aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/extras/Mesa/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/extras/Mesa/src/mesa/drivers')
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/common/descrip.mms37
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile34
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile.template109
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/depthtmp.h253
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.c1073
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.h555
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.c98
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.h39
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/extension_helper.h5887
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.NX.original497
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.X.original496
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/memops.h17
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmio.h62
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmx.h560
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp.h328
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp2.h609
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp_common.h81
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/stenciltmp.h182
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.c1339
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.h327
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.c695
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.h119
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.c347
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.h69
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.c1002
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.h124
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h94
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/Makefile96
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/de.po231
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/es.po219
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/fr.po225
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py191
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/nl.po230
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/options.h462
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/t_options.h230
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/Doxyfile232
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/Makefile21
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_dri.c786
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_egl.c881
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/Makefile36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.c159
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.h8
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.c354
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.h9
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_context.h306
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.c119
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.h36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.c245
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.h8
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_fifo.h28
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_fog.c73
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.c111
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.h18
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_linetmp.h81
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h37
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.c93
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.h15
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_pointtmp.h55
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_rendertmp.h646
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.c135
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.h10
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.c1223
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.h13
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.c226
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.h8
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.c53
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.h34
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.c945
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.h26
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tritmp.h239
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.c209
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.h45
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vbtmp.h151
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c427
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.h8
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.c753
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.h26
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_dac.h367
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_drishare.h48
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_regs.h509
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/Makefile35
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_client.h6185
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.c226
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.h403
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_dd.c128
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_inithw.c551
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_lock.c59
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_lock.h84
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_macros.h324
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_regs.h659
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_render.c220
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_screen.c147
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_screen.h30
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_span.c313
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_state.c1730
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tex.c433
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texmem.c535
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texstate.c216
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tris.c659
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tris.h36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tritmp.h497
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_vb.c362
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_vb.h60
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_xmesa.c266
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_common.h64
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_dri.h123
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/Makefile32
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810_3d_reg.h636
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.c572
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.h252
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.c511
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.h49
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810render.c173
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.c471
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.h99
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.c201
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.h14
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.c1025
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.h15
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c564
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.h78
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texmem.c183
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texstate.c746
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.c871
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.h36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.c489
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.h60
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_common.h192
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_dri.c975
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_dri.h128
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_reg.h992
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/Makefile31
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_3d_reg.h677
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c626
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.h327
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.c415
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.h48
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.c841
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.h105
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_render.c226
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c557
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.h113
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.c427
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.h51
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.c1707
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.h68
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c700
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.h70
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c237
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c716
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.c1056
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.h37
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_common.h288
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_dri.h140
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/Makefile47
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.c122
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.h215
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_metaops.c733
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_reg.h641
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_state.c1089
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_tex.c345
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texblend.c465
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c483
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_vtbl.c456
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.c181
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.h351
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_debug.c299
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_fragprog.c1065
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_metaops.c516
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.c466
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.h163
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_reg.h833
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_state.c954
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_tex.c182
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texprog.c668
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c922
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_vtbl.c353
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.c688
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.h123
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c712
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h519
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.c607
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.h66
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_pixel.c490
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_reg.h84
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_render.c240
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c511
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h101
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.c379
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.h41
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_state.c285
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c831
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.h42
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.c920
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.h46
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_common.h169
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_dri.h69
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/Makefile33
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.c338
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.h405
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.c135
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.h36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.c912
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.h148
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.c93
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.h104
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vb.c257
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h562
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_reg.h406
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.c553
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.h78
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.c231
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.h41
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.c1216
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.h47
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.c610
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.h99
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texmem.c867
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texstate.c558
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.c1921
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.h43
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.c642
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.h77
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vbtmp.h770
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/server/mach64_dri.h126
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Doxyfile234
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Makefile34
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/README26
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texcombine.c672
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texstate.c902
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c1020
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.h155
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgacontext.h372
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.c98
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.h36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.c743
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.h111
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.c664
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.h36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaregs.h1395
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgarender.c172
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.c312
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.h40
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.c1237
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.h39
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.c538
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.h51
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatexmem.c278
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.c912
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.h52
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.c480
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.h66
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga.h115
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_bios.h143
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.c1089
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.h113
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_macros.h118
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_reg.h484
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/Makefile32
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.c364
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.h269
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.c148
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.h41
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.c813
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.h144
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.c123
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.h108
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.c547
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.h84
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.c368
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.h46
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.c1261
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.h51
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.c617
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.h85
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texmem.c301
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texobj.h68
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texstate.c648
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.c769
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.h48
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/pci_ids.h57
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128.h465
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.c1113
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.h103
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_macros.h135
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_reg.h1394
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_version.h60
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Doxyfile232
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Makefile62
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_cmdbuf.c423
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c694
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.h995
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.c966
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.h215
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.c127
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.h107
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.c15
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.h44
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos_arrays.c530
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.c492
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.h40
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_reg.h1454
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.c1341
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.h8
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c737
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.h106
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.c367
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.h46
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.c2383
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.h67
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state_init.c798
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.c957
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.h76
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c583
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.h69
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c1183
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.h47
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c526
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c1468
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.c1227
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.h123
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c1002
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c234
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c440
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S495
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/Makefile83
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/pixel_shader.h103
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_context.h822
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_ioctl.h204
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_reg.h1423
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_sanity.h7
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_state.h58
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tcl.h50
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tex.h51
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c655
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.h118
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.c453
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.h844
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_emit.h282
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h294
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.c1090
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.h49
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog_swz.c1343
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c774
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.h62
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.c561
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.h49
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_program.h151
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_reg.h1387
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_render.c726
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_shader.c112
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.c2321
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.h69
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.c1051
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.h51
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texmem.c514
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.c270
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.h9
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texstate.c1465
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_vertexprog.c952
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.c312
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.h249
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.c372
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.h53
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.c166
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.h122
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.c879
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.h112
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.c391
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.h46
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.c245
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.h45
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/vertex_shader.h91
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/Makefile42
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_compat.c302
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c630
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.h868
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.c1283
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.h217
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lighting.c682
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.c135
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.h108
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.c12
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.h44
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c604
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h284
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_verts.c367
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.c1070
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.h8
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c656
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.h103
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.c346
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.h46
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.c2295
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.h74
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state_init.c572
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.c983
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.h69
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c489
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.h66
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c866
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.h50
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c404
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c1171
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c1093
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h120
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c922
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c232
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c437
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxtmp_x86.S494
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon.h202
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.c1336
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.h116
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_egl.c978
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_macros.h129
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_reg.h2142
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/Makefile36
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_common.h83
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.c258
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.h444
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dd.c108
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dri.h143
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_inithw.c79
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.c62
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.h99
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_macros.h229
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_regs.h367
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c203
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.c99
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.h39
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_span.c334
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_state.c888
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.c554
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.h28
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texmem.c582
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texstate.c300
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.c850
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.h11
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tritmp.h958
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.c339
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.h39
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_xmesa.c362
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3virgetri.h383
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/Makefile30
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_3d_reg.h699
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_bci.h612
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_init.h168
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_xmesa.c1056
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagecontext.h331
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.c119
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.h32
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.c657
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.h203
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagerender.c370
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.c343
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.h137
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.c1765
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.h41
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.c2133
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.h83
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.c1297
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.h49
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/server/savage_dri.h76
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/Makefile35
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_common.h63
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_dri.h85
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.c243
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.h44
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_clear.c451
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_common2.h140
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.c523
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.h440
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.c181
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.h39
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.c156
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.h45
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_fog.c190
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.c76
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.h87
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_reg.h868
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.c468
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.h62
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.c237
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.h46
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.c853
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.h54
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.c185
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.h37
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.c484
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.h38
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_texstate.c672
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.c1071
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.h71
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tritmp.h70
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/BUGS64
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/Makefile37
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S84
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h314
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/dri_glide.h60
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c471
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h28
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.c1028
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.h1007
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.c322
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.h45
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_glide.h606
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.c90
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.h144
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.c689
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.h77
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.c808
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.h50
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.c492
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.h73
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.c1427
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.h49
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.c1449
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.h61
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.c1914
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.h102
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.c994
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.h84
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.c2209
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.h44
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.c1293
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.h42
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.c353
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.h69
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h266
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/Makefile26
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.c472
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.h242
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dd.c127
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dri.h28
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_lock.h11
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_state.c555
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_tris.c1125
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_vb.c434
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/Makefile32
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via.h11
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.c1252
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.h78
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_driver.h309
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_priv.h70
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_regs.h197
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_3d_reg.h1652
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.c782
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.h412
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_drmclient.h29
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.c243
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.h42
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.c970
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.h135
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_memcpy.c138
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_render.c131
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.c491
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.h95
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.c289
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.h37
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.c1550
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.h39
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.c970
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.h41
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_texcombine.c424
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.c1190
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.h35
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/Makefile89
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.c487
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.h12
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/fbdev/glfbdev.c861
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxapi.c951
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxdd.c2197
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddspan.c663
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddtex.c1849
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxdrv.h771
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxg.c2309
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxg.h382
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxglidew.c269
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxglidew.h228
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxsetup.c2217
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxsetup.h850
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxtexman.c874
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxtris.c1834
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxvb.c838
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/glide/fxvbtmp.h369
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/osmesa/Makefile.win39
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/osmesa/descrip.mms41
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.c1333
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.def13
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/descrip.mms51
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/fakeglx.c2886
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.c1348
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.h223
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.c180
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.h326
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.c377
-rw-r--r--nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.h41
597 files changed, 0 insertions, 260451 deletions
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/common/descrip.mms b/nx-X11/extras/Mesa/src/mesa/drivers/common/descrip.mms
deleted file mode 100644
index aa4b8ae21..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/common/descrip.mms
+++ /dev/null
@@ -1,37 +0,0 @@
-# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 16 June 2003
-
-.first
- define gl [----.include.gl]
- define math [--.math]
- define swrast [--.swrast]
-
-.include [----]mms-config.
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = [----.include],[--.main],[--.glapi],[--.shader]
-LIBDIR = [----.lib]
-CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)
-
-SOURCES = driverfuncs.c
-
-OBJECTS =driverfuncs.obj
-
-##### RULES #####
-
-VERSION=Mesa V3.4
-
-##### TARGETS #####
-# Make the library
-$(LIBDIR)$(GL_LIB) : $(OBJECTS)
- @ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
-
-clean :
- purge
- delete *.obj;*
-
-driverfuncs.obj : driverfuncs.c
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile
deleted file mode 100644
index 8db675431..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-# src/mesa/drivers/dri/Makefile
-
-TOP = ../../../..
-
-include $(TOP)/configs/current
-
-
-
-default: $(LIB_DIR) subdirs
-
-
-$(LIB_DIR):
- -mkdir $(LIB_DIR)
-
-
-subdirs:
- echo $(DRI_DIRS)
- @for dir in $(DRI_DIRS) ; do \
- echo $$dir ; \
- (cd $$dir ; $(MAKE)) || exit 1; \
- done
-
-
-install:
- @for dir in $(DRI_DIRS) ; do \
- (cd $$dir ; $(MAKE) install) || exit 1; \
- done
-
-
-clean:
- @for dir in $(DRI_DIRS) ; do \
- (cd $$dir ; $(MAKE) clean) ; \
- done
- -rm -f common/*.o
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile.template b/nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile.template
deleted file mode 100644
index c8fef8aac..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/Makefile.template
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*-makefile-*-
-
-MESA_MODULES = $(TOP)/src/mesa/mesa.a
-
-COMMON_SOURCES = \
- ../../common/driverfuncs.c \
- ../common/utils.c \
- ../common/texmem.c \
- ../common/vblank.c \
- ../common/dri_util.c \
- ../common/xmlconfig.c \
- ../common/drirenderbuffer.c
-
-ifeq ($(WINDOW_SYSTEM),dri)
-WINOBJ=
-WINLIB=
-INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) \
- `pkg-config --cflags libdrm`
-
-OBJECTS = $(C_SOURCES:.c=.o) \
- $(ASM_SOURCES:.S=.o)
-
-else
-WINOBJ=
-WINLIB=-L$(MESA)/src/glx/mini
-MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
-INCLUDES = $(MINIGLX_INCLUDES) \
- -I$(DRM_SOURCE_PATH)/shared-core \
- -I$(DRM_SOURCE_PATH)/libdrm \
- $(SHARED_INCLUDES)
-
-OBJECTS = $(C_SOURCES:.c=.o) \
- $(MINIGLX_SOURCES:.c=.o) \
- $(ASM_SOURCES:.S=.o)
-endif
-
-
-### Include directories
-SHARED_INCLUDES = \
- -I. \
- -I$(TOP)/src/mesa/drivers/dri/common \
- -Iserver \
- -I$(DRM_SOURCE_PATH)/shared-core \
- -I$(TOP)/include \
- -I$(TOP)/include/GL/internal \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa/math \
- -I$(TOP)/src/mesa/transform \
- -I$(TOP)/src/mesa/shader \
- -I$(TOP)/src/mesa/swrast \
- -I$(TOP)/src/mesa/swrast_setup \
- -I$(TOP)/src/egl/main \
- -I$(TOP)/src/egl/drivers/dri
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend symlinks $(LIBNAME) $(LIB_DIR)/$(LIBNAME)
-
-
-#$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile
-# @echo BUILDING FOR: $(WINDOW_SYSTEM)
-# $(TOP)/bin/mklib -o $(LIBNAME) -noprefix -install $(LIB_DIR) \
-# $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES) $(OBJECTS)
-
-# XXX we should use the mklib script here
-$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
- rm -f $@
- $(CC) $(ARCH_FLAGS) -o $@ -shared $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
-
-
-$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
- install $(LIBNAME) $(LIB_DIR)
-
-
-
-# Run 'make depend' to update the dependencies if you change
-# what's included by any source file.
-.PHONY: depend
-depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES) \
- > /dev/null
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean:
- -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
- -rm -f depend depend.bak
-
-install: $(LIBNAME)
- install $(LIBNAME) /usr/X11R6/lib/modules/dri/$(LIBNAME)
-
-include depend
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/depthtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/depthtmp.h
deleted file mode 100644
index 1875d157b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/depthtmp.h
+++ /dev/null
@@ -1,253 +0,0 @@
-
-/*
- * Notes:
- * 1. These functions plug into the gl_renderbuffer structure.
- * 2. The 'values' parameter always points to GLuint values, regardless of
- * the actual Z buffer depth.
- */
-
-
-#include "spantmp_common.h"
-
-#ifndef DBG
-#define DBG 0
-#endif
-
-#ifndef HAVE_HW_DEPTH_SPANS
-#define HAVE_HW_DEPTH_SPANS 0
-#endif
-
-#ifndef HAVE_HW_DEPTH_PIXELS
-#define HAVE_HW_DEPTH_PIXELS 0
-#endif
-
-static void TAG(WriteDepthSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLuint *depth = (const GLuint *) values;
- GLint x1;
- GLint n1;
- LOCAL_DEPTH_VARS;
-
- y = Y_FLIP( y );
-
-#if HAVE_HW_DEPTH_SPANS
- (void) x1; (void) n1;
-
- if ( DBG ) fprintf( stderr, "WriteDepthSpan 0..%d (x1 %d)\n",
- (int)n, (int)x );
-
- WRITE_DEPTH_SPAN();
-#else
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN( x, y, n, x1, n1, i );
-
- if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d) (mask %p)\n",
- (int)i, (int)n1, (int)x1, mask );
-
- if ( mask ) {
- for ( ; n1>0 ; i++, x1++, n1-- ) {
- if ( mask[i] ) WRITE_DEPTH( x1, y, depth[i] );
- }
- } else {
- for ( ; n1>0 ; i++, x1++, n1-- ) {
- WRITE_DEPTH( x1, y, depth[i] );
- }
- }
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_WRITE_UNLOCK();
-}
-
-
-#if HAVE_HW_DEPTH_SPANS
-/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */
-static void
-TAG(WriteMonoDepthSpan)( 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;
- TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask);
-}
-#else
-static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *value,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLuint depth = *((GLuint *) value);
- GLint x1;
- GLint n1;
- LOCAL_DEPTH_VARS;
-
- y = Y_FLIP( y );
-
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN( x, y, n, x1, n1, i );
-
- if ( DBG ) fprintf( stderr, "%s %d..%d (x1 %d) = %u\n",
- __FUNCTION__, (int)i, (int)n1, (int)x1, (GLuint)depth );
-
- if ( mask ) {
- for ( ; n1>0 ; i++, x1++, n1-- ) {
- if ( mask[i] ) WRITE_DEPTH( x1, y, depth );
- }
- } else {
- for ( ; n1>0 ; x1++, n1-- ) {
- WRITE_DEPTH( x1, y, depth );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-#endif
-
-
-static void TAG(WriteDepthPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const void *values,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLuint *depth = (const GLuint *) values;
- GLuint i;
- LOCAL_DEPTH_VARS;
-
- if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" );
-
-#if HAVE_HW_DEPTH_PIXELS
- (void) i;
-
- WRITE_DEPTH_PIXELS();
-#else
- HW_CLIPLOOP()
- {
- if ( mask ) {
- for ( i = 0 ; i < n ; i++ ) {
- if ( mask[i] ) {
- const int fy = Y_FLIP( y[i] );
- if ( CLIPPIXEL( x[i], fy ) )
- WRITE_DEPTH( x[i], fy, depth[i] );
- }
- }
- }
- else {
- for ( i = 0 ; i < n ; i++ ) {
- const int fy = Y_FLIP( y[i] );
- if ( CLIPPIXEL( x[i], fy ) )
- WRITE_DEPTH( x[i], fy, depth[i] );
- }
- }
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_WRITE_UNLOCK();
-}
-
-
-/* Read depth spans and pixels
- */
-static void TAG(ReadDepthSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values )
-{
- HW_READ_LOCK()
- {
- GLuint *depth = (GLuint *) values;
- GLint x1, n1;
- LOCAL_DEPTH_VARS;
-
- y = Y_FLIP( y );
-
- if ( DBG ) fprintf( stderr, "ReadDepthSpan\n" );
-
-#if HAVE_HW_DEPTH_SPANS
- (void) x1; (void) n1;
-
- READ_DEPTH_SPAN();
-#else
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN( x, y, n, x1, n1, i );
- for ( ; n1>0 ; i++, n1-- ) {
- READ_DEPTH( depth[i], x+i, y );
- }
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_READ_UNLOCK();
-}
-
-static void TAG(ReadDepthPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- void *values )
-{
- HW_READ_LOCK()
- {
- GLuint *depth = (GLuint *) values;
- GLuint i;
- LOCAL_DEPTH_VARS;
-
- if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" );
-
-#if HAVE_HW_DEPTH_PIXELS
- (void) i;
-
- READ_DEPTH_PIXELS();
-#else
- HW_CLIPLOOP()
- {
- for ( i = 0 ; i < n ;i++ ) {
- int fy = Y_FLIP( y[i] );
- if ( CLIPPIXEL( x[i], fy ) )
- READ_DEPTH( depth[i], x[i], fy );
- }
- }
- HW_ENDCLIPLOOP();
-#endif
- }
- HW_READ_UNLOCK();
-}
-
-
-#if HAVE_HW_DEPTH_SPANS
-#undef WRITE_DEPTH_SPAN
-#undef WRITE_DEPTH_PIXELS
-#undef READ_DEPTH_SPAN
-#undef READ_DEPTH_PIXELS
-#else
-#undef WRITE_DEPTH
-#undef READ_DEPTH
-#endif
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.c
deleted file mode 100644
index 3edeb03f9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.c
+++ /dev/null
@@ -1,1073 +0,0 @@
-/* $XFree86: xc/lib/GL/dri/dri_util.c,v 1.7 2003/04/28 17:01:25 dawes Exp $ */
-/**
- * \file dri_util.c
- * DRI utility functions.
- *
- * This module acts as glue between GLX and the actual hardware driver. A DRI
- * driver doesn't really \e have to use any of this - it's optional. But, some
- * useful stuff is done here that otherwise would have to be duplicated in most
- * drivers.
- *
- * Basically, these utility functions take care of some of the dirty details of
- * screen initialization, context creation, context binding, DRM setup, etc.
- *
- * These functions are compiled into each DRI driver so libGL.so knows nothing
- * about them.
- */
-
-
-#include <assert.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <stdio.h>
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-#include "imports.h"
-#define None 0
-
-#include "dri_util.h"
-#include "drm_sarea.h"
-
-#ifndef GLX_OML_sync_control
-typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid drawable, int32_t *numerator, int32_t *denominator);
-#endif
-
-/* This pointer *must* be set by the driver's __driCreateNewScreen funciton!
- */
-const __DRIinterfaceMethods * dri_interface = NULL;
-
-/**
- * This is used in a couple of places that call \c driCreateNewDrawable.
- */
-static const int empty_attribute_list[1] = { None };
-
-
-/**
- * Cached copy of the internal API version used by libGL and the client-side
- * DRI driver.
- */
-static int api_ver = 0;
-
-/* forward declarations */
-static int driQueryFrameTracking( __DRInativeDisplay * dpy, void * priv,
- int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage,
- float * usage );
-
-static void *driCreateNewDrawable(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
- __DRIid draw, __DRIdrawable *pdraw, int renderType, const int *attrs);
-
-static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate);
-
-
-/**
- * Print message to \c stderr if the \c LIBGL_DEBUG environment variable
- * is set.
- *
- * Is called from the drivers.
- *
- * \param f \c printf like format string.
- */
-void
-__driUtilMessage(const char *f, ...)
-{
- va_list args;
-
- if (getenv("LIBGL_DEBUG")) {
- fprintf(stderr, "libGL error: \n");
- va_start(args, f);
- vfprintf(stderr, f, args);
- va_end(args);
- fprintf(stderr, "\n");
- }
-}
-
-
-/*****************************************************************/
-/** \name Drawable list management */
-/*****************************************************************/
-/*@{*/
-
-static GLboolean __driAddDrawable(void *drawHash, __DRIdrawable *pdraw)
-{
- __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private;
-
- if (drmHashInsert(drawHash, pdp->draw, pdraw))
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-static __DRIdrawable *__driFindDrawable(void *drawHash, __DRIid draw)
-{
- int retcode;
- __DRIdrawable *pdraw;
-
- retcode = drmHashLookup(drawHash, draw, (void *)&pdraw);
- if (retcode)
- return NULL;
-
- return pdraw;
-}
-
-
-/**
- * Find drawables in the local hash that have been destroyed on the
- * server.
- *
- * \param drawHash Hash-table containing all know drawables.
- */
-static void __driGarbageCollectDrawables(void *drawHash)
-{
- __DRIid draw;
- __DRInativeDisplay *dpy;
- __DRIdrawable *pdraw;
-
- if (drmHashFirst(drawHash, &draw, (void *)&pdraw) == 1) {
- do {
- __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private;
- dpy = pdp->driScreenPriv->display;
- if (! (*dri_interface->windowExists)(dpy, draw)) {
- /* Destroy the local drawable data, if the drawable no
- longer exists in the Xserver */
- (*pdraw->destroyDrawable)(dpy, pdraw->private);
- _mesa_free(pdraw);
- }
- } while (drmHashNext(drawHash, &draw, (void *)&pdraw) == 1);
- }
-}
-
-/*@}*/
-
-
-/*****************************************************************/
-/** \name Context (un)binding functions */
-/*****************************************************************/
-/*@{*/
-
-/**
- * Unbind context.
- *
- * \param dpy the display handle.
- * \param scrn the screen number.
- * \param draw drawable.
- * \param read Current reading drawable.
- * \param gc context.
- *
- * \return \c GL_TRUE on success, or \c GL_FALSE on failure.
- *
- * \internal
- * This function calls __DriverAPIRec::UnbindContext, and then decrements
- * __DRIdrawablePrivateRec::refcount which must be non-zero for a successful
- * return.
- *
- * While casting the opaque private pointers associated with the parameters
- * into their respective real types it also assures they are not \c NULL.
- */
-static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn,
- __DRIid draw, __DRIid read,
- __DRIcontext *ctx)
-{
- __DRIscreen *pDRIScreen;
- __DRIdrawable *pdraw;
- __DRIdrawable *pread;
- __DRIcontextPrivate *pcp;
- __DRIscreenPrivate *psp;
- __DRIdrawablePrivate *pdp;
- __DRIdrawablePrivate *prp;
-
- /*
- ** Assume error checking is done properly in glXMakeCurrent before
- ** calling driUnbindContext.
- */
-
- if (ctx == NULL || draw == None || read == None) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- pDRIScreen = (*dri_interface->getScreen)(dpy, scrn);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- psp = (__DRIscreenPrivate *)pDRIScreen->private;
- pcp = (__DRIcontextPrivate *)ctx->private;
-
- pdraw = __driFindDrawable(psp->drawHash, draw);
- if (!pdraw) {
- /* ERROR!!! */
- return GL_FALSE;
- }
- pdp = (__DRIdrawablePrivate *)pdraw->private;
-
- pread = __driFindDrawable(psp->drawHash, read);
- if (!pread) {
- /* ERROR!!! */
- return GL_FALSE;
- }
- prp = (__DRIdrawablePrivate *)pread->private;
-
-
- /* Let driver unbind drawable from context */
- (*psp->DriverAPI.UnbindContext)(pcp);
-
-
- if (pdp->refcount == 0) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- pdp->refcount--;
-
- if (prp != pdp) {
- if (prp->refcount == 0) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- prp->refcount--;
- }
-
-
- /* XXX this is disabled so that if we call SwapBuffers on an unbound
- * window we can determine the last context bound to the window and
- * use that context's lock. (BrianP, 2-Dec-2000)
- */
-#if 0
- /* Unbind the drawable */
- pcp->driDrawablePriv = NULL;
- pdp->driContextPriv = &psp->dummyContextPriv;
-#endif
-
- return GL_TRUE;
-}
-
-
-/**
- * This function takes both a read buffer and a draw buffer. This is needed
- * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent
- * function.
- *
- * \bug This function calls \c driCreateNewDrawable in two places with the
- * \c renderType hard-coded to \c GLX_WINDOW_BIT. Some checking might
- * be needed in those places when support for pbuffers and / or pixmaps
- * is added. Is it safe to assume that the drawable is a window?
- */
-static GLboolean DoBindContext(__DRInativeDisplay *dpy,
- __DRIid draw, __DRIid read,
- __DRIcontext *ctx, const __GLcontextModes * modes,
- __DRIscreenPrivate *psp)
-{
- __DRIdrawable *pdraw;
- __DRIdrawablePrivate *pdp;
- __DRIdrawable *pread;
- __DRIdrawablePrivate *prp;
- __DRIcontextPrivate * const pcp = ctx->private;
-
-
- /* Find the _DRIdrawable which corresponds to the writing drawable. */
- pdraw = __driFindDrawable(psp->drawHash, draw);
- if (!pdraw) {
- /* Allocate a new drawable */
- pdraw = (__DRIdrawable *)_mesa_malloc(sizeof(__DRIdrawable));
- if (!pdraw) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- /* Create a new drawable */
- driCreateNewDrawable(dpy, modes, draw, pdraw, GLX_WINDOW_BIT,
- empty_attribute_list);
- if (!pdraw->private) {
- /* ERROR!!! */
- _mesa_free(pdraw);
- return GL_FALSE;
- }
-
- }
- pdp = (__DRIdrawablePrivate *) pdraw->private;
-
- /* Find the _DRIdrawable which corresponds to the reading drawable. */
- if (read == draw) {
- /* read buffer == draw buffer */
- prp = pdp;
- }
- else {
- pread = __driFindDrawable(psp->drawHash, read);
- if (!pread) {
- /* Allocate a new drawable */
- pread = (__DRIdrawable *)_mesa_malloc(sizeof(__DRIdrawable));
- if (!pread) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- /* Create a new drawable */
- driCreateNewDrawable(dpy, modes, read, pread, GLX_WINDOW_BIT,
- empty_attribute_list);
- if (!pread->private) {
- /* ERROR!!! */
- _mesa_free(pread);
- return GL_FALSE;
- }
- }
- prp = (__DRIdrawablePrivate *) pread->private;
- }
-
- /* Bind the drawable to the context */
- pcp->driDrawablePriv = pdp;
- pdp->driContextPriv = pcp;
- pdp->refcount++;
- if ( pdp != prp ) {
- prp->refcount++;
- }
-
- /*
- ** Now that we have a context associated with this drawable, we can
- ** initialize the drawable information if has not been done before.
- */
- if (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp) {
- DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
- __driUtilUpdateDrawableInfo(pdp);
- DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
- }
-
- /* Call device-specific MakeCurrent */
- (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
-
- return GL_TRUE;
-}
-
-
-/**
- * This function takes both a read buffer and a draw buffer. This is needed
- * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent
- * function.
- */
-static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn,
- __DRIid draw, __DRIid read,
- __DRIcontext * ctx)
-{
- __DRIscreen *pDRIScreen;
-
- /*
- ** Assume error checking is done properly in glXMakeCurrent before
- ** calling driBindContext.
- */
-
- if (ctx == NULL || draw == None || read == None) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- pDRIScreen = (*dri_interface->getScreen)(dpy, scrn);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- return DoBindContext( dpy, draw, read, ctx, ctx->mode,
- (__DRIscreenPrivate *)pDRIScreen->private );
-}
-/*@}*/
-
-
-/*****************************************************************/
-/** \name Drawable handling functions */
-/*****************************************************************/
-/*@{*/
-
-/**
- * Update private drawable information.
- *
- * \param pdp pointer to the private drawable information to update.
- *
- * This function basically updates the __DRIdrawablePrivate struct's
- * cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo.
- * This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which
- * compares the __DRIdrwablePrivate pStamp and lastStamp values. If
- * the values are different that means we have to update the clipping
- * info.
- */
-void
-__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
-{
- __DRIscreenPrivate *psp;
- __DRIcontextPrivate *pcp = pdp->driContextPriv;
-
- if (!pcp || (pdp != pcp->driDrawablePriv)) {
- /* ERROR!!! */
- return;
- }
-
- psp = pdp->driScreenPriv;
- if (!psp) {
- /* ERROR!!! */
- return;
- }
-
- if (pdp->pClipRects) {
- _mesa_free(pdp->pClipRects);
- }
-
- if (pdp->pBackClipRects) {
- _mesa_free(pdp->pBackClipRects);
- }
-
- DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-
- if (!__driFindDrawable(psp->drawHash, pdp->draw) ||
- ! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw,
- &pdp->index, &pdp->lastStamp,
- &pdp->x, &pdp->y, &pdp->w, &pdp->h,
- &pdp->numClipRects, &pdp->pClipRects,
- &pdp->backX,
- &pdp->backY,
- &pdp->numBackClipRects,
- &pdp->pBackClipRects )) {
- /* Error -- eg the window may have been destroyed. Keep going
- * with no cliprects.
- */
- pdp->pStamp = &pdp->lastStamp; /* prevent endless loop */
- pdp->numClipRects = 0;
- pdp->pClipRects = NULL;
- pdp->numBackClipRects = 0;
- pdp->pBackClipRects = NULL;
- }
- else
- pdp->pStamp = &(psp->pSAREA->drawableTable[pdp->index].stamp);
-
- DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-
-}
-
-/*@}*/
-
-/*****************************************************************/
-/** \name GLX callbacks */
-/*****************************************************************/
-/*@{*/
-
-/**
- * Swap buffers.
- *
- * \param dpy the display handle.
- * \param drawablePrivate opaque pointer to the per-drawable private info.
- *
- * \internal
- * This function calls __DRIdrawablePrivate::swapBuffers.
- *
- * Is called directly from glXSwapBuffers().
- */
-static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate )
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- dPriv->swapBuffers(dPriv);
- (void) dpy;
-}
-
-/**
- * Called directly from a number of higher-level GLX functions.
- */
-static int driGetMSC( void *screenPrivate, int64_t *msc )
-{
- __DRIscreenPrivate *sPriv = (__DRIscreenPrivate *) screenPrivate;
-
- return sPriv->DriverAPI.GetMSC( sPriv, msc );
-}
-
-/**
- * Called directly from a number of higher-level GLX functions.
- */
-static int driGetSBC( __DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc )
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- __DRIswapInfo sInfo;
- int status;
-
-
- status = dPriv->driScreenPriv->DriverAPI.GetSwapInfo( dPriv, & sInfo );
- *sbc = sInfo.swap_count;
-
- return status;
-}
-
-static int driWaitForSBC( __DRInativeDisplay * dpy, void *drawablePriv,
- int64_t target_sbc,
- int64_t * msc, int64_t * sbc )
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv;
-
- return dPriv->driScreenPriv->DriverAPI.WaitForSBC( dPriv, target_sbc,
- msc, sbc );
-}
-
-static int driWaitForMSC( __DRInativeDisplay * dpy, void *drawablePriv,
- int64_t target_msc,
- int64_t divisor, int64_t remainder,
- int64_t * msc, int64_t * sbc )
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv;
- __DRIswapInfo sInfo;
- int status;
-
-
- status = dPriv->driScreenPriv->DriverAPI.WaitForMSC( dPriv, target_msc,
- divisor, remainder,
- msc );
-
- /* GetSwapInfo() may not be provided by the driver if GLX_SGI_video_sync
- * is supported but GLX_OML_sync_control is not. Therefore, don't return
- * an error value if GetSwapInfo() is not implemented.
- */
- if ( status == 0
- && dPriv->driScreenPriv->DriverAPI.GetSwapInfo ) {
- status = dPriv->driScreenPriv->DriverAPI.GetSwapInfo( dPriv, & sInfo );
- *sbc = sInfo.swap_count;
- }
-
- return status;
-}
-
-static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv,
- int64_t target_msc,
- int64_t divisor, int64_t remainder )
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv;
-
- return dPriv->driScreenPriv->DriverAPI.SwapBuffersMSC( dPriv, target_msc,
- divisor,
- remainder );
-}
-
-
-/**
- * This is called via __DRIscreenRec's createNewDrawable pointer.
- */
-static void *driCreateNewDrawable(__DRInativeDisplay *dpy,
- const __GLcontextModes *modes,
- __DRIid draw,
- __DRIdrawable *pdraw,
- int renderType,
- const int *attrs)
-{
- __DRIscreen * const pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen);
- __DRIscreenPrivate *psp;
- __DRIdrawablePrivate *pdp;
-
-
- pdraw->private = NULL;
-
- /* Since pbuffers are not yet supported, no drawable attributes are
- * supported either.
- */
- (void) attrs;
-
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return NULL;
- }
-
- pdp = (__DRIdrawablePrivate *)_mesa_malloc(sizeof(__DRIdrawablePrivate));
- if (!pdp) {
- return NULL;
- }
-
- if (!(*dri_interface->createDrawable)(dpy, modes->screen, draw, &pdp->hHWDrawable)) {
- _mesa_free(pdp);
- return NULL;
- }
-
- pdp->draw = draw;
- pdp->pdraw = pdraw;
- pdp->refcount = 0;
- pdp->pStamp = NULL;
- pdp->lastStamp = 0;
- pdp->index = 0;
- pdp->x = 0;
- pdp->y = 0;
- pdp->w = 0;
- pdp->h = 0;
- pdp->numClipRects = 0;
- pdp->numBackClipRects = 0;
- pdp->pClipRects = NULL;
- pdp->pBackClipRects = NULL;
- pdp->display = dpy;
- pdp->screen = modes->screen;
-
- psp = (__DRIscreenPrivate *)pDRIScreen->private;
- pdp->driScreenPriv = psp;
- pdp->driContextPriv = &psp->dummyContextPriv;
-
- if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes,
- renderType == GLX_PIXMAP_BIT)) {
- (void)(*dri_interface->destroyDrawable)(dpy, modes->screen, pdp->draw);
- _mesa_free(pdp);
- return NULL;
- }
-
- pdraw->private = pdp;
- pdraw->destroyDrawable = driDestroyDrawable;
- pdraw->swapBuffers = driSwapBuffers; /* called by glXSwapBuffers() */
-
- pdraw->getSBC = driGetSBC;
- pdraw->waitForSBC = driWaitForSBC;
- pdraw->waitForMSC = driWaitForMSC;
- pdraw->swapBuffersMSC = driSwapBuffersMSC;
- pdraw->frameTracking = NULL;
- pdraw->queryFrameTracking = driQueryFrameTracking;
-
- /* This special default value is replaced with the configured
- * default value when the drawable is first bound to a direct
- * rendering context.
- */
- pdraw->swap_interval = (unsigned)-1;
-
- pdp->swapBuffers = psp->DriverAPI.SwapBuffers;
-
- /* Add pdraw to drawable list */
- if (!__driAddDrawable(psp->drawHash, pdraw)) {
- /* ERROR!!! */
- (*pdraw->destroyDrawable)(dpy, pdp);
- _mesa_free(pdp);
- pdp = NULL;
- pdraw->private = NULL;
- }
-
- return (void *) pdp;
-}
-
-static __DRIdrawable *driGetDrawable(__DRInativeDisplay *dpy, __DRIid draw,
- void *screenPrivate)
-{
- __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate;
-
- /*
- ** Make sure this routine returns NULL if the drawable is not bound
- ** to a direct rendering context!
- */
- return __driFindDrawable(psp->drawHash, draw);
-}
-
-static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate)
-{
- __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawablePrivate;
- __DRIscreenPrivate *psp = pdp->driScreenPriv;
- int scrn = psp->myNum;
-
- if (pdp) {
- (*psp->DriverAPI.DestroyBuffer)(pdp);
- if ((*dri_interface->windowExists)(dpy, pdp->draw))
- (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw);
- drmHashDelete(psp->drawHash, pdp->draw);
- if (pdp->pClipRects) {
- _mesa_free(pdp->pClipRects);
- pdp->pClipRects = NULL;
- }
- if (pdp->pBackClipRects) {
- _mesa_free(pdp->pBackClipRects);
- pdp->pBackClipRects = NULL;
- }
- _mesa_free(pdp);
- }
-}
-
-/*@}*/
-
-
-/*****************************************************************/
-/** \name Context handling functions */
-/*****************************************************************/
-/*@{*/
-
-/**
- * Destroy the per-context private information.
- *
- * \param dpy the display handle.
- * \param scrn the screen number.
- * \param contextPrivate opaque pointer to the per-drawable private info.
- *
- * \internal
- * This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls
- * drmDestroyContext(), and finally frees \p contextPrivate.
- */
-static void driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate)
-{
- __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate;
-
- if (pcp) {
- (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
- __driGarbageCollectDrawables(pcp->driScreenPriv->drawHash);
- (void) (*dri_interface->destroyContext)(dpy, scrn, pcp->contextID);
- _mesa_free(pcp);
- }
-}
-
-
-/**
- * Create the per-drawable private driver information.
- *
- * \param dpy The display handle.
- * \param modes Mode used to create the new context.
- * \param render_type Type of rendering target. \c GLX_RGBA is the only
- * type likely to ever be supported for direct-rendering.
- * \param sharedPrivate The shared context dependent methods or \c NULL if
- * non-existent.
- * \param pctx DRI context to receive the context dependent methods.
- *
- * \returns An opaque pointer to the per-context private information on
- * success, or \c NULL on failure.
- *
- * \internal
- * This function allocates and fills a __DRIcontextPrivateRec structure. It
- * performs some device independent initialization and passes all the
- * relevent information to __DriverAPIRec::CreateContext to create the
- * context.
- *
- */
-static void *
-driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
- int render_type, void *sharedPrivate, __DRIcontext *pctx)
-{
- __DRIscreen *pDRIScreen;
- __DRIcontextPrivate *pcp;
- __DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate;
- __DRIscreenPrivate *psp;
- void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL;
-
- pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- /* ERROR!!! */
- return NULL;
- }
-
- psp = (__DRIscreenPrivate *)pDRIScreen->private;
-
- pcp = (__DRIcontextPrivate *)_mesa_malloc(sizeof(__DRIcontextPrivate));
- if (!pcp) {
- return NULL;
- }
-
- if (! (*dri_interface->createContext)(dpy, modes->screen, modes->fbconfigID,
- &pcp->contextID, &pcp->hHWContext)) {
- _mesa_free(pcp);
- return NULL;
- }
-
- pcp->display = dpy;
- pcp->driScreenPriv = psp;
- pcp->driDrawablePriv = NULL;
-
- /* When the first context is created for a screen, initialize a "dummy"
- * context.
- */
-
- if (!psp->dummyContextPriv.driScreenPriv) {
- psp->dummyContextPriv.contextID = 0;
- psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context;
- psp->dummyContextPriv.driScreenPriv = psp;
- psp->dummyContextPriv.driDrawablePriv = NULL;
- psp->dummyContextPriv.driverPrivate = NULL;
- /* No other fields should be used! */
- }
-
- pctx->destroyContext = driDestroyContext;
- pctx->bindContext = driBindContext;
- pctx->unbindContext = driUnbindContext;
-
- if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) {
- (void) (*dri_interface->destroyContext)(dpy, modes->screen,
- pcp->contextID);
- _mesa_free(pcp);
- return NULL;
- }
-
- __driGarbageCollectDrawables(pcp->driScreenPriv->drawHash);
-
- return pcp;
-}
-/*@}*/
-
-
-/*****************************************************************/
-/** \name Screen handling functions */
-/*****************************************************************/
-/*@{*/
-
-/**
- * Destroy the per-screen private information.
- *
- * \param dpy the display handle.
- * \param scrn the screen number.
- * \param screenPrivate opaque pointer to the per-screen private information.
- *
- * \internal
- * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls
- * drmClose(), and finally frees \p screenPrivate.
- */
-static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPrivate)
-{
- __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate;
-
- if (psp) {
- /* No interaction with the X-server is possible at this point. This
- * routine is called after XCloseDisplay, so there is no protocol
- * stream open to the X-server anymore.
- */
-
- if (psp->DriverAPI.DestroyScreen)
- (*psp->DriverAPI.DestroyScreen)(psp);
-
- (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX);
- (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize);
- _mesa_free(psp->pDevPriv);
- (void)drmClose(psp->fd);
- if ( psp->modes != NULL ) {
- (*dri_interface->destroyContextModes)( psp->modes );
- }
- _mesa_free(psp);
- }
-}
-
-
-/**
- * Utility function used to create a new driver-private screen structure.
- *
- * \param dpy Display pointer
- * \param scrn Index of the screen
- * \param psc DRI screen data (not driver private)
- * \param modes Linked list of known display modes. This list is, at a
- * minimum, a list of modes based on the current display mode.
- * These roughly match the set of available X11 visuals, but it
- * need not be limited to X11! The calling libGL should create
- * a list that will inform the driver of the current display
- * mode (i.e., color buffer depth, depth buffer depth, etc.).
- * \param ddx_version Version of the 2D DDX. This may not be meaningful for
- * all drivers.
- * \param dri_version Version of the "server-side" DRI.
- * \param drm_version Version of the kernel DRM.
- * \param frame_buffer Data describing the location and layout of the
- * framebuffer.
- * \param pSAREA Pointer the the SAREA.
- * \param fd Device handle for the DRM.
- * \param internal_api_version Version of the internal interface between the
- * driver and libGL.
- * \param driverAPI Driver API functions used by other routines in dri_util.c.
- *
- * \note
- * There is no need to check the minimum API version in this function. Since
- * the \c __driCreateNewScreen function is versioned, it is impossible for a
- * loader that is too old to even load this driver.
- */
-__DRIscreenPrivate *
-__driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drm_sarea_t *pSAREA,
- int fd,
- int internal_api_version,
- const struct __DriverAPIRec *driverAPI)
-{
- __DRIscreenPrivate *psp;
-
-
- api_ver = internal_api_version;
-
- psp = (__DRIscreenPrivate *)_mesa_malloc(sizeof(__DRIscreenPrivate));
- if (!psp) {
- return NULL;
- }
-
- /* Create the hash table */
- psp->drawHash = drmHashCreate();
- if ( psp->drawHash == NULL ) {
- _mesa_free( psp );
- return NULL;
- }
-
- psp->display = dpy;
- psp->myNum = scrn;
- psp->psc = psc;
- psp->modes = modes;
-
- /*
- ** NOT_DONE: This is used by the X server to detect when the client
- ** has died while holding the drawable lock. The client sets the
- ** drawable lock to this value.
- */
- psp->drawLockID = 1;
-
- psp->drmMajor = drm_version->major;
- psp->drmMinor = drm_version->minor;
- psp->drmPatch = drm_version->patch;
- psp->ddxMajor = ddx_version->major;
- psp->ddxMinor = ddx_version->minor;
- psp->ddxPatch = ddx_version->patch;
- psp->driMajor = dri_version->major;
- psp->driMinor = dri_version->minor;
- psp->driPatch = dri_version->patch;
-
- /* install driver's callback functions */
- memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) );
-
- psp->pSAREA = pSAREA;
-
- psp->pFB = frame_buffer->base;
- psp->fbSize = frame_buffer->size;
- psp->fbStride = frame_buffer->stride;
- psp->fbWidth = frame_buffer->width;
- psp->fbHeight = frame_buffer->height;
- psp->devPrivSize = frame_buffer->dev_priv_size;
- psp->pDevPriv = frame_buffer->dev_priv;
- psp->fbBPP = psp->fbStride * 8 / frame_buffer->width;
-
- psp->fd = fd;
-
- /*
- ** Do not init dummy context here; actual initialization will be
- ** done when the first DRI context is created. Init screen priv ptr
- ** to NULL to let CreateContext routine that it needs to be inited.
- */
- psp->dummyContextPriv.driScreenPriv = NULL;
-
- psc->destroyScreen = driDestroyScreen;
- psc->createNewDrawable = driCreateNewDrawable;
- psc->getDrawable = driGetDrawable;
- psc->getMSC = driGetMSC;
- psc->createNewContext = driCreateNewContext;
-
- if ( (psp->DriverAPI.InitDriver != NULL)
- && !(*psp->DriverAPI.InitDriver)(psp) ) {
- _mesa_free( psp );
- return NULL;
- }
-
-
- return psp;
-}
-
-
-/**
- * Compare the current GLX API version with a driver supplied required version.
- *
- * The minimum required version is compared with the API version exported by
- * the \c __glXGetInternalVersion function (in libGL.so).
- *
- * \param required_version Minimum required internal GLX API version.
- * \return A tri-value return, as from strcmp is returned. A value less
- * than, equal to, or greater than zero will be returned if the
- * internal GLX API version is less than, equal to, or greater
- * than \c required_version.
- *
- * \sa __glXGetInternalVersion().
- */
-int driCompareGLXAPIVersion( GLint required_version )
-{
- if ( api_ver > required_version ) {
- return 1;
- }
- else if ( api_ver == required_version ) {
- return 0;
- }
-
- return -1;
-}
-
-
-static int
-driQueryFrameTracking( __DRInativeDisplay * dpy, void * priv,
- int64_t * sbc, int64_t * missedFrames,
- float * lastMissedUsage, float * usage )
-{
- __DRIswapInfo sInfo;
- int status;
- int64_t ust;
- __DRIdrawablePrivate * dpriv = (__DRIdrawablePrivate *) priv;
-
-
- status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo );
- if ( status == 0 ) {
- *sbc = sInfo.swap_count;
- *missedFrames = sInfo.swap_missed_count;
- *lastMissedUsage = sInfo.swap_missed_usage;
-
- (*dri_interface->getUST)( & ust );
- *usage = driCalculateSwapUsage( dpriv, sInfo.swap_ust, ust );
- }
-
- return status;
-}
-
-
-/**
- * Calculate amount of swap interval used between GLX buffer swaps.
- *
- * The usage value, on the range [0,max], is the fraction of total swap
- * interval time used between GLX buffer swaps is calculated.
- *
- * \f$p = t_d / (i * t_r)\f$
- *
- * Where \f$t_d\f$ is the time since the last GLX buffer swap, \f$i\f$ is the
- * swap interval (as set by \c glXSwapIntervalSGI), and \f$t_r\f$ time
- * required for a single vertical refresh period (as returned by \c
- * glXGetMscRateOML).
- *
- * See the documentation for the GLX_MESA_swap_frame_usage extension for more
- * details.
- *
- * \param dPriv Pointer to the private drawable structure.
- * \return If less than a single swap interval time period was required
- * between GLX buffer swaps, a number greater than 0 and less than
- * 1.0 is returned. If exactly one swap interval time period is
- * required, 1.0 is returned, and if more than one is required then
- * a number greater than 1.0 will be returned.
- *
- * \sa glXSwapIntervalSGI glXGetMscRateOML
- *
- * \todo Instead of caching the \c glXGetMscRateOML function pointer, would it
- * be possible to cache the sync rate?
- */
-float
-driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
- int64_t current_ust )
-{
- int32_t n;
- int32_t d;
- int interval;
- float usage = 1.0;
-
-
- if ( (*dri_interface->getMSCRate)( dPriv->display, dPriv->draw, &n, &d ) ) {
- interval = (dPriv->pdraw->swap_interval != 0)
- ? dPriv->pdraw->swap_interval : 1;
-
-
- /* We want to calculate
- * (current_UST - last_swap_UST) / (interval * us_per_refresh). We get
- * current_UST by calling __glXGetUST. last_swap_UST is stored in
- * dPriv->swap_ust. interval has already been calculated.
- *
- * The only tricky part is us_per_refresh. us_per_refresh is
- * 1000000 / MSC_rate. We know the MSC_rate is n / d. We can flip it
- * around and say us_per_refresh = 1000000 * d / n. Since this goes in
- * the denominator of the final calculation, we calculate
- * (interval * 1000000 * d) and move n into the numerator.
- */
-
- usage = (current_ust - last_swap_ust);
- usage *= n;
- usage /= (interval * d);
- usage /= 1000000.0;
- }
-
- return usage;
-}
-
-/*@}*/
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.h
deleted file mode 100644
index b9b38f39c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/dri_util.h
+++ /dev/null
@@ -1,555 +0,0 @@
-/* $XFree86: xc/lib/GL/dri/dri_util.h,v 1.1 2002/02/22 21:32:52 dawes Exp $ */
-/**
- * \file dri_util.h
- * DRI utility functions definitions.
- *
- * This module acts as glue between GLX and the actual hardware driver. A DRI
- * driver doesn't really \e have to use any of this - it's optional. But, some
- * useful stuff is done here that otherwise would have to be duplicated in most
- * drivers.
- *
- * Basically, these utility functions take care of some of the dirty details of
- * screen initialization, context creation, context binding, DRM setup, etc.
- *
- * These functions are compiled into each DRI driver so libGL.so knows nothing
- * about them.
- *
- * \sa dri_util.c.
- *
- * \author Kevin E. Martin <kevin@precisioninsight.com>
- * \author Brian Paul <brian@precisioninsight.com>
- */
-
-/*
- * 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.
- */
-
-
-#ifndef _DRI_UTIL_H_
-#define _DRI_UTIL_H_
-
-#define CAPI /* XXX this should be globally defined somewhere */
-
-#include <GL/gl.h>
-#include "drm.h"
-#include "drm_sarea.h"
-#include "xf86drm.h"
-#include "GL/internal/glcore.h"
-#include "GL/internal/dri_interface.h"
-
-#define GLX_BAD_CONTEXT 5
-
-typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate;
-typedef struct __DRIscreenPrivateRec __DRIscreenPrivate;
-typedef struct __DRIcontextPrivateRec __DRIcontextPrivate;
-typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate;
-typedef struct __DRIswapInfoRec __DRIswapInfo;
-typedef struct __DRIutilversionRec2 __DRIutilversion2;
-
-
-/**
- * Used by DRI_VALIDATE_DRAWABLE_INFO
- */
-#define DRI_VALIDATE_DRAWABLE_INFO_ONCE(pDrawPriv) \
- do { \
- if (*(pDrawPriv->pStamp) != pDrawPriv->lastStamp) { \
- __driUtilUpdateDrawableInfo(pDrawPriv); \
- } \
- } while (0)
-
-
-/**
- * Utility macro to validate the drawable information.
- *
- * See __DRIdrawablePrivate::pStamp and __DRIdrawablePrivate::lastStamp.
- */
-#define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp) \
-do { \
- while (*(pdp->pStamp) != pdp->lastStamp) { \
- DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, \
- pdp->driContextPriv->hHWContext); \
- \
- DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
- DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \
- DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
- \
- DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, \
- pdp->driContextPriv->hHWContext); \
- } \
-} while (0)
-
-
-/**
- * Driver callback functions.
- *
- * Each DRI driver must have one of these structures with all the pointers set
- * to appropriate functions within the driver.
- *
- * When glXCreateContext() is called, for example, it'll call a helper function
- * dri_util.c which in turn will jump through the \a CreateContext pointer in
- * this structure.
- */
-struct __DriverAPIRec {
- /**
- * Driver initialization callback
- */
- GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv);
-
- /**
- * Screen destruction callback
- */
- void (*DestroyScreen)(__DRIscreenPrivate *driScrnPriv);
-
- /**
- * Context creation callback
- */
- GLboolean (*CreateContext)(const __GLcontextModes *glVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
- /**
- * Context destruction callback
- */
- void (*DestroyContext)(__DRIcontextPrivate *driContextPriv);
-
- /**
- * Buffer (drawable) creation callback
- */
- GLboolean (*CreateBuffer)(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *glVis,
- GLboolean pixmapBuffer);
-
- /**
- * Buffer (drawable) destruction callback
- */
- void (*DestroyBuffer)(__DRIdrawablePrivate *driDrawPriv);
-
- /**
- * Buffer swapping callback
- */
- void (*SwapBuffers)(__DRIdrawablePrivate *driDrawPriv);
-
- /**
- * Context activation callback
- */
- GLboolean (*MakeCurrent)(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
- /**
- * Context unbinding callback
- */
- GLboolean (*UnbindContext)(__DRIcontextPrivate *driContextPriv);
-
- /**
- * Retrieves statistics about buffer swap operations. Required if
- * GLX_OML_sync_control or GLX_MESA_swap_frame_usage is supported.
- */
- int (*GetSwapInfo)( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-
- /**
- * Required if GLX_SGI_video_sync or GLX_OML_sync_control is
- * supported.
- */
- int (*GetMSC)( __DRIscreenPrivate * priv, int64_t * count );
-
- /**
- * These are required if GLX_OML_sync_control is supported.
- */
- /*@{*/
- int (*WaitForMSC)( __DRIdrawablePrivate *priv, int64_t target_msc,
- int64_t divisor, int64_t remainder,
- int64_t * msc );
- int (*WaitForSBC)( __DRIdrawablePrivate *priv, int64_t target_sbc,
- int64_t * msc, int64_t * sbc );
-
- int64_t (*SwapBuffersMSC)( __DRIdrawablePrivate *priv, int64_t target_msc,
- int64_t divisor, int64_t remainder );
- /*@}*/
-};
-
-
-struct __DRIswapInfoRec {
- /**
- * Number of swapBuffers operations that have been *completed*.
- */
- u_int64_t swap_count;
-
- /**
- * Unadjusted system time of the last buffer swap. This is the time
- * when the swap completed, not the time when swapBuffers was called.
- */
- int64_t swap_ust;
-
- /**
- * Number of swap operations that occurred after the swap deadline. That
- * is if a swap happens more than swap_interval frames after the previous
- * swap, it has missed its deadline. If swap_interval is 0, then the
- * swap deadline is 1 frame after the previous swap.
- */
- u_int64_t swap_missed_count;
-
- /**
- * Amount of time used by the last swap that missed its deadline. This
- * is calculated as (__glXGetUST() - swap_ust) / (swap_interval *
- * time_for_single_vrefresh)). If the actual value of swap_interval is
- * 0, then 1 is used instead. If swap_missed_count is non-zero, this
- * should be greater-than 1.0.
- */
- float swap_missed_usage;
-};
-
-
-/**
- * Per-drawable private DRI driver information.
- */
-struct __DRIdrawablePrivateRec {
- /**
- * Kernel drawable handle
- */
- drm_drawable_t hHWDrawable;
-
- /**
- * Driver's private drawable information.
- *
- * This structure is opaque.
- */
- void *driverPrivate;
-
- /**
- * X's drawable ID associated with this private drawable.
- */
- __DRIid draw;
- __DRIdrawable *pdraw;
-
- /**
- * Reference count for number of context's currently bound to this
- * drawable.
- *
- * Once it reaches zero, the drawable can be destroyed.
- *
- * \note This behavior will change with GLX 1.3.
- */
- int refcount;
-
- /**
- * Index of this drawable information in the SAREA.
- */
- unsigned int index;
-
- /**
- * Pointer to the "drawable has changed ID" stamp in the SAREA.
- */
- unsigned int *pStamp;
-
- /**
- * Last value of the stamp.
- *
- * If this differs from the value stored at __DRIdrawablePrivate::pStamp,
- * then the drawable information has been modified by the X server, and the
- * drawable information (below) should be retrieved from the X server.
- */
- unsigned int lastStamp;
-
- /**
- * \name Drawable
- *
- * Drawable information used in software fallbacks.
- */
- /*@{*/
- int x;
- int y;
- int w;
- int h;
- int numClipRects;
- drm_clip_rect_t *pClipRects;
- /*@}*/
-
- /**
- * \name Back and depthbuffer
- *
- * Information about the back and depthbuffer where different from above.
- */
- /*@{*/
- int backX;
- int backY;
- int backClipRectType;
- int numBackClipRects;
- drm_clip_rect_t *pBackClipRects;
- /*@}*/
-
- /**
- * Pointer to context to which this drawable is currently bound.
- */
- __DRIcontextPrivate *driContextPriv;
-
- /**
- * Pointer to screen on which this drawable was created.
- */
- __DRIscreenPrivate *driScreenPriv;
-
- /**
- * \name Display and screen information.
- *
- * Basically just need these for when the locking code needs to call
- * \c __driUtilUpdateDrawableInfo.
- */
- /*@{*/
- __DRInativeDisplay *display;
- int screen;
- /*@}*/
-
- /**
- * Called via glXSwapBuffers().
- */
- void (*swapBuffers)( __DRIdrawablePrivate *dPriv );
-};
-
-/**
- * Per-context private driver information.
- */
-struct __DRIcontextPrivateRec {
- /**
- * Kernel context handle used to access the device lock.
- */
- __DRIid contextID;
-
- /**
- * Kernel context handle used to access the device lock.
- */
- drm_context_t hHWContext;
-
- /**
- * Device driver's private context data. This structure is opaque.
- */
- void *driverPrivate;
-
- /**
- * This context's display pointer.
- */
- __DRInativeDisplay *display;
-
- /**
- * Pointer to drawable currently bound to this context.
- */
- __DRIdrawablePrivate *driDrawablePriv;
-
- /**
- * Pointer to screen on which this context was created.
- */
- __DRIscreenPrivate *driScreenPriv;
-};
-
-/**
- * Per-screen private driver information.
- */
-struct __DRIscreenPrivateRec {
- /**
- * Display for this screen
- */
- __DRInativeDisplay *display;
-
- /**
- * Current screen's number
- */
- int myNum;
-
- /**
- * Callback functions into the hardware-specific DRI driver code.
- */
- struct __DriverAPIRec DriverAPI;
-
- /**
- * \name DDX version
- * DDX / 2D driver version information.
- * \todo Replace these fields with a \c __DRIversionRec.
- */
- /*@{*/
- int ddxMajor;
- int ddxMinor;
- int ddxPatch;
- /*@}*/
-
- /**
- * \name DRI version
- * DRI X extension version information.
- * \todo Replace these fields with a \c __DRIversionRec.
- */
- /*@{*/
- int driMajor;
- int driMinor;
- int driPatch;
- /*@}*/
-
- /**
- * \name DRM version
- * DRM (kernel module) version information.
- * \todo Replace these fields with a \c __DRIversionRec.
- */
- /*@{*/
- int drmMajor;
- int drmMinor;
- int drmPatch;
- /*@}*/
-
- /**
- * ID used when the client sets the drawable lock.
- *
- * The X server uses this value to detect if the client has died while
- * holding the drawable lock.
- */
- int drawLockID;
-
- /**
- * File descriptor returned when the kernel device driver is opened.
- *
- * Used to:
- * - authenticate client to kernel
- * - map the frame buffer, SAREA, etc.
- * - close the kernel device driver
- */
- int fd;
-
- /**
- * SAREA pointer
- *
- * Used to access:
- * - the device lock
- * - the device-independent per-drawable and per-context(?) information
- */
- drm_sarea_t *pSAREA;
-
- /**
- * \name Direct frame buffer access information
- * Used for software fallbacks.
- */
- /*@{*/
- unsigned char *pFB;
- int fbSize;
- int fbOrigin;
- int fbStride;
- int fbWidth;
- int fbHeight;
- int fbBPP;
- /*@}*/
-
- /**
- * \name Device-dependent private information (stored in the SAREA).
- *
- * This data is accessed by the client driver only.
- */
- /*@{*/
- void *pDevPriv;
- int devPrivSize;
- /*@}*/
-
- /**
- * Dummy context to which drawables are bound when not bound to any
- * other context.
- *
- * A dummy hHWContext is created for this context, and is used by the GL
- * core when a hardware lock is required but the drawable is not currently
- * bound (e.g., potentially during a SwapBuffers request). The dummy
- * context is created when the first "real" context is created on this
- * screen.
- */
- __DRIcontextPrivate dummyContextPriv;
-
- /**
- * Hash table to hold the drawable information for this screen.
- */
- void *drawHash;
-
- /**
- * Device-dependent private information (not stored in the SAREA).
- *
- * This pointer is never touched by the DRI layer.
- */
- void *private;
-
- /**
- * GLX visuals / FBConfigs for this screen. These are stored as a
- * linked list.
- *
- * \note
- * This field is \b only used in conjunction with the old interfaces. If
- * the new interfaces are used, this field will be set to \c NULL and will
- * not be dereferenced.
- */
- __GLcontextModes *modes;
-
- /**
- * Pointer back to the \c __DRIscreen that contains this structure.
- */
-
- __DRIscreen *psc;
-};
-
-
-/**
- * Used to store a version which includes a major range instead of a single
- * major version number.
- */
-struct __DRIutilversionRec2 {
- int major_min; /** min allowed Major version number. */
- int major_max; /** max allowed Major version number. */
- int minor; /**< Minor version number. */
- int patch; /**< Patch-level. */
-};
-
-
-extern void
-__driUtilMessage(const char *f, ...);
-
-
-extern void
-__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp);
-
-
-extern __DRIscreenPrivate * __driUtilCreateNewScreen( __DRInativeDisplay *dpy,
- int scrn, __DRIscreen *psc, __GLcontextModes * modes,
- const __DRIversion * ddx_version, const __DRIversion * dri_version,
- const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
- drm_sarea_t *pSAREA, int fd, int internal_api_version,
- const struct __DriverAPIRec *driverAPI );
-
-/* Test the version of the internal GLX API. Returns a value like strcmp. */
-extern int
-driCompareGLXAPIVersion( GLint required_version );
-
-extern float
-driCalculateSwapUsage( __DRIdrawablePrivate *dPriv,
- int64_t last_swap_ust, int64_t current_ust );
-
-/**
- * Pointer to the \c __DRIinterfaceMethods passed to the driver by the loader.
- *
- * This pointer is set in the driver's \c __driCreateNewScreen function and
- * is defined in dri_util.c.
- */
-extern const __DRIinterfaceMethods * dri_interface;
-
-#endif /* _DRI_UTIL_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.c
deleted file mode 100644
index 44826958d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ /dev/null
@@ -1,98 +0,0 @@
-
-#include "mtypes.h"
-#include "drirenderbuffer.h"
-#include "renderbuffer.h"
-#include "imports.h"
-
-
-/**
- * This will get called when a window is resized.
- * Just update width, height and internal format fields for now.
- * There's usually no memory allocation above because the present
- * DRI drivers use statically-allocated full-screen buffers.
- */
-static GLboolean
-driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat, GLuint width, GLuint height)
-{
- rb->Width = width;
- rb->Height = height;
- rb->InternalFormat = internalFormat;
- return GL_TRUE;
-}
-
-
-/**
- * Allocate a new driRenderbuffer object.
- * Individual drivers are free to implement different versions of
- * this function.
- * \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24,
- * GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now).
- * \param cpp chars or bytes per pixel
- * \param offset start of buffer with respect to framebuffer address
- * \param pitch pixels per row
- */
-driRenderbuffer *
-driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch)
-{
- driRenderbuffer *drb;
-
- assert(format == GL_RGBA ||
- 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));
- if (drb) {
- const GLuint name = 0;
-
- _mesa_init_renderbuffer(&drb->Base, name);
-
- /* Make sure we're using a null-valued GetPointer routine */
- assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL);
-
- drb->Base.InternalFormat = format;
-
- if (format == GL_RGBA) {
- /* Color */
- drb->Base._BaseFormat = GL_RGBA;
- drb->Base.DataType = GL_UNSIGNED_BYTE;
- }
- else if (format == GL_DEPTH_COMPONENT16) {
- /* Depth */
- drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- /* we always Get/Put 32-bit Z values */
- drb->Base.DataType = GL_UNSIGNED_INT;
- }
- else if (format == GL_DEPTH_COMPONENT24) {
- /* Depth */
- drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- /* we always Get/Put 32-bit Z values */
- drb->Base.DataType = GL_UNSIGNED_INT;
- }
- else {
- /* Stencil */
- ASSERT(format == GL_STENCIL_INDEX8);
- drb->Base._BaseFormat = GL_STENCIL_INDEX;
- drb->Base.DataType = GL_UNSIGNED_BYTE;
- }
-
- /* XXX if we were allocating a user-created renderbuffer, we'd have
- * to fill in the ComponentSizes[] array too.
- */
-
- drb->Base.AllocStorage = driRenderbufferStorage;
- /* using default Delete function */
-
-
- /* DRI renderbuffer-specific fields: */
- drb->offset = offset;
- drb->pitch = pitch;
- drb->cpp = cpp;
- }
- return drb;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.h
deleted file mode 100644
index 627f1d41d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/**
- * A driRenderbuffer is dervied from gl_renderbuffer.
- * It describes a color buffer (front or back), a depth buffer, or stencil
- * buffer etc.
- * Specific to DRI drivers are the offset and pitch fields.
- */
-
-
-#ifndef DRIRENDERBUFFER_H
-#define DRIRENDERBUFFER_H
-
-#include "mtypes.h"
-
-typedef struct {
- struct gl_renderbuffer Base;
-
- /* Chars or bytes per pixel. If Z and Stencil are stored together this
- * will typically be 32 whether this a depth or stencil renderbuffer.
- */
- GLint cpp;
-
- /* Buffer position and pitch (row stride). Recall that for today's DRI
- * drivers, we have statically allocated color/depth/stencil buffers.
- * So this information describes the whole screen, not just a window.
- * To address pixels in a window, we need to know the window's position
- * and size with respect to the screen.
- */
- GLint offset; /* in bytes */
- GLint pitch; /* in pixels */
-
-} driRenderbuffer;
-
-
-driRenderbuffer *
-driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch);
-
-
-#endif /* DRIRENDERBUFFER_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/extension_helper.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/extension_helper.h
deleted file mode 100644
index 4a6606819..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/extension_helper.h
+++ /dev/null
@@ -1,5887 +0,0 @@
-/* DO NOT EDIT - This file generated automatically by extension_helper.py (from Mesa) script */
-
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * IBM,
- * 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 "utils.h"
-#include "dispatch.h"
-
-#ifndef NULL
-# define NULL 0
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char UniformMatrix3fvARB_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameter4fNV_names[] =
- "iiffff\0" /* Parameter signature */
- "glProgramParameter4fNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_multisample)
-static const char SampleCoverageARB_names[] =
- "fi\0" /* Parameter signature */
- "glSampleCoverage\0"
- "glSampleCoverageARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionFilter1D_names[] =
- "iiiiip\0" /* Parameter signature */
- "glConvolutionFilter1D\0"
- "glConvolutionFilter1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char BeginQueryARB_names[] =
- "ii\0" /* Parameter signature */
- "glBeginQuery\0"
- "glBeginQueryARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite)
-static const char PointParameteriNV_names[] =
- "ii\0" /* Parameter signature */
- "glPointParameteri\0"
- "glPointParameteriNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3sARB_names[] =
- "iiii\0" /* Parameter signature */
- "glMultiTexCoord3s\0"
- "glMultiTexCoord3sARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3iEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3i\0"
- "glSecondaryColor3iEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3fMESA_names[] =
- "fff\0" /* Parameter signature */
- "glWindowPos3f\0"
- "glWindowPos3fARB\0"
- "glWindowPos3fMESA\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameterfvSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glPixelTexGenParameterfvSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char ActiveTextureARB_names[] =
- "i\0" /* Parameter signature */
- "glActiveTexture\0"
- "glActiveTextureARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4ubvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4ubvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char GetColorTableParameterfvSGI_names[] =
- "iip\0" /* Parameter signature */
- "glGetColorTableParameterfvSGI\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char GetProgramNamedParameterdvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glGetProgramNamedParameterdvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char Histogram_names[] =
- "iiii\0" /* Parameter signature */
- "glHistogram\0"
- "glHistogramEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture4D)
-static const char TexImage4DSGIS_names[] =
- "iiiiiiiiiip\0" /* Parameter signature */
- "glTexImage4DSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2dvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2dv\0"
- "glWindowPos2dvARB\0"
- "glWindowPos2dvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiColor3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_paletted_texture)
-static const char GetColorTableParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetColorTableParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_blend_equation_separate) || defined(need_GL_ATI_blend_equation_separate)
-static const char BlendEquationSeparateEXT_names[] =
- "ii\0" /* Parameter signature */
- "glBlendEquationSeparateEXT\0"
- "glBlendEquationSeparateATI\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameterfSGIX_names[] =
- "iif\0" /* Parameter signature */
- "glListParameterfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3bEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3b\0"
- "glSecondaryColor3bEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fColor4fNormal3fVertex4fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glTexCoord4fColor4fNormal3fVertex4fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4svNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GetBufferSubDataARB_names[] =
- "iiip\0" /* Parameter signature */
- "glGetBufferSubData\0"
- "glGetBufferSubDataARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char BufferSubDataARB_names[] =
- "iiip\0" /* Parameter signature */
- "glBufferSubData\0"
- "glBufferSubDataARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4ubVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glTexCoord2fColor4ubVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramEnvParameter4dvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramEnvParameter4dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2fARB_names[] =
- "iff\0" /* Parameter signature */
- "glVertexAttrib2fARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetHistogramParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetHistogramParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3fARB_names[] =
- "ifff\0" /* Parameter signature */
- "glVertexAttrib3fARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GetQueryivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryiv\0"
- "glGetQueryivARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture3D)
-static const char TexImage3D_names[] =
- "iiiiiiiiip\0" /* Parameter signature */
- "glTexImage3D\0"
- "glTexImage3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glReplacementCodeuiVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GetQueryObjectivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryObjectiv\0"
- "glGetQueryObjectivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexSubImage2DARB_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glCompressedTexSubImage2D\0"
- "glCompressedTexSubImage2DARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform2fARB_names[] =
- "iff\0" /* Parameter signature */
- "glUniform2fARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1svARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs1dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs1dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform2ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform2ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char GetImageTransformParameterfvHP_names[] =
- "iip\0" /* Parameter signature */
- "glGetImageTransformParameterfvHP\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char CopyConvolutionFilter1D_names[] =
- "iiiii\0" /* Parameter signature */
- "glCopyConvolutionFilter1D\0"
- "glCopyConvolutionFilter1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiNormal3fVertex3fSUN_names[] =
- "iffffff\0" /* Parameter signature */
- "glReplacementCodeuiNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentMaterialfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_blend_color)
-static const char BlendColor_names[] =
- "ffff\0" /* Parameter signature */
- "glBlendColor\0"
- "glBlendColorEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char UniformMatrix4fvARB_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char ReadInstrumentsSGIX_names[] =
- "i\0" /* Parameter signature */
- "glReadInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glColor4ubVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char GetListParameterivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetListParameterivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NusvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4NusvARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4svMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4svMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char CreateProgramObjectARB_names[] =
- "\0" /* Parameter signature */
- "glCreateProgramObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModelivSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glFragmentLightModelivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char ColorFragmentOp3ATI_names[] =
- "iiiiiiiiiiiii\0" /* Parameter signature */
- "glColorFragmentOp3ATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char PrioritizeTextures_names[] =
- "ipp\0" /* Parameter signature */
- "glPrioritizeTextures\0"
- "glPrioritizeTexturesEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char AsyncMarkerSGIX_names[] =
- "i\0" /* Parameter signature */
- "glAsyncMarkerSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorubSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorubSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char ResetHistogram_names[] =
- "i\0" /* Parameter signature */
- "glResetHistogram\0"
- "glResetHistogramEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char GetProgramNamedParameterfvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glGetProgramNamedParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters)
-static const char PointParameterfEXT_names[] =
- "if\0" /* Parameter signature */
- "glPointParameterf\0"
- "glPointParameterfARB\0"
- "glPointParameterfEXT\0"
- "glPointParameterfSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char LoadIdentityDeformationMapSGIX_names[] =
- "i\0" /* Parameter signature */
- "glLoadIdentityDeformationMapSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char GenFencesNV_names[] =
- "ip\0" /* Parameter signature */
- "glGenFencesNV\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameterfHP_names[] =
- "iif\0" /* Parameter signature */
- "glImageTransformParameterfHP\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexusvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMatrixIndexusvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameter4dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glProgramParameter4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char DisableVertexAttribArrayARB_names[] =
- "i\0" /* Parameter signature */
- "glDisableVertexAttribArrayARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char StencilMaskSeparate_names[] =
- "ii\0" /* Parameter signature */
- "glStencilMaskSeparate\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4dARB_names[] =
- "iidddd\0" /* Parameter signature */
- "glProgramLocalParameter4dARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexImage3DARB_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glCompressedTexImage3D\0"
- "glCompressedTexImage3DARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1fARB_names[] =
- "if\0" /* Parameter signature */
- "glVertexAttrib1fARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char TestFenceNV_names[] =
- "i\0" /* Parameter signature */
- "glTestFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1fv\0"
- "glMultiTexCoord1fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char ColorFragmentOp2ATI_names[] =
- "iiiiiiiiii\0" /* Parameter signature */
- "glColorFragmentOp2ATI\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char SecondaryColorPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glSecondaryColorPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char GetPixelTexGenParameterivSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetPixelTexGenParameterivSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4fNV_names[] =
- "iffff\0" /* Parameter signature */
- "glVertexAttrib4fNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeubSUN_names[] =
- "i\0" /* Parameter signature */
- "glReplacementCodeubSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char FinishAsyncSGIX_names[] =
- "p\0" /* Parameter signature */
- "glFinishAsyncSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoorddEXT_names[] =
- "d\0" /* Parameter signature */
- "glFogCoordd\0"
- "glFogCoorddEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex3fSUN_names[] =
- "iiiifff\0" /* Parameter signature */
- "glColor4ubVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoordfEXT_names[] =
- "f\0" /* Parameter signature */
- "glFogCoordf\0"
- "glFogCoordfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fVertex3fSUN_names[] =
- "fffff\0" /* Parameter signature */
- "glTexCoord2fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactoriSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactoriSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2dNV_names[] =
- "idd\0" /* Parameter signature */
- "glVertexAttrib2dNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NbvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4NbvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_shader)
-static const char GetActiveAttribARB_names[] =
- "iiipppp\0" /* Parameter signature */
- "glGetActiveAttribARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4ubNV_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4ubNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4fNormal3fVertex3fSUN_names[] =
- "ffffffffffff\0" /* Parameter signature */
- "glTexCoord2fColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetMinmaxEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetMinmaxEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameterfvNV_names[] =
- "ip\0" /* Parameter signature */
- "glCombinerParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs3dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs3dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightiSGIX_names[] =
- "iii\0" /* Parameter signature */
- "glFragmentLightiSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_polygon_offset)
-static const char PolygonOffsetEXT_names[] =
- "ff\0" /* Parameter signature */
- "glPolygonOffsetEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char PollAsyncSGIX_names[] =
- "p\0" /* Parameter signature */
- "glPollAsyncSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char DeleteFragmentShaderATI_names[] =
- "i\0" /* Parameter signature */
- "glDeleteFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fNormal3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glTexCoord2fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char MultTransposeMatrixdARB_names[] =
- "p\0" /* Parameter signature */
- "glMultTransposeMatrixd\0"
- "glMultTransposeMatrixdARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2svMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2sv\0"
- "glWindowPos2svARB\0"
- "glWindowPos2svMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexImage1DARB_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glCompressedTexImage1D\0"
- "glCompressedTexImage1DARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2sNV_names[] =
- "iii\0" /* Parameter signature */
- "glVertexAttrib2sNV\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char NormalPointerListIBM_names[] =
- "iipi\0" /* Parameter signature */
- "glNormalPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char IndexPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glIndexPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char NormalPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glNormalPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3dARB_names[] =
- "iddd\0" /* Parameter signature */
- "glMultiTexCoord3d\0"
- "glMultiTexCoord3dARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2iARB_names[] =
- "iii\0" /* Parameter signature */
- "glMultiTexCoord2i\0"
- "glMultiTexCoord2iARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names[] =
- "iffffffff\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2sv\0"
- "glMultiTexCoord2svARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeubvSUN_names[] =
- "p\0" /* Parameter signature */
- "glReplacementCodeubvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform3iARB_names[] =
- "iiii\0" /* Parameter signature */
- "glUniform3iARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentMaterialfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentMaterialfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3fEXT_names[] =
- "fff\0" /* Parameter signature */
- "glBinormal3fEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightivARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactordSUN_names[] =
- "d\0" /* Parameter signature */
- "glGlobalAlphaFactordSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs3fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs3fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char GenerateMipmapEXT_names[] =
- "i\0" /* Parameter signature */
- "glGenerateMipmapEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameter4dNV_names[] =
- "iidddd\0" /* Parameter signature */
- "glProgramParameter4dNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char SetFragmentShaderConstantATI_names[] =
- "ip\0" /* Parameter signature */
- "glSetFragmentShaderConstantATI\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapAttribParameterivNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetMapAttribParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char CreateShaderObjectARB_names[] =
- "i\0" /* Parameter signature */
- "glCreateShaderObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_sharpen_texture)
-static const char GetSharpenTexFuncSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetSharpenTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char BufferDataARB_names[] =
- "iipi\0" /* Parameter signature */
- "glBufferData\0"
- "glBufferDataARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_array_range)
-static const char FlushVertexArrayRangeNV_names[] =
- "\0" /* Parameter signature */
- "glFlushVertexArrayRangeNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char SampleMapATI_names[] =
- "iii\0" /* Parameter signature */
- "glSampleMapATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char VertexPointerEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glVertexPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture_filter4)
-static const char GetTexFilterFuncSGIS_names[] =
- "iip\0" /* Parameter signature */
- "glGetTexFilterFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerOutputParameterfvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetCombinerOutputParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_subtexture)
-static const char TexSubImage1D_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glTexSubImage1D\0"
- "glTexSubImage1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1sARB_names[] =
- "ii\0" /* Parameter signature */
- "glVertexAttrib1sARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char FinalCombinerInputNV_names[] =
- "iiii\0" /* Parameter signature */
- "glFinalCombinerInputNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetHistogramParameterfvEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetHistogramParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_flush_raster)
-static const char FlushRasterSGIX_names[] =
- "\0" /* Parameter signature */
- "glFlushRasterSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fVertex3fSUN_names[] =
- "ifffff\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_draw_buffers) || defined(need_GL_ATI_draw_buffers)
-static const char DrawBuffersARB_names[] =
- "ip\0" /* Parameter signature */
- "glDrawBuffersARB\0"
- "glDrawBuffersATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char IsRenderbufferEXT_names[] =
- "i\0" /* Parameter signature */
- "glIsRenderbufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char StencilOpSeparate_names[] =
- "iiii\0" /* Parameter signature */
- "glStencilOpSeparate\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char ColorTableParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glColorTableParameteriv\0"
- "glColorTableParameterivSGI\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char FogCoordPointerListIBM_names[] =
- "iipi\0" /* Parameter signature */
- "glFogCoordPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3dMESA_names[] =
- "ddd\0" /* Parameter signature */
- "glWindowPos3d\0"
- "glWindowPos3dARB\0"
- "glWindowPos3dMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters)
-static const char PointParameterfvEXT_names[] =
- "ip\0" /* Parameter signature */
- "glPointParameterfv\0"
- "glPointParameterfvARB\0"
- "glPointParameterfvEXT\0"
- "glPointParameterfvSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2fvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2fv\0"
- "glWindowPos2fvARB\0"
- "glWindowPos2fvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3bvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3bv\0"
- "glSecondaryColor3bvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetHistogramEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetHistogramEXT\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char VertexPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glVertexPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramLocalParameterfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramLocalParameterfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialfSGIX_names[] =
- "iif\0" /* Parameter signature */
- "glFragmentMaterialfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_paletted_texture)
-static const char GetColorTableEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glGetColorTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char RenderbufferStorageEXT_names[] =
- "iiii\0" /* Parameter signature */
- "glRenderbufferStorageEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char IsFenceNV_names[] =
- "i\0" /* Parameter signature */
- "glIsFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char AttachObjectARB_names[] =
- "ii\0" /* Parameter signature */
- "glAttachObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentLightivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentLightivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char UniformMatrix2fvARB_names[] =
- "iiip\0" /* Parameter signature */
- "glUniformMatrix2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2fARB_names[] =
- "iff\0" /* Parameter signature */
- "glMultiTexCoord2f\0"
- "glMultiTexCoord2fARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture)
-static const char ColorTable_names[] =
- "iiiiip\0" /* Parameter signature */
- "glColorTable\0"
- "glColorTableSGI\0"
- "glColorTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char MapControlPointsNV_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glMapControlPointsNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionFilter2D_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glConvolutionFilter2D\0"
- "glConvolutionFilter2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char MapParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glMapParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_PGI_misc_hints)
-static const char HintPGI_names[] =
- "ii\0" /* Parameter signature */
- "glHintPGI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameteriv_names[] =
- "iip\0" /* Parameter signature */
- "glConvolutionParameteriv\0"
- "glConvolutionParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_cull_vertex)
-static const char CullParameterdvEXT_names[] =
- "ip\0" /* Parameter signature */
- "glCullParameterdvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4fNV_names[] =
- "iipffff\0" /* Parameter signature */
- "glProgramNamedParameter4fNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color3fVertex3fSUN_names[] =
- "ffffff\0" /* Parameter signature */
- "glColor3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramEnvParameter4fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramEnvParameter4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModeliSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glFragmentLightModeliSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glConvolutionParameterfv\0"
- "glConvolutionParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_3DFX_tbuffer)
-static const char TbufferMask3DFX_names[] =
- "i\0" /* Parameter signature */
- "glTbufferMask3DFX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char LoadProgramNV_names[] =
- "iiip\0" /* Parameter signature */
- "glLoadProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetAttachedObjectsARB_names[] =
- "iipp\0" /* Parameter signature */
- "glGetAttachedObjectsARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform3fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_draw_range_elements)
-static const char DrawRangeElements_names[] =
- "iiiiip\0" /* Parameter signature */
- "glDrawRangeElements\0"
- "glDrawRangeElementsEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameterfvSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glSpriteParameterfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char CheckFramebufferStatusEXT_names[] =
- "i\0" /* Parameter signature */
- "glCheckFramebufferStatusEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactoruiSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactoruiSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetHandleARB_names[] =
- "i\0" /* Parameter signature */
- "glGetHandleARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetVertexAttribivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerInputParameterfvNV_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetCombinerInputParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiNormal3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char LoadTransposeMatrixdARB_names[] =
- "p\0" /* Parameter signature */
- "glLoadTransposeMatrixd\0"
- "glLoadTransposeMatrixdARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const char StencilFuncSeparate_names[] =
- "iiii\0" /* Parameter signature */
- "glStencilFuncSeparate\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3sEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3s\0"
- "glSecondaryColor3sEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color3fVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glColor3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorbSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorbSUN\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameterfvHP_names[] =
- "iip\0" /* Parameter signature */
- "glImageTransformParameterfvHP\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3fNV_names[] =
- "ifff\0" /* Parameter signature */
- "glVertexAttrib3fNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs2dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs2dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3fv\0"
- "glMultiTexCoord3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3dEXT_names[] =
- "ddd\0" /* Parameter signature */
- "glSecondaryColor3d\0"
- "glSecondaryColor3dEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramParameterfvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetProgramParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char TangentPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glTangentPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4fNormal3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char GetInstrumentsSGIX_names[] =
- "\0" /* Parameter signature */
- "glGetInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char EvalMapsNV_names[] =
- "ii\0" /* Parameter signature */
- "glEvalMapsNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_subtexture)
-static const char TexSubImage2D_names[] =
- "iiiiiiiip\0" /* Parameter signature */
- "glTexSubImage2D\0"
- "glTexSubImage2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentLightivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char DeleteRenderbuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteRenderbuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameterfvEXT_names[] =
- "iip\0" /* Parameter signature */
- "glPixelTransformParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4bvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4bvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char AlphaFragmentOp2ATI_names[] =
- "iiiiiiiii\0" /* Parameter signature */
- "glAlphaFragmentOp2ATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetSeparableFilterEXT_names[] =
- "iiippp\0" /* Parameter signature */
- "glGetSeparableFilterEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4sARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glMultiTexCoord4s\0"
- "glMultiTexCoord4sARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentMaterialivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentMaterialivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4dMESA_names[] =
- "dddd\0" /* Parameter signature */
- "glWindowPos4dMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightPointerARB_names[] =
- "iiip\0" /* Parameter signature */
- "glWeightPointerARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2dMESA_names[] =
- "dd\0" /* Parameter signature */
- "glWindowPos2d\0"
- "glWindowPos2dARB\0"
- "glWindowPos2dMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferTexture3DEXT_names[] =
- "iiiiii\0" /* Parameter signature */
- "glFramebufferTexture3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_blend_minmax)
-static const char BlendEquation_names[] =
- "i\0" /* Parameter signature */
- "glBlendEquation\0"
- "glBlendEquationEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3dNV_names[] =
- "iddd\0" /* Parameter signature */
- "glVertexAttrib3dNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3dARB_names[] =
- "iddd\0" /* Parameter signature */
- "glVertexAttrib3dARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names[] =
- "ppppp\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4fARB_names[] =
- "iffff\0" /* Parameter signature */
- "glVertexAttrib4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_index_func)
-static const char IndexFuncEXT_names[] =
- "if\0" /* Parameter signature */
- "glIndexFuncEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char GetListParameterfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetListParameterfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2dv\0"
- "glMultiTexCoord2dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_cull_vertex)
-static const char CullParameterfvEXT_names[] =
- "ip\0" /* Parameter signature */
- "glCullParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4fvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glProgramNamedParameter4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColorPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glSecondaryColorPointer\0"
- "glSecondaryColorPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char ColorPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glColorPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetActiveUniformARB_names[] =
- "iiipppp\0" /* Parameter signature */
- "glGetActiveUniformARB\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameteriHP_names[] =
- "iii\0" /* Parameter signature */
- "glImageTransformParameteriHP\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1sv\0"
- "glMultiTexCoord1svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char EndQueryARB_names[] =
- "i\0" /* Parameter signature */
- "glEndQuery\0"
- "glEndQueryARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char DeleteFencesNV_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteFencesNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char DeformationMap3dSGIX_names[] =
- "iddiiddiiddiip\0" /* Parameter signature */
- "glDeformationMap3dSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char GetImageTransformParameterivHP_names[] =
- "iip\0" /* Parameter signature */
- "glGetImageTransformParameterivHP\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4ivMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4ivMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3sv\0"
- "glMultiTexCoord3svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4iARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glMultiTexCoord4i\0"
- "glMultiTexCoord4iARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3ivEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3ivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_resize_buffers)
-static const char ResizeBuffersMESA_names[] =
- "\0" /* Parameter signature */
- "glResizeBuffersMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetUniformivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetUniformivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameteriSGIS_names[] =
- "ii\0" /* Parameter signature */
- "glPixelTexGenParameteriSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char VertexPointervINTEL_names[] =
- "iip\0" /* Parameter signature */
- "glVertexPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3uiEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3ui\0"
- "glSecondaryColor3uiEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char StartInstrumentsSGIX_names[] =
- "\0" /* Parameter signature */
- "glStartInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3usvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3usv\0"
- "glSecondaryColor3usvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4dvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramLocalParameter4dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexuivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMatrixIndexuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3sEXT_names[] =
- "iii\0" /* Parameter signature */
- "glTangent3sEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorfSUN_names[] =
- "f\0" /* Parameter signature */
- "glGlobalAlphaFactorfSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3iARB_names[] =
- "iiii\0" /* Parameter signature */
- "glMultiTexCoord3i\0"
- "glMultiTexCoord3iARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetConvolutionFilterEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glGetConvolutionFilterEXT\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char TexCoordPointerListIBM_names[] =
- "iiipi\0" /* Parameter signature */
- "glTexCoordPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorusSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorusSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferRenderbufferEXT_names[] =
- "iiii\0" /* Parameter signature */
- "glFramebufferRenderbufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char SetFenceNV_names[] =
- "ii\0" /* Parameter signature */
- "glSetFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferTexture1DEXT_names[] =
- "iiiii\0" /* Parameter signature */
- "glFramebufferTexture1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerOutputParameterivNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetCombinerOutputParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameterivSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glPixelTexGenParameterivSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_perturb_normal)
-static const char TextureNormalEXT_names[] =
- "i\0" /* Parameter signature */
- "glTextureNormalEXT\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char IndexPointerListIBM_names[] =
- "iipi\0" /* Parameter signature */
- "glIndexPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightfvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameter4fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glProgramParameter4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4fMESA_names[] =
- "ffff\0" /* Parameter signature */
- "glWindowPos4fMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3dvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3dv\0"
- "glWindowPos3dvARB\0"
- "glWindowPos3dvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1dARB_names[] =
- "id\0" /* Parameter signature */
- "glMultiTexCoord1d\0"
- "glMultiTexCoord1dARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite)
-static const char PointParameterivNV_names[] =
- "ip\0" /* Parameter signature */
- "glPointParameteriv\0"
- "glPointParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform2fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3dv\0"
- "glMultiTexCoord3dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char DeleteObjectARB_names[] =
- "i\0" /* Parameter signature */
- "glDeleteObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char UseProgramObjectARB_names[] =
- "i\0" /* Parameter signature */
- "glUseProgramObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4dvNV_names[] =
- "iipp\0" /* Parameter signature */
- "glProgramNamedParameter4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3fvEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char BindFramebufferEXT_names[] =
- "ii\0" /* Parameter signature */
- "glBindFramebufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4usvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4usvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_compiled_vertex_array)
-static const char UnlockArraysEXT_names[] =
- "\0" /* Parameter signature */
- "glUnlockArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor3fVertex3fSUN_names[] =
- "ffffffff\0" /* Parameter signature */
- "glTexCoord2fColor3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3fvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3fv\0"
- "glWindowPos3fvARB\0"
- "glWindowPos3fvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1svNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexSubImage3D_names[] =
- "iiiiiiiii\0" /* Parameter signature */
- "glCopyTexSubImage3D\0"
- "glCopyTexSubImage3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2dARB_names[] =
- "idd\0" /* Parameter signature */
- "glVertexAttrib2dARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture_color_mask)
-static const char TextureColorMaskSGIS_names[] =
- "iiii\0" /* Parameter signature */
- "glTextureColorMaskSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char CopyColorTable_names[] =
- "iiiii\0" /* Parameter signature */
- "glCopyColorTable\0"
- "glCopyColorTableSGI\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char ColorPointervINTEL_names[] =
- "iip\0" /* Parameter signature */
- "glColorPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char AlphaFragmentOp1ATI_names[] =
- "iiiiii\0" /* Parameter signature */
- "glAlphaFragmentOp1ATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord3iv\0"
- "glMultiTexCoord3ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2sARB_names[] =
- "iii\0" /* Parameter signature */
- "glMultiTexCoord2s\0"
- "glMultiTexCoord2sARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char DeleteTextures_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteTextures\0"
- "glDeleteTexturesEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char TexCoordPointerEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glTexCoordPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture4D)
-static const char TexSubImage4DSGIS_names[] =
- "iiiiiiiiiiiip\0" /* Parameter signature */
- "glTexSubImage4DSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners2)
-static const char CombinerStageParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glCombinerStageParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char StopInstrumentsSGIX_names[] =
- "i\0" /* Parameter signature */
- "glStopInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fColor4fNormal3fVertex4fSUN_names[] =
- "fffffffffffffff\0" /* Parameter signature */
- "glTexCoord4fColor4fNormal3fVertex4fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char DeformSGIX_names[] =
- "i\0" /* Parameter signature */
- "glDeformSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetVertexAttribfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3ivEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3iv\0"
- "glSecondaryColor3ivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_detail_texture)
-static const char GetDetailTexFuncSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetDetailTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners2)
-static const char GetCombinerStageParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetCombinerStageParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex2fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glColor4ubVertex2fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_texture_filter4)
-static const char TexFilterFuncSGIS_names[] =
- "iiip\0" /* Parameter signature */
- "glTexFilterFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample)
-static const char SampleMaskSGIS_names[] =
- "fi\0" /* Parameter signature */
- "glSampleMaskSGIS\0"
- "glSampleMaskEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_shader)
-static const char GetAttribLocationARB_names[] =
- "ip\0" /* Parameter signature */
- "glGetAttribLocationARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4ubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4ubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_detail_texture)
-static const char DetailTexFuncSGIS_names[] =
- "iip\0" /* Parameter signature */
- "glDetailTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Normal3fVertex3fSUN_names[] =
- "ffffff\0" /* Parameter signature */
- "glNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexImage2D_names[] =
- "iiiiiiii\0" /* Parameter signature */
- "glCopyTexImage2D\0"
- "glCopyTexImage2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GetBufferPointervARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetBufferPointerv\0"
- "glGetBufferPointervARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramEnvParameter4fARB_names[] =
- "iiffff\0" /* Parameter signature */
- "glProgramEnvParameter4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform3ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform3ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char GetFenceivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetFenceivNV\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4dvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4dvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_color_subtable)
-static const char ColorSubTable_names[] =
- "iiiiip\0" /* Parameter signature */
- "glColorSubTable\0"
- "glColorSubTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4iv\0"
- "glMultiTexCoord4ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapAttribParameterfvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetMapAttribParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4sARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4sARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GetQueryObjectuivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetQueryObjectuiv\0"
- "glGetQueryObjectuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char MapParameterivNV_names[] =
- "iip\0" /* Parameter signature */
- "glMapParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char GenRenderbuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glGenRenderbuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetConvolutionParameterfvEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetConvolutionParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetMinmaxParameterfvEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetMinmaxParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char EdgeFlagPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glEdgeFlagPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs2svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs2svNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightbvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightbvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GetBufferParameterivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetBufferParameteriv\0"
- "glGetBufferParameterivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameteriSGIX_names[] =
- "iii\0" /* Parameter signature */
- "glListParameteriSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4fNormal3fVertex3fSUN_names[] =
- "iffffffffff\0" /* Parameter signature */
- "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char InstrumentsBufferSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glInstrumentsBufferSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4NivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeuivSUN_names[] =
- "p\0" /* Parameter signature */
- "glReplacementCodeuivSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2iMESA_names[] =
- "ii\0" /* Parameter signature */
- "glWindowPos2i\0"
- "glWindowPos2iARB\0"
- "glWindowPos2iMESA\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3fvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3fv\0"
- "glSecondaryColor3fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexSubImage1DARB_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glCompressedTexSubImage1D\0"
- "glCompressedTexSubImage1DARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fNormal3fVertex3fSUN_names[] =
- "ffffffff\0" /* Parameter signature */
- "glTexCoord2fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramStringARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramStringARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char CompileShaderARB_names[] =
- "i\0" /* Parameter signature */
- "glCompileShaderARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerOutputNV_names[] =
- "iiiiiiiiii\0" /* Parameter signature */
- "glCombinerOutputNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameterfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glListParameterfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3dvEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3dvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3sMESA_names[] =
- "iii\0" /* Parameter signature */
- "glWindowPos3s\0"
- "glWindowPos3sARB\0"
- "glWindowPos3sMESA\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2svNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs1fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs1fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glTexCoord2fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4sMESA_names[] =
- "iiii\0" /* Parameter signature */
- "glWindowPos4sMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NuivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4NuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char ClientActiveTextureARB_names[] =
- "i\0" /* Parameter signature */
- "glClientActiveTexture\0"
- "glClientActiveTextureARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_pixel_texture)
-static const char PixelTexGenSGIX_names[] =
- "i\0" /* Parameter signature */
- "glPixelTexGenSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeusvSUN_names[] =
- "p\0" /* Parameter signature */
- "glReplacementCodeusvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform4fARB_names[] =
- "iffff\0" /* Parameter signature */
- "glUniform4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_multimode_draw_arrays)
-static const char MultiModeDrawArraysIBM_names[] =
- "pppii\0" /* Parameter signature */
- "glMultiModeDrawArraysIBM\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char IsProgramNV_names[] =
- "i\0" /* Parameter signature */
- "glIsProgramARB\0"
- "glIsProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodePointerSUN_names[] =
- "iip\0" /* Parameter signature */
- "glReplacementCodePointerSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramEnvParameter4dARB_names[] =
- "iidddd\0" /* Parameter signature */
- "glProgramEnvParameter4dARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char ColorTableParameterfv_names[] =
- "iip\0" /* Parameter signature */
- "glColorTableParameterfv\0"
- "glColorTableParameterfvSGI\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModelfSGIX_names[] =
- "if\0" /* Parameter signature */
- "glFragmentLightModelfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3bvEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3bvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const char VertexWeightfvEXT_names[] =
- "p\0" /* Parameter signature */
- "glVertexWeightfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1dARB_names[] =
- "id\0" /* Parameter signature */
- "glVertexAttrib1dARB\0"
- "";
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const char ImageTransformParameterivHP_names[] =
- "iip\0" /* Parameter signature */
- "glImageTransformParameterivHP\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char DeleteQueriesARB_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteQueries\0"
- "glDeleteQueriesARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4ubVertex2fSUN_names[] =
- "iiiiff\0" /* Parameter signature */
- "glColor4ubVertex2fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentColorMaterialSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glFragmentColorMaterialSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char CurrentPaletteMatrixARB_names[] =
- "i\0" /* Parameter signature */
- "glCurrentPaletteMatrixARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4sNV_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4sNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample)
-static const char SamplePatternSGIS_names[] =
- "i\0" /* Parameter signature */
- "glSamplePatternSGIS\0"
- "glSamplePatternEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char IsQueryARB_names[] =
- "i\0" /* Parameter signature */
- "glIsQuery\0"
- "glIsQueryARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] =
- "iiiiifff\0" /* Parameter signature */
- "glReplacementCodeuiColor4ubVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char LinkProgramARB_names[] =
- "i\0" /* Parameter signature */
- "glLinkProgramARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib2fNV_names[] =
- "iff\0" /* Parameter signature */
- "glVertexAttrib2fNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char ShaderSourceARB_names[] =
- "iipp\0" /* Parameter signature */
- "glShaderSourceARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialiSGIX_names[] =
- "iii\0" /* Parameter signature */
- "glFragmentMaterialiSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexSubImage3DARB_names[] =
- "iiiiiiiiiip\0" /* Parameter signature */
- "glCompressedTexSubImage3D\0"
- "glCompressedTexSubImage3DARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2ivMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos2iv\0"
- "glWindowPos2ivARB\0"
- "glWindowPos2ivMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char IsFramebufferEXT_names[] =
- "i\0" /* Parameter signature */
- "glIsFramebufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform4ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform4ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetVertexAttribdvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3dEXT_names[] =
- "ddd\0" /* Parameter signature */
- "glBinormal3dEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameteriSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glSpriteParameteriSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char RequestResidentProgramsNV_names[] =
- "ip\0" /* Parameter signature */
- "glRequestResidentProgramsNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_tag_sample_buffer)
-static const char TagSampleBufferSGIX_names[] =
- "\0" /* Parameter signature */
- "glTagSampleBufferSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeusSUN_names[] =
- "i\0" /* Parameter signature */
- "glReplacementCodeusSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const char ListParameterivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glListParameterivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays)
-static const char MultiDrawElementsEXT_names[] =
- "ipipi\0" /* Parameter signature */
- "glMultiDrawElements\0"
- "glMultiDrawElementsEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform1ivARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform1ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2sMESA_names[] =
- "ii\0" /* Parameter signature */
- "glWindowPos2s\0"
- "glWindowPos2sARB\0"
- "glWindowPos2sMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightusvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightusvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoordPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glFogCoordPointer\0"
- "glFogCoordPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_index_material)
-static const char IndexMaterialEXT_names[] =
- "ii\0" /* Parameter signature */
- "glIndexMaterialEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3ubvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3ubv\0"
- "glSecondaryColor3ubvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_shader)
-static const char BindAttribLocationARB_names[] =
- "iip\0" /* Parameter signature */
- "glBindAttribLocationARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2dARB_names[] =
- "idd\0" /* Parameter signature */
- "glMultiTexCoord2d\0"
- "glMultiTexCoord2dARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ExecuteProgramNV_names[] =
- "iip\0" /* Parameter signature */
- "glExecuteProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char LightEnviSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glLightEnviSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char GetColorTableParameterivSGI_names[] =
- "iip\0" /* Parameter signature */
- "glGetColorTableParameterivSGI\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const char ReplacementCodeuiSUN_names[] =
- "i\0" /* Parameter signature */
- "glReplacementCodeuiSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char FramebufferTexture2DEXT_names[] =
- "iiiii\0" /* Parameter signature */
- "glFramebufferTexture2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribPointerNV_names[] =
- "iiiip\0" /* Parameter signature */
- "glVertexAttribPointerNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char GetFramebufferAttachmentParameterivEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glGetFramebufferAttachmentParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4dv\0"
- "glMultiTexCoord4dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameteriEXT_names[] =
- "iii\0" /* Parameter signature */
- "glPixelTransformParameteriEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char ValidateProgramARB_names[] =
- "i\0" /* Parameter signature */
- "glValidateProgramARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4ubVertex3fSUN_names[] =
- "ffiiiifff\0" /* Parameter signature */
- "glTexCoord2fColor4ubVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform1iARB_names[] =
- "ii\0" /* Parameter signature */
- "glUniform1iARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttribPointerARB_names[] =
- "iiiiip\0" /* Parameter signature */
- "glVertexAttribPointerARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_sharpen_texture)
-static const char SharpenTexFuncSGIS_names[] =
- "iip\0" /* Parameter signature */
- "glSharpenTexFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4fv\0"
- "glMultiTexCoord4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char TrackMatrixNV_names[] =
- "iiii\0" /* Parameter signature */
- "glTrackMatrixNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameteriNV_names[] =
- "ii\0" /* Parameter signature */
- "glCombinerParameteriNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char DeleteAsyncMarkersSGIX_names[] =
- "ii\0" /* Parameter signature */
- "glDeleteAsyncMarkersSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char IsAsyncMarkerSGIX_names[] =
- "i\0" /* Parameter signature */
- "glIsAsyncMarkerSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_framezoom)
-static const char FrameZoomSGIX_names[] =
- "i\0" /* Parameter signature */
- "glFrameZoomSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Normal3fVertex3fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NsvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4NsvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char DeleteFramebuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteFramebuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const char GlobalAlphaFactorsSUN_names[] =
- "i\0" /* Parameter signature */
- "glGlobalAlphaFactorsSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture3D)
-static const char TexSubImage3D_names[] =
- "iiiiiiiiiip\0" /* Parameter signature */
- "glTexSubImage3D\0"
- "glTexSubImage3DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3fEXT_names[] =
- "fff\0" /* Parameter signature */
- "glTangent3fEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3uivEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3uiv\0"
- "glSecondaryColor3uivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMatrixIndexubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char Color4fNormal3fVertex3fSUN_names[] =
- "ffffffffff\0" /* Parameter signature */
- "glColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char PixelTexGenParameterfSGIS_names[] =
- "if\0" /* Parameter signature */
- "glPixelTexGenParameterfSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor4fNormal3fVertex3fvSUN_names[] =
- "pppp\0" /* Parameter signature */
- "glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightModelfvSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glFragmentLightModelfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord3fARB_names[] =
- "ifff\0" /* Parameter signature */
- "glMultiTexCoord3f\0"
- "glMultiTexCoord3fARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const char GetPixelTexGenParameterfvSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glGetPixelTexGenParameterfvSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char GenFramebuffersEXT_names[] =
- "ip\0" /* Parameter signature */
- "glGenFramebuffersEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramParameterdvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetProgramParameterdvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameterfEXT_names[] =
- "iif\0" /* Parameter signature */
- "glPixelTransformParameterfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentLightfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3sNV_names[] =
- "iiii\0" /* Parameter signature */
- "glVertexAttrib3sNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NubARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glVertexAttrib4NubARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramEnvParameterfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramEnvParameterfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetTrackMatrixivNV_names[] =
- "iiip\0" /* Parameter signature */
- "glGetTrackMatrixivNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3svNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3svNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform4fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char MultTransposeMatrixfARB_names[] =
- "p\0" /* Parameter signature */
- "glMultTransposeMatrixf\0"
- "glMultTransposeMatrixfARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char ColorFragmentOp1ATI_names[] =
- "iiiiiii\0" /* Parameter signature */
- "glColorFragmentOp1ATI\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetUniformfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetUniformfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names[] =
- "iffffffffffff\0" /* Parameter signature */
- "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char DetachObjectARB_names[] =
- "ii\0" /* Parameter signature */
- "glDetachObjectARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char VertexBlendARB_names[] =
- "i\0" /* Parameter signature */
- "glVertexBlendARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3iMESA_names[] =
- "iii\0" /* Parameter signature */
- "glWindowPos3i\0"
- "glWindowPos3iARB\0"
- "glWindowPos3iMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char SeparableFilter2D_names[] =
- "iiiiiipp\0" /* Parameter signature */
- "glSeparableFilter2D\0"
- "glSeparableFilter2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor4ubVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glReplacementCodeuiColor4ubVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char CompressedTexImage2DARB_names[] =
- "iiiiiiip\0" /* Parameter signature */
- "glCompressedTexImage2D\0"
- "glCompressedTexImage2DARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char ArrayElement_names[] =
- "i\0" /* Parameter signature */
- "glArrayElement\0"
- "glArrayElementEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_depth_bounds_test)
-static const char DepthBoundsEXT_names[] =
- "dd\0" /* Parameter signature */
- "glDepthBoundsEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameters4fvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramParameters4fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const char DeformationMap3fSGIX_names[] =
- "iffiiffiiffiip\0" /* Parameter signature */
- "glDeformationMap3fSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramivNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexImage1D_names[] =
- "iiiiiii\0" /* Parameter signature */
- "glCopyTexImage1D\0"
- "glCopyTexImage1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char AlphaFragmentOp3ATI_names[] =
- "iiiiiiiiiiii\0" /* Parameter signature */
- "glAlphaFragmentOp3ATI\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribdvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribdvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetFinalCombinerInputParameterivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetFinalCombinerInputParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapParameterivNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetMapParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform4iARB_names[] =
- "iiiii\0" /* Parameter signature */
- "glUniform4iARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameteri_names[] =
- "iii\0" /* Parameter signature */
- "glConvolutionParameteri\0"
- "glConvolutionParameteriEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3sEXT_names[] =
- "iii\0" /* Parameter signature */
- "glBinormal3sEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char ConvolutionParameterf_names[] =
- "iif\0" /* Parameter signature */
- "glConvolutionParameterf\0"
- "glConvolutionParameterfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs2fvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs2fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const char MatrixIndexPointerARB_names[] =
- "iiip\0" /* Parameter signature */
- "glMatrixIndexPointerARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetMapParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char PassTexCoordATI_names[] =
- "iii\0" /* Parameter signature */
- "glPassTexCoordATI\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1fvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1fvNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3ivEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3ivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3dEXT_names[] =
- "ddd\0" /* Parameter signature */
- "glTangent3dEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3dvEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3dv\0"
- "glSecondaryColor3dvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays)
-static const char MultiDrawArraysEXT_names[] =
- "ippi\0" /* Parameter signature */
- "glMultiDrawArrays\0"
- "glMultiDrawArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char BindRenderbufferEXT_names[] =
- "ii\0" /* Parameter signature */
- "glBindRenderbufferEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4dARB_names[] =
- "idddd\0" /* Parameter signature */
- "glMultiTexCoord4d\0"
- "glMultiTexCoord4dARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const char GetColorTableSGI_names[] =
- "iiip\0" /* Parameter signature */
- "glGetColorTableSGI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3usEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3us\0"
- "glSecondaryColor3usEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glProgramLocalParameter4fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char DeleteProgramsNV_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteProgramsARB\0"
- "glDeleteProgramsNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1sARB_names[] =
- "ii\0" /* Parameter signature */
- "glMultiTexCoord1s\0"
- "glMultiTexCoord1sARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiColor3fVertex3fSUN_names[] =
- "iffffff\0" /* Parameter signature */
- "glReplacementCodeuiColor3fVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char GetVertexAttribPointervNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetVertexAttribPointervARB\0"
- "glGetVertexAttribPointervNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1dvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1dv\0"
- "glMultiTexCoord1dvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform2iARB_names[] =
- "iii\0" /* Parameter signature */
- "glUniform2iARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char GetConvolutionParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetConvolutionParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char GetProgramStringNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramStringNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char ColorPointerEXT_names[] =
- "iiiip\0" /* Parameter signature */
- "glColorPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char MapBufferARB_names[] =
- "ii\0" /* Parameter signature */
- "glMapBuffer\0"
- "glMapBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3svEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3svEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const char ApplyTextureEXT_names[] =
- "i\0" /* Parameter signature */
- "glApplyTextureEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const char TextureMaterialEXT_names[] =
- "ii\0" /* Parameter signature */
- "glTextureMaterialEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const char TextureLightEXT_names[] =
- "i\0" /* Parameter signature */
- "glTextureLightEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char ResetMinmax_names[] =
- "i\0" /* Parameter signature */
- "glResetMinmax\0"
- "glResetMinmaxEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char GenTexturesEXT_names[] =
- "ip\0" /* Parameter signature */
- "glGenTexturesEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameterfSGIX_names[] =
- "if\0" /* Parameter signature */
- "glSpriteParameterfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char GetMinmaxParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetMinmaxParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4dvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4dARB_names[] =
- "idddd\0" /* Parameter signature */
- "glVertexAttrib4dARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const char ProgramNamedParameter4dNV_names[] =
- "iipdddd\0" /* Parameter signature */
- "glProgramNamedParameter4dNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const char VertexWeightfEXT_names[] =
- "f\0" /* Parameter signature */
- "glVertexWeightfEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoordfvEXT_names[] =
- "p\0" /* Parameter signature */
- "glFogCoordfv\0"
- "glFogCoordfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord1iv\0"
- "glMultiTexCoord1ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3ubEXT_names[] =
- "iii\0" /* Parameter signature */
- "glSecondaryColor3ub\0"
- "glSecondaryColor3ubEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2ivARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2iv\0"
- "glMultiTexCoord2ivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_fog_function)
-static const char FogFuncSGIS_names[] =
- "ip\0" /* Parameter signature */
- "glFogFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexSubImage2D_names[] =
- "iiiiiiii\0" /* Parameter signature */
- "glCopyTexSubImage2D\0"
- "glCopyTexSubImage2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetObjectParameterivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetObjectParameterivARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fVertex4fSUN_names[] =
- "ffffffff\0" /* Parameter signature */
- "glTexCoord4fVertex4fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramLocalParameterdvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramLocalParameterdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1iARB_names[] =
- "ii\0" /* Parameter signature */
- "glMultiTexCoord1i\0"
- "glMultiTexCoord1iARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramivARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramivARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_blend_func_separate) || defined(need_GL_INGR_blend_func_separate)
-static const char BlendFuncSeparateEXT_names[] =
- "iiii\0" /* Parameter signature */
- "glBlendFuncSeparate\0"
- "glBlendFuncSeparateEXT\0"
- "glBlendFuncSeparateINGR\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char ProgramParameters4dvNV_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramParameters4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord2fColor3fVertex3fvSUN_names[] =
- "ppp\0" /* Parameter signature */
- "glTexCoord2fColor3fVertex3fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3dvEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3dvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char AreTexturesResidentEXT_names[] =
- "ipp\0" /* Parameter signature */
- "glAreTexturesResidentEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIS_fog_function)
-static const char GetFogFuncSGIS_names[] =
- "p\0" /* Parameter signature */
- "glGetFogFuncSGIS\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetUniformLocationARB_names[] =
- "ip\0" /* Parameter signature */
- "glGetUniformLocationARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3fEXT_names[] =
- "fff\0" /* Parameter signature */
- "glSecondaryColor3f\0"
- "glSecondaryColor3fEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerInputNV_names[] =
- "iiiiii\0" /* Parameter signature */
- "glCombinerInputNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib3sARB_names[] =
- "iiii\0" /* Parameter signature */
- "glVertexAttrib3sARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramStringARB_names[] =
- "iiip\0" /* Parameter signature */
- "glProgramStringARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char TexCoord4fVertex4fvSUN_names[] =
- "pp\0" /* Parameter signature */
- "glTexCoord4fVertex4fvSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1fNV_names[] =
- "if\0" /* Parameter signature */
- "glVertexAttrib1fNV\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentLightfSGIX_names[] =
- "iif\0" /* Parameter signature */
- "glFragmentLightfSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression)
-static const char GetCompressedTexImageARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetCompressedTexImage\0"
- "glGetCompressedTexImageARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const char VertexWeightPointerEXT_names[] =
- "iiip\0" /* Parameter signature */
- "glVertexWeightPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_stencil_two_side)
-static const char ActiveStencilFaceEXT_names[] =
- "i\0" /* Parameter signature */
- "glActiveStencilFaceEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_paletted_texture)
-static const char GetColorTableParameterfvEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetColorTableParameterfvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetShaderSourceARB_names[] =
- "iipp\0" /* Parameter signature */
- "glGetShaderSourceARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_igloo_interface)
-static const char IglooInterfaceSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glIglooInterfaceSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4dNV_names[] =
- "idddd\0" /* Parameter signature */
- "glVertexAttrib4dNV\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_multimode_draw_arrays)
-static const char MultiModeDrawElementsIBM_names[] =
- "ppipii\0" /* Parameter signature */
- "glMultiModeDrawElementsIBM\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4svARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord4sv\0"
- "glMultiTexCoord4svARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query)
-static const char GenQueriesARB_names[] =
- "ip\0" /* Parameter signature */
- "glGenQueries\0"
- "glGenQueriesARB\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const char ReplacementCodeuiVertex3fSUN_names[] =
- "ifff\0" /* Parameter signature */
- "glReplacementCodeuiVertex3fSUN\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3iEXT_names[] =
- "iii\0" /* Parameter signature */
- "glTangent3iEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUN_mesh_array)
-static const char DrawMeshArraysSUN_names[] =
- "iiii\0" /* Parameter signature */
- "glDrawMeshArraysSUN\0"
- "";
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const char GetMapControlPointsNV_names[] =
- "iiiiiip\0" /* Parameter signature */
- "glGetMapControlPointsNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform1fARB_names[] =
- "if\0" /* Parameter signature */
- "glUniform1fARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char ProgramLocalParameter4fARB_names[] =
- "iiffff\0" /* Parameter signature */
- "glProgramLocalParameter4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const char SpriteParameterivSGIX_names[] =
- "ip\0" /* Parameter signature */
- "glSpriteParameterivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord1fARB_names[] =
- "if\0" /* Parameter signature */
- "glMultiTexCoord1f\0"
- "glMultiTexCoord1fARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4ubvNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4ubvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightsvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightsvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform1fvARB_names[] =
- "iip\0" /* Parameter signature */
- "glUniform1fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const char CopyTexSubImage1D_names[] =
- "iiiiii\0" /* Parameter signature */
- "glCopyTexSubImage1D\0"
- "glCopyTexSubImage1DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char BindTexture_names[] =
- "ii\0" /* Parameter signature */
- "glBindTexture\0"
- "glBindTextureEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char BeginFragmentShaderATI_names[] =
- "\0" /* Parameter signature */
- "glBeginFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord4fARB_names[] =
- "iffff\0" /* Parameter signature */
- "glMultiTexCoord4f\0"
- "glMultiTexCoord4fARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs3svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs3svNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char EnableVertexAttribArrayARB_names[] =
- "i\0" /* Parameter signature */
- "glEnableVertexAttribArrayARB\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char NormalPointervINTEL_names[] =
- "ip\0" /* Parameter signature */
- "glNormalPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const char CopyConvolutionFilter2D_names[] =
- "iiiiii\0" /* Parameter signature */
- "glCopyConvolutionFilter2D\0"
- "glCopyConvolutionFilter2DEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3ivMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3iv\0"
- "glWindowPos3ivARB\0"
- "glWindowPos3ivMESA\0"
- "";
-#endif
-
-#if defined(need_GL_NV_fence)
-static const char FinishFenceNV_names[] =
- "i\0" /* Parameter signature */
- "glFinishFenceNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char IsBufferARB_names[] =
- "i\0" /* Parameter signature */
- "glIsBuffer\0"
- "glIsBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4iMESA_names[] =
- "iiii\0" /* Parameter signature */
- "glWindowPos4iMESA\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4uivARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4uivARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3bvEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3bvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_reference_plane)
-static const char ReferencePlaneSGIX_names[] =
- "p\0" /* Parameter signature */
- "glReferencePlaneSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3fvEXT_names[] =
- "p\0" /* Parameter signature */
- "glBinormal3fvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const char IsTextureEXT_names[] =
- "i\0" /* Parameter signature */
- "glIsTextureEXT\0"
- "";
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const char TexCoordPointervINTEL_names[] =
- "iip\0" /* Parameter signature */
- "glTexCoordPointervINTEL\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char DeleteBuffersARB_names[] =
- "ip\0" /* Parameter signature */
- "glDeleteBuffers\0"
- "glDeleteBuffersARB\0"
- "";
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const char WindowPos4fvMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos4fvMESA\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1sNV_names[] =
- "ii\0" /* Parameter signature */
- "glVertexAttrib1sNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color)
-static const char SecondaryColor3svEXT_names[] =
- "p\0" /* Parameter signature */
- "glSecondaryColor3sv\0"
- "glSecondaryColor3svEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix)
-static const char LoadTransposeMatrixfARB_names[] =
- "p\0" /* Parameter signature */
- "glLoadTransposeMatrixf\0"
- "glLoadTransposeMatrixfARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char GetPointerv_names[] =
- "ip\0" /* Parameter signature */
- "glGetPointerv\0"
- "glGetPointervEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3bEXT_names[] =
- "iii\0" /* Parameter signature */
- "glTangent3bEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameterfNV_names[] =
- "if\0" /* Parameter signature */
- "glCombinerParameterfNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char BindProgramNV_names[] =
- "ii\0" /* Parameter signature */
- "glBindProgramARB\0"
- "glBindProgramNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4svARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char Uniform3fARB_names[] =
- "ifff\0" /* Parameter signature */
- "glUniform3fARB\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char BindFragmentShaderATI_names[] =
- "i\0" /* Parameter signature */
- "glBindFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char UnmapBufferARB_names[] =
- "i\0" /* Parameter signature */
- "glUnmapBuffer\0"
- "glUnmapBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const char Minmax_names[] =
- "iii\0" /* Parameter signature */
- "glMinmax\0"
- "glMinmaxEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
-static const char FogCoorddvEXT_names[] =
- "p\0" /* Parameter signature */
- "glFogCoorddv\0"
- "glFogCoorddvEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SUNX_constant_data)
-static const char FinishTextureSUNX_names[] =
- "\0" /* Parameter signature */
- "glFinishTextureSUNX\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char GetFragmentLightfvSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glGetFragmentLightfvSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetFinalCombinerInputParameterfvNV_names[] =
- "iip\0" /* Parameter signature */
- "glGetFinalCombinerInputParameterfvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2svARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib2svARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char AreProgramsResidentNV_names[] =
- "ipp\0" /* Parameter signature */
- "glAreProgramsResidentNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos3svMESA_names[] =
- "p\0" /* Parameter signature */
- "glWindowPos3sv\0"
- "glWindowPos3svARB\0"
- "glWindowPos3svMESA\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_color_subtable)
-static const char CopyColorSubTable_names[] =
- "iiiii\0" /* Parameter signature */
- "glCopyColorSubTable\0"
- "glCopyColorSubTableEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightdvARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const char PollInstrumentsSGIX_names[] =
- "p\0" /* Parameter signature */
- "glPollInstrumentsSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib4NubvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4NubvARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib3dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib3dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetObjectParameterfvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetObjectParameterfvARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char GetProgramEnvParameterdvARB_names[] =
- "iip\0" /* Parameter signature */
- "glGetProgramEnvParameterdvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_compiled_vertex_array)
-static const char LockArraysEXT_names[] =
- "ii\0" /* Parameter signature */
- "glLockArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const char PixelTransformParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glPixelTransformParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char BinormalPointerEXT_names[] =
- "iip\0" /* Parameter signature */
- "glBinormalPointerEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib1dNV_names[] =
- "id\0" /* Parameter signature */
- "glVertexAttrib1dNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char GetCombinerInputParameterivNV_names[] =
- "iiiip\0" /* Parameter signature */
- "glGetCombinerInputParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const char MultiTexCoord2fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glMultiTexCoord2fv\0"
- "glMultiTexCoord2fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const char GetRenderbufferParameterivEXT_names[] =
- "iip\0" /* Parameter signature */
- "glGetRenderbufferParameterivEXT\0"
- "";
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const char CombinerParameterivNV_names[] =
- "ip\0" /* Parameter signature */
- "glCombinerParameterivNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char GenFragmentShadersATI_names[] =
- "i\0" /* Parameter signature */
- "glGenFragmentShadersATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const char DrawArrays_names[] =
- "iii\0" /* Parameter signature */
- "glDrawArrays\0"
- "glDrawArraysEXT\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const char WeightuivARB_names[] =
- "ip\0" /* Parameter signature */
- "glWeightuivARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib2sARB_names[] =
- "iii\0" /* Parameter signature */
- "glVertexAttrib2sARB\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const char GenAsyncMarkersSGIX_names[] =
- "i\0" /* Parameter signature */
- "glGenAsyncMarkersSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Tangent3svEXT_names[] =
- "p\0" /* Parameter signature */
- "glTangent3svEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char BindBufferARB_names[] =
- "ii\0" /* Parameter signature */
- "glBindBuffer\0"
- "glBindBufferARB\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const char GetInfoLogARB_names[] =
- "iipp\0" /* Parameter signature */
- "glGetInfoLogARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs4svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs4svNV\0"
- "";
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const char EdgeFlagPointerListIBM_names[] =
- "ipi\0" /* Parameter signature */
- "glEdgeFlagPointerListIBM\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const char VertexAttrib1fvARB_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib1fvARB\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object)
-static const char GenBuffersARB_names[] =
- "ip\0" /* Parameter signature */
- "glGenBuffers\0"
- "glGenBuffersARB\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttribs1svNV_names[] =
- "iip\0" /* Parameter signature */
- "glVertexAttribs1svNV\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3bEXT_names[] =
- "iii\0" /* Parameter signature */
- "glBinormal3bEXT\0"
- "";
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const char FragmentMaterialivSGIX_names[] =
- "iip\0" /* Parameter signature */
- "glFragmentMaterialivSGIX\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_array_range)
-static const char VertexArrayRangeNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexArrayRangeNV\0"
- "";
-#endif
-
-#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program)
-static const char GenProgramsNV_names[] =
- "ip\0" /* Parameter signature */
- "glGenProgramsARB\0"
- "glGenProgramsNV\0"
- "";
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const char VertexAttrib4dvNV_names[] =
- "ip\0" /* Parameter signature */
- "glVertexAttrib4dvNV\0"
- "";
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const char EndFragmentShaderATI_names[] =
- "\0" /* Parameter signature */
- "glEndFragmentShaderATI\0"
- "";
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const char Binormal3iEXT_names[] =
- "iii\0" /* Parameter signature */
- "glBinormal3iEXT\0"
- "";
-#endif
-
-#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos)
-static const char WindowPos2fMESA_names[] =
- "ff\0" /* Parameter signature */
- "glWindowPos2f\0"
- "glWindowPos2fARB\0"
- "glWindowPos2fMESA\0"
- "";
-#endif
-
-#if defined(need_GL_3DFX_tbuffer)
-static const struct dri_extension_function GL_3DFX_tbuffer_functions[] = {
- { TbufferMask3DFX_names, TbufferMask3DFX_remap_index, 553 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_draw_buffers)
-static const struct dri_extension_function GL_ARB_draw_buffers_functions[] = {
- { DrawBuffersARB_names, DrawBuffersARB_remap_index, 413 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_matrix_palette)
-static const struct dri_extension_function GL_ARB_matrix_palette_functions[] = {
- { MatrixIndexusvARB_names, MatrixIndexusvARB_remap_index, -1 },
- { MatrixIndexuivARB_names, MatrixIndexuivARB_remap_index, -1 },
- { CurrentPaletteMatrixARB_names, CurrentPaletteMatrixARB_remap_index, -1 },
- { MatrixIndexubvARB_names, MatrixIndexubvARB_remap_index, -1 },
- { MatrixIndexPointerARB_names, MatrixIndexPointerARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_multisample)
-static const struct dri_extension_function GL_ARB_multisample_functions[] = {
- { SampleCoverageARB_names, SampleCoverageARB_remap_index, 412 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_occlusion_query)
-static const struct dri_extension_function GL_ARB_occlusion_query_functions[] = {
- { BeginQueryARB_names, BeginQueryARB_remap_index, 703 },
- { GetQueryivARB_names, GetQueryivARB_remap_index, 705 },
- { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, 706 },
- { EndQueryARB_names, EndQueryARB_remap_index, 704 },
- { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, 707 },
- { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, 701 },
- { IsQueryARB_names, IsQueryARB_remap_index, 702 },
- { GenQueriesARB_names, GenQueriesARB_remap_index, 700 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_point_parameters)
-static const struct dri_extension_function GL_ARB_point_parameters_functions[] = {
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, 458 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, 459 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_shader_objects)
-static const struct dri_extension_function GL_ARB_shader_objects_functions[] = {
- { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, 739 },
- { Uniform2fARB_names, Uniform2fARB_remap_index, 723 },
- { Uniform2ivARB_names, Uniform2ivARB_remap_index, 735 },
- { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, 740 },
- { CreateProgramObjectARB_names, CreateProgramObjectARB_remap_index, 717 },
- { Uniform3iARB_names, Uniform3iARB_remap_index, 728 },
- { CreateShaderObjectARB_names, CreateShaderObjectARB_remap_index, 714 },
- { AttachObjectARB_names, AttachObjectARB_remap_index, 718 },
- { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, 738 },
- { GetAttachedObjectsARB_names, GetAttachedObjectsARB_remap_index, 744 },
- { Uniform3fvARB_names, Uniform3fvARB_remap_index, 732 },
- { GetHandleARB_names, GetHandleARB_remap_index, 712 },
- { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, 746 },
- { GetUniformivARB_names, GetUniformivARB_remap_index, 748 },
- { Uniform2fvARB_names, Uniform2fvARB_remap_index, 731 },
- { DeleteObjectARB_names, DeleteObjectARB_remap_index, 711 },
- { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, 720 },
- { Uniform3ivARB_names, Uniform3ivARB_remap_index, 736 },
- { CompileShaderARB_names, CompileShaderARB_remap_index, 716 },
- { Uniform4fARB_names, Uniform4fARB_remap_index, 725 },
- { LinkProgramARB_names, LinkProgramARB_remap_index, 719 },
- { ShaderSourceARB_names, ShaderSourceARB_remap_index, 715 },
- { Uniform4ivARB_names, Uniform4ivARB_remap_index, 737 },
- { Uniform1ivARB_names, Uniform1ivARB_remap_index, 734 },
- { ValidateProgramARB_names, ValidateProgramARB_remap_index, 721 },
- { Uniform1iARB_names, Uniform1iARB_remap_index, 726 },
- { Uniform4fvARB_names, Uniform4fvARB_remap_index, 733 },
- { GetUniformfvARB_names, GetUniformfvARB_remap_index, 747 },
- { DetachObjectARB_names, DetachObjectARB_remap_index, 713 },
- { Uniform4iARB_names, Uniform4iARB_remap_index, 729 },
- { Uniform2iARB_names, Uniform2iARB_remap_index, 727 },
- { GetObjectParameterivARB_names, GetObjectParameterivARB_remap_index, 742 },
- { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, 745 },
- { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, 749 },
- { Uniform1fARB_names, Uniform1fARB_remap_index, 722 },
- { Uniform1fvARB_names, Uniform1fvARB_remap_index, 730 },
- { Uniform3fARB_names, Uniform3fARB_remap_index, 724 },
- { GetObjectParameterfvARB_names, GetObjectParameterfvARB_remap_index, 741 },
- { GetInfoLogARB_names, GetInfoLogARB_remap_index, 743 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_texture_compression)
-static const struct dri_extension_function GL_ARB_texture_compression_functions[] = {
- { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, 558 },
- { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, 554 },
- { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, 556 },
- { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, 559 },
- { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, 557 },
- { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, 555 },
- { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, 560 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_transpose_matrix)
-static const struct dri_extension_function GL_ARB_transpose_matrix_functions[] = {
- { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, 411 },
- { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, 409 },
- { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, 410 },
- { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, 408 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_blend)
-static const struct dri_extension_function GL_ARB_vertex_blend_functions[] = {
- { WeightubvARB_names, WeightubvARB_remap_index, -1 },
- { WeightivARB_names, WeightivARB_remap_index, -1 },
- { WeightPointerARB_names, WeightPointerARB_remap_index, -1 },
- { WeightfvARB_names, WeightfvARB_remap_index, -1 },
- { WeightbvARB_names, WeightbvARB_remap_index, -1 },
- { WeightusvARB_names, WeightusvARB_remap_index, -1 },
- { VertexBlendARB_names, VertexBlendARB_remap_index, -1 },
- { WeightsvARB_names, WeightsvARB_remap_index, -1 },
- { WeightdvARB_names, WeightdvARB_remap_index, -1 },
- { WeightuivARB_names, WeightuivARB_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_buffer_object)
-static const struct dri_extension_function GL_ARB_vertex_buffer_object_functions[] = {
- { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, 695 },
- { BufferSubDataARB_names, BufferSubDataARB_remap_index, 690 },
- { BufferDataARB_names, BufferDataARB_remap_index, 689 },
- { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, 694 },
- { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, 693 },
- { MapBufferARB_names, MapBufferARB_remap_index, 697 },
- { IsBufferARB_names, IsBufferARB_remap_index, 696 },
- { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, 691 },
- { UnmapBufferARB_names, UnmapBufferARB_remap_index, 698 },
- { BindBufferARB_names, BindBufferARB_remap_index, 688 },
- { GenBuffersARB_names, GenBuffersARB_remap_index, 692 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_program)
-static const struct dri_extension_function GL_ARB_vertex_program_functions[] = {
- { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, 669 },
- { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, 611 },
- { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, 617 },
- { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, 608 },
- { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, 662 },
- { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, 666 },
- { ProgramLocalParameter4dARB_names, ProgramLocalParameter4dARB_remap_index, 672 },
- { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, 605 },
- { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, 659 },
- { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, 607 },
- { GetProgramLocalParameterfvARB_names, GetProgramLocalParameterfvARB_remap_index, 679 },
- { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, 616 },
- { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, 671 },
- { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, 590 },
- { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, 655 },
- { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, 654 },
- { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, 615 },
- { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, 623 },
- { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, 624 },
- { ProgramLocalParameter4dvARB_names, ProgramLocalParameter4dvARB_remap_index, 673 },
- { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, 657 },
- { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, 609 },
- { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, 604 },
- { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, 589 },
- { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, 656 },
- { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, 670 },
- { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, 625 },
- { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, 610 },
- { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, 612 },
- { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, 661 },
- { GetProgramStringARB_names, GetProgramStringARB_remap_index, 681 },
- { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, 663 },
- { IsProgramNV_names, IsProgramNV_remap_index, 592 },
- { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, 668 },
- { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, 603 },
- { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, 620 },
- { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, 588 },
- { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, 622 },
- { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, 664 },
- { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, 660 },
- { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, 618 },
- { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, 627 },
- { GetProgramEnvParameterfvARB_names, GetProgramEnvParameterfvARB_remap_index, 677 },
- { ProgramLocalParameter4fvARB_names, ProgramLocalParameter4fvARB_remap_index, 675 },
- { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, 580 },
- { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, 591 },
- { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, 621 },
- { GetProgramLocalParameterdvARB_names, GetProgramLocalParameterdvARB_remap_index, 678 },
- { GetProgramivARB_names, GetProgramivARB_remap_index, 680 },
- { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, 619 },
- { ProgramStringARB_names, ProgramStringARB_remap_index, 667 },
- { ProgramLocalParameter4fARB_names, ProgramLocalParameter4fARB_remap_index, 674 },
- { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, 665 },
- { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, 658 },
- { BindProgramNV_names, BindProgramNV_remap_index, 579 },
- { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, 626 },
- { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, 614 },
- { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, 628 },
- { GetProgramEnvParameterdvARB_names, GetProgramEnvParameterdvARB_remap_index, 676 },
- { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, 613 },
- { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, 606 },
- { GenProgramsNV_names, GenProgramsNV_remap_index, 582 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_vertex_shader)
-static const struct dri_extension_function GL_ARB_vertex_shader_functions[] = {
- { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, 751 },
- { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, 752 },
- { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, 750 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ARB_window_pos)
-static const struct dri_extension_function GL_ARB_window_pos_functions[] = {
- { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, 523 },
- { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, 514 },
- { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, 520 },
- { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, 521 },
- { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, 516 },
- { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, 513 },
- { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, 522 },
- { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, 524 },
- { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, 517 },
- { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, 527 },
- { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, 518 },
- { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, 519 },
- { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, 525 },
- { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, 526 },
- { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, 528 },
- { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, 515 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_blend_equation_separate)
-static const struct dri_extension_function GL_ATI_blend_equation_separate_functions[] = {
- { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, 710 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_draw_buffers)
-static const struct dri_extension_function GL_ATI_draw_buffers_functions[] = {
- { DrawBuffersARB_names, DrawBuffersARB_remap_index, 413 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_ATI_fragment_shader)
-static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = {
- { ColorFragmentOp3ATI_names, ColorFragmentOp3ATI_remap_index, 791 },
- { ColorFragmentOp2ATI_names, ColorFragmentOp2ATI_remap_index, 790 },
- { DeleteFragmentShaderATI_names, DeleteFragmentShaderATI_remap_index, 784 },
- { SetFragmentShaderConstantATI_names, SetFragmentShaderConstantATI_remap_index, 795 },
- { SampleMapATI_names, SampleMapATI_remap_index, 788 },
- { AlphaFragmentOp2ATI_names, AlphaFragmentOp2ATI_remap_index, 793 },
- { AlphaFragmentOp1ATI_names, AlphaFragmentOp1ATI_remap_index, 792 },
- { ColorFragmentOp1ATI_names, ColorFragmentOp1ATI_remap_index, 789 },
- { AlphaFragmentOp3ATI_names, AlphaFragmentOp3ATI_remap_index, 794 },
- { PassTexCoordATI_names, PassTexCoordATI_remap_index, 787 },
- { BeginFragmentShaderATI_names, BeginFragmentShaderATI_remap_index, 785 },
- { BindFragmentShaderATI_names, BindFragmentShaderATI_remap_index, 783 },
- { GenFragmentShadersATI_names, GenFragmentShadersATI_remap_index, 782 },
- { EndFragmentShaderATI_names, EndFragmentShaderATI_remap_index, 786 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_color)
-static const struct dri_extension_function GL_EXT_blend_color_functions[] = {
- { BlendColor_names, -1, 336 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_equation_separate)
-static const struct dri_extension_function GL_EXT_blend_equation_separate_functions[] = {
- { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, 710 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_func_separate)
-static const struct dri_extension_function GL_EXT_blend_func_separate_functions[] = {
- { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, 537 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_blend_minmax)
-static const struct dri_extension_function GL_EXT_blend_minmax_functions[] = {
- { BlendEquation_names, -1, 337 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_color_subtable)
-static const struct dri_extension_function GL_EXT_color_subtable_functions[] = {
- { ColorSubTable_names, -1, 346 },
- { CopyColorSubTable_names, -1, 347 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_compiled_vertex_array)
-static const struct dri_extension_function GL_EXT_compiled_vertex_array_functions[] = {
- { UnlockArraysEXT_names, UnlockArraysEXT_remap_index, 541 },
- { LockArraysEXT_names, LockArraysEXT_remap_index, 540 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_convolution)
-static const struct dri_extension_function GL_EXT_convolution_functions[] = {
- { ConvolutionFilter1D_names, -1, 348 },
- { CopyConvolutionFilter1D_names, -1, 354 },
- { ConvolutionFilter2D_names, -1, 349 },
- { ConvolutionParameteriv_names, -1, 353 },
- { ConvolutionParameterfv_names, -1, 351 },
- { GetSeparableFilterEXT_names, GetSeparableFilterEXT_remap_index, 426 },
- { GetConvolutionFilterEXT_names, GetConvolutionFilterEXT_remap_index, 423 },
- { GetConvolutionParameterfvEXT_names, GetConvolutionParameterfvEXT_remap_index, 424 },
- { SeparableFilter2D_names, -1, 360 },
- { ConvolutionParameteri_names, -1, 352 },
- { ConvolutionParameterf_names, -1, 350 },
- { GetConvolutionParameterivEXT_names, GetConvolutionParameterivEXT_remap_index, 425 },
- { CopyConvolutionFilter2D_names, -1, 355 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_coordinate_frame)
-static const struct dri_extension_function GL_EXT_coordinate_frame_functions[] = {
- { Binormal3fEXT_names, Binormal3fEXT_remap_index, -1 },
- { TangentPointerEXT_names, TangentPointerEXT_remap_index, -1 },
- { Binormal3ivEXT_names, Binormal3ivEXT_remap_index, -1 },
- { Tangent3sEXT_names, Tangent3sEXT_remap_index, -1 },
- { Tangent3fvEXT_names, Tangent3fvEXT_remap_index, -1 },
- { Tangent3dvEXT_names, Tangent3dvEXT_remap_index, -1 },
- { Binormal3bvEXT_names, Binormal3bvEXT_remap_index, -1 },
- { Binormal3dEXT_names, Binormal3dEXT_remap_index, -1 },
- { Tangent3fEXT_names, Tangent3fEXT_remap_index, -1 },
- { Binormal3sEXT_names, Binormal3sEXT_remap_index, -1 },
- { Tangent3ivEXT_names, Tangent3ivEXT_remap_index, -1 },
- { Tangent3dEXT_names, Tangent3dEXT_remap_index, -1 },
- { Binormal3svEXT_names, Binormal3svEXT_remap_index, -1 },
- { Binormal3dvEXT_names, Binormal3dvEXT_remap_index, -1 },
- { Tangent3iEXT_names, Tangent3iEXT_remap_index, -1 },
- { Tangent3bvEXT_names, Tangent3bvEXT_remap_index, -1 },
- { Binormal3fvEXT_names, Binormal3fvEXT_remap_index, -1 },
- { Tangent3bEXT_names, Tangent3bEXT_remap_index, -1 },
- { BinormalPointerEXT_names, BinormalPointerEXT_remap_index, -1 },
- { Tangent3svEXT_names, Tangent3svEXT_remap_index, -1 },
- { Binormal3bEXT_names, Binormal3bEXT_remap_index, -1 },
- { Binormal3iEXT_names, Binormal3iEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_copy_texture)
-static const struct dri_extension_function GL_EXT_copy_texture_functions[] = {
- { CopyTexSubImage3D_names, -1, 373 },
- { CopyTexImage2D_names, -1, 324 },
- { CopyTexImage1D_names, -1, 323 },
- { CopyTexSubImage2D_names, -1, 326 },
- { CopyTexSubImage1D_names, -1, 325 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_cull_vertex)
-static const struct dri_extension_function GL_EXT_cull_vertex_functions[] = {
- { CullParameterdvEXT_names, CullParameterdvEXT_remap_index, 542 },
- { CullParameterfvEXT_names, CullParameterfvEXT_remap_index, 543 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_depth_bounds_test)
-static const struct dri_extension_function GL_EXT_depth_bounds_test_functions[] = {
- { DepthBoundsEXT_names, DepthBoundsEXT_remap_index, 699 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_draw_range_elements)
-static const struct dri_extension_function GL_EXT_draw_range_elements_functions[] = {
- { DrawRangeElements_names, -1, 338 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_fog_coord)
-static const struct dri_extension_function GL_EXT_fog_coord_functions[] = {
- { FogCoorddEXT_names, FogCoorddEXT_remap_index, 547 },
- { FogCoordfEXT_names, FogCoordfEXT_remap_index, 545 },
- { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, 549 },
- { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, 546 },
- { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, 548 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_framebuffer_object)
-static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = {
- { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, 812 },
- { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, 796 },
- { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, 800 },
- { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, 806 },
- { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, 798 },
- { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, 809 },
- { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, 810 },
- { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, 807 },
- { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, 803 },
- { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, 799 },
- { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, 802 },
- { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, 808 },
- { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, 811 },
- { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, 804 },
- { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, 805 },
- { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, 797 },
- { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, 801 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_histogram)
-static const struct dri_extension_function GL_EXT_histogram_functions[] = {
- { Histogram_names, -1, 367 },
- { GetHistogramParameterivEXT_names, GetHistogramParameterivEXT_remap_index, 419 },
- { ResetHistogram_names, -1, 369 },
- { GetMinmaxEXT_names, GetMinmaxEXT_remap_index, 420 },
- { GetHistogramParameterfvEXT_names, GetHistogramParameterfvEXT_remap_index, 418 },
- { GetHistogramEXT_names, GetHistogramEXT_remap_index, 417 },
- { GetMinmaxParameterfvEXT_names, GetMinmaxParameterfvEXT_remap_index, 421 },
- { ResetMinmax_names, -1, 370 },
- { GetMinmaxParameterivEXT_names, GetMinmaxParameterivEXT_remap_index, 422 },
- { Minmax_names, -1, 368 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_index_func)
-static const struct dri_extension_function GL_EXT_index_func_functions[] = {
- { IndexFuncEXT_names, IndexFuncEXT_remap_index, 539 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_index_material)
-static const struct dri_extension_function GL_EXT_index_material_functions[] = {
- { IndexMaterialEXT_names, IndexMaterialEXT_remap_index, 538 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_light_texture)
-static const struct dri_extension_function GL_EXT_light_texture_functions[] = {
- { ApplyTextureEXT_names, ApplyTextureEXT_remap_index, -1 },
- { TextureMaterialEXT_names, TextureMaterialEXT_remap_index, -1 },
- { TextureLightEXT_names, TextureLightEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_multi_draw_arrays)
-static const struct dri_extension_function GL_EXT_multi_draw_arrays_functions[] = {
- { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, 645 },
- { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, 644 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_multisample)
-static const struct dri_extension_function GL_EXT_multisample_functions[] = {
- { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, 446 },
- { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, 447 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_paletted_texture)
-static const struct dri_extension_function GL_EXT_paletted_texture_functions[] = {
- { GetColorTableParameterivEXT_names, GetColorTableParameterivEXT_remap_index, 551 },
- { GetColorTableEXT_names, GetColorTableEXT_remap_index, 550 },
- { ColorTable_names, -1, 339 },
- { GetColorTableParameterfvEXT_names, GetColorTableParameterfvEXT_remap_index, 552 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_pixel_transform)
-static const struct dri_extension_function GL_EXT_pixel_transform_functions[] = {
- { PixelTransformParameterfvEXT_names, PixelTransformParameterfvEXT_remap_index, -1 },
- { PixelTransformParameteriEXT_names, PixelTransformParameteriEXT_remap_index, -1 },
- { PixelTransformParameterfEXT_names, PixelTransformParameterfEXT_remap_index, -1 },
- { PixelTransformParameterivEXT_names, PixelTransformParameterivEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_point_parameters)
-static const struct dri_extension_function GL_EXT_point_parameters_functions[] = {
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, 458 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, 459 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_polygon_offset)
-static const struct dri_extension_function GL_EXT_polygon_offset_functions[] = {
- { PolygonOffsetEXT_names, PolygonOffsetEXT_remap_index, 414 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_secondary_color)
-static const struct dri_extension_function GL_EXT_secondary_color_functions[] = {
- { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, 567 },
- { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, 561 },
- { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, 562 },
- { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, 569 },
- { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, 563 },
- { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, 577 },
- { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, 573 },
- { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, 576 },
- { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, 568 },
- { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, 566 },
- { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, 572 },
- { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, 574 },
- { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, 564 },
- { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, 575 },
- { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, 571 },
- { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, 565 },
- { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, 570 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_stencil_two_side)
-static const struct dri_extension_function GL_EXT_stencil_two_side_functions[] = {
- { ActiveStencilFaceEXT_names, ActiveStencilFaceEXT_remap_index, 646 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_subtexture)
-static const struct dri_extension_function GL_EXT_subtexture_functions[] = {
- { TexSubImage1D_names, -1, 332 },
- { TexSubImage2D_names, -1, 333 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture3D)
-static const struct dri_extension_function GL_EXT_texture3D_functions[] = {
- { TexImage3D_names, -1, 371 },
- { TexSubImage3D_names, -1, 372 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_object)
-static const struct dri_extension_function GL_EXT_texture_object_functions[] = {
- { PrioritizeTextures_names, -1, 331 },
- { DeleteTextures_names, -1, 327 },
- { GenTexturesEXT_names, GenTexturesEXT_remap_index, 440 },
- { AreTexturesResidentEXT_names, AreTexturesResidentEXT_remap_index, 439 },
- { BindTexture_names, -1, 307 },
- { IsTextureEXT_names, IsTextureEXT_remap_index, 441 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_texture_perturb_normal)
-static const struct dri_extension_function GL_EXT_texture_perturb_normal_functions[] = {
- { TextureNormalEXT_names, TextureNormalEXT_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_vertex_array)
-static const struct dri_extension_function GL_EXT_vertex_array_functions[] = {
- { IndexPointerEXT_names, IndexPointerEXT_remap_index, 450 },
- { NormalPointerEXT_names, NormalPointerEXT_remap_index, 451 },
- { VertexPointerEXT_names, VertexPointerEXT_remap_index, 453 },
- { TexCoordPointerEXT_names, TexCoordPointerEXT_remap_index, 452 },
- { EdgeFlagPointerEXT_names, EdgeFlagPointerEXT_remap_index, 449 },
- { ArrayElement_names, -1, 306 },
- { ColorPointerEXT_names, ColorPointerEXT_remap_index, 448 },
- { GetPointerv_names, -1, 329 },
- { DrawArrays_names, -1, 310 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_EXT_vertex_weighting)
-static const struct dri_extension_function GL_EXT_vertex_weighting_functions[] = {
- { VertexWeightfvEXT_names, VertexWeightfvEXT_remap_index, 495 },
- { VertexWeightfEXT_names, VertexWeightfEXT_remap_index, 494 },
- { VertexWeightPointerEXT_names, VertexWeightPointerEXT_remap_index, 496 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_HP_image_transform)
-static const struct dri_extension_function GL_HP_image_transform_functions[] = {
- { GetImageTransformParameterfvHP_names, GetImageTransformParameterfvHP_remap_index, -1 },
- { ImageTransformParameterfHP_names, ImageTransformParameterfHP_remap_index, -1 },
- { ImageTransformParameterfvHP_names, ImageTransformParameterfvHP_remap_index, -1 },
- { ImageTransformParameteriHP_names, ImageTransformParameteriHP_remap_index, -1 },
- { GetImageTransformParameterivHP_names, GetImageTransformParameterivHP_remap_index, -1 },
- { ImageTransformParameterivHP_names, ImageTransformParameterivHP_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_IBM_multimode_draw_arrays)
-static const struct dri_extension_function GL_IBM_multimode_draw_arrays_functions[] = {
- { MultiModeDrawArraysIBM_names, MultiModeDrawArraysIBM_remap_index, 708 },
- { MultiModeDrawElementsIBM_names, MultiModeDrawElementsIBM_remap_index, 709 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_IBM_vertex_array_lists)
-static const struct dri_extension_function GL_IBM_vertex_array_lists_functions[] = {
- { SecondaryColorPointerListIBM_names, SecondaryColorPointerListIBM_remap_index, -1 },
- { NormalPointerListIBM_names, NormalPointerListIBM_remap_index, -1 },
- { FogCoordPointerListIBM_names, FogCoordPointerListIBM_remap_index, -1 },
- { VertexPointerListIBM_names, VertexPointerListIBM_remap_index, -1 },
- { ColorPointerListIBM_names, ColorPointerListIBM_remap_index, -1 },
- { TexCoordPointerListIBM_names, TexCoordPointerListIBM_remap_index, -1 },
- { IndexPointerListIBM_names, IndexPointerListIBM_remap_index, -1 },
- { EdgeFlagPointerListIBM_names, EdgeFlagPointerListIBM_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_INGR_blend_func_separate)
-static const struct dri_extension_function GL_INGR_blend_func_separate_functions[] = {
- { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, 537 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_INTEL_parallel_arrays)
-static const struct dri_extension_function GL_INTEL_parallel_arrays_functions[] = {
- { VertexPointervINTEL_names, VertexPointervINTEL_remap_index, -1 },
- { ColorPointervINTEL_names, ColorPointervINTEL_remap_index, -1 },
- { NormalPointervINTEL_names, NormalPointervINTEL_remap_index, -1 },
- { TexCoordPointervINTEL_names, TexCoordPointervINTEL_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_MESA_resize_buffers)
-static const struct dri_extension_function GL_MESA_resize_buffers_functions[] = {
- { ResizeBuffersMESA_names, ResizeBuffersMESA_remap_index, 512 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_MESA_window_pos)
-static const struct dri_extension_function GL_MESA_window_pos_functions[] = {
- { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, 523 },
- { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, 514 },
- { WindowPos4svMESA_names, WindowPos4svMESA_remap_index, 536 },
- { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, 520 },
- { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, 521 },
- { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, 516 },
- { WindowPos4dMESA_names, WindowPos4dMESA_remap_index, 529 },
- { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, 513 },
- { WindowPos4ivMESA_names, WindowPos4ivMESA_remap_index, 534 },
- { WindowPos4fMESA_names, WindowPos4fMESA_remap_index, 531 },
- { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, 522 },
- { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, 524 },
- { WindowPos4dvMESA_names, WindowPos4dvMESA_remap_index, 530 },
- { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, 517 },
- { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, 527 },
- { WindowPos4sMESA_names, WindowPos4sMESA_remap_index, 535 },
- { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, 518 },
- { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, 519 },
- { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, 525 },
- { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, 526 },
- { WindowPos4iMESA_names, WindowPos4iMESA_remap_index, 533 },
- { WindowPos4fvMESA_names, WindowPos4fvMESA_remap_index, 532 },
- { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, 528 },
- { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, 515 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_evaluators)
-static const struct dri_extension_function GL_NV_evaluators_functions[] = {
- { GetMapAttribParameterivNV_names, GetMapAttribParameterivNV_remap_index, -1 },
- { MapControlPointsNV_names, MapControlPointsNV_remap_index, -1 },
- { MapParameterfvNV_names, MapParameterfvNV_remap_index, -1 },
- { EvalMapsNV_names, EvalMapsNV_remap_index, -1 },
- { GetMapAttribParameterfvNV_names, GetMapAttribParameterfvNV_remap_index, -1 },
- { MapParameterivNV_names, MapParameterivNV_remap_index, -1 },
- { GetMapParameterivNV_names, GetMapParameterivNV_remap_index, -1 },
- { GetMapParameterfvNV_names, GetMapParameterfvNV_remap_index, -1 },
- { GetMapControlPointsNV_names, GetMapControlPointsNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_fence)
-static const struct dri_extension_function GL_NV_fence_functions[] = {
- { GenFencesNV_names, GenFencesNV_remap_index, 648 },
- { TestFenceNV_names, TestFenceNV_remap_index, 650 },
- { IsFenceNV_names, IsFenceNV_remap_index, 649 },
- { DeleteFencesNV_names, DeleteFencesNV_remap_index, 647 },
- { SetFenceNV_names, SetFenceNV_remap_index, 653 },
- { GetFenceivNV_names, GetFenceivNV_remap_index, 651 },
- { FinishFenceNV_names, FinishFenceNV_remap_index, 652 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_fragment_program)
-static const struct dri_extension_function GL_NV_fragment_program_functions[] = {
- { GetProgramNamedParameterdvNV_names, GetProgramNamedParameterdvNV_remap_index, 687 },
- { GetProgramNamedParameterfvNV_names, GetProgramNamedParameterfvNV_remap_index, 686 },
- { ProgramNamedParameter4fNV_names, ProgramNamedParameter4fNV_remap_index, 682 },
- { ProgramNamedParameter4fvNV_names, ProgramNamedParameter4fvNV_remap_index, 684 },
- { ProgramNamedParameter4dvNV_names, ProgramNamedParameter4dvNV_remap_index, 685 },
- { ProgramNamedParameter4dNV_names, ProgramNamedParameter4dNV_remap_index, 683 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_point_sprite)
-static const struct dri_extension_function GL_NV_point_sprite_functions[] = {
- { PointParameteriNV_names, PointParameteriNV_remap_index, 642 },
- { PointParameterivNV_names, PointParameterivNV_remap_index, 643 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_register_combiners)
-static const struct dri_extension_function GL_NV_register_combiners_functions[] = {
- { CombinerParameterfvNV_names, CombinerParameterfvNV_remap_index, 499 },
- { GetCombinerOutputParameterfvNV_names, GetCombinerOutputParameterfvNV_remap_index, 508 },
- { FinalCombinerInputNV_names, FinalCombinerInputNV_remap_index, 505 },
- { GetCombinerInputParameterfvNV_names, GetCombinerInputParameterfvNV_remap_index, 506 },
- { GetCombinerOutputParameterivNV_names, GetCombinerOutputParameterivNV_remap_index, 509 },
- { CombinerOutputNV_names, CombinerOutputNV_remap_index, 504 },
- { CombinerParameteriNV_names, CombinerParameteriNV_remap_index, 502 },
- { GetFinalCombinerInputParameterivNV_names, GetFinalCombinerInputParameterivNV_remap_index, 511 },
- { CombinerInputNV_names, CombinerInputNV_remap_index, 503 },
- { CombinerParameterfNV_names, CombinerParameterfNV_remap_index, 500 },
- { GetFinalCombinerInputParameterfvNV_names, GetFinalCombinerInputParameterfvNV_remap_index, 510 },
- { GetCombinerInputParameterivNV_names, GetCombinerInputParameterivNV_remap_index, 507 },
- { CombinerParameterivNV_names, CombinerParameterivNV_remap_index, 501 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_register_combiners2)
-static const struct dri_extension_function GL_NV_register_combiners2_functions[] = {
- { CombinerStageParameterfvNV_names, CombinerStageParameterfvNV_remap_index, -1 },
- { GetCombinerStageParameterfvNV_names, GetCombinerStageParameterfvNV_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_vertex_array_range)
-static const struct dri_extension_function GL_NV_vertex_array_range_functions[] = {
- { FlushVertexArrayRangeNV_names, FlushVertexArrayRangeNV_remap_index, 497 },
- { VertexArrayRangeNV_names, VertexArrayRangeNV_remap_index, 498 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_NV_vertex_program)
-static const struct dri_extension_function GL_NV_vertex_program_functions[] = {
- { ProgramParameter4fNV_names, ProgramParameter4fNV_remap_index, 596 },
- { VertexAttrib4ubvNV_names, VertexAttrib4ubvNV_remap_index, 781 },
- { VertexAttrib4svNV_names, VertexAttrib4svNV_remap_index, 779 },
- { VertexAttribs1dvNV_names, VertexAttribs1dvNV_remap_index, 629 },
- { ProgramParameter4dvNV_names, ProgramParameter4dvNV_remap_index, 595 },
- { VertexAttrib4fNV_names, VertexAttrib4fNV_remap_index, 776 },
- { VertexAttrib2dNV_names, VertexAttrib2dNV_remap_index, 762 },
- { VertexAttrib4ubNV_names, VertexAttrib4ubNV_remap_index, 780 },
- { VertexAttribs3dvNV_names, VertexAttribs3dvNV_remap_index, 635 },
- { VertexAttribs4fvNV_names, VertexAttribs4fvNV_remap_index, 639 },
- { VertexAttrib2sNV_names, VertexAttrib2sNV_remap_index, 766 },
- { VertexAttribs3fvNV_names, VertexAttribs3fvNV_remap_index, 636 },
- { ProgramParameter4dNV_names, ProgramParameter4dNV_remap_index, 594 },
- { LoadProgramNV_names, LoadProgramNV_remap_index, 593 },
- { VertexAttrib4fvNV_names, VertexAttrib4fvNV_remap_index, 777 },
- { VertexAttrib3fNV_names, VertexAttrib3fNV_remap_index, 770 },
- { VertexAttribs2dvNV_names, VertexAttribs2dvNV_remap_index, 632 },
- { GetProgramParameterfvNV_names, GetProgramParameterfvNV_remap_index, 584 },
- { VertexAttrib3dNV_names, VertexAttrib3dNV_remap_index, 768 },
- { VertexAttrib2fvNV_names, VertexAttrib2fvNV_remap_index, 765 },
- { VertexAttrib2dvNV_names, VertexAttrib2dvNV_remap_index, 763 },
- { VertexAttrib1dvNV_names, VertexAttrib1dvNV_remap_index, 757 },
- { ProgramParameter4fvNV_names, ProgramParameter4fvNV_remap_index, 597 },
- { VertexAttrib1svNV_names, VertexAttrib1svNV_remap_index, 761 },
- { VertexAttribs2svNV_names, VertexAttribs2svNV_remap_index, 634 },
- { GetVertexAttribivNV_names, GetVertexAttribivNV_remap_index, 755 },
- { GetVertexAttribfvNV_names, GetVertexAttribfvNV_remap_index, 754 },
- { VertexAttrib2svNV_names, VertexAttrib2svNV_remap_index, 767 },
- { VertexAttribs1fvNV_names, VertexAttribs1fvNV_remap_index, 630 },
- { IsProgramNV_names, IsProgramNV_remap_index, 592 },
- { VertexAttrib4sNV_names, VertexAttrib4sNV_remap_index, 778 },
- { VertexAttrib2fNV_names, VertexAttrib2fNV_remap_index, 764 },
- { RequestResidentProgramsNV_names, RequestResidentProgramsNV_remap_index, 600 },
- { ExecuteProgramNV_names, ExecuteProgramNV_remap_index, 581 },
- { VertexAttribPointerNV_names, VertexAttribPointerNV_remap_index, 602 },
- { TrackMatrixNV_names, TrackMatrixNV_remap_index, 601 },
- { GetProgramParameterdvNV_names, GetProgramParameterdvNV_remap_index, 583 },
- { VertexAttrib3sNV_names, VertexAttrib3sNV_remap_index, 772 },
- { GetTrackMatrixivNV_names, GetTrackMatrixivNV_remap_index, 587 },
- { VertexAttrib3svNV_names, VertexAttrib3svNV_remap_index, 773 },
- { ProgramParameters4fvNV_names, ProgramParameters4fvNV_remap_index, 599 },
- { GetProgramivNV_names, GetProgramivNV_remap_index, 585 },
- { GetVertexAttribdvNV_names, GetVertexAttribdvNV_remap_index, 753 },
- { VertexAttrib3fvNV_names, VertexAttrib3fvNV_remap_index, 771 },
- { VertexAttribs2fvNV_names, VertexAttribs2fvNV_remap_index, 633 },
- { VertexAttrib1fvNV_names, VertexAttrib1fvNV_remap_index, 759 },
- { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, 580 },
- { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, 591 },
- { GetProgramStringNV_names, GetProgramStringNV_remap_index, 586 },
- { VertexAttribs4dvNV_names, VertexAttribs4dvNV_remap_index, 638 },
- { ProgramParameters4dvNV_names, ProgramParameters4dvNV_remap_index, 598 },
- { VertexAttrib1fNV_names, VertexAttrib1fNV_remap_index, 758 },
- { VertexAttrib4dNV_names, VertexAttrib4dNV_remap_index, 774 },
- { VertexAttribs4ubvNV_names, VertexAttribs4ubvNV_remap_index, 641 },
- { VertexAttribs3svNV_names, VertexAttribs3svNV_remap_index, 637 },
- { VertexAttrib1sNV_names, VertexAttrib1sNV_remap_index, 760 },
- { BindProgramNV_names, BindProgramNV_remap_index, 579 },
- { AreProgramsResidentNV_names, AreProgramsResidentNV_remap_index, 578 },
- { VertexAttrib3dvNV_names, VertexAttrib3dvNV_remap_index, 769 },
- { VertexAttrib1dNV_names, VertexAttrib1dNV_remap_index, 756 },
- { VertexAttribs4svNV_names, VertexAttribs4svNV_remap_index, 640 },
- { VertexAttribs1svNV_names, VertexAttribs1svNV_remap_index, 631 },
- { GenProgramsNV_names, GenProgramsNV_remap_index, 582 },
- { VertexAttrib4dvNV_names, VertexAttrib4dvNV_remap_index, 775 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_PGI_misc_hints)
-static const struct dri_extension_function GL_PGI_misc_hints_functions[] = {
- { HintPGI_names, HintPGI_remap_index, 544 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_detail_texture)
-static const struct dri_extension_function GL_SGIS_detail_texture_functions[] = {
- { GetDetailTexFuncSGIS_names, GetDetailTexFuncSGIS_remap_index, 443 },
- { DetailTexFuncSGIS_names, DetailTexFuncSGIS_remap_index, 442 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_fog_function)
-static const struct dri_extension_function GL_SGIS_fog_function_functions[] = {
- { FogFuncSGIS_names, FogFuncSGIS_remap_index, -1 },
- { GetFogFuncSGIS_names, GetFogFuncSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_multisample)
-static const struct dri_extension_function GL_SGIS_multisample_functions[] = {
- { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, 446 },
- { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, 447 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_pixel_texture)
-static const struct dri_extension_function GL_SGIS_pixel_texture_functions[] = {
- { PixelTexGenParameterfvSGIS_names, PixelTexGenParameterfvSGIS_remap_index, 434 },
- { GetPixelTexGenParameterivSGIS_names, GetPixelTexGenParameterivSGIS_remap_index, 435 },
- { PixelTexGenParameteriSGIS_names, PixelTexGenParameteriSGIS_remap_index, 431 },
- { PixelTexGenParameterivSGIS_names, PixelTexGenParameterivSGIS_remap_index, 432 },
- { PixelTexGenParameterfSGIS_names, PixelTexGenParameterfSGIS_remap_index, 433 },
- { GetPixelTexGenParameterfvSGIS_names, GetPixelTexGenParameterfvSGIS_remap_index, 436 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_point_parameters)
-static const struct dri_extension_function GL_SGIS_point_parameters_functions[] = {
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, 458 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, 459 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_sharpen_texture)
-static const struct dri_extension_function GL_SGIS_sharpen_texture_functions[] = {
- { GetSharpenTexFuncSGIS_names, GetSharpenTexFuncSGIS_remap_index, 445 },
- { SharpenTexFuncSGIS_names, SharpenTexFuncSGIS_remap_index, 444 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture4D)
-static const struct dri_extension_function GL_SGIS_texture4D_functions[] = {
- { TexImage4DSGIS_names, TexImage4DSGIS_remap_index, 437 },
- { TexSubImage4DSGIS_names, TexSubImage4DSGIS_remap_index, 438 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture_color_mask)
-static const struct dri_extension_function GL_SGIS_texture_color_mask_functions[] = {
- { TextureColorMaskSGIS_names, TextureColorMaskSGIS_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIS_texture_filter4)
-static const struct dri_extension_function GL_SGIS_texture_filter4_functions[] = {
- { GetTexFilterFuncSGIS_names, GetTexFilterFuncSGIS_remap_index, 415 },
- { TexFilterFuncSGIS_names, TexFilterFuncSGIS_remap_index, 416 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_async)
-static const struct dri_extension_function GL_SGIX_async_functions[] = {
- { AsyncMarkerSGIX_names, AsyncMarkerSGIX_remap_index, -1 },
- { FinishAsyncSGIX_names, FinishAsyncSGIX_remap_index, -1 },
- { PollAsyncSGIX_names, PollAsyncSGIX_remap_index, -1 },
- { DeleteAsyncMarkersSGIX_names, DeleteAsyncMarkersSGIX_remap_index, -1 },
- { IsAsyncMarkerSGIX_names, IsAsyncMarkerSGIX_remap_index, -1 },
- { GenAsyncMarkersSGIX_names, GenAsyncMarkersSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_flush_raster)
-static const struct dri_extension_function GL_SGIX_flush_raster_functions[] = {
- { FlushRasterSGIX_names, FlushRasterSGIX_remap_index, 469 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_fragment_lighting)
-static const struct dri_extension_function GL_SGIX_fragment_lighting_functions[] = {
- { FragmentMaterialfvSGIX_names, FragmentMaterialfvSGIX_remap_index, 486 },
- { FragmentLightModelivSGIX_names, FragmentLightModelivSGIX_remap_index, 484 },
- { FragmentLightiSGIX_names, FragmentLightiSGIX_remap_index, 479 },
- { GetFragmentMaterialfvSGIX_names, GetFragmentMaterialfvSGIX_remap_index, 491 },
- { FragmentMaterialfSGIX_names, FragmentMaterialfSGIX_remap_index, 485 },
- { GetFragmentLightivSGIX_names, GetFragmentLightivSGIX_remap_index, 490 },
- { FragmentLightModeliSGIX_names, FragmentLightModeliSGIX_remap_index, 483 },
- { FragmentLightivSGIX_names, FragmentLightivSGIX_remap_index, 480 },
- { GetFragmentMaterialivSGIX_names, GetFragmentMaterialivSGIX_remap_index, 492 },
- { FragmentLightModelfSGIX_names, FragmentLightModelfSGIX_remap_index, 481 },
- { FragmentColorMaterialSGIX_names, FragmentColorMaterialSGIX_remap_index, 476 },
- { FragmentMaterialiSGIX_names, FragmentMaterialiSGIX_remap_index, 487 },
- { LightEnviSGIX_names, LightEnviSGIX_remap_index, 493 },
- { FragmentLightModelfvSGIX_names, FragmentLightModelfvSGIX_remap_index, 482 },
- { FragmentLightfvSGIX_names, FragmentLightfvSGIX_remap_index, 478 },
- { FragmentLightfSGIX_names, FragmentLightfSGIX_remap_index, 477 },
- { GetFragmentLightfvSGIX_names, GetFragmentLightfvSGIX_remap_index, 489 },
- { FragmentMaterialivSGIX_names, FragmentMaterialivSGIX_remap_index, 488 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_framezoom)
-static const struct dri_extension_function GL_SGIX_framezoom_functions[] = {
- { FrameZoomSGIX_names, FrameZoomSGIX_remap_index, 466 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_igloo_interface)
-static const struct dri_extension_function GL_SGIX_igloo_interface_functions[] = {
- { IglooInterfaceSGIX_names, IglooInterfaceSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_instruments)
-static const struct dri_extension_function GL_SGIX_instruments_functions[] = {
- { ReadInstrumentsSGIX_names, ReadInstrumentsSGIX_remap_index, 463 },
- { GetInstrumentsSGIX_names, GetInstrumentsSGIX_remap_index, 460 },
- { StartInstrumentsSGIX_names, StartInstrumentsSGIX_remap_index, 464 },
- { StopInstrumentsSGIX_names, StopInstrumentsSGIX_remap_index, 465 },
- { InstrumentsBufferSGIX_names, InstrumentsBufferSGIX_remap_index, 461 },
- { PollInstrumentsSGIX_names, PollInstrumentsSGIX_remap_index, 462 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_list_priority)
-static const struct dri_extension_function GL_SGIX_list_priority_functions[] = {
- { ListParameterfSGIX_names, ListParameterfSGIX_remap_index, 472 },
- { GetListParameterivSGIX_names, GetListParameterivSGIX_remap_index, 471 },
- { GetListParameterfvSGIX_names, GetListParameterfvSGIX_remap_index, 470 },
- { ListParameteriSGIX_names, ListParameteriSGIX_remap_index, 474 },
- { ListParameterfvSGIX_names, ListParameterfvSGIX_remap_index, 473 },
- { ListParameterivSGIX_names, ListParameterivSGIX_remap_index, 475 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_pixel_texture)
-static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = {
- { PixelTexGenSGIX_names, PixelTexGenSGIX_remap_index, 430 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_polynomial_ffd)
-static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = {
- { LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 },
- { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
- { DeformSGIX_names, DeformSGIX_remap_index, -1 },
- { DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_reference_plane)
-static const struct dri_extension_function GL_SGIX_reference_plane_functions[] = {
- { ReferencePlaneSGIX_names, ReferencePlaneSGIX_remap_index, 468 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_sprite)
-static const struct dri_extension_function GL_SGIX_sprite_functions[] = {
- { SpriteParameterfvSGIX_names, SpriteParameterfvSGIX_remap_index, 455 },
- { SpriteParameteriSGIX_names, SpriteParameteriSGIX_remap_index, 456 },
- { SpriteParameterfSGIX_names, SpriteParameterfSGIX_remap_index, 454 },
- { SpriteParameterivSGIX_names, SpriteParameterivSGIX_remap_index, 457 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGIX_tag_sample_buffer)
-static const struct dri_extension_function GL_SGIX_tag_sample_buffer_functions[] = {
- { TagSampleBufferSGIX_names, TagSampleBufferSGIX_remap_index, 467 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SGI_color_table)
-static const struct dri_extension_function GL_SGI_color_table_functions[] = {
- { GetColorTableParameterfvSGI_names, GetColorTableParameterfvSGI_remap_index, 428 },
- { ColorTableParameteriv_names, -1, 341 },
- { ColorTable_names, -1, 339 },
- { CopyColorTable_names, -1, 342 },
- { ColorTableParameterfv_names, -1, 340 },
- { GetColorTableParameterivSGI_names, GetColorTableParameterivSGI_remap_index, 429 },
- { GetColorTableSGI_names, GetColorTableSGI_remap_index, 427 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUNX_constant_data)
-static const struct dri_extension_function GL_SUNX_constant_data_functions[] = {
- { FinishTextureSUNX_names, FinishTextureSUNX_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_global_alpha)
-static const struct dri_extension_function GL_SUN_global_alpha_functions[] = {
- { GlobalAlphaFactorubSUN_names, GlobalAlphaFactorubSUN_remap_index, -1 },
- { GlobalAlphaFactoriSUN_names, GlobalAlphaFactoriSUN_remap_index, -1 },
- { GlobalAlphaFactordSUN_names, GlobalAlphaFactordSUN_remap_index, -1 },
- { GlobalAlphaFactoruiSUN_names, GlobalAlphaFactoruiSUN_remap_index, -1 },
- { GlobalAlphaFactorbSUN_names, GlobalAlphaFactorbSUN_remap_index, -1 },
- { GlobalAlphaFactorfSUN_names, GlobalAlphaFactorfSUN_remap_index, -1 },
- { GlobalAlphaFactorusSUN_names, GlobalAlphaFactorusSUN_remap_index, -1 },
- { GlobalAlphaFactorsSUN_names, GlobalAlphaFactorsSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_mesh_array)
-static const struct dri_extension_function GL_SUN_mesh_array_functions[] = {
- { DrawMeshArraysSUN_names, DrawMeshArraysSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_triangle_list)
-static const struct dri_extension_function GL_SUN_triangle_list_functions[] = {
- { ReplacementCodeubSUN_names, ReplacementCodeubSUN_remap_index, -1 },
- { ReplacementCodeubvSUN_names, ReplacementCodeubvSUN_remap_index, -1 },
- { ReplacementCodeuivSUN_names, ReplacementCodeuivSUN_remap_index, -1 },
- { ReplacementCodeusvSUN_names, ReplacementCodeusvSUN_remap_index, -1 },
- { ReplacementCodePointerSUN_names, ReplacementCodePointerSUN_remap_index, -1 },
- { ReplacementCodeusSUN_names, ReplacementCodeusSUN_remap_index, -1 },
- { ReplacementCodeuiSUN_names, ReplacementCodeuiSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_SUN_vertex)
-static const struct dri_extension_function GL_SUN_vertex_functions[] = {
- { ReplacementCodeuiColor3fVertex3fvSUN_names, ReplacementCodeuiColor3fVertex3fvSUN_remap_index, -1 },
- { TexCoord4fColor4fNormal3fVertex4fvSUN_names, TexCoord4fColor4fNormal3fVertex4fvSUN_remap_index, -1 },
- { TexCoord2fColor4ubVertex3fvSUN_names, TexCoord2fColor4ubVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiVertex3fvSUN_names, ReplacementCodeuiVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiNormal3fVertex3fSUN_names, ReplacementCodeuiNormal3fVertex3fSUN_remap_index, -1 },
- { Color4ubVertex3fvSUN_names, Color4ubVertex3fvSUN_remap_index, -1 },
- { Color4ubVertex3fSUN_names, Color4ubVertex3fSUN_remap_index, -1 },
- { TexCoord2fVertex3fSUN_names, TexCoord2fVertex3fSUN_remap_index, -1 },
- { TexCoord2fColor4fNormal3fVertex3fSUN_names, TexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 },
- { TexCoord2fNormal3fVertex3fvSUN_names, TexCoord2fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fVertex3fSUN_names, ReplacementCodeuiTexCoord2fVertex3fSUN_remap_index, -1 },
- { Color3fVertex3fSUN_names, Color3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiNormal3fVertex3fvSUN_names, ReplacementCodeuiNormal3fVertex3fvSUN_remap_index, -1 },
- { Color3fVertex3fvSUN_names, Color3fVertex3fvSUN_remap_index, -1 },
- { Color4fNormal3fVertex3fvSUN_names, Color4fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_remap_index, -1 },
- { TexCoord2fColor3fVertex3fSUN_names, TexCoord2fColor3fVertex3fSUN_remap_index, -1 },
- { TexCoord4fColor4fNormal3fVertex4fSUN_names, TexCoord4fColor4fNormal3fVertex4fSUN_remap_index, -1 },
- { Color4ubVertex2fvSUN_names, Color4ubVertex2fvSUN_remap_index, -1 },
- { Normal3fVertex3fSUN_names, Normal3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fSUN_remap_index, -1 },
- { TexCoord2fNormal3fVertex3fSUN_names, TexCoord2fNormal3fVertex3fSUN_remap_index, -1 },
- { TexCoord2fVertex3fvSUN_names, TexCoord2fVertex3fvSUN_remap_index, -1 },
- { Color4ubVertex2fSUN_names, Color4ubVertex2fSUN_remap_index, -1 },
- { ReplacementCodeuiColor4ubVertex3fSUN_names, ReplacementCodeuiColor4ubVertex3fSUN_remap_index, -1 },
- { TexCoord2fColor4ubVertex3fSUN_names, TexCoord2fColor4ubVertex3fSUN_remap_index, -1 },
- { Normal3fVertex3fvSUN_names, Normal3fVertex3fvSUN_remap_index, -1 },
- { Color4fNormal3fVertex3fSUN_names, Color4fNormal3fVertex3fSUN_remap_index, -1 },
- { TexCoord2fColor4fNormal3fVertex3fvSUN_names, TexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 },
- { ReplacementCodeuiColor4ubVertex3fvSUN_names, ReplacementCodeuiColor4ubVertex3fvSUN_remap_index, -1 },
- { ReplacementCodeuiColor3fVertex3fSUN_names, ReplacementCodeuiColor3fVertex3fSUN_remap_index, -1 },
- { TexCoord4fVertex4fSUN_names, TexCoord4fVertex4fSUN_remap_index, -1 },
- { TexCoord2fColor3fVertex3fvSUN_names, TexCoord2fColor3fVertex3fvSUN_remap_index, -1 },
- { TexCoord4fVertex4fvSUN_names, TexCoord4fVertex4fvSUN_remap_index, -1 },
- { ReplacementCodeuiVertex3fSUN_names, ReplacementCodeuiVertex3fSUN_remap_index, -1 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_3)
-static const struct dri_extension_function GL_VERSION_1_3_functions[] = {
- { SampleCoverageARB_names, SampleCoverageARB_remap_index, 412 },
- { MultiTexCoord3sARB_names, -1, 398 },
- { ActiveTextureARB_names, -1, 374 },
- { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, 558 },
- { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, 554 },
- { MultiTexCoord1fvARB_names, -1, 379 },
- { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, 411 },
- { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, 556 },
- { MultiTexCoord3dARB_names, -1, 392 },
- { MultiTexCoord2iARB_names, -1, 388 },
- { MultiTexCoord2svARB_names, -1, 391 },
- { MultiTexCoord2fARB_names, -1, 386 },
- { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, 409 },
- { MultiTexCoord3fvARB_names, -1, 395 },
- { MultiTexCoord4sARB_names, -1, 406 },
- { MultiTexCoord2dvARB_names, -1, 385 },
- { MultiTexCoord1svARB_names, -1, 383 },
- { MultiTexCoord3svARB_names, -1, 399 },
- { MultiTexCoord4iARB_names, -1, 404 },
- { MultiTexCoord3iARB_names, -1, 396 },
- { MultiTexCoord1dARB_names, -1, 376 },
- { MultiTexCoord3dvARB_names, -1, 393 },
- { MultiTexCoord3ivARB_names, -1, 397 },
- { MultiTexCoord2sARB_names, -1, 390 },
- { MultiTexCoord4ivARB_names, -1, 405 },
- { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, 559 },
- { ClientActiveTextureARB_names, -1, 375 },
- { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, 557 },
- { MultiTexCoord2dARB_names, -1, 384 },
- { MultiTexCoord4dvARB_names, -1, 401 },
- { MultiTexCoord4fvARB_names, -1, 403 },
- { MultiTexCoord3fARB_names, -1, 394 },
- { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, 410 },
- { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, 555 },
- { MultiTexCoord4dARB_names, -1, 400 },
- { MultiTexCoord1sARB_names, -1, 382 },
- { MultiTexCoord1dvARB_names, -1, 377 },
- { MultiTexCoord1ivARB_names, -1, 381 },
- { MultiTexCoord2ivARB_names, -1, 389 },
- { MultiTexCoord1iARB_names, -1, 380 },
- { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, 560 },
- { MultiTexCoord4svARB_names, -1, 407 },
- { MultiTexCoord1fARB_names, -1, 378 },
- { MultiTexCoord4fARB_names, -1, 402 },
- { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, 408 },
- { MultiTexCoord2fvARB_names, -1, 387 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_4)
-static const struct dri_extension_function GL_VERSION_1_4_functions[] = {
- { PointParameteriNV_names, PointParameteriNV_remap_index, 642 },
- { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, 567 },
- { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, 523 },
- { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, 514 },
- { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, 561 },
- { PointParameterfEXT_names, PointParameterfEXT_remap_index, 458 },
- { FogCoorddEXT_names, FogCoorddEXT_remap_index, 547 },
- { FogCoordfEXT_names, FogCoordfEXT_remap_index, 545 },
- { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, 520 },
- { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, 521 },
- { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, 459 },
- { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, 516 },
- { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, 562 },
- { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, 569 },
- { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, 563 },
- { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, 513 },
- { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, 577 },
- { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, 573 },
- { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, 576 },
- { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, 522 },
- { PointParameterivNV_names, PointParameterivNV_remap_index, 643 },
- { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, 524 },
- { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, 568 },
- { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, 517 },
- { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, 566 },
- { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, 527 },
- { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, 518 },
- { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, 645 },
- { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, 519 },
- { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, 549 },
- { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, 572 },
- { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, 574 },
- { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, 525 },
- { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, 564 },
- { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, 644 },
- { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, 575 },
- { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, 546 },
- { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, 571 },
- { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, 537 },
- { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, 565 },
- { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, 526 },
- { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, 570 },
- { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, 548 },
- { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, 528 },
- { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, 515 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_1_5)
-static const struct dri_extension_function GL_VERSION_1_5_functions[] = {
- { BeginQueryARB_names, BeginQueryARB_remap_index, 703 },
- { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, 695 },
- { BufferSubDataARB_names, BufferSubDataARB_remap_index, 690 },
- { GetQueryivARB_names, GetQueryivARB_remap_index, 705 },
- { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, 706 },
- { BufferDataARB_names, BufferDataARB_remap_index, 689 },
- { EndQueryARB_names, EndQueryARB_remap_index, 704 },
- { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, 694 },
- { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, 707 },
- { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, 693 },
- { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, 701 },
- { IsQueryARB_names, IsQueryARB_remap_index, 702 },
- { MapBufferARB_names, MapBufferARB_remap_index, 697 },
- { GenQueriesARB_names, GenQueriesARB_remap_index, 700 },
- { IsBufferARB_names, IsBufferARB_remap_index, 696 },
- { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, 691 },
- { UnmapBufferARB_names, UnmapBufferARB_remap_index, 698 },
- { BindBufferARB_names, BindBufferARB_remap_index, 688 },
- { GenBuffersARB_names, GenBuffersARB_remap_index, 692 },
- { NULL, 0, 0 }
-};
-#endif
-
-#if defined(need_GL_VERSION_2_0)
-static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
- { StencilMaskSeparate_names, StencilMaskSeparate_remap_index, 815 },
- { StencilOpSeparate_names, StencilOpSeparate_remap_index, 814 },
- { StencilFuncSeparate_names, StencilFuncSeparate_remap_index, 813 },
- { NULL, 0, 0 }
-};
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.NX.original b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.NX.original
deleted file mode 100644
index 066c5ffba..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.NX.original
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2003
- * 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, 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file glcontextmodes.c
- * Utility routines for working with \c __GLcontextModes structures. At
- * some point most or all of these functions will be moved to the Mesa
- * code base.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#if defined(IN_MINI_GLX)
-# include <stdlib.h>
-# include <string.h>
-# include <GL/gl.h>
-# include "GL/internal/dri_interface.h"
-# include "imports.h"
-# define __glXMemset memset
-#else
-# include <X11/X.h>
-# include <GL/glx.h>
-# include "GL/glxint.h"
-
-# ifdef XFree86Server
-void *memset( void * ptr, int val, size_t size);
-# include "GL/glx_ansic.h"
-extern void * __glXMalloc( size_t size );
-extern void __glXFree( void * ptr );
-# define _mesa_malloc(b) __glXMalloc(b)
-# define _mesa_free(m) __glXFree(m)
-# else
-# include <X11/Xlibint.h>
-# define __glXMemset memset
-# define _mesa_malloc(b) Xmalloc(b)
-# define _mesa_free(m) Xfree(m)
-# endif /* XFree86Server */
-#endif /* !defined(IN_MINI_GLX) */
-
-#include "glcontextmodes.h"
-
-#if !defined(IN_MINI_GLX)
-#define NUM_VISUAL_TYPES 6
-
-/**
- * Convert an X visual type to a GLX visual type.
- *
- * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.)
- * to be converted.
- * \return If \c visualType is a valid X visual type, a GLX visual type will
- * be returned. Otherwise \c GLX_NONE will be returned.
- */
-GLint
-_gl_convert_from_x_visual_type( int visualType )
-{
- static const int glx_visual_types[ NUM_VISUAL_TYPES ] = {
- GLX_STATIC_GRAY, GLX_GRAY_SCALE,
- GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
- GLX_TRUE_COLOR, GLX_DIRECT_COLOR
- };
-
- return ( (unsigned) visualType < NUM_VISUAL_TYPES )
- ? glx_visual_types[ visualType ] : GLX_NONE;
-}
-
-
-/**
- * Convert a GLX visual type to an X visual type.
- *
- * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR,
- * \c GLX_STATIC_GRAY, etc.) to be converted.
- * \return If \c visualType is a valid GLX visual type, an X visual type will
- * be returned. Otherwise -1 will be returned.
- */
-GLint
-_gl_convert_to_x_visual_type( int visualType )
-{
- static const int x_visual_types[ NUM_VISUAL_TYPES ] = {
- TrueColor, DirectColor,
- PseudoColor, StaticColor,
- GrayScale, StaticGray
- };
-
- return ( (unsigned) (visualType - GLX_TRUE_COLOR) <= NUM_VISUAL_TYPES )
- ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
-}
-
-
-/**
- * Copy a GLX visual config structure to a GL context mode structure. All
- * of the fields in \c config are copied to \c mode. Additional fields in
- * \c mode that can be derrived from the fields of \c config (i.e.,
- * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode
- * that cannot be derrived are set to default values.
- *
- * \param mode Destination GL context mode.
- * \param config Source GLX visual config.
- *
- * \note
- * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes
- * structure will be set to the \c vid of the \c __GLXvisualConfig structure.
- */
-void
-_gl_copy_visual_to_context_mode( __GLcontextModes * mode,
- const __GLXvisualConfig * config )
-{
- __GLcontextModes * const next = mode->next;
-
- (void) __glXMemset( mode, 0, sizeof( __GLcontextModes ) );
- mode->next = next;
-
- mode->visualID = config->vid;
- mode->visualType = _gl_convert_from_x_visual_type( config->class );
- mode->xRenderable = GL_TRUE;
- mode->fbconfigID = config->vid;
- mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
-
- mode->rgbMode = (config->rgba != 0);
- mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
- mode->colorIndexMode = !(mode->rgbMode);
- mode->doubleBufferMode = (config->doubleBuffer != 0);
- mode->stereoMode = (config->stereo != 0);
-
- mode->haveAccumBuffer = ((config->accumRedSize +
- config->accumGreenSize +
- config->accumBlueSize +
- config->accumAlphaSize) > 0);
- mode->haveDepthBuffer = (config->depthSize > 0);
- mode->haveStencilBuffer = (config->stencilSize > 0);
-
- mode->redBits = config->redSize;
- mode->greenBits = config->greenSize;
- mode->blueBits = config->blueSize;
- mode->alphaBits = config->alphaSize;
- mode->redMask = config->redMask;
- mode->greenMask = config->greenMask;
- mode->blueMask = config->blueMask;
- mode->alphaMask = config->alphaMask;
- mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
- mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
-
- mode->accumRedBits = config->accumRedSize;
- mode->accumGreenBits = config->accumGreenSize;
- mode->accumBlueBits = config->accumBlueSize;
- mode->accumAlphaBits = config->accumAlphaSize;
- mode->depthBits = config->depthSize;
- mode->stencilBits = config->stencilSize;
-
- mode->numAuxBuffers = config->auxBuffers;
- mode->level = config->level;
-
- mode->visualRating = config->visualRating;
- mode->transparentPixel = config->transparentPixel;
- mode->transparentRed = config->transparentRed;
- mode->transparentGreen = config->transparentGreen;
- mode->transparentBlue = config->transparentBlue;
- mode->transparentAlpha = config->transparentAlpha;
- mode->transparentIndex = config->transparentIndex;
-
- mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
-}
-
-
-/**
- * Get data from a GL context mode.
- *
- * \param mode GL context mode whose data is to be returned.
- * \param attribute Attribute of \c mode that is to be returned.
- * \param value_return Location to store the data member of \c mode.
- * \return If \c attribute is a valid attribute of \c mode, zero is
- * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned.
- */
-int
-_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
- int *value_return)
-{
- switch (attribute) {
- case GLX_USE_GL:
- *value_return = GL_TRUE;
- return 0;
- case GLX_BUFFER_SIZE:
- *value_return = mode->rgbBits;
- return 0;
- case GLX_RGBA:
- *value_return = mode->rgbMode;
- return 0;
- case GLX_RED_SIZE:
- *value_return = mode->redBits;
- return 0;
- case GLX_GREEN_SIZE:
- *value_return = mode->greenBits;
- return 0;
- case GLX_BLUE_SIZE:
- *value_return = mode->blueBits;
- return 0;
- case GLX_ALPHA_SIZE:
- *value_return = mode->alphaBits;
- return 0;
- case GLX_DOUBLEBUFFER:
- *value_return = mode->doubleBufferMode;
- return 0;
- case GLX_STEREO:
- *value_return = mode->stereoMode;
- return 0;
- case GLX_AUX_BUFFERS:
- *value_return = mode->numAuxBuffers;
- return 0;
- case GLX_DEPTH_SIZE:
- *value_return = mode->depthBits;
- return 0;
- case GLX_STENCIL_SIZE:
- *value_return = mode->stencilBits;
- return 0;
- case GLX_ACCUM_RED_SIZE:
- *value_return = mode->accumRedBits;
- return 0;
- case GLX_ACCUM_GREEN_SIZE:
- *value_return = mode->accumGreenBits;
- return 0;
- case GLX_ACCUM_BLUE_SIZE:
- *value_return = mode->accumBlueBits;
- return 0;
- case GLX_ACCUM_ALPHA_SIZE:
- *value_return = mode->accumAlphaBits;
- return 0;
- case GLX_LEVEL:
- *value_return = mode->level;
- return 0;
- case GLX_TRANSPARENT_TYPE_EXT:
- *value_return = mode->transparentPixel;
- return 0;
- case GLX_TRANSPARENT_RED_VALUE:
- *value_return = mode->transparentRed;
- return 0;
- case GLX_TRANSPARENT_GREEN_VALUE:
- *value_return = mode->transparentGreen;
- return 0;
- case GLX_TRANSPARENT_BLUE_VALUE:
- *value_return = mode->transparentBlue;
- return 0;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- *value_return = mode->transparentAlpha;
- return 0;
- case GLX_TRANSPARENT_INDEX_VALUE:
- *value_return = mode->transparentIndex;
- return 0;
- case GLX_X_VISUAL_TYPE:
- *value_return = mode->visualType;
- return 0;
- case GLX_CONFIG_CAVEAT:
- *value_return = mode->visualRating;
- return 0;
- case GLX_VISUAL_ID:
- *value_return = mode->visualID;
- return 0;
- case GLX_DRAWABLE_TYPE:
- *value_return = mode->drawableType;
- return 0;
- case GLX_RENDER_TYPE:
- *value_return = mode->renderType;
- return 0;
- case GLX_X_RENDERABLE:
- *value_return = mode->xRenderable;
- return 0;
- case GLX_FBCONFIG_ID:
- *value_return = mode->fbconfigID;
- return 0;
- case GLX_MAX_PBUFFER_WIDTH:
- *value_return = mode->maxPbufferWidth;
- return 0;
- case GLX_MAX_PBUFFER_HEIGHT:
- *value_return = mode->maxPbufferHeight;
- return 0;
- case GLX_MAX_PBUFFER_PIXELS:
- *value_return = mode->maxPbufferPixels;
- return 0;
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- *value_return = mode->optimalPbufferWidth;
- return 0;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- *value_return = mode->optimalPbufferHeight;
- return 0;
- case GLX_SWAP_METHOD_OML:
- *value_return = mode->swapMethod;
- return 0;
- case GLX_SAMPLE_BUFFERS_SGIS:
- *value_return = mode->sampleBuffers;
- return 0;
- case GLX_SAMPLES_SGIS:
- *value_return = mode->samples;
- return 0;
-
- /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
- * It is ONLY for communication between the GLX client and the GLX
- * server.
- */
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- default:
- return GLX_BAD_ATTRIBUTE;
- }
-}
-#endif /* !defined(IN_MINI_GLX) */
-
-
-/**
- * Allocate a linked list of \c __GLcontextModes structures. The fields of
- * each structure will be initialized to "reasonable" default values. In
- * most cases this is the default value defined by table 3.4 of the GLX
- * 1.3 specification. This means that most values are either initialized to
- * zero or \c GLX_DONT_CARE (which is -1). As support for additional
- * extensions is added, the new values will be initialized to appropriate
- * values from the extension specification.
- *
- * \param count Number of structures to allocate.
- * \param minimum_size Minimum size of a structure to allocate. This allows
- * for differences in the version of the
- * \c __GLcontextModes stucture used in libGL and in a
- * DRI-based driver.
- * \returns A pointer to the first element in a linked list of \c count
- * stuctures on success, or \c NULL on failure.
- *
- * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
- * The fundamental assumption is that if the \c minimum_size
- * specified by the driver and the size of the \c __GLcontextModes
- * structure in libGL is the same, then the meaning of each byte in
- * the structure is the same in both places. \b Be \b careful!
- * Basically this means that fields have to be added in libGL and
- * then propagated to drivers. Drivers should \b never arbitrarilly
- * extend the \c __GLcontextModes data-structure.
- */
-__GLcontextModes *
-_gl_context_modes_create( unsigned count, size_t minimum_size )
-{
- const size_t size = (minimum_size > sizeof( __GLcontextModes ))
- ? minimum_size : sizeof( __GLcontextModes );
- __GLcontextModes * base = NULL;
- __GLcontextModes ** next;
- unsigned i;
-
- next = & base;
- for ( i = 0 ; i < count ; i++ ) {
- *next = (__GLcontextModes *) _mesa_malloc( size );
- if ( *next == NULL ) {
- _gl_context_modes_destroy( base );
- base = NULL;
- break;
- }
-
- (void) __glXMemset( *next, 0, size );
- (*next)->visualID = GLX_DONT_CARE;
- (*next)->visualType = GLX_DONT_CARE;
- (*next)->visualRating = GLX_NONE;
- (*next)->transparentPixel = GLX_NONE;
- (*next)->transparentRed = GLX_DONT_CARE;
- (*next)->transparentGreen = GLX_DONT_CARE;
- (*next)->transparentBlue = GLX_DONT_CARE;
- (*next)->transparentAlpha = GLX_DONT_CARE;
- (*next)->transparentIndex = GLX_DONT_CARE;
- (*next)->xRenderable = GLX_DONT_CARE;
- (*next)->fbconfigID = GLX_DONT_CARE;
- (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
- next = & ((*next)->next);
- }
-
- return base;
-}
-
-
-/**
- * Destroy a linked list of \c __GLcontextModes structures created by
- * \c _gl_context_modes_create.
- *
- * \param modes Linked list of structures to be destroyed. All structres
- * in the list will be freed.
- */
-void
-_gl_context_modes_destroy( __GLcontextModes * modes )
-{
- while ( modes != NULL ) {
- __GLcontextModes * const next = modes->next;
-
- _mesa_free( modes );
- modes = next;
- }
-}
-
-
-/**
- * Find a context mode matching a Visual ID.
- *
- * \param modes List list of context-mode structures to be searched.
- * \param vid Visual ID to be found.
- * \returns A pointer to a context-mode in \c modes if \c vid was found in
- * the list, or \c NULL if it was not.
- */
-
-__GLcontextModes *
-_gl_context_modes_find_visual( __GLcontextModes * modes, int vid )
-{
- while ( modes != NULL ) {
- if ( modes->visualID == vid ) {
- break;
- }
-
- modes = modes->next;
- }
-
- return modes;
-}
-
-
-/**
- * Determine if two context-modes are the same. This is intended to be used
- * by libGL implementations to compare to sets of driver generated FBconfigs.
- *
- * \param a Context-mode to be compared.
- * \param b Context-mode to be compared.
- * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is
- * returned otherwise.
- */
-GLboolean
-_gl_context_modes_are_same( const __GLcontextModes * a,
- const __GLcontextModes * b )
-{
- return( (a->rgbMode == b->rgbMode) &&
- (a->floatMode == b->floatMode) &&
- (a->colorIndexMode == b->colorIndexMode) &&
- (a->doubleBufferMode == b->doubleBufferMode) &&
- (a->stereoMode == b->stereoMode) &&
- (a->redBits == b->redBits) &&
- (a->greenBits == b->greenBits) &&
- (a->blueBits == b->blueBits) &&
- (a->alphaBits == b->alphaBits) &&
-#if 0 /* For some reason these don't get set on the client-side in libGL. */
- (a->redMask == b->redMask) &&
- (a->greenMask == b->greenMask) &&
- (a->blueMask == b->blueMask) &&
- (a->alphaMask == b->alphaMask) &&
-#endif
- (a->rgbBits == b->rgbBits) &&
- (a->indexBits == b->indexBits) &&
- (a->accumRedBits == b->accumRedBits) &&
- (a->accumGreenBits == b->accumGreenBits) &&
- (a->accumBlueBits == b->accumBlueBits) &&
- (a->accumAlphaBits == b->accumAlphaBits) &&
- (a->depthBits == b->depthBits) &&
- (a->stencilBits == b->stencilBits) &&
- (a->numAuxBuffers == b->numAuxBuffers) &&
- (a->level == b->level) &&
- (a->pixmapMode == b->pixmapMode) &&
- (a->visualRating == b->visualRating) &&
-
- (a->transparentPixel == b->transparentPixel) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
- ((a->transparentRed == b->transparentRed) &&
- (a->transparentGreen == b->transparentGreen) &&
- (a->transparentBlue == b->transparentBlue) &&
- (a->transparentAlpha == b->transparentAlpha))) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
- (a->transparentIndex == b->transparentIndex)) &&
-
- (a->sampleBuffers == b->sampleBuffers) &&
- (a->samples == b->samples) &&
- ((a->drawableType & b->drawableType) != 0) &&
- (a->renderType == b->renderType) &&
- (a->maxPbufferWidth == b->maxPbufferWidth) &&
- (a->maxPbufferHeight == b->maxPbufferHeight) &&
- (a->maxPbufferPixels == b->maxPbufferPixels) &&
- (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
- (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
- (a->swapMethod == b->swapMethod) );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.X.original b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.X.original
deleted file mode 100644
index 5e9e352f2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c.X.original
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2003
- * 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, 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file glcontextmodes.c
- * Utility routines for working with \c __GLcontextModes structures. At
- * some point most or all of these functions will be moved to the Mesa
- * code base.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#if defined(IN_MINI_GLX)
-# include <stdlib.h>
-# include <string.h>
-# include <GL/gl.h>
-# include "GL/internal/dri_interface.h"
-# include "imports.h"
-# define __glXMemset memset
-#else
-# include <X11/X.h>
-# include <GL/glx.h>
-# include "GL/glxint.h"
-
-# ifdef XFree86Server
-# include "GL/glx_ansic.h"
-extern void * __glXMalloc( size_t size );
-extern void __glXFree( void * ptr );
-# define _mesa_malloc(b) __glXMalloc(b)
-# define _mesa_free(m) __glXFree(m)
-# else
-# include <X11/Xlibint.h>
-# define __glXMemset memset
-# define _mesa_malloc(b) Xmalloc(b)
-# define _mesa_free(m) Xfree(m)
-# endif /* XFree86Server */
-#endif /* !defined(IN_MINI_GLX) */
-
-#include "glcontextmodes.h"
-
-#if !defined(IN_MINI_GLX)
-#define NUM_VISUAL_TYPES 6
-
-/**
- * Convert an X visual type to a GLX visual type.
- *
- * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.)
- * to be converted.
- * \return If \c visualType is a valid X visual type, a GLX visual type will
- * be returned. Otherwise \c GLX_NONE will be returned.
- */
-GLint
-_gl_convert_from_x_visual_type( int visualType )
-{
- static const int glx_visual_types[ NUM_VISUAL_TYPES ] = {
- GLX_STATIC_GRAY, GLX_GRAY_SCALE,
- GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
- GLX_TRUE_COLOR, GLX_DIRECT_COLOR
- };
-
- return ( (unsigned) visualType < NUM_VISUAL_TYPES )
- ? glx_visual_types[ visualType ] : GLX_NONE;
-}
-
-
-/**
- * Convert a GLX visual type to an X visual type.
- *
- * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR,
- * \c GLX_STATIC_GRAY, etc.) to be converted.
- * \return If \c visualType is a valid GLX visual type, an X visual type will
- * be returned. Otherwise -1 will be returned.
- */
-GLint
-_gl_convert_to_x_visual_type( int visualType )
-{
- static const int x_visual_types[ NUM_VISUAL_TYPES ] = {
- TrueColor, DirectColor,
- PseudoColor, StaticColor,
- GrayScale, StaticGray
- };
-
- return ( (unsigned) (visualType - GLX_TRUE_COLOR) <= NUM_VISUAL_TYPES )
- ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
-}
-
-
-/**
- * Copy a GLX visual config structure to a GL context mode structure. All
- * of the fields in \c config are copied to \c mode. Additional fields in
- * \c mode that can be derrived from the fields of \c config (i.e.,
- * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode
- * that cannot be derrived are set to default values.
- *
- * \param mode Destination GL context mode.
- * \param config Source GLX visual config.
- *
- * \note
- * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes
- * structure will be set to the \c vid of the \c __GLXvisualConfig structure.
- */
-void
-_gl_copy_visual_to_context_mode( __GLcontextModes * mode,
- const __GLXvisualConfig * config )
-{
- __GLcontextModes * const next = mode->next;
-
- (void) __glXMemset( mode, 0, sizeof( __GLcontextModes ) );
- mode->next = next;
-
- mode->visualID = config->vid;
- mode->visualType = _gl_convert_from_x_visual_type( config->class );
- mode->xRenderable = GL_TRUE;
- mode->fbconfigID = config->vid;
- mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
-
- mode->rgbMode = (config->rgba != 0);
- mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
- mode->colorIndexMode = !(mode->rgbMode);
- mode->doubleBufferMode = (config->doubleBuffer != 0);
- mode->stereoMode = (config->stereo != 0);
-
- mode->haveAccumBuffer = ((config->accumRedSize +
- config->accumGreenSize +
- config->accumBlueSize +
- config->accumAlphaSize) > 0);
- mode->haveDepthBuffer = (config->depthSize > 0);
- mode->haveStencilBuffer = (config->stencilSize > 0);
-
- mode->redBits = config->redSize;
- mode->greenBits = config->greenSize;
- mode->blueBits = config->blueSize;
- mode->alphaBits = config->alphaSize;
- mode->redMask = config->redMask;
- mode->greenMask = config->greenMask;
- mode->blueMask = config->blueMask;
- mode->alphaMask = config->alphaMask;
- mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
- mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
-
- mode->accumRedBits = config->accumRedSize;
- mode->accumGreenBits = config->accumGreenSize;
- mode->accumBlueBits = config->accumBlueSize;
- mode->accumAlphaBits = config->accumAlphaSize;
- mode->depthBits = config->depthSize;
- mode->stencilBits = config->stencilSize;
-
- mode->numAuxBuffers = config->auxBuffers;
- mode->level = config->level;
-
- mode->visualRating = config->visualRating;
- mode->transparentPixel = config->transparentPixel;
- mode->transparentRed = config->transparentRed;
- mode->transparentGreen = config->transparentGreen;
- mode->transparentBlue = config->transparentBlue;
- mode->transparentAlpha = config->transparentAlpha;
- mode->transparentIndex = config->transparentIndex;
-
- mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
-}
-
-
-/**
- * Get data from a GL context mode.
- *
- * \param mode GL context mode whose data is to be returned.
- * \param attribute Attribute of \c mode that is to be returned.
- * \param value_return Location to store the data member of \c mode.
- * \return If \c attribute is a valid attribute of \c mode, zero is
- * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned.
- */
-int
-_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
- int *value_return)
-{
- switch (attribute) {
- case GLX_USE_GL:
- *value_return = GL_TRUE;
- return 0;
- case GLX_BUFFER_SIZE:
- *value_return = mode->rgbBits;
- return 0;
- case GLX_RGBA:
- *value_return = mode->rgbMode;
- return 0;
- case GLX_RED_SIZE:
- *value_return = mode->redBits;
- return 0;
- case GLX_GREEN_SIZE:
- *value_return = mode->greenBits;
- return 0;
- case GLX_BLUE_SIZE:
- *value_return = mode->blueBits;
- return 0;
- case GLX_ALPHA_SIZE:
- *value_return = mode->alphaBits;
- return 0;
- case GLX_DOUBLEBUFFER:
- *value_return = mode->doubleBufferMode;
- return 0;
- case GLX_STEREO:
- *value_return = mode->stereoMode;
- return 0;
- case GLX_AUX_BUFFERS:
- *value_return = mode->numAuxBuffers;
- return 0;
- case GLX_DEPTH_SIZE:
- *value_return = mode->depthBits;
- return 0;
- case GLX_STENCIL_SIZE:
- *value_return = mode->stencilBits;
- return 0;
- case GLX_ACCUM_RED_SIZE:
- *value_return = mode->accumRedBits;
- return 0;
- case GLX_ACCUM_GREEN_SIZE:
- *value_return = mode->accumGreenBits;
- return 0;
- case GLX_ACCUM_BLUE_SIZE:
- *value_return = mode->accumBlueBits;
- return 0;
- case GLX_ACCUM_ALPHA_SIZE:
- *value_return = mode->accumAlphaBits;
- return 0;
- case GLX_LEVEL:
- *value_return = mode->level;
- return 0;
- case GLX_TRANSPARENT_TYPE_EXT:
- *value_return = mode->transparentPixel;
- return 0;
- case GLX_TRANSPARENT_RED_VALUE:
- *value_return = mode->transparentRed;
- return 0;
- case GLX_TRANSPARENT_GREEN_VALUE:
- *value_return = mode->transparentGreen;
- return 0;
- case GLX_TRANSPARENT_BLUE_VALUE:
- *value_return = mode->transparentBlue;
- return 0;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- *value_return = mode->transparentAlpha;
- return 0;
- case GLX_TRANSPARENT_INDEX_VALUE:
- *value_return = mode->transparentIndex;
- return 0;
- case GLX_X_VISUAL_TYPE:
- *value_return = mode->visualType;
- return 0;
- case GLX_CONFIG_CAVEAT:
- *value_return = mode->visualRating;
- return 0;
- case GLX_VISUAL_ID:
- *value_return = mode->visualID;
- return 0;
- case GLX_DRAWABLE_TYPE:
- *value_return = mode->drawableType;
- return 0;
- case GLX_RENDER_TYPE:
- *value_return = mode->renderType;
- return 0;
- case GLX_X_RENDERABLE:
- *value_return = mode->xRenderable;
- return 0;
- case GLX_FBCONFIG_ID:
- *value_return = mode->fbconfigID;
- return 0;
- case GLX_MAX_PBUFFER_WIDTH:
- *value_return = mode->maxPbufferWidth;
- return 0;
- case GLX_MAX_PBUFFER_HEIGHT:
- *value_return = mode->maxPbufferHeight;
- return 0;
- case GLX_MAX_PBUFFER_PIXELS:
- *value_return = mode->maxPbufferPixels;
- return 0;
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- *value_return = mode->optimalPbufferWidth;
- return 0;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- *value_return = mode->optimalPbufferHeight;
- return 0;
- case GLX_SWAP_METHOD_OML:
- *value_return = mode->swapMethod;
- return 0;
- case GLX_SAMPLE_BUFFERS_SGIS:
- *value_return = mode->sampleBuffers;
- return 0;
- case GLX_SAMPLES_SGIS:
- *value_return = mode->samples;
- return 0;
-
- /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
- * It is ONLY for communication between the GLX client and the GLX
- * server.
- */
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- default:
- return GLX_BAD_ATTRIBUTE;
- }
-}
-#endif /* !defined(IN_MINI_GLX) */
-
-
-/**
- * Allocate a linked list of \c __GLcontextModes structures. The fields of
- * each structure will be initialized to "reasonable" default values. In
- * most cases this is the default value defined by table 3.4 of the GLX
- * 1.3 specification. This means that most values are either initialized to
- * zero or \c GLX_DONT_CARE (which is -1). As support for additional
- * extensions is added, the new values will be initialized to appropriate
- * values from the extension specification.
- *
- * \param count Number of structures to allocate.
- * \param minimum_size Minimum size of a structure to allocate. This allows
- * for differences in the version of the
- * \c __GLcontextModes stucture used in libGL and in a
- * DRI-based driver.
- * \returns A pointer to the first element in a linked list of \c count
- * stuctures on success, or \c NULL on failure.
- *
- * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
- * The fundamental assumption is that if the \c minimum_size
- * specified by the driver and the size of the \c __GLcontextModes
- * structure in libGL is the same, then the meaning of each byte in
- * the structure is the same in both places. \b Be \b careful!
- * Basically this means that fields have to be added in libGL and
- * then propagated to drivers. Drivers should \b never arbitrarilly
- * extend the \c __GLcontextModes data-structure.
- */
-__GLcontextModes *
-_gl_context_modes_create( unsigned count, size_t minimum_size )
-{
- const size_t size = (minimum_size > sizeof( __GLcontextModes ))
- ? minimum_size : sizeof( __GLcontextModes );
- __GLcontextModes * base = NULL;
- __GLcontextModes ** next;
- unsigned i;
-
- next = & base;
- for ( i = 0 ; i < count ; i++ ) {
- *next = (__GLcontextModes *) _mesa_malloc( size );
- if ( *next == NULL ) {
- _gl_context_modes_destroy( base );
- base = NULL;
- break;
- }
-
- (void) __glXMemset( *next, 0, size );
- (*next)->visualID = GLX_DONT_CARE;
- (*next)->visualType = GLX_DONT_CARE;
- (*next)->visualRating = GLX_NONE;
- (*next)->transparentPixel = GLX_NONE;
- (*next)->transparentRed = GLX_DONT_CARE;
- (*next)->transparentGreen = GLX_DONT_CARE;
- (*next)->transparentBlue = GLX_DONT_CARE;
- (*next)->transparentAlpha = GLX_DONT_CARE;
- (*next)->transparentIndex = GLX_DONT_CARE;
- (*next)->xRenderable = GLX_DONT_CARE;
- (*next)->fbconfigID = GLX_DONT_CARE;
- (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
- next = & ((*next)->next);
- }
-
- return base;
-}
-
-
-/**
- * Destroy a linked list of \c __GLcontextModes structures created by
- * \c _gl_context_modes_create.
- *
- * \param modes Linked list of structures to be destroyed. All structres
- * in the list will be freed.
- */
-void
-_gl_context_modes_destroy( __GLcontextModes * modes )
-{
- while ( modes != NULL ) {
- __GLcontextModes * const next = modes->next;
-
- _mesa_free( modes );
- modes = next;
- }
-}
-
-
-/**
- * Find a context mode matching a Visual ID.
- *
- * \param modes List list of context-mode structures to be searched.
- * \param vid Visual ID to be found.
- * \returns A pointer to a context-mode in \c modes if \c vid was found in
- * the list, or \c NULL if it was not.
- */
-
-__GLcontextModes *
-_gl_context_modes_find_visual( __GLcontextModes * modes, int vid )
-{
- while ( modes != NULL ) {
- if ( modes->visualID == vid ) {
- break;
- }
-
- modes = modes->next;
- }
-
- return modes;
-}
-
-
-/**
- * Determine if two context-modes are the same. This is intended to be used
- * by libGL implementations to compare to sets of driver generated FBconfigs.
- *
- * \param a Context-mode to be compared.
- * \param b Context-mode to be compared.
- * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is
- * returned otherwise.
- */
-GLboolean
-_gl_context_modes_are_same( const __GLcontextModes * a,
- const __GLcontextModes * b )
-{
- return( (a->rgbMode == b->rgbMode) &&
- (a->floatMode == b->floatMode) &&
- (a->colorIndexMode == b->colorIndexMode) &&
- (a->doubleBufferMode == b->doubleBufferMode) &&
- (a->stereoMode == b->stereoMode) &&
- (a->redBits == b->redBits) &&
- (a->greenBits == b->greenBits) &&
- (a->blueBits == b->blueBits) &&
- (a->alphaBits == b->alphaBits) &&
-#if 0 /* For some reason these don't get set on the client-side in libGL. */
- (a->redMask == b->redMask) &&
- (a->greenMask == b->greenMask) &&
- (a->blueMask == b->blueMask) &&
- (a->alphaMask == b->alphaMask) &&
-#endif
- (a->rgbBits == b->rgbBits) &&
- (a->indexBits == b->indexBits) &&
- (a->accumRedBits == b->accumRedBits) &&
- (a->accumGreenBits == b->accumGreenBits) &&
- (a->accumBlueBits == b->accumBlueBits) &&
- (a->accumAlphaBits == b->accumAlphaBits) &&
- (a->depthBits == b->depthBits) &&
- (a->stencilBits == b->stencilBits) &&
- (a->numAuxBuffers == b->numAuxBuffers) &&
- (a->level == b->level) &&
- (a->pixmapMode == b->pixmapMode) &&
- (a->visualRating == b->visualRating) &&
-
- (a->transparentPixel == b->transparentPixel) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
- ((a->transparentRed == b->transparentRed) &&
- (a->transparentGreen == b->transparentGreen) &&
- (a->transparentBlue == b->transparentBlue) &&
- (a->transparentAlpha == b->transparentAlpha))) &&
-
- ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
- (a->transparentIndex == b->transparentIndex)) &&
-
- (a->sampleBuffers == b->sampleBuffers) &&
- (a->samples == b->samples) &&
- ((a->drawableType & b->drawableType) != 0) &&
- (a->renderType == b->renderType) &&
- (a->maxPbufferWidth == b->maxPbufferWidth) &&
- (a->maxPbufferHeight == b->maxPbufferHeight) &&
- (a->maxPbufferPixels == b->maxPbufferPixels) &&
- (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
- (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
- (a->swapMethod == b->swapMethod) );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/memops.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/memops.h
deleted file mode 100644
index 4952d788e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/memops.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef DRIMEMSETIO_H
-#define DRIMEMSETIO_H
-/*
-* memset an area in I/O space
-* We need to be careful about this on some archs
-*/
-static __inline__ void drimemsetio(void* address, int c, int size)
-{
-#if defined(__powerpc__) || defined(__ia64__)
- int i;
- for(i=0;i<size;i++)
- *((char *)address + i)=c;
-#else
- memset(address,c,size);
-#endif
-}
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmio.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmio.h
deleted file mode 100644
index 2b7b4123e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmio.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004
- * 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, 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
- * IBM 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.
- */
-
-/**
- * \file mmio.h
- * Functions for properly handling memory mapped IO on various platforms.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-
-#ifndef MMIO_H
-#define MMIO_H
-
-#include "glheader.h"
-
-#if defined( __powerpc__ )
-
-static __inline__ u_int32_t
-read_MMIO_LE32( volatile void * base, unsigned long offset )
-{
- u_int32_t val;
-
- __asm__ __volatile__( "lwbrx %0, %1, %2 ; eieio"
- : "=r" (val)
- : "b" (base), "r" (offset) );
- return val;
-}
-
-#else
-
-static __inline__ u_int32_t
-read_MMIO_LE32( volatile void * base, unsigned long offset )
-{
- volatile u_int32_t * p = (volatile u_int32_t *) (((volatile char *) base) + offset);
- return LE32_TO_CPU( p[0] );
-}
-
-#endif
-
-#endif /* MMIO_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmx.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmx.h
deleted file mode 100644
index 49ce7e3e3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/mmx.h
+++ /dev/null
@@ -1,560 +0,0 @@
-/* mmx.h
-
- MultiMedia eXtensions GCC interface library for IA32.
-
- To use this library, simply include this header file
- and compile with GCC. You MUST have inlining enabled
- in order for mmx_ok() to work; this can be done by
- simply using -O on the GCC command line.
-
- Compiling with -DMMX_TRACE will cause detailed trace
- output to be sent to stderr for each mmx operation.
- This adds lots of code, and obviously slows execution to
- a crawl, but can be very useful for debugging.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
- LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR ANY PARTICULAR PURPOSE.
-
- 1997-98 by H. Dietz and R. Fisher
-
- History:
- 97-98* R.Fisher Early versions
- 980501 R.Fisher Original Release
- 980611* H.Dietz Rewrite, correctly implementing inlines, and
- R.Fisher including direct register accesses.
- 980616 R.Fisher Release of 980611 as 980616.
- 980714 R.Fisher Minor corrections to Makefile, etc.
- 980715 R.Fisher mmx_ok() now prevents optimizer from using
- clobbered values.
- mmx_ok() now checks if cpuid instruction is
- available before trying to use it.
- 980726* R.Fisher mm_support() searches for AMD 3DNow, Cyrix
- Extended MMX, and standard MMX. It returns a
- value which is positive if any of these are
- supported, and can be masked with constants to
- see which. mmx_ok() is now a call to this
- 980726* R.Fisher Added i2r support for shift functions
- 980919 R.Fisher Fixed AMD extended feature recognition bug.
- 980921 R.Fisher Added definition/check for _MMX_H.
- Added "float s[2]" to mmx_t for use with
- 3DNow and EMMX. So same mmx_t can be used.
- 981013 R.Fisher Fixed cpuid function 1 bug (looked at wrong reg)
- Fixed psllq_i2r error in mmxtest.c
-
- * Unreleased (internal or interim) versions
-
- Notes:
- It appears that the latest gas has the pand problem fixed, therefore
- I'll undefine BROKEN_PAND by default.
- String compares may be quicker than the multiple test/jumps in vendor
- test sequence in mmx_ok(), but I'm not concerned with that right now.
-
- Acknowledgments:
- Jussi Laako for pointing out the errors ultimately found to be
- connected to the failure to notify the optimizer of clobbered values.
- Roger Hardiman for reminding us that CPUID isn't everywhere, and that
- someone may actually try to use this on a machine without CPUID.
- Also for suggesting code for checking this.
- Robert Dale for pointing out the AMD recognition bug.
- Jimmy Mayfield and Carl Witty for pointing out the Intel recognition
- bug.
- Carl Witty for pointing out the psllq_i2r test bug.
-*/
-
-#ifndef _MMX_H
-#define _MMX_H
-
-//#define MMX_TRACE
-
-/* Warning: at this writing, the version of GAS packaged
- with most Linux distributions does not handle the
- parallel AND operation mnemonic correctly. If the
- symbol BROKEN_PAND is defined, a slower alternative
- coding will be used. If execution of mmxtest results
- in an illegal instruction fault, define this symbol.
-*/
-#undef BROKEN_PAND
-
-
-/* The type of an value that fits in an MMX register
- (note that long long constant values MUST be suffixed
- by LL and unsigned long long values by ULL, lest
- they be truncated by the compiler)
-*/
-typedef union {
- long long q; /* Quadword (64-bit) value */
- unsigned long long uq; /* Unsigned Quadword */
- int d[2]; /* 2 Doubleword (32-bit) values */
- unsigned int ud[2]; /* 2 Unsigned Doubleword */
- short w[4]; /* 4 Word (16-bit) values */
- unsigned short uw[4]; /* 4 Unsigned Word */
- char b[8]; /* 8 Byte (8-bit) values */
- unsigned char ub[8]; /* 8 Unsigned Byte */
- float s[2]; /* Single-precision (32-bit) value */
-} mmx_t;
-
-/* Helper functions for the instruction macros that follow...
- (note that memory-to-register, m2r, instructions are nearly
- as efficient as register-to-register, r2r, instructions;
- however, memory-to-memory instructions are really simulated
- as a convenience, and are only 1/3 as efficient)
-*/
-#ifdef MMX_TRACE
-
-/* Include the stuff for printing a trace to stderr...
-*/
-
-#include <stdio.h>
-
-#define mmx_i2r(op, imm, reg) \
- { \
- mmx_t mmx_trace; \
- mmx_trace = (imm); \
- fprintf(stderr, #op "_i2r(" #imm "=0x%016llx, ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (imm)); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_m2r(op, mem, reg) \
- { \
- mmx_t mmx_trace; \
- mmx_trace = (mem); \
- fprintf(stderr, #op "_m2r(" #mem "=0x%016llx, ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (mem)); \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_r2m(op, reg, mem) \
- { \
- mmx_t mmx_trace; \
- __asm__ __volatile__ ("movq %%" #reg ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #op "_r2m(" #reg "=0x%016llx, ", mmx_trace.q); \
- mmx_trace = (mem); \
- fprintf(stderr, #mem "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %%" #reg ", %0" \
- : "=X" (mem) \
- : /* nothing */ ); \
- mmx_trace = (mem); \
- fprintf(stderr, #mem "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_r2r(op, regs, regd) \
- { \
- mmx_t mmx_trace; \
- __asm__ __volatile__ ("movq %%" #regs ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #op "_r2r(" #regs "=0x%016llx, ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %%" #regd ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #regd "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ (#op " %" #regs ", %" #regd); \
- __asm__ __volatile__ ("movq %%" #regd ", %0" \
- : "=X" (mmx_trace) \
- : /* nothing */ ); \
- fprintf(stderr, #regd "=0x%016llx\n", mmx_trace.q); \
- }
-
-#define mmx_m2m(op, mems, memd) \
- { \
- mmx_t mmx_trace; \
- mmx_trace = (mems); \
- fprintf(stderr, #op "_m2m(" #mems "=0x%016llx, ", mmx_trace.q); \
- mmx_trace = (memd); \
- fprintf(stderr, #memd "=0x%016llx) => ", mmx_trace.q); \
- __asm__ __volatile__ ("movq %0, %%mm0\n\t" \
- #op " %1, %%mm0\n\t" \
- "movq %%mm0, %0" \
- : "=X" (memd) \
- : "X" (mems)); \
- mmx_trace = (memd); \
- fprintf(stderr, #memd "=0x%016llx\n", mmx_trace.q); \
- }
-
-#else
-
-/* These macros are a lot simpler without the tracing...
-*/
-
-#define mmx_i2r(op, imm, reg) \
- __asm__ __volatile__ (#op " $" #imm ", %%" #reg \
- : /* nothing */ \
- : /* nothing */);
-
-#define mmx_m2r(op, mem, reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (mem))
-
-#define mmx_r2m(op, reg, mem) \
- __asm__ __volatile__ (#op " %%" #reg ", %0" \
- : "=X" (mem) \
- : /* nothing */ )
-
-#define mmx_r2r(op, regs, regd) \
- __asm__ __volatile__ (#op " %" #regs ", %" #regd)
-
-#define mmx_m2m(op, mems, memd) \
- __asm__ __volatile__ ("movq %0, %%mm0\n\t" \
- #op " %1, %%mm0\n\t" \
- "movq %%mm0, %0" \
- : "=X" (memd) \
- : "X" (mems))
-
-#endif
-
-
-/* 1x64 MOVe Quadword
- (this is both a load and a store...
- in fact, it is the only way to store)
-*/
-#define movq_m2r(var, reg) mmx_m2r(movq, var, reg)
-#define movq_r2m(reg, var) mmx_r2m(movq, reg, var)
-#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd)
-#define movq(vars, vard) \
- __asm__ __volatile__ ("movq %1, %%mm0\n\t" \
- "movq %%mm0, %0" \
- : "=X" (vard) \
- : "X" (vars))
-
-
-/* 1x32 MOVe Doubleword
- (like movq, this is both load and store...
- but is most useful for moving things between
- mmx registers and ordinary registers)
-*/
-#define movd_m2r(var, reg) mmx_m2r(movd, var, reg)
-#define movd_r2m(reg, var) mmx_r2m(movd, reg, var)
-#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd)
-#define movd(vars, vard) \
- __asm__ __volatile__ ("movd %1, %%mm0\n\t" \
- "movd %%mm0, %0" \
- : "=X" (vard) \
- : "X" (vars))
-
-
-/* 2x32, 4x16, and 8x8 Parallel ADDs
-*/
-#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg)
-#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd)
-#define paddd(vars, vard) mmx_m2m(paddd, vars, vard)
-
-#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg)
-#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd)
-#define paddw(vars, vard) mmx_m2m(paddw, vars, vard)
-
-#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg)
-#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd)
-#define paddb(vars, vard) mmx_m2m(paddb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic
-*/
-#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg)
-#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd)
-#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard)
-
-#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg)
-#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd)
-#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic
-*/
-#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg)
-#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd)
-#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard)
-
-#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg)
-#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd)
-#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard)
-
-
-/* 2x32, 4x16, and 8x8 Parallel SUBs
-*/
-#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg)
-#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd)
-#define psubd(vars, vard) mmx_m2m(psubd, vars, vard)
-
-#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg)
-#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd)
-#define psubw(vars, vard) mmx_m2m(psubw, vars, vard)
-
-#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg)
-#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd)
-#define psubb(vars, vard) mmx_m2m(psubb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic
-*/
-#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg)
-#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd)
-#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard)
-
-#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg)
-#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd)
-#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard)
-
-
-/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic
-*/
-#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg)
-#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd)
-#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard)
-
-#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg)
-#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd)
-#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard)
-
-
-/* 4x16 Parallel MULs giving Low 4x16 portions of results
-*/
-#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg)
-#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd)
-#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard)
-
-
-/* 4x16 Parallel MULs giving High 4x16 portions of results
-*/
-#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg)
-#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd)
-#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard)
-
-
-/* 4x16->2x32 Parallel Mul-ADD
- (muls like pmullw, then adds adjacent 16-bit fields
- in the multiply result to make the final 2x32 result)
-*/
-#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg)
-#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd)
-#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard)
-
-
-/* 1x64 bitwise AND
-*/
-#ifdef BROKEN_PAND
-#define pand_m2r(var, reg) \
- { \
- mmx_m2r(pandn, (mmx_t) -1LL, reg); \
- mmx_m2r(pandn, var, reg); \
- }
-#define pand_r2r(regs, regd) \
- { \
- mmx_m2r(pandn, (mmx_t) -1LL, regd); \
- mmx_r2r(pandn, regs, regd) \
- }
-#define pand(vars, vard) \
- { \
- movq_m2r(vard, mm0); \
- mmx_m2r(pandn, (mmx_t) -1LL, mm0); \
- mmx_m2r(pandn, vars, mm0); \
- movq_r2m(mm0, vard); \
- }
-#else
-#define pand_m2r(var, reg) mmx_m2r(pand, var, reg)
-#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd)
-#define pand(vars, vard) mmx_m2m(pand, vars, vard)
-#endif
-
-
-/* 1x64 bitwise AND with Not the destination
-*/
-#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg)
-#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd)
-#define pandn(vars, vard) mmx_m2m(pandn, vars, vard)
-
-
-/* 1x64 bitwise OR
-*/
-#define por_m2r(var, reg) mmx_m2r(por, var, reg)
-#define por_r2r(regs, regd) mmx_r2r(por, regs, regd)
-#define por(vars, vard) mmx_m2m(por, vars, vard)
-
-
-/* 1x64 bitwise eXclusive OR
-*/
-#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg)
-#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd)
-#define pxor(vars, vard) mmx_m2m(pxor, vars, vard)
-
-
-/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality
- (resulting fields are either 0 or -1)
-*/
-#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg)
-#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd)
-#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard)
-
-#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg)
-#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd)
-#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard)
-
-#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg)
-#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd)
-#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard)
-
-
-/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than
- (resulting fields are either 0 or -1)
-*/
-#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg)
-#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd)
-#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard)
-
-#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg)
-#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd)
-#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard)
-
-#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg)
-#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd)
-#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard)
-
-
-/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical
-*/
-#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg)
-#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg)
-#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd)
-#define psllq(vars, vard) mmx_m2m(psllq, vars, vard)
-
-#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg)
-#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg)
-#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd)
-#define pslld(vars, vard) mmx_m2m(pslld, vars, vard)
-
-#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg)
-#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg)
-#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd)
-#define psllw(vars, vard) mmx_m2m(psllw, vars, vard)
-
-
-/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical
-*/
-#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg)
-#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg)
-#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd)
-#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard)
-
-#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg)
-#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg)
-#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd)
-#define psrld(vars, vard) mmx_m2m(psrld, vars, vard)
-
-#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg)
-#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg)
-#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd)
-#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard)
-
-
-/* 2x32 and 4x16 Parallel Shift Right Arithmetic
-*/
-#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg)
-#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg)
-#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd)
-#define psrad(vars, vard) mmx_m2m(psrad, vars, vard)
-
-#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg)
-#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg)
-#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd)
-#define psraw(vars, vard) mmx_m2m(psraw, vars, vard)
-
-
-/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate
- (packs source and dest fields into dest in that order)
-*/
-#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg)
-#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd)
-#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard)
-
-#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg)
-#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd)
-#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard)
-
-
-/* 4x16->8x8 PACK and Unsigned Saturate
- (packs source and dest fields into dest in that order)
-*/
-#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg)
-#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd)
-#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard)
-
-
-/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low
- (interleaves low half of dest with low half of source
- as padding in each result field)
-*/
-#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg)
-#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd)
-#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard)
-
-#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg)
-#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd)
-#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard)
-
-#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg)
-#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd)
-#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard)
-
-
-/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High
- (interleaves high half of dest with high half of source
- as padding in each result field)
-*/
-#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg)
-#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd)
-#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard)
-
-#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg)
-#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd)
-#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard)
-
-#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg)
-#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd)
-#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard)
-
-
-/* Empty MMx State
- (used to clean-up when going from mmx to float use
- of the registers that are shared by both; note that
- there is no float-to-mmx operation needed, because
- only the float tag word info is corruptible)
-*/
-#ifdef MMX_TRACE
-
-#define emms() \
- { \
- fprintf(stderr, "emms()\n"); \
- __asm__ __volatile__ ("emms"); \
- }
-
-#else
-
-#define emms() __asm__ __volatile__ ("emms")
-
-#endif
-
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp.h
deleted file mode 100644
index f726e8305..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp.h
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (C) Copyright IBM Corporation 2002, 2003
- * 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, 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
- * VA LINUX SYSTEM, IBM 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:
- * Keith Whitwell <keithw@tungstengraphics.com>
- * Gareth Hughes <gareth@nvidia.com>
- */
-
-#include "spantmp_common.h"
-
-#ifndef DBG
-#define DBG 0
-#endif
-
-#ifndef HW_READ_CLIPLOOP
-#define HW_READ_CLIPLOOP() HW_CLIPLOOP()
-#endif
-
-#ifndef HW_WRITE_CLIPLOOP
-#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP()
-#endif
-
-
-static void TAG(WriteRGBASpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
- GLint x1;
- GLint n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_RGBA( x1, y,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_RGBA( x1, y,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
- GLint x1;
- GLint n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBAPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
- GLuint i;
- LOCAL_VARS;
-
- if (DBG) fprintf(stderr, "WriteRGBAPixels\n");
-
- HW_WRITE_CLIPLOOP()
- {
- if (mask)
- {
- for (i=0;i<n;i++)
- {
- if (mask[i]) {
- const int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL(x[i],fy))
- WRITE_RGBA( x[i], fy,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- }
- else
- {
- for (i=0;i<n;i++)
- {
- const int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL(x[i],fy))
- WRITE_RGBA( x[i], fy,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *value,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte *color = (const GLubyte *) value;
- GLint x1;
- GLint n1;
- LOCAL_VARS;
- INIT_MONO_PIXEL(p, color);
-
- y = Y_FLIP( y );
-
- if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n");
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_PIXEL( x1, y, p );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_PIXEL( x1, y, p );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- const void *value,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte *color = (const GLubyte *) value;
- GLuint i;
- LOCAL_VARS;
- INIT_MONO_PIXEL(p, color);
-
- if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n");
-
- HW_WRITE_CLIPLOOP()
- {
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL( x[i], fy ))
- WRITE_PIXEL( x[i], fy, p );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL( x[i], fy ))
- WRITE_PIXEL( x[i], fy, p );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(ReadRGBASpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values)
-{
- HW_READ_LOCK()
- {
- GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLint x1,n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
- HW_READ_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- for (;n1>0;i++,x1++,n1--)
- READ_RGBA( rgba[i], x1, y );
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-
-static void TAG(ReadRGBAPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- void *values )
-{
- HW_READ_LOCK()
- {
- GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- const GLubyte *mask = NULL; /* remove someday */
- GLuint i;
- LOCAL_VARS;
-
- if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
-
- 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 );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-
-
-
-#undef WRITE_PIXEL
-#undef WRITE_RGBA
-#undef READ_RGBA
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp2.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp2.h
deleted file mode 100644
index 1a20a4597..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp2.h
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (C) Copyright IBM Corporation 2004
- * 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, 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file spantmp2.h
- *
- * Template file of span read / write functions.
- *
- * \author Keith Whitwell <keithw@tungstengraphics.com>
- * \author Gareth Hughes <gareth@nvidia.com>
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "colormac.h"
-#include "spantmp_common.h"
-
-#ifndef DBG
-#define DBG 0
-#endif
-
-#ifndef HW_READ_CLIPLOOP
-#define HW_READ_CLIPLOOP() HW_CLIPLOOP()
-#endif
-
-#ifndef HW_WRITE_CLIPLOOP
-#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP()
-#endif
-
-#if (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
-
-#ifndef GET_SRC_PTR
-#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#ifndef GET_DST_PTR
-#define GET_DST_PTR(_x, _y) ( buf + (_x) * 2 + (_y) * pitch)
-#endif
-
-#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 ) \
- do { \
- GLshort * _p = (GLshort *) GET_DST_PTR(_x, _y); \
- _p[0] = ((((int)r & 0xf8) << 8) | (((int)g & 0xfc) << 3) | \
- (((int)b & 0xf8) >> 3)); \
- } while(0)
-
-#define WRITE_PIXEL( _x, _y, p ) \
- do { \
- GLushort * _p = (GLushort *) GET_DST_PTR(_x, _y); \
- _p[0] = p; \
- } while(0)
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(volatile GLshort *) GET_SRC_PTR(_x, _y); \
- rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
- rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
- rgba[3] = 0xff; \
- } while (0)
-
-#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-
-#ifndef GET_SRC_PTR
-#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 4 + (_y) * pitch)
-#endif
-
-#ifndef GET_DST_PTR
-#define GET_DST_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch)
-#endif
-
-# 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) \
- do { \
- GLuint * _p = (GLuint *) GET_DST_PTR(_x, _y); \
- _p[0] = ((r << 16) | (g << 8) | (b << 0) | (a << 24)); \
- } while(0)
-
-#define WRITE_PIXEL(_x, _y, p) \
- do { \
- GLuint * _p = (GLuint *) GET_DST_PTR(_x, _y); \
- _p[0] = p; \
- } while(0)
-
-# if defined( USE_X86_ASM )
-# define READ_RGBA(rgba, _x, _y) \
- do { \
- GLuint p = *(volatile GLuint *) GET_SRC_PTR(_x, _y); \
- __asm__ __volatile__( "bswap %0; rorl $8, %0" \
- : "=r" (p) : "r" (p) ); \
- ((GLuint *)rgba)[0] = p; \
- } while (0)
-# elif defined( MESA_BIG_ENDIAN )
- /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
- * rotlwi instruction. It also produces good code on SPARC.
- */
-# define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLuint p = *(volatile GLuint *) GET_SRC_PTR(_x, _y); \
- GLuint t = p; \
- *((uint32_t *) rgba) = (t >> 24) | (p << 8); \
- } while (0)
-# else
-# define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLuint p = *(volatile GLuint *) GET_SRC_PTR(_x, _y); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = (p >> 24) & 0xff; \
- } while (0)
-# endif
-
-#else
-#error SPANTMP_PIXEL_FMT must be set to a valid value!
-#endif
-
-#if defined( USE_MMX_ASM ) || defined( USE_SSE_ASM )
-#include "x86/read_rgba_span_x86.h"
-#include "x86/common_x86_asm.h"
-#endif
-
-static void TAG(WriteRGBASpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
- GLint x1;
- GLint n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_RGBA( x1, y,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_RGBA( x1, y,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
- GLint x1;
- GLint n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-static void TAG(WriteRGBAPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
- GLint i;
- LOCAL_VARS;
-
- if (DBG) fprintf(stderr, "WriteRGBAPixels\n");
-
- HW_WRITE_CLIPLOOP()
- {
- if (mask)
- {
- for (i=0;i<n;i++)
- {
- if (mask[i]) {
- const int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL(x[i],fy))
- WRITE_RGBA( x[i], fy,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- }
- else
- {
- for (i=0;i<n;i++)
- {
- const int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL(x[i],fy))
- WRITE_RGBA( x[i], fy,
- rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3] );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *value, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte *color = (const GLubyte *) value;
- GLint x1;
- GLint n1;
- LOCAL_VARS;
- INIT_MONO_PIXEL(p, color);
-
- y = Y_FLIP( y );
-
- if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n");
-
- HW_WRITE_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_PIXEL( x1, y, p );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_PIXEL( x1, y, p );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- const void *value,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte *color = (const GLubyte *) value;
- GLint i;
- LOCAL_VARS;
- INIT_MONO_PIXEL(p, color);
-
- if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n");
-
- HW_WRITE_CLIPLOOP()
- {
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL( x[i], fy ))
- WRITE_PIXEL( x[i], fy, p );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL( x[i], fy ))
- WRITE_PIXEL( x[i], fy, p );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(ReadRGBASpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, void *values)
-{
- HW_READ_LOCK()
- {
- GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLint x1,n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
- HW_READ_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- for (;n1>0;i++,x1++,n1--)
- READ_RGBA( rgba[i], x1, y );
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-
-#if defined(USE_MMX_ASM) && \
- (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
- ((SPANTMP_PIXEL_FMT == GL_RGB) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
-static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, void *values)
-{
-#ifndef USE_INNER_EMMS
- /* The EMMS instruction is directly in-lined here because using GCC's
- * built-in _mm_empty function was found to utterly destroy performance.
- */
- __asm__ __volatile__( "emms" );
-#endif
-
- HW_READ_LOCK()
- {
- GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLint x1,n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
- HW_READ_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- {
- const char * src = GET_SRC_PTR( x1, y );
-#if (SPANTMP_PIXEL_FMT == GL_RGB) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
- _generic_read_RGBA_span_RGB565_MMX( src, rgba[i], n1 );
-#else
- _generic_read_RGBA_span_BGRA8888_REV_MMX( src, rgba[i], n1 );
-#endif
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-#ifndef USE_INNER_EMMS
- __asm__ __volatile__( "emms" );
-#endif
-}
-#endif
-
-
-#if defined(USE_SSE_ASM) && \
- (SPANTMP_PIXEL_FMT == GL_BGRA) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values)
-{
- HW_READ_LOCK()
- {
- GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLint x1,n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
- HW_READ_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- {
- const char * src = GET_SRC_PTR( x1, y );
- _generic_read_RGBA_span_BGRA8888_REV_SSE2( src, rgba[i], n1 );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-#endif
-
-#if defined(USE_SSE_ASM) && \
- (SPANTMP_PIXEL_FMT == GL_BGRA) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values)
-{
-#ifndef USE_INNER_EMMS
- /* The EMMS instruction is directly in-lined here because using GCC's
- * built-in _mm_empty function was found to utterly destroy performance.
- */
- __asm__ __volatile__( "emms" );
-#endif
-
- HW_READ_LOCK()
- {
- GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLint x1,n1;
- LOCAL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadRGBASpan\n");
-
- HW_READ_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- {
- const char * src = GET_SRC_PTR( x1, y );
- _generic_read_RGBA_span_BGRA8888_REV_SSE( src, rgba[i], n1 );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-#ifndef USE_INNER_EMMS
- __asm__ __volatile__( "emms" );
-#endif
-}
-#endif
-
-
-static void TAG(ReadRGBAPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- void *values )
-{
- HW_READ_LOCK()
- {
- GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLubyte *mask = NULL; /* remove someday */
- GLint i;
- LOCAL_VARS;
-
- if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
-
- 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 );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-static void TAG(InitPointers)(struct gl_renderbuffer *rb)
-{
- rb->PutRow = TAG(WriteRGBASpan);
- rb->PutRowRGB = TAG(WriteRGBSpan);
- rb->PutMonoRow = TAG(WriteMonoRGBASpan);
- rb->PutValues = TAG(WriteRGBAPixels);
- rb->PutMonoValues = TAG(WriteMonoRGBAPixels);
- rb->GetValues = TAG(ReadRGBAPixels);
-
-#if defined(USE_SSE_ASM) && \
- (SPANTMP_PIXEL_FMT == GL_BGRA) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
- if ( cpu_has_xmm2 ) {
- if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" );
- rb->GetRow = TAG2(ReadRGBASpan, _SSE2);
- }
- else
-#endif
-#if defined(USE_SSE_ASM) && \
- (SPANTMP_PIXEL_FMT == GL_BGRA) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
- if ( cpu_has_xmm ) {
- if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" );
- rb->GetRow = TAG2(ReadRGBASpan, _SSE);
- }
- else
-#endif
-#if defined(USE_MMX_ASM) && \
- (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
- ((SPANTMP_PIXEL_FMT == GL_RGB) && \
- (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
- if ( cpu_has_mmx ) {
- if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" );
- rb->GetRow = TAG2(ReadRGBASpan, _MMX);
- }
- else
-#endif
- {
- if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" );
- rb->GetRow = TAG(ReadRGBASpan);
- }
-
-}
-
-
-#undef INIT_MONO_PIXEL
-#undef WRITE_PIXEL
-#undef WRITE_RGBA
-#undef READ_RGBA
-#undef TAG
-#undef TAG2
-#undef GET_SRC_PTR
-#undef GET_DST_PTR
-#undef SPANTMP_PIXEL_FMT
-#undef SPANTMP_PIXEL_TYPE
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp_common.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp_common.h
deleted file mode 100644
index a4509a569..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/spantmp_common.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (C) Copyright IBM Corporation 2004
- * 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, 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file spantmp_common.h
- *
- * common macros for span read / write functions to be used in the depth,
- * stencil and pixel span templates.
- */
-
-#ifndef HW_WRITE_LOCK
-#define HW_WRITE_LOCK() HW_LOCK()
-#endif
-
-#ifndef HW_WRITE_UNLOCK
-#define HW_WRITE_UNLOCK() HW_UNLOCK()
-#endif
-
-#ifndef HW_READ_LOCK
-#define HW_READ_LOCK() HW_LOCK()
-#endif
-
-#ifndef HW_READ_UNLOCK
-#define HW_READ_UNLOCK() HW_UNLOCK()
-#endif
-
-#ifndef HW_CLIPLOOP
-#define HW_CLIPLOOP() \
- do { \
- int _nc = dPriv->numClipRects; \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-#endif
-
-#ifndef HW_ENDCLIPLOOP
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-#endif
-
-#ifndef CLIPPIXEL
-#define CLIPPIXEL( _x, _y ) \
- ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
-#endif
-
-#ifndef CLIPSPAN
-#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
- if ( _y < miny || _y >= maxy /*|| _x + n < minx || _x >=maxx*/ ) { \
- _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); \
- }
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/stenciltmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/stenciltmp.h
deleted file mode 100644
index dccab0660..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/stenciltmp.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/common/stenciltmp.h,v 1.3 2001/03/21 16:14:20 dawes Exp $ */
-
-#include "spantmp_common.h"
-
-#ifndef DBG
-#define DBG 0
-#endif
-
-static void TAG(WriteStencilSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte *stencil = (const GLubyte *) values;
- GLint x1;
- GLint n1;
- LOCAL_STENCIL_VARS;
-
- y = Y_FLIP(y);
-
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_STENCIL( x1, y, stencil[i] );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_STENCIL( x1, y, stencil[i] );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-static void TAG(WriteMonoStencilSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *value,
- const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte stencil = *((const GLubyte *) value);
- GLint x1;
- GLint n1;
- LOCAL_STENCIL_VARS;
-
- y = Y_FLIP(y);
-
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
-
- if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n",
- (int)i, (int)n1, (int)x1);
-
- if (mask)
- {
- for (;n1>0;i++,x1++,n1--)
- if (mask[i])
- WRITE_STENCIL( x1, y, stencil );
- }
- else
- {
- for (;n1>0;i++,x1++,n1--)
- WRITE_STENCIL( x1, y, stencil );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-
-static void TAG(WriteStencilPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- const void *values, const GLubyte mask[] )
-{
- HW_WRITE_LOCK()
- {
- const GLubyte *stencil = (const GLubyte *) values;
- GLuint i;
- LOCAL_STENCIL_VARS;
-
- if (DBG) fprintf(stderr, "WriteStencilPixels\n");
-
- HW_CLIPLOOP()
- {
- for (i=0;i<n;i++)
- {
- if (mask[i]) {
- const int fy = Y_FLIP(y[i]);
- if (CLIPPIXEL(x[i],fy))
- WRITE_STENCIL( x[i], fy, stencil[i] );
- }
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_WRITE_UNLOCK();
-}
-
-
-/* Read stencil spans and pixels
- */
-static void TAG(ReadStencilSpan)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values)
-{
- HW_READ_LOCK()
- {
- GLubyte *stencil = (GLubyte *) values;
- GLint x1,n1;
- LOCAL_STENCIL_VARS;
-
- y = Y_FLIP(y);
-
- if (DBG) fprintf(stderr, "ReadStencilSpan\n");
-
- HW_CLIPLOOP()
- {
- GLint i = 0;
- CLIPSPAN(x,y,n,x1,n1,i);
- for (;n1>0;i++,n1--)
- READ_STENCIL( stencil[i], (x+i), y );
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-static void TAG(ReadStencilPixels)( GLcontext *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- void *values )
-{
- HW_READ_LOCK()
- {
- GLubyte *stencil = (GLubyte *) values;
- GLuint i;
- LOCAL_STENCIL_VARS;
-
- if (DBG) fprintf(stderr, "ReadStencilPixels\n");
-
- HW_CLIPLOOP()
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_STENCIL( stencil[i], x[i], fy );
- }
- }
- HW_ENDCLIPLOOP();
- }
- HW_READ_UNLOCK();
-}
-
-
-
-
-#undef WRITE_STENCIL
-#undef READ_STENCIL
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.c
deleted file mode 100644
index acefce0f5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.c
+++ /dev/null
@@ -1,1339 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (C) Copyright IBM Corporation 2002, 2003
- * 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, 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
- * VA LINUX SYSTEM, IBM 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:
- * Ian Romanick <idr@us.ibm.com>
- * Keith Whitwell <keithw@tungstengraphics.com>
- * Kevin E. Martin <kem@users.sourceforge.net>
- * Gareth Hughes <gareth@nvidia.com>
- */
-/* $XFree86:$ */
-
-/** \file texmem.c
- * Implements all of the device-independent texture memory management.
- *
- * Currently, only a simple LRU texture memory management policy is
- * implemented. In the (hopefully very near) future, better policies will be
- * implemented. The idea is that the DRI should be able to run in one of two
- * modes. In the default mode the DRI will dynamically attempt to discover
- * the best texture management policy for the running application. In the
- * other mode, the user (via some sort of as yet TBD mechanism) will select
- * a texture management policy that is known to work well with the
- * application.
- */
-
-#include "texmem.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "macros.h"
-#include "texformat.h"
-
-#include <assert.h>
-
-
-
-static unsigned dummy_swap_counter;
-
-
-/**
- * Calculate \f$\log_2\f$ of a value. This is a particularly poor
- * implementation of this function. However, since system performance is in
- * no way dependent on this function, the slowness of the implementation is
- * irrelevent.
- *
- * \param n Value whose \f$\log_2\f$ is to be calculated
- */
-
-static GLuint
-driLog2( GLuint n )
-{
- GLuint log2;
-
- for ( log2 = 1 ; n > 1 ; log2++ ) {
- n >>= 1;
- }
-
- return log2;
-}
-
-
-
-
-/**
- * Determine if a texture is resident in textureable memory. Depending on
- * the driver, this may or may not be on-card memory. It could be AGP memory
- * or anyother type of memory from which the hardware can directly read
- * texels.
- *
- * This function is intended to be used as the \c IsTextureResident function
- * in the device's \c dd_function_table.
- *
- * \param ctx GL context pointer (currently unused)
- * \param texObj Texture object to be tested
- */
-
-GLboolean
-driIsTextureResident( GLcontext * ctx,
- struct gl_texture_object * texObj )
-{
- driTextureObject * t;
-
-
- t = (driTextureObject *) texObj->DriverData;
- return( (t != NULL) && (t->memBlock != NULL) );
-}
-
-
-
-
-/**
- * (Re)initialize the global circular LRU list. The last element
- * in the array (\a heap->nrRegions) is the sentinal. Keeping it
- * at the end of the array allows the other elements of the array
- * to be addressed rationally when looking up objects at a particular
- * location in texture memory.
- *
- * \param heap Texture heap to be reset
- */
-
-static void resetGlobalLRU( driTexHeap * heap )
-{
- drmTextureRegionPtr list = heap->global_regions;
- unsigned sz = 1U << heap->logGranularity;
- unsigned i;
-
- for (i = 0 ; (i+1) * sz <= heap->size ; i++) {
- list[i].prev = i-1;
- list[i].next = i+1;
- list[i].age = 0;
- }
-
- i--;
- list[0].prev = heap->nrRegions;
- list[i].prev = i-1;
- list[i].next = heap->nrRegions;
- list[heap->nrRegions].prev = i;
- list[heap->nrRegions].next = 0;
- heap->global_age[0] = 0;
-}
-
-/**
- * Print out debugging information about the local texture LRU.
- *
- * \param heap Texture heap to be printed
- * \param callername Name of calling function
- */
-static void printLocalLRU( driTexHeap * heap, const char *callername )
-{
- driTextureObject *t;
- unsigned sz = 1U << heap->logGranularity;
-
- fprintf( stderr, "%s in %s:\nLocal LRU, heap %d:\n",
- __FUNCTION__, callername, heap->heapId );
-
- foreach ( t, &heap->texture_objects ) {
- if (!t->memBlock)
- continue;
- if (!t->tObj) {
- fprintf( stderr, "Placeholder (%p) %d at 0x%x sz 0x%x\n",
- (void *)t,
- t->memBlock->ofs / sz,
- t->memBlock->ofs,
- t->memBlock->size );
- } else {
- fprintf( stderr, "Texture (%p) at 0x%x sz 0x%x\n",
- (void *)t,
- t->memBlock->ofs,
- t->memBlock->size );
- }
- }
- foreach ( t, heap->swapped_objects ) {
- if (!t->tObj) {
- fprintf( stderr, "Swapped Placeholder (%p)\n", (void *)t );
- } else {
- fprintf( stderr, "Swapped Texture (%p)\n", (void *)t );
- }
- }
-
- fprintf( stderr, "\n" );
-}
-
-/**
- * Print out debugging information about the global texture LRU.
- *
- * \param heap Texture heap to be printed
- * \param callername Name of calling function
- */
-static void printGlobalLRU( driTexHeap * heap, const char *callername )
-{
- drmTextureRegionPtr list = heap->global_regions;
- unsigned int i, j;
-
- fprintf( stderr, "%s in %s:\nGlobal LRU, heap %d list %p:\n",
- __FUNCTION__, callername, heap->heapId, (void *)list );
-
- for ( i = 0, j = heap->nrRegions ; i < heap->nrRegions ; i++ ) {
- fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n",
- j, list[j].age, list[j].next, list[j].prev, list[j].in_use );
- j = list[j].next;
- if ( j == heap->nrRegions ) break;
- }
-
- if ( j != heap->nrRegions ) {
- fprintf( stderr, "Loop detected in global LRU\n" );
- for ( i = 0 ; i < heap->nrRegions ; i++ ) {
- fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n",
- i, list[i].age, list[i].next, list[i].prev, list[i].in_use );
- }
- }
-
- fprintf( stderr, "\n" );
-}
-
-
-/**
- * Called by the client whenever it touches a local texture.
- *
- * \param t Texture object that the client has accessed
- */
-
-void driUpdateTextureLRU( driTextureObject * t )
-{
- driTexHeap * heap;
- drmTextureRegionPtr list;
- unsigned shift;
- unsigned start;
- unsigned end;
- unsigned i;
-
-
- heap = t->heap;
- if ( heap != NULL ) {
- shift = heap->logGranularity;
- start = t->memBlock->ofs >> shift;
- end = (t->memBlock->ofs + t->memBlock->size - 1) >> shift;
-
-
- heap->local_age = ++heap->global_age[0];
- list = heap->global_regions;
-
-
- /* Update the context's local LRU
- */
-
- move_to_head( & heap->texture_objects, t );
-
-
- for (i = start ; i <= end ; i++) {
- list[i].age = heap->local_age;
-
- /* 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 = heap->nrRegions;
- list[i].next = list[heap->nrRegions].next;
- list[(unsigned)list[heap->nrRegions].next].prev = i;
- list[heap->nrRegions].next = i;
- }
-
- if ( 0 ) {
- printGlobalLRU( heap, __FUNCTION__ );
- printLocalLRU( heap, __FUNCTION__ );
- }
- }
-}
-
-
-
-
-/**
- * Keep track of swapped out texture objects.
- *
- * \param t Texture object to be "swapped" out of its texture heap
- */
-
-void driSwapOutTextureObject( driTextureObject * t )
-{
- unsigned face;
-
-
- if ( t->memBlock != NULL ) {
- assert( t->heap != NULL );
- mmFreeMem( t->memBlock );
- t->memBlock = NULL;
-
- if (t->timestamp > t->heap->timestamp)
- t->heap->timestamp = t->timestamp;
-
- t->heap->texture_swaps[0]++;
- move_to_tail( t->heap->swapped_objects, t );
- t->heap = NULL;
- }
- else {
- assert( t->heap == NULL );
- }
-
-
- for ( face = 0 ; face < 6 ; face++ ) {
- t->dirty_images[face] = ~0;
- }
-}
-
-
-
-
-/**
- * Destroy hardware state associated with texture \a t. Calls the
- * \a destroy_texture_object method associated with the heap from which
- * \a t was allocated.
- *
- * \param t Texture object to be destroyed
- */
-
-void driDestroyTextureObject( driTextureObject * t )
-{
- driTexHeap * heap;
-
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] freeing %p (tObj = %p, DriverData = %p)\n",
- __FILE__, __LINE__,
- (void *)t,
- (void *)((t != NULL) ? t->tObj : NULL),
- (void *)((t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL ));
- }
-
- if ( t != NULL ) {
- if ( t->memBlock ) {
- heap = t->heap;
- assert( heap != NULL );
-
- heap->texture_swaps[0]++;
-
- mmFreeMem( t->memBlock );
- t->memBlock = NULL;
-
- if (t->timestamp > t->heap->timestamp)
- t->heap->timestamp = t->timestamp;
-
- heap->destroy_texture_object( heap->driverContext, t );
- t->heap = NULL;
- }
-
- if ( t->tObj != NULL ) {
- assert( t->tObj->DriverData == t );
- t->tObj->DriverData = NULL;
- }
-
- remove_from_list( t );
- FREE( t );
- }
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, (void *)t );
- }
-}
-
-
-
-
-/**
- * Update the local heap's representation of texture memory based on
- * data in the SAREA. This is done each time it is detected that some other
- * direct rendering client has held the lock. This pertains to both our local
- * textures and the textures belonging to other clients. Keep track of other
- * client's textures by pushing a placeholder texture onto the LRU list --
- * these are denoted by \a tObj being \a NULL.
- *
- * \param heap Heap whose state is to be updated
- * \param offset Byte offset in the heap that has been stolen
- * \param size Size, in bytes, of the stolen block
- * \param in_use Non-zero if the block is pinned/reserved by the kernel
- */
-
-static void driTexturesGone( driTexHeap * heap, int offset, int size,
- int in_use )
-{
- driTextureObject * t;
- driTextureObject * tmp;
-
-
- foreach_s ( t, tmp, & heap->texture_objects ) {
- if ( (t->memBlock->ofs < (offset + size))
- && ((t->memBlock->ofs + t->memBlock->size) > offset) ) {
- /* It overlaps - kick it out. If the texture object is just a
- * place holder, then destroy it all together. Otherwise, mark
- * it as being swapped out.
- */
-
- if ( t->tObj != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- driDestroyTextureObject( t );
- }
- }
- }
-
-
- {
- t = (driTextureObject *) CALLOC( heap->texture_object_size );
- if ( t == NULL ) return;
-
- t->memBlock = mmAllocMem( heap->memory_heap, size, 0, offset );
- if ( t->memBlock == NULL ) {
- fprintf( stderr, "Couldn't alloc placeholder: heap %u sz %x ofs %x\n", heap->heapId,
- (int)size, (int)offset );
- mmDumpMemInfo( heap->memory_heap );
- return;
- }
- t->heap = heap;
- if (in_use)
- t->bound = 99;
- insert_at_head( & heap->texture_objects, t );
- }
-}
-
-
-
-
-/**
- * Called by the client on lock contention to determine whether textures have
- * been stolen. If another client has modified a region in which we have
- * textures, then we need to figure out which of our textures have been
- * removed and update our global LRU.
- *
- * \param heap Texture heap to be updated
- */
-
-void driAgeTextures( driTexHeap * heap )
-{
- drmTextureRegionPtr list = heap->global_regions;
- unsigned sz = 1U << (heap->logGranularity);
- unsigned i, nr = 0;
-
-
- /* Have to go right round from the back to ensure stuff ends up
- * LRU in the local list... Fix with a cursor pointer.
- */
-
- for (i = list[heap->nrRegions].prev ;
- i != heap->nrRegions && nr < heap->nrRegions ;
- i = list[i].prev, nr++) {
- /* If switching texturing schemes, then the SAREA might not have been
- * properly cleared, so we need to reset the global texture LRU.
- */
-
- if ( (i * sz) > heap->size ) {
- nr = heap->nrRegions;
- break;
- }
-
- if (list[i].age > heap->local_age)
- driTexturesGone( heap, i * sz, sz, list[i].in_use);
- }
-
- /* Loop or uninitialized heap detected. Reset.
- */
-
- if (nr == heap->nrRegions) {
- driTexturesGone( heap, 0, heap->size, 0);
- resetGlobalLRU( heap );
- }
-
- if ( 0 ) {
- printGlobalLRU( heap, __FUNCTION__ );
- printLocalLRU( heap, __FUNCTION__ );
- }
-
- heap->local_age = heap->global_age[0];
-}
-
-
-
-
-#define INDEX_ARRAY_SIZE 6 /* I'm not aware of driver with more than 2 heaps */
-
-/**
- * Allocate memory from a texture heap to hold a texture object. This
- * routine will attempt to allocate memory for the texture from the heaps
- * specified by \c heap_array in order. That is, first it will try to
- * allocate from \c heap_array[0], then \c heap_array[1], and so on.
- *
- * \param heap_array Array of pointers to texture heaps to use
- * \param nr_heaps Number of heap pointer in \a heap_array
- * \param t Texture object for which space is needed
- * \return The ID of the heap from which memory was allocated, or -1 if
- * memory could not be allocated.
- *
- * \bug The replacement policy implemented by this function is horrible.
- */
-
-
-int
-driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps,
- driTextureObject * t )
-{
- driTexHeap * heap;
- driTextureObject * temp;
- driTextureObject * cursor;
- unsigned id;
-
-
- /* In case it already has texture space, initialize heap. This also
- * prevents GCC from issuing a warning that heap might be used
- * uninitialized.
- */
-
- heap = t->heap;
-
-
- /* Run through each of the existing heaps and try to allocate a buffer
- * to hold the texture.
- */
-
- for ( id = 0 ; (t->memBlock == NULL) && (id < nr_heaps) ; id++ ) {
- heap = heap_array[ id ];
- if ( heap != NULL ) {
- t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize,
- heap->alignmentShift, 0 );
- }
- }
-
-
- /* Kick textures out until the requested texture fits.
- */
-
- if ( t->memBlock == NULL ) {
- unsigned index[INDEX_ARRAY_SIZE];
- unsigned nrGoodHeaps = 0;
-
- /* Trying to avoid dynamic memory allocation. If you have more
- * heaps, increase INDEX_ARRAY_SIZE. I'm not aware of any
- * drivers with more than 2 tex heaps. */
- assert( nr_heaps < INDEX_ARRAY_SIZE );
-
- /* Sort large enough heaps by duty. Insertion sort should be
- * fast enough for such a short array. */
- for ( id = 0 ; id < nr_heaps ; id++ ) {
- heap = heap_array[ id ];
-
- if ( heap != NULL && t->totalSize <= heap->size ) {
- unsigned j;
-
- for ( j = 0 ; j < nrGoodHeaps; j++ ) {
- if ( heap->duty > heap_array[ index[ j ] ]->duty )
- break;
- }
-
- if ( j < nrGoodHeaps ) {
- memmove( &index[ j+1 ], &index[ j ],
- sizeof(index[ 0 ]) * (nrGoodHeaps - j) );
- }
-
- index[ j ] = id;
-
- nrGoodHeaps++;
- }
- }
-
- for ( id = 0 ; (t->memBlock == NULL) && (id < nrGoodHeaps) ; id++ ) {
- heap = heap_array[ index[ id ] ];
-
- for ( cursor = heap->texture_objects.prev, temp = cursor->prev;
- cursor != &heap->texture_objects ;
- cursor = temp, temp = cursor->prev ) {
-
- /* The the LRU element. If the texture is bound to one of
- * the texture units, then we cannot kick it out.
- */
- if ( cursor->bound /* || cursor->reserved */ ) {
- continue;
- }
-
- if ( cursor->memBlock )
- heap->duty -= cursor->memBlock->size;
-
- /* If this is a placeholder, there's no need to keep it */
- if (cursor->tObj)
- driSwapOutTextureObject( cursor );
- else
- driDestroyTextureObject( cursor );
-
- t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize,
- heap->alignmentShift, 0 );
-
- if (t->memBlock)
- break;
- }
- }
-
- /* Rebalance duties. If a heap kicked more data than its duty,
- * then all other heaps get that amount multiplied with their
- * relative weight added to their duty. The negative duty is
- * reset to 0. In the end all heaps have a duty >= 0.
- *
- * CAUTION: we must not change the heap pointer here, because it
- * is used below to update the texture object.
- */
- for ( id = 0 ; id < nr_heaps ; id++ )
- if ( heap_array[ id ] != NULL && heap_array[ id ]->duty < 0) {
- int duty = -heap_array[ id ]->duty;
- double weight = heap_array[ id ]->weight;
- unsigned j;
-
- for ( j = 0 ; j < nr_heaps ; j++ )
- if ( j != id && heap_array[ j ] != NULL ) {
- heap_array[ j ]->duty += (double) duty *
- heap_array[ j ]->weight / weight;
- }
-
- heap_array[ id ]->duty = 0;
- }
- }
-
-
- if ( t->memBlock != NULL ) {
- /* id and heap->heapId may or may not be the same value here.
- */
-
- assert( heap != NULL );
- assert( (t->heap == NULL) || (t->heap == heap) );
-
- t->heap = heap;
- return heap->heapId;
- }
- else {
- assert( t->heap == NULL );
-
- fprintf( stderr, "[%s:%d] unable to allocate texture\n",
- __FUNCTION__, __LINE__ );
- return -1;
- }
-}
-
-
-
-
-
-
-/**
- * Set the location where the texture-swap counter is stored.
- */
-
-void
-driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter )
-{
- heap->texture_swaps = (counter == NULL) ? & dummy_swap_counter : counter;
-}
-
-
-
-
-/**
- * Create a new heap for texture data.
- *
- * \param heap_id Device-dependent heap identifier. This value
- * will returned by driAllocateTexture when memory
- * is allocated from this heap.
- * \param context Device-dependent driver context. This is
- * supplied as the first parameter to the
- * \c destroy_tex_obj function.
- * \param size Size, in bytes, of the texture region
- * \param alignmentShift Alignment requirement for textures. If textures
- * must be allocated on a 4096 byte boundry, this
- * would be 12.
- * \param nr_regions Number of regions into which this texture space
- * should be partitioned
- * \param global_regions Array of \c drmTextureRegion structures in the SAREA
- * \param global_age Pointer to the global texture age in the SAREA
- * \param swapped_objects Pointer to the list of texture objects that are
- * not in texture memory (i.e., have been swapped
- * out).
- * \param texture_object_size Size, in bytes, of a device-dependent texture
- * object
- * \param destroy_tex_obj Function used to destroy a device-dependent
- * texture object
- *
- * \sa driDestroyTextureHeap
- */
-
-driTexHeap *
-driCreateTextureHeap( unsigned heap_id, void * context, unsigned size,
- unsigned alignmentShift, unsigned nr_regions,
- drmTextureRegionPtr global_regions, unsigned * global_age,
- driTextureObject * swapped_objects,
- unsigned texture_object_size,
- destroy_texture_object_t * destroy_tex_obj
- )
-{
- driTexHeap * heap;
- unsigned l;
-
-
- if ( 0 )
- fprintf( stderr, "%s( %u, %p, %u, %u, %u )\n",
- __FUNCTION__,
- heap_id, (void *)context, size, alignmentShift, nr_regions );
-
- heap = (driTexHeap *) CALLOC( sizeof( driTexHeap ) );
- if ( heap != NULL ) {
- l = driLog2( (size - 1) / nr_regions );
- if ( l < alignmentShift )
- {
- l = alignmentShift;
- }
-
- heap->logGranularity = l;
- heap->size = size & ~((1L << l) - 1);
-
- heap->memory_heap = mmInit( 0, heap->size );
- if ( heap->memory_heap != NULL ) {
- heap->heapId = heap_id;
- heap->driverContext = context;
-
- heap->alignmentShift = alignmentShift;
- heap->nrRegions = nr_regions;
- heap->global_regions = global_regions;
- heap->global_age = global_age;
- heap->swapped_objects = swapped_objects;
- heap->texture_object_size = texture_object_size;
- heap->destroy_texture_object = destroy_tex_obj;
-
- /* Force global heap init */
- if (heap->global_age[0] == 0)
- heap->local_age = ~0;
- else
- heap->local_age = 0;
-
- make_empty_list( & heap->texture_objects );
- driSetTextureSwapCounterLocation( heap, NULL );
-
- heap->weight = heap->size;
- heap->duty = 0;
- }
- else {
- FREE( heap );
- heap = NULL;
- }
- }
-
-
- if ( 0 )
- fprintf( stderr, "%s returning %p\n", __FUNCTION__, (void *)heap );
-
- return heap;
-}
-
-
-
-
-/** Destroys a texture heap
- *
- * \param heap Texture heap to be destroyed
- */
-
-void
-driDestroyTextureHeap( driTexHeap * heap )
-{
- driTextureObject * t;
- driTextureObject * temp;
-
-
- if ( heap != NULL ) {
- foreach_s( t, temp, & heap->texture_objects ) {
- driDestroyTextureObject( t );
- }
- foreach_s( t, temp, heap->swapped_objects ) {
- driDestroyTextureObject( t );
- }
-
- mmDestroy( heap->memory_heap );
- FREE( heap );
- }
-}
-
-
-
-
-/****************************************************************************/
-/**
- * Determine how many texels (including all mipmap levels) would be required
- * for a texture map of size \f$2^^\c base_size_log2\f$ would require.
- *
- * \param base_size_log2 \f$log_2\f$ of the size of a side of the texture
- * \param dimensions Number of dimensions of the texture. Either 2 or 3.
- * \param faces Number of faces of the texture. Either 1 or 6 (for cube maps).
- * \return Number of texels
- */
-
-static unsigned
-texels_this_map_size( int base_size_log2, unsigned dimensions, unsigned faces )
-{
- unsigned texels;
-
-
- assert( (faces == 1) || (faces == 6) );
- assert( (dimensions == 2) || (dimensions == 3) );
-
- texels = 0;
- if ( base_size_log2 >= 0 ) {
- texels = (1U << (dimensions * base_size_log2));
-
- /* See http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg03636.html
- * for the complete explaination of why this formulation is used.
- * Basically, the smaller mipmap levels sum to 0.333 the size of the
- * level 0 map. The total size is therefore the size of the map
- * multipled by 1.333. The +2 is there to round up.
- */
-
- texels = (texels * 4 * faces + 2) / 3;
- }
-
- return texels;
-}
-
-
-
-
-struct maps_per_heap {
- unsigned c[32];
-};
-
-static void
-fill_in_maximums( driTexHeap * const * heaps, unsigned nr_heaps,
- unsigned max_bytes_per_texel, unsigned max_size,
- unsigned mipmaps_at_once, unsigned dimensions,
- unsigned faces, struct maps_per_heap * max_textures )
-{
- unsigned heap;
- unsigned log2_size;
- unsigned mask;
-
-
- /* Determine how many textures of each size can be stored in each
- * texture heap.
- */
-
- for ( heap = 0 ; heap < nr_heaps ; heap++ ) {
- if ( heaps[ heap ] == NULL ) {
- (void) memset( max_textures[ heap ].c, 0,
- sizeof( max_textures[ heap ].c ) );
- continue;
- }
-
- mask = (1U << heaps[ heap ]->logGranularity) - 1;
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] heap[%u] = %u bytes, mask = 0x%08x\n",
- __FILE__, __LINE__,
- heap, heaps[ heap ]->size, mask );
- }
-
- for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) {
- unsigned total;
-
-
- /* Determine the total number of bytes required by a texture of
- * size log2_size.
- */
-
- total = texels_this_map_size( log2_size, dimensions, faces )
- - texels_this_map_size( log2_size - mipmaps_at_once,
- dimensions, faces );
- total *= max_bytes_per_texel;
- total = (total + mask) & ~mask;
-
- /* The number of textures of a given size that will fit in a heap
- * is equal to the size of the heap divided by the size of the
- * texture.
- */
-
- max_textures[ heap ].c[ log2_size ] = heaps[ heap ]->size / total;
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] "
- "= 0x%08x / 0x%08x "
- "= %u (%u)\n",
- __FILE__, __LINE__,
- heap, log2_size,
- heaps[ heap ]->size, total,
- heaps[ heap ]->size / total,
- max_textures[ heap ].c[ log2_size ] );
- }
- }
- }
-}
-
-
-static unsigned
-get_max_size( unsigned nr_heaps,
- unsigned texture_units,
- unsigned max_size,
- int all_textures_one_heap,
- struct maps_per_heap * max_textures )
-{
- unsigned heap;
- unsigned log2_size;
-
-
- /* Determine the largest texture size such that a texture of that size
- * can be bound to each texture unit at the same time. Some hardware
- * may require that all textures be in the same texture heap for
- * multitexturing.
- */
-
- for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) {
- unsigned total = 0;
-
- for ( heap = 0 ; heap < nr_heaps ; heap++ )
- {
- total += max_textures[ heap ].c[ log2_size ];
-
- if ( 0 ) {
- fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] = %u, "
- "total = %u\n", __FILE__, __LINE__, heap, log2_size,
- max_textures[ heap ].c[ log2_size ], total );
- }
-
- if ( (max_textures[ heap ].c[ log2_size ] >= texture_units)
- || (!all_textures_one_heap && (total >= texture_units)) ) {
- /* The number of mipmap levels is the log-base-2 of the
- * maximum texture size plus 1. If the maximum texture size
- * is 1x1, the log-base-2 is 0 and 1 mipmap level (the base
- * level) is available.
- */
-
- return log2_size + 1;
- }
- }
- }
-
- /* This should NEVER happen. It should always be possible to have at
- * *least* a 1x1 texture in memory!
- */
- assert( log2_size != 0 );
- return 0;
-}
-
-#define SET_MAX(f,v) \
- do { if ( max_sizes[v] != 0 ) { limits-> f = max_sizes[v]; } } while( 0 )
-
-#define SET_MAX_RECT(f,v) \
- do { if ( max_sizes[v] != 0 ) { limits-> f = 1 << max_sizes[v]; } } while( 0 )
-
-
-/**
- * Given the amount of texture memory, the number of texture units, and the
- * maximum size of a texel, calculate the maximum texture size the driver can
- * advertise.
- *
- * \param heaps Texture heaps for this card
- * \param nr_heap Number of texture heaps
- * \param limits OpenGL contants. MaxTextureUnits must be set.
- * \param max_bytes_per_texel Maximum size of a single texel, in bytes
- * \param max_2D_size \f$\log_2\f$ of the maximum 2D texture size (i.e.,
- * 1024x1024 textures, this would be 10)
- * \param max_3D_size \f$\log_2\f$ of the maximum 3D texture size (i.e.,
- * 1024x1024x1024 textures, this would be 10)
- * \param max_cube_size \f$\log_2\f$ of the maximum cube texture size (i.e.,
- * 1024x1024 textures, this would be 10)
- * \param max_rect_size \f$\log_2\f$ of the maximum texture rectangle size
- * (i.e., 1024x1024 textures, this would be 10). This is a power-of-2
- * even though texture rectangles need not be a power-of-2.
- * \param mipmaps_at_once Total number of mipmaps that can be used
- * at one time. For most hardware this will be \f$\c max_size + 1\f$.
- * For hardware that does not support mipmapping, this will be 1.
- * \param all_textures_one_heap True if the hardware requires that all
- * textures be in a single texture heap for multitexturing.
- */
-
-void
-driCalculateMaxTextureLevels( driTexHeap * const * heaps,
- unsigned nr_heaps,
- struct gl_constants * limits,
- unsigned max_bytes_per_texel,
- unsigned max_2D_size,
- unsigned max_3D_size,
- unsigned max_cube_size,
- unsigned max_rect_size,
- unsigned mipmaps_at_once,
- int all_textures_one_heap )
-{
- struct maps_per_heap max_textures[8];
- unsigned i;
- const unsigned dimensions[4] = { 2, 3, 2, 2 };
- const unsigned faces[4] = { 1, 1, 6, 1 };
- unsigned max_sizes[4];
- unsigned mipmaps[4];
-
-
- max_sizes[0] = max_2D_size;
- max_sizes[1] = max_3D_size;
- max_sizes[2] = max_cube_size;
- max_sizes[3] = max_rect_size;
-
- mipmaps[0] = mipmaps_at_once;
- mipmaps[1] = mipmaps_at_once;
- mipmaps[2] = 1;
- mipmaps[3] = mipmaps_at_once;
-
-
- /* Calculate the maximum number of texture levels in two passes. The
- * first pass determines how many textures of each power-of-two size
- * (including all mipmap levels for that size) can fit in each texture
- * heap. The second pass finds the largest texture size that allows
- * a texture of that size to be bound to every texture unit.
- */
-
- for ( i = 0 ; i < 4 ; i++ ) {
- if ( max_sizes[ i ] != 0 ) {
- fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel,
- max_sizes[ i ], mipmaps[ i ],
- dimensions[ i ], faces[ i ],
- max_textures );
-
- max_sizes[ i ] = get_max_size( nr_heaps,
- limits->MaxTextureUnits,
- max_sizes[ i ],
- all_textures_one_heap,
- max_textures );
- }
- }
-
- SET_MAX( MaxTextureLevels, 0 );
- SET_MAX( Max3DTextureLevels, 1 );
- SET_MAX( MaxCubeTextureLevels, 2 );
- SET_MAX_RECT( MaxTextureRectSize, 3 );
-}
-
-
-
-
-/**
- * Perform initial binding of default textures objects on a per unit, per
- * texture target basis.
- *
- * \param ctx Current OpenGL context
- * \param swapped List of swapped-out textures
- * \param targets Bit-mask of value texture targets
- */
-
-void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
- GLuint targets )
-{
- struct gl_texture_object *texObj;
- GLuint tmp = ctx->Texture.CurrentUnit;
- unsigned i;
-
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- ctx->Texture.CurrentUnit = i;
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) {
- texObj = ctx->Texture.Unit[i].Current1D;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) {
- texObj = ctx->Texture.Unit[i].Current2D;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) {
- texObj = ctx->Texture.Unit[i].Current3D;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) {
- texObj = ctx->Texture.Unit[i].CurrentCubeMap;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
-
- if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) {
- texObj = ctx->Texture.Unit[i].CurrentRect;
- ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj );
- move_to_tail( swapped, (driTextureObject *) texObj->DriverData );
- }
- }
-
- ctx->Texture.CurrentUnit = tmp;
-}
-
-
-
-
-/**
- * Verify that the specified texture is in the specificed heap.
- *
- * \param tex Texture to be tested.
- * \param heap Texture memory heap to be tested.
- * \return True if the texture is in the heap, false otherwise.
- */
-
-static GLboolean
-check_in_heap( const driTextureObject * tex, const driTexHeap * heap )
-{
-#if 1
- return tex->heap == heap;
-#else
- driTextureObject * curr;
-
- foreach( curr, & heap->texture_objects ) {
- if ( curr == tex ) {
- break;
- }
- }
-
- return curr == tex;
-#endif
-}
-
-
-
-/****************************************************************************/
-/**
- * Validate the consistency of a set of texture heaps.
- * Original version by Keith Whitwell in r200/r200_sanity.c.
- */
-
-GLboolean
-driValidateTextureHeaps( driTexHeap * const * texture_heaps,
- unsigned nr_heaps, const driTextureObject * swapped )
-{
- driTextureObject *t;
- unsigned i;
-
- for ( i = 0 ; i < nr_heaps ; i++ ) {
- int last_end = 0;
- unsigned textures_in_heap = 0;
- unsigned blocks_in_mempool = 0;
- const driTexHeap * heap = texture_heaps[i];
- const memHeap_t * p = heap->memory_heap;
-
- /* Check each texture object has a MemBlock, and is linked into
- * the correct heap.
- *
- * Check the texobj base address corresponds to the MemBlock
- * range. Check the texobj size (recalculate?) fits within
- * the MemBlock.
- *
- * Count the number of texobj's using this heap.
- */
-
- foreach ( t, &heap->texture_objects ) {
- if ( !check_in_heap( t, heap ) ) {
- fprintf( stderr, "%s memory block for texture object @ %p not "
- "found in heap #%d\n",
- __FUNCTION__, (void *)t, i );
- return GL_FALSE;
- }
-
-
- if ( t->totalSize > t->memBlock->size ) {
- fprintf( stderr, "%s: Memory block for texture object @ %p is "
- "only %u bytes, but %u are required\n",
- __FUNCTION__, (void *)t, t->totalSize, t->memBlock->size );
- return GL_FALSE;
- }
-
- textures_in_heap++;
- }
-
- /* Validate the contents of the heap:
- * - Ordering
- * - Overlaps
- * - Bounds
- */
-
- while ( p != NULL ) {
- if (p->reserved) {
- fprintf( stderr, "%s: Block (%08x,%x), is reserved?!\n",
- __FUNCTION__, p->ofs, p->size );
- return GL_FALSE;
- }
-
- if (p->ofs != last_end) {
- fprintf( stderr, "%s: blocks_in_mempool = %d, last_end = %d, p->ofs = %d\n",
- __FUNCTION__, blocks_in_mempool, last_end, p->ofs );
- return GL_FALSE;
- }
-
- if (!p->reserved && !p->free) {
- blocks_in_mempool++;
- }
-
- last_end = p->ofs + p->size;
- p = p->next;
- }
-
- if (textures_in_heap != blocks_in_mempool) {
- fprintf( stderr, "%s: Different number of textures objects (%u) and "
- "inuse memory blocks (%u)\n",
- __FUNCTION__, textures_in_heap, blocks_in_mempool );
- return GL_FALSE;
- }
-
-#if 0
- fprintf( stderr, "%s: textures_in_heap = %u\n",
- __FUNCTION__, textures_in_heap );
-#endif
- }
-
-
- /* Check swapped texobj's have zero memblocks
- */
- i = 0;
- foreach ( t, swapped ) {
- if ( t->memBlock != NULL ) {
- fprintf( stderr, "%s: Swapped texobj %p has non-NULL memblock %p\n",
- __FUNCTION__, (void *)t, (void *)t->memBlock );
- return GL_FALSE;
- }
- i++;
- }
-
-#if 0
- fprintf( stderr, "%s: swapped texture count = %u\n", __FUNCTION__, i );
-#endif
-
- return GL_TRUE;
-}
-
-
-
-
-/****************************************************************************/
-/**
- * Compute which mipmap levels that really need to be sent 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.
- */
-
-void
-driCalculateTextureFirstLastLevel( driTextureObject * t )
-{
- struct gl_texture_object * const tObj = t->tObj;
- const struct gl_texture_image * const baseImage =
- tObj->Image[0][tObj->BaseLevel];
-
- /* These must be signed values. MinLod and MaxLod can be negative numbers,
- * and having firstLevel and lastLevel as signed prevents the need for
- * extra sign checks.
- */
- int firstLevel;
- int lastLevel;
-
- /* Yes, this looks overly complicated, but it's all needed.
- */
-
- switch (tObj->Target) {
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- case GL_TEXTURE_CUBE_MAP:
- if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
- /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
- */
-
- 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, t->tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, t->tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_TEXTURE_4D_SGIS:
- firstLevel = lastLevel = 0;
- break;
- default:
- return;
- }
-
- /* save these values */
- t->firstLevel = firstLevel;
- t->lastLevel = lastLevel;
-}
-
-
-
-
-/**
- * \name DRI texture formats. Pointers initialized to either the big- or
- * little-endian Mesa formats.
- */
-/*@{*/
-const struct gl_texture_format *_dri_texformat_rgba8888 = NULL;
-const struct gl_texture_format *_dri_texformat_argb8888 = NULL;
-const struct gl_texture_format *_dri_texformat_rgb565 = NULL;
-const struct gl_texture_format *_dri_texformat_argb4444 = NULL;
-const struct gl_texture_format *_dri_texformat_argb1555 = NULL;
-const struct gl_texture_format *_dri_texformat_al88 = NULL;
-const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8;
-const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8;
-const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8;
-const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8;
-/*@}*/
-
-
-/**
- * Initialize little endian target, host byte order independent texture formats
- */
-void
-driInitTextureFormats(void)
-{
- const GLuint ui = 1;
- const GLubyte littleEndian = *((const GLubyte *) &ui);
-
- if (littleEndian) {
- _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888;
- _dri_texformat_argb8888 = &_mesa_texformat_argb8888;
- _dri_texformat_rgb565 = &_mesa_texformat_rgb565;
- _dri_texformat_argb4444 = &_mesa_texformat_argb4444;
- _dri_texformat_argb1555 = &_mesa_texformat_argb1555;
- _dri_texformat_al88 = &_mesa_texformat_al88;
- }
- else {
- _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev;
- _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev;
- _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev;
- _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev;
- _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev;
- _dri_texformat_al88 = &_mesa_texformat_al88_rev;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.h
deleted file mode 100644
index 705cd4d34..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/texmem.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (c) Copyright IBM Corporation 2002
- * 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, 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
- * VA LINUX SYSTEM, IBM 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:
- * Ian Romanick <idr@us.ibm.com>
- * Keith Whitwell <keithw@tungstengraphics.com>
- * Kevin E. Martin <kem@users.sourceforge.net>
- * Gareth Hughes <gareth@nvidia.com>
- */
-/* $XFree86:$ */
-
-/** \file texmem.h
- * Public interface to the DRI texture memory management routines.
- *
- * \sa texmem.c
- */
-
-#ifndef DRI_TEXMEM_H
-#define DRI_TEXMEM_H
-
-#include "mtypes.h"
-#include "mm.h"
-#include "xf86drm.h"
-
-struct dri_tex_heap;
-typedef struct dri_tex_heap driTexHeap;
-
-struct dri_texture_object;
-typedef struct dri_texture_object driTextureObject;
-
-
-/**
- * Base texture object type. Each driver will extend this type with its own
- * private data members.
- */
-
-struct dri_texture_object {
- struct dri_texture_object * next;
- struct dri_texture_object * prev;
-
- driTexHeap * heap; /**< Texture heap currently stored in */
- struct gl_texture_object * tObj;/**< Pointer to Mesa texture object
- * If NULL, this texture object is a
- * "placeholder" object representing
- * texture memory in use by another context.
- * A placeholder should have a heap and a memBlock.
- */
- PMemBlock memBlock; /**< Memory block containing texture */
- unsigned bound; /**< Texture unit currently bound to */
-
- unsigned totalSize; /**< Total size of the texture,
- * including all mipmap levels
- */
-
- unsigned dirty_images[6]; /**< Flags for whether or not images
- * need to be uploaded to local or
- * AGP texture space. One flag set
- * for each cube face for cubic
- * textures. Bit zero corresponds to
- * the base-level, which may or may
- * not be the level zero mipmap.
- */
-
- unsigned timestamp; /**< Timestamp used to
- * synchronize with 3d engine
- * in hardware where textures
- * are uploaded directly to
- * the framebuffer.
- */
-
- unsigned firstLevel; /**< Image in \c tObj->Image[0] that
- * corresponds to the base-level of
- * this texture object.
- */
-
- unsigned lastLevel; /**< Last image in \c tObj->Image[0]
- * used by the
- * current LOD settings of
- * this texture object. This
- * value must be greater than
- * or equal to \c firstLevel.
- */
-};
-
-
-typedef void (destroy_texture_object_t)( void * driverContext,
- driTextureObject * t );
-
-/**
- * Client-private representation of texture memory state.
- *
- * Clients will place one or more of these structs in their driver
- * context struct to manage one or more global texture heaps.
- */
-
-struct dri_tex_heap {
-
- /** Client-supplied heap identifier
- */
- unsigned heapId;
-
- /** Pointer to the client's private context
- */
- void *driverContext;
-
- /** Total size of the heap, in bytes
- */
- unsigned size;
-
- /** \brief \f$log_2\f$ of size of single heap region
- *
- * Each context takes memory from the global texture heap in
- * \f$2^{logGranularity}\f$ byte blocks. The value of
- * \a logGranularity is based on the amount of memory represented
- * by the heap and the maximum number of regions in the SAREA. Given
- * \a b bytes of texture memory an \a n regions in the SAREA,
- * \a logGranularity will be \f$\lfloor\log_2( b / n )\rfloor\f$.
- */
- unsigned logGranularity;
-
- /** \brief Required alignment of allocations in this heap
- *
- * The alignment shift is supplied to \a mmAllocMem when memory is
- * allocated from this heap. The value of \a alignmentShift will
- * typically reflect some require of the hardware. This value has
- * \b no \b relation to \a logGranularity. \a alignmentShift is a
- * per-context value.
- *
- * \sa mmAllocMem
- */
- unsigned alignmentShift;
-
- /** Number of elements in global list (the SAREA).
- */
- unsigned nrRegions;
-
- /** Pointer to SAREA \a driTexRegion array
- */
- drmTextureRegionPtr global_regions;
-
- /** Pointer to the texture state age (generation number) in the SAREA
- */
- unsigned * global_age;
-
- /** Local age (generation number) of texture state
- */
- unsigned local_age;
-
- /** Memory heap used to manage texture memory represented by
- * this texture heap.
- */
- memHeap_t * memory_heap;
-
- /** List of objects that we currently believe to be in texture
- * memory.
- */
- driTextureObject texture_objects;
-
- /** Pointer to the list of texture objects that are not in
- * texture memory.
- */
- driTextureObject * swapped_objects;
-
- /** Size of the driver-speicific texture object.
- */
- unsigned texture_object_size;
-
-
- /**
- * \brief Function to destroy driver-specific texture object data.
- *
- * This function is supplied by the driver so that the texture manager
- * can release all resources associated with a texture object. This
- * function should only release driver-specific data. That is,
- * \a driDestroyTextureObject will release the texture memory
- * associated with the texture object, it will release the memory
- * for the texture object itself, and it will unlink the texture
- * object from the texture object lists.
- *
- * \param driverContext Pointer to the driver supplied context
- * \param t Texture object that is to be destroyed
- * \sa driDestroyTextureObject
- */
-
- destroy_texture_object_t * destroy_texture_object;
-
-
- /**
- */
- unsigned * texture_swaps;
-
- /**
- * Timestamp used to synchronize with 3d engine in hardware
- * where textures are uploaded directly to the
- * framebuffer.
- */
- unsigned timestamp;
-
- /** \brief Kick/upload weight
- *
- * When not enough free space is available this weight
- * influences the choice of the heap from which textures are
- * kicked. By default the weight is equal to the heap size.
- */
- double weight;
-
- /** \brief Kick/upload duty
- *
- * The heap with the highest duty will be chosen for kicking
- * textures if not enough free space is available. The duty is
- * reduced by the amount of data kicked. Rebalancing of
- * negative duties takes the weights into account.
- */
- int duty;
-};
-
-
-
-
-/**
- * Called by the client on lock contention to determine whether textures have
- * been stolen. If another client has modified a region in which we have
- * textures, then we need to figure out which of our textures have been
- * removed and update our global LRU.
- *
- * \param heap Texture heap to be updated
- * \hideinitializer
- */
-
-#define DRI_AGE_TEXTURES( heap ) \
- do { \
- if ( ((heap) != NULL) \
- && ((heap)->local_age != (heap)->global_age[0]) ) \
- driAgeTextures( heap ); \
- } while( 0 )
-
-
-
-
-/* This should be called whenever there has been contention on the hardware
- * lock. driAgeTextures should not be called directly. Instead, clients
- * should use DRI_AGE_TEXTURES, above.
- */
-
-void driAgeTextures( driTexHeap * heap );
-
-void driUpdateTextureLRU( driTextureObject * t );
-void driSwapOutTextureObject( driTextureObject * t );
-void driDestroyTextureObject( driTextureObject * t );
-int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps,
- driTextureObject * t );
-
-GLboolean driIsTextureResident( GLcontext * ctx,
- struct gl_texture_object * texObj );
-
-driTexHeap * driCreateTextureHeap( unsigned heap_id, void * context,
- unsigned size, unsigned alignmentShift, unsigned nr_regions,
- drmTextureRegionPtr global_regions, unsigned * global_age,
- driTextureObject * swapped_objects, unsigned texture_object_size,
- destroy_texture_object_t * destroy_tex_obj );
-void driDestroyTextureHeap( driTexHeap * heap );
-
-void
-driCalculateMaxTextureLevels( driTexHeap * const * heaps,
- unsigned nr_heaps,
- struct gl_constants * limits,
- unsigned max_bytes_per_texel,
- unsigned max_2D_size,
- unsigned max_3D_size,
- unsigned max_cube_size,
- unsigned max_rect_size,
- unsigned mipmaps_at_once,
- int all_textures_one_heap );
-
-void
-driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter );
-
-#define DRI_TEXMGR_DO_TEXTURE_1D 0x0001
-#define DRI_TEXMGR_DO_TEXTURE_2D 0x0002
-#define DRI_TEXMGR_DO_TEXTURE_3D 0x0004
-#define DRI_TEXMGR_DO_TEXTURE_CUBE 0x0008
-#define DRI_TEXMGR_DO_TEXTURE_RECT 0x0010
-
-void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
- GLuint targets );
-
-GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps,
- unsigned nr_heaps, const driTextureObject * swapped );
-
-extern void driCalculateTextureFirstLastLevel( driTextureObject * t );
-
-
-extern const struct gl_texture_format *_dri_texformat_rgba8888;
-extern const struct gl_texture_format *_dri_texformat_argb8888;
-extern const struct gl_texture_format *_dri_texformat_rgb565;
-extern const struct gl_texture_format *_dri_texformat_argb4444;
-extern const struct gl_texture_format *_dri_texformat_argb1555;
-extern const struct gl_texture_format *_dri_texformat_al88;
-extern const struct gl_texture_format *_dri_texformat_a8;
-extern const struct gl_texture_format *_dri_texformat_ci8;
-extern const struct gl_texture_format *_dri_texformat_i8;
-extern const struct gl_texture_format *_dri_texformat_l8;
-
-extern void driInitTextureFormats( void );
-
-#endif /* DRI_TEXMEM_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.c
deleted file mode 100644
index fbe1991fa..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.c
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2002, 2004
- * 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, 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file utils.c
- * Utility functions for DRI drivers.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include "mtypes.h"
-#include "extensions.h"
-#include "utils.h"
-#include "dispatch.h"
-
-int driDispatchRemapTable[ driDispatchRemapTable_size ];
-
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-#if defined(USE_PPC_ASM)
-#include "ppc/common_ppc_features.h"
-#endif
-
-unsigned
-driParseDebugString( const char * debug,
- const struct dri_debug_control * control )
-{
- unsigned flag;
-
-
- flag = 0;
- if ( debug != NULL ) {
- while( control->string != NULL ) {
- if ( !strcmp( debug, "all" ) ||
- strstr( debug, control->string ) != NULL ) {
- flag |= control->flag;
- }
-
- control++;
- }
- }
-
- return flag;
-}
-
-
-
-/**
- * Create the \c GL_RENDERER string for DRI drivers.
- *
- * Almost all DRI drivers use a \c GL_RENDERER string of the form:
- *
- * "Mesa DRI <chip> <driver date> <AGP speed) <CPU information>"
- *
- * Using the supplied chip name, driver data, and AGP speed, this function
- * creates the string.
- *
- * \param buffer Buffer to hold the \c GL_RENDERER string.
- * \param hardware_name Name of the hardware.
- * \param driver_date Driver date.
- * \param agp_mode AGP mode (speed).
- *
- * \returns
- * The length of the string stored in \c buffer. This does \b not include
- * the terminating \c NUL character.
- */
-unsigned
-driGetRendererString( char * buffer, const char * hardware_name,
- const char * driver_date, GLuint agp_mode )
-{
-#define MAX_INFO 4
- const char * cpu[MAX_INFO];
- unsigned next = 0;
- unsigned i;
- unsigned offset;
-
-
- offset = sprintf( buffer, "Mesa DRI %s %s", hardware_name, driver_date );
-
- /* Append any AGP-specific information.
- */
- switch ( agp_mode ) {
- case 1:
- case 2:
- case 4:
- case 8:
- offset += sprintf( & buffer[ offset ], " AGP %ux", agp_mode );
- break;
-
- default:
- break;
- }
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- cpu[next] = " x86";
- next++;
- }
-# ifdef USE_MMX_ASM
- if ( cpu_has_mmx ) {
- cpu[next] = (cpu_has_mmxext) ? "/MMX+" : "/MMX";
- next++;
- }
-# endif
-# ifdef USE_3DNOW_ASM
- if ( cpu_has_3dnow ) {
- cpu[next] = (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!";
- next++;
- }
-# endif
-# ifdef USE_SSE_ASM
- if ( cpu_has_xmm ) {
- cpu[next] = (cpu_has_xmm2) ? "/SSE2" : "/SSE";
- next++;
- }
-# endif
-
-#elif defined(USE_SPARC_ASM)
-
- cpu[0] = " SPARC";
- next = 1;
-
-#elif defined(USE_PPC_ASM)
- if ( _mesa_ppc_cpu_features ) {
- cpu[next] = (cpu_has_64) ? " PowerPC 64" : " PowerPC";
- next++;
- }
-
-# ifdef USE_VMX_ASM
- if ( cpu_has_vmx ) {
- cpu[next] = "/Altivec";
- next++;
- }
-# endif
-
- if ( ! cpu_has_fpu ) {
- cpu[next] = "/No FPU";
- next++;
- }
-#endif
-
- for ( i = 0 ; i < next ; i++ ) {
- const size_t len = strlen( cpu[i] );
-
- strncpy( & buffer[ offset ], cpu[i], len );
- offset += len;
- }
-
- return offset;
-}
-
-
-
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_transpose_matrix
-#define need_GL_ARB_window_pos
-#define need_GL_EXT_compiled_vertex_array
-#define need_GL_EXT_polygon_offset
-#define need_GL_EXT_texture_object
-#define need_GL_EXT_vertex_array
-#define need_GL_MESA_window_pos
-
-/* These are needed in *all* drivers because Mesa internally implements
- * certain functionality in terms of functions provided by these extensions.
- * For example, glBlendFunc is implemented by calling glBlendFuncSeparateEXT.
- */
-#define need_GL_EXT_blend_func_separate
-#define need_GL_NV_vertex_program
-
-#include "extension_helper.h"
-
-static const struct dri_extension all_mesa_extensions[] = {
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_transpose_matrix", GL_ARB_transpose_matrix_functions },
- { "GL_ARB_window_pos", GL_ARB_window_pos_functions },
- { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
- { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions },
- { "GL_EXT_polygon_offset", GL_EXT_polygon_offset_functions },
- { "GL_EXT_texture_object", GL_EXT_texture_object_functions },
- { "GL_EXT_vertex_array", GL_EXT_vertex_array_functions },
- { "GL_MESA_window_pos", GL_MESA_window_pos_functions },
- { "GL_NV_vertex_program", GL_NV_vertex_program_functions },
- { NULL, NULL }
-};
-
-
-/**
- * Enable extensions supported by the driver.
- *
- * \bug
- * ARB_imaging isn't handled properly. In Mesa, enabling ARB_imaging also
- * enables all the sub-extensions that are folded into it. This means that
- * we need to add entry-points (via \c driInitSingleExtension) for those
- * new functions here.
- */
-void driInitExtensions( GLcontext * ctx,
- const struct dri_extension * extensions_to_enable,
- GLboolean enable_imaging )
-{
- static int first_time = 1;
- unsigned i;
-
- if ( first_time ) {
- for ( i = 0 ; i < driDispatchRemapTable_size ; i++ ) {
- driDispatchRemapTable[i] = -1;
- }
-
- first_time = 0;
- driInitExtensions( ctx, all_mesa_extensions, GL_FALSE );
- }
-
- if ( (ctx != NULL) && enable_imaging ) {
- _mesa_enable_imaging_extensions( ctx );
- }
-
- for ( i = 0 ; extensions_to_enable[i].name != NULL ; i++ ) {
- driInitSingleExtension( ctx, & extensions_to_enable[i] );
- }
-}
-
-
-
-
-/**
- * Enable and add dispatch functions for a single extension
- *
- * \param ctx Context where extension is to be enabled.
- * \param ext Extension that is to be enabled.
- *
- * \sa driInitExtensions, _mesa_enable_extension, _glapi_add_entrypoint
- *
- * \todo
- * Determine if it would be better to use \c strlen instead of the hardcoded
- * for-loops.
- */
-void driInitSingleExtension( GLcontext * ctx,
- const struct dri_extension * ext )
-{
- unsigned i;
-
-
- if ( ext->functions != NULL ) {
- for ( i = 0 ; ext->functions[i].strings != NULL ; i++ ) {
- const char * functions[16];
- const char * parameter_signature;
- const char * str = ext->functions[i].strings;
- unsigned j;
- unsigned offset;
-
-
- /* Separate the parameter signature from the rest of the string.
- * If the parameter signature is empty (i.e., the string starts
- * with a NUL character), then the function has a void parameter
- * list.
- */
- parameter_signature = str;
- while ( str[0] != '\0' ) {
- str++;
- }
- str++;
-
-
- /* Divide the string into the substrings that name each
- * entry-point for the function.
- */
- for ( j = 0 ; j < 16 ; j++ ) {
- if ( str[0] == '\0' ) {
- functions[j] = NULL;
- break;
- }
-
- functions[j] = str;
-
- while ( str[0] != '\0' ) {
- str++;
- }
- str++;
- }
-
-
- /* Add each entry-point to the dispatch table.
- */
- offset = _glapi_add_dispatch( functions, parameter_signature );
- if ( ext->functions[i].remap_index != -1 ) {
- driDispatchRemapTable[ ext->functions[i].remap_index ] = offset;
- }
-
- if ( (ext->functions[i].offset != -1)
- && (ext->functions[i].offset != offset) ) {
- fprintf(stderr, "DISPATCH ERROR! %s -> %u != %u\n", functions[0],
- driDispatchRemapTable[ ext->functions[i].remap_index ],
- ext->functions[i].offset);
- }
- }
- }
-
- if ( ctx != NULL ) {
- _mesa_enable_extension( ctx, ext->name );
- }
-}
-
-
-/**
- * Utility function used by drivers to test the verions of other components.
- *
- * If one of the version requirements is not met, a message is logged using
- * \c __driUtilMessage.
- *
- * \param driver_name Name of the driver. Used in error messages.
- * \param driActual Actual DRI version supplied __driCreateNewScreen.
- * \param driExpected Minimum DRI version required by the driver.
- * \param ddxActual Actual DDX version supplied __driCreateNewScreen.
- * \param ddxExpected Minimum DDX minor and range of DDX major version required by the driver.
- * \param drmActual Actual DRM version supplied __driCreateNewScreen.
- * \param drmExpected Minimum DRM version required by the driver.
- *
- * \returns \c GL_TRUE if all version requirements are met. Otherwise,
- * \c GL_FALSE is returned.
- *
- * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2, __driUtilMessage
- *
- * \todo
- * Now that the old \c driCheckDriDdxDrmVersions function is gone, this
- * function and \c driCheckDriDdxDrmVersions2 should be renamed.
- */
-GLboolean
-driCheckDriDdxDrmVersions3(const char * driver_name,
- const __DRIversion * driActual,
- const __DRIversion * driExpected,
- const __DRIversion * ddxActual,
- const __DRIutilversion2 * ddxExpected,
- const __DRIversion * drmActual,
- const __DRIversion * drmExpected)
-{
- static const char format[] = "%s DRI driver expected %s version %d.%d.x "
- "but got version %d.%d.%d";
- static const char format2[] = "%s DRI driver expected %s version %d-%d.%d.x "
- "but got version %d.%d.%d";
-
-
- /* Check the DRI version */
- if ( (driActual->major != driExpected->major)
- || (driActual->minor < driExpected->minor) ) {
- __driUtilMessage(format, driver_name, "DRI",
- driExpected->major, driExpected->minor,
- driActual->major, driActual->minor, driActual->patch);
- return GL_FALSE;
- }
-
- /* Check that the DDX driver version is compatible */
- if ( (ddxActual->major < ddxExpected->major_min)
- || (ddxActual->major > ddxExpected->major_max)
- || (ddxActual->minor < ddxExpected->minor) ) {
- __driUtilMessage(format2, driver_name, "DDX",
- ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor,
- ddxActual->major, ddxActual->minor, ddxActual->patch);
- return GL_FALSE;
- }
-
- /* Check that the DRM driver version is compatible */
- if ( (drmActual->major != drmExpected->major)
- || (drmActual->minor < drmExpected->minor) ) {
- __driUtilMessage(format, driver_name, "DRM",
- drmExpected->major, drmExpected->minor,
- drmActual->major, drmActual->minor, drmActual->patch);
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-GLboolean
-driCheckDriDdxDrmVersions2(const char * driver_name,
- const __DRIversion * driActual,
- const __DRIversion * driExpected,
- const __DRIversion * ddxActual,
- const __DRIversion * ddxExpected,
- const __DRIversion * drmActual,
- const __DRIversion * drmExpected)
-{
- __DRIutilversion2 ddx_expected;
- ddx_expected.major_min = ddxExpected->major;
- ddx_expected.major_max = ddxExpected->major;
- ddx_expected.minor = ddxExpected->minor;
- ddx_expected.patch = ddxExpected->patch;
- return driCheckDriDdxDrmVersions3(driver_name, driActual,
- driExpected, ddxActual, & ddx_expected,
- drmActual, drmExpected);
-}
-
-
-
-GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height )
-{
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-
-/**
- * Creates a set of \c __GLcontextModes that a driver will expose.
- *
- * A set of \c __GLcontextModes will be created based on the supplied
- * parameters. The number of modes processed will be 2 *
- * \c num_depth_stencil_bits * \c num_db_modes.
- *
- * For the most part, data is just copied from \c depth_bits, \c stencil_bits,
- * \c db_modes, and \c visType into each \c __GLcontextModes element.
- * However, the meanings of \c fb_format and \c fb_type require further
- * explanation. The \c fb_format specifies which color components are in
- * each pixel and what the default order is. For example, \c GL_RGB specifies
- * that red, green, blue are available and red is in the "most significant"
- * position and blue is in the "least significant". The \c fb_type specifies
- * the bit sizes of each component and the actual ordering. For example, if
- * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11]
- * are the blue value, bits [10:5] are the green value, and bits [4:0] are
- * the red value.
- *
- * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either
- * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the
- * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or
- * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as
- * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8
- * still uses 32-bits.
- *
- * If in doubt, look at the tables used in the function.
- *
- * \param ptr_to_modes Pointer to a pointer to a linked list of
- * \c __GLcontextModes. Upon completion, a pointer to
- * the next element to be process will be stored here.
- * If the function fails and returns \c GL_FALSE, this
- * value will be unmodified, but some elements in the
- * linked list may be modified.
- * \param fb_format Format of the framebuffer. Currently only \c GL_RGB,
- * \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported.
- * \param fb_type Type of the pixels in the framebuffer. Currently only
- * \c GL_UNSIGNED_SHORT_5_6_5,
- * \c GL_UNSIGNED_SHORT_5_6_5_REV,
- * \c GL_UNSIGNED_INT_8_8_8_8, and
- * \c GL_UNSIGNED_INT_8_8_8_8_REV are supported.
- * \param depth_bits Array of depth buffer sizes to be exposed.
- * \param stencil_bits Array of stencil buffer sizes to be exposed.
- * \param num_depth_stencil_bits Number of entries in both \c depth_bits and
- * \c stencil_bits.
- * \param db_modes Array of buffer swap modes. If an element has a
- * value of \c GLX_NONE, then it represents a
- * single-buffered mode. Other valid values are
- * \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and
- * \c GLX_SWAP_UNDEFINED_OML. See the
- * GLX_OML_swap_method extension spec for more details.
- * \param num_db_modes Number of entries in \c db_modes.
- * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or
- * \c GLX_DIRECT_COLOR.
- *
- * \returns
- * \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only
- * cause of failure is a bad parameter (i.e., unsupported \c fb_format or
- * \c fb_type).
- *
- * \todo
- * There is currently no way to support packed RGB modes (i.e., modes with
- * exactly 3 bytes per pixel) or floating-point modes. This could probably
- * be done by creating some new, private enums with clever names likes
- * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32,
- * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it.
- */
-GLboolean
-driFillInModes( __GLcontextModes ** ptr_to_modes,
- GLenum fb_format, GLenum fb_type,
- const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
- unsigned num_depth_stencil_bits,
- const GLenum * db_modes, unsigned num_db_modes,
- int visType )
-{
- static const u_int8_t bits_table[3][4] = {
- /* R G B A */
- { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
- { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
- { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
- };
-
- /* The following arrays are all indexed by the fb_type masked with 0x07.
- * Given the four supported fb_type values, this results in valid array
- * indices of 3, 4, 5, and 7.
- */
- static const u_int32_t masks_table_rgb[8][4] = {
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */
- { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */
- { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 }, /* 8_8_8_8 */
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 } /* 8_8_8_8_REV */
- };
-
- static const u_int32_t masks_table_rgba[8][4] = {
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */
- { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */
- { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF }, /* 8_8_8_8 */
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }, /* 8_8_8_8_REV */
- };
-
- static const u_int32_t masks_table_bgr[8][4] = {
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */
- { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 }, /* 8_8_8_8 */
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, /* 8_8_8_8_REV */
- };
-
- static const u_int32_t masks_table_bgra[8][4] = {
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */
- { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF }, /* 8_8_8_8 */
- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
- { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, /* 8_8_8_8_REV */
- };
-
- static const u_int8_t bytes_per_pixel[8] = {
- 0, 0, 0, 2, 2, 4, 0, 4
- };
-
- const u_int8_t * bits;
- const u_int32_t * masks;
- const int index = fb_type & 0x07;
- __GLcontextModes * modes = *ptr_to_modes;
- unsigned i;
- unsigned j;
- unsigned k;
-
-
- if ( bytes_per_pixel[ index ] == 0 ) {
- fprintf( stderr, "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.\n",
- __FUNCTION__, __LINE__, fb_type );
- return GL_FALSE;
- }
-
-
- /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and
- * the _REV versions.
- *
- * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA.
- */
-
- switch ( fb_format ) {
- case GL_RGB:
- bits = (bytes_per_pixel[ index ] == 2)
- ? bits_table[0] : bits_table[1];
- masks = masks_table_rgb[ index ];
- break;
-
- case GL_RGBA:
- bits = (bytes_per_pixel[ index ] == 2)
- ? bits_table[0] : bits_table[2];
- masks = masks_table_rgba[ index ];
- break;
-
- case GL_BGR:
- bits = (bytes_per_pixel[ index ] == 2)
- ? bits_table[0] : bits_table[1];
- masks = masks_table_bgr[ index ];
- break;
-
- case GL_BGRA:
- bits = (bytes_per_pixel[ index ] == 2)
- ? bits_table[0] : bits_table[2];
- masks = masks_table_bgra[ index ];
- break;
-
- default:
- fprintf( stderr, "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.\n",
- __FUNCTION__, __LINE__, fb_format );
- return GL_FALSE;
- }
-
-
- for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) {
- for ( i = 0 ; i < num_db_modes ; i++ ) {
- for ( j = 0 ; j < 2 ; j++ ) {
-
- modes->redBits = bits[0];
- modes->greenBits = bits[1];
- modes->blueBits = bits[2];
- modes->alphaBits = bits[3];
- modes->redMask = masks[0];
- modes->greenMask = masks[1];
- modes->blueMask = masks[2];
- modes->alphaMask = masks[3];
- modes->rgbBits = modes->redBits + modes->greenBits
- + modes->blueBits + modes->alphaBits;
-
- modes->accumRedBits = 16 * j;
- modes->accumGreenBits = 16 * j;
- modes->accumBlueBits = 16 * j;
- modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0;
- modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG;
-
- modes->stencilBits = stencil_bits[k];
- modes->depthBits = depth_bits[k];
-
- modes->visualType = visType;
- modes->renderType = GLX_RGBA_BIT;
- modes->drawableType = GLX_WINDOW_BIT;
- modes->rgbMode = GL_TRUE;
-
- if ( db_modes[i] == GLX_NONE ) {
- modes->doubleBufferMode = GL_FALSE;
- }
- else {
- modes->doubleBufferMode = GL_TRUE;
- modes->swapMethod = db_modes[i];
- }
-
- modes->haveAccumBuffer = ((modes->accumRedBits +
- modes->accumGreenBits +
- modes->accumBlueBits +
- modes->accumAlphaBits) > 0);
- modes->haveDepthBuffer = (modes->depthBits > 0);
- modes->haveStencilBuffer = (modes->stencilBits > 0);
-
- modes = modes->next;
- }
- }
- }
-
- *ptr_to_modes = modes;
- return GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.h
deleted file mode 100644
index 26d178f74..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/utils.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2002, 2004
- * 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, 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
- * VA LINUX SYSTEM, IBM 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:
- * Ian Romanick <idr@us.ibm.com>
- */
-/* $XFree86:$ */
-
-#ifndef DRI_DEBUG_H
-#define DRI_DEBUG_H
-
-#include "context.h"
-#include "dri_util.h"
-
-struct dri_debug_control {
- const char * string;
- unsigned flag;
-};
-
-/**
- * Description of the entry-points and parameters for an OpenGL function.
- */
-struct dri_extension_function {
- /**
- * \brief
- * Packed string describing the parameter signature and the entry-point
- * names.
- *
- * The parameter signature and the names of the entry-points for this
- * function are packed into a single string. The substrings are
- * separated by NUL characters. The whole string is terminated by
- * two consecutive NUL characters.
- */
- const char * strings;
-
-
- /**
- * Location in the remap table where the dispatch offset should be
- * stored.
- */
- int remap_index;
-
- /**
- * Offset of the function in the dispatch table.
- */
- int offset;
-};
-
-/**
- * Description of the API for an extension to OpenGL.
- */
-struct dri_extension {
- /**
- * Name of the extension.
- */
- const char * name;
-
-
- /**
- * Pointer to a list of \c dri_extension_function structures. The list
- * is terminated by a structure with a \c NULL
- * \c dri_extension_function::strings pointer.
- */
- const struct dri_extension_function * functions;
-};
-
-extern unsigned driParseDebugString( const char * debug,
- const struct dri_debug_control * control );
-
-extern unsigned driGetRendererString( char * buffer,
- const char * hardware_name, const char * driver_date, GLuint agp_mode );
-
-extern void driInitExtensions( GLcontext * ctx,
- const struct dri_extension * card_extensions, GLboolean enable_imaging );
-
-extern void driInitSingleExtension( GLcontext * ctx,
- const struct dri_extension * ext );
-
-extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name,
- const __DRIversion * driActual, const __DRIversion * driExpected,
- const __DRIversion * ddxActual, const __DRIversion * ddxExpected,
- const __DRIversion * drmActual, const __DRIversion * drmExpected);
-
-extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name,
- const __DRIversion * driActual, const __DRIversion * driExpected,
- const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected,
- const __DRIversion * drmActual, const __DRIversion * drmExpected);
-
-extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height );
-
-extern GLboolean driFillInModes( __GLcontextModes ** modes,
- GLenum fb_format, GLenum fb_type,
- const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
- unsigned num_depth_stencil_bits,
- const GLenum * db_modes, unsigned num_db_modes, int visType );
-
-#endif /* DRI_DEBUG_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.c
deleted file mode 100644
index eebe42d96..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * (c) Copyright IBM Corporation 2002
- * 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, 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
- * VA LINUX SYSTEM, IBM 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:
- * Ian Romanick <idr@us.ibm.com>
- */
-/* $XFree86:$ */
-
-#include "glheader.h"
-#include "xf86drm.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "vblank.h"
-#include "xmlpool.h"
-
-
-/****************************************************************************/
-/**
- * Get the current MSC refresh counter.
- *
- * Stores the 64-bit count of vertical refreshes since some (arbitrary)
- * point in time in \c count. Unless the value wraps around, which it
- * may, it will never decrease.
- *
- * \warning This function is called from \c glXGetVideoSyncSGI, which expects
- * a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which
- * expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl
- * currently always returns a \c sequence of type \c unsigned.
- *
- * \param priv Pointer to the DRI screen private struct.
- * \param count Storage to hold MSC counter.
- * \return Zero is returned on success. A negative errno value
- * is returned on failure.
- */
-int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count )
-{
- drmVBlank vbl;
- int ret;
-
- /* Don't wait for anything. Just get the current refresh count. */
-
- vbl.request.type = DRM_VBLANK_RELATIVE;
- vbl.request.sequence = 0;
-
- ret = drmWaitVBlank( priv->fd, &vbl );
- *count = (int64_t)vbl.reply.sequence;
-
- return ret;
-}
-
-
-/****************************************************************************/
-/**
- * Wait for a specified refresh count. This implements most of the
- * functionality of \c glXWaitForMscOML from the GLX_OML_sync_control spec.
- * Waits for the \c target_msc refresh. If that has already passed, it
- * waits until \f$(MSC \bmod divisor)\f$ is equal to \c remainder. If
- * \c target_msc is 0, use the behavior of glXWaitVideoSyncSGI(), which
- * omits the initial check against a target MSC value.
- *
- * This function is actually something of a hack. The problem is that, at
- * the time of this writing, none of the existing DRM modules support an
- * ioctl that returns a 64-bit count (at least not on 32-bit platforms).
- * However, this function exists to support a GLX function that requires
- * the use of 64-bit counts. As such, there is a little bit of ugly
- * hackery at the end of this function to make the 32-bit count act like
- * a 64-bit count. There are still some cases where this will break, but
- * I believe it catches the most common cases.
- *
- * The real solution is to provide an ioctl that uses a 64-bit count.
- *
- * \param dpy Pointer to the \c Display.
- * \param priv Pointer to the DRI drawable private.
- * \param target_msc Desired refresh count to wait for. A value of 0
- * means to use the glXWaitVideoSyncSGI() behavior.
- * \param divisor MSC divisor if \c target_msc is already reached.
- * \param remainder Desired MSC remainder if \c target_msc is already
- * reached.
- * \param msc Buffer to hold MSC when done waiting.
- *
- * \return Zero on success or \c GLX_BAD_CONTEXT on failure.
- */
-
-int driWaitForMSC32( __DRIdrawablePrivate *priv,
- int64_t target_msc, int64_t divisor, int64_t remainder,
- int64_t * msc )
-{
- drmVBlank vbl;
-
-
- if ( divisor != 0 ) {
- unsigned int target = (unsigned int)target_msc;
- unsigned int next = target;
- unsigned int r;
- int dont_wait = (target_msc == 0);
-
- do {
- /* dont_wait means we're using the glXWaitVideoSyncSGI() behavior.
- * The first time around, just get the current count and proceed
- * to the test for (MSC % divisor) == remainder.
- */
- vbl.request.type = dont_wait ? DRM_VBLANK_RELATIVE :
- DRM_VBLANK_ABSOLUTE;
- vbl.request.sequence = next;
-
- if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) {
- /* FIXME: This doesn't seem like the right thing to return here.
- */
- return GLX_BAD_CONTEXT;
- }
-
- dont_wait = 0;
- if (target_msc != 0 && vbl.reply.sequence == target)
- break;
-
- /* Assuming the wait-done test fails, the next refresh to wait for
- * will be one that satisfies (MSC % divisor) == remainder. The
- * value (MSC - (MSC % divisor) + remainder) is the refresh value
- * closest to the current value that would satisfy the equation.
- * If this refresh has already happened, we add divisor to obtain
- * the next refresh after the current one that will satisfy it.
- */
- r = (vbl.reply.sequence % (unsigned int)divisor);
- next = (vbl.reply.sequence - r + (unsigned int)remainder);
- if (next <= vbl.reply.sequence) next += (unsigned int)divisor;
-
- } while ( r != (unsigned int)remainder );
- }
- else {
- /* If the \c divisor is zero, just wait until the MSC is greater
- * than or equal to \c target_msc.
- */
-
- vbl.request.type = DRM_VBLANK_ABSOLUTE;
- vbl.request.sequence = target_msc;
-
- if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) {
- /* FIXME: This doesn't seem like the right thing to return here.
- */
- return GLX_BAD_CONTEXT;
- }
- }
-
- *msc = (target_msc & 0xffffffff00000000LL);
- *msc |= vbl.reply.sequence;
- if ( *msc < target_msc ) {
- *msc += 0x0000000100000000LL;
- }
-
- return 0;
-}
-
-
-/****************************************************************************/
-/**
- * Gets a set of default vertical-blank-wait flags based on the internal GLX
- * API version and several configuration options.
- */
-
-GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache )
-{
- GLuint flags = VBLANK_FLAG_INTERVAL;
- int vblank_mode;
-
-
- if ( driCheckOption( optionCache, "vblank_mode", DRI_ENUM ) )
- vblank_mode = driQueryOptioni( optionCache, "vblank_mode" );
- else
- vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;
-
- switch (vblank_mode) {
- case DRI_CONF_VBLANK_NEVER:
- flags = 0;
- break;
- case DRI_CONF_VBLANK_DEF_INTERVAL_0:
- break;
- case DRI_CONF_VBLANK_DEF_INTERVAL_1:
- flags |= VBLANK_FLAG_THROTTLE;
- break;
- case DRI_CONF_VBLANK_ALWAYS_SYNC:
- flags |= VBLANK_FLAG_SYNC;
- break;
- }
-
- return flags;
-}
-
-
-/****************************************************************************/
-/**
- * Sets the default swap interval when the drawable is first bound to a
- * direct rendering context.
- */
-
-void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags )
-{
- if ( priv->pdraw->swap_interval == (unsigned)-1 ) {
- priv->pdraw->swap_interval = (flags & VBLANK_FLAG_THROTTLE) != 0 ? 1 : 0;
- }
-}
-
-
-/****************************************************************************/
-/**
- * Wrapper to call \c drmWaitVBlank. The main purpose of this function is to
- * wrap the error message logging. The error message should only be logged
- * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is
- * successful, \c vbl_seq will be set the sequence value in the reply.
- *
- * \param vbl Pointer to drmVBlank packet desribing how to wait.
- * \param vbl_seq Location to store the current refresh counter.
- * \param fd File descriptor use to call into the DRM.
- * \return Zero on success or -1 on failure.
- */
-
-static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
-{
- int ret;
-
-
- ret = drmWaitVBlank( fd, vbl );
- if ( ret != 0 ) {
- static GLboolean first_time = GL_TRUE;
-
- if ( first_time ) {
- fprintf(stderr,
- "%s: drmWaitVBlank returned %d, IRQs don't seem to be"
- " working correctly.\nTry running with LIBGL_THROTTLE_REFRESH"
- " and LIBL_SYNC_REFRESH unset.\n", __FUNCTION__, ret);
- first_time = GL_FALSE;
- }
-
- return -1;
- }
-
- *vbl_seq = vbl->reply.sequence;
- return 0;
-}
-
-
-/****************************************************************************/
-/**
- * Waits for the vertical blank for use with glXSwapBuffers.
- *
- * \param vbl_seq Vertical blank sequence number (MSC) after the last buffer
- * swap. Updated after this wait.
- * \param flags \c VBLANK_FLAG bits that control how long to wait.
- * \param missed_deadline Set to \c GL_TRUE if the MSC after waiting is later
- * than the "target" based on \c flags. The idea is that if
- * \c missed_deadline is set, then the application is not
- * achieving its desired framerate.
- * \return Zero on success, -1 on error.
- */
-
-int
-driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq,
- GLuint flags, GLboolean * missed_deadline )
-{
- drmVBlank vbl;
- unsigned original_seq;
- unsigned deadline;
- unsigned interval;
-
-
- *missed_deadline = GL_FALSE;
- if ( (flags & (VBLANK_FLAG_INTERVAL |
- VBLANK_FLAG_THROTTLE |
- VBLANK_FLAG_SYNC)) == 0 ||
- (flags & VBLANK_FLAG_NO_IRQ) != 0 ) {
- return 0;
- }
-
-
- /* VBLANK_FLAG_SYNC means to wait for at least one vertical blank. If
- * that flag is not set, do a fake wait for zero vertical blanking
- * periods so that we can get the current MSC.
- *
- * VBLANK_FLAG_INTERVAL and VBLANK_FLAG_THROTTLE mean to wait for at
- * least one vertical blank since the last wait. Since do_wait modifies
- * vbl_seq, we have to save the original value of vbl_seq for the
- * VBLANK_FLAG_INTERVAL / VBLANK_FLAG_THROTTLE calculation later.
- */
-
- original_seq = *vbl_seq;
-
- vbl.request.sequence = ((flags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0;
- vbl.request.type = DRM_VBLANK_RELATIVE;
-
- if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) {
- return -1;
- }
-
-
- vbl.request.type = DRM_VBLANK_ABSOLUTE;
-
- if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) {
- interval = priv->pdraw->swap_interval;
- /* this must have been initialized when the drawable was first bound
- * to a direct rendering context. */
- assert ( interval != (unsigned)-1 );
- }
- else if ( (flags & VBLANK_FLAG_THROTTLE) != 0 ) {
- interval = 1;
- }
- else {
- interval = 0;
- }
-
-
- /* Wait until the next vertical blank. If the interval is zero, then
- * the deadline is one vertical blank after the previous wait.
- */
-
- vbl.request.sequence = original_seq + interval;
- if ( *vbl_seq < vbl.request.sequence ) {
- if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) {
- return -1;
- }
- }
-
- deadline = original_seq + ((interval == 0) ? 1 : interval);
- *missed_deadline = ( *vbl_seq > deadline );
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.h
deleted file mode 100644
index 3dc965def..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/vblank.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * (c) Copyright IBM Corporation 2002
- * 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, 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
- * VA LINUX SYSTEM, IBM 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:
- * Ian Romanick <idr@us.ibm.com>
- */
-/* $XFree86:$ */
-
-#ifndef DRI_VBLANK_H
-#define DRI_VBLANK_H
-
-#include "context.h"
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-#define VBLANK_FLAG_INTERVAL (1U << 0) /* Respect the swap_interval setting
- */
-#define VBLANK_FLAG_THROTTLE (1U << 1) /* Wait 1 refresh since last call.
- */
-#define VBLANK_FLAG_SYNC (1U << 2) /* Sync to the next refresh.
- */
-#define VBLANK_FLAG_NO_IRQ (1U << 7) /* DRM has no IRQ to wait on.
- */
-
-extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
-extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
- int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
-extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
-extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags );
-extern int driWaitForVBlank( const __DRIdrawablePrivate *priv,
- GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline );
-
-#undef usleep
-#include <unistd.h> /* for usleep() */
-#include <sched.h> /* for sched_yield() */
-
-#ifdef linux
-#include <sched.h> /* for sched_yield() */
-#endif
-
-#define DO_USLEEP(nr) \
- do { \
- if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \
- if (1) usleep( nr ); \
- sched_yield(); \
- } while( 0 )
-
-#endif /* DRI_VBLANK_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.c
deleted file mode 100644
index b635894fe..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.c
+++ /dev/null
@@ -1,1002 +0,0 @@
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * 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
- * FELIX KUEHLING, 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.
- *
- */
-/**
- * \file xmlconfig.c
- * \brief Driver-independent client-side part of the XML configuration
- * \author Felix Kuehling
- */
-
-#include "glheader.h"
-
-#include <string.h>
-#include <assert.h>
-#include <expat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include "imports.h"
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-/*
- * OS dependent ways of getting the name of the running program
- */
-#if (defined(__unix__) || defined(unix)) && !defined(USG)
-#include <sys/param.h>
-#endif
-
-#undef GET_PROGRAM_NAME
-
-#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__)
-# if !defined(__GLIBC__) || (__GLIBC__ < 2)
-/* These aren't declared in any libc5 header */
-extern char *program_invocation_name, *program_invocation_short_name;
-# endif
-# define GET_PROGRAM_NAME() program_invocation_short_name
-#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
-# include <osreldate.h>
-# if (__FreeBSD_version >= 440000)
-# include <stdlib.h>
-# define GET_PROGRAM_NAME() getprogname()
-# endif
-#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100)
-# include <stdlib.h>
-# define GET_PROGRAM_NAME() getprogname()
-#endif
-
-#if !defined(GET_PROGRAM_NAME)
-# if defined(OpenBSD) || defined(NetBSD) || defined(__UCLIBC__)
-/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU.
- * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's
- * used as a last resort, if there is no documented facility available. */
-static const char *__getProgramName () {
- extern const char *__progname;
- char * arg = strrchr(__progname, '/');
- if (arg)
- return arg+1;
- else
- return __progname;
-}
-# define GET_PROGRAM_NAME() __getProgramName()
-# else
-# define GET_PROGRAM_NAME() ""
-# warning "Per application configuration won't work with your OS version."
-# endif
-#endif
-
-/** \brief Find an option in an option cache with the name as key */
-static GLuint findOption (const driOptionCache *cache, const char *name) {
- GLuint len = strlen (name);
- GLuint size = 1 << cache->tableSize, mask = size - 1;
- GLuint hash = 0;
- GLuint i, shift;
-
- /* compute a hash from the variable length name */
- for (i = 0, shift = 0; i < len; ++i, shift = (shift+8) & 31)
- hash += (GLuint)name[i] << shift;
- hash *= hash;
- hash = (hash >> (16-cache->tableSize/2)) & mask;
-
- /* this is just the starting point of the linear search for the option */
- for (i = 0; i < size; ++i, hash = (hash+1) & mask) {
- /* if we hit an empty entry then the option is not defined (yet) */
- if (cache->info[hash].name == 0)
- break;
- else if (!strcmp (name, cache->info[hash].name))
- break;
- }
- /* this assertion fails if the hash table is full */
- assert (i < size);
-
- return hash;
-}
-
-/** \brief Count the real number of options in an option cache */
-static GLuint countOptions (const driOptionCache *cache) {
- GLuint size = 1 << cache->tableSize;
- GLuint i, count = 0;
- for (i = 0; i < size; ++i)
- if (cache->info[i].name)
- count++;
- return count;
-}
-
-/** \brief Like strdup but using MALLOC and with error checking. */
-#define XSTRDUP(dest,source) do { \
- GLuint len = strlen (source); \
- if (!(dest = MALLOC (len+1))) { \
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \
- abort(); \
- } \
- memcpy (dest, source, len+1); \
-} while (0)
-
-static int compare (const void *a, const void *b) {
- return strcmp (*(char *const*)a, *(char *const*)b);
-}
-/** \brief Binary search in a string array. */
-static GLuint bsearchStr (const XML_Char *name,
- const XML_Char *elems[], GLuint count) {
- const XML_Char **found;
- found = bsearch (&name, elems, count, sizeof (XML_Char *), compare);
- if (found)
- return found - elems;
- else
- return count;
-}
-
-/** \brief Locale-independent integer parser.
- *
- * Works similar to strtol. Leading space is NOT skipped. The input
- * number may have an optional sign. Radix is specified by base. If
- * base is 0 then decimal is assumed unless the input number is
- * prefixed by 0x or 0X for hexadecimal or 0 for octal. After
- * returning tail points to the first character that is not part of
- * the integer number. If no number was found then tail points to the
- * start of the input string. */
-static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) {
- GLint radix = base == 0 ? 10 : base;
- GLint result = 0;
- GLint sign = 1;
- GLboolean numberFound = GL_FALSE;
- const XML_Char *start = string;
-
- assert (radix >= 2 && radix <= 36);
-
- if (*string == '-') {
- sign = -1;
- string++;
- } else if (*string == '+')
- string++;
- if (base == 0 && *string == '0') {
- numberFound = GL_TRUE;
- if (*(string+1) == 'x' || *(string+1) == 'X') {
- radix = 16;
- string += 2;
- } else {
- radix = 8;
- string++;
- }
- }
- do {
- GLint digit = -1;
- if (radix <= 10) {
- if (*string >= '0' && *string < '0' + radix)
- digit = *string - '0';
- } else {
- if (*string >= '0' && *string <= '9')
- digit = *string - '0';
- else if (*string >= 'a' && *string < 'a' + radix - 10)
- digit = *string - 'a' + 10;
- else if (*string >= 'A' && *string < 'A' + radix - 10)
- digit = *string - 'A' + 10;
- }
- if (digit != -1) {
- numberFound = GL_TRUE;
- result = radix*result + digit;
- string++;
- } else
- break;
- } while (GL_TRUE);
- *tail = numberFound ? string : start;
- return sign * result;
-}
-
-/** \brief Locale-independent floating-point parser.
- *
- * Works similar to strtod. Leading space is NOT skipped. The input
- * number may have an optional sign. '.' is interpreted as decimal
- * point and may occor at most once. Optionally the number may end in
- * [eE]<exponent>, where <exponent> is an integer as recognized by
- * strToI. In that case the result is number * 10^exponent. After
- * returning tail points to the first character that is not part of
- * the floating point number. If no number was found then tail points
- * to the start of the input string.
- *
- * Uses two passes for maximum accuracy. */
-static GLfloat strToF (const XML_Char *string, const XML_Char **tail) {
- GLint nDigits = 0, pointPos, exponent;
- GLfloat sign = 1.0f, result = 0.0f, scale;
- const XML_Char *start = string, *numStart;
-
- /* sign */
- if (*string == '-') {
- sign = -1.0f;
- string++;
- } else if (*string == '+')
- string++;
-
- /* first pass: determine position of decimal point, number of
- * digits, exponent and the end of the number. */
- numStart = string;
- while (*string >= '0' && *string <= '9') {
- string++;
- nDigits++;
- }
- pointPos = nDigits;
- if (*string == '.') {
- string++;
- while (*string >= '0' && *string <= '9') {
- string++;
- nDigits++;
- }
- }
- if (nDigits == 0) {
- /* no digits, no number */
- *tail = start;
- return 0.0f;
- }
- *tail = string;
- if (*string == 'e' || *string == 'E') {
- const XML_Char *expTail;
- exponent = strToI (string+1, &expTail, 10);
- if (expTail == string+1)
- exponent = 0;
- else
- *tail = expTail;
- } else
- exponent = 0;
- string = numStart;
-
- /* scale of the first digit */
- scale = sign * (GLfloat)pow (10.0, (GLdouble)(pointPos-1 + exponent));
-
- /* second pass: parse digits */
- do {
- if (*string != '.') {
- assert (*string >= '0' && *string <= '9');
- result += scale * (GLfloat)(*string - '0');
- scale *= 0.1f;
- nDigits--;
- }
- string++;
- } while (nDigits > 0);
-
- return result;
-}
-
-/** \brief Parse a value of a given type. */
-static GLboolean parseValue (driOptionValue *v, driOptionType type,
- const XML_Char *string) {
- const XML_Char *tail;
- /* skip leading white-space */
- string += strspn (string, " \f\n\r\t\v");
- switch (type) {
- case DRI_BOOL:
- if (!strcmp (string, "false")) {
- v->_bool = GL_FALSE;
- tail = string + 5;
- } else if (!strcmp (string, "true")) {
- v->_bool = GL_TRUE;
- tail = string + 4;
- }
- else
- return GL_FALSE;
- break;
- case DRI_ENUM: /* enum is just a special integer */
- case DRI_INT:
- v->_int = strToI (string, &tail, 0);
- break;
- case DRI_FLOAT:
- v->_float = strToF (string, &tail);
- break;
- }
-
- if (tail == string)
- return GL_FALSE; /* empty string (or containing only white-space) */
- /* skip trailing white space */
- if (*tail)
- tail += strspn (tail, " \f\n\r\t\v");
- if (*tail)
- return GL_FALSE; /* something left over that is not part of value */
-
- return GL_TRUE;
-}
-
-/** \brief Parse a list of ranges of type info->type. */
-static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) {
- XML_Char *cp, *range;
- GLuint nRanges, i;
- driOptionRange *ranges;
-
- XSTRDUP (cp, string);
- /* pass 1: determine the number of ranges (number of commas + 1) */
- range = cp;
- for (nRanges = 1; *range; ++range)
- if (*range == ',')
- ++nRanges;
-
- if ((ranges = MALLOC (nRanges*sizeof(driOptionRange))) == NULL) {
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
- abort();
- }
-
- /* pass 2: parse all ranges into preallocated array */
- range = cp;
- for (i = 0; i < nRanges; ++i) {
- XML_Char *end, *sep;
- assert (range);
- end = strchr (range, ',');
- if (end)
- *end = '\0';
- sep = strchr (range, ':');
- if (sep) { /* non-empty interval */
- *sep = '\0';
- if (!parseValue (&ranges[i].start, info->type, range) ||
- !parseValue (&ranges[i].end, info->type, sep+1))
- break;
- if (info->type == DRI_INT &&
- ranges[i].start._int > ranges[i].end._int)
- break;
- if (info->type == DRI_FLOAT &&
- ranges[i].start._float > ranges[i].end._float)
- break;
- } else { /* empty interval */
- if (!parseValue (&ranges[i].start, info->type, range))
- break;
- ranges[i].end = ranges[i].start;
- }
- if (end)
- range = end+1;
- else
- range = NULL;
- }
- FREE (cp);
- if (i < nRanges) {
- FREE (ranges);
- return GL_FALSE;
- } else
- assert (range == NULL);
-
- info->nRanges = nRanges;
- info->ranges = ranges;
- return GL_TRUE;
-}
-
-/** \brief Check if a value is in one of info->ranges. */
-static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) {
- GLuint i;
- assert (info->type != DRI_BOOL); /* should be caught by the parser */
- if (info->nRanges == 0)
- return GL_TRUE;
- switch (info->type) {
- case DRI_ENUM: /* enum is just a special integer */
- case DRI_INT:
- for (i = 0; i < info->nRanges; ++i)
- if (v->_int >= info->ranges[i].start._int &&
- v->_int <= info->ranges[i].end._int)
- return GL_TRUE;
- break;
- case DRI_FLOAT:
- for (i = 0; i < info->nRanges; ++i)
- if (v->_float >= info->ranges[i].start._float &&
- v->_float <= info->ranges[i].end._float)
- return GL_TRUE;
- break;
- default:
- assert (0); /* should never happen */
- }
- return GL_FALSE;
-}
-
-/** \brief Output a warning message. */
-#define XML_WARNING1(msg) do {\
- __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser)); \
-} while (0)
-#define XML_WARNING(msg,args...) do { \
- __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser), \
- args); \
-} while (0)
-/** \brief Output an error message. */
-#define XML_ERROR1(msg) do { \
- __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser)); \
-} while (0)
-#define XML_ERROR(msg,args...) do { \
- __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser), \
- args); \
-} while (0)
-/** \brief Output a fatal error message and abort. */
-#define XML_FATAL1(msg) do { \
- fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \
- data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser)); \
- abort();\
-} while (0)
-#define XML_FATAL(msg,args...) do { \
- fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \
- data->name, \
- XML_GetCurrentLineNumber(data->parser), \
- XML_GetCurrentColumnNumber(data->parser), \
- args); \
- abort();\
-} while (0)
-
-/** \brief Parser context for __driConfigOptions. */
-struct OptInfoData {
- const char *name;
- XML_Parser parser;
- driOptionCache *cache;
- GLboolean inDriInfo;
- GLboolean inSection;
- GLboolean inDesc;
- GLboolean inOption;
- GLboolean inEnum;
- int curOption;
-};
-
-/** \brief Elements in __driConfigOptions. */
-enum OptInfoElem {
- OI_DESCRIPTION = 0, OI_DRIINFO, OI_ENUM, OI_OPTION, OI_SECTION, OI_COUNT
-};
-static const XML_Char *OptInfoElems[] = {
- "description", "driinfo", "enum", "option", "section"
-};
-
-/** \brief Parse attributes of an enum element.
- *
- * We're not actually interested in the data. Just make sure this is ok
- * for external configuration tools.
- */
-static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *value = NULL, *text = NULL;
- driOptionValue v;
- GLuint opt = data->curOption;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "value")) value = attr[i+1];
- else if (!strcmp (attr[i], "text")) text = attr[i+1];
- else XML_FATAL("illegal enum attribute: %s.", attr[i]);
- }
- if (!value) XML_FATAL1 ("value attribute missing in enum.");
- if (!text) XML_FATAL1 ("text attribute missing in enum.");
- if (!parseValue (&v, data->cache->info[opt].type, value))
- XML_FATAL ("illegal enum value: %s.", value);
- if (!checkValue (&v, &data->cache->info[opt]))
- XML_FATAL ("enum value out of valid range: %s.", value);
-}
-
-/** \brief Parse attributes of a description element.
- *
- * We're not actually interested in the data. Just make sure this is ok
- * for external configuration tools.
- */
-static void parseDescAttr (struct OptInfoData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *lang = NULL, *text = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "lang")) lang = attr[i+1];
- else if (!strcmp (attr[i], "text")) text = attr[i+1];
- else XML_FATAL("illegal description attribute: %s.", attr[i]);
- }
- if (!lang) XML_FATAL1 ("lang attribute missing in description.");
- if (!text) XML_FATAL1 ("text attribute missing in description.");
-}
-
-/** \brief Parse attributes of an option element. */
-static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) {
- enum OptAttr {OA_DEFAULT = 0, OA_NAME, OA_TYPE, OA_VALID, OA_COUNT};
- static const XML_Char *optAttr[] = {"default", "name", "type", "valid"};
- const XML_Char *attrVal[OA_COUNT] = {NULL, NULL, NULL, NULL};
- const char *defaultVal;
- driOptionCache *cache = data->cache;
- GLuint opt, i;
- for (i = 0; attr[i]; i += 2) {
- GLuint attrName = bsearchStr (attr[i], optAttr, OA_COUNT);
- if (attrName >= OA_COUNT)
- XML_FATAL ("illegal option attribute: %s", attr[i]);
- attrVal[attrName] = attr[i+1];
- }
- if (!attrVal[OA_NAME]) XML_FATAL1 ("name attribute missing in option.");
- if (!attrVal[OA_TYPE]) XML_FATAL1 ("type attribute missing in option.");
- if (!attrVal[OA_DEFAULT]) XML_FATAL1 ("default attribute missing in option.");
-
- opt = findOption (cache, attrVal[OA_NAME]);
- if (cache->info[opt].name)
- XML_FATAL ("option %s redefined.", attrVal[OA_NAME]);
- data->curOption = opt;
-
- XSTRDUP (cache->info[opt].name, attrVal[OA_NAME]);
-
- if (!strcmp (attrVal[OA_TYPE], "bool"))
- cache->info[opt].type = DRI_BOOL;
- else if (!strcmp (attrVal[OA_TYPE], "enum"))
- cache->info[opt].type = DRI_ENUM;
- else if (!strcmp (attrVal[OA_TYPE], "int"))
- cache->info[opt].type = DRI_INT;
- else if (!strcmp (attrVal[OA_TYPE], "float"))
- cache->info[opt].type = DRI_FLOAT;
- else
- XML_FATAL ("illegal type in option: %s.", attrVal[OA_TYPE]);
-
- defaultVal = getenv (cache->info[opt].name);
- if (defaultVal != NULL) {
- /* don't use XML_WARNING, we want the user to see this! */
- fprintf (stderr,
- "ATTENTION: default value of option %s overridden by environment.\n",
- cache->info[opt].name);
- } else
- defaultVal = attrVal[OA_DEFAULT];
- if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal))
- XML_FATAL ("illegal default value: %s.", defaultVal);
-
- if (attrVal[OA_VALID]) {
- if (cache->info[opt].type == DRI_BOOL)
- XML_FATAL1 ("boolean option with valid attribute.");
- if (!parseRanges (&cache->info[opt], attrVal[OA_VALID]))
- XML_FATAL ("illegal valid attribute: %s.", attrVal[OA_VALID]);
- if (!checkValue (&cache->values[opt], &cache->info[opt]))
- XML_FATAL ("default value out of valid range '%s': %s.",
- attrVal[OA_VALID], defaultVal);
- } else if (cache->info[opt].type == DRI_ENUM) {
- XML_FATAL1 ("valid attribute missing in option (mandatory for enums).");
- } else {
- cache->info[opt].nRanges = 0;
- cache->info[opt].ranges = NULL;
- }
-}
-
-/** \brief Handler for start element events. */
-static void optInfoStartElem (void *userData, const XML_Char *name,
- const XML_Char **attr) {
- struct OptInfoData *data = (struct OptInfoData *)userData;
- enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT);
- switch (elem) {
- case OI_DRIINFO:
- if (data->inDriInfo)
- XML_FATAL1 ("nested <driinfo> elements.");
- if (attr[0])
- XML_FATAL1 ("attributes specified on <driinfo> element.");
- data->inDriInfo = GL_TRUE;
- break;
- case OI_SECTION:
- if (!data->inDriInfo)
- XML_FATAL1 ("<section> must be inside <driinfo>.");
- if (data->inSection)
- XML_FATAL1 ("nested <section> elements.");
- if (attr[0])
- XML_FATAL1 ("attributes specified on <section> element.");
- data->inSection = GL_TRUE;
- break;
- case OI_DESCRIPTION:
- if (!data->inSection && !data->inOption)
- XML_FATAL1 ("<description> must be inside <description> or <option.");
- if (data->inDesc)
- XML_FATAL1 ("nested <description> elements.");
- data->inDesc = GL_TRUE;
- parseDescAttr (data, attr);
- break;
- case OI_OPTION:
- if (!data->inSection)
- XML_FATAL1 ("<option> must be inside <section>.");
- if (data->inDesc)
- XML_FATAL1 ("<option> nested in <description> element.");
- if (data->inOption)
- XML_FATAL1 ("nested <option> elements.");
- data->inOption = GL_TRUE;
- parseOptInfoAttr (data, attr);
- break;
- case OI_ENUM:
- if (!(data->inOption && data->inDesc))
- XML_FATAL1 ("<enum> must be inside <option> and <description>.");
- if (data->inEnum)
- XML_FATAL1 ("nested <enum> elements.");
- data->inEnum = GL_TRUE;
- parseEnumAttr (data, attr);
- break;
- default:
- XML_FATAL ("unknown element: %s.", name);
- }
-}
-
-/** \brief Handler for end element events. */
-static void optInfoEndElem (void *userData, const XML_Char *name) {
- struct OptInfoData *data = (struct OptInfoData *)userData;
- enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT);
- switch (elem) {
- case OI_DRIINFO:
- data->inDriInfo = GL_FALSE;
- break;
- case OI_SECTION:
- data->inSection = GL_FALSE;
- break;
- case OI_DESCRIPTION:
- data->inDesc = GL_FALSE;
- break;
- case OI_OPTION:
- data->inOption = GL_FALSE;
- break;
- case OI_ENUM:
- data->inEnum = GL_FALSE;
- break;
- default:
- assert (0); /* should have been caught by StartElem */
- }
-}
-
-void driParseOptionInfo (driOptionCache *info,
- const char *configOptions, GLuint nConfigOptions) {
- XML_Parser p;
- int status;
- struct OptInfoData userData;
- struct OptInfoData *data = &userData;
- GLuint realNoptions;
-
- /* determine hash table size and allocate memory:
- * 3/2 of the number of options, rounded up, so there remains always
- * at least one free entry. This is needed for detecting undefined
- * options in configuration files without getting a hash table overflow.
- * Round this up to a power of two. */
- GLuint minSize = (nConfigOptions*3 + 1) / 2;
- GLuint size, log2size;
- for (size = 1, log2size = 0; size < minSize; size <<= 1, ++log2size);
- info->tableSize = log2size;
- info->info = CALLOC (size * sizeof (driOptionInfo));
- info->values = CALLOC (size * sizeof (driOptionValue));
- if (info->info == NULL || info->values == NULL) {
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
- abort();
- }
-
- p = XML_ParserCreate ("UTF-8"); /* always UTF-8 */
- XML_SetElementHandler (p, optInfoStartElem, optInfoEndElem);
- XML_SetUserData (p, data);
-
- userData.name = "__driConfigOptions";
- userData.parser = p;
- userData.cache = info;
- userData.inDriInfo = GL_FALSE;
- userData.inSection = GL_FALSE;
- userData.inDesc = GL_FALSE;
- userData.inOption = GL_FALSE;
- userData.inEnum = GL_FALSE;
- userData.curOption = -1;
-
- status = XML_Parse (p, configOptions, strlen (configOptions), 1);
- if (!status)
- XML_FATAL ("%s.", XML_ErrorString(XML_GetErrorCode(p)));
-
- XML_ParserFree (p);
-
- /* Check if the actual number of options matches nConfigOptions.
- * A mismatch is not fatal (a hash table overflow would be) but we
- * want the driver developer's attention anyway. */
- realNoptions = countOptions (info);
- if (realNoptions != nConfigOptions) {
- fprintf (stderr,
- "Error: nConfigOptions (%u) does not match the actual number of options in\n"
- " __driConfigOptions (%u).\n",
- nConfigOptions, realNoptions);
- }
-}
-
-/** \brief Parser context for configuration files. */
-struct OptConfData {
- const char *name;
- XML_Parser parser;
- driOptionCache *cache;
- GLint screenNum;
- const char *driverName, *execName;
- GLuint ignoringDevice;
- GLuint ignoringApp;
- GLuint inDriConf;
- GLuint inDevice;
- GLuint inApp;
- GLuint inOption;
-};
-
-/** \brief Elements in configuration files. */
-enum OptConfElem {
- OC_APPLICATION = 0, OC_DEVICE, OC_DRICONF, OC_OPTION, OC_COUNT
-};
-static const XML_Char *OptConfElems[] = {
- "application", "device", "driconf", "option"
-};
-
-/** \brief Parse attributes of a device element. */
-static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *driver = NULL, *screen = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "driver")) driver = attr[i+1];
- else if (!strcmp (attr[i], "screen")) screen = attr[i+1];
- else XML_WARNING("unkown device attribute: %s.", attr[i]);
- }
- if (driver && strcmp (driver, data->driverName))
- data->ignoringDevice = data->inDevice;
- else if (screen) {
- driOptionValue screenNum;
- if (!parseValue (&screenNum, DRI_INT, screen))
- XML_WARNING("illegal screen number: %s.", screen);
- else if (screenNum._int != data->screenNum)
- data->ignoringDevice = data->inDevice;
- }
-}
-
-/** \brief Parse attributes of an application element. */
-static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *name = NULL, *exec = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "name")) name = attr[i+1];
- else if (!strcmp (attr[i], "executable")) exec = attr[i+1];
- else XML_WARNING("unkown application attribute: %s.", attr[i]);
- }
- if (exec && strcmp (exec, data->execName))
- data->ignoringApp = data->inApp;
-}
-
-/** \brief Parse attributes of an option element. */
-static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
- const XML_Char *name = NULL, *value = NULL;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp (attr[i], "name")) name = attr[i+1];
- else if (!strcmp (attr[i], "value")) value = attr[i+1];
- else XML_WARNING("unkown option attribute: %s.", attr[i]);
- }
- if (!name) XML_WARNING1 ("name attribute missing in option.");
- if (!value) XML_WARNING1 ("value attribute missing in option.");
- if (name && value) {
- driOptionCache *cache = data->cache;
- GLuint opt = findOption (cache, name);
- if (cache->info[opt].name == NULL)
- XML_WARNING ("undefined option: %s.", name);
- else if (getenv (cache->info[opt].name))
- /* don't use XML_WARNING, we want the user to see this! */
- fprintf (stderr, "ATTENTION: option value of option %s ignored.\n",
- cache->info[opt].name);
- else if (!parseValue (&cache->values[opt], cache->info[opt].type, value))
- XML_WARNING ("illegal option value: %s.", value);
- }
-}
-
-/** \brief Handler for start element events. */
-static void optConfStartElem (void *userData, const XML_Char *name,
- const XML_Char **attr) {
- struct OptConfData *data = (struct OptConfData *)userData;
- enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT);
- switch (elem) {
- case OC_DRICONF:
- if (data->inDriConf)
- XML_WARNING1 ("nested <driconf> elements.");
- if (attr[0])
- XML_WARNING1 ("attributes specified on <driconf> element.");
- data->inDriConf++;
- break;
- case OC_DEVICE:
- if (!data->inDriConf)
- XML_WARNING1 ("<device> should be inside <driconf>.");
- if (data->inDevice)
- XML_WARNING1 ("nested <device> elements.");
- data->inDevice++;
- if (!data->ignoringDevice && !data->ignoringApp)
- parseDeviceAttr (data, attr);
- break;
- case OC_APPLICATION:
- if (!data->inDevice)
- XML_WARNING1 ("<application> should be inside <device>.");
- if (data->inApp)
- XML_WARNING1 ("nested <application> elements.");
- data->inApp++;
- if (!data->ignoringDevice && !data->ignoringApp)
- parseAppAttr (data, attr);
- break;
- case OC_OPTION:
- if (!data->inApp)
- XML_WARNING1 ("<option> should be inside <application>.");
- if (data->inOption)
- XML_WARNING1 ("nested <option> elements.");
- data->inOption++;
- if (!data->ignoringDevice && !data->ignoringApp)
- parseOptConfAttr (data, attr);
- break;
- default:
- XML_WARNING ("unknown element: %s.", name);
- }
-}
-
-/** \brief Handler for end element events. */
-static void optConfEndElem (void *userData, const XML_Char *name) {
- struct OptConfData *data = (struct OptConfData *)userData;
- enum OptConfElem elem = bsearchStr (name, OptConfElems, OC_COUNT);
- switch (elem) {
- case OC_DRICONF:
- data->inDriConf--;
- break;
- case OC_DEVICE:
- if (data->inDevice-- == data->ignoringDevice)
- data->ignoringDevice = 0;
- break;
- case OC_APPLICATION:
- if (data->inApp-- == data->ignoringApp)
- data->ignoringApp = 0;
- break;
- case OC_OPTION:
- data->inOption--;
- break;
- default:
- /* unknown element, warning was produced on start tag */;
- }
-}
-
-/** \brief Initialize an option cache based on info */
-static void initOptionCache (driOptionCache *cache, const driOptionCache *info) {
- cache->info = info->info;
- cache->tableSize = info->tableSize;
- cache->values = MALLOC ((1<<info->tableSize) * sizeof (driOptionValue));
- if (cache->values == NULL) {
- fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__);
- abort();
- }
- memcpy (cache->values, info->values,
- (1<<info->tableSize) * sizeof (driOptionValue));
-}
-
-/** \brief Parse the named configuration file */
-static void parseOneConfigFile (XML_Parser p) {
-#define BUF_SIZE 0x1000
- struct OptConfData *data = (struct OptConfData *)XML_GetUserData (p);
- int status;
- int fd;
-
- if ((fd = open (data->name, O_RDONLY)) == -1) {
- __driUtilMessage ("Can't open configuration file %s: %s.",
- data->name, strerror (errno));
- return;
- }
-
- while (1) {
- int bytesRead;
- void *buffer = XML_GetBuffer (p, BUF_SIZE);
- if (!buffer) {
- __driUtilMessage ("Can't allocate parser buffer.");
- break;
- }
- bytesRead = read (fd, buffer, BUF_SIZE);
- if (bytesRead == -1) {
- __driUtilMessage ("Error reading from configuration file %s: %s.",
- data->name, strerror (errno));
- break;
- }
- status = XML_ParseBuffer (p, bytesRead, bytesRead == 0);
- if (!status) {
- XML_ERROR ("%s.", XML_ErrorString(XML_GetErrorCode(p)));
- break;
- }
- if (bytesRead == 0)
- break;
- }
-
- close (fd);
-#undef BUF_SIZE
-}
-
-void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
- GLint screenNum, const char *driverName) {
- char *filenames[2] = {"/etc/drirc", NULL};
- char *home;
- GLuint i;
- struct OptConfData userData;
-
- initOptionCache (cache, info);
-
- userData.cache = cache;
- userData.screenNum = screenNum;
- userData.driverName = driverName;
- userData.execName = GET_PROGRAM_NAME();
-
- if ((home = getenv ("HOME"))) {
- GLuint len = strlen (home);
- filenames[1] = MALLOC (len + 7+1);
- if (filenames[1] == NULL)
- __driUtilMessage ("Can't allocate memory for %s/.drirc.", home);
- else {
- memcpy (filenames[1], home, len);
- memcpy (filenames[1] + len, "/.drirc", 7+1);
- }
- }
-
- for (i = 0; i < 2; ++i) {
- XML_Parser p;
- if (filenames[i] == NULL)
- continue;
-
- p = XML_ParserCreate (NULL); /* use encoding specified by file */
- XML_SetElementHandler (p, optConfStartElem, optConfEndElem);
- XML_SetUserData (p, &userData);
- userData.parser = p;
- userData.name = filenames[i];
- userData.ignoringDevice = 0;
- userData.ignoringApp = 0;
- userData.inDriConf = 0;
- userData.inDevice = 0;
- userData.inApp = 0;
- userData.inOption = 0;
-
- parseOneConfigFile (p);
- XML_ParserFree (p);
- }
-
- if (filenames[1])
- FREE (filenames[1]);
-}
-
-void driDestroyOptionInfo (driOptionCache *info) {
- driDestroyOptionCache (info);
- if (info->info) {
- GLuint i, size = 1 << info->tableSize;
- for (i = 0; i < size; ++i) {
- if (info->info[i].name) {
- FREE (info->info[i].name);
- if (info->info[i].ranges)
- FREE (info->info[i].ranges);
- }
- }
- FREE (info->info);
- }
-}
-
-void driDestroyOptionCache (driOptionCache *cache) {
- if (cache->values)
- FREE (cache->values);
-}
-
-GLboolean driCheckOption (const driOptionCache *cache, const char *name,
- driOptionType type) {
- GLuint i = findOption (cache, name);
- return cache->info[i].name != NULL && cache->info[i].type == type;
-}
-
-GLboolean driQueryOptionb (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
- /* make sure the option is defined and has the correct type */
- assert (cache->info[i].name != NULL);
- assert (cache->info[i].type == DRI_BOOL);
- return cache->values[i]._bool;
-}
-
-GLint driQueryOptioni (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
- /* make sure the option is defined and has the correct type */
- assert (cache->info[i].name != NULL);
- assert (cache->info[i].type == DRI_INT || cache->info[i].type == DRI_ENUM);
- return cache->values[i]._int;
-}
-
-GLfloat driQueryOptionf (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
- /* make sure the option is defined and has the correct type */
- assert (cache->info[i].name != NULL);
- assert (cache->info[i].type == DRI_FLOAT);
- return cache->values[i]._float;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.h
deleted file mode 100644
index c363af764..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlconfig.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * 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
- * FELIX KUEHLING, 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.
- *
- */
-/**
- * \file xmlconfig.h
- * \brief Driver-independent client-side part of the XML configuration
- * \author Felix Kuehling
- */
-
-#ifndef __XMLCONFIG_H
-#define __XMLCONFIG_H
-
-/** \brief Option data types */
-typedef enum driOptionType {
- DRI_BOOL, DRI_ENUM, DRI_INT, DRI_FLOAT
-} driOptionType;
-
-/** \brief Option value */
-typedef union driOptionValue {
- GLboolean _bool; /**< \brief Boolean */
- GLint _int; /**< \brief Integer or Enum */
- GLfloat _float; /**< \brief Floating-point */
-} driOptionValue;
-
-/** \brief Single range of valid values
- *
- * For empty ranges (a single value) start == end */
-typedef struct driOptionRange {
- driOptionValue start; /**< \brief Start */
- driOptionValue end; /**< \brief End */
-} driOptionRange;
-
-/** \brief Information about an option */
-typedef struct driOptionInfo {
- char *name; /**< \brief Name */
- driOptionType type; /**< \brief Type */
- driOptionRange *ranges; /**< \brief Array of ranges */
- GLuint nRanges; /**< \brief Number of ranges */
-} driOptionInfo;
-
-/** \brief Option cache
- *
- * \li One in <driver>Screen caching option info and the default values
- * \li One in each <driver>Context with the actual values for that context */
-typedef struct driOptionCache {
- driOptionInfo *info;
- /**< \brief Array of option infos
- *
- * Points to the same array in the screen and all contexts */
- driOptionValue *values;
- /**< \brief Array of option values
- *
- * \li Default values in screen
- * \li Actual values in contexts
- */
- GLuint tableSize;
- /**< \brief Size of the arrays
- *
- * Depending on the hash function this may differ from __driNConfigOptions.
- * In the current implementation it's not actually a size but log2(size).
- * The value is the same in the screen and all contexts. */
-} driOptionCache;
-
-/** \brief Parse XML option info from configOptions
- *
- * To be called in <driver>CreateScreen
- *
- * \param info pointer to a driOptionCache that will store the option info
- * \param configOptions XML document describing available configuration opts
- * \param nConfigOptions number of options, used to choose a hash table size
- *
- * For the option information to be available to external configuration tools
- * it must be a public symbol __driConfigOptions. It is also passed as a
- * parameter to driParseOptionInfo in order to avoid driver-independent code
- * depending on symbols in driver-specific code. */
-void driParseOptionInfo (driOptionCache *info,
- const char *configOptions, GLuint nConfigOptions);
-/** \brief Initialize option cache from info and parse configuration files
- *
- * To be called in <driver>CreateContext. screenNum and driverName select
- * device sections. */
-void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
- GLint screenNum, const char *driverName);
-/** \brief Destroy option info
- *
- * To be called in <driver>DestroyScreen */
-void driDestroyOptionInfo (driOptionCache *info);
-/** \brief Destroy option cache
- *
- * To be called in <driver>DestroyContext */
-void driDestroyOptionCache (driOptionCache *cache);
-
-/** \brief Check if there exists a certain option */
-GLboolean driCheckOption (const driOptionCache *cache, const char *name,
- driOptionType type);
-
-/** \brief Query a boolean option value */
-GLboolean driQueryOptionb (const driOptionCache *cache, const char *name);
-/** \brief Query an integer option value */
-GLint driQueryOptioni (const driOptionCache *cache, const char *name);
-/** \brief Query a floating-point option value */
-GLfloat driQueryOptionf (const driOptionCache *cache, const char *name);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h
deleted file mode 100644
index 7fbc6e800..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * 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
- * FELIX KUEHLING, 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.
- *
- */
-/**
- * \file xmlpool.h
- * \brief Pool of common options
- * \author Felix Kuehling
- *
- * This file defines macros that can be used to construct
- * driConfigOptions in the drivers. Common options are defined in
- * xmlpool/t_options.h from which xmlpool/options.h is generated with
- * translations. This file defines generic helper macros and includes
- * xmlpool/options.h.
- */
-
-#ifndef __XMLPOOL_H
-#define __XMLPOOL_H
-
-/*
- * generic macros
- */
-
-/** \brief Begin __driConfigOptions */
-#define DRI_CONF_BEGIN \
-"<driinfo>\n"
-
-/** \brief End __driConfigOptions */
-#define DRI_CONF_END \
-"</driinfo>\n"
-
-/** \brief Begin a section of related options */
-#define DRI_CONF_SECTION_BEGIN \
-"<section>\n"
-
-/** \brief End a section of related options */
-#define DRI_CONF_SECTION_END \
-"</section>\n"
-
-/** \brief Begin an option definition */
-#define DRI_CONF_OPT_BEGIN(name,type,def) \
-"<option name=\""#name"\" type=\""#type"\" default=\""#def"\">\n"
-
-/** \brief Begin an option definition with restrictions on valid values */
-#define DRI_CONF_OPT_BEGIN_V(name,type,def,valid) \
-"<option name=\""#name"\" type=\""#type"\" default=\""#def"\" valid=\""valid"\">\n"
-
-/** \brief End an option description */
-#define DRI_CONF_OPT_END \
-"</option>\n"
-
-/** \brief A verbal description in a specified language (empty version) */
-#define DRI_CONF_DESC(lang,text) \
-"<description lang=\""#lang"\" text=\""text"\"/>\n"
-
-/** \brief A verbal description in a specified language */
-#define DRI_CONF_DESC_BEGIN(lang,text) \
-"<description lang=\""#lang"\" text=\""text"\">\n"
-
-/** \brief End a description */
-#define DRI_CONF_DESC_END \
-"</description>\n"
-
-/** \brief A verbal description of an enum value */
-#define DRI_CONF_ENUM(value,text) \
-"<enum value=\""#value"\" text=\""text"\"/>\n"
-
-
-/*
- * Predefined option sections and options with multi-lingual descriptions
- * are now automatically generated.
- */
-#include "xmlpool/options.h"
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/Makefile
deleted file mode 100644
index ef94541c3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-# Convenient makefile for managing translations.
-
-# Prerequisites:
-# - GNU gettext
-# - Python
-
-# Adding new translations
-# -----------------------
-
-# To start working on a new translation edit the POS=... line
-# below. If you want to add for example a french translation, add
-# fr.po.
-
-# Then run "make po" to generate a fresh .po file from translatable
-# strings in t_options.h. Now you can edit the new .po file (fr.po in
-# the example above) to translate the strings. Please make sure that
-# your editor encodes the file in UTF-8.
-
-# Updating existing translations
-# ------------------------------
-
-# Run "make po" to update .po files with new translatable strings from
-# t_options.h. Now you can edit the .po files you're interested
-# in. Please make sure that your editor encodes the file in UTF-8.
-
-# Updating options.h
-# ------------------
-
-# Finally run "make" to generate options.h from t_options.h with all
-# translations. Now you can rebuild the drivers. Any common options
-# used by the drivers will have option descriptions with the latest
-# translations.
-
-# Publishing translations
-# -----------------------
-
-# To get your translation(s) into Mesa CVS, please send me your
-# <lang>.po file.
-
-# More information:
-# - info gettext
-
-# The set of supported languages. Add languages as needed.
-POS=de.po es.po nl.po fr.po
-
-#
-# Don't change anything below, unless you know what you're doing.
-#
-LANGS=$(POS:%.po=%)
-MOS=$(POS:%.po=%/LC_MESSAGES/options.mo)
-POT=xmlpool.pot
-
-.PHONY: all clean pot po mo
-
-all: options.h
-
-# Only intermediate files are cleaned up. options.h is not deleted because
-# it's in CVS.
-clean:
- rm -f $(POT) *~
- rm -rf $(LANGS)
-
-# Default target options.h
-options.h: t_options.h mo
- python gen_xmlpool.py $(LANGS) > options.h
-
-# Update .mo files from the corresponding .po files.
-mo:
- @for mo in $(MOS); do \
- lang=$${mo%%/*}; \
- echo "Updating $$mo from $$lang.po."; \
- mkdir -p $${mo%/*}; \
- msgfmt -o $$mo $$lang.po; \
- done
-
-# Use this target to create or update .po files with new messages in
-# driconf.py.
-po: $(POS)
-
-pot: $(POT)
-
-# Extract message catalog from driconf.py.
-$(POT): t_options.h
- xgettext -L C --from-code utf-8 -o $(POT) t_options.h
-
-# Create or update a .po file for a specific language.
-%.po: $(POT)
- @if [ -f $@ ]; then \
- echo "Merging new strings from $(POT) into $@."; \
- mv $@ $@~; \
- msgmerge -o $@ $@~ $(POT); \
- else \
- echo "Initializing $@ from $(POT)."; \
- msginit -i $(POT) -o $@~ --locale=$*; \
- sed -e 's/charset=.*\\n/charset=UTF-8\\n/' $@~ > $@; \
- fi
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/de.po b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/de.po
deleted file mode 100644
index e287d0fe7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/de.po
+++ /dev/null
@@ -1,231 +0,0 @@
-# German translations for DRI driver options.
-# Copyright (C) 2005 Felix Kuehling
-# This file is distributed under the same license as the Mesa package.
-# Felix Kuehling <fxkuehl@gmx.de>, 2005.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Mesa 6.3\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-04-11 23:19+0200\n"
-"PO-Revision-Date: 2005-04-11 01:34+0200\n"
-"Last-Translator: Felix Kuehling <fxkuehl@gmx.de>\n"
-"Language-Team: German <de@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#: t_options.h:53
-msgid "Debugging"
-msgstr "Fehlersuche"
-
-#: t_options.h:57
-msgid "Disable 3D acceleration"
-msgstr "3D-Beschleunigung abschalten"
-
-#: t_options.h:62
-msgid "Show performance boxes"
-msgstr "Zeige Performanceboxen"
-
-#: t_options.h:69
-msgid "Image Quality"
-msgstr "Bildqualität"
-
-#: t_options.h:77
-msgid "Texture color depth"
-msgstr "Texturfarbtiefe"
-
-#: t_options.h:78
-msgid "Prefer frame buffer color depth"
-msgstr "Bevorzuge Farbtiefe des Framebuffers"
-
-#: t_options.h:79
-msgid "Prefer 32 bits per texel"
-msgstr "Bevorzuge 32 bits pro Texel"
-
-#: t_options.h:80
-msgid "Prefer 16 bits per texel"
-msgstr "Bevorzuge 16 bits pro Texel"
-
-#: t_options.h:81
-msgid "Force 16 bits per texel"
-msgstr "Erzwinge 16 bits pro Texel"
-
-#: t_options.h:87
-msgid "Initial maximum value for anisotropic texture filtering"
-msgstr "Initialer Maximalwert für anisotropische Texturfilterung"
-
-#: t_options.h:92
-msgid "Forbid negative texture LOD bias"
-msgstr "Verbiete negative Textur-Detailgradverschiebung"
-
-#: t_options.h:97
-msgid ""
-"Enable S3TC texture compression even if software support is not available"
-msgstr ""
-"Aktiviere S3TC Texturkomprimierung auch wenn die nötige "
-"Softwareunterstützung fehlt"
-
-#: t_options.h:104
-msgid "Initial color reduction method"
-msgstr "Initiale Farbreduktionsmethode"
-
-#: t_options.h:105
-msgid "Round colors"
-msgstr "Farben runden"
-
-#: t_options.h:106
-msgid "Dither colors"
-msgstr "Farben rastern"
-
-#: t_options.h:114
-msgid "Color rounding method"
-msgstr "Farbrundungsmethode"
-
-#: t_options.h:115
-msgid "Round color components downward"
-msgstr "Farbkomponenten abrunden"
-
-#: t_options.h:116
-msgid "Round to nearest color"
-msgstr "Zur ähnlichsten Farbe runden"
-
-#: t_options.h:125
-msgid "Color dithering method"
-msgstr "Farbrasterungsmethode"
-
-#: t_options.h:126
-msgid "Horizontal error diffusion"
-msgstr "Horizontale Fehlerstreuung"
-
-#: t_options.h:127
-msgid "Horizontal error diffusion, reset error at line start"
-msgstr "Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen"
-
-#: t_options.h:128
-msgid "Ordered 2D color dithering"
-msgstr "Geordnete 2D Farbrasterung"
-
-#: t_options.h:134
-msgid "Floating point depth buffer"
-msgstr "Fließkomma z-Puffer"
-
-#: t_options.h:140
-msgid "Performance"
-msgstr "Leistung"
-
-#: t_options.h:148
-msgid "TCL mode (Transformation, Clipping, Lighting)"
-msgstr "TCL-Modus (Transformation, Clipping, Licht)"
-
-#: t_options.h:149
-msgid "Use software TCL pipeline"
-msgstr "Benutze die Software-TCL-Pipeline"
-
-#: t_options.h:150
-msgid "Use hardware TCL as first TCL pipeline stage"
-msgstr "Benutze Hardware TCL als erste Stufe der TCL-Pipeline"
-
-#: t_options.h:151
-msgid "Bypass the TCL pipeline"
-msgstr "Umgehe die TCL-Pipeline"
-
-#: t_options.h:152
-msgid ""
-"Bypass the TCL pipeline with state-based machine code generated on-the-fly"
-msgstr ""
-"Umgehe die TCL-Pipeline mit zur Laufzeit erzeugtem, zustandsbasiertem "
-"Maschinencode"
-
-#: t_options.h:161
-msgid "Method to limit rendering latency"
-msgstr "Methode zur Begrenzung der Bildverzögerung"
-
-#: t_options.h:162
-msgid "Busy waiting for the graphics hardware"
-msgstr "Aktives Warten auf die Grafikhardware"
-
-#: t_options.h:163
-msgid "Sleep for brief intervals while waiting for the graphics hardware"
-msgstr "Kurze Schlafintervalle beim Warten auf die Grafikhardware"
-
-#: t_options.h:164
-msgid "Let the graphics hardware emit a software interrupt and sleep"
-msgstr ""
-"Die Grafikhardware eine Softwareunterbrechnung erzeugen lassen und schlafen"
-
-#: t_options.h:174
-msgid "Synchronization with vertical refresh (swap intervals)"
-msgstr "Synchronisation mit der vertikalen Bildwiederholung"
-
-#: t_options.h:175
-msgid "Never synchronize with vertical refresh, ignore application's choice"
-msgstr ""
-"Niemals mit der Bildwiederholung synchronisieren, Anweisungen der Anwendung "
-"ignorieren"
-
-#: t_options.h:176
-msgid "Initial swap interval 0, obey application's choice"
-msgstr "Initiales Bildinterval 0, Anweisungen der Anwendung gehorchen"
-
-#: t_options.h:177
-msgid "Initial swap interval 1, obey application's choice"
-msgstr "Initiales Bildinterval 1, Anweisungen der Anwendung gehorchen"
-
-#: t_options.h:178
-msgid ""
-"Always synchronize with vertical refresh, application chooses the minimum "
-"swap interval"
-msgstr ""
-"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minmale "
-"Bildinterval"
-
-#: t_options.h:186
-msgid "Use HyperZ to boost performance"
-msgstr "HyperZ zur Leistungssteigerung verwenden"
-
-#: t_options.h:191
-msgid "Number of texture units used"
-msgstr "Anzahl der benutzten Textureinheiten"
-
-#: t_options.h:196
-msgid ""
-"Enable hack to allow larger textures with texture compression on radeon/r200"
-msgstr ""
-"Hack aktivieren, der mit Texturkompression auf radeon/r200 größere Texturen "
-"erlaubt"
-
-#: t_options.h:201
-msgid "Texture filtering quality vs. speed, AKA “brilinear†texture filtering"
-msgstr ""
-"Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ "
-"Texturfilterung"
-
-#: t_options.h:209
-msgid "Used types of texture memory"
-msgstr "Benutzte Arten von Texturspeicher"
-
-#: t_options.h:210
-msgid "All available memory"
-msgstr "Aller verfügbarer Speicher"
-
-#: t_options.h:211
-msgid "Only card memory (if available)"
-msgstr "Nur Grafikspeicher (falls verfügbar)"
-
-#: t_options.h:212
-msgid "Only GART (AGP/PCIE) memory (if available)"
-msgstr "Nur GART-Speicher (AGP/PCIE) (falls verfügbar)"
-
-#: t_options.h:220
-msgid "Features that are not hardware-accelerated"
-msgstr "Funktionalität, die nicht hardwarebeschleunigt ist"
-
-#: t_options.h:224
-msgid "Enable extension GL_ARB_vertex_program"
-msgstr "Erweiterung GL_ARB_vertex_program aktivieren"
-
-#: t_options.h:229
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Erweiterung GL_NV_vertex_program aktivieren"
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/es.po b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/es.po
deleted file mode 100644
index 82ad177cb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/es.po
+++ /dev/null
@@ -1,219 +0,0 @@
-# translation of es.po to Spanish
-# Spanish translations for PACKAGE package.
-# Copyright (C) 2005 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# David <deifo@ono.com>, 2005.
-# David Rubio Miguélez <deifo@ono.com>, 2005.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: es\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-04-12 12:18+0200\n"
-"PO-Revision-Date: 2005-04-12 20:26+0200\n"
-"Last-Translator: David Rubio Miguélez <deifo@ono.com>\n"
-"Language-Team: Spanish <es@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: KBabel 1.10\n"
-
-#: t_options.h:53
-msgid "Debugging"
-msgstr "Depurando"
-
-#: t_options.h:57
-msgid "Disable 3D acceleration"
-msgstr "Desactivar aceleración 3D"
-
-#: t_options.h:62
-msgid "Show performance boxes"
-msgstr "Mostrar cajas de rendimiento"
-
-#: t_options.h:69
-msgid "Image Quality"
-msgstr "Calidad de imagen"
-
-#: t_options.h:77
-msgid "Texture color depth"
-msgstr "Profundidad de color de textura"
-
-#: t_options.h:78
-msgid "Prefer frame buffer color depth"
-msgstr "Preferir profundidad de color del \"framebuffer\""
-
-#: t_options.h:79
-msgid "Prefer 32 bits per texel"
-msgstr "Preferir 32 bits por texel"
-
-#: t_options.h:80
-msgid "Prefer 16 bits per texel"
-msgstr "Preferir 16 bits por texel"
-
-#: t_options.h:81
-msgid "Force 16 bits per texel"
-msgstr "Forzar a 16 bits por texel"
-
-#: t_options.h:87
-msgid "Initial maximum value for anisotropic texture filtering"
-msgstr "Valor máximo inicial para filtrado anisotrópico de textura"
-
-#: t_options.h:92
-msgid "Forbid negative texture LOD bias"
-msgstr "Prohibir valores negativos de Nivel De Detalle (LOD) de texturas"
-
-#: t_options.h:97
-msgid "Enable S3TC texture compression even if software support is not available"
-msgstr "Activar la compresión de texturas S3TC incluso si el soporte por software no está disponible"
-
-#: t_options.h:104
-msgid "Initial color reduction method"
-msgstr "Método inicial de reducción de color"
-
-#: t_options.h:105
-msgid "Round colors"
-msgstr "Colores redondeados"
-
-#: t_options.h:106
-msgid "Dither colors"
-msgstr "Colores suavizados"
-
-#: t_options.h:114
-msgid "Color rounding method"
-msgstr "Método de redondeo de colores"
-
-#: t_options.h:115
-msgid "Round color components downward"
-msgstr "Redondear hacia abajo los componentes de color"
-
-#: t_options.h:116
-msgid "Round to nearest color"
-msgstr "Redondear al color más cercano"
-
-#: t_options.h:125
-msgid "Color dithering method"
-msgstr "Método de suavizado de color"
-
-#: t_options.h:126
-msgid "Horizontal error diffusion"
-msgstr "Difusión de error horizontal"
-
-#: t_options.h:127
-msgid "Horizontal error diffusion, reset error at line start"
-msgstr "Difusión de error horizontal, reiniciar error al comienzo de línea"
-
-#: t_options.h:128
-msgid "Ordered 2D color dithering"
-msgstr "Suavizado de color 2D ordenado"
-
-#: t_options.h:134
-msgid "Floating point depth buffer"
-msgstr "Búfer de profundidad en coma flotante"
-
-#: t_options.h:140
-msgid "Performance"
-msgstr "Rendimiento"
-
-#: t_options.h:148
-msgid "TCL mode (Transformation, Clipping, Lighting)"
-msgstr "Modo TCL (Transformación, Recorte, Iluminación)"
-
-#: t_options.h:149
-msgid "Use software TCL pipeline"
-msgstr "Usar tubería TCL por software"
-
-#: t_options.h:150
-msgid "Use hardware TCL as first TCL pipeline stage"
-msgstr "Usar TCL por hardware en la primera fase de la tubería TCL"
-
-#: t_options.h:151
-msgid "Bypass the TCL pipeline"
-msgstr "Pasar por alto la tubería TCL"
-
-#: t_options.h:152
-msgid "Bypass the TCL pipeline with state-based machine code generated on-the-fly"
-msgstr "Pasar por alto la tubería TCL con código máquina basado en estados generado al vuelo"
-
-#: t_options.h:161
-msgid "Method to limit rendering latency"
-msgstr "Método para limitar la latencia de rénder"
-
-#: t_options.h:162
-msgid "Busy waiting for the graphics hardware"
-msgstr "Esperar activamente al hardware gráfico"
-
-#: t_options.h:163
-msgid "Sleep for brief intervals while waiting for the graphics hardware"
-msgstr "Dormir en intervalos cortos mientras se espera al hardware gráfico"
-
-#: t_options.h:164
-msgid "Let the graphics hardware emit a software interrupt and sleep"
-msgstr "Permitir que el hardware gráfico emita una interrupción de software y duerma"
-
-#: t_options.h:174
-msgid "Synchronization with vertical refresh (swap intervals)"
-msgstr "Sincronización con el refresco vertical (intervalos de intercambio)"
-
-#: t_options.h:175
-msgid "Never synchronize with vertical refresh, ignore application's choice"
-msgstr "No sincronizar nunca con el refresco vertical, ignorar la elección de la aplicación"
-
-#: t_options.h:176
-msgid "Initial swap interval 0, obey application's choice"
-msgstr "Intervalo de intercambio inicial 0, obedecer la elección de la aplicación"
-
-#: t_options.h:177
-msgid "Initial swap interval 1, obey application's choice"
-msgstr "Intervalo de intercambio inicial 1, obedecer la elección de la aplicación"
-
-#: t_options.h:178
-msgid ""
-"Always synchronize with vertical refresh, application chooses the minimum "
-"swap interval"
-msgstr "Sincronizar siempre con el refresco vertical, la aplicación elige el intervalo de intercambio mínimo"
-
-#: t_options.h:186
-msgid "Use HyperZ to boost performance"
-msgstr "Usar HyperZ para potenciar rendimiento"
-
-#: t_options.h:191
-msgid "Number of texture units used"
-msgstr "Número de unidades de textura usadas"
-
-#: t_options.h:196
-msgid "Enable hack to allow larger textures with texture compression on radeon/r200"
-msgstr "Activar \"hack\" para permitir texturas más grandes con compresión de textura activada en la Radeon/r200"
-
-#: t_options.h:201
-msgid "Texture filtering quality vs. speed, AKA “brilinear†texture filtering"
-msgstr "Calidad de filtrado de textura vs. velocidad, alias filtrado \"brilinear\" de textura"
-
-#: t_options.h:209
-msgid "Used types of texture memory"
-msgstr "Tipos de memoria de textura usados"
-
-#: t_options.h:210
-msgid "All available memory"
-msgstr "Toda la memoria disponible"
-
-#: t_options.h:211
-msgid "Only card memory (if available)"
-msgstr "Sólo la memoria de la tarjeta (si disponible)"
-
-#: t_options.h:212
-msgid "Only GART (AGP/PCIE) memory (if available)"
-msgstr "Sólo memoria GART (AGP/PCIE) (si disponible)"
-
-#: t_options.h:220
-msgid "Features that are not hardware-accelerated"
-msgstr "Características no aceleradas por hardware"
-
-#: t_options.h:224
-msgid "Enable extension GL_ARB_vertex_program"
-msgstr "Activar la extensión GL_ARB_vertex_program"
-
-#: t_options.h:229
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Activar extensión GL_NV_vertex_program"
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/fr.po b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/fr.po
deleted file mode 100644
index 19f3b4a4e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/fr.po
+++ /dev/null
@@ -1,225 +0,0 @@
-# French translations for DRI driver options.
-# Copyright (C) 2005 Stephane Marchesin
-# This file is distributed under the same license as the Mesa package.
-# Stephane Marchesin <marchesin@icps.u-strasbg.fr>, 2005.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Mesa 6.3\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-04-11 23:19+0200\n"
-"PO-Revision-Date: 2005-04-11 01:34+0200\n"
-"Last-Translator: Stephane Marchesin <marchesin@icps.u-strasbg.fr>\n"
-"Language-Team: French <fr@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#: t_options.h:53
-msgid "Debugging"
-msgstr "Debogage"
-
-#: t_options.h:57
-msgid "Disable 3D acceleration"
-msgstr "Désactiver l'accélération 3D"
-
-#: t_options.h:62
-msgid "Show performance boxes"
-msgstr "Afficher les boîtes de performance"
-
-#: t_options.h:69
-msgid "Image Quality"
-msgstr "Qualité d'image"
-
-#: t_options.h:77
-msgid "Texture color depth"
-msgstr "Profondeur de texture"
-
-#: t_options.h:78
-msgid "Prefer frame buffer color depth"
-msgstr "Profondeur de couleur"
-
-#: t_options.h:79
-msgid "Prefer 32 bits per texel"
-msgstr "Préférer 32 bits par texel"
-
-#: t_options.h:80
-msgid "Prefer 16 bits per texel"
-msgstr "Prérérer 16 bits par texel"
-
-#: t_options.h:81
-msgid "Force 16 bits per texel"
-msgstr "Forcer 16 bits par texel"
-
-#: t_options.h:87
-msgid "Initial maximum value for anisotropic texture filtering"
-msgstr "Valeur maximale initiale pour le filtrage anisotropique de texture"
-
-#: t_options.h:92
-msgid "Forbid negative texture LOD bias"
-msgstr "Interdire le LOD bias negatif"
-
-#: t_options.h:97
-msgid ""
-"Enable S3TC texture compression even if software support is not available"
-msgstr ""
-"Activer la compression de texture S3TC même si le support logiciel est absent"
-
-#: t_options.h:104
-msgid "Initial color reduction method"
-msgstr "Technique de réduction de couleurs"
-
-#: t_options.h:105
-msgid "Round colors"
-msgstr "Arrondir les valeurs de couleur"
-
-#: t_options.h:106
-msgid "Dither colors"
-msgstr "Tramer les couleurs"
-
-#: t_options.h:114
-msgid "Color rounding method"
-msgstr "Méthode d'arrondi des couleurs"
-
-#: t_options.h:115
-msgid "Round color components downward"
-msgstr "Arrondi à l'inférieur"
-
-#: t_options.h:116
-msgid "Round to nearest color"
-msgstr "Arrondi au plus proche"
-
-#: t_options.h:125
-msgid "Color dithering method"
-msgstr "Méthode de tramage"
-
-#: t_options.h:126
-msgid "Horizontal error diffusion"
-msgstr "Diffusion d'erreur horizontale"
-
-#: t_options.h:127
-msgid "Horizontal error diffusion, reset error at line start"
-msgstr "Diffusion d'erreur horizontale, réinitialisé pour chaque ligne"
-
-#: t_options.h:128
-msgid "Ordered 2D color dithering"
-msgstr "Tramage ordonné des couleurs"
-
-#: t_options.h:134
-msgid "Floating point depth buffer"
-msgstr "Z-buffer en virgule flottante"
-
-#: t_options.h:140
-msgid "Performance"
-msgstr "Performance"
-
-#: t_options.h:148
-msgid "TCL mode (Transformation, Clipping, Lighting)"
-msgstr "Mode de TCL (Transformation, Clipping, Eclairage)"
-
-#: t_options.h:149
-msgid "Use software TCL pipeline"
-msgstr "Utiliser un pipeline TCL logiciel"
-
-#: t_options.h:150
-msgid "Use hardware TCL as first TCL pipeline stage"
-msgstr "Utiliser le TCL matériel pour le premier niveau de pipeline"
-
-#: t_options.h:151
-msgid "Bypass the TCL pipeline"
-msgstr "Court-circuiter le pipeline TCL"
-
-#: t_options.h:152
-msgid ""
-"Bypass the TCL pipeline with state-based machine code generated on-the-fly"
-msgstr ""
-"Court-circuiter le pipeline TCL par une machine à états qui génère le code"
-"de TCL à la volée"
-
-#: t_options.h:161
-msgid "Method to limit rendering latency"
-msgstr "Méthode d'attente de la carte graphique"
-
-#: t_options.h:162
-msgid "Busy waiting for the graphics hardware"
-msgstr "Attente active de la carte graphique"
-
-#: t_options.h:163
-msgid "Sleep for brief intervals while waiting for the graphics hardware"
-msgstr "Attente utilisant usleep()"
-
-#: t_options.h:164
-msgid "Let the graphics hardware emit a software interrupt and sleep"
-msgstr "Utiliser les interruptions"
-
-#: t_options.h:174
-msgid "Synchronization with vertical refresh (swap intervals)"
-msgstr "Synchronisation de l'affichage avec le balayage vertical"
-
-#: t_options.h:175
-msgid "Never synchronize with vertical refresh, ignore application's choice"
-msgstr "Ne jamais synchroniser avec le balayage vertical, ignorer le choix de l'application"
-
-#: t_options.h:176
-msgid "Initial swap interval 0, obey application's choice"
-msgstr "Ne pas synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application"
-
-#: t_options.h:177
-msgid "Initial swap interval 1, obey application's choice"
-msgstr "Synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application"
-
-#: t_options.h:178
-msgid ""
-"Always synchronize with vertical refresh, application chooses the minimum "
-"swap interval"
-msgstr ""
-"Toujours synchroniser avec le balayage vertical, l'application choisit l'intervalle minimal"
-
-#: t_options.h:186
-msgid "Use HyperZ to boost performance"
-msgstr "Utiliser le HyperZ pour améliorer les performances"
-
-#: t_options.h:191
-msgid "Number of texture units used"
-msgstr "Nombre d'unités de texture"
-
-#: t_options.h:196
-msgid ""
-"Enable hack to allow larger textures with texture compression on radeon/r200"
-msgstr ""
-"Activer le hack permettant l'utilisation de textures de grande taille avec la "
-"compression de textures sur radeon/r200"
-
-#: t_options.h:201
-msgid "Texture filtering quality vs. speed, AKA “brilinear†texture filtering"
-msgstr ""
-"Qualité/performance du filtrage trilinéaire de texture (filtrage brilinéaire)"
-
-#: t_options.h:209
-msgid "Used types of texture memory"
-msgstr "Types de mémoire de texture"
-
-#: t_options.h:210
-msgid "All available memory"
-msgstr "Utiliser toute la mémoire disponible"
-
-#: t_options.h:211
-msgid "Only card memory (if available)"
-msgstr "Utiliser uniquement la mémoire graphique (si disponible)"
-
-#: t_options.h:212
-msgid "Only GART (AGP/PCIE) memory (if available)"
-msgstr "Utiliser uniquement la mémoire GART (AGP/PCIE) (si disponible)"
-
-#: t_options.h:220
-msgid "Features that are not hardware-accelerated"
-msgstr "Fonctionnalités ne bénéficiant pas d'une accélération matérielle"
-
-#: t_options.h:224
-msgid "Enable extension GL_ARB_vertex_program"
-msgstr "Activer l'extension GL_ARB_vertex_program"
-
-#: t_options.h:229
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Activer l'extension GL_NV_vertex_program"
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
deleted file mode 100644
index 7398c4cd0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import gettext
-import re
-
-# List of supported languages
-languages = sys.argv[1:]
-
-# Escape special characters in C strings
-def escapeCString (s):
- escapeSeqs = {'\a' : '\\a', '\b' : '\\b', '\f' : '\\f', '\n' : '\\n',
- '\r' : '\\r', '\t' : '\\t', '\v' : '\\v', '\\' : '\\\\'}
- # " -> '' is a hack. Quotes (") aren't possible in XML attributes.
- # Better use Unicode characters for typographic quotes in option
- # descriptions and translations.
- i = 0
- r = ''
- while i < len(s):
- # Special case: escape double quote with \u201c or \u201d, depending
- # on whether it's an open or close quote. This is needed because plain
- # double quotes are not possible in XML attributes.
- if s[i] == '"':
- if i == len(s)-1 or s[i+1].isspace():
- # close quote
- q = u'\u201c'
- else:
- # open quote
- q = u'\u201d'
- r = r + q
- elif escapeSeqs.has_key(s[i]):
- r = r + escapeSeqs[s[i]]
- else:
- r = r + s[i]
- i = i + 1
- return r
-
-# Expand escape sequences in C strings (needed for gettext lookup)
-def expandCString (s):
- escapeSeqs = {'a' : '\a', 'b' : '\b', 'f' : '\f', 'n' : '\n',
- 'r' : '\r', 't' : '\t', 'v' : '\v',
- '"' : '"', '\\' : '\\'}
- i = 0
- escape = False
- hexa = False
- octa = False
- num = 0
- digits = 0
- r = ''
- while i < len(s):
- if not escape:
- if s[i] == '\\':
- escape = True
- else:
- r = r + s[i]
- elif hexa:
- if (s[i] >= '0' and s[i] <= '9') or \
- (s[i] >= 'a' and s[i] <= 'f') or \
- (s[i] >= 'A' and s[i] <= 'F'):
- num = num * 16 + int(s[i],16)
- digits = digits + 1
- else:
- digits = 2
- if digits >= 2:
- hexa = False
- escape = False
- r = r + chr(num)
- elif octa:
- if s[i] >= '0' and s[i] <= '7':
- num = num * 8 + int(s[i],8)
- digits = digits + 1
- else:
- digits = 3
- if digits >= 3:
- octa = False
- escape = False
- r = r + chr(num)
- else:
- if escapeSeqs.has_key(s[i]):
- r = r + escapeSeqs[s[i]]
- escape = False
- elif s[i] >= '0' and s[i] <= '7':
- octa = True
- num = int(s[i],8)
- if num <= 3:
- digits = 1
- else:
- digits = 2
- elif s[i] == 'x' or s[i] == 'X':
- hexa = True
- num = 0
- digits = 0
- else:
- r = r + s[i]
- escape = False
- i = i + 1
- return r
-
-# Expand matches. The first match is always a DESC or DESC_BEGIN match.
-# Subsequent matches are ENUM matches.
-#
-# DESC, DESC_BEGIN format: \1 \2=<lang> \3 \4=gettext(" \5=<text> \6=") \7
-# ENUM format: \1 \2=gettext(" \3=<text> \4=") \5
-def expandMatches (matches, translations, end=None):
- assert len(matches) > 0
- nTranslations = len(translations)
- i = 0
- # Expand the description+enums for all translations
- for lang,trans in translations:
- i = i + 1
- # Make sure that all but the last line of a simple description
- # are extended with a backslash.
- suffix = ''
- if len(matches) == 1 and i < len(translations) and \
- not matches[0].expand (r'\7').endswith('\\'):
- suffix = ' \\'
- # Expand the description line. Need to use ugettext in order to allow
- # non-ascii unicode chars in the original English descriptions.
- text = escapeCString (trans.ugettext (unicode (expandCString (
- matches[0].expand (r'\5')), "utf-8"))).encode("utf-8")
- print matches[0].expand (r'\1' + lang + r'\3"' + text + r'"\7') + suffix
- # Expand any subsequent enum lines
- for match in matches[1:]:
- text = escapeCString (trans.ugettext (unicode (expandCString (
- match.expand (r'\3')), "utf-8"))).encode("utf-8")
- print match.expand (r'\1"' + text + r'"\5')
-
- # Expand description end
- if end:
- print end,
-
-# Compile a list of translation classes to all supported languages.
-# The first translation is always a NullTranslations.
-translations = [("en", gettext.NullTranslations())]
-for lang in languages:
- try:
- trans = gettext.translation ("options", ".", [lang])
- except IOError:
- sys.stderr.write ("Warning: language '%s' not found.\n" % lang)
- continue
- translations.append ((lang, trans))
-
-# Regular expressions:
-reLibintl_h = re.compile (r'#\s*include\s*<libintl.h>')
-reDESC = re.compile (r'(\s*DRI_CONF_DESC\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reDESC_BEGIN = re.compile (r'(\s*DRI_CONF_DESC_BEGIN\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reENUM = re.compile (r'(\s*DRI_CONF_ENUM\s*\([^,]+,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reDESC_END = re.compile (r'\s*DRI_CONF_DESC_END')
-
-# Print a header
-print \
-"/***********************************************************************\n" \
-" *** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***\n" \
-" ***********************************************************************/"
-
-# Process the options template and generate options.h with all
-# translations.
-template = file ("t_options.h", "r")
-descMatches = []
-for line in template:
- if len(descMatches) > 0:
- matchENUM = reENUM .match (line)
- matchDESC_END = reDESC_END.match (line)
- if matchENUM:
- descMatches.append (matchENUM)
- elif matchDESC_END:
- expandMatches (descMatches, translations, line)
- descMatches = []
- else:
- sys.stderr.write (
- "Warning: unexpected line inside description dropped:\n%s\n" \
- % line)
- continue
- if reLibintl_h.search (line):
- # Ignore (comment out) #include <libintl.h>
- print "/* %s * commented out by gen_xmlpool.py */" % line
- continue
- matchDESC = reDESC .match (line)
- matchDESC_BEGIN = reDESC_BEGIN.match (line)
- if matchDESC:
- assert len(descMatches) == 0
- expandMatches ([matchDESC], translations)
- elif matchDESC_BEGIN:
- assert len(descMatches) == 0
- descMatches = [matchDESC_BEGIN]
- else:
- print line,
-
-if len(descMatches) > 0:
- sys.stderr.write ("Warning: unterminated description at end of file.\n")
- expandMatches (descMatches, translations)
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/nl.po b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/nl.po
deleted file mode 100644
index 1e4cf167b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/nl.po
+++ /dev/null
@@ -1,230 +0,0 @@
-# Dutch translations for PACKAGE package.
-# Copyright (C) 2005 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# <manfred.stienstra@dwerg.net>, 2005.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-04-12 20:09+0200\n"
-"PO-Revision-Date: 2005-04-12 20:09+0200\n"
-"Last-Translator: Manfred Stienstra <manfred.stienstra@dwerg.net>\n"
-"Language-Team: Dutch <vertaling@nl.linux.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#: t_options.h:53
-msgid "Debugging"
-msgstr "Debuggen"
-
-#: t_options.h:57
-msgid "Disable 3D acceleration"
-msgstr "3D versnelling uitschakelen"
-
-#: t_options.h:62
-msgid "Show performance boxes"
-msgstr "Laat prestatie boxjes zien"
-
-#: t_options.h:69
-msgid "Image Quality"
-msgstr "Beeldkwaliteit"
-
-#: t_options.h:77
-msgid "Texture color depth"
-msgstr "Textuurkleurendiepte"
-
-#: t_options.h:78
-msgid "Prefer frame buffer color depth"
-msgstr "Prefereer kaderbufferkleurdiepte"
-
-#: t_options.h:79
-msgid "Prefer 32 bits per texel"
-msgstr "Prefereer 32 bits per texel"
-
-#: t_options.h:80
-msgid "Prefer 16 bits per texel"
-msgstr "Prefereer 16 bits per texel"
-
-#: t_options.h:81
-msgid "Force 16 bits per texel"
-msgstr "Dwing 16 bits per texel af"
-
-#: t_options.h:87
-msgid "Initial maximum value for anisotropic texture filtering"
-msgstr "Initïele maximum waarde voor anisotrophische textuur filtering"
-
-#: t_options.h:92
-msgid "Forbid negative texture LOD bias"
-msgstr "Verbied negatief niveau detailonderscheid (LOD) van texturen"
-
-#: t_options.h:97
-msgid ""
-"Enable S3TC texture compression even if software support is not available"
-msgstr ""
-"Schakel S3TC textuurcompressie in, zelfs als softwareondersteuning niet "
-"aanwezig is"
-
-#: t_options.h:104
-msgid "Initial color reduction method"
-msgstr "Initïele kleurreductie methode"
-
-#: t_options.h:105
-msgid "Round colors"
-msgstr "Rond kleuren af"
-
-#: t_options.h:106
-msgid "Dither colors"
-msgstr "Rasteriseer kleuren"
-
-#: t_options.h:114
-msgid "Color rounding method"
-msgstr "Kleurafrondingmethode"
-
-#: t_options.h:115
-msgid "Round color components downward"
-msgstr "Rond kleurencomponenten af naar beneden"
-
-#: t_options.h:116
-msgid "Round to nearest color"
-msgstr "Rond af naar dichtsbijzijnde kleur"
-
-#: t_options.h:125
-msgid "Color dithering method"
-msgstr "Kleurrasteriseringsmethode"
-
-#: t_options.h:126
-msgid "Horizontal error diffusion"
-msgstr "Horizontale foutdiffusie"
-
-#: t_options.h:127
-msgid "Horizontal error diffusion, reset error at line start"
-msgstr "Horizontale foutdiffusie, zet fout bij lijnbegin terug"
-
-#: t_options.h:128
-msgid "Ordered 2D color dithering"
-msgstr "Geordende 2D kleurrasterisering"
-
-#: t_options.h:134
-msgid "Floating point depth buffer"
-msgstr "Dieptebuffer als commagetal"
-
-#: t_options.h:140
-msgid "Performance"
-msgstr "Prestatie"
-
-#: t_options.h:148
-msgid "TCL mode (Transformation, Clipping, Lighting)"
-msgstr "TCL-modus (Transformatie, Clipping, Licht)"
-
-#: t_options.h:149
-msgid "Use software TCL pipeline"
-msgstr "Gebruik software TCL pijpleiding"
-
-#: t_options.h:150
-msgid "Use hardware TCL as first TCL pipeline stage"
-msgstr "Gebruik hardware TCL as eerste TCL pijpleiding trap"
-
-#: t_options.h:151
-msgid "Bypass the TCL pipeline"
-msgstr "Omzeil de TCL pijpleiding"
-
-#: t_options.h:152
-msgid ""
-"Bypass the TCL pipeline with state-based machine code generated on-the-fly"
-msgstr ""
-"Omzeil de TCL pijpleiding met staatgebaseerde machinecode die tijdens "
-"executie gegenereerd wordt"
-
-#: t_options.h:161
-msgid "Method to limit rendering latency"
-msgstr "Methode om beeldopbouwvertraging te onderdrukken"
-
-#: t_options.h:162
-msgid "Busy waiting for the graphics hardware"
-msgstr "Actief wachten voor de grafische hardware"
-
-#: t_options.h:163
-msgid "Sleep for brief intervals while waiting for the graphics hardware"
-msgstr "Slaap voor korte intervallen tijdens het wachten op de grafische "
-"hardware"
-
-#: t_options.h:164
-msgid "Let the graphics hardware emit a software interrupt and sleep"
-msgstr "Laat de grafische hardware een software onderbreking uitzenden en in "
-"slaap vallen"
-
-#: t_options.h:174
-msgid "Synchronization with vertical refresh (swap intervals)"
-msgstr "Synchronisatie met verticale verversing (interval omwisselen)"
-
-#: t_options.h:175
-msgid "Never synchronize with vertical refresh, ignore application's choice"
-msgstr "Nooit synchroniseren met verticale verversing, negeer de keuze van de "
-"applicatie"
-
-#: t_options.h:176
-msgid "Initial swap interval 0, obey application's choice"
-msgstr "Initïeel omwisselingsinterval 0, honoreer de keuze van de applicatie"
-
-#: t_options.h:177
-msgid "Initial swap interval 1, obey application's choice"
-msgstr "Initïeel omwisselingsinterval 1, honoreer de keuze van de applicatie"
-
-#: t_options.h:178
-msgid ""
-"Always synchronize with vertical refresh, application chooses the minimum "
-"swap interval"
-msgstr ""
-"Synchroniseer altijd met verticale verversing, de applicatie kiest het "
-"minimum omwisselingsinterval"
-
-#: t_options.h:186
-msgid "Use HyperZ to boost performance"
-msgstr "Gebruik HyperZ om de prestaties te verbeteren"
-
-#: t_options.h:191
-msgid "Number of texture units used"
-msgstr "Aantal textuureenheden in gebruik"
-
-#: t_options.h:196
-msgid ""
-"Enable hack to allow larger textures with texture compression on radeon/r200"
-msgstr ""
-"Schakel hack in om met textuurcompressie grotere texturen toe te staan op "
-"een radeon/r200"
-
-#: t_options.h:201
-msgid "Texture filtering quality vs. speed, AKA “brilinear†texture filtering"
-msgstr "Textuurfilterkwaliteit versus -snelheid, ookwel bekend als "
-"“brilineaire†textuurfiltering"
-
-#: t_options.h:209
-msgid "Used types of texture memory"
-msgstr "Gebruikte soorten textuurgeheugen"
-
-#: t_options.h:210
-msgid "All available memory"
-msgstr "Al het beschikbaar geheugen"
-
-#: t_options.h:211
-msgid "Only card memory (if available)"
-msgstr "Alleen geheugen op de kaart (als het aanwezig is)"
-
-#: t_options.h:212
-msgid "Only GART (AGP/PCIE) memory (if available)"
-msgstr "Alleen GART (AGP/PCIE) geheugen (als het aanwezig is)"
-
-#: t_options.h:220
-msgid "Features that are not hardware-accelerated"
-msgstr "Eigenschappen die niet hardwareversneld zijn"
-
-#: t_options.h:224
-msgid "Enable extension GL_ARB_vertex_program"
-msgstr "Zet uitbreiding GL_ARB_vertex_program aan"
-
-#: t_options.h:229
-msgid "Enable extension GL_NV_vertex_program"
-msgstr "Zet uitbreiding GL_NV_vertex_program aan"
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/options.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/options.h
deleted file mode 100644
index 86d17d024..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/options.h
+++ /dev/null
@@ -1,462 +0,0 @@
-/***********************************************************************
- *** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***
- ***********************************************************************/
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * 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
- * FELIX KUEHLING, 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.
- *
- */
-/**
- * \file t_options.h
- * \brief Templates of common options
- * \author Felix Kuehling
- *
- * This file defines macros for common options that can be used to
- * construct driConfigOptions in the drivers. This file is only a
- * template containing English descriptions for options wrapped in
- * gettext(). xgettext can be used to extract translatable
- * strings. These strings can then be translated by anyone familiar
- * with GNU gettext. gen_xmlpool.py takes this template and fills in
- * all the translations. The result (options.h) is included by
- * xmlpool.h which in turn can be included by drivers.
- *
- * The macros used to describe otions in this file are defined in
- * ../xmlpool.h.
- */
-
-/* This is needed for xgettext to extract translatable strings.
- * gen_xmlpool.py will discard this line. */
-/* #include <libintl.h>
- * commented out by gen_xmlpool.py */
-
-/*
- * predefined option sections and options with multi-lingual descriptions
- */
-
-/** \brief Debugging options */
-#define DRI_CONF_SECTION_DEBUG \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,"Debugging") \
- DRI_CONF_DESC(de,"Fehlersuche") \
- DRI_CONF_DESC(es,"Depurando") \
- DRI_CONF_DESC(nl,"Debuggen") \
- DRI_CONF_DESC(fr,"Debogage")
-
-#define DRI_CONF_NO_RAST(def) \
-DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
- DRI_CONF_DESC(en,"Disable 3D acceleration") \
- DRI_CONF_DESC(de,"3D-Beschleunigung abschalten") \
- DRI_CONF_DESC(es,"Desactivar aceleración 3D") \
- DRI_CONF_DESC(nl,"3D versnelling uitschakelen") \
- DRI_CONF_DESC(fr,"Désactiver l'accélération 3D") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_PERFORMANCE_BOXES(def) \
-DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
- DRI_CONF_DESC(en,"Show performance boxes") \
- DRI_CONF_DESC(de,"Zeige Performanceboxen") \
- DRI_CONF_DESC(es,"Mostrar cajas de rendimiento") \
- DRI_CONF_DESC(nl,"Laat prestatie boxjes zien") \
- DRI_CONF_DESC(fr,"Afficher les boîtes de performance") \
-DRI_CONF_OPT_END
-
-
-/** \brief Texture-related options */
-#define DRI_CONF_SECTION_QUALITY \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,"Image Quality") \
- DRI_CONF_DESC(de,"Bildqualität") \
- DRI_CONF_DESC(es,"Calidad de imagen") \
- DRI_CONF_DESC(nl,"Beeldkwaliteit") \
- DRI_CONF_DESC(fr,"Qualité d'image")
-
-#define DRI_CONF_TEXTURE_DEPTH_FB 0
-#define DRI_CONF_TEXTURE_DEPTH_32 1
-#define DRI_CONF_TEXTURE_DEPTH_16 2
-#define DRI_CONF_TEXTURE_DEPTH_FORCE_16 3
-#define DRI_CONF_TEXTURE_DEPTH(def) \
-DRI_CONF_OPT_BEGIN_V(texture_depth,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,"Texture color depth") \
- DRI_CONF_ENUM(0,"Prefer frame buffer color depth") \
- DRI_CONF_ENUM(1,"Prefer 32 bits per texel") \
- DRI_CONF_ENUM(2,"Prefer 16 bits per texel") \
- DRI_CONF_ENUM(3,"Force 16 bits per texel") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Texturfarbtiefe") \
- DRI_CONF_ENUM(0,"Bevorzuge Farbtiefe des Framebuffers") \
- DRI_CONF_ENUM(1,"Bevorzuge 32 bits pro Texel") \
- DRI_CONF_ENUM(2,"Bevorzuge 16 bits pro Texel") \
- DRI_CONF_ENUM(3,"Erzwinge 16 bits pro Texel") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Profundidad de color de textura") \
- DRI_CONF_ENUM(0,"Preferir profundidad de color del â€framebuffer“") \
- DRI_CONF_ENUM(1,"Preferir 32 bits por texel") \
- DRI_CONF_ENUM(2,"Preferir 16 bits por texel") \
- DRI_CONF_ENUM(3,"Forzar a 16 bits por texel") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"Textuurkleurendiepte") \
- DRI_CONF_ENUM(0,"Prefereer kaderbufferkleurdiepte") \
- DRI_CONF_ENUM(1,"Prefereer 32 bits per texel") \
- DRI_CONF_ENUM(2,"Prefereer 16 bits per texel") \
- DRI_CONF_ENUM(3,"Dwing 16 bits per texel af") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Profondeur de texture") \
- DRI_CONF_ENUM(0,"Profondeur de couleur") \
- DRI_CONF_ENUM(1,"Préférer 32 bits par texel") \
- DRI_CONF_ENUM(2,"Prérérer 16 bits par texel") \
- DRI_CONF_ENUM(3,"Forcer 16 bits par texel") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_DEF_MAX_ANISOTROPY(def,range) \
-DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \
- DRI_CONF_DESC(en,"Initial maximum value for anisotropic texture filtering") \
- DRI_CONF_DESC(de,"Initialer Maximalwert für anisotropische Texturfilterung") \
- DRI_CONF_DESC(es,"Valor máximo inicial para filtrado anisotrópico de textura") \
- DRI_CONF_DESC(nl,"Initïele maximum waarde voor anisotrophische textuur filtering") \
- DRI_CONF_DESC(fr,"Valeur maximale initiale pour le filtrage anisotropique de texture") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_NO_NEG_LOD_BIAS(def) \
-DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \
- DRI_CONF_DESC(en,"Forbid negative texture LOD bias") \
- DRI_CONF_DESC(de,"Verbiete negative Textur-Detailgradverschiebung") \
- DRI_CONF_DESC(es,"Prohibir valores negativos de Nivel De Detalle (LOD) de texturas") \
- DRI_CONF_DESC(nl,"Verbied negatief niveau detailonderscheid (LOD) van texturen") \
- DRI_CONF_DESC(fr,"Interdire le LOD bias negatif") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_FORCE_S3TC_ENABLE(def) \
-DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \
- DRI_CONF_DESC(en,"Enable S3TC texture compression even if software support is not available") \
- DRI_CONF_DESC(de,"Aktiviere S3TC Texturkomprimierung auch wenn die nötige Softwareunterstützung fehlt") \
- DRI_CONF_DESC(es,"Activar la compresión de texturas S3TC incluso si el soporte por software no está disponible") \
- DRI_CONF_DESC(nl,"Schakel S3TC textuurcompressie in, zelfs als softwareondersteuning niet aanwezig is") \
- DRI_CONF_DESC(fr,"Activer la compression de texture S3TC même si le support logiciel est absent") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_COLOR_REDUCTION_ROUND 0
-#define DRI_CONF_COLOR_REDUCTION_DITHER 1
-#define DRI_CONF_COLOR_REDUCTION(def) \
-DRI_CONF_OPT_BEGIN_V(color_reduction,enum,def,"0:1") \
- DRI_CONF_DESC_BEGIN(en,"Initial color reduction method") \
- DRI_CONF_ENUM(0,"Round colors") \
- DRI_CONF_ENUM(1,"Dither colors") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Initiale Farbreduktionsmethode") \
- DRI_CONF_ENUM(0,"Farben runden") \
- DRI_CONF_ENUM(1,"Farben rastern") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Método inicial de reducción de color") \
- DRI_CONF_ENUM(0,"Colores redondeados") \
- DRI_CONF_ENUM(1,"Colores suavizados") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"Initïele kleurreductie methode") \
- DRI_CONF_ENUM(0,"Rond kleuren af") \
- DRI_CONF_ENUM(1,"Rasteriseer kleuren") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Technique de réduction de couleurs") \
- DRI_CONF_ENUM(0,"Arrondir les valeurs de couleur") \
- DRI_CONF_ENUM(1,"Tramer les couleurs") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_ROUND_TRUNC 0
-#define DRI_CONF_ROUND_ROUND 1
-#define DRI_CONF_ROUND_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(round_mode,enum,def,"0:1") \
- DRI_CONF_DESC_BEGIN(en,"Color rounding method") \
- DRI_CONF_ENUM(0,"Round color components downward") \
- DRI_CONF_ENUM(1,"Round to nearest color") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Farbrundungsmethode") \
- DRI_CONF_ENUM(0,"Farbkomponenten abrunden") \
- DRI_CONF_ENUM(1,"Zur ähnlichsten Farbe runden") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Método de redondeo de colores") \
- DRI_CONF_ENUM(0,"Redondear hacia abajo los componentes de color") \
- DRI_CONF_ENUM(1,"Redondear al color más cercano") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"Kleurafrondingmethode") \
- DRI_CONF_ENUM(0,"Rond kleurencomponenten af naar beneden") \
- DRI_CONF_ENUM(1,"Rond af naar dichtsbijzijnde kleur") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Méthode d'arrondi des couleurs") \
- DRI_CONF_ENUM(0,"Arrondi à l'inférieur") \
- DRI_CONF_ENUM(1,"Arrondi au plus proche") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_DITHER_XERRORDIFF 0
-#define DRI_CONF_DITHER_XERRORDIFFRESET 1
-#define DRI_CONF_DITHER_ORDERED 2
-#define DRI_CONF_DITHER_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,"Color dithering method") \
- DRI_CONF_ENUM(0,"Horizontal error diffusion") \
- DRI_CONF_ENUM(1,"Horizontal error diffusion, reset error at line start") \
- DRI_CONF_ENUM(2,"Ordered 2D color dithering") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Farbrasterungsmethode") \
- DRI_CONF_ENUM(0,"Horizontale Fehlerstreuung") \
- DRI_CONF_ENUM(1,"Horizontale Fehlerstreuung, Fehler am Zeilenanfang zurücksetzen") \
- DRI_CONF_ENUM(2,"Geordnete 2D Farbrasterung") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Método de suavizado de color") \
- DRI_CONF_ENUM(0,"Difusión de error horizontal") \
- DRI_CONF_ENUM(1,"Difusión de error horizontal, reiniciar error al comienzo de línea") \
- DRI_CONF_ENUM(2,"Suavizado de color 2D ordenado") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"Kleurrasteriseringsmethode") \
- DRI_CONF_ENUM(0,"Horizontale foutdiffusie") \
- DRI_CONF_ENUM(1,"Horizontale foutdiffusie, zet fout bij lijnbegin terug") \
- DRI_CONF_ENUM(2,"Geordende 2D kleurrasterisering") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Méthode de tramage") \
- DRI_CONF_ENUM(0,"Diffusion d'erreur horizontale") \
- DRI_CONF_ENUM(1,"Diffusion d'erreur horizontale, réinitialisé pour chaque ligne") \
- DRI_CONF_ENUM(2,"Tramage ordonné des couleurs") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_FLOAT_DEPTH(def) \
-DRI_CONF_OPT_BEGIN(float_depth,bool,def) \
- DRI_CONF_DESC(en,"Floating point depth buffer") \
- DRI_CONF_DESC(de,"Fließkomma z-Puffer") \
- DRI_CONF_DESC(es,"Búfer de profundidad en coma flotante") \
- DRI_CONF_DESC(nl,"Dieptebuffer als commagetal") \
- DRI_CONF_DESC(fr,"Z-buffer en virgule flottante") \
-DRI_CONF_OPT_END
-
-/** \brief Performance-related options */
-#define DRI_CONF_SECTION_PERFORMANCE \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,"Performance") \
- DRI_CONF_DESC(de,"Leistung") \
- DRI_CONF_DESC(es,"Rendimiento") \
- DRI_CONF_DESC(nl,"Prestatie") \
- DRI_CONF_DESC(fr,"Performance")
-
-#define DRI_CONF_TCL_SW 0
-#define DRI_CONF_TCL_PIPELINED 1
-#define DRI_CONF_TCL_VTXFMT 2
-#define DRI_CONF_TCL_CODEGEN 3
-#define DRI_CONF_TCL_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,"TCL mode (Transformation, Clipping, Lighting)") \
- DRI_CONF_ENUM(0,"Use software TCL pipeline") \
- DRI_CONF_ENUM(1,"Use hardware TCL as first TCL pipeline stage") \
- DRI_CONF_ENUM(2,"Bypass the TCL pipeline") \
- DRI_CONF_ENUM(3,"Bypass the TCL pipeline with state-based machine code generated on-the-fly") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"TCL-Modus (Transformation, Clipping, Licht)") \
- DRI_CONF_ENUM(0,"Benutze die Software-TCL-Pipeline") \
- DRI_CONF_ENUM(1,"Benutze Hardware TCL als erste Stufe der TCL-Pipeline") \
- DRI_CONF_ENUM(2,"Umgehe die TCL-Pipeline") \
- DRI_CONF_ENUM(3,"Umgehe die TCL-Pipeline mit zur Laufzeit erzeugtem, zustandsbasiertem Maschinencode") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Modo TCL (Transformación, Recorte, Iluminación)") \
- DRI_CONF_ENUM(0,"Usar tubería TCL por software") \
- DRI_CONF_ENUM(1,"Usar TCL por hardware en la primera fase de la tubería TCL") \
- DRI_CONF_ENUM(2,"Pasar por alto la tubería TCL") \
- DRI_CONF_ENUM(3,"Pasar por alto la tubería TCL con código máquina basado en estados generado al vuelo") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"TCL-modus (Transformatie, Clipping, Licht)") \
- DRI_CONF_ENUM(0,"Gebruik software TCL pijpleiding") \
- DRI_CONF_ENUM(1,"Gebruik hardware TCL as eerste TCL pijpleiding trap") \
- DRI_CONF_ENUM(2,"Omzeil de TCL pijpleiding") \
- DRI_CONF_ENUM(3,"Omzeil de TCL pijpleiding met staatgebaseerde machinecode die tijdens executie gegenereerd wordt") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Mode de TCL (Transformation, Clipping, Eclairage)") \
- DRI_CONF_ENUM(0,"Utiliser un pipeline TCL logiciel") \
- DRI_CONF_ENUM(1,"Utiliser le TCL matériel pour le premier niveau de pipeline") \
- DRI_CONF_ENUM(2,"Court-circuiter le pipeline TCL") \
- DRI_CONF_ENUM(3,"Court-circuiter le pipeline TCL par une machine à états qui génère le codede TCL à la volée") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_FTHROTTLE_BUSY 0
-#define DRI_CONF_FTHROTTLE_USLEEPS 1
-#define DRI_CONF_FTHROTTLE_IRQS 2
-#define DRI_CONF_FTHROTTLE_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,"Method to limit rendering latency") \
- DRI_CONF_ENUM(0,"Busy waiting for the graphics hardware") \
- DRI_CONF_ENUM(1,"Sleep for brief intervals while waiting for the graphics hardware") \
- DRI_CONF_ENUM(2,"Let the graphics hardware emit a software interrupt and sleep") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Methode zur Begrenzung der Bildverzögerung") \
- DRI_CONF_ENUM(0,"Aktives Warten auf die Grafikhardware") \
- DRI_CONF_ENUM(1,"Kurze Schlafintervalle beim Warten auf die Grafikhardware") \
- DRI_CONF_ENUM(2,"Die Grafikhardware eine Softwareunterbrechnung erzeugen lassen und schlafen") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Método para limitar la latencia de rénder") \
- DRI_CONF_ENUM(0,"Esperar activamente al hardware gráfico") \
- DRI_CONF_ENUM(1,"Dormir en intervalos cortos mientras se espera al hardware gráfico") \
- DRI_CONF_ENUM(2,"Permitir que el hardware gráfico emita una interrupción de software y duerma") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"Methode om beeldopbouwvertraging te onderdrukken") \
- DRI_CONF_ENUM(0,"Actief wachten voor de grafische hardware") \
- DRI_CONF_ENUM(1,"Slaap voor korte intervallen tijdens het wachten op de grafische hardware") \
- DRI_CONF_ENUM(2,"Laat de grafische hardware een software onderbreking uitzenden en in slaap vallen") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Méthode d'attente de la carte graphique") \
- DRI_CONF_ENUM(0,"Attente active de la carte graphique") \
- DRI_CONF_ENUM(1,"Attente utilisant usleep()") \
- DRI_CONF_ENUM(2,"Utiliser les interruptions") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_VBLANK_NEVER 0
-#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
-#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
-#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
-#define DRI_CONF_VBLANK_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,"Synchronization with vertical refresh (swap intervals)") \
- DRI_CONF_ENUM(0,"Never synchronize with vertical refresh, ignore application's choice") \
- DRI_CONF_ENUM(1,"Initial swap interval 0, obey application's choice") \
- DRI_CONF_ENUM(2,"Initial swap interval 1, obey application's choice") \
- DRI_CONF_ENUM(3,"Always synchronize with vertical refresh, application chooses the minimum swap interval") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Synchronisation mit der vertikalen Bildwiederholung") \
- DRI_CONF_ENUM(0,"Niemals mit der Bildwiederholung synchronisieren, Anweisungen der Anwendung ignorieren") \
- DRI_CONF_ENUM(1,"Initiales Bildinterval 0, Anweisungen der Anwendung gehorchen") \
- DRI_CONF_ENUM(2,"Initiales Bildinterval 1, Anweisungen der Anwendung gehorchen") \
- DRI_CONF_ENUM(3,"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minmale Bildinterval") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Sincronización con el refresco vertical (intervalos de intercambio)") \
- DRI_CONF_ENUM(0,"No sincronizar nunca con el refresco vertical, ignorar la elección de la aplicación") \
- DRI_CONF_ENUM(1,"Intervalo de intercambio inicial 0, obedecer la elección de la aplicación") \
- DRI_CONF_ENUM(2,"Intervalo de intercambio inicial 1, obedecer la elección de la aplicación") \
- DRI_CONF_ENUM(3,"Sincronizar siempre con el refresco vertical, la aplicación elige el intervalo de intercambio mínimo") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"Synchronisatie met verticale verversing (interval omwisselen)") \
- DRI_CONF_ENUM(0,"Nooit synchroniseren met verticale verversing, negeer de keuze van de applicatie") \
- DRI_CONF_ENUM(1,"Initïeel omwisselingsinterval 0, honoreer de keuze van de applicatie") \
- DRI_CONF_ENUM(2,"Initïeel omwisselingsinterval 1, honoreer de keuze van de applicatie") \
- DRI_CONF_ENUM(3,"Synchroniseer altijd met verticale verversing, de applicatie kiest het minimum omwisselingsinterval") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Synchronisation de l'affichage avec le balayage vertical") \
- DRI_CONF_ENUM(0,"Ne jamais synchroniser avec le balayage vertical, ignorer le choix de l'application") \
- DRI_CONF_ENUM(1,"Ne pas synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application") \
- DRI_CONF_ENUM(2,"Synchroniser avec le balayage vertical par défaut, mais obéir au choix de l'application") \
- DRI_CONF_ENUM(3,"Toujours synchroniser avec le balayage vertical, l'application choisit l'intervalle minimal") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_HYPERZ_DISABLED 0
-#define DRI_CONF_HYPERZ_ENABLED 1
-#define DRI_CONF_HYPERZ(def) \
-DRI_CONF_OPT_BEGIN(hyperz,bool,def) \
- DRI_CONF_DESC(en,"Use HyperZ to boost performance") \
- DRI_CONF_DESC(de,"HyperZ zur Leistungssteigerung verwenden") \
- DRI_CONF_DESC(es,"Usar HyperZ para potenciar rendimiento") \
- DRI_CONF_DESC(nl,"Gebruik HyperZ om de prestaties te verbeteren") \
- DRI_CONF_DESC(fr,"Utiliser le HyperZ pour améliorer les performances") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_MAX_TEXTURE_UNITS(def,min,max) \
-DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
- DRI_CONF_DESC(en,"Number of texture units used") \
- DRI_CONF_DESC(de,"Anzahl der benutzten Textureinheiten") \
- DRI_CONF_DESC(es,"Número de unidades de textura usadas") \
- DRI_CONF_DESC(nl,"Aantal textuureenheden in gebruik") \
- DRI_CONF_DESC(fr,"Nombre d'unités de texture") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_TEXTURE_LEVEL_HACK(def) \
-DRI_CONF_OPT_BEGIN(texture_level_hack,bool,def) \
- DRI_CONF_DESC(en,"Enable hack to allow larger textures with texture compression on radeon/r200") \
- DRI_CONF_DESC(de,"Hack aktivieren, der mit Texturkompression auf radeon/r200 größere Texturen erlaubt") \
- DRI_CONF_DESC(es,"Activar â€hack“ para permitir texturas más grandes con compresión de textura activada en la Radeon/r200") \
- DRI_CONF_DESC(nl,"Schakel hack in om met textuurcompressie grotere texturen toe te staan op een radeon/r200") \
- DRI_CONF_DESC(fr,"Activer le hack permettant l'utilisation de textures de grande taille avec la compression de textures sur radeon/r200") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
-DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
- DRI_CONF_DESC(en,"Texture filtering quality vs. speed, AKA “brilinear†texture filtering") \
- DRI_CONF_DESC(de,"Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ Texturfilterung") \
- DRI_CONF_DESC(es,"Calidad de filtrado de textura vs. velocidad, alias filtrado â€brilinear“ de textura") \
- DRI_CONF_DESC(nl,"Textuurfilterkwaliteit versus -snelheid, ookwel bekend als “brilineaire†textuurfiltering") \
- DRI_CONF_DESC(fr,"Qualité/performance du filtrage trilinéaire de texture (filtrage brilinéaire)") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_TEXTURE_HEAPS_ALL 0
-#define DRI_CONF_TEXTURE_HEAPS_CARD 1
-#define DRI_CONF_TEXTURE_HEAPS_GART 2
-#define DRI_CONF_TEXTURE_HEAPS(def) \
-DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,"Used types of texture memory") \
- DRI_CONF_ENUM(0,"All available memory") \
- DRI_CONF_ENUM(1,"Only card memory (if available)") \
- DRI_CONF_ENUM(2,"Only GART (AGP/PCIE) memory (if available)") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(de,"Benutzte Arten von Texturspeicher") \
- DRI_CONF_ENUM(0,"Aller verfügbarer Speicher") \
- DRI_CONF_ENUM(1,"Nur Grafikspeicher (falls verfügbar)") \
- DRI_CONF_ENUM(2,"Nur GART-Speicher (AGP/PCIE) (falls verfügbar)") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(es,"Tipos de memoria de textura usados") \
- DRI_CONF_ENUM(0,"Toda la memoria disponible") \
- DRI_CONF_ENUM(1,"Sólo la memoria de la tarjeta (si disponible)") \
- DRI_CONF_ENUM(2,"Sólo memoria GART (AGP/PCIE) (si disponible)") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(nl,"Gebruikte soorten textuurgeheugen") \
- DRI_CONF_ENUM(0,"Al het beschikbaar geheugen") \
- DRI_CONF_ENUM(1,"Alleen geheugen op de kaart (als het aanwezig is)") \
- DRI_CONF_ENUM(2,"Alleen GART (AGP/PCIE) geheugen (als het aanwezig is)") \
- DRI_CONF_DESC_END \
- DRI_CONF_DESC_BEGIN(fr,"Types de mémoire de texture") \
- DRI_CONF_ENUM(0,"Utiliser toute la mémoire disponible") \
- DRI_CONF_ENUM(1,"Utiliser uniquement la mémoire graphique (si disponible)") \
- DRI_CONF_ENUM(2,"Utiliser uniquement la mémoire GART (AGP/PCIE) (si disponible)") \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
- On cards where there is no documentation (r200) or on rasterization-only hardware). */
-#define DRI_CONF_SECTION_SOFTWARE \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,"Features that are not hardware-accelerated") \
- DRI_CONF_DESC(de,"Funktionalität, die nicht hardwarebeschleunigt ist") \
- DRI_CONF_DESC(es,"Características no aceleradas por hardware") \
- DRI_CONF_DESC(nl,"Eigenschappen die niet hardwareversneld zijn") \
- DRI_CONF_DESC(fr,"Fonctionnalités ne bénéficiant pas d'une accélération matérielle")
-
-#define DRI_CONF_ARB_VERTEX_PROGRAM(def) \
-DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
- DRI_CONF_DESC(en,"Enable extension GL_ARB_vertex_program") \
- DRI_CONF_DESC(de,"Erweiterung GL_ARB_vertex_program aktivieren") \
- DRI_CONF_DESC(es,"Activar la extensión GL_ARB_vertex_program") \
- DRI_CONF_DESC(nl,"Zet uitbreiding GL_ARB_vertex_program aan") \
- DRI_CONF_DESC(fr,"Activer l'extension GL_ARB_vertex_program") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
-DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
- DRI_CONF_DESC(en,"Enable extension GL_NV_vertex_program") \
- DRI_CONF_DESC(de,"Erweiterung GL_NV_vertex_program aktivieren") \
- DRI_CONF_DESC(es,"Activar extensión GL_NV_vertex_program") \
- DRI_CONF_DESC(nl,"Zet uitbreiding GL_NV_vertex_program aan") \
- DRI_CONF_DESC(fr,"Activer l'extension GL_NV_vertex_program") \
-DRI_CONF_OPT_END
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/t_options.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/t_options.h
deleted file mode 100644
index ab9245ee2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * XML DRI client-side driver configuration
- * Copyright (C) 2003 Felix Kuehling
- *
- * 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
- * FELIX KUEHLING, 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.
- *
- */
-/**
- * \file t_options.h
- * \brief Templates of common options
- * \author Felix Kuehling
- *
- * This file defines macros for common options that can be used to
- * construct driConfigOptions in the drivers. This file is only a
- * template containing English descriptions for options wrapped in
- * gettext(). xgettext can be used to extract translatable
- * strings. These strings can then be translated by anyone familiar
- * with GNU gettext. gen_xmlpool.py takes this template and fills in
- * all the translations. The result (options.h) is included by
- * xmlpool.h which in turn can be included by drivers.
- *
- * The macros used to describe otions in this file are defined in
- * ../xmlpool.h.
- */
-
-/* This is needed for xgettext to extract translatable strings.
- * gen_xmlpool.py will discard this line. */
-#include <libintl.h>
-
-/*
- * predefined option sections and options with multi-lingual descriptions
- */
-
-/** \brief Debugging options */
-#define DRI_CONF_SECTION_DEBUG \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,gettext("Debugging"))
-
-#define DRI_CONF_NO_RAST(def) \
-DRI_CONF_OPT_BEGIN(no_rast,bool,def) \
- DRI_CONF_DESC(en,gettext("Disable 3D acceleration")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_PERFORMANCE_BOXES(def) \
-DRI_CONF_OPT_BEGIN(performance_boxes,bool,def) \
- DRI_CONF_DESC(en,gettext("Show performance boxes")) \
-DRI_CONF_OPT_END
-
-
-/** \brief Texture-related options */
-#define DRI_CONF_SECTION_QUALITY \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,gettext("Image Quality"))
-
-#define DRI_CONF_TEXTURE_DEPTH_FB 0
-#define DRI_CONF_TEXTURE_DEPTH_32 1
-#define DRI_CONF_TEXTURE_DEPTH_16 2
-#define DRI_CONF_TEXTURE_DEPTH_FORCE_16 3
-#define DRI_CONF_TEXTURE_DEPTH(def) \
-DRI_CONF_OPT_BEGIN_V(texture_depth,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,gettext("Texture color depth")) \
- DRI_CONF_ENUM(0,gettext("Prefer frame buffer color depth")) \
- DRI_CONF_ENUM(1,gettext("Prefer 32 bits per texel")) \
- DRI_CONF_ENUM(2,gettext("Prefer 16 bits per texel")) \
- DRI_CONF_ENUM(3,gettext("Force 16 bits per texel")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_DEF_MAX_ANISOTROPY(def,range) \
-DRI_CONF_OPT_BEGIN_V(def_max_anisotropy,float,def,range) \
- DRI_CONF_DESC(en,gettext("Initial maximum value for anisotropic texture filtering")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_NO_NEG_LOD_BIAS(def) \
-DRI_CONF_OPT_BEGIN(no_neg_lod_bias,bool,def) \
- DRI_CONF_DESC(en,gettext("Forbid negative texture LOD bias")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_FORCE_S3TC_ENABLE(def) \
-DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \
- DRI_CONF_DESC(en,gettext("Enable S3TC texture compression even if software support is not available")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_COLOR_REDUCTION_ROUND 0
-#define DRI_CONF_COLOR_REDUCTION_DITHER 1
-#define DRI_CONF_COLOR_REDUCTION(def) \
-DRI_CONF_OPT_BEGIN_V(color_reduction,enum,def,"0:1") \
- DRI_CONF_DESC_BEGIN(en,gettext("Initial color reduction method")) \
- DRI_CONF_ENUM(0,gettext("Round colors")) \
- DRI_CONF_ENUM(1,gettext("Dither colors")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_ROUND_TRUNC 0
-#define DRI_CONF_ROUND_ROUND 1
-#define DRI_CONF_ROUND_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(round_mode,enum,def,"0:1") \
- DRI_CONF_DESC_BEGIN(en,gettext("Color rounding method")) \
- DRI_CONF_ENUM(0,gettext("Round color components downward")) \
- DRI_CONF_ENUM(1,gettext("Round to nearest color")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_DITHER_XERRORDIFF 0
-#define DRI_CONF_DITHER_XERRORDIFFRESET 1
-#define DRI_CONF_DITHER_ORDERED 2
-#define DRI_CONF_DITHER_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(dither_mode,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,gettext("Color dithering method")) \
- DRI_CONF_ENUM(0,gettext("Horizontal error diffusion")) \
- DRI_CONF_ENUM(1,gettext("Horizontal error diffusion, reset error at line start")) \
- DRI_CONF_ENUM(2,gettext("Ordered 2D color dithering")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_FLOAT_DEPTH(def) \
-DRI_CONF_OPT_BEGIN(float_depth,bool,def) \
- DRI_CONF_DESC(en,gettext("Floating point depth buffer")) \
-DRI_CONF_OPT_END
-
-/** \brief Performance-related options */
-#define DRI_CONF_SECTION_PERFORMANCE \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,gettext("Performance"))
-
-#define DRI_CONF_TCL_SW 0
-#define DRI_CONF_TCL_PIPELINED 1
-#define DRI_CONF_TCL_VTXFMT 2
-#define DRI_CONF_TCL_CODEGEN 3
-#define DRI_CONF_TCL_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(tcl_mode,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,gettext("TCL mode (Transformation, Clipping, Lighting)")) \
- DRI_CONF_ENUM(0,gettext("Use software TCL pipeline")) \
- DRI_CONF_ENUM(1,gettext("Use hardware TCL as first TCL pipeline stage")) \
- DRI_CONF_ENUM(2,gettext("Bypass the TCL pipeline")) \
- DRI_CONF_ENUM(3,gettext("Bypass the TCL pipeline with state-based machine code generated on-the-fly")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_FTHROTTLE_BUSY 0
-#define DRI_CONF_FTHROTTLE_USLEEPS 1
-#define DRI_CONF_FTHROTTLE_IRQS 2
-#define DRI_CONF_FTHROTTLE_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(fthrottle_mode,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,gettext("Method to limit rendering latency")) \
- DRI_CONF_ENUM(0,gettext("Busy waiting for the graphics hardware")) \
- DRI_CONF_ENUM(1,gettext("Sleep for brief intervals while waiting for the graphics hardware")) \
- DRI_CONF_ENUM(2,gettext("Let the graphics hardware emit a software interrupt and sleep")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_VBLANK_NEVER 0
-#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
-#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
-#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
-#define DRI_CONF_VBLANK_MODE(def) \
-DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
- DRI_CONF_DESC_BEGIN(en,gettext("Synchronization with vertical refresh (swap intervals)")) \
- DRI_CONF_ENUM(0,gettext("Never synchronize with vertical refresh, ignore application's choice")) \
- DRI_CONF_ENUM(1,gettext("Initial swap interval 0, obey application's choice")) \
- DRI_CONF_ENUM(2,gettext("Initial swap interval 1, obey application's choice")) \
- DRI_CONF_ENUM(3,gettext("Always synchronize with vertical refresh, application chooses the minimum swap interval")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_HYPERZ_DISABLED 0
-#define DRI_CONF_HYPERZ_ENABLED 1
-#define DRI_CONF_HYPERZ(def) \
-DRI_CONF_OPT_BEGIN(hyperz,bool,def) \
- DRI_CONF_DESC(en,gettext("Use HyperZ to boost performance")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_MAX_TEXTURE_UNITS(def,min,max) \
-DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
- DRI_CONF_DESC(en,gettext("Number of texture units used")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_TEXTURE_LEVEL_HACK(def) \
-DRI_CONF_OPT_BEGIN(texture_level_hack,bool,def) \
- DRI_CONF_DESC(en,gettext("Enable hack to allow larger textures with texture compression on radeon/r200")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
-DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
- DRI_CONF_DESC(en,gettext("Texture filtering quality vs. speed, AKA “brilinear†texture filtering")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_TEXTURE_HEAPS_ALL 0
-#define DRI_CONF_TEXTURE_HEAPS_CARD 1
-#define DRI_CONF_TEXTURE_HEAPS_GART 2
-#define DRI_CONF_TEXTURE_HEAPS(def) \
-DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
- DRI_CONF_DESC_BEGIN(en,gettext("Used types of texture memory")) \
- DRI_CONF_ENUM(0,gettext("All available memory")) \
- DRI_CONF_ENUM(1,gettext("Only card memory (if available)")) \
- DRI_CONF_ENUM(2,gettext("Only GART (AGP/PCIE) memory (if available)")) \
- DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
-/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
- On cards where there is no documentation (r200) or on rasterization-only hardware). */
-#define DRI_CONF_SECTION_SOFTWARE \
-DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(en,gettext("Features that are not hardware-accelerated"))
-
-#define DRI_CONF_ARB_VERTEX_PROGRAM(def) \
-DRI_CONF_OPT_BEGIN(arb_vertex_program,bool,def) \
- DRI_CONF_DESC(en,gettext("Enable extension GL_ARB_vertex_program")) \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_NV_VERTEX_PROGRAM(def) \
-DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
- DRI_CONF_DESC(en,gettext("Enable extension GL_NV_vertex_program")) \
-DRI_CONF_OPT_END
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/Doxyfile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/Doxyfile
deleted file mode 100644
index 31256db83..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/Makefile
deleted file mode 100644
index 12465c9f4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# src/mesa/drivers/dri/fb/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = fb_dri.so
-
-DRIVER_SOURCES = \
- fb_dri.c \
- fb_egl.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_dri.c
deleted file mode 100644
index e2ba66d2e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_dri.c
+++ /dev/null
@@ -1,786 +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 "extensions.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "array_cache/acache.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"
-
-void fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-typedef struct {
- GLcontext *glCtx; /* Mesa context */
-
- struct {
- __DRIcontextPrivate *context;
- __DRIscreenPrivate *screen;
- __DRIdrawablePrivate *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 );
- _ac_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
-viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- _mesa_ResizeBuffersMESA();
-}
-
-
-static void
-init_core_functions( struct dd_function_table *functions )
-{
- functions->GetString = get_string;
- functions->UpdateState = update_state;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- 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( __DRIscreenPrivate *sPriv )
-{
- sPriv->private = NULL;
- return GL_TRUE;
-}
-
-static void
-fbDestroyScreen( __DRIscreenPrivate *sPriv )
-{
-}
-
-void fbSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- /* NOP until SetBuffer is fully removed */
-}
-
-/* Create the device specific context.
- */
-static GLboolean
-fbCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *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 );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _swsetup_Wakeup( ctx );
-
-
- /* swrast init -- need to verify these tests - I just plucked the
- * numbers out of the air. (KW)
- */
- {
- struct swrast_device_driver *swdd;
- swdd = _swrast_GetDeviceDriverReference( ctx );
- swdd->SetBuffer = fbSetBuffer;
- }
-
- /* 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( __DRIcontextPrivate *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 );
- _ac_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( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *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(GL_RGBA, driScrnPriv->fbBPP / 8,
- driScrnPriv->fbOrigin,
- driScrnPriv->fbStride);
- fbSetSpanFunctions(drb, mesaVis);
- drb->Base.Data = driScrnPriv->pFB;
- _mesa_add_renderbuffer(mesa_framebuffer,
- BUFFER_FRONT_LEFT, &drb->Base);
- }
- if (mesaVis->doubleBufferMode) {
- /* XXX what are the correct origin/stride values? */
- driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, driScrnPriv->fbBPP /8,
- driScrnPriv->fbOrigin,
- driScrnPriv->fbStride);
- fbSetSpanFunctions(drb, mesaVis);
- drb->Base.Data = _mesa_malloc(driScrnPriv->fbStride * driScrnPriv->fbHeight);
- _mesa_add_renderbuffer(mesa_framebuffer,
- BUFFER_BACK_LEFT, &drb->Base);
- }
-
- _mesa_add_soft_renderbuffers(mesa_framebuffer,
- GL_FALSE, /* color */
- swDepth,
- swStencil,
- swAccum,
- 0,
- GL_FALSE /* aux */);
-
- driDrawPriv->driverPrivate = mesa_framebuffer;
-
- return 1;
- }
-}
-
-
-static void
-fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- struct gl_framebuffer *mesa_framebuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate;
-
- _mesa_free(mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data);
- _mesa_destroy_framebuffer(mesa_framebuffer);
- driDrawPriv->driverPrivate = NULL;
-}
-
-
-
-/* If the backbuffer is on a videocard, this is extraordinarily slow!
- */
-static void
-fbSwapBuffers( __DRIdrawablePrivate *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( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *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( __DRIcontextPrivate *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, 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);
-
- return 1;
-}
-
-static void
-__driHaltFBDev( struct DRIDriverContextRec *ctx )
-{
-}
-
-struct DRIDriverRec __driDriver = {
- __driValidateMode,
- __driValidateMode,
- __driInitFBDev,
- __driHaltFBDev
-};
-
-static __GLcontextModes *
-fbFillInModes( 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 */
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_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 = (*dri_interface->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 __DRIscreenPrivate 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 )
-{
- __DRIscreenPrivate *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->fbBPP,
- (psp->fbBPP == 16) ? 16 : 24,
- (psp->fbBPP == 16) ? 0 : 8,
- 1);
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_egl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_egl.c
deleted file mode 100644
index 2cea48808..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/fb/fb_egl.c
+++ /dev/null
@@ -1,881 +0,0 @@
-/*
- * Test egl driver for fb_dri.so
- */
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <linux/fb.h>
-
-#include "utils.h"
-#include "buffers.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "array_cache/acache.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"
-#include "drirenderbuffer.h"
-
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-
-extern void
-fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis);
-extern void
-fbSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer, GLuint bufferBit);
-
-/**
- * fb driver-specific driver class derived from _EGLDriver
- */
-typedef struct fb_driver
-{
- _EGLDriver Base; /* base class/object */
- GLuint fbStuff;
-} fbDriver;
-
-/**
- * fb display-specific driver class derived from _EGLDisplay
- */
-typedef struct fb_display
-{
- _EGLDisplay Base; /* base class/object */
- void *pFB;
-} fbDisplay;
-
-/**
- * fb driver-specific screen class derived from _EGLScreen
- */
-typedef struct fb_screen
-{
- _EGLScreen Base;
- char fb[NAME_MAX];
-} fbScreen;
-
-
-/**
- * fb driver-specific surface class derived from _EGLSurface
- */
-typedef struct fb_surface
-{
- _EGLSurface Base; /* base class/object */
- struct gl_framebuffer *mesa_framebuffer;
-} fbSurface;
-
-
-/**
- * fb driver-specific context class derived from _EGLContext
- */
-typedef struct fb_context
-{
- _EGLContext Base; /* base class/object */
- GLcontext *glCtx;
-} fbContext;
-
-
-static EGLBoolean
-fbFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer) {
- _EGLConfig *configs;
- _EGLConfig *c;
- unsigned int i, num_configs;
- unsigned int depth_buffer_factor;
- unsigned int 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 */
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_t stencil_bits_array[2];
-
- depth_bits_array[0] = 0;
- 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_configs = depth_buffer_factor * back_buffer_factor * 2;
-
- 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;
- }
-
- configs = calloc(sizeof(*configs), num_configs);
- c = configs;
- if (!_eglFillInConfigs(c, 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 EGL_FALSE;
- }
-
- /* Mark the visual as slow if there are "fake" stencil bits.
- */
- for (i = 0, c = configs; i < num_configs; i++, c++) {
- int stencil = GET_CONFIG_ATTRIB(c, EGL_STENCIL_SIZE);
- if ((stencil != 0) && (stencil != stencil_bits)) {
- SET_CONFIG_ATTRIB(c, EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG);
- }
- }
-
- for (i = 0, c = configs; i < num_configs; i++, c++)
- _eglAddConfig(disp, c);
-
- free(configs);
-
- return EGL_TRUE;
-}
-
-static EGLBoolean
-fbSetupFramebuffer(fbDisplay *disp, char *fbdev)
-{
- int fd;
- char dev[20];
- struct fb_var_screeninfo varInfo;
- struct fb_fix_screeninfo fixedInfo;
-
- snprintf(dev, sizeof(dev), "/dev/%s", fbdev);
-
- /* open the framebuffer device */
- fd = open(dev, O_RDWR);
- if (fd < 0) {
- fprintf(stderr, "Error opening %s: %s\n", fbdev, strerror(errno));
- return EGL_FALSE;
- }
-
- /* get the original variable screen info */
- if (ioctl(fd, FBIOGET_VSCREENINFO, &varInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
-
- /* Turn off hw accels (otherwise mmap of mmio region will be
- * refused)
- */
- if (varInfo.accel_flags) {
- varInfo.accel_flags = 0;
- if (ioctl(fd, FBIOPUT_VSCREENINFO, &varInfo)) {
- fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
- }
-
- /* Get the fixed screen info */
- if (ioctl(fd, FBIOGET_FSCREENINFO, &fixedInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
-
- if (fixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
- struct fb_cmap cmap;
- unsigned short red[256], green[256], blue[256];
- int rcols = 1 << varInfo.red.length;
- int gcols = 1 << varInfo.green.length;
- int bcols = 1 << varInfo.blue.length;
- int i;
-
- cmap.start = 0;
- cmap.len = gcols;
- cmap.red = red;
- cmap.green = green;
- cmap.blue = blue;
- cmap.transp = NULL;
-
- for (i = 0; i < rcols ; i++)
- red[i] = (65536/(rcols-1)) * i;
-
- for (i = 0; i < gcols ; i++)
- green[i] = (65536/(gcols-1)) * i;
-
- for (i = 0; i < bcols ; i++)
- blue[i] = (65536/(bcols-1)) * i;
-
- if (ioctl(fd, FBIOPUTCMAP, (void *) &cmap) < 0) {
- fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
- exit(1);
- }
- }
-
- /* mmap the framebuffer into our address space */
- if (!disp->pFB)
- disp->pFB = (caddr_t)mmap(0, /* start */
- fixedInfo.smem_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- fd, /* fd */
- 0); /* offset */
- if (disp->pFB == (caddr_t)-1) {
- fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
-
-const char *sysfs = "/sys/class/graphics";
-
-static EGLBoolean
-fbInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- fbDisplay *display;
- fbScreen *s;
- _EGLScreen *scrn;
- char c;
- unsigned int x, y, r;
- DIR *dir;
- FILE *file;
- struct dirent *dirent;
- char path[NAME_MAX];
-
- /* Switch display structure to one with our private fields */
- display = calloc(1, sizeof(*display));
- display->Base = *disp;
- _eglHashInsert(_eglGlobal.Displays, disp->Handle, display);
- free(disp);
-
- *major = 1;
- *minor = 0;
-
- dir = opendir(sysfs);
- if (!dir) {
- printf("EGL - %s framebuffer device not found.", sysfs);
- return EGL_FALSE;
- }
-
- while ((dirent = readdir(dir))) { /* assignment! */
-
- if (dirent->d_name[0] != 'f')
- continue;
- if (dirent->d_name[1] != 'b')
- continue;
-
- if (fbSetupFramebuffer(display, dirent->d_name) == EGL_FALSE)
- continue;
-
- /* Create a screen */
- s = (fbScreen *) calloc(1, sizeof(fbScreen));
- if (!s)
- return EGL_FALSE;
-
- strncpy(s->fb, dirent->d_name, NAME_MAX);
- scrn = &s->Base;
- _eglInitScreen(scrn);
- _eglAddScreen(&display->Base, scrn);
-
- snprintf(path, sizeof(path), "%s/%s/modes", sysfs, s->fb);
- file = fopen(path, "r");
- while (fgets(path, sizeof(path), file)) {
- sscanf(path, "%c:%ux%u-%u", &c, &x, &y, &r);
- _eglAddMode(scrn, x, y, r * 1000, path);
- }
- fclose(file);
-
- fbFillInConfigs(&display->Base, 32, 24, 8, 1);
-
- }
- closedir(dir);
-
- drv->Initialized = EGL_TRUE;
- return EGL_TRUE;
-}
-
-
-static fbDisplay *
-Lookup_fbDisplay(EGLDisplay dpy)
-{
- _EGLDisplay *d = _eglLookupDisplay(dpy);
- return (fbDisplay *) d;
-}
-
-
-static fbScreen *
-Lookup_fbScreen(EGLDisplay dpy, EGLScreenMESA screen)
-{
- _EGLScreen *s = _eglLookupScreen(dpy, screen);
- return (fbScreen *) s;
-}
-
-
-static fbContext *
-Lookup_fbContext(EGLContext ctx)
-{
- _EGLContext *c = _eglLookupContext(ctx);
- return (fbContext *) c;
-}
-
-
-static fbSurface *
-Lookup_fbSurface(EGLSurface surf)
-{
- _EGLSurface *s = _eglLookupSurface(surf);
- return (fbSurface *) s;
-}
-
-
-static EGLBoolean
-fbTerminate(_EGLDriver *drv, EGLDisplay dpy)
-{
- fbDisplay *display = Lookup_fbDisplay(dpy);
- _eglCleanupDisplay(&display->Base);
- free(display);
- free(drv);
- return EGL_TRUE;
-}
-
-
-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 );
- _ac_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 )
-{
- *width = buffer->Width;
- *height = buffer->Height;
-}
-
-
-static void
-viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- _mesa_ResizeBuffersMESA();
-}
-
-
-static void
-init_core_functions( struct dd_function_table *functions )
-{
- functions->GetString = get_string;
- functions->UpdateState = update_state;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetBufferSize = get_buffer_size;
- functions->Viewport = viewport;
-
- functions->Clear = _swrast_Clear; /* could accelerate with blits */
-}
-
-
-static EGLContext
-fbCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
-{
- GLcontext *ctx;
- _EGLConfig *conf;
- fbContext *c;
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- struct dd_function_table functions;
- GLvisual vis;
- int i;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs defined for now */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
- }
-
- c = (fbContext *) calloc(1, sizeof(fbContext));
- if (!c)
- return EGL_NO_CONTEXT;
-
- _eglInitContext(&c->Base);
- c->Base.Display = disp;
- c->Base.Config = conf;
- c->Base.DrawSurface = EGL_NO_SURFACE;
- c->Base.ReadSurface = EGL_NO_SURFACE;
-
- /* generate handle and insert into hash table */
- _eglSaveContext(&c->Base);
- assert(c->Base.Handle);
-
- /* Init default driver functions then plug in our FBdev-specific functions
- */
- _mesa_init_driver_functions(&functions);
- init_core_functions(&functions);
-
- _eglConfigToContextModesRec(conf, &vis);
-
- ctx = c->glCtx = _mesa_create_context(&vis, NULL, &functions, (void *)c);
- if (!c->glCtx) {
- _mesa_free(c);
- return GL_FALSE;
- }
-
- /* Create module contexts */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _swsetup_Wakeup( ctx );
-
-
- /* swrast init -- need to verify these tests - I just plucked the
- * numbers out of the air. (KW)
- */
- {
- struct swrast_device_driver *swdd;
- swdd = _swrast_GetDeviceDriverReference( ctx );
- swdd->SetBuffer = fbSetBuffer;
- }
-
- /* use default TCL pipeline */
- {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- }
-
- _mesa_enable_sw_extensions(ctx);
-
- return c->Base.Handle;
-}
-
-
-static EGLSurface
-fbCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
-{
- int i;
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateWindowSurface");
- return EGL_NO_SURFACE;
- }
- }
- printf("eglCreateWindowSurface()\n");
- /* XXX unfinished */
-
- return EGL_NO_SURFACE;
-}
-
-
-static EGLSurface
-fbCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
-{
- _EGLConfig *conf;
- EGLint i;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
- }
-
- if (conf->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] == 0) {
- _eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
-
- printf("eglCreatePixmapSurface()\n");
- return EGL_NO_SURFACE;
-}
-
-
-static EGLSurface
-fbCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- fbSurface *surf;
-
- surf = (fbSurface *) calloc(1, sizeof(fbSurface));
- if (!surf) {
- return EGL_NO_SURFACE;
- }
-
- if (_eglInitPbufferSurface(&surf->Base, drv, dpy, config, attrib_list) == EGL_NO_SURFACE) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- /* create software-based pbuffer */
- {
- GLcontext *ctx = NULL; /* this _should_ be OK */
- GLvisual vis;
- _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
- assert(conf); /* bad config should be caught earlier */
- _eglConfigToContextModesRec(conf, &vis);
-
- surf->mesa_framebuffer = _mesa_create_framebuffer(&vis);
- _mesa_add_soft_renderbuffers(surf->mesa_framebuffer,
- GL_TRUE, /* color bufs */
- vis.haveDepthBuffer,
- vis.haveStencilBuffer,
- vis.haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */ );
-
- /* set pbuffer/framebuffer size */
- _mesa_resize_framebuffer(ctx, surf->mesa_framebuffer,
- surf->Base.Width, surf->Base.Height);
- }
-
- return surf->Base.Handle;
-}
-
-
-static EGLBoolean
-fbDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
-{
- fbSurface *fs = Lookup_fbSurface(surface);
- _eglRemoveSurface(&fs->Base);
- if (fs->Base.IsBound) {
- fs->Base.DeletePending = EGL_TRUE;
- }
- else {
- free(fs);
- }
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-fbDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
-{
- fbContext *fc = Lookup_fbContext(context);
- _eglRemoveContext(&fc->Base);
- if (fc->Base.IsBound) {
- fc->Base.DeletePending = EGL_TRUE;
- }
- else {
- free(fc);
- }
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-fbMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context)
-{
- fbSurface *readSurf = Lookup_fbSurface(read);
- fbSurface *drawSurf = Lookup_fbSurface(draw);
- fbContext *ctx = Lookup_fbContext(context);
- EGLBoolean b;
-
- b = _eglMakeCurrent(drv, dpy, draw, read, context);
- if (!b)
- return EGL_FALSE;
-
- if (ctx) {
- _mesa_make_current( ctx->glCtx,
- drawSurf->mesa_framebuffer,
- readSurf->mesa_framebuffer);
- } else
- _mesa_make_current( NULL, NULL, NULL );
-
- return EGL_TRUE;
-}
-
-
-/**
- * Create a drawing surface which can be directly displayed on a screen.
- */
-static EGLSurface
-fbCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
- const EGLint *attrib_list)
-{
- _EGLConfig *config = _eglLookupConfig(drv, dpy, cfg);
- fbDisplay *display = Lookup_fbDisplay(dpy);
- fbSurface *surface;
- EGLSurface surf;
- GLvisual vis;
- GLcontext *ctx = NULL; /* this should be OK */
- int origin, bytesPerPixel;
- int width, height, stride;
-
- surface = (fbSurface *) malloc(sizeof(*surface));
- if (!surface) {
- return EGL_NO_SURFACE;
- }
-
- /* init base class, error check, etc. */
- surf = _eglInitScreenSurface(&surface->Base, drv, dpy, cfg, attrib_list);
- if (surf == EGL_NO_SURFACE) {
- free(surface);
- return EGL_NO_SURFACE;
- }
-
- /* convert EGLConfig to GLvisual */
- _eglConfigToContextModesRec(config, &vis);
-
- /* create Mesa framebuffer */
- surface->mesa_framebuffer = _mesa_create_framebuffer(&vis);
- if (!surface->mesa_framebuffer) {
- free(surface);
- _eglRemoveSurface(&surface->Base);
- return EGL_NO_SURFACE;
- }
-
- width = surface->Base.Width;
- height = surface->Base.Height;
- bytesPerPixel = vis.rgbBits / 8;
- stride = width * bytesPerPixel;
- origin = 0;
-
- /* front color renderbuffer */
- {
- driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, bytesPerPixel,
- origin, stride);
- fbSetSpanFunctions(drb, &vis);
- drb->Base.Data = display->pFB;
- _mesa_add_renderbuffer(surface->mesa_framebuffer,
- BUFFER_FRONT_LEFT, &drb->Base);
- }
-
- /* back color renderbuffer */
- if (vis.doubleBufferMode) {
- driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, bytesPerPixel,
- origin, stride);
- fbSetSpanFunctions(drb, &vis);
- drb->Base.Data = _mesa_malloc(stride * height);
- _mesa_add_renderbuffer(surface->mesa_framebuffer,
- BUFFER_BACK_LEFT, &drb->Base);
- }
-
- /* other renderbuffers- software based */
- _mesa_add_soft_renderbuffers(surface->mesa_framebuffer,
- GL_FALSE, /* color */
- vis.haveDepthBuffer,
- vis.haveStencilBuffer,
- vis.haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
-
- _mesa_resize_framebuffer(ctx, surface->mesa_framebuffer, width, height);
-
- return surf;
-}
-
-
-/**
- * Show the given surface on the named screen.
- * If surface is EGL_NO_SURFACE, disable the screen's output.
- */
-static EGLBoolean
-fbShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA m)
-{
- fbDisplay *display = Lookup_fbDisplay(dpy);
- fbScreen *scrn = Lookup_fbScreen(dpy, screen);
- fbSurface *surf = Lookup_fbSurface(surface);
- FILE *file;
- char buffer[NAME_MAX];
- _EGLMode *mode = _eglLookupMode(dpy, m);
- int bits;
-
- if (!_eglShowSurfaceMESA(drv, dpy, screen, surface, m))
- return EGL_FALSE;
-
- snprintf(buffer, sizeof(buffer), "%s/%s/blank", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file) {
-err:
- printf("chown all fb sysfs attrib to allow write - %s\n", buffer);
- return EGL_FALSE;
- }
- snprintf(buffer, sizeof(buffer), "%d", (m == EGL_NO_MODE_MESA ? VESA_POWERDOWN : VESA_VSYNC_SUSPEND));
- fputs(buffer, file);
- fclose(file);
-
- if (m == EGL_NO_MODE_MESA)
- return EGL_TRUE;
-
- snprintf(buffer, sizeof(buffer), "%s/%s/mode", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file)
- goto err;
- fputs(mode->Name, file);
- fclose(file);
-
- snprintf(buffer, sizeof(buffer), "%s/%s/bits_per_pixel", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file)
- goto err;
- bits = GET_CONFIG_ATTRIB(surf->Base.Config, EGL_BUFFER_SIZE);
- snprintf(buffer, sizeof(buffer), "%d", bits);
- fputs(buffer, file);
- fclose(file);
-
- fbSetupFramebuffer(display, scrn->fb);
-
- snprintf(buffer, sizeof(buffer), "%s/%s/blank", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file)
- goto err;
-
- snprintf(buffer, sizeof(buffer), "%d", VESA_NO_BLANKING);
- fputs(buffer, file);
- fclose(file);
-
- return EGL_TRUE;
-}
-
-
-/* If the backbuffer is on a videocard, this is extraordinarily slow!
- */
-static EGLBoolean
-fbSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
-{
- fbContext *context = (fbContext *)_eglGetCurrentContext();
- fbSurface *fs = Lookup_fbSurface(draw);
- struct gl_renderbuffer * front_renderbuffer = fs->mesa_framebuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
- void *frontBuffer = front_renderbuffer->Data;
- int currentPitch = ((driRenderbuffer *)front_renderbuffer)->pitch;
- void *backBuffer = fs->mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data;
-
- if (!_eglSwapBuffers(drv, dpy, draw))
- return EGL_FALSE;
-
- if (context) {
- GLcontext *ctx = context->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 < fs->Base.Height; 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");
- return EGL_FALSE;
- }
- return EGL_TRUE;
-}
-
-
-/**
- * The bootstrap function. Return a new fbDriver object and
- * plug in API functions.
- */
-_EGLDriver *
-_eglMain(_EGLDisplay *dpy)
-{
- fbDriver *fb;
-
- fb = (fbDriver *) calloc(1, sizeof(fbDriver));
- if (!fb) {
- return NULL;
- }
-
- /* First fill in the dispatch table with defaults */
- _eglInitDriverFallbacks(&fb->Base);
-
- /* then plug in our fb-specific functions */
- fb->Base.Initialize = fbInitialize;
- fb->Base.Terminate = fbTerminate;
- fb->Base.CreateContext = fbCreateContext;
- fb->Base.MakeCurrent = fbMakeCurrent;
- fb->Base.CreateWindowSurface = fbCreateWindowSurface;
- fb->Base.CreatePixmapSurface = fbCreatePixmapSurface;
- fb->Base.CreatePbufferSurface = fbCreatePbufferSurface;
- fb->Base.DestroySurface = fbDestroySurface;
- fb->Base.DestroyContext = fbDestroyContext;
- fb->Base.CreateScreenSurfaceMESA = fbCreateScreenSurfaceMESA;
- fb->Base.ShowSurfaceMESA = fbShowSurfaceMESA;
- fb->Base.SwapBuffers = fbSwapBuffers;
-
- /* enable supported extensions */
- fb->Base.MESA_screen_surface = EGL_TRUE;
- fb->Base.MESA_copy_context = EGL_TRUE;
-
- return &fb->Base;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/Makefile
deleted file mode 100644
index cb73238c0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/Makefile
+++ /dev/null
@@ -1,36 +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
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.c
deleted file mode 100644
index 7263e8381..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.c,v 1.1 2002/02/22 21:32:58 dawes Exp $
- *
- * 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 "image.h"
-#include "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;
- __DRIdrawablePrivate *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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.h
deleted file mode 100644
index 4f8d2ea2a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_bitmap.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_bitmap.h,v 1.1 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_BITMAP_H
-#define _FFB_BITMAP_H
-
-extern void ffbDDInitBitmapFuncs(GLcontext *);
-
-#endif /* !(_FFB_BITMAP_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.c
deleted file mode 100644
index c63179149..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_clear.c,v 1.2 2002/02/22 21:32:58 dawes Exp $
- *
- * 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 "mtypes.h"
-#include "extensions.h"
-
-#include "mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_tris.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(ffbContextPtr fmesa, __DRIdrawablePrivate *dPriv,
- GLboolean all, GLint cx, GLint cy, GLint cwidth,
- GLint cheight)
-{
- FFBDRIPtr gDRIPriv = (FFBDRIPtr) fmesa->driScreen->pDevPriv;
- ffb_fbcPtr ffb = fmesa->regs;
- drm_clip_rect_t *box = dPriv->pClipRects;
- int nc = dPriv->numClipRects;
-
- cy = dPriv->h - cy - cheight;
- 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 (!all) {
- if (x < cx) {
- width -= cx - x;
- x = cx;
- }
- if (y < cy) {
- height -= cy - y;
- y = cy;
- }
- if (x + width > cx + cwidth)
- width = cx + cwidth - x;
- if (y + height > cy + cheight)
- height = cy + cheight - y;
- if (width <= 0)
- continue;
- if (height <= 0)
- continue;
- }
-
- 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, GLboolean all,
- GLint cx, GLint cy, GLint cwidth, GLint cheight)
-{
- ffbContextPtr fmesa = FFB_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- unsigned int stcmask = BUFFER_BIT_STENCIL;
-
-#ifdef CLEAR_TRACE
- fprintf(stderr, "ffbDDClear: mask(%08x) all(%d) "
- "[x(%x)y(%x)w(%x)h(%x)]\n",
- mask, (int) all, cx, cy, cwidth, cheight);
-#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(fmesa, dPriv, all, cx, cy, cwidth, cheight);
-
- 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, all, cx, cy, cwidth, cheight);
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.h
deleted file mode 100644
index 4b707f19b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_clear.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_clear.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_CLEAR_H
-#define _FFB_CLEAR_H
-
-extern void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cwidth, GLint cheight);
-
-#endif /* !(_FFB_CLEAR_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_context.h
deleted file mode 100644
index 33f6f7cff..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_context.h
+++ /dev/null
@@ -1,306 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_context.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#ifndef _FFB_CONTEXT_H
-#define _FFB_CONTEXT_H
-
-#include "dri_util.h"
-#include "drm.h"
-
-#include "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;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *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 int, 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) ((GLdepth)(((VAL) & 0x0fffffff) << (32 - 28)))
-#define Z_FROM_MESA(VAL) (((GLuint)((GLdouble)(VAL))) >> (32 - 28))
-
-#endif /* !(_FFB_CONTEXT_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.c
deleted file mode 100644
index 53423bbae..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c,v 1.4 2002/09/11 19:49:07 tsi Exp $
- *
- * 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 "mtypes.h"
-#include "mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
-#include "ffb_clear.h"
-#include "ffb_lock.h"
-#include "extensions.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.h
deleted file mode 100644
index 4ffcbe666..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_dd.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_dd.h,v 1.1 2000/06/20 05:08:38 dawes Exp $
- *
- * 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 "context.h"
-
-void ffbDDInitDriverFuncs(GLcontext *ctx);
-void ffbDDExtensionsInit(GLcontext *ctx);
-
-#endif /* !(_FFB_DD_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.c
deleted file mode 100644
index 68a2450eb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_depth.c,v 1.2 2002/02/22 21:32:58 dawes Exp $
- *
- * 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 "mtypes.h"
-#include "swrast/swrast.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_depth.h"
-#include "ffb_lock.h"
-
-#include "swrast/swrast.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);
- __DRIdrawablePrivate *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);
- __DRIdrawablePrivate *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);
- __DRIdrawablePrivate *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);
- __DRIdrawablePrivate *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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.h
deleted file mode 100644
index db908e7a6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_depth.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_depth.h,v 1.1 2000/06/20 05:08:38 dawes Exp $ */
-
-#ifndef _FFB_DEPTH_H
-#define _FFB_DEPTH_H
-
-void ffbSetDepthFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-#endif /* !(_FFB_DEPTH_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_fifo.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_fifo.h
deleted file mode 100644
index 886d71b76..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_fifo.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_fifo.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_fog.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_fog.c
deleted file mode 100644
index e6eca2390..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.c
deleted file mode 100644
index da1de18f3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_lines.c,v 1.2 2002/02/22 21:32:58 dawes Exp $
- *
- * 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 "mtypes.h"
-#include "mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_lines.h"
-#include "ffb_tris.h"
-#include "ffb_lock.h"
-#include "extensions.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.h
deleted file mode 100644
index d508c243e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lines.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_lines.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_linetmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_linetmp.h
deleted file mode 100644
index 0951513ca..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_linetmp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
-
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h
deleted file mode 100644
index 7c49f740f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_lock.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_lock.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.c
deleted file mode 100644
index a7496dd1d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_points.c,v 1.2 2002/02/22 21:32:59 dawes Exp $
- *
- * 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 "mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_points.h"
-#include "ffb_tris.h"
-#include "ffb_lock.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.h
deleted file mode 100644
index 7d5c1f8a0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_points.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_points.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_pointtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_pointtmp.h
deleted file mode 100644
index 310c95d89..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_pointtmp.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.3 2002/02/22 21:32:59 dawes Exp $ */
-
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_rendertmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_rendertmp.h
deleted file mode 100644
index 26d991b08..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_rendertmp.h
+++ /dev/null
@@ -1,646 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_rendertmp.h,v 1.2 2003/01/29 23:00:40 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.c
deleted file mode 100644
index f4698c64e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_span.c,v 1.2 2002/02/22 21:32:59 dawes Exp $
- *
- * 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 "mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_lock.h"
-
-#include "swrast/swrast.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 \
- __DRIdrawablePrivate *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)
-
-#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);
- drb->Base.GetRow = ffbReadRGBASpan_888;
- drb->Base.GetValues = ffbReadRGBAPixels_888;
- drb->Base.PutRow = ffbWriteRGBASpan_888;
- drb->Base.PutRowRGB = ffbWriteRGBSpan_888;
- drb->Base.PutMonoRow = ffbWriteMonoRGBASpan_888;
- drb->Base.PutValues = ffbWriteRGBAPixels_888;
- drb->Base.PutMonoValues = ffbWriteMonoRGBAPixels_888;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.h
deleted file mode 100644
index 5ae227910..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_span.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_span.h,v 1.1 2000/06/20 05:08:39 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.c
deleted file mode 100644
index 86df5b4bc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.c
+++ /dev/null
@@ -1,1223 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_state.c,v 1.5 2002/10/30 12:51:27 alanh Exp $
- *
- * 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 "mtypes.h"
-#include "buffers.h"
-#include "colormac.h"
-#include "mm.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_depth.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
-#include "ffb_state.h"
-#include "ffb_lock.h"
-#include "extensions.h"
-#include "enums.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.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 ffbDDStencilFunc(GLcontext *ctx, 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 ffbDDStencilMask(GLcontext *ctx, 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 ffbDDStencilOp(GLcontext *ctx, 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);
- __DRIdrawablePrivate *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;
- __DRIdrawablePrivate *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)
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- 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)
- */
-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);
- }
-}
-
-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)
-{
- __DRIdrawablePrivate *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) {
- ffbDDStencilFunc(ctx,
- ctx->Stencil.Function[0],
- ctx->Stencil.Ref[0],
- ctx->Stencil.ValueMask[0]);
- ffbDDStencilMask(ctx, ctx->Stencil.WriteMask[0]);
- ffbDDStencilOp(ctx,
- 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 );
- _ac_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.StencilFunc = ffbDDStencilFunc;
- ctx->Driver.StencilMask = ffbDDStencilMask;
- ctx->Driver.StencilOp = ffbDDStencilOp;
- }
-
- 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;
- */
-
- {
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ctx);
- swdd->SetBuffer = ffbDDSetBuffer;
- }
-
-
-}
-
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.h
deleted file mode 100644
index 17b6fa20a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_state.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_state.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.c
deleted file mode 100644
index 2f13ee921..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.c,v 1.2 2002/02/22 21:32:59 dawes Exp $
- *
- * 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 "mtypes.h"
-#include "ffb_dd.h"
-#include "ffb_span.h"
-#include "ffb_context.h"
-#include "ffb_stencil.h"
-#include "ffb_lock.h"
-
-#include "swrast/swrast.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);
- __DRIdrawablePrivate *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);
- __DRIdrawablePrivate *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);
- __DRIdrawablePrivate *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);
- __DRIdrawablePrivate *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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.h
deleted file mode 100644
index c7da1ca68..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_stencil.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_stencil.h,v 1.1 2000/06/20 05:08:39 dawes Exp $ */
-
-#ifndef _FFB_STENCIL_H
-#define _FFB_STENCIL_H
-
-void ffbSetStencilFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-#endif /* !(_FFB_STENCIL_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.c
deleted file mode 100644
index d6763b7cd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tex.c,v 1.1 2002/02/22 21:32:59 dawes Exp $
- *
- * 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 "glheader.h"
-#include "mtypes.h"
-#include "ffb_tex.h"
-
-/* No texture unit, all software. */
-/* XXX this function isn't needed since _mesa_init_driver_functions()
- * will make all these assignments.
- */
-void ffbDDInitTexFuncs(GLcontext *ctx)
-{
- /*
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
- */
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.h
deleted file mode 100644
index dba0e08af..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tex.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tex.h,v 1.1 2002/02/22 21:32:59 dawes Exp $
- *
- * 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.c
deleted file mode 100644
index ca0e514dc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.c
+++ /dev/null
@@ -1,945 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tris.c,v 1.3 2002/10/30 12:51:28 alanh Exp $
- *
- * 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 "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/s_context.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->win[0] = sx * src->x + tx;
- dst->win[1] = sy * src->y + ty;
- dst->win[2] = sz * src->z + tz;
- dst->win[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); \
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable; \
- ffb_color color[n]; \
- (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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.h
deleted file mode 100644
index a803174b3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tris.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tris.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tritmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tritmp.h
deleted file mode 100644
index 612ef2433..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_tritmp.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_tritmp.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.c
deleted file mode 100644
index 6ba1eabbf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vb.c,v 1.4 2002/02/22 21:32:59 dawes Exp $
- *
- * 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 "imports.h"
-#include "tnl/t_context.h"
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.h
deleted file mode 100644
index 9eb6759f6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vb.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vb.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_VB_H
-#define _FFB_VB_H
-
-#include "mtypes.h"
-#include "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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vbtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vbtmp.h
deleted file mode 100644
index a1d1254d9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vbtmp.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h,v 1.1 2002/02/22 21:32:59 dawes Exp $ */
-
-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->ColorPtr[0]->data;
- col0_stride = VB->ColorPtr[0]->stride;
-#if (IND & (FFB_VB_TWOSIDE_BIT))
- col1 = VB->ColorPtr[1]->data;
- col1_stride = VB->ColorPtr[1]->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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c
deleted file mode 100644
index d6a61d98e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.c,v 1.1 2002/02/22 21:32:59 dawes Exp $
- *
- * 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 "glheader.h"
-#include "api_noop.h"
-#include "context.h"
-#include "light.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "vtxfmt.h"
-#include "ffb_xmesa.h"
-#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "ffb_vtxfmt.h"
-
-#ifndef __GNUC__
-#define __inline /**/
-#endif
-
-#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();
-
- MEMSET(vfmt, 0, sizeof(GLvertexformat));
-
- /* 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->Rectf = _mesa_noop_Rectf; /* generic helper */
-
- vfmt->DrawArrays = NULL;
- vfmt->DrawElements = NULL;
- vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; /* discard range */
-
-
- /* Not active in supported states; just keep ctx->Current uptodate: */
- vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexi = _mesa_noop_Indexi;
- vfmt->Indexiv = _mesa_noop_Indexiv;
-
- /* 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.h
deleted file mode 100644
index 063bb4923..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_vtxfmt.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vtxfmt.h,v 1.1 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_VTXFMT_H
-#define _FFB_VTXFMT_H
-
-extern void ffbInitTnlModule(GLcontext *);
-
-#endif /* !(_FFB_VTXFMT_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.c
deleted file mode 100644
index 530c5373a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c,v 1.4 2002/02/22 21:32:59 dawes Exp $
- *
- * 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 "context.h"
-#include "framebuffer.h"
-#include "matrix.h"
-#include "renderbuffer.h"
-#include "simple_list.h"
-#include "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 "array_cache/acache.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_tex.h"
-#include "ffb_lock.h"
-#include "ffb_vtxfmt.h"
-#include "ffb_bitmap.h"
-
-#include "drm_sarea.h"
-
-static GLboolean
-ffbInitDriver(__DRIscreenPrivate *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(__DRIscreenPrivate *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,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- ffbContextPtr fmesa;
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *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 hw 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;
-
- /* 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 );
- _ac_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(__DRIcontextPrivate *driContextPriv)
-{
- ffbContextPtr fmesa = (ffbContextPtr) driContextPriv->driverPrivate;
-
- if (fmesa) {
- ffbFreeVB(fmesa->glCtx);
-
- _swsetup_DestroyContext( fmesa->glCtx );
- _tnl_DestroyContext( fmesa->glCtx );
- _ac_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(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *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);
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0);
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, bpp, offset, bogusPitch);
- ffbSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, bpp, offset, bogusPitch);
- ffbSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, bpp, offset, bogusPitch);
- ffbSetDepthFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, bpp, offset,bogusPitch);
- 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;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-#define USE_FAST_SWAP
-
-static void
-ffbSwapBuffers( __DRIdrawablePrivate *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(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *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),
- 1, 0, 0, 0, 0);
- }
- } else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer */
-static GLboolean
-ffbUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-void ffbXMesaUpdateState(ffbContextPtr fmesa)
-{
- __DRIdrawablePrivate *dPriv = fmesa->driDrawable;
- __DRIscreenPrivate *sPriv = fmesa->driScreen;
- int stamp = dPriv->lastStamp;
-
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
- if (dPriv->lastStamp != stamp) {
- GLcontext *ctx = fmesa->glCtx;
-
- ffbCalcViewport(ctx);
- if (ctx->Polygon.StippleFlag)
- ffbXformAreaPattern(fmesa,
- (const GLubyte *)ctx->PolygonStipple);
- }
-}
-
-static const struct __DriverAPIRec ffbAPI = {
- .InitDriver = ffbInitDriver,
- .DestroyScreen = ffbDestroyScreen,
- .CreateContext = ffbCreateContext,
- .DestroyContext = ffbDestroyContext,
- .CreateBuffer = ffbCreateBuffer,
- .DestroyBuffer = ffbDestroyBuffer,
- .SwapBuffers = ffbSwapBuffers,
- .MakeCurrent = ffbMakeCurrent,
- .UnbindContext = ffbUnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *
-ffbFillInModes( 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;
-
- /* 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
- };
-
- u_int8_t depth_bits_array[3];
- u_int8_t stencil_bits_array[3];
-
-
- 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;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
- back_buffer_factor = (have_back_buffer) ? 3 : 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_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *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 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "ffb",
- 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, &ffbAPI);
- if ( psp != NULL ) {
- *driver_modes = ffbFillInModes( 32, 16, 0, GL_TRUE );
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.h
deleted file mode 100644
index b7580780a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/ffb_xmesa.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.h,v 1.2 2002/02/22 21:32:59 dawes Exp $ */
-
-#ifndef _FFB_XMESA_H_
-#define _FFB_XMESA_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "mtypes.h"
-#include "ffb_drishare.h"
-#include "ffb_regs.h"
-#include "ffb_dac.h"
-#include "ffb_fifo.h"
-
-typedef struct {
- __DRIscreenPrivate *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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_dac.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_dac.h
deleted file mode 100644
index 08114282e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_dac.h
+++ /dev/null
@@ -1,367 +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.
- *
- */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h,v 1.2 2001/04/05 17:42:33 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_drishare.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_drishare.h
deleted file mode 100644
index baf2f0d0a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_drishare.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_drishare.h,v 1.2 2000/06/21 00:47:37 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_regs.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_regs.h
deleted file mode 100644
index 7f383d38d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/ffb/server/ffb_regs.h
+++ /dev/null
@@ -1,509 +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.
- *
- */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_regs.h,v 1.1 2000/05/18 23:21:37 dawes Exp $ */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/Makefile
deleted file mode 100644
index 250d3ac08..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/Makefile
+++ /dev/null
@@ -1,35 +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
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_client.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_client.h
deleted file mode 100644
index 1c1a22ebc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_client.h
+++ /dev/null
@@ -1,6185 +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.
- *
- * $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_client.h,v 1.3 2002/02/22 21:33:00 dawes Exp $
- *
- */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.c
deleted file mode 100644
index ffaf45459..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.c
+++ /dev/null
@@ -1,226 +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 "gamma_context.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-#include "simple_list.h"
-#include "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,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *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;
-
- 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 );
- _ac_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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.h
deleted file mode 100644
index 7745f4c3c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_context.h
+++ /dev/null
@@ -1,403 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_context.h,v 1.6 2002/12/16 16:18:50 dawes Exp $ */
-/*
- * 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_macros.h"
-#include "gamma_screen.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "glint_dri.h"
-#include "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(__DRIscreenPrivate *sPriv);
-extern void gammaDestroyScreen(__DRIscreenPrivate *sPriv);
-extern GLboolean gammaCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *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;
-
- PMemBlock 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];
-
- u_int32_t TextureBaseAddr[GAMMA_TEX_MAXLEVELS];
- u_int32_t TextureAddressMode;
- u_int32_t TextureColorMode;
- u_int32_t TextureFilterMode;
- u_int32_t TextureFormat;
- u_int32_t TextureReadMode;
- u_int32_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 */
-
- __DRIcontextPrivate *driContext;
- __DRIscreenPrivate *driScreen;
- __DRIdrawablePrivate *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];
-
- memHeap_t *texHeap;
-
- unsigned int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- unsigned int lastStamp;
-
-
- u_int32_t ClearColor;
- u_int32_t Color;
- u_int32_t DitherMode;
- u_int32_t ClearDepth;
- u_int32_t FogMode;
- u_int32_t AreaStippleMode;
- u_int32_t LBReadFormat;
- u_int32_t LBWriteFormat;
- u_int32_t LineMode;
- u_int32_t PointMode;
- u_int32_t TriangleMode;
- u_int32_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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_dd.c
deleted file mode 100644
index cca382d89..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_dd.c
+++ /dev/null
@@ -1,128 +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 "gamma_context.h"
-#include "gamma_vb.h"
-#include "gamma_lock.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-#include "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.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = gammaDDGetString;
-
- ctx->Driver.Error = NULL;
-
- /* Pixel path fallbacks
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_inithw.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_inithw.c
deleted file mode 100644
index 47eb802b4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_inithw.c
+++ /dev/null
@@ -1,551 +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>
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_inithw.c,v 1.9 2002/10/30 12:51:29 alanh Exp $ */
-
-#include "gamma_context.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_lock.c
deleted file mode 100644
index 4c0970f09..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_lock.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_lock.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
-
-#include "gamma_context.h"
-#include "gamma_lock.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 )
-{
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable;
- __DRIscreenPrivate *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 ) {
- 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_lock.h
deleted file mode 100644
index 2d117320d..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_macros.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_macros.h
deleted file mode 100644
index 974fe569d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_macros.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_macros.h,v 1.5 2002/02/22 21:33:02 dawes Exp $ */
-/**************************************************************************
-
-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 { \
- /*__DRIscreenPrivate *psp = gcp->driScreen;*/ \
- __DRIdrawablePrivate *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 { \
- __DRIscreenPrivate *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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_regs.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_regs.h
deleted file mode 100644
index 2edda0722..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_regs.h
+++ /dev/null
@@ -1,659 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_regs.h,v 1.5 2002/02/22 21:33:02 dawes Exp $ */
-/**************************************************************************
-
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_render.c
deleted file mode 100644
index 4b462f225..000000000
--- a/nx-X11/extras/Mesa/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 "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "gamma_context.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->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- tc0_stride = VB->TexCoordPtr[0]->stride;
- tc0 = VB->TexCoordPtr[0]->data;
- tc0_size = VB->TexCoordPtr[0]->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, *(u_int32_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, *(u_int32_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, *(u_int32_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 = VB->Primitive[i].mode;
- 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_screen.c
deleted file mode 100644
index 0b91d059e..000000000
--- a/nx-X11/extras/Mesa/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 "gamma_context.h"
-#include "gamma_vb.h"
-#include "glint_dri.h"
-
-#include "imports.h"
-
-gammaScreenPtr gammaCreateScreen( __DRIscreenPrivate *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( __DRIscreenPrivate *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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_screen.h
deleted file mode 100644
index 7f0ed6f80..000000000
--- a/nx-X11/extras/Mesa/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 */
-
- __DRIscreenPrivate *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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_span.c
deleted file mode 100644
index 66cc961c6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_span.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_span.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
-
-#include "gamma_context.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; \
- __DRIscreenPrivate *sPriv = gmesa->driScreen; \
- __DRIdrawablePrivate *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)); \
- char *read_buf = (char *)(sPriv->pFB + \
- gmesa->readOffset + \
- (dPriv->x * gammascrn->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-/* FIXME! Depth/Stencil read/writes don't work ! */
-#define LOCAL_DEPTH_VARS \
- gammaScreenPtr gammascrn = gmesa->gammaScreen; \
- __DRIdrawablePrivate *dPriv = gmesa->driDrawable; \
- __DRIscreenPrivate *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 *)(read_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 *)(read_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 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 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 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;
- u_int32_t dwords1, dwords2, i = 0;
- char *src = (char *)rgba[0];
- GLuint read = n * gammascrn->cpp; /* Number of bytes we are expecting */
- u_int32_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 u_int32_t*)(void *)(((u_int8_t*)gammascrn->regions[0].map) + (GlintOutFIFOWords));
- dwords2 = *(volatile u_int32_t*)(void *)(((u_int8_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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_state.c
deleted file mode 100644
index 194313dc9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_state.c
+++ /dev/null
@@ -1,1730 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_state.c,v 1.5 2002/11/05 17:46:07 tsi Exp $ */
-/*
- * 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 "gamma_context.h"
-#include "gamma_macros.h"
-#include "buffers.h"
-#include "macros.h"
-#include "glint_dri.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-
-#define ENABLELIGHTING 0
-
-/* =============================================================
- * Alpha blending
- */
-
-static void gammaUpdateAlphaMode( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- u_int32_t a = gmesa->AlphaTestMode;
- u_int32_t b = gmesa->AlphaBlendMode;
- u_int32_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, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- 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, all, cx, cy, cw, ch );
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void gammaUpdateZMode( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- u_int32_t z = gmesa->DepthMode;
- u_int32_t delta = gmesa->DeltaMode;
- u_int32_t window = gmesa->Window;
- u_int32_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);
- u_int32_t f = gmesa->FogMode;
- u_int32_t g = gmesa->GeometryMode;
- u_int32_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);
- u_int32_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);
- u_int32_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[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[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);
- u_int32_t g = gmesa->GeometryMode;
- u_int32_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);
- __DRIdrawablePrivate *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 )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- gammaUpdateWindow( ctx );
-}
-
-static void gammaDDDepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- gammaUpdateWindow( ctx );
-}
-
-void gammaUpdateViewportOffset( GLcontext *ctx )
-{
- gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
- __DRIdrawablePrivate *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 {
- u_int32_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 {
- u_int32_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 {
- u_int32_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 );
- _ac_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.ClearStencil = NULL;
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
- ctx->Driver.Viewport = gammaDDViewport;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tex.c
deleted file mode 100644
index d4fc93f86..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tex.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_tex.c,v 1.4 2002/11/05 17:46:07 tsi Exp $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "texformat.h"
-#include "texobj.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-#include "gamma_context.h"
-#include "colormac.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)
-{
- u_int32_t t1 = t->TextureAddressMode;
- u_int32_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)
-{
- u_int32_t t1 = t->TextureAddressMode;
- u_int32_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,
- GLubyte color[4])
-{
- t->TextureBorderColor = PACK_COLOR_8888(color[0], color[1], color[2], color[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->_BorderChan );
- 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->_BorderChan );
- }
-}
-
-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].Current1D;
- gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[0].Current2D;
- gammaBindTexture( ctx, GL_TEXTURE_2D, texObj );
-
-#if 0
- ctx->Texture.CurrentUnit = 1;
-
- texObj = ctx->Texture.Unit[1].Current1D;
- gammaBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[1].Current2D;
- 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texmem.c
deleted file mode 100644
index 506b5c4c8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texmem.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_texmem.c,v 1.5 2002/11/05 17:46:07 tsi Exp $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "colormac.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-#include "glint_dri.h"
-#include "gamma_context.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texstate.c
deleted file mode 100644
index a8d1b253c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_texstate.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_texstate.c,v 1.5 2002/11/05 17:46:07 tsi Exp $ */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-#include "gamma_context.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tris.c
deleted file mode 100644
index 83bf56a14..000000000
--- a/nx-X11/extras/Mesa/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 "gamma_context.h"
-#include "gamma_vb.h"
-#include "gamma_tris.h"
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.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"
-
-
-/***********************************************************************
- * 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tris.h
deleted file mode 100644
index 02bec2869..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tritmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tritmp.h
deleted file mode 100644
index 23459ff15..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tritmp.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* $XFree86: xc/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_tritmp.h,v 1.2 2004/12/13 22:40:49 tsi Exp $ */
-
-static void TAG(gamma_point)( gammaContextPtr gmesa,
- const gammaVertex *v0 )
-{
- u_int32_t vColor;
- u_int32_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 )
-{
- u_int32_t vColor;
- u_int32_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 )
-{
- u_int32_t vColor;
- u_int32_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 )
-{
- u_int32_t vColor;
- u_int32_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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_vb.c
deleted file mode 100644
index 80d35cba9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_vb.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_vb.c,v 1.4 2003/03/26 20:43:48 tsi Exp $ */
-/*
- * 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 "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/tnl.h"
-
-#include "gamma_context.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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_vb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_vb.h
deleted file mode 100644
index feda25c4c..000000000
--- a/nx-X11/extras/Mesa/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 "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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_xmesa.c
deleted file mode 100644
index 00f6aa32a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/gamma_xmesa.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c,v 1.14 2002/10/30 12:51:30 alanh Exp $ */
-/*
- * 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 "gamma_context.h"
-#include "gamma_vb.h"
-#include "context.h"
-#include "matrix.h"
-#include "glint_dri.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-static GLboolean
-gammaInitDriver(__DRIscreenPrivate *sPriv)
-{
- sPriv->private = (void *) gammaCreateScreen( sPriv );
-
- if (!sPriv->private) {
- gammaDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void
-gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- gammaContextPtr gmesa = (gammaContextPtr)driContextPriv->driverPrivate;
-
- if (gmesa) {
- _swsetup_DestroyContext( gmesa->glCtx );
- _tnl_DestroyContext( gmesa->glCtx );
- _ac_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( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *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(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static void
-gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- gammaContextPtr gmesa;
- __DRIscreenPrivate *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;
- __DRIscreenPrivate *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(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *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( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec gammaAPI = {
- 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 __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &gammaAPI);
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_common.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_common.h
deleted file mode 100644
index ec601f942..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_common.h
+++ /dev/null
@@ -1,64 +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>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_common.h,v 1.2 2003/04/03 16:52:18 dawes Exp $
- *
- */
-
-#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/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_dri.h
deleted file mode 100644
index 3952759f8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/gamma/server/glint_dri.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.7 2002/10/30 12:52:16 alanh Exp $ */
-/**************************************************************************
-
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/Makefile
deleted file mode 100644
index a7825b49b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# src/mesa/drivers/dri/i810/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = i810_dri.so
-
-# Not yet
-# MINIGLX_SOURCES = server/i810_dri.c
-
-DRIVER_SOURCES = \
- i810context.c \
- i810ioctl.c \
- i810render.c \
- i810screen.c \
- i810span.c \
- i810state.c \
- i810tex.c \
- i810texmem.c \
- i810texstate.c \
- i810tris.c \
- i810vb.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810_3d_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810_3d_reg.h
deleted file mode 100644
index dade1a826..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810_3d_reg.h
+++ /dev/null
@@ -1,636 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_3d_reg.h,v 1.7 2002/02/22 21:33:03 dawes Exp $ */
-
-#ifndef I810_3D_REG_H
-#define I810_3D_REG_H
-
-#include "i810_reg.h"
-
-/* Registers not used in the X server
- */
-
-#define I810_NOP_ID 0x2094
-#define I810_NOP_ID_MASK ((1<<22)-1)
-
-
-/* 3D instructions
- */
-
-
-/* GFXRENDERSTATE_PV_PIXELIZATION_RULE, p149
- *
- * Format:
- * 0: GFX_OP_PV_RULE | PV_*
- *
- */
-#define GFX_OP_PV_RULE ((0x3<<29)|(0x7<<24))
-#define PV_SMALL_TRI_FILTER_ENABLE (0x1<<11)
-#define PV_UPDATE_PIXRULE (0x1<<10)
-#define PV_PIXRULE_ENABLE (0x1<<9)
-#define PV_UPDATE_LINELIST (0x1<<8)
-#define PV_LINELIST_MASK (0x3<<6)
-#define PV_LINELIST_PV0 (0x0<<6)
-#define PV_LINELIST_PV1 (0x1<<6)
-#define PV_UPDATE_TRIFAN (0x1<<5)
-#define PV_TRIFAN_MASK (0x3<<3)
-#define PV_TRIFAN_PV0 (0x0<<3)
-#define PV_TRIFAN_PV1 (0x1<<3)
-#define PV_TRIFAN_PV2 (0x2<<3)
-#define PV_UPDATE_TRISTRIP (0x1<<2)
-#define PV_TRISTRIP_MASK (0x3<<0)
-#define PV_TRISTRIP_PV0 (0x0<<0)
-#define PV_TRISTRIP_PV1 (0x1<<0)
-#define PV_TRISTRIP_PV2 (0x2<<0)
-
-
-/* GFXRENDERSTATE_SCISSOR_ENABLE, p146
- *
- * Format:
- * 0: GFX_OP_SCISSOR | SC_*
- */
-#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
-#define SC_UPDATE_SCISSOR (0x1<<1)
-#define SC_ENABLE_MASK (0x1<<0)
-#define SC_ENABLE (0x1<<0)
-
-/* GFXRENDERSTATE_SCISSOR_INFO, p147
- *
- * Format:
- * 0: GFX_OP_SCISSOR_INFO
- * 1: SCI_MIN_*
- * 2: SCI_MAX_*
- */
-#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
-#define SCI_YMIN_MASK (0xffff<<16)
-#define SCI_XMIN_MASK (0xffff<<0)
-#define SCI_YMAX_MASK (0xffff<<16)
-#define SCI_XMAX_MASK (0xffff<<0)
-
-/* GFXRENDERSTATE_DRAWING_RECT_INFO, p144
- *
- * Format:
- * 0: GFX_OP_DRAWRECT_INFO
- * 1: DR1_*
- * 2: DR2_*
- * 3: DR3_*
- * 4: DR4_*
- */
-#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
-#define DR1_RECT_CLIP_ENABLE (0x0<<31)
-#define DR1_RECT_CLIP_DISABLE (0x1<<31)
-#define DR1_X_DITHER_BIAS_MASK (0x3<<26)
-#define DR1_X_DITHER_BIAS_SHIFT 26
-#define DR1_Y_DITHER_BIAS_MASK (0x3<<24)
-#define DR1_Y_DITHER_BIAS_SHIFT 24
-#define DR2_YMIN_MASK (0xffff<<16)
-#define DR2_XMIN_MASK (0xffff<<0)
-#define DR3_YMAX_MASK (0xffff<<16)
-#define DR3_XMAX_MASK (0xffff<<0)
-#define DR4_YORG_MASK (0x3ff<<16)
-#define DR4_XORG_MASK (0x7ff<<0)
-
-
-/* GFXRENDERSTATE_LINEWIDTH_CULL_SHADE_MODE, p140
- *
- * Format:
- * 0: GFX_OP_LINEWIDTH_CULL_SHADE_MODE | LCS_*
- */
-#define GFX_OP_LINEWIDTH_CULL_SHADE_MODE ((0x3<<29)|(0x2<<24))
-#define LCS_UPDATE_ZMODE (0x1<<20)
-#define LCS_Z_MASK (0xf<<16)
-#define LCS_Z_NEVER (0x1<<16)
-#define LCS_Z_LESS (0x2<<16)
-#define LCS_Z_EQUAL (0x3<<16)
-#define LCS_Z_LEQUAL (0x4<<16)
-#define LCS_Z_GREATER (0x5<<16)
-#define LCS_Z_NOTEQUAL (0x6<<16)
-#define LCS_Z_GEQUAL (0x7<<16)
-#define LCS_Z_ALWAYS (0x8<<16)
-#define LCS_UPDATE_LINEWIDTH (0x1<<15)
-#define LCS_LINEWIDTH_MASK (0x7<<12)
-#define LCS_LINEWIDTH_SHIFT 12
-#define LCS_LINEWIDTH_0_5 (0x1<<12)
-#define LCS_LINEWIDTH_1_0 (0x2<<12)
-#define LCS_LINEWIDTH_2_0 (0x4<<12)
-#define LCS_LINEWIDTH_3_0 (0x6<<12)
-#define LCS_UPDATE_ALPHA_INTERP (0x1<<11)
-#define LCS_ALPHA_FLAT (0x1<<10)
-#define LCS_ALPHA_INTERP (0x0<<10)
-#define LCS_UPDATE_FOG_INTERP (0x1<<9)
-#define LCS_FOG_INTERP (0x0<<8)
-#define LCS_FOG_FLAT (0x1<<8)
-#define LCS_UPDATE_SPEC_INTERP (0x1<<7)
-#define LCS_SPEC_INTERP (0x0<<6)
-#define LCS_SPEC_FLAT (0x1<<6)
-#define LCS_UPDATE_RGB_INTERP (0x1<<5)
-#define LCS_RGB_INTERP (0x0<<4)
-#define LCS_RGB_FLAT (0x1<<4)
-#define LCS_UPDATE_CULL_MODE (0x1<<3)
-#define LCS_CULL_MASK (0x7<<0)
-#define LCS_CULL_DISABLE (0x1<<0)
-#define LCS_CULL_CW (0x2<<0)
-#define LCS_CULL_CCW (0x3<<0)
-#define LCS_CULL_BOTH (0x4<<0)
-
-#define LCS_INTERP_FLAT (LCS_ALPHA_FLAT|LCS_RGB_FLAT|LCS_SPEC_FLAT)
-#define LCS_UPDATE_INTERP (LCS_UPDATE_ALPHA_INTERP| \
- LCS_UPDATE_RGB_INTERP| \
- LCS_UPDATE_SPEC_INTERP)
-
-
-/* GFXRENDERSTATE_BOOLEAN_ENA_1, p142
- *
- */
-#define GFX_OP_BOOL_1 ((0x3<<29)|(0x3<<24))
-#define B1_UPDATE_SPEC_SETUP_ENABLE (1<<19)
-#define B1_SPEC_SETUP_ENABLE (1<<18)
-#define B1_UPDATE_ALPHA_SETUP_ENABLE (1<<17)
-#define B1_ALPHA_SETUP_ENABLE (1<<16)
-#define B1_UPDATE_CI_KEY_ENABLE (1<<15)
-#define B1_CI_KEY_ENABLE (1<<14)
-#define B1_UPDATE_CHROMAKEY_ENABLE (1<<13)
-#define B1_CHROMAKEY_ENABLE (1<<12)
-#define B1_UPDATE_Z_BIAS_ENABLE (1<<11)
-#define B1_Z_BIAS_ENABLE (1<<10)
-#define B1_UPDATE_SPEC_ENABLE (1<<9)
-#define B1_SPEC_ENABLE (1<<8)
-#define B1_UPDATE_FOG_ENABLE (1<<7)
-#define B1_FOG_ENABLE (1<<6)
-#define B1_UPDATE_ALPHA_TEST_ENABLE (1<<5)
-#define B1_ALPHA_TEST_ENABLE (1<<4)
-#define B1_UPDATE_BLEND_ENABLE (1<<3)
-#define B1_BLEND_ENABLE (1<<2)
-#define B1_UPDATE_Z_TEST_ENABLE (1<<1)
-#define B1_Z_TEST_ENABLE (1<<0)
-
-/* GFXRENDERSTATE_BOOLEAN_ENA_2, p143
- *
- */
-#define GFX_OP_BOOL_2 ((0x3<<29)|(0x4<<24))
-#define B2_UPDATE_MAP_CACHE_ENABLE (1<<17)
-#define B2_MAP_CACHE_ENABLE (1<<16)
-#define B2_UPDATE_ALPHA_DITHER_ENABLE (1<<15)
-#define B2_ALPHA_DITHER_ENABLE (1<<14)
-#define B2_UPDATE_FOG_DITHER_ENABLE (1<<13)
-#define B2_FOG_DITHER_ENABLE (1<<12)
-#define B2_UPDATE_SPEC_DITHER_ENABLE (1<<11)
-#define B2_SPEC_DITHER_ENABLE (1<<10)
-#define B2_UPDATE_RGB_DITHER_ENABLE (1<<9)
-#define B2_RGB_DITHER_ENABLE (1<<8)
-#define B2_UPDATE_FB_WRITE_ENABLE (1<<3)
-#define B2_FB_WRITE_ENABLE (1<<2)
-#define B2_UPDATE_ZB_WRITE_ENABLE (1<<1)
-#define B2_ZB_WRITE_ENABLE (1<<0)
-
-
-/* GFXRENDERSTATE_FOG_COLOR, p144
- */
-#define GFX_OP_FOG_COLOR ((0x3<<29)|(0x15<<24))
-#define FOG_RED_SHIFT 16
-#define FOG_GREEN_SHIFT 8
-#define FOG_BLUE_SHIFT 0
-#define FOG_RESERVED_MASK ((0x7<<16)|(0x3<<8)|(0x3))
-
-
-/* GFXRENDERSTATE_Z_BIAS_ALPHA_FUNC_REF, p139
- */
-#define GFX_OP_ZBIAS_ALPHAFUNC ((0x3<<29)|(0x14<<24))
-#define ZA_UPDATE_ZBIAS (1<<22)
-#define ZA_ZBIAS_SHIFT 14
-#define ZA_ZBIAS_MASK (0xff<<14)
-#define ZA_UPDATE_ALPHAFUNC (1<<13)
-#define ZA_ALPHA_MASK (0xf<<9)
-#define ZA_ALPHA_NEVER (1<<9)
-#define ZA_ALPHA_LESS (2<<9)
-#define ZA_ALPHA_EQUAL (3<<9)
-#define ZA_ALPHA_LEQUAL (4<<9)
-#define ZA_ALPHA_GREATER (5<<9)
-#define ZA_ALPHA_NOTEQUAL (6<<9)
-#define ZA_ALPHA_GEQUAL (7<<9)
-#define ZA_ALPHA_ALWAYS (8<<9)
-#define ZA_UPDATE_ALPHAREF (1<<8)
-#define ZA_ALPHAREF_MASK (0xff<<0)
-#define ZA_ALPHAREF_SHIFT 0
-#define ZA_ALPHAREF_RESERVED (0x7<<0)
-
-
-/* GFXRENDERSTATE_SRC_DST_BLEND_MONO, p136
- */
-#define GFX_OP_SRC_DEST_MONO ((0x3<<29)|(0x8<<24))
-#define SDM_UPDATE_MONO_ENABLE (1<<13)
-#define SDM_MONO_ENABLE (1<<12)
-#define SDM_UPDATE_SRC_BLEND (1<<11)
-#define SDM_SRC_MASK (0xf<<6)
-#define SDM_SRC_ZERO (0x1<<6)
-#define SDM_SRC_ONE (0x2<<6)
-#define SDM_SRC_SRC_COLOR (0x3<<6)
-#define SDM_SRC_INV_SRC_COLOR (0x4<<6)
-#define SDM_SRC_SRC_ALPHA (0x5<<6)
-#define SDM_SRC_INV_SRC_ALPHA (0x6<<6)
-#define SDM_SRC_DST_COLOR (0x9<<6)
-#define SDM_SRC_INV_DST_COLOR (0xa<<6)
-#define SDM_SRC_BOTH_SRC_ALPHA (0xc<<6)
-#define SDM_SRC_BOTH_INV_SRC_ALPHA (0xd<<6)
-#define SDM_UPDATE_DST_BLEND (1<<5)
-#define SDM_DST_MASK (0xf<<0)
-#define SDM_DST_ZERO (0x1<<0)
-#define SDM_DST_ONE (0x2<<0)
-#define SDM_DST_SRC_COLOR (0x3<<0)
-#define SDM_DST_INV_SRC_COLOR (0x4<<0)
-#define SDM_DST_SRC_ALPHA (0x5<<0)
-#define SDM_DST_INV_SRC_ALPHA (0x6<<0)
-#define SDM_DST_DST_COLOR (0x9<<0)
-#define SDM_DST_INV_DST_COLOR (0xa<<0)
-#define SDM_DST_BOTH_SRC_ALPHA (0xc<<0)
-#define SDM_DST_BOTH_INV_SRC_ALPHA (0xd<<0)
-
-
-/* GFXRENDERSTATE_COLOR_FACTOR, p134
- *
- * Format:
- * 0: GFX_OP_COLOR_FACTOR
- * 1: ARGB8888 color factor
- */
-#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
-
-/* GFXRENDERSTATE_MAP_ALPHA_BLEND_STAGES, p132
- */
-#define GFX_OP_MAP_ALPHA_STAGES ((0x3<<29)|(0x1<<24))
-#define MA_STAGE_SHIFT 20
-#define MA_STAGE_0 (0<<20)
-#define MA_STAGE_1 (1<<20)
-#define MA_STAGE_2 (2<<20)
-#define MA_UPDATE_ARG1 (1<<18)
-#define MA_ARG1_MASK ((0x7<<15)|(0x1<<13))
-#define MA_ARG1_ALPHA_FACTOR (0x1<<15)
-#define MA_ARG1_ITERATED_ALPHA (0x3<<15)
-#define MA_ARG1_CURRENT_ALPHA (0x5<<15)
-#define MA_ARG1_TEX0_ALPHA (0x6<<15)
-#define MA_ARG1_TEX1_ALPHA (0x7<<15)
-#define MA_ARG1_INVERT (0x1<<13)
-#define MA_ARG1_DONT_INVERT (0x0<<13)
-#define MA_UPDATE_ARG2 (1<<12)
-#define MA_ARG2_MASK ((0x7<<8)|(0x1<<6))
-#define MA_ARG2_ALPHA_FACTOR (0x1<<8)
-#define MA_ARG2_ITERATED_ALPHA (0x3<<8)
-#define MA_ARG2_CURRENT_ALPHA (0x5<<8)
-#define MA_ARG2_TEX0_ALPHA (0x6<<8)
-#define MA_ARG2_TEX1_ALPHA (0x7<<8)
-#define MA_ARG2_INVERT (0x1<<6)
-#define MA_ARG2_DONT_INVERT (0x0<<6)
-#define MA_UPDATE_OP (1<<5)
-#define MA_OP_MASK (0xf)
-#define MA_OP_ARG1 (0x1)
-#define MA_OP_ARG2 (0x2)
-#define MA_OP_MODULATE (0x3)
-#define MA_OP_MODULATE_X2 (0x4)
-#define MA_OP_MODULATE_X4 (0x5)
-#define MA_OP_ADD (0x6)
-#define MA_OP_ADD_SIGNED (0x7)
-#define MA_OP_LIN_BLEND_ITER_ALPHA (0x8)
-#define MA_OP_LIN_BLEND_ALPHA_FACTOR (0xa)
-#define MA_OP_LIN_BLEND_TEX0_ALPHA (0x10)
-#define MA_OP_LIN_BLEND_TEX1_ALPHA (0x11)
-
-
-/* GFXRENDERSTATE_MAP_COLOR_BLEND_STAGES, p129
- */
-#define GFX_OP_MAP_COLOR_STAGES ((0x3<<29)|(0x0<<24))
-#define MC_STAGE_SHIFT 20
-#define MC_STAGE_0 (0<<20)
-#define MC_STAGE_1 (1<<20)
-#define MC_STAGE_2 (2<<20)
-#define MC_UPDATE_DEST (1<<19)
-#define MC_DEST_MASK (1<<18)
-#define MC_DEST_CURRENT (0<<18)
-#define MC_DEST_ACCUMULATOR (1<<18)
-#define MC_UPDATE_ARG1 (1<<17)
-#define MC_ARG1_MASK ((0x7<<14)|(0x1<<13)|(0x1<<12))
-#define MC_ARG1_ONE (0x0<<14)
-#define MC_ARG1_COLOR_FACTOR (0x1<<14)
-#define MC_ARG1_ACCUMULATOR (0x2<<14)
-#define MC_ARG1_ITERATED_COLOR (0x3<<14)
-#define MC_ARG1_SPECULAR_COLOR (0x4<<14)
-#define MC_ARG1_CURRENT_COLOR (0x5<<14)
-#define MC_ARG1_TEX0_COLOR (0x6<<14)
-#define MC_ARG1_TEX1_COLOR (0x7<<14)
-#define MC_ARG1_DONT_REPLICATE_ALPHA (0x0<<13)
-#define MC_ARG1_REPLICATE_ALPHA (0x1<<13)
-#define MC_ARG1_DONT_INVERT (0x0<<12)
-#define MC_ARG1_INVERT (0x1<<12)
-#define MC_UPDATE_ARG2 (1<<11)
-#define MC_ARG2_MASK ((0x7<<8)|(0x1<<7)|(0x1<<6))
-#define MC_ARG2_ONE (0x0<<8)
-#define MC_ARG2_COLOR_FACTOR (0x1<<8)
-#define MC_ARG2_ACCUMULATOR (0x2<<8)
-#define MC_ARG2_ITERATED_COLOR (0x3<<8)
-#define MC_ARG2_SPECULAR_COLOR (0x4<<8)
-#define MC_ARG2_CURRENT_COLOR (0x5<<8)
-#define MC_ARG2_TEX0_COLOR (0x6<<8)
-#define MC_ARG2_TEX1_COLOR (0x7<<8)
-#define MC_ARG2_DONT_REPLICATE_ALPHA (0x0<<7)
-#define MC_ARG2_REPLICATE_ALPHA (0x1<<7)
-#define MC_ARG2_DONT_INVERT (0x0<<6)
-#define MC_ARG2_INVERT (0x1<<6)
-#define MC_UPDATE_OP (1<<5)
-#define MC_OP_MASK (0xf)
-#define MC_OP_DISABLE (0x0)
-#define MC_OP_ARG1 (0x1)
-#define MC_OP_ARG2 (0x2)
-#define MC_OP_MODULATE (0x3)
-#define MC_OP_MODULATE_X2 (0x4)
-#define MC_OP_MODULATE_X4 (0x5)
-#define MC_OP_ADD (0x6)
-#define MC_OP_ADD_SIGNED (0x7)
-#define MC_OP_LIN_BLEND_ITER_ALPHA (0x8)
-#define MC_OP_LIN_BLEND_ALPHA_FACTOR (0xa)
-#define MC_OP_LIN_BLEND_TEX0_ALPHA (0x10)
-#define MC_OP_LIN_BLEND_TEX1_ALPHA (0x11)
-#define MC_OP_LIN_BLEND_TEX0_COLOR (0x12)
-#define MC_OP_LIN_BLEND_TEX1_COLOR (0x13)
-#define MC_OP_SUBTRACT (0x14)
-
-/* GFXRENDERSTATE_MAP_PALETTE_LOAD, p128
- *
- * Format:
- * 0: GFX_OP_MAP_PALETTE_LOAD
- * 1: 16bpp color[0]
- * ...
- * 256: 16bpp color[255]
- */
-#define GFX_OP_MAP_PALETTE_LOAD ((0x3<<29)|(0x1d<<24)|(0x82<<16)|0xff)
-
-/* GFXRENDERSTATE_MAP_LOD_CONTROL, p127
- */
-#define GFX_OP_MAP_LOD_CTL ((0x3<<29)|(0x1c<<24)|(0x4<<19))
-#define MLC_MAP_ID_SHIFT 16
-#define MLC_MAP_0 (0<<16)
-#define MLC_MAP_1 (1<<16)
-#define MLC_UPDATE_DITHER_WEIGHT (1<<10)
-#define MLC_DITHER_WEIGHT_MASK (0x3<<8)
-#define MLC_DITHER_WEIGHT_FULL (0x0<<8)
-#define MLC_DITHER_WEIGHT_50 (0x1<<8)
-#define MLC_DITHER_WEIGHT_25 (0x2<<8)
-#define MLC_DITHER_WEIGHT_12 (0x3<<8)
-#define MLC_UPDATE_LOD_BIAS (1<<7)
-#define MLC_LOD_BIAS_MASK ((1<<7)-1)
-
-/* GFXRENDERSTATE_MAP_LOD_LIMITS, p126
- */
-#define GFX_OP_MAP_LOD_LIMITS ((0x3<<29)|(0x1c<<24)|(0x3<<19))
-#define MLL_MAP_ID_SHIFT 16
-#define MLL_MAP_0 (0<<16)
-#define MLL_MAP_1 (1<<16)
-#define MLL_UPDATE_MAX_MIP (1<<13)
-#define MLL_MAX_MIP_SHIFT 5
-#define MLL_MAX_MIP_MASK (0xff<<5)
-#define MLL_MAX_MIP_ONE (0x10<<5)
-#define MLL_UPDATE_MIN_MIP (1<<4)
-#define MLL_MIN_MIP_SHIFT 0
-#define MLL_MIN_MIP_MASK (0xf<<0)
-
-/* GFXRENDERSTATE_MAP_FILTER, p124
- */
-#define GFX_OP_MAP_FILTER ((0x3<<29)|(0x1c<<24)|(0x2<<19))
-#define MF_MAP_ID_SHIFT 16
-#define MF_MAP_0 (0<<16)
-#define MF_MAP_1 (1<<16)
-#define MF_UPDATE_ANISOTROPIC (1<<12)
-#define MF_ANISOTROPIC_MASK (1<<10)
-#define MF_ANISOTROPIC_ENABLE (1<<10)
-#define MF_UPDATE_MIP_FILTER (1<<9)
-#define MF_MIP_MASK (0x3<<6)
-#define MF_MIP_NONE (0x0<<6)
-#define MF_MIP_NEAREST (0x1<<6)
-#define MF_MIP_DITHER (0x2<<6)
-#define MF_MIP_LINEAR (0x3<<6)
-#define MF_UPDATE_MAG_FILTER (1<<5)
-#define MF_MAG_MASK (1<<3)
-#define MF_MAG_LINEAR (1<<3)
-#define MF_MAG_NEAREST (0<<3)
-#define MF_UPDATE_MIN_FILTER (1<<2)
-#define MF_MIN_MASK (1<<0)
-#define MF_MIN_LINEAR (1<<0)
-#define MF_MIN_NEAREST (0<<0)
-
-/* GFXRENDERSTATE_MAP_INFO, p118
- */
-#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x2)
-#define MI1_MAP_ID_SHIFT 28
-#define MI1_MAP_0 (0<<28)
-#define MI1_MAP_1 (1<<28)
-#define MI1_FMT_MASK (0x7<<24)
-#define MI1_FMT_8CI (0x0<<24)
-#define MI1_FMT_8BPP (0x1<<24)
-#define MI1_FMT_16BPP (0x2<<24)
-#define MI1_FMT_422 (0x5<<24)
-#define MI1_PF_MASK (0x3<<21)
-#define MI1_PF_8CI_RGB565 (0x0<<21)
-#define MI1_PF_8CI_ARGB1555 (0x1<<21)
-#define MI1_PF_8CI_ARGB4444 (0x2<<21)
-#define MI1_PF_8CI_AY88 (0x3<<21)
-#define MI1_PF_16BPP_RGB565 (0x0<<21)
-#define MI1_PF_16BPP_ARGB1555 (0x1<<21)
-#define MI1_PF_16BPP_ARGB4444 (0x2<<21)
-#define MI1_PF_16BPP_AY88 (0x3<<21)
-#define MI1_PF_422_YCRCB_SWAP_Y (0x0<<21)
-#define MI1_PF_422_YCRCB (0x1<<21)
-#define MI1_PF_422_YCRCB_SWAP_UV (0x2<<21)
-#define MI1_PF_422_YCRCB_SWAP_YUV (0x3<<21)
-#define MI1_OUTPUT_CHANNEL_MASK (0x3<<19)
-#define MI1_COLOR_CONV_ENABLE (1<<18)
-#define MI1_VERT_STRIDE_MASK (1<<17)
-#define MI1_VERT_STRIDE_1 (1<<17)
-#define MI1_VERT_OFFSET_MASK (1<<16)
-#define MI1_VERT_OFFSET_1 (1<<16)
-#define MI1_ENABLE_FENCE_REGS (1<<10)
-#define MI1_TILED_SURFACE (1<<9)
-#define MI1_TILE_WALK_X (0<<8)
-#define MI1_TILE_WALK_Y (1<<8)
-#define MI1_PITCH_MASK (0xf<<0)
-#define MI2_DIMENSIONS_ARE_LOG2 (1<<31)
-#define MI2_DIMENSIONS_ARE_EXACT (0<<31)
-#define MI2_HEIGHT_SHIFT 16
-#define MI2_HEIGHT_MASK (0x1ff<<16)
-#define MI2_WIDTH_SHIFT 0
-#define MI2_WIDTH_MASK (0x1ff<<0)
-#define MI3_BASE_ADDR_MASK (~0xf)
-
-/* GFXRENDERSTATE_MAP_COORD_SETS, p116
- */
-#define GFX_OP_MAP_COORD_SETS ((0x3<<29)|(0x1c<<24)|(0x1<<19))
-#define MCS_COORD_ID_SHIFT 16
-#define MCS_COORD_0 (0<<16)
-#define MCS_COORD_1 (1<<16)
-#define MCS_UPDATE_NORMALIZED (1<<15)
-#define MCS_NORMALIZED_COORDS_MASK (1<<14)
-#define MCS_NORMALIZED_COORDS (1<<14)
-#define MCS_UPDATE_V_STATE (1<<7)
-#define MCS_V_STATE_MASK (0x3<<4)
-#define MCS_V_WRAP (0x0<<4)
-#define MCS_V_MIRROR (0x1<<4)
-#define MCS_V_CLAMP (0x2<<4)
-#define MCS_V_WRAP_SHORTEST (0x3<<4)
-#define MCS_UPDATE_U_STATE (1<<3)
-#define MCS_U_STATE_MASK (0x3<<0)
-#define MCS_U_WRAP (0x0<<0)
-#define MCS_U_MIRROR (0x1<<0)
-#define MCS_U_CLAMP (0x2<<0)
-#define MCS_U_WRAP_SHORTEST (0x3<<0)
-
-/* GFXRENDERSTATE_MAP_TEXELS, p115
- */
-#define GFX_OP_MAP_TEXELS ((0x3<<29)|(0x1c<<24)|(0x0<<19))
-#define MT_UPDATE_TEXEL1_STATE (1<<15)
-#define MT_TEXEL1_DISABLE (0<<14)
-#define MT_TEXEL1_ENABLE (1<<14)
-#define MT_TEXEL1_COORD0 (0<<11)
-#define MT_TEXEL1_COORD1 (1<<11)
-#define MT_TEXEL1_MAP0 (0<<8)
-#define MT_TEXEL1_MAP1 (1<<8)
-#define MT_UPDATE_TEXEL0_STATE (1<<7)
-#define MT_TEXEL0_DISABLE (0<<6)
-#define MT_TEXEL0_ENABLE (1<<6)
-#define MT_TEXEL0_COORD0 (0<<3)
-#define MT_TEXEL0_COORD1 (1<<3)
-#define MT_TEXEL0_MAP0 (0<<0)
-#define MT_TEXEL0_MAP1 (1<<0)
-
-/* GFXRENDERSTATE_VERTEX_FORMAT, p110
- */
-#define GFX_OP_VERTEX_FMT ((0x3<<29)|(0x5<<24))
-#define VF_TEXCOORD_COUNT_SHIFT 8
-#define VF_TEXCOORD_COUNT_0 (0<<8)
-#define VF_TEXCOORD_COUNT_1 (1<<8)
-#define VF_TEXCOORD_COUNT_2 (2<<8)
-#define VF_SPEC_FOG_ENABLE (1<<7)
-#define VF_RGBA_ENABLE (1<<6)
-#define VF_Z_OFFSET_ENABLE (1<<5)
-#define VF_XYZ (0x1<<1)
-#define VF_XYZW (0x2<<1)
-#define VF_XY (0x3<<1)
-#define VF_XYW (0x4<<1)
-
-
-#define VERT_X_MASK (~0xf)
-#define VERT_X_EDGE_V2V0 (1<<2)
-#define VERT_X_EDGE_V1V2 (1<<1)
-#define VERT_X_EDGE_V0V1 (1<<0)
-
-/* Not enabled fields should not be sent to hardware:
- */
-typedef struct {
- union {
- float x;
- unsigned int edge_flags;
- } x;
- float y;
- float z;
- float z_bias;
- float oow;
- unsigned int argb;
- unsigned int fog_spec_rgb; /* spec g and r ignored. */
- float tu0;
- float tv0;
- float tu1;
- float tv1;
-} i810_full_vertex;
-
-
-
-/* GFXCMDPARSER_BATCH_BUFFER, p105
- *
- * Not clear whether start address must be shifted or not. Not clear
- * whether address is physical system memory, or subject to GTT
- * translation. Because the address appears to be 32 bits long,
- * perhaps it refers to physical system memory...
- */
-#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1)
-#define BB1_START_ADDR_MASK (~0x7)
-#define BB1_PROTECTED (1<<0)
-#define BB1_UNPROTECTED (0<<0)
-#define BB2_END_ADDR_MASK (~0x7)
-
-/* Hardware seems to barf on buffers larger than this (in strange ways)...
- */
-#define MAX_BATCH (512*1024)
-
-
-/* GFXCMDPARSER_Z_BUFFER_INFO, p98
- *
- * Base address is in GTT space, and must be 4K aligned
- */
-#define CMD_OP_Z_BUFFER_INFO ((0x0<<29)|(0x16<<23))
-#define ZB_BASE_ADDR_SHIFT 0
-#define ZB_BASE_ADDR_MASK (~((1<<12)-1))
-#define ZB_PITCH_512B (0x0<<0)
-#define ZB_PITCH_1K (0x1<<0)
-#define ZB_PITCH_2K (0x2<<0)
-#define ZB_PITCH_4K (0x3<<0)
-
-/* GFXCMDPARSER_FRONT_BUFFER_INFO, p97
- *
- * Format:
- * 0: CMD_OP_FRONT_BUFFER_INFO | (pitch<<FB0_PITCH_SHIFT) | FB0_*
- * 1: FB1_*
- */
-#define CMD_OP_FRONT_BUFFER_INFO ((0x0<<29)|(0x14<<23))
-#define FB0_PITCH_SHIFT 8
-#define FB0_FLIP_SYNC (0<<6)
-#define FB0_FLIP_ASYNC (1<<6)
-#define FB0_BASE_ADDR_SHIFT 0
-#define FB0_BASE_ADDR_MASK 0x03FFFFF8
-
-/* GFXCMDPARSER_DEST_BUFFER_INFO, p96
- *
- * Format:
- */
-#define CMD_OP_DESTBUFFER_INFO ((0x0<<29)|(0x15<<23))
-#define DB1_BASE_ADDR_SHIFT 0
-#define DB1_BASE_ADDR_MASK 0x03FFF000
-#define DB1_PITCH_512B (0x0<<0)
-#define DB1_PITCH_1K (0x1<<0)
-#define DB1_PITCH_2K (0x2<<0)
-#define DB1_PITCH_4K (0x4<<0)
-
-
-/* GFXRENDERSTATE_DEST_BUFFER_VARIABLES, p152
- *
- * Format:
- * 0: GFX_OP_DESTBUFFER_VARS
- * 1: DEST_*
- */
-#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
-#define DV_HORG_BIAS_MASK (0xf<<20)
-#define DV_HORG_BIAS_OGL (0x0<<20)
-#define DV_VORG_BIAS_MASK (0xf<<16)
-#define DV_VORG_BIAS_OGL (0x0<<16)
-#define DV_PF_MASK (0x7<<8)
-#define DV_PF_INDEX (0x0<<8)
-#define DV_PF_555 (0x1<<8)
-#define DV_PF_565 (0x2<<8)
-
-#define GFX_OP_ANTIALIAS ((0x3<<29)|(0x6<<24))
-#define AA_UPDATE_EDGEFLAG (1<<13)
-#define AA_ENABLE_EDGEFLAG (1<<12)
-#define AA_UPDATE_POLYWIDTH (1<<11)
-#define AA_POLYWIDTH_05 (1<<9)
-#define AA_POLYWIDTH_10 (2<<9)
-#define AA_POLYWIDTH_20 (3<<9)
-#define AA_POLYWIDTH_40 (4<<9)
-#define AA_UPDATE_LINEWIDTH (1<<8)
-#define AA_LINEWIDTH_05 (1<<6)
-#define AA_LINEWIDTH_10 (2<<6)
-#define AA_LINEWIDTH_20 (3<<6)
-#define AA_LINEWIDTH_40 (4<<6)
-#define AA_UPDATE_BB_EXPANSION (1<<5)
-#define AA_BB_EXPANSION_SHIFT 2
-#define AA_UPDATE_AA_ENABLE (1<<1)
-#define AA_ENABLE (1<<0)
-
-#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-#define I810_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.c
deleted file mode 100644
index 47c41c5db..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.c
+++ /dev/null
@@ -1,572 +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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810context.c,v 1.3 2002/10/30 12:51:33 alanh Exp $ */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810state.h"
-#include "i810tex.h"
-#include "i810span.h"
-#include "i810tris.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-
-#include "utils.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#include "extension_helper.h"
-
-#ifndef I810_DEBUG
-int I810_DEBUG = (0);
-#endif
-
-PUBLIC const char __driConfigOptions[] = { 0 };
-const GLuint __driNConfigOptions = 0;
-
-#define DRIVER_DATE "20050818"
-
-static const GLubyte *i810GetString( GLcontext *ctx, GLenum name )
-{
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *)"Keith Whitwell";
- case GL_RENDERER: {
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- const char * chipset;
-
- switch (imesa->i810Screen->deviceID) {
- case PCI_CHIP_I810: chipset = "i810"; break;
- case PCI_CHIP_I810_DC100: chipset = "i810 DC-100"; break;
- case PCI_CHIP_I810_E: chipset = "i810E"; break;
- case PCI_CHIP_I815: chipset = "i815"; break;
- default: chipset = "Unknown i810-class Chipset"; break;
- }
-
- (void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 );
- return (GLubyte *) buffer;
- }
- default:
- return 0;
- }
-}
-
-static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE(imesa);
- *width = imesa->driDrawable->w;
- *height = imesa->driDrawable->h;
- UNLOCK_HARDWARE(imesa);
-}
-
-/* Extension strings exported by the i810 driver.
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-extern const struct tnl_pipeline_stage _i810_render_stage;
-
-static const struct tnl_pipeline_stage *i810_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
- &_i810_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "sleep", DEBUG_SLEEP },
- { NULL, 0 }
-};
-
-GLboolean
-i810CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- i810ContextPtr imesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private;
- I810SAREAPtr saPriv = (I810SAREAPtr)
- (((GLubyte *)sPriv->pSAREA) + i810Screen->sarea_priv_offset);
- struct dd_function_table functions;
-
- /* Allocate i810 context */
- imesa = (i810ContextPtr) CALLOC_STRUCT(i810_context_t);
- if (!imesa) {
- return GL_FALSE;
- }
-
- driContextPriv->driverPrivate = imesa;
-
- imesa->i810Screen = i810Screen;
- imesa->driScreen = sPriv;
- imesa->sarea = saPriv;
- imesa->glBuffer = NULL;
-
- /* Init default driver functions then plug in our I810-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions( &functions );
- i810InitIoctlFuncs( &functions );
- i810InitTextureFuncs( &functions );
-
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((i810ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- imesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
- &functions, (void*) imesa);
- if (!imesa->glCtx) {
- FREE(imesa);
- return GL_FALSE;
- }
-
- (void) memset( imesa->texture_heaps, 0, sizeof( imesa->texture_heaps ) );
- make_empty_list( & imesa->swapped );
-
- imesa->nr_heaps = 1;
- imesa->texture_heaps[0] = driCreateTextureHeap( 0, imesa,
- i810Screen->textureSize,
- 12,
- I810_NR_TEX_REGIONS,
- imesa->sarea->texList,
- (unsigned *) & imesa->sarea->texAge, /* XXX we shouldn't cast! */
- & imesa->swapped,
- sizeof( struct i810_texture_object_t ),
- (destroy_texture_object_t *) i810DestroyTexObj );
-
-
-
- /* Set the maximum texture size small enough that we can guarentee
- * that both texture units can bind a maximal texture and have them
- * in memory at once.
- */
-
-
-
- ctx = imesa->glCtx;
- ctx->Const.MaxTextureUnits = 2;
- ctx->Const.MaxTextureImageUnits = 2;
- ctx->Const.MaxTextureCoordUnits = 2;
-
-
- /* FIXME: driCalcualteMaxTextureLevels assumes that mipmaps are tightly
- * FIXME: packed, but they're not in Intel graphics hardware.
- */
- driCalculateMaxTextureLevels( imesa->texture_heaps,
- imesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported */
- 0, /* cube textures unsupported. */
- 0, /* texture rectangles unsupported. */
- 12,
- GL_FALSE );
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 3.0;
- ctx->Const.MaxLineWidthAA = 3.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 3.0;
- ctx->Const.MaxPointSizeAA = 3.0;
- ctx->Const.PointSizeGranularity = 1.0;
-
- ctx->Driver.GetBufferSize = i810BufferSize;
- ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
- ctx->Driver.GetString = i810GetString;
-
- /* Who owns who?
- */
- ctx->DriverCtx = (void *) imesa;
- imesa->glCtx = ctx;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, i810_pipeline );
-
- /* Configure swrast and T&L 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 );
-
- /* Dri stuff
- */
- imesa->hHWContext = driContextPriv->hHWContext;
- imesa->driFd = sPriv->fd;
- imesa->driHwLock = &sPriv->pSAREA->lock;
-
- imesa->stipple_in_hw = 1;
- imesa->RenderIndex = ~0;
- imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS;
- imesa->upload_cliprects = GL_TRUE;
-
- imesa->CurrentTexObj[0] = 0;
- imesa->CurrentTexObj[1] = 0;
-
- _math_matrix_ctr( &imesa->ViewportMatrix );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- /* XXX these should really go right after _mesa_init_driver_functions() */
- i810InitStateFuncs( ctx );
- i810InitTriFuncs( ctx );
- i810InitSpanFuncs( ctx );
- i810InitVB( ctx );
- i810InitState( ctx );
-
-#if DO_DEBUG
- I810_DEBUG = driParseDebugString( getenv( "I810_DEBUG" ),
- debug_control );
- I810_DEBUG |= driParseDebugString( getenv( "INTEL_DEBUG" ),
- debug_control );
-#endif
-
- return GL_TRUE;
-}
-
-void
-i810DestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
-
- assert(imesa); /* should never be null */
- if (imesa) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( imesa->glCtx );
- _tnl_DestroyContext( imesa->glCtx );
- _ac_DestroyContext( imesa->glCtx );
- _swrast_DestroyContext( imesa->glCtx );
-
- i810FreeVB( imesa->glCtx );
-
- /* free the Mesa context */
- imesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(imesa->glCtx);
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- unsigned int i;
-
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( imesa->texture_heaps[ i ] );
- imesa->texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & imesa->swapped ) );
- }
-
- FREE(imesa);
- }
-}
-
-
-void i810XMesaSetFrontClipRects( i810ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
-
- i810EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-
-void i810XMesaSetBackClipRects( i810ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- if (imesa->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0)
- {
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
- } else {
- imesa->numClipRects = dPriv->numBackClipRects;
- imesa->pClipRects = dPriv->pBackClipRects;
- imesa->drawX = dPriv->backX;
- imesa->drawY = dPriv->backY;
- }
-
- i810EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-
-static void i810XMesaWindowMoved( i810ContextPtr imesa )
-{
- /* Determine current color drawing buffer */
- switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- i810XMesaSetFrontClipRects( imesa );
- break;
- case BUFFER_BIT_BACK_LEFT:
- i810XMesaSetBackClipRects( imesa );
- break;
- default:
- /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
- i810XMesaSetFrontClipRects( imesa );
- }
-}
-
-
-GLboolean
-i810UnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
- if (imesa) {
- imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS;
- if (imesa->CurrentTexObj[0]) imesa->dirty |= I810_UPLOAD_TEX0;
- if (imesa->CurrentTexObj[1]) imesa->dirty |= I810_UPLOAD_TEX1;
- }
-
- return GL_TRUE;
-}
-
-
-GLboolean
-i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- i810ContextPtr imesa = (i810ContextPtr) driContextPriv->driverPrivate;
-
- /* Shouldn't the readbuffer be stored also?
- */
- imesa->driDrawable = driDrawPriv;
-
- _mesa_make_current(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- /* Are these necessary?
- */
- i810XMesaWindowMoved( imesa );
- }
- else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-static void
-i810UpdatePageFlipping( i810ContextPtr imesa )
-{
- GLcontext *ctx = imesa->glCtx;
- int front = 0;
-
- /* Determine current color drawing buffer */
- switch (ctx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- front = 1;
- break;
- case BUFFER_BIT_BACK_LEFT:
- front = 0;
- break;
- default:
- return;
- }
-
- if ( imesa->sarea->pf_current_page == 1 )
- front ^= 1;
-
- if (front) {
- imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->fbOffset | imesa->i810Screen->backPitchBits;
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- } else {
- imesa->BufferSetup[I810_DESTREG_DI1] = imesa->i810Screen->backOffset | imesa->i810Screen->backPitchBits;
- imesa->drawMap = imesa->i810Screen->back.map;
- imesa->readMap = imesa->i810Screen->back.map;
- }
-
- imesa->dirty |= I810_UPLOAD_BUFFERS;
-}
-
-void i810GetLock( i810ContextPtr imesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- __DRIscreenPrivate *sPriv = imesa->driScreen;
- I810SAREAPtr sarea = imesa->sarea;
- int me = imesa->hHWContext;
- unsigned i;
-
- drmGetLock(imesa->driFd, imesa->hHWContext, flags);
-
- /* If the window moved, may need to set a new cliprect now.
- *
- * NOTE: This releases and regains the hw lock, so all state
- * checking must be done *after* this call:
- */
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
-
- /* If we lost context, need to dump all registers to hardware.
- * Note that we don't care about 2d contexts, even if they perform
- * accelerated commands, so the DRI locking in the X server is even
- * more broken than usual.
- */
- if (sarea->ctxOwner != me) {
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty = I810_UPLOAD_CTX|I810_UPLOAD_BUFFERS;
- if (imesa->CurrentTexObj[0]) imesa->dirty |= I810_UPLOAD_TEX0;
- if (imesa->CurrentTexObj[1]) imesa->dirty |= I810_UPLOAD_TEX1;
- sarea->ctxOwner = me;
- }
-
- /* Shared texture managment - if another client has played with
- * texture space, figure out which if any of our textures have been
- * ejected, and update our global LRU.
- */
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( imesa->texture_heaps[ i ] );
- }
-
- if (imesa->lastStamp != dPriv->lastStamp) {
- i810UpdatePageFlipping( imesa );
- i810XMesaWindowMoved( imesa );
- imesa->lastStamp = dPriv->lastStamp;
- }
-}
-
-
-void
-i810SwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- i810ContextPtr imesa;
- GLcontext *ctx;
- imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = imesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( imesa->sarea->pf_active ) {
- i810PageFlip( dPriv );
- } else {
- i810CopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "i810SwapBuffers: drawable has no context!\n");
- }
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.h
deleted file mode 100644
index a2202e148..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810context.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810context.h,v 1.9 2002/12/16 16:18:51 dawes Exp $ */
-
-#ifndef I810CONTEXT_INC
-#define I810CONTEXT_INC
-
-typedef struct i810_context_t i810Context;
-typedef struct i810_context_t *i810ContextPtr;
-typedef struct i810_texture_object_t *i810TextureObjectPtr;
-
-#include "drm.h"
-#include "mtypes.h"
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810tex.h"
-
-
-/* Reasons to disable hardware rasterization.
- */
-#define I810_FALLBACK_TEXTURE 0x1
-#define I810_FALLBACK_DRAW_BUFFER 0x2
-#define I810_FALLBACK_READ_BUFFER 0x4
-#define I810_FALLBACK_COLORMASK 0x8
-#define I810_FALLBACK_SPECULAR 0x20
-#define I810_FALLBACK_LOGICOP 0x40
-#define I810_FALLBACK_RENDERMODE 0x80
-#define I810_FALLBACK_STENCIL 0x100
-#define I810_FALLBACK_BLEND_EQ 0x200
-#define I810_FALLBACK_BLEND_FUNC 0x400
-
-
-#ifndef PCI_CHIP_I810
-#define PCI_CHIP_I810 0x7121
-#define PCI_CHIP_I810_DC100 0x7123
-#define PCI_CHIP_I810_E 0x7125
-#define PCI_CHIP_I815 0x1132
-#endif
-
-#define IS_I810(imesa) (imesa->i810Screen->deviceID == PCI_CHIP_I810 || \
- imesa->i810Screen->deviceID == PCI_CHIP_I810_DC100 || \
- imesa->i810Screen->deviceID == PCI_CHIP_I810_E)
-#define IS_I815(imesa) (imesa->i810Screen->deviceID == PCI_CHIP_I815)
-
-
-#define I810_UPLOAD_TEX(i) (I810_UPLOAD_TEX0<<(i))
-
-/* Use the templated vertex formats:
- */
-#define TAG(x) i810##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*i810_tri_func)( i810ContextPtr, i810Vertex *, i810Vertex *,
- i810Vertex * );
-typedef void (*i810_line_func)( i810ContextPtr, i810Vertex *, i810Vertex * );
-typedef void (*i810_point_func)( i810ContextPtr, i810Vertex * );
-
-struct i810_context_t {
- GLint refcount;
- GLcontext *glCtx;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[1];
- driTextureObject swapped;
-
- struct i810_texture_object_t *CurrentTexObj[2];
-
-
- /* Bit flag to keep track of fallbacks.
- */
- GLuint Fallback;
-
- /* State for i810vb.c and i810tris.c.
- */
- GLuint new_state; /* _NEW_* flags */
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLuint RenderIndex;
- GLmatrix ViewportMatrix;
- GLenum render_primitive;
- GLenum reduced_primitive;
- GLuint hw_primitive;
- GLubyte *verts;
-
- drmBufPtr vertex_buffer;
- char *vertex_addr;
- GLuint vertex_low;
- GLuint vertex_high;
- GLuint vertex_last_prim;
-
- GLboolean upload_cliprects;
-
-
- /* Fallback rasterization functions
- */
- i810_point_func draw_point;
- i810_line_func draw_line;
- i810_tri_func draw_tri;
-
- /* Hardware state
- */
- GLuint dirty; /* I810_UPLOAD_* */
- GLuint Setup[I810_CTX_SETUP_SIZE];
- GLuint BufferSetup[I810_DEST_SETUP_SIZE];
- int vertex_size;
- int vertex_stride_shift;
- unsigned int lastStamp;
- GLboolean stipple_in_hw;
-
- GLenum TexEnvImageFmt[2];
-
- /* State which can't be computed completely on the fly:
- */
- GLuint LcsCullMode;
- GLuint LcsLineWidth;
- GLuint LcsPointSize;
-
- /* Funny mesa mirrors
- */
- GLushort ClearColor;
-
- /* DRI stuff
- */
- GLuint needClip;
- GLframebuffer *glBuffer;
- GLboolean doPageFlip;
-
- /* These refer to the current draw (front vs. back) buffer:
- */
- char *drawMap; /* draw buffer address in virtual mem */
- char *readMap;
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- GLuint numClipRects; /* cliprects for that buffer */
- drm_clip_rect_t *pClipRects;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
-
-
- GLboolean scissor;
- drm_clip_rect_t draw_rect;
- drm_clip_rect_t scissor_rect;
-
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *driScreen;
- i810ScreenPrivate *i810Screen;
- I810SAREAPtr sarea;
-};
-
-
-#define I810_CONTEXT(ctx) ((i810ContextPtr)(ctx->DriverCtx))
-
-#define GET_DISPATCH_AGE( imesa ) imesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE( imesa ) imesa->sarea->last_enqueue
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( imesa ) \
- do { \
- char __ret=0; \
- DRM_CAS(imesa->driHwLock, imesa->hHWContext, \
- (DRM_LOCK_HELD|imesa->hHWContext), __ret); \
- if (__ret) \
- i810GetLock( imesa, 0 ); \
- } while (0)
-
-
-
-/* Release the kernel lock.
- */
-#define UNLOCK_HARDWARE(imesa) \
- DRM_UNLOCK(imesa->driFd, imesa->driHwLock, imesa->hHWContext);
-
-
-/* This is the wrong way to do it, I'm sure. Otherwise the drm
- * bitches that I've already got the heavyweight lock. At worst,
- * this is 3 ioctls. The best solution probably only gets me down
- * to 2 ioctls in the worst case.
- */
-#define LOCK_HARDWARE_QUIESCENT( imesa ) do { \
- LOCK_HARDWARE( imesa ); \
- i810RegetLockQuiescent( imesa ); \
-} while(0)
-
-
-extern void i810GetLock( i810ContextPtr imesa, GLuint flags );
-extern void i810EmitHwStateLocked( i810ContextPtr imesa );
-extern void i810EmitScissorValues( i810ContextPtr imesa, int box_nr, int emit );
-extern void i810EmitDrawingRectangle( i810ContextPtr imesa );
-extern void i810XMesaSetBackClipRects( i810ContextPtr imesa );
-extern void i810XMesaSetFrontClipRects( i810ContextPtr imesa );
-
-#define SUBPIXEL_X -.5
-#define SUBPIXEL_Y -.5
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-#if DO_DEBUG
-extern int I810_DEBUG;
-#else
-#define I810_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x1
-#define DEBUG_STATE 0x2
-#define DEBUG_IOCTL 0x4
-#define DEBUG_PRIMS 0x8
-#define DEBUG_VERTS 0x10
-#define DEBUG_FALLBACKS 0x20
-#define DEBUG_VERBOSE 0x40
-#define DEBUG_DRI 0x80
-#define DEBUG_DMA 0x100
-#define DEBUG_SANITY 0x200
-#define DEBUG_SYNC 0x400
-#define DEBUG_SLEEP 0x800
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.c
deleted file mode 100644
index ba651555a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.c,v 1.7 2002/10/30 12:51:33 alanh Exp $ */
-
-#include <unistd.h> /* for usleep() */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "swrast/swrast.h"
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810ioctl.h"
-#include "i810state.h"
-
-static drmBufPtr i810_get_buffer_ioctl( i810ContextPtr imesa )
-{
- drmI810DMA dma;
- drmBufPtr buf;
- int retcode, i = 0;
-
- while (1) {
- retcode = drmCommandWriteRead(imesa->driFd, DRM_I810_GETBUF,
- &dma, sizeof(drmI810DMA));
-
- if (dma.granted == 1 && retcode == 0)
- break;
-
- if (++i > 1000) {
- drmCommandNone(imesa->driFd, DRM_I810_FLUSH);
- i = 0;
- }
- }
-
- buf = &(imesa->i810Screen->bufs->list[dma.request_idx]);
- buf->idx = dma.request_idx;
- buf->used = 0;
- buf->total = dma.request_size;
- buf->address = (drmAddress)dma.virtual;
-
- return buf;
-}
-
-
-
-#define DEPTH_SCALE ((1<<16)-1)
-
-static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- drmI810Clear clear;
- unsigned int i;
-
- clear.flags = 0;
- clear.clear_color = imesa->ClearColor;
- clear.clear_depth = (GLuint) (ctx->Depth.Clear * DEPTH_SCALE);
-
- I810_FIREVERTICES( imesa );
-
- if ((mask & BUFFER_BIT_FRONT_LEFT) && colorMask == ~0U) {
- clear.flags |= I810_FRONT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ((mask & BUFFER_BIT_BACK_LEFT) && colorMask == ~0U) {
- clear.flags |= I810_BACK;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if (mask & BUFFER_BIT_DEPTH) {
- if (ctx->Depth.Mask)
- clear.flags |= I810_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if (clear.flags) {
- LOCK_HARDWARE( imesa );
-
- /* flip top to bottom */
- cy = dPriv->h-cy-ch;
- cx += imesa->drawX;
- cy += imesa->drawY;
-
- for (i = 0 ; i < imesa->numClipRects ; )
- {
- unsigned int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, imesa->numClipRects);
- drm_clip_rect_t *box = imesa->pClipRects;
- drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
- int n = 0;
-
- if (!all) {
- for ( ; i < nr ; i++) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++) {
- *b++ = box[i];
- n++;
- }
- }
-
- imesa->sarea->nbox = n;
- drmCommandWrite(imesa->driFd, DRM_I810_CLEAR,
- &clear, sizeof(drmI810Clear));
- }
-
- UNLOCK_HARDWARE( imesa );
- imesa->upload_cliprects = GL_TRUE;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void i810CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- i810ContextPtr imesa;
- drm_clip_rect_t *pbox;
- int nbox, i, tmp;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I810_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- pbox = (drm_clip_rect_t *)dPriv->pClipRects;
- nbox = dPriv->numClipRects;
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
-
- imesa->sarea->nbox = nr - i;
-
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
-
- drmCommandNone(imesa->driFd, DRM_I810_SWAP);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i810WaitAge(imesa, imesa->lastSwap);
- }
-
- imesa->lastSwap = tmp;
- imesa->upload_cliprects = GL_TRUE;
-}
-
-
-/*
- * XXX implement when full-screen extension is done.
- */
-void i810PageFlip( const __DRIdrawablePrivate *dPriv )
-{
- i810ContextPtr imesa;
- int tmp, ret;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I810_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- if (dPriv->pClipRects) {
- memcpy(&(imesa->sarea->boxes[0]), &(dPriv->pClipRects[0]),
- sizeof(drm_clip_rect_t));
- imesa->sarea->nbox = 1;
- }
- ret = drmCommandNone(imesa->driFd, DRM_I810_FLIP);
- if (ret) {
- fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);
- UNLOCK_HARDWARE( imesa );
- exit(1);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i810WaitAge(imesa, imesa->lastSwap);
- }
-
- /* i810SetDrawBuffer( imesa->glCtx, imesa->glCtx->Color.DriverDrawBuffer );*/
- i810DrawBuffer( imesa->glCtx, imesa->glCtx->Color.DrawBuffer[0] );
- imesa->upload_cliprects = GL_TRUE;
- imesa->lastSwap = tmp;
- return;
-}
-
-
-/* This waits for *everybody* to finish rendering -- overkill.
- */
-void i810DmaFinish( i810ContextPtr imesa )
-{
- I810_FIREVERTICES( imesa );
-
- LOCK_HARDWARE( imesa );
- i810RegetLockQuiescent( imesa );
- UNLOCK_HARDWARE( imesa );
-}
-
-
-void i810RegetLockQuiescent( i810ContextPtr imesa )
-{
- drmUnlock(imesa->driFd, imesa->hHWContext);
- i810GetLock( imesa, DRM_LOCK_QUIESCENT );
-}
-
-void i810WaitAgeLocked( i810ContextPtr imesa, int age )
-{
- int i = 0, j;
-
- while (++i < 5000) {
- drmCommandNone(imesa->driFd, DRM_I810_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age)
- return;
- for (j = 0 ; j < 1000 ; j++)
- ;
- }
-
- drmCommandNone(imesa->driFd, DRM_I810_FLUSH);
-}
-
-
-void i810WaitAge( i810ContextPtr imesa, int age )
-{
- int i = 0, j;
-
- while (++i < 5000) {
- drmCommandNone(imesa->driFd, DRM_I810_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age)
- return;
- for (j = 0 ; j < 1000 ; j++)
- ;
- }
-
- i = 0;
- while (++i < 1000) {
- drmCommandNone(imesa->driFd, DRM_I810_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age)
- return;
- usleep(1000);
- }
-
- LOCK_HARDWARE(imesa);
- drmCommandNone(imesa->driFd, DRM_I810_FLUSH);
- UNLOCK_HARDWARE(imesa);
-}
-
-
-
-
-static int intersect_rect( drm_clip_rect_t *out,
- drm_clip_rect_t *a,
- drm_clip_rect_t *b )
-{
- *out = *a;
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (out->x1 >= out->x2) return 0;
-
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->y2 < out->y2) out->y2 = b->y2;
- if (out->y1 >= out->y2) return 0;
- return 1;
-}
-
-
-static void emit_state( i810ContextPtr imesa )
-{
- GLuint dirty = imesa->dirty;
- I810SAREAPtr sarea = imesa->sarea;
-
- if (dirty & I810_UPLOAD_BUFFERS) {
- memcpy( sarea->BufferState, imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- }
-
- if (dirty & I810_UPLOAD_CTX) {
- memcpy( sarea->ContextState, imesa->Setup,
- sizeof(imesa->Setup) );
- }
-
- if (dirty & I810_UPLOAD_TEX0) {
- memcpy(sarea->TexState[0],
- imesa->CurrentTexObj[0]->Setup,
- sizeof(imesa->CurrentTexObj[0]->Setup));
- }
-
- if (dirty & I810_UPLOAD_TEX1) {
- GLuint *setup = sarea->TexState[1];
-
- memcpy( setup,
- imesa->CurrentTexObj[1]->Setup,
- sizeof(imesa->CurrentTexObj[1]->Setup));
-
- /* Need this for the case where both units are bound to the same
- * texobj.
- */
- setup[I810_TEXREG_MI1] ^= (MI1_MAP_0 ^ MI1_MAP_1);
- setup[I810_TEXREG_MLC] ^= (MLC_MAP_0 ^ MLC_MAP_1);
- setup[I810_TEXREG_MLL] ^= (MLL_MAP_0 ^ MLL_MAP_1);
- setup[I810_TEXREG_MCS] ^= (MCS_COORD_0 ^ MCS_COORD_1);
- setup[I810_TEXREG_MF] ^= (MF_MAP_0 ^ MF_MAP_1);
- }
-
- sarea->dirty = dirty;
- imesa->dirty = 0;
-}
-
-
-static void age_imesa( i810ContextPtr imesa, int age )
-{
- if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->base.timestamp = age;
- if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->base.timestamp = age;
-}
-
-
-void i810FlushPrimsLocked( i810ContextPtr imesa )
-{
- drm_clip_rect_t *pbox = imesa->pClipRects;
- int nbox = imesa->numClipRects;
- drmBufPtr buffer = imesa->vertex_buffer;
- I810SAREAPtr sarea = imesa->sarea;
- drmI810Vertex vertex;
- int i;
-
- if (I810_DEBUG & DEBUG_STATE)
- i810PrintDirty( __FUNCTION__, imesa->dirty );
-
- if (imesa->dirty)
- emit_state( imesa );
-
- vertex.idx = buffer->idx;
- vertex.used = imesa->vertex_low;
- vertex.discard = 0;
- sarea->vertex_prim = imesa->hw_primitive;
-
- if (!nbox) {
- vertex.used = 0;
- }
- else if (nbox > I810_NR_SAREA_CLIPRECTS) {
- imesa->upload_cliprects = GL_TRUE;
- }
-
- if (!nbox || !imesa->upload_cliprects)
- {
- if (nbox == 1)
- sarea->nbox = 0;
- else
- sarea->nbox = nbox;
-
- vertex.discard = 1;
- drmCommandWrite(imesa->driFd, DRM_I810_VERTEX,
- &vertex, sizeof(drmI810Vertex));
- age_imesa(imesa, sarea->last_enqueue);
- }
- else
- {
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, nbox);
- drm_clip_rect_t *b = (drm_clip_rect_t *)sarea->boxes;
-
- if (imesa->scissor) {
- sarea->nbox = 0;
-
- for ( ; i < nr ; i++) {
- b->x1 = pbox[i].x1 - imesa->drawX;
- b->y1 = pbox[i].y1 - imesa->drawY;
- b->x2 = pbox[i].x2 - imesa->drawX;
- b->y2 = pbox[i].y2 - imesa->drawY;
-
- if (intersect_rect(b, b, &imesa->scissor_rect)) {
- sarea->nbox++;
- b++;
- }
- }
-
- /* Culled?
- */
- if (!sarea->nbox) {
- if (nr < nbox) continue;
- vertex.used = 0;
- }
- } else {
- sarea->nbox = nr - i;
- for ( ; i < nr ; i++, b++) {
- b->x1 = pbox[i].x1 - imesa->drawX;
- b->y1 = pbox[i].y1 - imesa->drawY;
- b->x2 = pbox[i].x2 - imesa->drawX;
- b->y2 = pbox[i].y2 - imesa->drawY;
- }
- }
-
- /* Finished with the buffer?
- */
- if (nr == nbox)
- vertex.discard = 1;
-
- drmCommandWrite(imesa->driFd, DRM_I810_VERTEX,
- &vertex, sizeof(drmI810Vertex));
- age_imesa(imesa, imesa->sarea->last_enqueue);
- }
- }
-
- /* Reset imesa vars:
- */
- imesa->vertex_buffer = 0;
- imesa->vertex_addr = 0;
- imesa->vertex_low = 0;
- imesa->vertex_high = 0;
- imesa->vertex_last_prim = 0;
- imesa->dirty = 0;
- imesa->upload_cliprects = GL_FALSE;
-}
-
-void i810FlushPrimsGetBuffer( i810ContextPtr imesa )
-{
- LOCK_HARDWARE(imesa);
-
- if (imesa->vertex_buffer)
- i810FlushPrimsLocked( imesa );
-
- imesa->vertex_buffer = i810_get_buffer_ioctl( imesa );
- imesa->vertex_high = imesa->vertex_buffer->total;
- imesa->vertex_addr = (char *)imesa->vertex_buffer->address;
- imesa->vertex_low = 4; /* leave room for instruction header */
- imesa->vertex_last_prim = imesa->vertex_low;
- UNLOCK_HARDWARE(imesa);
-}
-
-
-void i810FlushPrims( i810ContextPtr imesa )
-{
- if (imesa->vertex_buffer) {
- LOCK_HARDWARE( imesa );
- i810FlushPrimsLocked( imesa );
- UNLOCK_HARDWARE( imesa );
- }
-}
-
-
-
-int i810_check_copy(int fd)
-{
- return(drmCommandNone(fd, DRM_I810_DOCOPY));
-}
-
-static void i810Flush( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- I810_FIREVERTICES( imesa );
-}
-
-static void i810Finish( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- i810DmaFinish( imesa );
-}
-
-void i810InitIoctlFuncs( struct dd_function_table *functions )
-{
- functions->Flush = i810Flush;
- functions->Clear = i810Clear;
- functions->Finish = i810Finish;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.h
deleted file mode 100644
index 61399ee7b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810ioctl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810ioctl.h,v 1.7 2002/10/30 12:51:33 alanh Exp $ */
-
-#ifndef I810_IOCTL_H
-#define I810_IOCTL_H
-
-#include "i810context.h"
-
-void i810EmitPrim( i810ContextPtr imesa );
-void i810FlushPrims( i810ContextPtr mmesa );
-void i810FlushPrimsLocked( i810ContextPtr mmesa );
-void i810FlushPrimsGetBuffer( i810ContextPtr imesa );
-
-void i810WaitAgeLocked( i810ContextPtr imesa, int age );
-void i810WaitAge( i810ContextPtr imesa, int age );
-void i810DmaFinish( i810ContextPtr imesa );
-void i810RegetLockQuiescent( i810ContextPtr imesa );
-void i810InitIoctlFuncs( struct dd_function_table *functions );
-void i810CopyBuffer( const __DRIdrawablePrivate *dpriv );
-void i810PageFlip( const __DRIdrawablePrivate *dpriv );
-int i810_check_copy(int fd);
-
-#define I810_STATECHANGE(imesa, flag) \
-do { \
- if (imesa->vertex_low != imesa->vertex_last_prim) \
- i810FlushPrims(imesa); \
- imesa->dirty |= flag; \
-} while (0) \
-
-
-#define I810_FIREVERTICES(imesa) \
-do { \
- if (imesa->vertex_buffer) { \
- i810FlushPrims(imesa); \
- } \
-} while (0)
-
-static __inline GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes )
-{
- if (imesa->vertex_low + bytes > imesa->vertex_high)
- i810FlushPrimsGetBuffer( imesa );
-
- {
- GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
- imesa->vertex_low += bytes;
- return start;
- }
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810render.c
deleted file mode 100644
index a31d54236..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810render.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Intel i810 DRI driver for Mesa 3.5
- *
- * Copyright (C) 1999-2000 Keith Whitwell 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 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware acceleration where possible.
- *
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tris.h"
-#include "i810state.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 0
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0
-
-
-static GLuint hw_prim[GL_POLYGON+1] = {
- 0,
- PR_LINES,
- 0,
- PR_LINESTRIP,
- PR_TRIANGLES,
- PR_TRISTRIP_0,
- PR_TRIFAN,
- 0,
- 0,
- PR_POLYGON
-};
-
-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
-};
-
-
-
-
-#define LOCAL_VARS i810ContextPtr imesa = I810_CONTEXT(ctx)
-#define INIT( prim ) do { \
- I810_STATECHANGE(imesa, 0); \
- i810RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] ); \
-} while (0)
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)imesa->vertex_high - (int)imesa->vertex_low) / (imesa->vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (I810_DMA_BUF_SZ-4) / (imesa->vertex_size * 4)
-
-#define ALLOC_VERTS( nr ) \
- i810AllocDmaLow( imesa, (nr) * imesa->vertex_size * 4)
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- i810_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
-
-#define FLUSH() I810_FIREVERTICES( imesa )
-
-
-#define TAG(x) i810_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean i810_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- /* Don't handle clipping or indexed vertices.
- */
- if (imesa->RenderIndex != 0 ||
- !i810_validate_render( ctx, VB )) {
- return GL_TRUE;
- }
-
- imesa->SetupNewInputs = VERT_BIT_POS;
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- i810_render_tab_verts[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 _i810_render_stage =
-{
- "i810 render",
- NULL,
- NULL,
- NULL,
- NULL,
- i810_run_render /* run */
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.c
deleted file mode 100644
index 991c7cb23..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.c
+++ /dev/null
@@ -1,471 +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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810screen.c,v 1.2 2002/10/30 12:51:33 alanh Exp $ */
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "framebuffer.h"
-#include "fbobject.h"
-#include "matrix.h"
-#include "renderbuffer.h"
-#include "simple_list.h"
-#include "utils.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810state.h"
-#include "i810tex.h"
-#include "i810span.h"
-#include "i810tris.h"
-#include "i810ioctl.h"
-
-#include "GL/internal/dri_interface.h"
-
-extern const struct dri_extension card_extensions[];
-
-static __GLcontextModes *fill_in_modes( __GLcontextModes *modes,
- unsigned pixel_bits,
- unsigned depth_bits,
- unsigned stencil_bits,
- const GLenum * db_modes,
- unsigned num_db_modes,
- int visType )
-{
- static const u_int8_t bits[1][4] = {
- { 5, 6, 5, 0 }
- };
-
- static const u_int32_t masks[1][4] = {
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }
- };
-
- unsigned i;
- unsigned j;
- const unsigned index = 0;
-
- for ( i = 0 ; i < num_db_modes ; i++ ) {
- for ( j = 0 ; j < 2 ; j++ ) {
-
- modes->redBits = bits[index][0];
- modes->greenBits = bits[index][1];
- modes->blueBits = bits[index][2];
- modes->alphaBits = bits[index][3];
- modes->redMask = masks[index][0];
- modes->greenMask = masks[index][1];
- modes->blueMask = masks[index][2];
- modes->alphaMask = masks[index][3];
- modes->rgbBits = modes->redBits + modes->greenBits
- + modes->blueBits + modes->alphaBits;
-
- modes->accumRedBits = 16 * j;
- modes->accumGreenBits = 16 * j;
- modes->accumBlueBits = 16 * j;
- modes->accumAlphaBits = (masks[index][3] != 0) ? 16 * j : 0;
- modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG;
-
- modes->stencilBits = stencil_bits;
- modes->depthBits = depth_bits;
-
- modes->visualType = visType;
- modes->renderType = GLX_RGBA_BIT;
- modes->drawableType = GLX_WINDOW_BIT;
- modes->rgbMode = GL_TRUE;
-
- if ( db_modes[i] == GLX_NONE ) {
- modes->doubleBufferMode = GL_FALSE;
- }
- else {
- modes->doubleBufferMode = GL_TRUE;
- modes->swapMethod = db_modes[i];
- }
-
- modes = modes->next;
- }
- }
-
- return modes;
-
-}
-
-
-static __GLcontextModes *
-i810FillInModes( 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;
- unsigned i;
-
- /* 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 */
- };
-
- int depth_buffer_modes[2][2];
-
-
- depth_buffer_modes[0][0] = depth_bits;
- depth_buffer_modes[1][0] = 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.
- */
- depth_buffer_modes[0][1] = 0;
- depth_buffer_modes[1][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;
-
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR );
- }
-
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR );
- }
-
- /* 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;
-
-}
-
-
-/* static int i810_malloc_proxy_buf(drmBufMapPtr buffers) */
-/* { */
-/* char *buffer; */
-/* drmBufPtr buf; */
-/* int i; */
-
-/* buffer = CALLOC(I810_DMA_BUF_SZ); */
-/* if(buffer == NULL) return -1; */
-/* for(i = 0; i < I810_DMA_BUF_NR; i++) { */
-/* buf = &(buffers->list[i]); */
-/* buf->address = (drmAddress)buffer; */
-/* } */
-/* return 0; */
-/* } */
-
-static drmBufMapPtr i810_create_empty_buffers(void)
-{
- drmBufMapPtr retval;
-
- retval = (drmBufMapPtr)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);
- if(retval->list == NULL) {
- ALIGN_FREE(retval);
- return NULL;
- }
- memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR);
- return retval;
-}
-
-
-static GLboolean
-i810InitDriver(__DRIscreenPrivate *sPriv)
-{
- i810ScreenPrivate *i810Screen;
- I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv;
-
- if (sPriv->devPrivSize != sizeof(I810DRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(I810DRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- i810Screen = (i810ScreenPrivate *)CALLOC(sizeof(i810ScreenPrivate));
- if (!i810Screen) {
- __driUtilMessage("i810InitDriver: alloc i810ScreenPrivate struct failed");
- return GL_FALSE;
- }
-
- i810Screen->driScrnPriv = sPriv;
- sPriv->private = (void *)i810Screen;
-
- i810Screen->deviceID=gDRIPriv->deviceID;
- i810Screen->width=gDRIPriv->width;
- i810Screen->height=gDRIPriv->height;
- i810Screen->mem=gDRIPriv->mem;
- i810Screen->cpp=gDRIPriv->cpp;
- i810Screen->fbStride=gDRIPriv->fbStride;
- i810Screen->fbOffset=gDRIPriv->fbOffset;
-
- if (gDRIPriv->bitsPerPixel == 15)
- i810Screen->fbFormat = DV_PF_555;
- else
- i810Screen->fbFormat = DV_PF_565;
-
- i810Screen->backOffset=gDRIPriv->backOffset;
- i810Screen->depthOffset=gDRIPriv->depthOffset;
- i810Screen->backPitch = gDRIPriv->auxPitch;
- i810Screen->backPitchBits = gDRIPriv->auxPitchBits;
- i810Screen->textureOffset=gDRIPriv->textureOffset;
- i810Screen->textureSize=gDRIPriv->textureSize;
- i810Screen->logTextureGranularity = gDRIPriv->logTextureGranularity;
-
- i810Screen->bufs = i810_create_empty_buffers();
- if (i810Screen->bufs == NULL) {
- __driUtilMessage("i810InitDriver: i810_create_empty_buffers() failed");
- FREE(i810Screen);
- return GL_FALSE;
- }
-
- i810Screen->back.handle = gDRIPriv->backbuffer;
- i810Screen->back.size = gDRIPriv->backbufferSize;
-
- if (drmMap(sPriv->fd,
- i810Screen->back.handle,
- i810Screen->back.size,
- (drmAddress *)&i810Screen->back.map) != 0) {
- FREE(i810Screen);
- sPriv->private = NULL;
- __driUtilMessage("i810InitDriver: drmMap failed");
- return GL_FALSE;
- }
-
- i810Screen->depth.handle = gDRIPriv->depthbuffer;
- i810Screen->depth.size = gDRIPriv->depthbufferSize;
-
- if (drmMap(sPriv->fd,
- i810Screen->depth.handle,
- i810Screen->depth.size,
- (drmAddress *)&i810Screen->depth.map) != 0) {
- FREE(i810Screen);
- drmUnmap(i810Screen->back.map, i810Screen->back.size);
- sPriv->private = NULL;
- __driUtilMessage("i810InitDriver: drmMap (2) failed");
- return GL_FALSE;
- }
-
- i810Screen->tex.handle = gDRIPriv->textures;
- i810Screen->tex.size = gDRIPriv->textureSize;
-
- if (drmMap(sPriv->fd,
- i810Screen->tex.handle,
- i810Screen->tex.size,
- (drmAddress *)&i810Screen->tex.map) != 0) {
- FREE(i810Screen);
- drmUnmap(i810Screen->back.map, i810Screen->back.size);
- drmUnmap(i810Screen->depth.map, i810Screen->depth.size);
- sPriv->private = NULL;
- __driUtilMessage("i810InitDriver: drmMap (3) failed");
- return GL_FALSE;
- }
-
- i810Screen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
- return GL_TRUE;
-}
-
-static void
-i810DestroyScreen(__DRIscreenPrivate *sPriv)
-{
- i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private;
-
- /* Need to unmap all the bufs and maps here:
- */
- drmUnmap(i810Screen->back.map, i810Screen->back.size);
- drmUnmap(i810Screen->depth.map, i810Screen->depth.size);
- drmUnmap(i810Screen->tex.map, i810Screen->tex.size);
-
- FREE(i810Screen);
- sPriv->private = NULL;
-}
-
-
-/**
- * Create a buffer which corresponds to the window.
- */
-static GLboolean
-i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- i810ScreenPrivate *screen = (i810ScreenPrivate *) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- /*screen->frontOffset*/0, screen->backPitch);
- i810SetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- i810SetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->backPitch);
- i810SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-static const struct __DriverAPIRec i810API = {
- .InitDriver = i810InitDriver,
- .DestroyScreen = i810DestroyScreen,
- .CreateContext = i810CreateContext,
- .DestroyContext = i810DestroyContext,
- .CreateBuffer = i810CreateBuffer,
- .DestroyBuffer = i810DestroyBuffer,
- .SwapBuffers = i810SwapBuffers,
- .MakeCurrent = i810MakeCurrent,
- .UnbindContext = i810UnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/**
- * 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 2, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "i810",
- 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, &i810API);
- if ( psp != NULL ) {
- *driver_modes = i810FillInModes( 16,
- 16, 0,
- 1);
- driInitExtensions( NULL, card_extensions, GL_TRUE );
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.h
deleted file mode 100644
index b29937665..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810screen.h
+++ /dev/null
@@ -1,99 +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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef _I810_INIT_H_
-#define _I810_INIT_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-
-typedef struct {
- drm_handle_t handle;
- drmSize size;
- char *map;
-} i810Region, *i810RegionPtr;
-
-typedef struct {
- i810Region front;
- i810Region back;
- i810Region depth;
- i810Region tex;
-
- int deviceID;
- int width;
- int height;
- int mem;
-
- int cpp; /* for front and back buffers */
- int bitsPerPixel;
-
- int fbFormat;
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int depthOffset;
-
- int backPitch;
- int backPitchBits;
-
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-
- __DRIscreenPrivate *driScrnPriv;
- drmBufMapPtr bufs;
- unsigned int sarea_priv_offset;
-} i810ScreenPrivate;
-
-
-extern GLboolean
-i810CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void
-i810DestroyContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i810UnbindContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
-extern void
-i810SwapBuffers(__DRIdrawablePrivate *driDrawPriv);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.c
deleted file mode 100644
index 1a976048c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.c
+++ /dev/null
@@ -1,201 +0,0 @@
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810span.h"
-#include "i810ioctl.h"
-#include "swrast/swrast.h"
-
-
-#define DBG 0
-
-#define LOCAL_VARS \
- i810ContextPtr imesa = I810_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i810ScreenPrivate *i810Screen = imesa->i810Screen; \
- GLuint pitch = i810Screen->backPitch; \
- GLuint height = dPriv->h; \
- GLushort p; \
- char *buf = (char *)(imesa->drawMap + \
- dPriv->x * 2 + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * 2 + \
- dPriv->y * pitch); \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- i810ContextPtr imesa = I810_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i810ScreenPrivate *i810Screen = imesa->i810Screen; \
- GLuint pitch = i810Screen->backPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(i810Screen->depth.map + \
- dPriv->x * 2 + \
- dPriv->y * pitch)
-
-#define INIT_MONO_PIXEL(p, color) \
- p = PACK_COLOR_565( color[0], color[1], color[2] )
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-/* 16 bit, 565 rgb color spanline and pixel functions
- */
-#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 *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
- rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) i810##x##_565
-#include "spantmp.h"
-
-/* 16 bit depthbuffer functions.
- */
-#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) i810##x##_16
-#include "depthtmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void i810SetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- (void) buffer;
-
- switch(bufferBit) {
- case BUFFER_BIT_FRONT_LEFT:
- if ( imesa->sarea->pf_current_page == 1)
- imesa->readMap = imesa->i810Screen->back.map;
- else
- imesa->readMap = (char*)imesa->driScreen->pFB;
- break;
- case BUFFER_BIT_BACK_LEFT:
- if ( imesa->sarea->pf_current_page == 1)
- imesa->readMap = (char*)imesa->driScreen->pFB;
- else
- imesa->readMap = imesa->i810Screen->back.map;
- break;
- default:
- ASSERT(0);
- break;
- }
- imesa->drawMap = imesa->readMap;
-}
-
-/* Move locking out to get reasonable span performance.
- */
-void i810SpanRenderStart( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- I810_FIREVERTICES(imesa);
- LOCK_HARDWARE(imesa);
- i810RegetLockQuiescent( imesa );
-}
-
-void i810SpanRenderFinish( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( imesa );
-}
-
-void i810InitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = i810SetBuffer;
-
-#if 0
- swdd->WriteRGBASpan = i810WriteRGBASpan_565;
- swdd->WriteRGBSpan = i810WriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = i810WriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = i810WriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = i810WriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = i810ReadRGBASpan_565;
- swdd->ReadRGBAPixels = i810ReadRGBAPixels_565;
-#endif
-
-#if 0
- swdd->ReadDepthSpan = i810ReadDepthSpan_16;
- swdd->WriteDepthSpan = i810WriteDepthSpan_16;
- swdd->ReadDepthPixels = i810ReadDepthPixels_16;
- swdd->WriteDepthPixels = i810WriteDepthPixels_16;
-#endif
-
- swdd->SpanRenderStart = i810SpanRenderStart;
- swdd->SpanRenderFinish = i810SpanRenderFinish;
-}
-
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- /* always 565 RGB */
- drb->Base.GetRow = i810ReadRGBASpan_565;
- drb->Base.GetValues = i810ReadRGBAPixels_565;
- drb->Base.PutRow = i810WriteRGBASpan_565;
- drb->Base.PutRowRGB = i810WriteRGBSpan_565;
- drb->Base.PutMonoRow = i810WriteMonoRGBASpan_565;
- drb->Base.PutValues = i810WriteRGBAPixels_565;
- drb->Base.PutMonoValues = i810WriteMonoRGBAPixels_565;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = i810ReadDepthSpan_16;
- drb->Base.GetValues = i810ReadDepthPixels_16;
- drb->Base.PutRow = i810WriteDepthSpan_16;
- drb->Base.PutMonoRow = i810WriteMonoDepthSpan_16;
- drb->Base.PutValues = i810WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- /* should never get here */
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.h
deleted file mode 100644
index 9aed253bd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810span.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _I810_SPAN_H
-#define _I810_SPAN_H
-
-#include "drirenderbuffer.h"
-
-extern void i810InitSpanFuncs( GLcontext *ctx );
-
-extern void i810SpanRenderFinish( GLcontext *ctx );
-extern void i810SpanRenderStart( GLcontext *ctx );
-
-extern void
-i810SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.c
deleted file mode 100644
index 62dc819b3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810state.c,v 1.9 2002/10/30 12:51:33 alanh Exp $ */
-
-#include <stdio.h>
-
-#include "glheader.h"
-#include "buffers.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-#include "colormac.h"
-
-#include "texmem.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810state.h"
-#include "i810tex.h"
-#include "i810vb.h"
-#include "i810tris.h"
-#include "i810ioctl.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-static __inline__ GLuint i810PackColor(GLuint format,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
-
- if (I810_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case DV_PF_555:
- return PACK_COLOR_1555( a, r, g, b );
- case DV_PF_565:
- return PACK_COLOR_565( r, g, b );
- default:
- fprintf(stderr, "unknown format %d\n", (int)format);
- return 0;
- }
-}
-
-
-static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint a = (ZA_UPDATE_ALPHAFUNC|ZA_UPDATE_ALPHAREF);
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- switch (ctx->Color.AlphaFunc) {
- case GL_NEVER: a |= ZA_ALPHA_NEVER; break;
- case GL_LESS: a |= ZA_ALPHA_LESS; break;
- case GL_GEQUAL: a |= ZA_ALPHA_GEQUAL; break;
- case GL_LEQUAL: a |= ZA_ALPHA_LEQUAL; break;
- case GL_GREATER: a |= ZA_ALPHA_GREATER; break;
- case GL_NOTEQUAL: a |= ZA_ALPHA_NOTEQUAL; break;
- case GL_EQUAL: a |= ZA_ALPHA_EQUAL; break;
- case GL_ALWAYS: a |= ZA_ALPHA_ALWAYS; break;
- default: return;
- }
-
- a |= ((refByte & 0xfc) << ZA_ALPHAREF_SHIFT);
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_ZA] &= ~(ZA_ALPHA_MASK|ZA_ALPHAREF_MASK);
- imesa->Setup[I810_CTXREG_ZA] |= a;
-}
-
-static void i810BlendEquationSeparate(GLcontext *ctx,
- GLenum modeRGB, GLenum modeA)
-{
- assert( modeRGB == modeA );
-
- /* Can only do GL_ADD equation in hardware */
- FALLBACK( I810_CONTEXT(ctx), I810_FALLBACK_BLEND_EQ,
- modeRGB != GL_FUNC_ADD);
-
- /* BlendEquation sets ColorLogicOpEnabled in an unexpected
- * manner.
- */
- FALLBACK( I810_CONTEXT(ctx), I810_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
-}
-
-static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint a = SDM_UPDATE_SRC_BLEND | SDM_UPDATE_DST_BLEND;
- GLboolean fallback = GL_FALSE;
-
- switch (ctx->Color.BlendSrcRGB) {
- case GL_ZERO: a |= SDM_SRC_ZERO; break;
- case GL_ONE: a |= SDM_SRC_ONE; break;
- case GL_SRC_COLOR: a |= SDM_SRC_SRC_COLOR; break;
- case GL_ONE_MINUS_SRC_COLOR: a |= SDM_SRC_INV_SRC_COLOR; break;
- case GL_SRC_ALPHA: a |= SDM_SRC_SRC_ALPHA; break;
- case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_SRC_INV_SRC_ALPHA; break;
- case GL_DST_ALPHA: a |= SDM_SRC_ONE; break;
- case GL_ONE_MINUS_DST_ALPHA: a |= SDM_SRC_ZERO; break;
- case GL_DST_COLOR: a |= SDM_SRC_DST_COLOR; break;
- case GL_ONE_MINUS_DST_COLOR: a |= SDM_SRC_INV_DST_COLOR; break;
-
- /* (f, f, f, 1), f = min(As, 1 - Ad) = min(As, 1 - 1) = 0
- * So (f, f, f, 1) = (0, 0, 0, 1). Since there is no destination alpha and
- * the only supported alpha operation is GL_FUNC_ADD, the result modulating
- * the source alpha with the alpha factor is largely irrelevant.
- */
- case GL_SRC_ALPHA_SATURATE: a |= SDM_SRC_ZERO; break;
-
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- fallback = GL_TRUE;
- break;
- default:
- return;
- }
-
- switch (ctx->Color.BlendDstRGB) {
- case GL_ZERO: a |= SDM_DST_ZERO; break;
- case GL_ONE: a |= SDM_DST_ONE; break;
- case GL_SRC_COLOR: a |= SDM_DST_SRC_COLOR; break;
- case GL_ONE_MINUS_SRC_COLOR: a |= SDM_DST_INV_SRC_COLOR; break;
- case GL_SRC_ALPHA: a |= SDM_DST_SRC_ALPHA; break;
- case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_DST_INV_SRC_ALPHA; break;
- case GL_DST_ALPHA: a |= SDM_DST_ONE; break;
- case GL_ONE_MINUS_DST_ALPHA: a |= SDM_DST_ZERO; break;
- case GL_DST_COLOR: a |= SDM_DST_DST_COLOR; break;
- case GL_ONE_MINUS_DST_COLOR: a |= SDM_DST_INV_DST_COLOR; break;
-
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- fallback = GL_TRUE;
- break;
- default:
- return;
- }
-
- FALLBACK( imesa, I810_FALLBACK_BLEND_FUNC, fallback);
- if (!fallback) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_SDM] &= ~(SDM_SRC_MASK|SDM_DST_MASK);
- imesa->Setup[I810_CTXREG_SDM] |= a;
- }
-}
-
-
-
-static void i810DepthFunc(GLcontext *ctx, GLenum func)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- int zmode;
-
- switch(func) {
- case GL_NEVER: zmode = LCS_Z_NEVER; break;
- case GL_ALWAYS: zmode = LCS_Z_ALWAYS; break;
- case GL_LESS: zmode = LCS_Z_LESS; break;
- case GL_LEQUAL: zmode = LCS_Z_LEQUAL; break;
- case GL_EQUAL: zmode = LCS_Z_EQUAL; break;
- case GL_GREATER: zmode = LCS_Z_GREATER; break;
- case GL_GEQUAL: zmode = LCS_Z_GEQUAL; break;
- case GL_NOTEQUAL: zmode = LCS_Z_NOTEQUAL; break;
- default: return;
- }
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_Z_MASK;
- imesa->Setup[I810_CTXREG_LCS] |= zmode;
-}
-
-static void i810DepthMask(GLcontext *ctx, GLboolean flag)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
-
- if (flag)
- imesa->Setup[I810_CTXREG_B2] |= B2_ZB_WRITE_ENABLE;
- else
- imesa->Setup[I810_CTXREG_B2] &= ~B2_ZB_WRITE_ENABLE;
-}
-
-
-/* =============================================================
- * Polygon stipple
- *
- * The i810 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i810PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- imesa->reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 0 ; j < 4; j++)
- for (i = 0 ; i < 4 ; i++)
- if (*m++ != p[j]) {
- imesa->stipple_in_hw = 0;
- return;
- }
-
- newMask = ((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12);
-
- if (newMask == 0xffff) {
- /* this is needed to make conform pass */
- imesa->stipple_in_hw = 0;
- return;
- }
-
- imesa->Setup[I810_CTXREG_ST1] &= ~0xffff;
- imesa->Setup[I810_CTXREG_ST1] |= newMask;
- imesa->stipple_in_hw = 1;
-
- if (active)
- imesa->Setup[I810_CTXREG_ST1] |= ST1_ENABLE;
-}
-
-
-
-/* =============================================================
- * Hardware clipping
- */
-
-
-static void i810Scissor( GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- if (ctx->Scissor.Enabled) {
- I810_FIREVERTICES(imesa); /* don't pipeline cliprect changes */
- imesa->upload_cliprects = GL_TRUE;
- }
-
- imesa->scissor_rect.x1 = x;
- imesa->scissor_rect.y1 = imesa->driDrawable->h - (y + h);
- imesa->scissor_rect.x2 = x + w;
- imesa->scissor_rect.y2 = imesa->driDrawable->h - y;
-}
-
-
-static void i810LogicOp( GLcontext *ctx, GLenum opcode )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- FALLBACK( imesa, I810_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled && opcode != GL_COPY) );
-}
-
-/* Fallback to swrast for select and feedback.
- */
-static void i810RenderMode( GLcontext *ctx, GLenum mode )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- FALLBACK( imesa, I810_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-
-void i810DrawBuffer(GLcontext *ctx, GLenum mode )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- int front = 0;
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- front = 1;
- break;
- case BUFFER_BIT_BACK_LEFT:
- front = 0;
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- if ( imesa->sarea->pf_current_page == 1 )
- front ^= 1;
-
- FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_FALSE );
- I810_FIREVERTICES(imesa);
- I810_STATECHANGE(imesa, I810_UPLOAD_BUFFERS);
-
- if (front)
- {
- imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->fbOffset |
- imesa->i810Screen->backPitchBits);
- i810XMesaSetFrontClipRects( imesa );
- }
- else
- {
- imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->backOffset |
- imesa->i810Screen->backPitchBits);
- i810XMesaSetBackClipRects( imesa );
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-
-static void i810ReadBuffer(GLcontext *ctx, GLenum mode )
-{
- /* XXX anything? */
-}
-
-
-static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] )
-{
- i810ContextPtr imesa = I810_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]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
- imesa->ClearColor = i810PackColor( imesa->i810Screen->fbFormat,
- c[0], c[1], c[2], c[3] );
-}
-
-
-/* =============================================================
- * Culling - the i810 isn't quite as clean here as the rest of
- * its interfaces, but it's not bad.
- */
-static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint mode = LCS_CULL_BOTH;
-
- if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = LCS_CULL_CW;
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (LCS_CULL_CW ^ LCS_CULL_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (LCS_CULL_CW ^ LCS_CULL_CCW);
- }
-
- imesa->LcsCullMode = mode;
-
- if (ctx->Polygon.CullFlag)
- {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_CULL_MASK;
- imesa->Setup[I810_CTXREG_LCS] |= mode;
- }
-}
-
-
-static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- int width = (int)ctx->Line._Width;
-
- imesa->LcsLineWidth = 0;
- if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0;
- if (width & 2) imesa->LcsLineWidth |= LCS_LINEWIDTH_2_0;
-
- if (imesa->reduced_primitive == GL_LINES) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_3_0;
- imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsLineWidth;
- }
-}
-
-static void i810PointSize( GLcontext *ctx, GLfloat sz )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- int size = (int)ctx->Point._Size;
-
- imesa->LcsPointSize = 0;
- if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
- if (size & 2) imesa->LcsPointSize |= LCS_LINEWIDTH_2_0;
-
- if (imesa->reduced_primitive == GL_POINTS) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_3_0;
- imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsPointSize;
- }
-}
-
-/* =============================================================
- * Color masks
- */
-
-static void i810ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint tmp = 0;
-
- if (r && g && b) {
- tmp = imesa->Setup[I810_CTXREG_B2] | B2_FB_WRITE_ENABLE;
- FALLBACK( imesa, I810_FALLBACK_COLORMASK, GL_FALSE );
- } else if (!r && !g && !b) {
- tmp = imesa->Setup[I810_CTXREG_B2] & ~B2_FB_WRITE_ENABLE;
- FALLBACK( imesa, I810_FALLBACK_COLORMASK, GL_FALSE );
- } else {
- FALLBACK( imesa, I810_FALLBACK_COLORMASK, GL_TRUE );
- return;
- }
-
- if (tmp != imesa->Setup[I810_CTXREG_B2]) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B2] = tmp;
- imesa->dirty |= I810_UPLOAD_CTX;
- }
-}
-
-/* Seperate specular not fully implemented on the i810.
- */
-static void i810LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL)
- {
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- FALLBACK( imesa, I810_FALLBACK_SPECULAR,
- (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR));
- }
-}
-
-/* But the 815 has it...
- */
-static void i810LightModelfv_i815(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL)
- {
- i810ContextPtr imesa = I810_CONTEXT( ctx );
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- imesa->Setup[I810_CTXREG_B1] |= B1_SPEC_ENABLE;
- else
- imesa->Setup[I810_CTXREG_B1] &= ~B1_SPEC_ENABLE;
- }
-}
-
-/* In Mesa 3.5 we can reliably do native flatshading.
- */
-static void i810ShadeModel(GLcontext *ctx, GLenum mode)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- if (mode == GL_FLAT)
- imesa->Setup[I810_CTXREG_LCS] |= LCS_INTERP_FLAT;
- else
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_INTERP_FLAT;
-}
-
-
-
-/* =============================================================
- * Fog
- */
-static void i810Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
-
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_FOG] = ((GFX_OP_FOG_COLOR | color) &
- ~FOG_RESERVED_MASK);
- }
-}
-
-
-/* =============================================================
- */
-static void i810Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- switch(cap) {
- case GL_ALPHA_TEST:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_ALPHA_TEST_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_ALPHA_TEST_ENABLE;
- break;
- case GL_BLEND:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_BLEND_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_BLEND_ENABLE;
-
- /* For some reason enable(GL_BLEND) affects ColorLogicOpEnabled.
- */
- FALLBACK( imesa, I810_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
- case GL_DEPTH_TEST:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_Z_TEST_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_Z_TEST_ENABLE;
- break;
- case GL_SCISSOR_TEST:
- /* XXX without these next two lines, conform's scissor test fails */
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- I810_STATECHANGE(imesa, I810_UPLOAD_BUFFERS);
- I810_FIREVERTICES(imesa); /* don't pipeline cliprect changes */
- imesa->upload_cliprects = GL_TRUE;
- imesa->scissor = state;
- break;
- case GL_POLYGON_STIPPLE:
- if (imesa->stipple_in_hw && imesa->reduced_primitive == GL_TRIANGLES)
- {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_ST1] &= ~ST1_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_ST1] |= ST1_ENABLE;
- }
- break;
- case GL_LINE_SMOOTH:
- /* Need to fatten the lines by .5, or they disappear...
- */
- if (imesa->reduced_primitive == GL_LINES) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_AA] &= ~AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_0_5;
- if (state) {
- imesa->Setup[I810_CTXREG_AA] |= AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] |= LCS_LINEWIDTH_0_5;
- }
- }
- break;
- case GL_POINT_SMOOTH:
- if (imesa->reduced_primitive == GL_POINTS) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_AA] &= ~AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_0_5;
- if (state) {
- imesa->Setup[I810_CTXREG_AA] |= AA_ENABLE;
- imesa->Setup[I810_CTXREG_LCS] |= LCS_LINEWIDTH_0_5;
- }
- }
- break;
- case GL_POLYGON_SMOOTH:
- if (imesa->reduced_primitive == GL_TRIANGLES) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_AA] &= ~AA_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_AA] |= AA_ENABLE;
- }
- break;
- case GL_FOG:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_B1] &= ~B1_FOG_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_B1] |= B1_FOG_ENABLE;
- break;
- case GL_CULL_FACE:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_LCS] &= ~LCS_CULL_MASK;
- if (state)
- imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsCullMode;
- else
- imesa->Setup[I810_CTXREG_LCS] |= LCS_CULL_DISABLE;
- break;
- case GL_TEXTURE_2D:
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- if (ctx->Texture.CurrentUnit == 0) {
- imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL0_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL0_ENABLE;
- } else {
- imesa->Setup[I810_CTXREG_MT] &= ~MT_TEXEL1_ENABLE;
- if (state)
- imesa->Setup[I810_CTXREG_MT] |= MT_TEXEL1_ENABLE;
- }
- break;
- case GL_COLOR_LOGIC_OP:
- FALLBACK( imesa, I810_FALLBACK_LOGICOP,
- (state && ctx->Color.LogicOp != GL_COPY));
- break;
- case GL_STENCIL_TEST:
- FALLBACK( imesa, I810_FALLBACK_STENCIL, state );
- break;
- default:
- ;
- }
-}
-
-
-
-
-
-
-
-/* =============================================================
- */
-
-
-
-
-void i810EmitDrawingRectangle( i810ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- i810ScreenPrivate *i810Screen = imesa->i810Screen;
- int x0 = imesa->drawX;
- int y0 = imesa->drawY;
- int x1 = x0 + dPriv->w;
- int y1 = y0 + dPriv->h;
- GLuint dr2, dr3, dr4;
-
-
- /* Coordinate origin of the window - may be offscreen.
- */
- dr4 = imesa->BufferSetup[I810_DESTREG_DR4] = ((y0<<16) |
- (((unsigned)x0)&0xFFFF));
-
- /* Clip to screen.
- */
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > i810Screen->width-1) x1 = i810Screen->width-1;
- if (y1 > i810Screen->height-1) y1 = i810Screen->height-1;
-
-
- /* Onscreen drawing rectangle.
- */
- dr2 = imesa->BufferSetup[I810_DESTREG_DR2] = ((y0<<16) | x0);
- dr3 = imesa->BufferSetup[I810_DESTREG_DR3] = (((y1+1)<<16) | (x1+1));
-
-
- imesa->dirty |= I810_UPLOAD_BUFFERS;
-}
-
-
-
-static void i810CalcViewport( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = imesa->ViewportMatrix.m;
-
- /* See also i810_translate_vertex. SUBPIXEL adjustments can be done
- * via state vars, too.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + imesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * (1.0 / 0xffff);
- m[MAT_TZ] = v[MAT_TZ] * (1.0 / 0xffff);
-}
-
-static void i810Viewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- i810CalcViewport( ctx );
-}
-
-static void i810DepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- i810CalcViewport( ctx );
-}
-
-
-
-void i810PrintDirty( const char *msg, GLuint state )
-{
- fprintf(stderr, "%s (0x%x): %s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & I810_UPLOAD_TEX0) ? "upload-tex0, " : "",
- (state & I810_UPLOAD_TEX1) ? "upload-tex1, " : "",
- (state & I810_UPLOAD_CTX) ? "upload-ctx, " : "",
- (state & I810_UPLOAD_BUFFERS) ? "upload-bufs, " : ""
- );
-}
-
-
-
-void i810InitState( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- i810ScreenPrivate *i810Screen = imesa->i810Screen;
-
- memset(imesa->Setup, 0, sizeof(imesa->Setup));
-
- imesa->Setup[I810_CTXREG_VF] = 0;
-
- imesa->Setup[I810_CTXREG_MT] = (GFX_OP_MAP_TEXELS |
- MT_UPDATE_TEXEL1_STATE |
- MT_TEXEL1_COORD1 |
- MT_TEXEL1_MAP1 |
- MT_TEXEL1_DISABLE |
- MT_UPDATE_TEXEL0_STATE |
- MT_TEXEL0_COORD0 |
- MT_TEXEL0_MAP0 |
- MT_TEXEL0_DISABLE);
-
- imesa->Setup[I810_CTXREG_MC0] = ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ITERATED_COLOR |
- MC_ARG1_DONT_REPLICATE_ALPHA |
- MC_ARG1_DONT_INVERT |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_ARG2_DONT_REPLICATE_ALPHA |
- MC_ARG2_DONT_INVERT |
- MC_UPDATE_OP |
- MC_OP_ARG1 );
-
- imesa->Setup[I810_CTXREG_MC1] = ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ONE |
- MC_ARG1_DONT_REPLICATE_ALPHA |
- MC_ARG1_DONT_INVERT |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_ARG2_DONT_REPLICATE_ALPHA |
- MC_ARG2_DONT_INVERT |
- MC_UPDATE_OP |
- MC_OP_DISABLE );
-
-
- imesa->Setup[I810_CTXREG_MC2] = ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_2 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_CURRENT_COLOR |
- MC_ARG1_REPLICATE_ALPHA |
- MC_ARG1_DONT_INVERT |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_ARG2_DONT_REPLICATE_ALPHA |
- MC_ARG2_DONT_INVERT |
- MC_UPDATE_OP |
- MC_OP_DISABLE );
-
-
- imesa->Setup[I810_CTXREG_MA0] = ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_ARG1_DONT_INVERT |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_ARG2_DONT_INVERT |
- MA_UPDATE_OP |
- MA_OP_ARG1 );
-
-
- imesa->Setup[I810_CTXREG_MA1] = ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_ARG1_DONT_INVERT |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_ARG2_DONT_INVERT |
- MA_UPDATE_OP |
- MA_OP_ARG1 );
-
-
- imesa->Setup[I810_CTXREG_MA2] = ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_2 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_ARG1_DONT_INVERT |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_ARG2_DONT_INVERT |
- MA_UPDATE_OP |
- MA_OP_ARG1 );
-
-
- imesa->Setup[I810_CTXREG_SDM] = ( GFX_OP_SRC_DEST_MONO |
- SDM_UPDATE_MONO_ENABLE |
- 0 |
- SDM_UPDATE_SRC_BLEND |
- SDM_SRC_ONE |
- SDM_UPDATE_DST_BLEND |
- SDM_DST_ZERO );
-
- /* Use for colormask:
- */
- imesa->Setup[I810_CTXREG_CF0] = GFX_OP_COLOR_FACTOR;
- imesa->Setup[I810_CTXREG_CF1] = 0xffffffff;
-
- imesa->Setup[I810_CTXREG_ZA] = (GFX_OP_ZBIAS_ALPHAFUNC |
- ZA_UPDATE_ALPHAFUNC |
- ZA_ALPHA_ALWAYS |
- ZA_UPDATE_ZBIAS |
- 0 |
- ZA_UPDATE_ALPHAREF |
- 0x0);
-
- imesa->Setup[I810_CTXREG_FOG] = (GFX_OP_FOG_COLOR |
- (0xffffff & ~FOG_RESERVED_MASK));
-
- /* Choose a pipe
- */
- imesa->Setup[I810_CTXREG_B1] = ( GFX_OP_BOOL_1 |
- B1_UPDATE_SPEC_SETUP_ENABLE |
- 0 |
- B1_UPDATE_ALPHA_SETUP_ENABLE |
- B1_ALPHA_SETUP_ENABLE |
- B1_UPDATE_CI_KEY_ENABLE |
- 0 |
- B1_UPDATE_CHROMAKEY_ENABLE |
- 0 |
- B1_UPDATE_Z_BIAS_ENABLE |
- 0 |
- B1_UPDATE_SPEC_ENABLE |
- 0 |
- B1_UPDATE_FOG_ENABLE |
- 0 |
- B1_UPDATE_ALPHA_TEST_ENABLE |
- 0 |
- B1_UPDATE_BLEND_ENABLE |
- 0 |
- B1_UPDATE_Z_TEST_ENABLE |
- 0 );
-
- imesa->Setup[I810_CTXREG_B2] = ( GFX_OP_BOOL_2 |
- B2_UPDATE_MAP_CACHE_ENABLE |
- B2_MAP_CACHE_ENABLE |
- B2_UPDATE_ALPHA_DITHER_ENABLE |
- 0 |
- B2_UPDATE_FOG_DITHER_ENABLE |
- 0 |
- B2_UPDATE_SPEC_DITHER_ENABLE |
- 0 |
- B2_UPDATE_RGB_DITHER_ENABLE |
- B2_RGB_DITHER_ENABLE |
- B2_UPDATE_FB_WRITE_ENABLE |
- B2_FB_WRITE_ENABLE |
- B2_UPDATE_ZB_WRITE_ENABLE |
- B2_ZB_WRITE_ENABLE );
-
- imesa->Setup[I810_CTXREG_LCS] = ( GFX_OP_LINEWIDTH_CULL_SHADE_MODE |
- LCS_UPDATE_ZMODE |
- LCS_Z_LESS |
- LCS_UPDATE_LINEWIDTH |
- LCS_LINEWIDTH_1_0 |
- LCS_UPDATE_ALPHA_INTERP |
- LCS_ALPHA_INTERP |
- LCS_UPDATE_FOG_INTERP |
- 0 |
- LCS_UPDATE_SPEC_INTERP |
- 0 |
- LCS_UPDATE_RGB_INTERP |
- LCS_RGB_INTERP |
- LCS_UPDATE_CULL_MODE |
- LCS_CULL_DISABLE);
-
- imesa->LcsCullMode = LCS_CULL_CW;
- imesa->LcsLineWidth = LCS_LINEWIDTH_1_0;
- imesa->LcsPointSize = LCS_LINEWIDTH_1_0;
-
- imesa->Setup[I810_CTXREG_PV] = ( GFX_OP_PV_RULE |
- PV_UPDATE_PIXRULE |
- PV_PIXRULE_ENABLE |
- PV_UPDATE_LINELIST |
- PV_LINELIST_PV1 |
- PV_UPDATE_TRIFAN |
- PV_TRIFAN_PV2 |
- PV_UPDATE_TRISTRIP |
- PV_TRISTRIP_PV2 );
-
-
- imesa->Setup[I810_CTXREG_ST0] = GFX_OP_STIPPLE;
- imesa->Setup[I810_CTXREG_ST1] = 0;
-
- imesa->Setup[I810_CTXREG_AA] = ( GFX_OP_ANTIALIAS |
- AA_UPDATE_EDGEFLAG |
- 0 |
- AA_UPDATE_POLYWIDTH |
- AA_POLYWIDTH_05 |
- AA_UPDATE_LINEWIDTH |
- AA_LINEWIDTH_05 |
- AA_UPDATE_BB_EXPANSION |
- 0 |
- AA_UPDATE_AA_ENABLE |
- 0 );
-
- memset(imesa->BufferSetup, 0, sizeof(imesa->BufferSetup));
- imesa->BufferSetup[I810_DESTREG_DI0] = CMD_OP_DESTBUFFER_INFO;
-
- if (imesa->glCtx->Visual.doubleBufferMode && imesa->sarea->pf_current_page == 0) {
- /* use back buffer by default */
- imesa->drawMap = i810Screen->back.map;
- imesa->readMap = i810Screen->back.map;
- imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->backOffset |
- i810Screen->backPitchBits);
- } else {
- /* use front buffer by default */
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- imesa->BufferSetup[I810_DESTREG_DI1] = (i810Screen->fbOffset |
- i810Screen->backPitchBits);
- }
-
- imesa->BufferSetup[I810_DESTREG_DV0] = GFX_OP_DESTBUFFER_VARS;
- imesa->BufferSetup[I810_DESTREG_DV1] = (DV_HORG_BIAS_OGL |
- DV_VORG_BIAS_OGL |
- i810Screen->fbFormat);
-
- imesa->BufferSetup[I810_DESTREG_DR0] = GFX_OP_DRAWRECT_INFO;
- imesa->BufferSetup[I810_DESTREG_DR1] = DR1_RECT_CLIP_ENABLE;
-}
-
-
-static void i810InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- I810_CONTEXT(ctx)->new_state |= new_state;
-}
-
-
-void i810InitStateFuncs(GLcontext *ctx)
-{
- /* Callbacks for internal Mesa events.
- */
- ctx->Driver.UpdateState = i810InvalidateState;
-
- /* API callbacks
- */
- ctx->Driver.AlphaFunc = i810AlphaFunc;
- ctx->Driver.BlendEquationSeparate = i810BlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = i810BlendFuncSeparate;
- ctx->Driver.ClearColor = i810ClearColor;
- ctx->Driver.ColorMask = i810ColorMask;
- ctx->Driver.CullFace = i810CullFaceFrontFace;
- ctx->Driver.DepthFunc = i810DepthFunc;
- ctx->Driver.DepthMask = i810DepthMask;
- ctx->Driver.Enable = i810Enable;
- ctx->Driver.Fogfv = i810Fogfv;
- ctx->Driver.FrontFace = i810CullFaceFrontFace;
- ctx->Driver.LineWidth = i810LineWidth;
- ctx->Driver.LogicOpcode = i810LogicOp;
- ctx->Driver.PolygonStipple = i810PolygonStipple;
- ctx->Driver.RenderMode = i810RenderMode;
- ctx->Driver.Scissor = i810Scissor;
- ctx->Driver.DrawBuffer = i810DrawBuffer;
- ctx->Driver.ReadBuffer = i810ReadBuffer;
- ctx->Driver.ShadeModel = i810ShadeModel;
- ctx->Driver.DepthRange = i810DepthRange;
- ctx->Driver.Viewport = i810Viewport;
- ctx->Driver.PointSize = i810PointSize;
-
- if (IS_I815(I810_CONTEXT(ctx))) {
- ctx->Driver.LightModelfv = i810LightModelfv_i815;
- } else {
- ctx->Driver.LightModelfv = i810LightModelfv;
- }
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.h
deleted file mode 100644
index 118b07549..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810state.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _I810_STATE_H
-#define _I810_STATE_H
-
-#include "i810context.h"
-
-extern void i810InitState( GLcontext *ctx );
-extern void i810InitStateFuncs( GLcontext *ctx );
-extern void i810PrintDirty( const char *msg, GLuint state );
-extern void i810DrawBuffer(GLcontext *ctx, GLenum mode );
-
-extern void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) i810Fallback( imesa, bit, mode )
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c
deleted file mode 100644
index 0aba8e8aa..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tex.c,v 1.9 2002/10/30 12:51:33 alanh Exp $ */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texmem.h"
-#include "texobj.h"
-#include "swrast/swrast.h"
-#include "colormac.h"
-#include "texobj.h"
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tex.h"
-#include "i810state.h"
-#include "i810ioctl.h"
-
-
-/*
- * Compute the 'S2.4' lod bias factor from the floating point OpenGL bias.
- */
-static GLuint i810ComputeLodBias(GLfloat bias)
-{
- int b = (int) (bias * 16.0) + 12;
- if (b > 63)
- b = 63;
- else if (b < -64)
- b = -64;
- return (GLuint) (b & MLC_LOD_BIAS_MASK);
-}
-
-
-static void i810SetTexWrapping(i810TextureObjectPtr tex,
- GLenum swrap, GLenum twrap)
-{
- tex->Setup[I810_TEXREG_MCS] &= ~(MCS_U_STATE_MASK| MCS_V_STATE_MASK);
-
- switch( swrap ) {
- case GL_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_U_WRAP;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I810_TEXREG_MCS] |= MCS_U_CLAMP;
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_U_MIRROR;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch( twrap ) {
- case GL_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_V_WRAP;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I810_TEXREG_MCS] |= MCS_V_CLAMP;
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I810_TEXREG_MCS] |= MCS_V_MIRROR;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-}
-
-
-static void i810SetTexFilter(i810ContextPtr imesa,
- i810TextureObjectPtr t,
- GLenum minf, GLenum magf,
- GLfloat bias)
-{
- t->Setup[I810_TEXREG_MF] &= ~(MF_MIN_MASK|
- MF_MAG_MASK|
- MF_MIP_MASK);
- t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
-
- switch (minf) {
- case GL_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_NONE;
- break;
- case GL_LINEAR:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_NEAREST;
- if (magf == GL_LINEAR) {
- /*bias -= 0.5;*/ /* this doesn't work too good */
- }
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- if (IS_I815(imesa))
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_LINEAR;
- else
- t->Setup[I810_TEXREG_MF] |= MF_MIN_NEAREST | MF_MIP_DITHER;
- /*
- if (magf == GL_LINEAR) {
- bias -= 0.5;
- }
- */
- bias -= 0.5; /* always biasing here looks better */
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- if (IS_I815(imesa))
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_LINEAR;
- else
- t->Setup[I810_TEXREG_MF] |= MF_MIN_LINEAR | MF_MIP_DITHER;
- break;
- default:
- return;
- }
-
- switch (magf) {
- case GL_NEAREST:
- t->Setup[I810_TEXREG_MF] |= MF_MAG_NEAREST;
- break;
- case GL_LINEAR:
- t->Setup[I810_TEXREG_MF] |= MF_MAG_LINEAR;
- break;
- default:
- return;
- }
-
- t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(bias);
-}
-
-
-static void
-i810SetTexBorderColor( i810TextureObjectPtr t, GLubyte color[4] )
-{
- /* Need a fallback.
- */
-}
-
-
-static i810TextureObjectPtr
-i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj )
-{
- i810TextureObjectPtr t;
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- t = CALLOC_STRUCT( i810_texture_object_t );
- texObj->DriverData = t;
- if ( t != NULL ) {
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->Setup[I810_TEXREG_MI0] = GFX_OP_MAP_INFO;
- t->Setup[I810_TEXREG_MI1] = MI1_MAP_0;
- t->Setup[I810_TEXREG_MI2] = MI2_DIMENSIONS_ARE_LOG2;
- t->Setup[I810_TEXREG_MLC] = (GFX_OP_MAP_LOD_CTL |
- MLC_MAP_0 |
- /*MLC_DITHER_WEIGHT_FULL |*/
- MLC_DITHER_WEIGHT_12 |
- MLC_UPDATE_LOD_BIAS |
- 0x0);
- t->Setup[I810_TEXREG_MCS] = (GFX_OP_MAP_COORD_SETS |
- MCS_COORD_0 |
- MCS_UPDATE_NORMALIZED |
- MCS_NORMALIZED_COORDS |
- MCS_UPDATE_V_STATE |
- MCS_V_WRAP |
- MCS_UPDATE_U_STATE |
- MCS_U_WRAP);
- t->Setup[I810_TEXREG_MF] = (GFX_OP_MAP_FILTER |
- MF_MAP_0 |
- MF_UPDATE_ANISOTROPIC |
- MF_UPDATE_MIP_FILTER |
- MF_UPDATE_MAG_FILTER |
- MF_UPDATE_MIN_FILTER);
-
- make_empty_list( & t->base );
-
- i810SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
- /*i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/
- i810SetTexFilter( imesa, t, texObj->MinFilter, texObj->MagFilter, bias );
- i810SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static void i810TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
-
- if (!t)
- return;
-
- if ( target != GL_TEXTURE_2D )
- return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting imesa->new_state means that
- * i810UpdateTextureState() 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;
- i810SetTexFilter( imesa, t, tObj->MinFilter, tObj->MagFilter, bias );
- }
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- i810SetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- i810SetTexBorderColor( t, tObj->_BorderChan );
- 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.
- */
- I810_FIREVERTICES( I810_CONTEXT(ctx) );
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- if (t == imesa->CurrentTexObj[0]) {
- I810_STATECHANGE( imesa, I810_UPLOAD_TEX0 );
- }
-
- if (t == imesa->CurrentTexObj[1]) {
- I810_STATECHANGE( imesa, I810_UPLOAD_TEX1 );
- }
-}
-
-
-/**
- * Setup hardware bits for new texture environment settings.
- *
- * \todo
- * Determine whether or not \c param can be used instead of
- * \c texUnit->EnvColor in the \c GL_TEXTURE_ENV_COLOR case.
- */
-static void i810TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- const GLuint unit = ctx->Texture.CurrentUnit;
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- /* 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: {
- GLubyte c[4];
- GLuint envColor;
-
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
- envColor = PACK_COLOR_8888( c[3], c[0], c[1], c[2] );
-
- if (imesa->Setup[I810_CTXREG_CF1] != envColor) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_CF1] = envColor;
- }
- break;
- }
-
- case GL_TEXTURE_ENV_MODE:
- imesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
-
- case GL_TEXTURE_LOD_BIAS: {
- if ( texUnit->_Current != NULL ) {
- const struct gl_texture_object *tObj = texUnit->_Current;
- i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
-
- t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
- t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
- }
- break;
- }
-
- default:
- break;
- }
-}
-
-
-
-#if 0
-static void i810TexImage1D( 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 )
-{
- i810TextureObjectPtr t = (i810TextureObjectPtr) texObj->DriverData;
- if (t) {
- i810SwapOutTexObj( imesa, t );
- }
-}
-
-static void i810TexSubImage1D( 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 )
-{
-}
-#endif
-
-
-static void i810TexImage2D( 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 )
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
- if (t) {
- I810_FIREVERTICES( I810_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) i810AllocTexObj( ctx, texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-}
-
-static void i810TexSubImage2D( 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 )
-{
- driTextureObject *t = (driTextureObject *)texObj->DriverData;
- if (t) {
- I810_FIREVERTICES( I810_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-}
-
-
-static void i810BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- assert( (target != GL_TEXTURE_2D) || (tObj->DriverData != NULL) );
-}
-
-
-static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
- if (t) {
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- if (imesa)
- I810_FIREVERTICES( imesa );
- driDestroyTextureObject( t );
- }
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
-}
-
-/**
- * Choose a Mesa texture format to match the requested format.
- *
- * \todo
- * Determine why \c _mesa_texformat_al88 doesn't work right for
- * \c GL_LUMINANCE_ALPHA textures. It seems to work fine for \c GL_INTENSITY,
- * but \c GL_LUMINANCE_ALPHA gets some red bands in progs/demos/texenv.
- */
-static const struct gl_texture_format *
-i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- return &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
-
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_al88;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_rgb565;
-
- 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:
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
-#if 0
- return &_mesa_texformat_al88;
-#else
- return &_mesa_texformat_argb4444;
-#endif
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-/**
- * 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 *
-i810NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- i810AllocTexObj( ctx, obj );
- return obj;
-}
-
-void i810InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->ChooseTextureFormat = i810ChooseTextureFormat;
- functions->TexImage2D = i810TexImage2D;
- functions->TexSubImage2D = i810TexSubImage2D;
- functions->BindTexture = i810BindTexture;
- functions->NewTextureObject = i810NewTextureObject;
- functions->DeleteTexture = i810DeleteTexture;
- functions->TexParameter = i810TexParameter;
- functions->TexEnv = i810TexEnv;
- functions->IsTextureResident = driIsTextureResident;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.h
deleted file mode 100644
index c6ab4c8e6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tex.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- *
- */
-
-#ifndef I810TEX_INC
-#define I810TEX_INC
-
-#include "mtypes.h"
-#include "mm.h"
-
-#include "i810context.h"
-#include "i810_3d_reg.h"
-#include "texmem.h"
-
-#define I810_TEX_MAXLEVELS 11
-
-/* 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 i810_texture_object_t {
- driTextureObject base;
-
- int Pitch;
- int Height;
- int texelBytes;
- char *BufAddr;
-
- GLuint max_level;
-
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[I810_TEX_MAXLEVELS];
-
- GLuint Setup[I810_TEX_SETUP_SIZE];
- GLuint dirty;
-
-};
-
-void i810UpdateTextureState( GLcontext *ctx );
-void i810InitTextureFuncs( struct dd_function_table *functions );
-
-void i810DestroyTexObj( i810ContextPtr imesa, i810TextureObjectPtr t );
-int i810UploadTexImagesLocked( i810ContextPtr imesa, i810TextureObjectPtr t );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texmem.c
deleted file mode 100644
index 08900cc67..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texmem.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- * Texmem interface changes (C) 2003 Dave Airlie
- *
- * 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.
- *
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "colormac.h"
-#include "mm.h"
-#include "texformat.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tex.h"
-#include "i810state.h"
-#include "i810ioctl.h"
-
-
-void i810DestroyTexObj(i810ContextPtr imesa, i810TextureObjectPtr t)
-{
- /* See if it was the driver's current object.
- */
- if ( imesa != NULL ) {
- if (imesa->CurrentTexObj[0] == t) {
- imesa->CurrentTexObj[0] = 0;
- imesa->dirty &= ~I810_UPLOAD_TEX0;
- }
-
- if (imesa->CurrentTexObj[1] == t) {
- imesa->CurrentTexObj[1] = 0;
- imesa->dirty &= ~I810_UPLOAD_TEX1;
- }
- }
-}
-
-
-
-#if defined(i386) || defined(__i386__)
-/* From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- */
-static __inline__ void * __memcpy(void * to, const void * from, size_t n)
-{
-int d0, d1, d2;
-__asm__ __volatile__(
- "rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n"
- "2:"
- : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- : "memory");
-return (to);
-}
-#else
-/* Allow compilation on other architectures */
-#define __memcpy memcpy
-#endif
-
-/* Upload an image from mesa's internal copy.
- */
-static void i810UploadTexLevel( i810ContextPtr imesa,
- i810TextureObjectPtr t, int hwlevel )
-{
- const struct gl_texture_image *image = t->image[hwlevel].image;
- int j;
-
- if (!image || !image->Data)
- return;
-
- if (image->Width * image->TexFormat->TexelBytes == t->Pitch) {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- memcpy( dst, src, t->Pitch * image->Height );
- }
- else switch (image->TexFormat->TexelBytes) {
- case 1:
- {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) {
- __memcpy(dst, src, image->Width );
- src += image->Width;
- }
- }
- break;
-
- case 2:
- {
- GLushort *dst = (GLushort *)(t->BufAddr + t->image[hwlevel].offset);
- GLushort *src = (GLushort *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/2)) {
- __memcpy(dst, src, image->Width * 2 );
- src += image->Width;
- }
- }
- break;
-
- default:
- fprintf(stderr, "%s: Not supported texel size %d\n",
- __FUNCTION__, image->TexFormat->TexelBytes);
- }
-}
-
-/* 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.
- */
-int i810UploadTexImagesLocked( i810ContextPtr imesa, i810TextureObjectPtr t )
-{
- int i;
- int ofs;
- int numLevels;
-
- /* Do we need to eject LRU texture objects?
- */
- if (!t->base.memBlock) {
- int heap;
-
- heap = driAllocateTexture( imesa->texture_heaps, imesa->nr_heaps,
- (driTextureObject *) t);
-
- if ( heap == -1 ) {
- return -1;
- }
-
- ofs = t->base.memBlock->ofs;
- t->BufAddr = imesa->i810Screen->tex.map + ofs;
- t->Setup[I810_TEXREG_MI3] = imesa->i810Screen->textureOffset + ofs;
-
- if (t == imesa->CurrentTexObj[0])
- I810_STATECHANGE(imesa, I810_UPLOAD_TEX0);
-
- if (t == imesa->CurrentTexObj[1])
- I810_STATECHANGE(imesa, I810_UPLOAD_TEX1);
-
- /* i810UpdateTexLRU( imesa, t );*/
- }
- driUpdateTextureLRU( (driTextureObject *) t );
-
- if (imesa->texture_heaps[0]->timestamp >= GET_DISPATCH_AGE(imesa))
- i810WaitAgeLocked( imesa, imesa->texture_heaps[0]->timestamp );
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- for (i = 0 ; i < numLevels ; i++)
- if (t->base.dirty_images[0] & (1<<i))
- i810UploadTexLevel( imesa, t, i );
-
- t->base.dirty_images[0] = 0;
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texstate.c
deleted file mode 100644
index e100c565c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810texstate.c
+++ /dev/null
@@ -1,746 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810tex.h"
-#include "i810state.h"
-#include "i810ioctl.h"
-
-
-
-
-static void i810SetTexImages( i810ContextPtr imesa,
- struct gl_texture_object *tObj )
-{
- GLuint height, width, pitch, i, textureFormat, log_pitch;
- i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint numLevels;
- GLint log2Width, log2Height;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- switch (baseImage->Format) {
- case GL_RGB:
- case GL_LUMINANCE:
- t->texelBytes = 2;
- textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_RGB565;
- break;
- case GL_ALPHA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_RGBA:
- t->texelBytes = 2;
- textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_ARGB4444;
- break;
- case GL_COLOR_INDEX:
- textureFormat = MI1_FMT_8CI | MI1_PF_8CI_ARGB4444;
- t->texelBytes = 1;
- break;
- case GL_YCBCR_MESA:
- t->texelBytes = 2;
- textureFormat = MI1_FMT_422 | MI1_PF_422_YCRCB_SWAP_Y
- | MI1_COLOR_CONV_ENABLE;
- break;
-
- default:
- fprintf(stderr, "i810SetTexImages: bad image->Format\n" );
- return;
- }
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][t->base.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][t->base.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][t->base.firstLevel + i];
- t->image[i].offset = height * pitch;
- t->image[i].internalFormat = baseImage->Format;
- height += t->image[i].image->Height;
- }
-
- t->Pitch = pitch;
- t->base.totalSize = height*pitch;
- t->max_level = i-1;
- t->dirty = I810_UPLOAD_TEX0 | I810_UPLOAD_TEX1;
- t->Setup[I810_TEXREG_MI1] = (MI1_MAP_0 | textureFormat | log_pitch);
- t->Setup[I810_TEXREG_MI2] = (MI2_DIMENSIONS_ARE_LOG2 |
- (log2Height << 16) | log2Width);
- t->Setup[I810_TEXREG_MLL] = (GFX_OP_MAP_LOD_LIMITS |
- MLL_MAP_0 |
- MLL_UPDATE_MAX_MIP |
- MLL_UPDATE_MIN_MIP |
- ((numLevels - 1) << MLL_MIN_MIP_SHIFT));
-
- LOCK_HARDWARE( imesa );
- i810UploadTexImagesLocked( imesa, t );
- UNLOCK_HARDWARE( imesa );
-}
-
-/* ================================================================
- * Texture combine functions
- */
-
-#define I810_DISABLE 0
-#define I810_PASSTHRU 1
-#define I810_REPLACE 2
-#define I810_MODULATE 3
-#define I810_DECAL 4
-#define I810_BLEND 5
-#define I810_ALPHA_BLEND 6
-#define I810_ADD 7
-#define I810_MAX_COMBFUNC 8
-
-
-static GLuint i810_color_combine[][I810_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ITERATED_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ), /* actually passthru */
-
- /* Passthru
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ITERATED_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_TEX0_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX0_COLOR ),
-
- /* GL_BLEND according to alpha
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_0 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX0_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ITERATED_COLOR |
- MC_UPDATE_OP |
- MC_OP_ADD ),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage (Note: disables all subsequent stages)
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_ONE |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_DISABLE ),
-
-
- /* Passthru
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_CURRENT_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_ONE |
- MC_UPDATE_OP |
- MC_OP_ARG1 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_TEX1_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_COLOR_FACTOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX1_COLOR ),
-
- /* GL_BLEND according to alpha
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_COLOR_STAGES |
- MC_STAGE_1 |
- MC_UPDATE_DEST |
- MC_DEST_CURRENT |
- MC_UPDATE_ARG1 |
- MC_ARG1_TEX1_COLOR |
- MC_UPDATE_ARG2 |
- MC_ARG2_CURRENT_COLOR |
- MC_UPDATE_OP |
- MC_OP_ADD ),
- }
-};
-
-static GLuint i810_alpha_combine[][I810_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* Disable combiner stage
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* Passthru
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG2 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ALPHA_FACTOR |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_BLEND according to alpha (same as above)
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX0_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_0 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ITERATED_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX0_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ADD ),
- },
-
- /* Unit 1:
- */
- {
- /* Disable combiner stage
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* Passthru
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_CURRENT_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_REPLACE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX1_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ARG2 ),
-
- /* GL_MODULATE
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX1_ALPHA |
- MA_UPDATE_OP |
- MA_OP_MODULATE ),
-
- /* GL_DECAL
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ALPHA_FACTOR |
- MA_UPDATE_OP |
- MA_OP_ARG1 ),
-
- /* GL_BLEND
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_BLEND according to alpha (same as above)
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_ALPHA_FACTOR |
- MA_UPDATE_ARG2 |
- MA_ARG2_ITERATED_ALPHA |
- MA_UPDATE_OP |
- MA_OP_LIN_BLEND_TEX1_ALPHA ),
-
- /* GL_ADD
- */
- ( GFX_OP_MAP_ALPHA_STAGES |
- MA_STAGE_1 |
- MA_UPDATE_ARG1 |
- MA_ARG1_CURRENT_ALPHA |
- MA_UPDATE_ARG2 |
- MA_ARG2_TEX1_ALPHA |
- MA_UPDATE_OP |
- MA_OP_ADD ),
- }
-
-};
-
-
-
-static void i810UpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- 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;
- GLuint color_combine, alpha_combine;
-
- switch (texUnit->EnvMode) {
- case GL_REPLACE:
- if (format == GL_ALPHA) {
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_REPLACE];
- } else if (format == GL_LUMINANCE || format == GL_RGB) {
- color_combine = i810_color_combine[unit][I810_REPLACE];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- } else {
- color_combine = i810_color_combine[unit][I810_REPLACE];
- alpha_combine = i810_alpha_combine[unit][I810_REPLACE];
- }
- break;
-
- case GL_MODULATE:
- if (format == GL_ALPHA) {
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- } else {
- color_combine = i810_color_combine[unit][I810_MODULATE];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- }
- break;
-
- case GL_DECAL:
- switch (format) {
- case GL_RGBA:
- color_combine = i810_color_combine[unit][I810_ALPHA_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_RGB:
- color_combine = i810_color_combine[unit][I810_REPLACE];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_COLOR_INDEX:
- default:
- return;
- }
- break;
-
- case GL_BLEND:
- switch (format) {
- case GL_RGB:
- case GL_LUMINANCE:
- color_combine = i810_color_combine[unit][I810_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- color_combine = i810_color_combine[unit][I810_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = i810_color_combine[unit][I810_BLEND];
- alpha_combine = i810_alpha_combine[unit][I810_BLEND];
- break;
- case GL_COLOR_INDEX:
- default:
- return;
- }
- break;
-
- case GL_ADD:
- switch (format) {
- case GL_RGB:
- case GL_LUMINANCE:
- color_combine = i810_color_combine[unit][I810_ADD];
- alpha_combine = i810_alpha_combine[unit][I810_PASSTHRU];
- break;
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- color_combine = i810_color_combine[unit][I810_ADD];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_ALPHA:
- color_combine = i810_color_combine[unit][I810_PASSTHRU];
- alpha_combine = i810_alpha_combine[unit][I810_MODULATE];
- break;
- case GL_INTENSITY:
- color_combine = i810_color_combine[unit][I810_ADD];
- alpha_combine = i810_alpha_combine[unit][I810_ADD];
- break;
- case GL_COLOR_INDEX:
- default:
- return;
- }
- break;
-
- default:
- return;
- }
-
- if (alpha_combine != imesa->Setup[I810_CTXREG_MA0 + unit] ||
- color_combine != imesa->Setup[I810_CTXREG_MC0 + unit])
- {
- I810_STATECHANGE( imesa, I810_UPLOAD_CTX );
- imesa->Setup[I810_CTXREG_MA0 + unit] = alpha_combine;
- imesa->Setup[I810_CTXREG_MC0 + unit] = color_combine;
- }
-}
-
-
-
-
-static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
- {
- struct gl_texture_object *tObj = texUnit->_Current;
- i810TextureObjectPtr t = (i810TextureObjectPtr)tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->base.dirty_images[0]) {
- I810_FIREVERTICES(imesa);
- i810SetTexImages( imesa, tObj );
- if (!t->base.memBlock) {
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
- }
-
- if (tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (imesa->CurrentTexObj[unit] != t) {
- I810_STATECHANGE(imesa, (I810_UPLOAD_TEX0<<unit));
- imesa->CurrentTexObj[unit] = t;
- t->base.bound |= (1U << unit);
-
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked */
-
- }
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- */
- if (tObj->Image[0][tObj->BaseLevel]->Format != imesa->TexEnvImageFmt[unit]) {
- imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format;
- i810UpdateTexEnv( ctx, unit );
- }
- }
- else if (texUnit->_ReallyEnabled) {
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
- }
- else /*if (imesa->CurrentTexObj[unit])*/ {
- imesa->CurrentTexObj[unit] = 0;
- imesa->TexEnvImageFmt[unit] = 0;
- imesa->dirty &= ~(I810_UPLOAD_TEX0<<unit);
- imesa->Setup[I810_CTXREG_MA0 + unit] =
- i810_alpha_combine[unit][I810_DISABLE];
- imesa->Setup[I810_CTXREG_MC0 + unit] =
- i810_color_combine[unit][I810_DISABLE];
- I810_STATECHANGE( imesa, I810_UPLOAD_CTX );
- }
-}
-
-
-void i810UpdateTextureState( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- /* fprintf(stderr, "%s\n", __FUNCTION__); */
- FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_FALSE );
- i810UpdateTexUnit( ctx, 0 );
- i810UpdateTexUnit( ctx, 1 );
-}
-
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.c
deleted file mode 100644
index 3e09427bb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.c
+++ /dev/null
@@ -1,871 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.c,v 1.7 2002/10/30 12:51:33 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2001 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, 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
-ATI, 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "enums.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810tris.h"
-#include "i810state.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-
-static void i810RenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v) ); \
-} while (0)
-#else
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- for ( j = 0 ; j < vertsize ; j++ ) \
- vb[j] = ((GLuint *)v)[j]; \
- vb += vertsize; \
-} while (0)
-#endif
-
-static __inline__ void i810_draw_triangle( i810ContextPtr imesa,
- i810VertexPtr v0,
- i810VertexPtr v1,
- i810VertexPtr v2 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 3 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
-}
-
-
-static __inline__ void i810_draw_quad( i810ContextPtr imesa,
- i810VertexPtr v0,
- i810VertexPtr v1,
- i810VertexPtr v2,
- i810VertexPtr v3 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 6 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v3 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
- COPY_DWORDS( j, vb, vertsize, v3 );
-}
-
-
-static __inline__ void i810_draw_point( i810ContextPtr imesa,
- i810VertexPtr tmp )
-{
- GLfloat sz = imesa->glCtx->Point._Size * .5;
- int vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
- int j;
-
- /* Draw a point as a horizontal line.
- */
- *(float *)&vb[0] = tmp->v.x - sz + 0.125;
- for (j = 1 ; j < vertsize ; j++)
- vb[j] = tmp->ui[j];
- vb += vertsize;
-
- *(float *)&vb[0] = tmp->v.x + sz + 0.125;
- for (j = 1 ; j < vertsize ; j++)
- vb[j] = tmp->ui[j];
- vb += vertsize;
-}
-
-
-static __inline__ void i810_draw_line( i810ContextPtr imesa,
- i810VertexPtr v0,
- i810VertexPtr v1 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
-}
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (0) fprintf(stderr, "hw TRI\n"); \
- if (DO_FALLBACK) \
- imesa->draw_tri( imesa, a, b, c ); \
- else \
- i810_draw_triangle( imesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (0) fprintf(stderr, "hw QUAD\n"); \
- if (DO_FALLBACK) { \
- imesa->draw_tri( imesa, a, b, d ); \
- imesa->draw_tri( imesa, b, c, d ); \
- } else \
- i810_draw_quad( imesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (0) fprintf(stderr, "hw LINE\n"); \
- if (DO_FALLBACK) \
- imesa->draw_line( imesa, v0, v1 ); \
- else \
- i810_draw_line( imesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (0) fprintf(stderr, "hw POINT\n"); \
- if (DO_FALLBACK) \
- imesa->draw_point( imesa, v0 ); \
- else \
- i810_draw_point( imesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define I810_OFFSET_BIT 0x01
-#define I810_TWOSIDE_BIT 0x02
-#define I810_UNFILLED_BIT 0x04
-#define I810_FALLBACK_BIT 0x08
-#define I810_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[I810_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & I810_FALLBACK_BIT)
-#define DO_OFFSET (IND & I810_OFFSET_BIT)
-#define DO_UNFILLED (IND & I810_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & I810_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX i810Vertex
-#define TAB rast_tab
-
-
-#define DEPTH_SCALE (1.0/0xffff)
-#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) (imesa->verts + (e * imesa->vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- i810_color_t *color = (i810_color_t *)&((v)->ui[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-
-#define VERT_SET_SPEC( v0, c ) \
-do { \
- if (havespec) { \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- if (havespec) { \
- v0->v.specular.red = v1->v.specular.red; \
- v0->v.specular.green = v1->v.specular.green; \
- v0->v.specular.blue = v1->v.specular.blue; \
- } \
-} while (0)
-
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- i810ContextPtr imesa = I810_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (imesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (imesa->vertex_size > 4); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PR_LINES,
- PR_LINES,
- PR_LINES,
- PR_LINES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES,
- PR_TRIANGLES
-};
-
-#define RASTERIZE(x) if (imesa->hw_primitive != hw_prim[x]) \
- i810RasterPrimitive( ctx, x, hw_prim[x] )
-#define RENDER_PRIMITIVE imesa->render_primitive
-#define TAG(x) x
-#define IND I810_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 (I810_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_OFFSET_BIT|I810_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT|I810_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_OFFSET_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_UNFILLED_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_OFFSET_BIT|I810_UNFILLED_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_UNFILLED_BIT|I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I810_TWOSIDE_BIT|I810_OFFSET_BIT|I810_UNFILLED_BIT| \
- I810_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-/***********************************************************************
- * 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
-i810_fallback_tri( i810ContextPtr imesa,
- i810Vertex *v0,
- i810Vertex *v1,
- i810Vertex *v2 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[3];
- i810_translate_vertex( ctx, v0, &v[0] );
- i810_translate_vertex( ctx, v1, &v[1] );
- i810_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-i810_fallback_line( i810ContextPtr imesa,
- i810Vertex *v0,
- i810Vertex *v1 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[2];
- i810_translate_vertex( ctx, v0, &v[0] );
- i810_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-i810_fallback_point( i810ContextPtr imesa,
- i810Vertex *v0 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[1];
- i810_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define IND 0
-#define V(x) (i810Vertex *)(vertptr + ((x)*vertsize*sizeof(int)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) POINT( V(ELT(start)) );
-#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
-#define RENDER_TRI( v0, v1, v2 ) TRI( V(v0), V(v1), V(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) QUAD( V(v0), V(v1), V(v2), V(v3) )
-#define INIT(x) i810RenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- i810ContextPtr imesa = I810_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)imesa->verts; \
- const GLuint vertsize = imesa->vertex_size; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) i810_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) i810_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void i810RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = imesa->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 i810RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i810AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
- GLubyte *vertptr = (GLubyte *)imesa->verts;
- const GLuint *start = (const GLuint *)V(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, V(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, V(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-
-#define _I810_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-#define POINT_FALLBACK (0)
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
-#define TRI_FALLBACK (0)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|\
- DD_TRI_STIPPLE)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-static void i810ChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (I810_DEBUG & DEBUG_STATE)
- fprintf(stderr,"\n%s\n",__FUNCTION__);
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= I810_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= I810_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= I810_UNFILLED_BIT;
- }
-
- imesa->draw_point = i810_draw_point;
- imesa->draw_line = i810_draw_line;
- imesa->draw_tri = i810_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & POINT_FALLBACK)
- imesa->draw_point = i810_fallback_point;
-
- if (flags & LINE_FALLBACK)
- imesa->draw_line = i810_fallback_line;
-
- if (flags & TRI_FALLBACK)
- imesa->draw_tri = i810_fallback_tri;
-
- if ((flags & DD_TRI_STIPPLE) && !imesa->stipple_in_hw)
- imesa->draw_tri = i810_fallback_tri;
-
- index |= I810_FALLBACK_BIT;
- }
- }
-
- if (imesa->RenderIndex != index) {
- imesa->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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = i810_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = i810_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = i810FastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = i810RenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = i810RenderClippedPoly;
- }
- }
-}
-
-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
-};
-
-
-/**********************************************************************/
-/* 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 i810render.c.
- */
-static void i810RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- imesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (imesa->reduced_primitive != rprim ||
- hw_prim[prim] != imesa->hw_primitive) {
- i810RasterPrimitive( ctx, rprim, hw_prim[prim] );
- }
-}
-
-static void i810RunPipeline( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
-
- if (imesa->new_state) {
- if (imesa->new_state & _NEW_TEXTURE)
- i810UpdateTextureState( ctx ); /* may modify imesa->new_state */
-
- if (!imesa->Fallback) {
- if (imesa->new_state & _I810_NEW_VERTEX)
- i810ChooseVertexState( ctx );
-
- if (imesa->new_state & _I810_NEW_RENDERSTATE)
- i810ChooseRenderState( ctx );
- }
-
- imesa->new_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void i810RenderStart( GLcontext *ctx )
-{
- /* Check for projective textureing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- i810CheckTexSizes( ctx );
-}
-
-static void i810RenderFinish( GLcontext *ctx )
-{
- if (I810_CONTEXT(ctx)->RenderIndex & I810_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-
-/* System to flush dma and emit state changes based on the rasterized
- * primitive.
- */
-void i810RasterPrimitive( GLcontext *ctx,
- GLenum rprim,
- GLuint hwprim )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint st1 = imesa->Setup[I810_CTXREG_ST1];
- GLuint aa = imesa->Setup[I810_CTXREG_AA];
- GLuint lcs = imesa->Setup[I810_CTXREG_LCS];
-
- st1 &= ~ST1_ENABLE;
- aa &= ~AA_ENABLE;
-
- if (I810_DEBUG & DEBUG_PRIMS) {
- /* Prints reduced prim, and hw prim */
- char *prim_name = "Unknown";
-
- switch(hwprim) {
- case PR_LINES:
- prim_name = "Lines";
- break;
- case PR_LINESTRIP:
- prim_name = "LineStrip";
- break;
- case PR_TRIANGLES:
- prim_name = "Triangles";
- break;
- case PR_TRISTRIP_0:
- prim_name = "TriStrip_0";
- break;
- case PR_TRIFAN:
- prim_name = "TriFan";
- break;
- case PR_POLYGON:
- prim_name = "Polygons";
- break;
- default:
- break;
- }
-
- fprintf(stderr, "%s : rprim(%s), hwprim(%s)\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(rprim),
- prim_name);
- }
-
- switch (rprim) {
- case GL_TRIANGLES:
- if (ctx->Polygon.StippleFlag)
- st1 |= ST1_ENABLE;
- if (ctx->Polygon.SmoothFlag)
- aa |= AA_ENABLE;
- break;
- case GL_LINES:
- lcs &= ~(LCS_LINEWIDTH_3_0|LCS_LINEWIDTH_0_5);
- lcs |= imesa->LcsLineWidth;
- if (ctx->Line.SmoothFlag) {
- aa |= AA_ENABLE;
- lcs |= LCS_LINEWIDTH_0_5;
- }
- break;
- case GL_POINTS:
- lcs &= ~(LCS_LINEWIDTH_3_0|LCS_LINEWIDTH_0_5);
- lcs |= imesa->LcsPointSize;
- if (ctx->Point.SmoothFlag) {
- aa |= AA_ENABLE;
- lcs |= LCS_LINEWIDTH_0_5;
- }
- break;
- default:
- return;
- }
-
- imesa->reduced_primitive = rprim;
-
- if (st1 != imesa->Setup[I810_CTXREG_ST1] ||
- aa != imesa->Setup[I810_CTXREG_AA] ||
- lcs != imesa->Setup[I810_CTXREG_LCS])
- {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->hw_primitive = hwprim;
- imesa->Setup[I810_CTXREG_LCS] = lcs;
- imesa->Setup[I810_CTXREG_ST1] = st1;
- imesa->Setup[I810_CTXREG_AA] = aa;
- }
- else if (hwprim != imesa->hw_primitive) {
- I810_STATECHANGE(imesa, 0);
- imesa->hw_primitive = hwprim;
- }
-}
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-static char *fallbackStrings[] = {
- "Texture",
- "Draw buffer",
- "Read buffer",
- "Color mask",
- "Render mode",
- "Stencil",
- "Stipple",
- "User disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = imesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = imesa->Fallback;
-
- if (0) fprintf(stderr, "%s old %x bit %x mode %d\n", __FUNCTION__,
- imesa->Fallback, bit, mode );
-
- if (mode) {
- imesa->Fallback |= bit;
- if (oldfallback == 0) {
- I810_FIREVERTICES(imesa);
- if (I810_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "ENTER FALLBACK %s\n", getFallbackString( bit ));
- _swsetup_Wakeup( ctx );
- imesa->RenderIndex = ~0;
- }
- }
- else {
- imesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- if (I810_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "LEAVE FALLBACK %s\n", getFallbackString( bit ));
- tnl->Driver.Render.Start = i810RenderStart;
- tnl->Driver.Render.PrimitiveNotify = i810RenderPrimitive;
- tnl->Driver.Render.Finish = i810RenderFinish;
- tnl->Driver.Render.BuildVertices = i810BuildVertices;
- imesa->new_state |= (_I810_NEW_RENDERSTATE|_I810_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void i810InitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = i810RunPipeline;
- tnl->Driver.Render.Start = i810RenderStart;
- tnl->Driver.Render.Finish = i810RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = i810RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = i810BuildVertices;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.h
deleted file mode 100644
index 06c8b3fcd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810tris.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.h,v 1.10 2002/02/22 21:33:04 dawes Exp $ */
-
-#ifndef I810TRIS_INC
-#define I810TRIS_INC
-
-#include "mtypes.h"
-
-extern void i810PrintRenderState( const char *msg, GLuint state );
-extern void i810InitTriFuncs( GLcontext *ctx );
-extern void i810RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.c
deleted file mode 100644
index 5ce98a991..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810vb.c,v 1.13 2003/03/26 20:43:48 tsi Exp $ */
-
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-
-#include "i810screen.h"
-#include "i810_dri.h"
-
-#include "i810context.h"
-#include "i810vb.h"
-#include "i810ioctl.h"
-#include "i810tris.h"
-#include "i810state.h"
-
-
-#define I810_TEX1_BIT 0x1
-#define I810_TEX0_BIT 0x2
-#define I810_RGBA_BIT 0x4
-#define I810_SPEC_BIT 0x8
-#define I810_FOG_BIT 0x10
-#define I810_XYZW_BIT 0x20
-#define I810_PTEX_BIT 0x40
-#define I810_MAX_SETUP 0x80
-
-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[I810_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_0 | \
- VF_RGBA_ENABLE | \
- VF_XYZ)
-
-#define NOTEX_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_0 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#define TEX0_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_1 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#define TEX1_VERTEX_FORMAT (GFX_OP_VERTEX_FMT | \
- VF_TEXCOORD_COUNT_2 | \
- VF_SPEC_FOG_ENABLE | \
- VF_RGBA_ENABLE | \
- VF_XYZW)
-
-#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 & I810_XYZW_BIT)
-#define DO_RGBA (IND & I810_RGBA_BIT)
-#define DO_SPEC (IND & I810_SPEC_BIT)
-#define DO_FOG (IND & I810_FOG_BIT)
-#define DO_TEX0 (IND & I810_TEX0_BIT)
-#define DO_TEX1 (IND & I810_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & I810_PTEX_BIT)
-
-#define VERTEX i810Vertex
-#define VERTEX_COLOR i810_color_t
-#define GET_VIEWPORT_MAT() I810_CONTEXT(ctx)->ViewportMatrix.m
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() I810_CONTEXT(ctx)->Setup[I810_CTXREG_VF]
-#define GET_VERTEX_STORE() I810_CONTEXT(ctx)->verts
-#define GET_VERTEX_SIZE() I810_CONTEXT(ctx)->vertex_size * sizeof(GLuint)
-#define INVALIDATE_STORED_VERTICES()
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS GLfloat h = I810_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z * (float)0xffff
-
-#define PTEX_FALLBACK() FALLBACK(I810_CONTEXT(ctx), I810_FALLBACK_TEXTURE, 1)
-
-#define INTERP_VERTEX setup_tab[I810_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[I810_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) i810_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_TEX0_BIT|I810_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT|\
- I810_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT|\
- I810_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT|\
- I810_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT|\
- I810_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|\
- I810_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|\
- I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_XYZW_BIT|I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|\
- I810_TEX0_BIT|I810_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_FOG_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_FOG_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_SPEC_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_TEX0_BIT|I810_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|I810_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (I810_RGBA_BIT|I810_FOG_BIT|I810_SPEC_BIT|I810_TEX0_BIT|\
- I810_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-
-
-static void i810PrintSetupFlags(const char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & I810_XYZW_BIT) ? " xyzw," : "",
- (flags & I810_RGBA_BIT) ? " rgba," : "",
- (flags & I810_SPEC_BIT) ? " spec," : "",
- (flags & I810_FOG_BIT) ? " fog," : "",
- (flags & I810_TEX0_BIT) ? " tex-0," : "",
- (flags & I810_TEX1_BIT) ? " tex-1," : "");
-}
-
-
-
-void i810CheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT( ctx );
-
- if (!setup_tab[imesa->SetupIndex].check_tex_sizes(ctx)) {
- /* Invalidate stored verts
- */
- imesa->SetupNewInputs = ~0;
- imesa->SetupIndex |= I810_PTEX_BIT;
-
- if (!imesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[imesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[imesa->SetupIndex].copy_pv;
- }
- if (imesa->Fallback) {
- tnl->Driver.Render.Start(ctx);
- }
- }
-}
-
-void i810BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint stride = imesa->vertex_size * sizeof(int);
- GLubyte *v = ((GLubyte *)imesa->verts + (start * stride));
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- newinputs |= imesa->SetupNewInputs;
- imesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= I810_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= I810_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= I810_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= I810_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= I810_FOG_BIT;
-
- if (imesa->SetupIndex & I810_PTEX_BIT)
- ind = ~0;
-
- ind &= imesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void i810ChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i810ContextPtr imesa = I810_CONTEXT( ctx );
- GLuint ind = I810_XYZW_BIT|I810_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= I810_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= I810_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2)
- /* unit 1 enabled */
- ind |= I810_TEX1_BIT|I810_TEX0_BIT;
- else if (ctx->Texture._EnabledUnits & 0x1)
- /* unit 0 enabled */
- ind |= I810_TEX0_BIT;
-
- imesa->SetupIndex = ind;
-
- if (I810_DEBUG & (DEBUG_VERTS|DEBUG_STATE))
- i810PrintSetupFlags( __FUNCTION__, ind );
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = i810_interp_extras;
- tnl->Driver.Render.CopyPV = i810_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 != imesa->Setup[I810_CTXREG_VF]) {
- I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
- imesa->Setup[I810_CTXREG_VF] = setup_tab[ind].vertex_format;
- imesa->vertex_size = setup_tab[ind].vertex_size;
- }
-}
-
-
-
-void *i810_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- void *dest )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- GLuint stride = imesa->vertex_size * 4;
- setup_tab[imesa->SetupIndex].emit( ctx, start, count, dest, stride );
- return (void *)((char *)dest + stride * (count - start));
-}
-
-
-
-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);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void i810FreeVB( GLcontext *ctx )
-{
- i810ContextPtr imesa = I810_CONTEXT(ctx);
- if (imesa->verts) {
- ALIGN_FREE(imesa->verts);
- imesa->verts = 0;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.h
deleted file mode 100644
index 1cced86ab..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/i810vb.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810vb.h,v 1.4 2002/02/22 21:33:04 dawes Exp $ */
-
-#ifndef I810VB_INC
-#define I810VB_INC
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-
-#define _I810_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void i810ChooseVertexState( GLcontext *ctx );
-extern void i810CheckTexSizes( GLcontext *ctx );
-extern void i810BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void *i810_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- void *dest );
-
-extern void i810_translate_vertex( GLcontext *ctx,
- const i810Vertex *src,
- SWvertex *dst );
-
-extern void i810InitVB( GLcontext *ctx );
-extern void i810FreeVB( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_common.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_common.h
deleted file mode 100644
index 02e548be0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_common.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* i810_common.h -- common header definitions for I810 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>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_common.h,v 1.1 2002/09/11 00:29:31 dawes Exp $
- *
- */
-
-/* WARNING: If you change any of these defines, make sure to change
- * the kernel include file as well (i810_drm.h)
- */
-
-#ifndef _I810_COMMON_H_
-#define _I810_COMMON_H_
-
-#ifndef _I810_DEFINES_
-#define _I810_DEFINES_
-#define I810_USE_BATCH 1
-
-#define I810_DMA_BUF_ORDER 12
-#define I810_DMA_BUF_SZ (1<<I810_DMA_BUF_ORDER)
-#define I810_DMA_BUF_NR 256
-
-#define I810_NR_SAREA_CLIPRECTS 8
-
-/* Each region is a minimum of 64k, and there are at most 64 of them.
- */
-#define I810_NR_TEX_REGIONS 64
-#define I810_LOG_MIN_TEX_REGION_SIZE 16
-
-/* Destbuffer state
- * - backbuffer linear offset and pitch -- invarient in the current dri
- * - zbuffer linear offset and pitch -- also invarient
- * - drawing origin in back and depth buffers.
- *
- * Keep the depth/back buffer state here to acommodate private buffers
- * in the future.
- */
-#define I810_DESTREG_DI0 0 /* CMD_OP_DESTBUFFER_INFO (2 dwords) */
-#define I810_DESTREG_DI1 1
-#define I810_DESTREG_DV0 2 /* GFX_OP_DESTBUFFER_VARS (2 dwords) */
-#define I810_DESTREG_DV1 3
-#define I810_DESTREG_DR0 4 /* GFX_OP_DRAWRECT_INFO (4 dwords) */
-#define I810_DESTREG_DR1 5
-#define I810_DESTREG_DR2 6
-#define I810_DESTREG_DR3 7
-#define I810_DESTREG_DR4 8
-#define I810_DEST_SETUP_SIZE 10
-
-/* Context state
- */
-#define I810_CTXREG_CF0 0 /* GFX_OP_COLOR_FACTOR */
-#define I810_CTXREG_CF1 1
-#define I810_CTXREG_ST0 2 /* GFX_OP_STIPPLE */
-#define I810_CTXREG_ST1 3
-#define I810_CTXREG_VF 4 /* GFX_OP_VERTEX_FMT */
-#define I810_CTXREG_MT 5 /* GFX_OP_MAP_TEXELS */
-#define I810_CTXREG_MC0 6 /* GFX_OP_MAP_COLOR_STAGES - stage 0 */
-#define I810_CTXREG_MC1 7 /* GFX_OP_MAP_COLOR_STAGES - stage 1 */
-#define I810_CTXREG_MC2 8 /* GFX_OP_MAP_COLOR_STAGES - stage 2 */
-#define I810_CTXREG_MA0 9 /* GFX_OP_MAP_ALPHA_STAGES - stage 0 */
-#define I810_CTXREG_MA1 10 /* GFX_OP_MAP_ALPHA_STAGES - stage 1 */
-#define I810_CTXREG_MA2 11 /* GFX_OP_MAP_ALPHA_STAGES - stage 2 */
-#define I810_CTXREG_SDM 12 /* GFX_OP_SRC_DEST_MONO */
-#define I810_CTXREG_FOG 13 /* GFX_OP_FOG_COLOR */
-#define I810_CTXREG_B1 14 /* GFX_OP_BOOL_1 */
-#define I810_CTXREG_B2 15 /* GFX_OP_BOOL_2 */
-#define I810_CTXREG_LCS 16 /* GFX_OP_LINEWIDTH_CULL_SHADE_MODE */
-#define I810_CTXREG_PV 17 /* GFX_OP_PV_RULE -- Invarient! */
-#define I810_CTXREG_ZA 18 /* GFX_OP_ZBIAS_ALPHAFUNC */
-#define I810_CTXREG_AA 19 /* GFX_OP_ANTIALIAS */
-#define I810_CTX_SETUP_SIZE 20
-
-/* Texture state (per tex unit)
- */
-#define I810_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (4 dwords) */
-#define I810_TEXREG_MI1 1
-#define I810_TEXREG_MI2 2
-#define I810_TEXREG_MI3 3
-#define I810_TEXREG_MF 4 /* GFX_OP_MAP_FILTER */
-#define I810_TEXREG_MLC 5 /* GFX_OP_MAP_LOD_CTL */
-#define I810_TEXREG_MLL 6 /* GFX_OP_MAP_LOD_LIMITS */
-#define I810_TEXREG_MCS 7 /* GFX_OP_MAP_COORD_SETS ??? */
-#define I810_TEX_SETUP_SIZE 8
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_I810_INIT 0x00
-#define DRM_I810_VERTEX 0x01
-#define DRM_I810_CLEAR 0x02
-#define DRM_I810_FLUSH 0x03
-#define DRM_I810_GETAGE 0x04
-#define DRM_I810_GETBUF 0x05
-#define DRM_I810_SWAP 0x06
-#define DRM_I810_COPY 0x07
-#define DRM_I810_DOCOPY 0x08
-#define DRM_I810_OV0INFO 0x09
-#define DRM_I810_FSTATUS 0x0a
-#define DRM_I810_OV0FLIP 0x0b
-#define DRM_I810_MC 0x0c
-#define DRM_I810_RSTATUS 0x0d
-#define DRM_I810_FLIP 0x0e
-
-#endif
-
-typedef enum _drmI810Initfunc {
- I810_INIT_DMA = 0x01,
- I810_CLEANUP_DMA = 0x02,
- I810_INIT_DMA_1_4 = 0x03
-} drmI810Initfunc;
-
-typedef struct {
- drmI810Initfunc func;
- unsigned int mmio_offset;
- unsigned int buffers_offset;
- int sarea_priv_offset;
- unsigned int ring_start;
- unsigned int ring_end;
- unsigned int ring_size;
- unsigned int front_offset;
- unsigned int back_offset;
- unsigned int depth_offset;
- unsigned int overlay_offset;
- unsigned int overlay_physical;
- unsigned int w;
- unsigned int h;
- unsigned int pitch;
- unsigned int pitch_bits;
-} drmI810Init;
-
-typedef struct {
- void *virtual;
- int request_idx;
- int request_size;
- int granted;
-} drmI810DMA;
-
-/* Flags for clear ioctl
- */
-#define I810_FRONT 0x1
-#define I810_BACK 0x2
-#define I810_DEPTH 0x4
-
-typedef struct {
- int clear_color;
- int clear_depth;
- int flags;
-} drmI810Clear;
-
-typedef struct {
- int idx; /* buffer index */
- int used; /* nr bytes in use */
- int discard; /* client is finished with the buffer? */
-} drmI810Vertex;
-
-/* Flags for vertex ioctl
- */
-#define PR_TRIANGLES (0x0<<18)
-#define PR_TRISTRIP_0 (0x1<<18)
-#define PR_TRISTRIP_1 (0x2<<18)
-#define PR_TRIFAN (0x3<<18)
-#define PR_POLYGON (0x4<<18)
-#define PR_LINES (0x5<<18)
-#define PR_LINESTRIP (0x6<<18)
-#define PR_RECTS (0x7<<18)
-#define PR_MASK (0x7<<18)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_dri.c
deleted file mode 100644
index f52797c5e..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_dri.h
deleted file mode 100644
index 408a4ebb4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_dri.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.10 2002/12/10 01:27:04 dawes Exp $ */
-
-#ifndef _I810_DRI_
-#define _I810_DRI_
-
-#include "xf86drm.h"
-#include "i810_common.h"
-
-#define I810_MAX_DRAWABLES 256
-
-typedef struct {
- drm_handle_t regs;
- drmSize regsSize;
-
- drmSize backbufferSize;
- drm_handle_t backbuffer;
-
- drmSize depthbufferSize;
- drm_handle_t depthbuffer;
-
- drm_handle_t textures;
- int textureSize;
-
- drm_handle_t agp_buffers;
- drmSize agp_buf_size;
-
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int bitsPerPixel;
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int depthOffset;
-
- int auxPitch;
- int auxPitchBits;
-
- int logTextureGranularity;
- int textureOffset;
-
- /* For non-dma direct rendering.
- */
- int ringOffset;
- int ringSize;
-
- drmBufMapPtr drmBufs;
- int irq;
- unsigned int sarea_priv_offset;
-
-} I810DRIRec, *I810DRIPtr;
-
-/* WARNING: Do not change the SAREA structure without changing the kernel
- * as well */
-
-#define I810_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */
-#define I810_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */
-#define I810_UPLOAD_CTX 0x4
-#define I810_UPLOAD_BUFFERS 0x8
-#define I810_UPLOAD_TEX0 0x10
-#define I810_UPLOAD_TEX1 0x20
-#define I810_UPLOAD_CLIPRECTS 0x40
-
-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 */
-} I810TexRegionRec, *I810TexRegionPtr;
-
-typedef struct {
- unsigned int ContextState[I810_CTX_SETUP_SIZE];
- unsigned int BufferState[I810_DEST_SETUP_SIZE];
- unsigned int TexState[2][I810_TEX_SETUP_SIZE];
- unsigned int dirty;
-
- unsigned int nbox;
- drm_clip_rect_t boxes[I810_NR_SAREA_CLIPRECTS];
-
- /* 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.
- */
-
- drmTextureRegion texList[I810_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;
-
- int pf_enabled; /* is pageflipping allowed? */
- int pf_active; /* is pageflipping active right now? */
- int pf_current_page; /* which buffer is being displayed? */
-
-
-} I810SAREARec, *I810SAREAPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I810ConfigPrivRec, *I810ConfigPrivPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I810DRIContextRec, *I810DRIContextPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_reg.h
deleted file mode 100644
index c935982a7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i810/server/i810_reg.h
+++ /dev/null
@@ -1,992 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */
-/**************************************************************************
-
-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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- * based on the i740 driver by
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- *
- */
-
-#ifndef _I810_REG_H
-#define _I810_REG_H
-
-/* I/O register offsets
- */
-#define SRX 0x3C4 /* p208 */
-#define GRX 0x3CE /* p213 */
-#define ARX 0x3C0 /* p224 */
-
-/* VGA Color Palette Registers */
-#define DACMASK 0x3C6 /* p232 */
-#define DACSTATE 0x3C7 /* p232 */
-#define DACRX 0x3C7 /* p233 */
-#define DACWX 0x3C8 /* p233 */
-#define DACDATA 0x3C9 /* p233 */
-
-/* CRT Controller Registers (CRX) */
-#define START_ADDR_HI 0x0C /* p246 */
-#define START_ADDR_LO 0x0D /* p247 */
-#define VERT_SYNC_END 0x11 /* p249 */
-#define EXT_VERT_TOTAL 0x30 /* p257 */
-#define EXT_VERT_DISPLAY 0x31 /* p258 */
-#define EXT_VERT_SYNC_START 0x32 /* p259 */
-#define EXT_VERT_BLANK_START 0x33 /* p260 */
-#define EXT_HORIZ_TOTAL 0x35 /* p261 */
-#define EXT_HORIZ_BLANK 0x39 /* p261 */
-#define EXT_START_ADDR 0x40 /* p262 */
-#define EXT_START_ADDR_ENABLE 0x80
-#define EXT_OFFSET 0x41 /* p263 */
-#define EXT_START_ADDR_HI 0x42 /* p263 */
-#define INTERLACE_CNTL 0x70 /* p264 */
-#define INTERLACE_ENABLE 0x80
-#define INTERLACE_DISABLE 0x00
-
-/* Miscellaneous Output Register
- */
-#define MSR_R 0x3CC /* p207 */
-#define MSR_W 0x3C2 /* p207 */
-#define IO_ADDR_SELECT 0x01
-
-#define MDA_BASE 0x3B0 /* p207 */
-#define CGA_BASE 0x3D0 /* p207 */
-
-/* CR80 - IO Control, p264
- */
-#define IO_CTNL 0x80
-#define EXTENDED_ATTR_CNTL 0x02
-#define EXTENDED_CRTC_CNTL 0x01
-
-/* GR10 - Address mapping, p221
- */
-#define ADDRESS_MAPPING 0x10
-#define PAGE_TO_LOCAL_MEM_ENABLE 0x10
-#define GTT_MEM_MAP_ENABLE 0x08
-#define PACKED_MODE_ENABLE 0x04
-#define LINEAR_MODE_ENABLE 0x02
-#define PAGE_MAPPING_ENABLE 0x01
-
-/* Blitter control, p378
- */
-#define BITBLT_CNTL 0x7000c
-#define COLEXP_MODE 0x30
-#define COLEXP_8BPP 0x00
-#define COLEXP_16BPP 0x10
-#define COLEXP_24BPP 0x20
-#define COLEXP_RESERVED 0x30
-#define BITBLT_STATUS 0x01
-
-/* p375.
- */
-#define DISPLAY_CNTL 0x70008
-#define VGA_WRAP_MODE 0x02
-#define VGA_WRAP_AT_256KB 0x00
-#define VGA_NO_WRAP 0x02
-#define GUI_MODE 0x01
-#define STANDARD_VGA_MODE 0x00
-#define HIRES_MODE 0x01
-
-/* p375
- */
-#define PIXPIPE_CONFIG_0 0x70009
-#define DAC_8_BIT 0x80
-#define DAC_6_BIT 0x00
-#define HW_CURSOR_ENABLE 0x10
-#define EXTENDED_PALETTE 0x01
-
-/* p375
- */
-#define PIXPIPE_CONFIG_1 0x7000a
-#define DISPLAY_COLOR_MODE 0x0F
-#define DISPLAY_VGA_MODE 0x00
-#define DISPLAY_8BPP_MODE 0x02
-#define DISPLAY_15BPP_MODE 0x04
-#define DISPLAY_16BPP_MODE 0x05
-#define DISPLAY_24BPP_MODE 0x06
-#define DISPLAY_32BPP_MODE 0x07
-
-/* p375
- */
-#define PIXPIPE_CONFIG_2 0x7000b
-#define DISPLAY_GAMMA_ENABLE 0x08
-#define DISPLAY_GAMMA_DISABLE 0x00
-#define OVERLAY_GAMMA_ENABLE 0x04
-#define OVERLAY_GAMMA_DISABLE 0x00
-
-
-/* p380
- */
-#define DISPLAY_BASE 0x70020
-#define DISPLAY_BASE_MASK 0x03fffffc
-
-
-/* Cursor control registers, pp383-384
- */
-/* Desktop (845G, 865G) */
-#define CURSOR_CONTROL 0x70080
-#define CURSOR_ENABLE 0x80000000
-#define CURSOR_GAMMA_ENABLE 0x40000000
-#define CURSOR_STRIDE_MASK 0x30000000
-#define CURSOR_FORMAT_SHIFT 24
-#define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
-#define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
-#define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
-#define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
-#define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
-#define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
-
-/* Mobile and i810 */
-#define CURSOR_A_CONTROL CURSOR_CONTROL
-#define CURSOR_ORIGIN_SCREEN 0x00 /* i810 only */
-#define CURSOR_ORIGIN_DISPLAY 0x1 /* i810 only */
-#define CURSOR_MODE 0x27
-#define CURSOR_MODE_DISABLE 0x00
-#define CURSOR_MODE_32_4C_AX 0x01 /* i810 only */
-#define CURSOR_MODE_64_3C 0x04
-#define CURSOR_MODE_64_4C_AX 0x05
-#define CURSOR_MODE_64_4C 0x06
-#define CURSOR_MODE_64_32B_AX 0x07
-#define CURSOR_MODE_64_ARGB_AX (0x20 | CURSOR_MODE_64_32B_AX)
-#define MCURSOR_PIPE_SELECT (1 << 28)
-#define MCURSOR_PIPE_A 0x00
-#define MCURSOR_PIPE_B (1 << 28)
-#define MCURSOR_GAMMA_ENABLE (1 << 26)
-#define MCURSOR_MEM_TYPE_LOCAL (1 << 25)
-
-
-#define CURSOR_BASEADDR 0x70084
-#define CURSOR_A_BASE CURSOR_BASEADDR
-#define CURSOR_BASEADDR_MASK 0x1FFFFF00
-#define CURSOR_A_POSITION 0x70088
-#define CURSOR_POS_SIGN 0x8000
-#define CURSOR_POS_MASK 0x007FF
-#define CURSOR_X_SHIFT 0
-#define CURSOR_Y_SHIFT 16
-#define CURSOR_X_LO 0x70088
-#define CURSOR_X_HI 0x70089
-#define CURSOR_X_POS 0x00
-#define CURSOR_X_NEG 0x80
-#define CURSOR_Y_LO 0x7008A
-#define CURSOR_Y_HI 0x7008B
-#define CURSOR_Y_POS 0x00
-#define CURSOR_Y_NEG 0x80
-
-#define CURSOR_A_PALETTE0 0x70090
-#define CURSOR_A_PALETTE1 0x70094
-#define CURSOR_A_PALETTE2 0x70098
-#define CURSOR_A_PALETTE3 0x7009C
-
-#define CURSOR_SIZE 0x700A0
-#define CURSOR_SIZE_MASK 0x3FF
-#define CURSOR_SIZE_HSHIFT 0
-#define CURSOR_SIZE_VSHIFT 12
-
-
-/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm
- * not sure they refer to local (graphics) memory.
- *
- * These details are for the local memory control registers,
- * (pp301-310). The test machines are not equiped with local memory,
- * so nothing is tested. Only a single row seems to be supported.
- */
-#define DRAM_ROW_TYPE 0x3000
-#define DRAM_ROW_0 0x01
-#define DRAM_ROW_0_SDRAM 0x01
-#define DRAM_ROW_0_EMPTY 0x00
-#define DRAM_ROW_CNTL_LO 0x3001
-#define DRAM_PAGE_MODE_CTRL 0x10
-#define DRAM_RAS_TO_CAS_OVRIDE 0x08
-#define DRAM_CAS_LATENCY 0x04
-#define DRAM_RAS_TIMING 0x02
-#define DRAM_RAS_PRECHARGE 0x01
-#define DRAM_ROW_CNTL_HI 0x3002
-#define DRAM_REFRESH_RATE 0x18
-#define DRAM_REFRESH_DISABLE 0x00
-#define DRAM_REFRESH_60HZ 0x08
-#define DRAM_REFRESH_FAST_TEST 0x10
-#define DRAM_REFRESH_RESERVED 0x18
-#define DRAM_SMS 0x07
-#define DRAM_SMS_NORMAL 0x00
-#define DRAM_SMS_NOP_ENABLE 0x01
-#define DRAM_SMS_ABPCE 0x02
-#define DRAM_SMS_MRCE 0x03
-#define DRAM_SMS_CBRCE 0x04
-
-/* p307
- */
-#define DPMS_SYNC_SELECT 0x5002
-#define VSYNC_CNTL 0x08
-#define VSYNC_ON 0x00
-#define VSYNC_OFF 0x08
-#define HSYNC_CNTL 0x02
-#define HSYNC_ON 0x00
-#define HSYNC_OFF 0x02
-
-
-
-/* p317, 319
- */
-#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
-#define VCLK2_VCO_N 0x600a
-#define VCLK2_VCO_DIV_SEL 0x6012
-
-#define VCLK_DIVISOR_VGA0 0x6000
-#define VCLK_DIVISOR_VGA1 0x6004
-#define VCLK_POST_DIV 0x6010
-
-#define POST_DIV_SELECT 0x70
-#define POST_DIV_1 0x00
-#define POST_DIV_2 0x10
-#define POST_DIV_4 0x20
-#define POST_DIV_8 0x30
-#define POST_DIV_16 0x40
-#define POST_DIV_32 0x50
-#define VCO_LOOP_DIV_BY_4M 0x00
-#define VCO_LOOP_DIV_BY_16M 0x04
-
-
-/* Instruction Parser Mode Register
- * - p281
- * - 2 new bits.
- */
-#define INST_PM 0x20c0
-#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
-#define SYNC_PACKET_FLUSH_ENABLE 0x10
-#define TWO_D_INST_DISABLE 0x08
-#define THREE_D_INST_DISABLE 0x04
-#define STATE_VAR_UPDATE_DISABLE 0x02
-#define PAL_STIP_DISABLE 0x01
-
-#define INST_DONE 0x2090
-#define INST_PS 0x20c4
-
-#define MEMMODE 0x20dc
-
-
-/* Instruction parser error register. p279
- */
-#define IPEIR 0x2088
-#define IPEHR 0x208C
-
-
-/* General error reporting regs, p296
- */
-#define EIR 0x20B0
-#define EMR 0x20B4
-#define ESR 0x20B8
-#define IP_ERR 0x0001
-#define ERROR_RESERVED 0xffc6
-
-
-/* Interrupt Control Registers
- * - new bits for i810
- * - new register hwstam (mask)
- */
-#define HWSTAM 0x2098 /* p290 */
-#define IER 0x20a0 /* p291 */
-#define IIR 0x20a4 /* p292 */
-#define IMR 0x20a8 /* p293 */
-#define ISR 0x20ac /* p294 */
-#define HW_ERROR 0x8000
-#define SYNC_STATUS_TOGGLE 0x1000
-#define DPY_0_FLIP_PENDING 0x0800
-#define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */
-#define OVL_0_FLIP_PENDING 0x0200
-#define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */
-#define DPY_0_VBLANK 0x0080
-#define DPY_0_EVENT 0x0040
-#define DPY_1_VBLANK 0x0020 /* not implemented on i810 */
-#define DPY_1_EVENT 0x0010 /* not implemented on i810 */
-#define HOST_PORT_EVENT 0x0008 /* */
-#define CAPTURE_EVENT 0x0004 /* */
-#define USER_DEFINED 0x0002
-#define BREAKPOINT 0x0001
-
-
-#define INTR_RESERVED (0x6000 | \
- DPY_1_FLIP_PENDING | \
- OVL_1_FLIP_PENDING | \
- DPY_1_VBLANK | \
- DPY_1_EVENT | \
- HOST_PORT_EVENT | \
- CAPTURE_EVENT )
-
-/* FIFO Watermark and Burst Length Control Register
- *
- * - different offset and contents on i810 (p299) (fewer bits per field)
- * - some overlay fields added
- * - what does it all mean?
- */
-#define FWATER_BLC 0x20d8
-#define FWATER_BLC2 0x20dc
-#define MM_BURST_LENGTH 0x00700000
-#define MM_FIFO_WATERMARK 0x0001F000
-#define LM_BURST_LENGTH 0x00000700
-#define LM_FIFO_WATERMARK 0x0000001F
-
-
-/* Fence/Tiling ranges [0..7]
- */
-#define FENCE 0x2000
-#define FENCE_NR 8
-
-#define I830_FENCE_START_MASK 0x07f80000
-
-#define FENCE_START_MASK 0x03F80000
-#define FENCE_X_MAJOR 0x00000000
-#define FENCE_Y_MAJOR 0x00001000
-#define FENCE_SIZE_MASK 0x00000700
-#define FENCE_SIZE_512K 0x00000000
-#define FENCE_SIZE_1M 0x00000100
-#define FENCE_SIZE_2M 0x00000200
-#define FENCE_SIZE_4M 0x00000300
-#define FENCE_SIZE_8M 0x00000400
-#define FENCE_SIZE_16M 0x00000500
-#define FENCE_SIZE_32M 0x00000600
-#define FENCE_SIZE_64M 0x00000700
-#define FENCE_PITCH_MASK 0x00000070
-#define FENCE_PITCH_1 0x00000000
-#define FENCE_PITCH_2 0x00000010
-#define FENCE_PITCH_4 0x00000020
-#define FENCE_PITCH_8 0x00000030
-#define FENCE_PITCH_16 0x00000040
-#define FENCE_PITCH_32 0x00000050
-#define FENCE_PITCH_64 0x00000060
-#define FENCE_VALID 0x00000001
-
-
-/* Registers to control page table, p274
- */
-#define PGETBL_CTL 0x2020
-#define PGETBL_ADDR_MASK 0xFFFFF000
-#define PGETBL_ENABLE_MASK 0x00000001
-#define PGETBL_ENABLED 0x00000001
-
-/* Register containing pge table error results, p276
- */
-#define PGE_ERR 0x2024
-#define PGE_ERR_ADDR_MASK 0xFFFFF000
-#define PGE_ERR_ID_MASK 0x00000038
-#define PGE_ERR_CAPTURE 0x00000000
-#define PGE_ERR_OVERLAY 0x00000008
-#define PGE_ERR_DISPLAY 0x00000010
-#define PGE_ERR_HOST 0x00000018
-#define PGE_ERR_RENDER 0x00000020
-#define PGE_ERR_BLITTER 0x00000028
-#define PGE_ERR_MAPPING 0x00000030
-#define PGE_ERR_CMD_PARSER 0x00000038
-#define PGE_ERR_TYPE_MASK 0x00000007
-#define PGE_ERR_INV_TABLE 0x00000000
-#define PGE_ERR_INV_PTE 0x00000001
-#define PGE_ERR_MIXED_TYPES 0x00000002
-#define PGE_ERR_PAGE_MISS 0x00000003
-#define PGE_ERR_ILLEGAL_TRX 0x00000004
-#define PGE_ERR_LOCAL_MEM 0x00000005
-#define PGE_ERR_TILED 0x00000006
-
-
-
-/* Page table entries loaded via mmio region, p323
- */
-#define PTE_BASE 0x10000
-#define PTE_ADDR_MASK 0x3FFFF000
-#define PTE_TYPE_MASK 0x00000006
-#define PTE_LOCAL 0x00000002
-#define PTE_MAIN_UNCACHED 0x00000000
-#define PTE_MAIN_CACHED 0x00000006
-#define PTE_VALID_MASK 0x00000001
-#define PTE_VALID 0x00000001
-
-
-/* Ring buffer registers, p277, overview p19
- */
-#define LP_RING 0x2030
-#define HP_RING 0x2040
-
-#define RING_TAIL 0x00
-#define TAIL_ADDR 0x000FFFF8
-#define I830_TAIL_MASK 0x001FFFF8
-
-#define RING_HEAD 0x04
-#define HEAD_WRAP_COUNT 0xFFE00000
-#define HEAD_WRAP_ONE 0x00200000
-#define HEAD_ADDR 0x001FFFFC
-#define I830_HEAD_MASK 0x001FFFFC
-
-#define RING_START 0x08
-#define START_ADDR 0x00FFFFF8
-#define I830_RING_START_MASK 0xFFFFF000
-
-#define RING_LEN 0x0C
-#define RING_NR_PAGES 0x000FF000
-#define I830_RING_NR_PAGES 0x001FF000
-#define RING_REPORT_MASK 0x00000006
-#define RING_REPORT_64K 0x00000002
-#define RING_REPORT_128K 0x00000004
-#define RING_NO_REPORT 0x00000000
-#define RING_VALID_MASK 0x00000001
-#define RING_VALID 0x00000001
-#define RING_INVALID 0x00000000
-
-
-
-/* BitBlt Instructions
- *
- * There are many more masks & ranges yet to add.
- */
-#define BR00_BITBLT_CLIENT 0x40000000
-#define BR00_OP_COLOR_BLT 0x10000000
-#define BR00_OP_SRC_COPY_BLT 0x10C00000
-#define BR00_OP_FULL_BLT 0x11400000
-#define BR00_OP_MONO_SRC_BLT 0x11800000
-#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000
-#define BR00_OP_MONO_PAT_BLT 0x11C00000
-#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)
-#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000
-
-
-#define BR00_TPCY_DISABLE 0x00000000
-#define BR00_TPCY_ENABLE 0x00000010
-
-#define BR00_TPCY_ROP 0x00000000
-#define BR00_TPCY_NO_ROP 0x00000020
-#define BR00_TPCY_EQ 0x00000000
-#define BR00_TPCY_NOT_EQ 0x00000040
-
-#define BR00_PAT_MSB_FIRST 0x00000000 /* ? */
-
-#define BR00_PAT_VERT_ALIGN 0x000000e0
-
-#define BR00_LENGTH 0x0000000F
-
-#define BR09_DEST_ADDR 0x03FFFFFF
-
-#define BR11_SOURCE_PITCH 0x00003FFF
-
-#define BR12_SOURCE_ADDR 0x03FFFFFF
-
-#define BR13_SOLID_PATTERN 0x80000000
-#define BR13_RIGHT_TO_LEFT 0x40000000
-#define BR13_LEFT_TO_RIGHT 0x00000000
-#define BR13_MONO_TRANSPCY 0x20000000
-#define BR13_USE_DYN_DEPTH 0x04000000
-#define BR13_DYN_8BPP 0x00000000
-#define BR13_DYN_16BPP 0x01000000
-#define BR13_DYN_24BPP 0x02000000
-#define BR13_ROP_MASK 0x00FF0000
-#define BR13_DEST_PITCH 0x0000FFFF
-#define BR13_PITCH_SIGN_BIT 0x00008000
-
-#define BR14_DEST_HEIGHT 0xFFFF0000
-#define BR14_DEST_WIDTH 0x0000FFFF
-
-#define BR15_PATTERN_ADDR 0x03FFFFFF
-
-#define BR16_SOLID_PAT_COLOR 0x00FFFFFF
-#define BR16_BACKGND_PAT_CLR 0x00FFFFFF
-
-#define BR17_FGND_PAT_CLR 0x00FFFFFF
-
-#define BR18_SRC_BGND_CLR 0x00FFFFFF
-#define BR19_SRC_FGND_CLR 0x00FFFFFF
-
-
-/* Instruction parser instructions
- */
-
-#define INST_PARSER_CLIENT 0x00000000
-#define INST_OP_FLUSH 0x02000000
-#define INST_FLUSH_MAP_CACHE 0x00000001
-
-
-#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
-
-
-/* Registers in the i810 host-pci bridge pci config space which affect
- * the i810 graphics operations.
- */
-#define SMRAM_MISCC 0x70
-#define GMS 0x000000c0
-#define GMS_DISABLE 0x00000000
-#define GMS_ENABLE_BARE 0x00000040
-#define GMS_ENABLE_512K 0x00000080
-#define GMS_ENABLE_1M 0x000000c0
-#define USMM 0x00000030
-#define USMM_DISABLE 0x00000000
-#define USMM_TSEG_ZERO 0x00000010
-#define USMM_TSEG_512K 0x00000020
-#define USMM_TSEG_1M 0x00000030
-#define GFX_MEM_WIN_SIZE 0x00010000
-#define GFX_MEM_WIN_32M 0x00010000
-#define GFX_MEM_WIN_64M 0x00000000
-
-/* Overkill? I don't know. Need to figure out top of mem to make the
- * SMRAM calculations come out. Linux seems to have problems
- * detecting it all on its own, so this seems a reasonable double
- * check to any user supplied 'mem=...' boot param.
- *
- * ... unfortunately this reg doesn't work according to spec on the
- * test hardware.
- */
-#define WHTCFG_PAMR_DRP 0x50
-#define SYS_DRAM_ROW_0_SHIFT 16
-#define SYS_DRAM_ROW_1_SHIFT 20
-#define DRAM_MASK 0x0f
-#define DRAM_VALUE_0 0
-#define DRAM_VALUE_1 8
-/* No 2 value defined */
-#define DRAM_VALUE_3 16
-#define DRAM_VALUE_4 16
-#define DRAM_VALUE_5 24
-#define DRAM_VALUE_6 32
-#define DRAM_VALUE_7 32
-#define DRAM_VALUE_8 48
-#define DRAM_VALUE_9 64
-#define DRAM_VALUE_A 64
-#define DRAM_VALUE_B 96
-#define DRAM_VALUE_C 128
-#define DRAM_VALUE_D 128
-#define DRAM_VALUE_E 192
-#define DRAM_VALUE_F 256 /* nice one, geezer */
-#define LM_FREQ_MASK 0x10
-#define LM_FREQ_133 0x10
-#define LM_FREQ_100 0x00
-
-
-
-
-/* These are 3d state registers, but the state is invarient, so we let
- * the X server handle it:
- */
-
-
-
-/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135
- */
-#define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)
-#define CC1_UPDATE_KILL_WRITE (1<<28)
-#define CC1_ENABLE_KILL_WRITE (1<<27)
-#define CC1_DISABLE_KILL_WRITE 0
-#define CC1_UPDATE_COLOR_IDX (1<<26)
-#define CC1_UPDATE_CHROMA_LOW (1<<25)
-#define CC1_UPDATE_CHROMA_HI (1<<24)
-#define CC1_CHROMA_LOW_MASK ((1<<24)-1)
-#define CC2_COLOR_IDX_SHIFT 24
-#define CC2_COLOR_IDX_MASK (0xff<<24)
-#define CC2_CHROMA_HI_MASK ((1<<24)-1)
-
-
-#define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23))
-#define CS_UPDATE_LOAD (1<<17)
-#define CS_UPDATE_USE (1<<16)
-#define CS_UPDATE_LOAD (1<<17)
-#define CS_LOAD_CTX0 0
-#define CS_LOAD_CTX1 (1<<8)
-#define CS_USE_CTX0 0
-#define CS_USE_CTX1 (1<<0)
-
-/* I810 LCD/TV registers */
-#define LCD_TV_HTOTAL 0x60000
-#define LCD_TV_C 0x60018
-#define LCD_TV_OVRACT 0x6001C
-
-#define LCD_TV_ENABLE (1 << 31)
-#define LCD_TV_VGAMOD (1 << 28)
-
-/* I830 CRTC registers */
-#define HTOTAL_A 0x60000
-#define HBLANK_A 0x60004
-#define HSYNC_A 0x60008
-#define VTOTAL_A 0x6000c
-#define VBLANK_A 0x60010
-#define VSYNC_A 0x60014
-#define PIPEASRC 0x6001c
-#define BCLRPAT_A 0x60020
-
-#define HTOTAL_B 0x61000
-#define HBLANK_B 0x61004
-#define HSYNC_B 0x61008
-#define VTOTAL_B 0x6100c
-#define VBLANK_B 0x61010
-#define VSYNC_B 0x61014
-#define PIPEBSRC 0x6101c
-#define BCLRPAT_B 0x61020
-
-#define DPLL_A 0x06014
-#define DPLL_B 0x06018
-#define FPA0 0x06040
-#define FPA1 0x06044
-
-#define I830_HTOTAL_MASK 0xfff0000
-#define I830_HACTIVE_MASK 0x7ff
-
-#define I830_HBLANKEND_MASK 0xfff0000
-#define I830_HBLANKSTART_MASK 0xfff
-
-#define I830_HSYNCEND_MASK 0xfff0000
-#define I830_HSYNCSTART_MASK 0xfff
-
-#define I830_VTOTAL_MASK 0xfff0000
-#define I830_VACTIVE_MASK 0x7ff
-
-#define I830_VBLANKEND_MASK 0xfff0000
-#define I830_VBLANKSTART_MASK 0xfff
-
-#define I830_VSYNCEND_MASK 0xfff0000
-#define I830_VSYNCSTART_MASK 0xfff
-
-#define I830_PIPEA_HORZ_MASK 0x7ff0000
-#define I830_PIPEA_VERT_MASK 0x7ff
-
-#define ADPA 0x61100
-#define ADPA_DAC_ENABLE (1<<31)
-#define ADPA_DAC_DISABLE 0
-#define ADPA_PIPE_SELECT_MASK (1<<30)
-#define ADPA_PIPE_A_SELECT 0
-#define ADPA_PIPE_B_SELECT (1<<30)
-#define ADPA_USE_VGA_HVPOLARITY (1<<15)
-#define ADPA_SETS_HVPOLARITY 0
-#define ADPA_VSYNC_CNTL_DISABLE (1<<11)
-#define ADPA_VSYNC_CNTL_ENABLE 0
-#define ADPA_HSYNC_CNTL_DISABLE (1<<10)
-#define ADPA_HSYNC_CNTL_ENABLE 0
-#define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
-#define ADPA_VSYNC_ACTIVE_LOW 0
-#define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
-#define ADPA_HSYNC_ACTIVE_LOW 0
-
-
-#define DVOA 0x61120
-#define DVOB 0x61140
-#define DVOC 0x61160
-#define DVO_ENABLE (1<<31)
-
-#define DVOA_SRCDIM 0x61124
-#define DVOB_SRCDIM 0x61144
-#define DVOC_SRCDIM 0x61164
-
-#define LVDS 0x61180
-
-#define PIPEACONF 0x70008
-#define PIPEACONF_ENABLE (1<<31)
-#define PIPEACONF_DISABLE 0
-#define PIPEACONF_DOUBLE_WIDE (1<<30)
-#define PIPEACONF_SINGLE_WIDE 0
-#define PIPEACONF_PIPE_UNLOCKED 0
-#define PIPEACONF_PIPE_LOCKED (1<<25)
-#define PIPEACONF_PALETTE 0
-#define PIPEACONF_GAMMA (1<<24)
-
-#define PIPEBCONF 0x71008
-#define PIPEBCONF_ENABLE (1<<31)
-#define PIPEBCONF_DISABLE 0
-#define PIPEBCONF_GAMMA (1<<24)
-#define PIPEBCONF_PALETTE 0
-
-#define DSPACNTR 0x70180
-#define DSPBCNTR 0x71180
-#define DISPLAY_PLANE_ENABLE (1<<31)
-#define DISPLAY_PLANE_DISABLE 0
-#define DISPPLANE_GAMMA_ENABLE (1<<30)
-#define DISPPLANE_GAMMA_DISABLE 0
-#define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
-#define DISPPLANE_8BPP (0x2<<26)
-#define DISPPLANE_15_16BPP (0x4<<26)
-#define DISPPLANE_16BPP (0x5<<26)
-#define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
-#define DISPPLANE_32BPP (0x7<<26)
-#define DISPPLANE_STEREO_ENABLE (1<<25)
-#define DISPPLANE_STEREO_DISABLE 0
-#define DISPPLANE_SEL_PIPE_MASK (1<<24)
-#define DISPPLANE_SEL_PIPE_A 0
-#define DISPPLANE_SEL_PIPE_B (1<<24)
-#define DISPPLANE_SRC_KEY_ENABLE (1<<22)
-#define DISPPLANE_SRC_KEY_DISABLE 0
-#define DISPPLANE_LINE_DOUBLE (1<<20)
-#define DISPPLANE_NO_LINE_DOUBLE 0
-#define DISPPLANE_STEREO_POLARITY_FIRST 0
-#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
-/* plane B only */
-#define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
-#define DISPPLANE_ALPHA_TRANS_DISABLE 0
-#define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
-#define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
-
-#define DSPABASE 0x70184
-#define DSPASTRIDE 0x70188
-
-#define DSPBBASE 0x71184
-#define DSPBADDR DSPBBASE
-#define DSPBSTRIDE 0x71188
-
-/* Various masks for reserved bits, etc. */
-#define I830_FWATER1_MASK (~((1<<11)|(1<<10)|(1<<9)| \
- (1<<8)|(1<<26)|(1<<25)|(1<<24)|(1<<5)|(1<<4)|(1<<3)| \
- (1<<2)|(1<<1)|1|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)))
-#define I830_FWATER2_MASK ~(0)
-
-#define DV0A_RESERVED ((1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1)
-#define DV0B_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1)
-#define VGA0_N_DIVISOR_MASK ((1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
-#define VGA0_M1_DIVISOR_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))
-#define VGA0_M2_DIVISOR_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
-#define VGA0_M1M2N_RESERVED ~(VGA0_N_DIVISOR_MASK|VGA0_M1_DIVISOR_MASK|VGA0_M2_DIVISOR_MASK)
-#define VGA0_POSTDIV_MASK ((1<<7)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
-#define VGA1_POSTDIV_MASK ((1<<15)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))
-#define VGA_POSTDIV_RESERVED ~(VGA0_POSTDIV_MASK|VGA1_POSTDIV_MASK|(1<<7)|(1<<15))
-#define DPLLA_POSTDIV_MASK ((1<<23)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
-#define DPLLA_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<22)|(1<<15)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
-#define ADPA_RESERVED ((1<<2)|(1<<1)|1|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
-#define SUPER_WORD 32
-#define BURST_A_MASK ((1<<11)|(1<<10)|(1<<9)|(1<<8))
-#define BURST_B_MASK ((1<<26)|(1<<25)|(1<<24))
-#define WATER_A_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)
-#define WATER_B_MASK ((1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))
-#define WATER_RESERVED ((1<<31)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<7)|(1<<6))
-#define PIPEACONF_RESERVED ((1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff)
-#define PIPEBCONF_RESERVED ((1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff)
-#define DSPACNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0xffff)
-#define DSPBCNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0x7ffe)
-
-#define I830_GMCH_CTRL 0x52
-
-#define I830_GMCH_ENABLED 0x4
-#define I830_GMCH_MEM_MASK 0x1
-#define I830_GMCH_MEM_64M 0x1
-#define I830_GMCH_MEM_128M 0
-
-#define I830_GMCH_GMS_MASK 0x70
-#define I830_GMCH_GMS_DISABLED 0x00
-#define I830_GMCH_GMS_LOCAL 0x10
-#define I830_GMCH_GMS_STOLEN_512 0x20
-#define I830_GMCH_GMS_STOLEN_1024 0x30
-#define I830_GMCH_GMS_STOLEN_8192 0x40
-
-#define I830_RDRAM_CHANNEL_TYPE 0x03010
-#define I830_RDRAM_ND(x) (((x) & 0x20) >> 5)
-#define I830_RDRAM_DDT(x) (((x) & 0x18) >> 3)
-
-#define I855_GMCH_GMS_MASK (0x7 << 4)
-#define I855_GMCH_GMS_DISABLED 0x00
-#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
-#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4)
-#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4)
-#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4)
-#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4)
-
-#define I85X_CAPID 0x44
-#define I85X_VARIANT_MASK 0x7
-#define I85X_VARIANT_SHIFT 5
-#define I855_GME 0x0
-#define I855_GM 0x4
-#define I852_GME 0x2
-#define I852_GM 0x5
-
-/* BLT commands */
-#define COLOR_BLT_CMD ((2<<29)|(0x40<<22)|(0x3))
-#define COLOR_BLT_WRITE_ALPHA (1<<21)
-#define COLOR_BLT_WRITE_RGB (1<<20)
-
-#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|(0x4))
-#define XY_COLOR_BLT_WRITE_ALPHA (1<<21)
-#define XY_COLOR_BLT_WRITE_RGB (1<<20)
-
-#define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)|1)
-
-#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
-#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
-#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
-
-#define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|0x4)
-#define SRC_COPY_BLT_WRITE_ALPHA (1<<21)
-#define SRC_COPY_BLT_WRITE_RGB (1<<20)
-
-#define XY_MONO_PAT_BLT_CMD ((0x2<<29)|(0x52<<22)|0x7)
-#define XY_MONO_PAT_VERT_SEED ((1<<10)|(1<<9)|(1<<8))
-#define XY_MONO_PAT_HORT_SEED ((1<<14)|(1<<13)|(1<<12))
-#define XY_MONO_PAT_BLT_WRITE_ALPHA (1<<21)
-#define XY_MONO_PAT_BLT_WRITE_RGB (1<<20)
-
-#define XY_MONO_SRC_BLT_CMD ((0x2<<29)|(0x54<<22)|(0x6))
-#define XY_MONO_SRC_BLT_WRITE_ALPHA (1<<21)
-#define XY_MONO_SRC_BLT_WRITE_RGB (1<<20)
-
-/* 3d state */
-#define STATE3D_FOG_MODE ((3<<29)|(0x1d<<24)|(0x89<<16)|2)
-#define FOG_MODE_VERTEX (1<<31)
-#define STATE3D_MAP_COORD_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8c<<16))
-#define DISABLE_TEX_TRANSFORM (1<<28)
-#define TEXTURE_SET(x) (x<<29)
-#define STATE3D_RASTERIZATION_RULES ((3<<29)|(0x07<<24))
-#define POINT_RASTER_ENABLE (1<<15)
-#define POINT_RASTER_OGL (1<<13)
-#define STATE3D_VERTEX_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8b<<16))
-#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
-#define DISABLE_PERSPECTIVE_DIVIDE (1<<29)
-
-#define MI_SET_CONTEXT (0x18<<23)
-#define CTXT_NO_RESTORE (1)
-#define CTXT_PALETTE_SAVE_DISABLE (1<<3)
-#define CTXT_PALETTE_RESTORE_DISABLE (1<<2)
-
-/* Dword 0 */
-#define MI_VERTEX_BUFFER (0x17<<23)
-#define MI_VERTEX_BUFFER_IDX(x) (x<<20)
-#define MI_VERTEX_BUFFER_PITCH(x) (x<<13)
-#define MI_VERTEX_BUFFER_WIDTH(x) (x<<6)
-/* Dword 1 */
-#define MI_VERTEX_BUFFER_DISABLE (1)
-
-/* Overlay Flip */
-#define MI_OVERLAY_FLIP (0x11<<23)
-#define MI_OVERLAY_FLIP_CONTINUE (0<<21)
-#define MI_OVERLAY_FLIP_ON (1<<21)
-#define MI_OVERLAY_FLIP_OFF (2<<21)
-
-/* Wait for Events */
-#define MI_WAIT_FOR_EVENT (0x03<<23)
-#define MI_WAIT_FOR_OVERLAY_FLIP (1<<16)
-
-/* Flush */
-#define MI_FLUSH (0x04<<23)
-#define MI_WRITE_DIRTY_STATE (1<<4)
-#define MI_END_SCENE (1<<3)
-#define MI_INHIBIT_RENDER_CACHE_FLUSH (1<<2)
-#define MI_INVALIDATE_MAP_CACHE (1<<0)
-
-/* Noop */
-#define MI_NOOP 0x00
-#define MI_NOOP_WRITE_ID (1<<22)
-#define MI_NOOP_ID_MASK (1<<22 - 1)
-
-#define STATE3D_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x01<<16))
-
-/* STATE3D_FOG_MODE stuff */
-#define ENABLE_FOG_SOURCE (1<<27)
-#define ENABLE_FOG_CONST (1<<24)
-#define ENABLE_FOG_DENSITY (1<<23)
-
-
-#define MAX_DISPLAY_PIPES 2
-
-typedef enum {
- CrtIndex = 0,
- TvIndex,
- DfpIndex,
- LfpIndex,
- Tv2Index,
- Dfp2Index,
- UnknownIndex,
- Unknown2Index,
- NumDisplayTypes,
- NumKnownDisplayTypes = UnknownIndex
-} DisplayType;
-
-/* What's connected to the pipes (as reported by the BIOS) */
-#define PIPE_ACTIVE_MASK 0xff
-#define PIPE_CRT_ACTIVE (1 << CrtIndex)
-#define PIPE_TV_ACTIVE (1 << TvIndex)
-#define PIPE_DFP_ACTIVE (1 << DfpIndex)
-#define PIPE_LCD_ACTIVE (1 << LfpIndex)
-#define PIPE_TV2_ACTIVE (1 << Tv2Index)
-#define PIPE_DFP2_ACTIVE (1 << Dfp2Index)
-#define PIPE_UNKNOWN_ACTIVE ((1 << UnknownIndex) | \
- (1 << Unknown2Index))
-
-#define PIPE_SIZED_DISP_MASK (PIPE_DFP_ACTIVE | \
- PIPE_LCD_ACTIVE | \
- PIPE_DFP2_ACTIVE)
-
-#define PIPE_A_SHIFT 0
-#define PIPE_B_SHIFT 8
-#define PIPE_SHIFT(n) ((n) == 0 ? \
- PIPE_A_SHIFT : PIPE_B_SHIFT)
-
-/*
- * Some BIOS scratch area registers. The 845 (and 830?) store the amount
- * of video memory available to the BIOS in SWF1.
- */
-
-#define SWF0 0x71410
-#define SWF1 0x71414
-#define SWF2 0x71418
-#define SWF3 0x7141c
-#define SWF4 0x71420
-#define SWF5 0x71424
-#define SWF6 0x71428
-
-/*
- * 855 scratch registers.
- */
-#define SWF00 0x70410
-#define SWF01 0x70414
-#define SWF02 0x70418
-#define SWF03 0x7041c
-#define SWF04 0x70420
-#define SWF05 0x70424
-#define SWF06 0x70428
-
-#define SWF10 SWF0
-#define SWF11 SWF1
-#define SWF12 SWF2
-#define SWF13 SWF3
-#define SWF14 SWF4
-#define SWF15 SWF5
-#define SWF16 SWF6
-
-#define SWF30 0x72414
-#define SWF31 0x72418
-#define SWF32 0x7241c
-
-/*
- * Overlay registers. These are overlay registers accessed via MMIO.
- * Those loaded via the overlay register page are defined in i830_video.c.
- */
-#define OVADD 0x30000
-
-#define DOVSTA 0x30008
-#define OC_BUF (0x3<<20)
-
-#define OGAMC5 0x30010
-#define OGAMC4 0x30014
-#define OGAMC3 0x30018
-#define OGAMC2 0x3001c
-#define OGAMC1 0x30020
-#define OGAMC0 0x30024
-
-
-/*
- * Palette registers
- */
-#define PALETTE_A 0x0a000
-#define PALETTE_B 0x0a800
-
-#endif /* _I810_REG_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/Makefile
deleted file mode 100644
index 3276d396e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = i830_dri.so
-
-DRIVER_SOURCES = \
- i830_context.c \
- i830_debug.c \
- i830_ioctl.c \
- i830_render.c \
- i830_screen.c \
- i830_span.c \
- i830_state.c \
- i830_tex.c \
- i830_texmem.c \
- i830_texstate.c \
- i830_tris.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(MINIGLX_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_3d_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_3d_reg.h
deleted file mode 100644
index fa6f407ef..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_3d_reg.h
+++ /dev/null
@@ -1,677 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_3d_reg.h,v 1.4 2002/12/10 01:26:53 dawes Exp $ */
-#define I830_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#define CMD_3D (0x3<<29)
-
-/* 3DPRIMITIVE, p104 */
-#define PRIM3D_INLINE (CMD_3D | (0x1f<<24))
-#define PRIM3D_INDIRECT_SEQ ((1<<23) | PRIM3D_INLINE)
-#define PRIM3D_INDICES ((1<<23) | PRIM3D_INLINE | (1<<17))
-
-#define PRIM3D_INLINE_CNT(used) ((used / 4) - 2)
-#define PRIM3D_INDICES_CNT(num_indices) ((num_indices + 1) / 2)
-#define PRIM3D_INDIRECT_CNT(verts) (verts)
-
-#define PRIM3D_TRILIST 0
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-
-/* STATE3D_ANTI_ALIASING, p 123 */
-#define STATE3D_AA_CMD (CMD_3D | (0x06<<24))
-
-#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
-#define AA_LINE_ECAAR_WIDTH_0_5 0
-#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
-#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
-#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
-
-#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
-#define AA_LINE_REGION_WIDTH_0_5 0
-#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
-#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
-#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
-
-#define AA_LINE_ENABLE ((1<<1) | 1)
-#define AA_LINE_DISABLE (1<<1)
-
-/* STATE3D_BUFFER_INFO, p 124 */
-#define STATE3D_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
-/* Dword 1 */
-#define BUF_3D_ID_COLOR_BACK (0x3<<24)
-#define BUF_3D_ID_DEPTH (0x7<<24)
-#define BUF_3D_USE_FENCE (1<<23)
-#define BUF_3D_TILED_SURFACE (1<<22)
-#define BUF_3D_TILE_WALK_X 0
-#define BUF_3D_TILE_WALK_Y (1<<21)
-#define BUF_3D_PITCH(x) ((x)<<2)
-/* Dword 2 */
-#define BUF_3D_ADDR(x) ((x) & ~0x3)
-
-/* STATE3D_COLOR_FACTOR_0, p127 */
-#define STATE3D_COLOR_FACTOR_CMD(stage) (CMD_3D | (0x1d<<24) | ((0x90 + (stage))<<16))
-
-/* STATE3D_CONSTANT_BLEND_COLOR, p128 */
-#define STATE3D_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
-
-/* STATE3D_DEFAULT_DIFFUSE, p128 */
-#define STATE3D_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
-
-/* STATE3D_DEFAULT_SPECULAR, p129 */
-#define STATE3D_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
-
-/* STATE3D_DEFAULT_Z, p129 */
-#define STATE3D_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
-
-/* STATE3D_DEST_BUFFER_VARIABLES, p130 */
-#define STATE3D_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
-/* Dword 1 */
-#define DSTORG_HORT_BIAS(x) ((x)<<20)
-#define DSTORG_VERT_BIAS(x) ((x)<<16)
-#define COLOR_4_2_2_CHNL_WRT_ALL 0
-#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
-#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
-#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
-#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
-#define COLR_BUF_8BIT 0
-#define COLR_BUF_RGB555 (1<<8)
-#define COLR_BUF_RGB565 (2<<8)
-#define COLR_BUF_ARGB8888 (3<<8)
-#define DEPTH_IS_Z 0
-#define DEPTH_IS_W (1<<6)
-#define DEPTH_FRMT_16_FIXED 0
-#define DEPTH_FRMT_16_FLOAT (1<<2)
-#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
-#define DEPTH_FRMT_24_FLOAT_8_OTHER (3<<2)
-#define VERT_LINE_STRIDE_1 (1<<1)
-#define VERT_LINE_STRIDE_0 0
-#define VERT_LINE_STRIDE_OFS_1 1
-#define VERT_LINE_STRIDE_OFS_0 0
-
-/* STATE3D_DRAWING_RECTANGLE, p133 */
-#define STATE3D_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
-/* Dword 1 */
-#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
-#define DRAW_DITHER_OFS_X(x) ((x)<<26)
-#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
-/* Dword 2 */
-#define DRAW_YMIN(x) ((x)<<16)
-#define DRAW_XMIN(x) (x)
-/* Dword 3 */
-#define DRAW_YMAX(x) ((x)<<16)
-#define DRAW_XMAX(x) (x)
-/* Dword 4 */
-#define DRAW_YORG(x) ((x)<<16)
-#define DRAW_XORG(x) (x)
-
-/* STATE3D_ENABLES_1, p136 */
-#define STATE3D_ENABLES_1_CMD (CMD_3D|(0x3<<24))
-#define ENABLE_LOGIC_OP_MASK ((1<<23)|(1<<22))
-#define ENABLE_LOGIC_OP ((1<<23)|(1<<22))
-#define DISABLE_LOGIC_OP (1<<23)
-#define ENABLE_STENCIL_TEST ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_TEST (1<<21)
-#define ENABLE_DEPTH_BIAS ((1<<11)|(1<<10))
-#define DISABLE_DEPTH_BIAS (1<<11)
-#define ENABLE_SPEC_ADD_MASK ((1<<9)|(1<<8))
-#define ENABLE_SPEC_ADD ((1<<9)|(1<<8))
-#define DISABLE_SPEC_ADD (1<<9)
-#define ENABLE_DIS_FOG_MASK ((1<<7)|(1<<6))
- /* prefixed I830 because ENABLE_FOG defined elsewhere */
-#define I830_ENABLE_FOG ((1<<7)|(1<<6))
-#define I830_DISABLE_FOG (1<<7)
-#define ENABLE_DIS_ALPHA_TEST_MASK ((1<<5)|(1<<4))
-#define ENABLE_ALPHA_TEST ((1<<5)|(1<<4))
-#define DISABLE_ALPHA_TEST (1<<5)
-#define ENABLE_DIS_CBLEND_MASK ((1<<3)|(1<<2))
-#define ENABLE_COLOR_BLEND ((1<<3)|(1<<2))
-#define DISABLE_COLOR_BLEND (1<<3)
-#define ENABLE_DIS_DEPTH_TEST_MASK ((1<<1)|1)
-#define ENABLE_DEPTH_TEST ((1<<1)|1)
-#define DISABLE_DEPTH_TEST (1<<1)
-
-/* STATE3D_ENABLES_2, p138 */
-#define STATE3D_ENABLES_2_CMD (CMD_3D|(0x4<<24))
-#define ENABLE_STENCIL_WRITE ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_WRITE (1<<21)
-#define ENABLE_TEX_CACHE ((1<<17)|(1<<16))
-#define DISABLE_TEX_CACHE (1<<17)
-#define ENABLE_DITHER ((1<<9)|(1<<8))
-#define DISABLE_DITHER (1<<9)
-#define ENABLE_COLOR_MASK (1<<10)
-#define WRITEMASK_ALPHA (1<<7)
-#define WRITEMASK_ALPHA_SHIFT 7
-#define WRITEMASK_RED (1<<6)
-#define WRITEMASK_RED_SHIFT 6
-#define WRITEMASK_GREEN (1<<5)
-#define WRITEMASK_GREEN_SHIFT 5
-#define WRITEMASK_BLUE (1<<4)
-#define WRITEMASK_BLUE_SHIFT 4
-#define WRITEMASK_MASK ((1<<4)|(1<<5)|(1<<6)|(1<<7))
-#define ENABLE_COLOR_WRITE ((1<<3)|(1<<2))
-#define DISABLE_COLOR_WRITE (1<<3)
-#define ENABLE_DIS_DEPTH_WRITE_MASK 0x3
-#define ENABLE_DEPTH_WRITE ((1<<1)|1)
-#define DISABLE_DEPTH_WRITE (1<<1)
-
-/* STATE3D_FOG_COLOR, p139 */
-#define STATE3D_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
-#define FOG_COLOR_RED(x) ((x)<<16)
-#define FOG_COLOR_GREEN(x) ((x)<<8)
-#define FOG_COLOR_BLUE(x) (x)
-
-/* STATE3D_FOG_MODE, p140 */
-#define STATE3D_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
-/* Dword 1 */
-#define FOGFUNC_ENABLE (1<<31)
-#define FOGFUNC_VERTEX 0
-#define FOGFUNC_PIXEL_EXP (1<<28)
-#define FOGFUNC_PIXEL_EXP2 (2<<28)
-#define FOGFUNC_PIXEL_LINEAR (3<<28)
-#define FOGSRC_INDEX_Z (1<<27)
-#define FOGSRC_INDEX_W ((1<<27)|(1<<25))
-#define FOG_LINEAR_CONST (1<<24)
-#define FOG_CONST_1(x) ((x)<<4)
-#define ENABLE_FOG_DENSITY (1<<23)
-/* Dword 2 */
-#define FOG_CONST_2(x) (x)
-/* Dword 3 */
-#define FOG_DENSITY(x) (x)
-
-/* STATE3D_INDEPENDENT_ALPHA_BLEND, p142 */
-#define STATE3D_INDPT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
-#define ENABLE_INDPT_ALPHA_BLEND ((1<<23)|(1<<22))
-#define DISABLE_INDPT_ALPHA_BLEND (1<<23)
-#define ALPHA_BLENDFUNC_MASK 0x3f0000
-#define ENABLE_ALPHA_BLENDFUNC (1<<21)
-#define ABLENDFUNC_ADD 0
-#define ABLENDFUNC_SUB (1<<16)
-#define ABLENDFUNC_RVSE_SUB (2<<16)
-#define ABLENDFUNC_MIN (3<<16)
-#define ABLENDFUNC_MAX (4<<16)
-#define SRC_DST_ABLEND_MASK 0xfff
-#define ENABLE_SRC_ABLEND_FACTOR (1<<11)
-#define SRC_ABLEND_FACT(x) ((x)<<6)
-#define ENABLE_DST_ABLEND_FACTOR (1<<5)
-#define DST_ABLEND_FACT(x) (x)
-
-#define BLEND_STATE_MASK (ALPHA_BLENDFUNC_MASK | SRC_DST_ABLEND_MASK)
-
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_DST_COLR 0x09
-#define BLENDFACT_INV_DST_COLR 0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
-#define BLENDFACT_CONST_COLOR 0x0c
-#define BLENDFACT_INV_CONST_COLOR 0x0d
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-
-/* STATE3D_MAP_BLEND_ARG, p152 */
-#define STATE3D_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20))
-
-#define TEXPIPE_COLOR 0
-#define TEXPIPE_ALPHA (1<<18)
-#define TEXPIPE_KILL (2<<18)
-#define TEXBLEND_ARG0 0
-#define TEXBLEND_ARG1 (1<<15)
-#define TEXBLEND_ARG2 (2<<15)
-#define TEXBLEND_ARG3 (3<<15)
-#define TEXBLENDARG_MODIFY_PARMS (1<<6)
-#define TEXBLENDARG_REPLICATE_ALPHA (1<<5)
-#define TEXBLENDARG_INV_ARG (1<<4)
-#define TEXBLENDARG_ONE 0
-#define TEXBLENDARG_FACTOR 0x01
-#define TEXBLENDARG_ACCUM 0x02
-#define TEXBLENDARG_DIFFUSE 0x03
-#define TEXBLENDARG_SPEC 0x04
-#define TEXBLENDARG_CURRENT 0x05
-#define TEXBLENDARG_TEXEL0 0x06
-#define TEXBLENDARG_TEXEL1 0x07
-#define TEXBLENDARG_TEXEL2 0x08
-#define TEXBLENDARG_TEXEL3 0x09
-#define TEXBLENDARG_FACTOR_N 0x0e
-
-/* STATE3D_MAP_BLEND_OP, p155 */
-#define STATE3D_MAP_BLEND_OP_CMD(stage) (CMD_3D|(0x0d<<24)|((stage)<<20))
-#if 0
-#define TEXPIPE_COLOR 0
-#define TEXPIPE_ALPHA (1<<18)
-#define TEXPIPE_KILL (2<<18)
-#endif
-#define ENABLE_TEXOUTPUT_WRT_SEL (1<<17)
-#define TEXOP_OUTPUT_CURRENT 0
-#define TEXOP_OUTPUT_ACCUM (1<<15)
-#define ENABLE_TEX_CNTRL_STAGE ((1<<12)|(1<<11))
-#define DISABLE_TEX_CNTRL_STAGE (1<<12)
-#define TEXOP_SCALE_SHIFT 9
-#define TEXOP_SCALE_1X (0 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_2X (1 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_4X (2 << TEXOP_SCALE_SHIFT)
-#define TEXOP_MODIFY_PARMS (1<<8)
-#define TEXOP_LAST_STAGE (1<<7)
-#define TEXBLENDOP_KILLPIXEL 0x02
-#define TEXBLENDOP_ARG1 0x01
-#define TEXBLENDOP_ARG2 0x02
-#define TEXBLENDOP_MODULATE 0x03
-#define TEXBLENDOP_ADD 0x06
-#define TEXBLENDOP_ADDSIGNED 0x07
-#define TEXBLENDOP_BLEND 0x08
-#define TEXBLENDOP_BLEND_AND_ADD 0x09
-#define TEXBLENDOP_SUBTRACT 0x0a
-#define TEXBLENDOP_DOT3 0x0b
-#define TEXBLENDOP_DOT4 0x0c
-#define TEXBLENDOP_MODULATE_AND_ADD 0x0d
-#define TEXBLENDOP_MODULATE_2X_AND_ADD 0x0e
-#define TEXBLENDOP_MODULATE_4X_AND_ADD 0x0f
-
-/* STATE3D_MAP_BUMP_TABLE, p160 TODO */
-/* STATE3D_MAP_COLOR_CHROMA_KEY, p161 TODO */
-
-/* STATE3D_MAP_COORD_SET_BINDINGS, p162 */
-#define STATE3D_MAP_COORD_SETBIND_CMD (CMD_3D|(0x1d<<24)|(0x02<<16))
-#define TEXBIND_MASK3 ((1<<15)|(1<<14)|(1<<13)|(1<<12))
-#define TEXBIND_MASK2 ((1<<11)|(1<<10)|(1<<9)|(1<<8))
-#define TEXBIND_MASK1 ((1<<7)|(1<<6)|(1<<5)|(1<<4))
-#define TEXBIND_MASK0 ((1<<3)|(1<<2)|(1<<1)|1)
-
-#define TEXBIND_SET3(x) ((x)<<12)
-#define TEXBIND_SET2(x) ((x)<<8)
-#define TEXBIND_SET1(x) ((x)<<4)
-#define TEXBIND_SET0(x) (x)
-
-#define TEXCOORDSRC_KEEP 0
-#define TEXCOORDSRC_DEFAULT 0x01
-#define TEXCOORDSRC_VTXSET_0 0x08
-#define TEXCOORDSRC_VTXSET_1 0x09
-#define TEXCOORDSRC_VTXSET_2 0x0a
-#define TEXCOORDSRC_VTXSET_3 0x0b
-#define TEXCOORDSRC_VTXSET_4 0x0c
-#define TEXCOORDSRC_VTXSET_5 0x0d
-#define TEXCOORDSRC_VTXSET_6 0x0e
-#define TEXCOORDSRC_VTXSET_7 0x0f
-
-#define MAP_UNIT(unit) ((unit)<<16)
-#define MAP_UNIT_MASK (3<<16)
-
-/* STATE3D_MAP_COORD_SETS, p164 */
-#define STATE3D_MAP_COORD_SET_CMD (CMD_3D|(0x1c<<24)|(0x01<<19))
-#define ENABLE_TEXCOORD_PARAMS (1<<15)
-#define TEXCOORDS_ARE_NORMAL (1<<14)
-#define TEXCOORDS_ARE_IN_TEXELUNITS 0
-#define TEXCOORDTYPE_CARTESIAN 0
-#define TEXCOORDTYPE_HOMOGENEOUS (1<<11)
-#define TEXCOORDTYPE_VECTOR (2<<11)
-#define ENABLE_ADDR_V_CNTL (1<<7)
-#define ENABLE_ADDR_U_CNTL (1<<3)
-#define TEXCOORD_ADDR_V_MODE(x) ((x)<<4)
-#define TEXCOORD_ADDR_U_MODE(x) (x)
-#define TEXCOORDMODE_WRAP 0
-#define TEXCOORDMODE_MIRROR 1
-#define TEXCOORDMODE_CLAMP 2
-#define TEXCOORDMODE_WRAP_SHORTEST 3
-#define TEXCOORDMODE_CLAMP_BORDER 4
-#define TEXCOORD_ADDR_V_MASK 0x70
-#define TEXCOORD_ADDR_U_MASK 0x7
-
-/* STATE3D_MAP_CUBE, p168 TODO */
-#define STATE3D_MAP_CUBE (CMD_3D|(0x1c<<24)|(0x0a<<19))
-#define CUBE_NEGX_ENABLE (1<<5)
-#define CUBE_POSX_ENABLE (1<<4)
-#define CUBE_NEGY_ENABLE (1<<3)
-#define CUBE_POSY_ENABLE (1<<2)
-#define CUBE_NEGZ_ENABLE (1<<1)
-#define CUBE_POSZ_ENABLE (1<<0)
-
-
-/* STATE3D_MODES_1, p190 */
-#define STATE3D_MODES_1_CMD (CMD_3D|(0x08<<24))
-#define BLENDFUNC_MASK 0x3f0000
-#define ENABLE_COLR_BLND_FUNC (1<<21)
-#define BLENDFUNC_ADD 0
-#define BLENDFUNC_SUB (1<<16)
-#define BLENDFUNC_RVRSE_SUB (2<<16)
-#define BLENDFUNC_MIN (3<<16)
-#define BLENDFUNC_MAX (4<<16)
-#define SRC_DST_BLND_MASK 0xfff
-#define ENABLE_SRC_BLND_FACTOR (1<<11)
-#define ENABLE_DST_BLND_FACTOR (1<<5)
-#define SRC_BLND_FACT(x) ((x)<<6)
-#define DST_BLND_FACT(x) (x)
-
-/* Use the blendfact defines for BLND_FACTOR macros */
-#if 0
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-#endif
-
-/* STATE3D_MODES_2, p192 */
-#define STATE3D_MODES_2_CMD (CMD_3D|(0x0f<<24))
-#define ENABLE_GLOBAL_DEPTH_BIAS (1<<22)
-#define GLOBAL_DEPTH_BIAS(x) ((x)<<14)
-#define ENABLE_ALPHA_TEST_FUNC (1<<13)
-#define ENABLE_ALPHA_REF_VALUE (1<<8)
-#define ALPHA_TEST_FUNC(x) ((x)<<9)
-#define ALPHA_REF_VALUE(x) (x)
-
-#define ALPHA_TEST_REF_MASK 0x3fff
-#define COMPAREFUNC_ALWAYS 0
-#define COMPAREFUNC_NEVER 0x1
-#define COMPAREFUNC_LESS 0x2
-#define COMPAREFUNC_EQUAL 0x3
-#define COMPAREFUNC_LEQUAL 0x4
-#define COMPAREFUNC_GREATER 0x5
-#define COMPAREFUNC_NOTEQUAL 0x6
-#define COMPAREFUNC_GEQUAL 0x7
-
-/* STATE3D_MODES_3, p193 */
-#define STATE3D_MODES_3_CMD (CMD_3D|(0x02<<24))
-#define DEPTH_TEST_FUNC_MASK 0x1f0000
-#define ENABLE_DEPTH_TEST_FUNC (1<<20)
-/* Uses COMPAREFUNC */
-#define DEPTH_TEST_FUNC(x) ((x)<<16)
-#define ENABLE_ALPHA_SHADE_MODE (1<<11)
-#define ENABLE_FOG_SHADE_MODE (1<<9)
-#define ENABLE_SPEC_SHADE_MODE (1<<7)
-#define ENABLE_COLOR_SHADE_MODE (1<<5)
-#define ALPHA_SHADE_MODE(x) ((x)<<10)
-#define FOG_SHADE_MODE(x) ((x)<<8)
-#define SPEC_SHADE_MODE(x) ((x)<<6)
-#define COLOR_SHADE_MODE(x) ((x)<<4)
-#define CULLMODE_MASK 0xf
-#define ENABLE_CULL_MODE (1<<3)
-#define CULLMODE_BOTH 0
-#define CULLMODE_NONE 1
-#define CULLMODE_CW 2
-#define CULLMODE_CCW 3
-
-#define SHADE_MODE_LINEAR 0
-#define SHADE_MODE_FLAT 0x1
-
-/* STATE3D_MODES_4, p195 */
-#define STATE3D_MODES_4_CMD (CMD_3D|(0x16<<24))
-#define ENABLE_LOGIC_OP_FUNC (1<<23)
-#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK ((1<<18)|(1<<19)|(1<<20)|(1<<21))
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
-#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
-#define ENABLE_STENCIL_TEST_MASK (1<<17)
-#define STENCIL_TEST_MASK(x) ((x)<<8)
-#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
-#define ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define STENCIL_WRITE_MASK(x) (x)
-
-/* STATE3D_MODES_5, p196 */
-#define STATE3D_MODES_5_CMD (CMD_3D|(0x0c<<24))
-#define ENABLE_SPRITE_POINT_TEX (1<<23)
-#define SPRITE_POINT_TEX_ON (1<<22)
-#define SPRITE_POINT_TEX_OFF 0
-#define FLUSH_RENDER_CACHE (1<<18)
-#define FLUSH_TEXTURE_CACHE (1<<16)
-#define FIXED_LINE_WIDTH_MASK 0xfc00
-#define ENABLE_FIXED_LINE_WIDTH (1<<15)
-#define FIXED_LINE_WIDTH(x) ((x)<<10)
-#define FIXED_POINT_WIDTH_MASK 0x3ff
-#define ENABLE_FIXED_POINT_WIDTH (1<<9)
-#define FIXED_POINT_WIDTH(x) (x)
-
-/* STATE3D_RASTERIZATION_RULES, p198 */
-#define STATE3D_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
-#define ENABLE_POINT_RASTER_RULE (1<<15)
-#define OGL_POINT_RASTER_RULE (1<<13)
-#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
-#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
-#define ENABLE_TRI_STRIP_PROVOKE_VRTX (1<<2)
-#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
-#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
-#define TRI_STRIP_PROVOKE_VRTX(x) (x)
-
-/* STATE3D_SCISSOR_ENABLE, p200 */
-#define STATE3D_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
-#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
-#define DISABLE_SCISSOR_RECT (1<<1)
-
-/* STATE3D_SCISSOR_RECTANGLE_0, p201 */
-#define STATE3D_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
-/* Dword 1 */
-#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMIN(x) (x)
-/* Dword 2 */
-#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMAX(x) (x)
-
-/* STATE3D_STENCIL_TEST, p202 */
-#define STATE3D_STENCIL_TEST_CMD (CMD_3D|(0x09<<24))
-#define ENABLE_STENCIL_PARMS (1<<23)
-#define STENCIL_OPS_MASK (0xffc000)
-#define STENCIL_FAIL_OP(x) ((x)<<20)
-#define STENCIL_PASS_DEPTH_FAIL_OP(x) ((x)<<17)
-#define STENCIL_PASS_DEPTH_PASS_OP(x) ((x)<<14)
-
-#define STENCILOP_KEEP 0
-#define STENCILOP_ZERO 0x1
-#define STENCILOP_REPLACE 0x2
-#define STENCILOP_INCRSAT 0x3
-#define STENCILOP_DECRSAT 0x4
-#define STENCILOP_INCR 0x5
-#define STENCILOP_DECR 0x6
-#define STENCILOP_INVERT 0x7
-
-#define ENABLE_STENCIL_TEST_FUNC_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9))
-#define ENABLE_STENCIL_TEST_FUNC (1<<13)
-/* Uses COMPAREFUNC */
-#define STENCIL_TEST_FUNC(x) ((x)<<9)
-#define STENCIL_REF_VALUE_MASK ((1<<8)|0xff)
-#define ENABLE_STENCIL_REF_VALUE (1<<8)
-#define STENCIL_REF_VALUE(x) (x)
-
-/* STATE3D_VERTEX_FORMAT, p204 */
-#define STATE3D_VERTEX_FORMAT_CMD (CMD_3D|(0x05<<24))
-#define VRTX_HAS_POINT_WIDTH (1<<12)
-#define VRTX_TEX_COORD_COUNT(x) ((x)<<8)
-#define VRTX_HAS_SPEC (1<<7)
-#define VRTX_HAS_DIFFUSE (1<<6)
-#define VRTX_HAS_DEPTH_OFS (1<<5)
-#define VRTX_HAS_XYZ (1<<1)
-#define VRTX_HAS_XYZW (2<<1)
-#define VRTX_HAS_XY (3<<1)
-#define VRTX_HAS_XYW (4<<1)
-
-/* STATE3D_VERTEX_FORMAT_2, p206 */
-#define STATE3D_VERTEX_FORMAT_2_CMD (CMD_3D|(0x0a<<24))
-#define VRTX_TEX_SET_7_FMT(x) ((x)<<14)
-#define VRTX_TEX_SET_6_FMT(x) ((x)<<12)
-#define VRTX_TEX_SET_5_FMT(x) ((x)<<10)
-#define VRTX_TEX_SET_4_FMT(x) ((x)<<8)
-#define VRTX_TEX_SET_3_FMT(x) ((x)<<6)
-#define VRTX_TEX_SET_2_FMT(x) ((x)<<4)
-#define VRTX_TEX_SET_1_FMT(x) ((x)<<2)
-#define VRTX_TEX_SET_0_FMT(x) (x)
-
-#define TEXCOORDFMT_2D 0
-#define TEXCOORDFMT_3D 1
-#define TEXCOORDFMT_4D 2
-#define TEXCOORDFMT_1D 3
-
-/*New stuff picked up along the way */
-
-#define MLC_LOD_BIAS_MASK ((1<<7)-1)
-
-
-/* STATE3D_VERTEX_TRANSFORM, p207 */
-#define STATE3D_VERTEX_TRANS_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|0)
-#define STATE3D_VERTEX_TRANS_MTX_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|6)
-/* Dword 1 */
-#define ENABLE_VIEWPORT_TRANSFORM ((1<<31)|(1<<30))
-#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
-#define ENABLE_PERSP_DIVIDE ((1<<29)|(1<<28))
-#define DISABLE_PERSP_DIVIDE (1<<29)
-#define VRTX_TRANS_LOAD_MATRICES 0x7421
-#define VRTX_TRANS_NO_LOAD_MATRICES 0x0000
-/* Dword 2 -> 7 are matrix elements */
-
-/* STATE3D_W_STATE, p209 */
-#define STATE3D_W_STATE_CMD (CMD_3D|(0x1d<<24)|(0x8d<<16)|1)
-/* Dword 1 */
-#define MAGIC_W_STATE_DWORD1 0x00000008
-/* Dword 2 */
-#define WFAR_VALUE(x) (x)
-
-/* if defining I830_ENABLE_4_TEXTURES, do it in i830_drm.h, too */
-
-#define I830PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define I830PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define I830PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define I830PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-
-/* Stipple command, carried over from the i810, apparently:
- */
-#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-
-
-#define STATE3D_LOAD_STATE_IMMEDIATE_2 ((0x3<<29)|(0x1d<<24)|(0x03<<16))
-#define LOAD_TEXTURE_MAP0 (1<<11)
-
-#define TM0S0_ADDRESS_MASK 0xfffffffc
-#define TM0S0_USE_FENCE (1<<1)
-
-#define TM0S1_HEIGHT_SHIFT 21
-#define TM0S1_WIDTH_SHIFT 10
-#define TM0S1_PALETTE_SELECT (1<<9)
-#define TM0S1_MAPSURF_FORMAT_MASK (0x7 << 6)
-#define TM0S1_MAPSURF_FORMAT_SHIFT 6
-#define MAPSURF_8BIT_INDEXED (0<<6)
-#define MAPSURF_8BIT (1<<6)
-#define MAPSURF_16BIT (2<<6)
-#define MAPSURF_32BIT (3<<6)
-#define MAPSURF_411 (4<<6)
-#define MAPSURF_422 (5<<6)
-#define MAPSURF_COMPRESSED (6<<6)
-#define MAPSURF_4BIT_INDEXED (7<<6)
-#define TM0S1_MT_FORMAT_MASK (0x7 << 3)
-#define TM0S1_MT_FORMAT_SHIFT 3
-#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
-#define MT_8BIT_IDX_RGB565 (0<<3) /* SURFACE_8BIT_INDEXED */
-#define MT_8BIT_IDX_ARGB1555 (1<<3)
-#define MT_8BIT_IDX_ARGB4444 (2<<3)
-#define MT_8BIT_IDX_AY88 (3<<3)
-#define MT_8BIT_IDX_ABGR8888 (4<<3)
-#define MT_8BIT_IDX_BUMP_88DVDU (5<<3)
-#define MT_8BIT_IDX_BUMP_655LDVDU (6<<3)
-#define MT_8BIT_IDX_ARGB8888 (7<<3)
-#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
-#define MT_8BIT_L8 (1<<3)
-#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
-#define MT_16BIT_ARGB1555 (1<<3)
-#define MT_16BIT_ARGB4444 (2<<3)
-#define MT_16BIT_AY88 (3<<3)
-#define MT_16BIT_DIB_ARGB1555_8888 (4<<3)
-#define MT_16BIT_BUMP_88DVDU (5<<3)
-#define MT_16BIT_BUMP_655LDVDU (6<<3)
-#define MT_16BIT_DIB_RGB565_8888 (7<<3)
-#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
-#define MT_32BIT_ABGR8888 (1<<3)
-#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3)
-#define MT_32BIT_DIB_8888 (7<<3)
-#define MT_411_YUV411 (0<<3) /* SURFACE_411 */
-#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
-#define MT_422_YCRCB_NORMAL (1<<3)
-#define MT_422_YCRCB_SWAPUV (2<<3)
-#define MT_422_YCRCB_SWAPUVY (3<<3)
-#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
-#define MT_COMPRESS_DXT2_3 (1<<3)
-#define MT_COMPRESS_DXT4_5 (2<<3)
-#define MT_COMPRESS_FXT1 (3<<3)
-#define TM0S1_COLORSPACE_CONVERSION (1 << 2)
-#define TM0S1_TILED_SURFACE (1 << 1)
-#define TM0S1_TILE_WALK (1 << 0)
-
-#define TM0S2_PITCH_SHIFT 21
-#define TM0S2_CUBE_FACE_ENA_SHIFT 15
-#define TM0S2_MAP_FORMAT (1<<14)
-#define TM0S2_VERTICAL_LINE_STRIDE (1<<13)
-#define TM0S2_VERITCAL_LINE_STRIDE_OFF (1<<12)
-#define TM0S2_OUTPUT_CHAN_SHIFT 10
-#define TM0S2_OUTPUT_CHAN_MASK (3<<10)
-
-#define TM0S3_MIP_FILTER_MASK (0x3<<30)
-#define TM0S3_MIP_FILTER_SHIFT 30
-#define MIPFILTER_NONE 0
-#define MIPFILTER_NEAREST 1
-#define MIPFILTER_LINEAR 3
-#define TM0S3_MAG_FILTER_MASK (0x3<<28)
-#define TM0S3_MAG_FILTER_SHIFT 28
-#define TM0S3_MIN_FILTER_MASK (0x3<<26)
-#define TM0S3_MIN_FILTER_SHIFT 26
-#define FILTER_NEAREST 0
-#define FILTER_LINEAR 1
-#define FILTER_ANISOTROPIC 2
-
-#define TM0S3_LOD_BIAS_SHIFT 17
-#define TM0S3_LOD_BIAS_MASK (0x1ff<<17)
-#define TM0S3_MAX_MIP_SHIFT 9
-#define TM0S3_MAX_MIP_MASK (0xff<<9)
-#define TM0S3_MIN_MIP_SHIFT 3
-#define TM0S3_MIN_MIP_MASK (0x3f<<3)
-#define TM0S3_KILL_PIXEL (1<<2)
-#define TM0S3_KEYED_FILTER (1<<1)
-#define TM0S3_CHROMA_KEY (1<<0)
-
-
-/* STATE3D_MAP_TEXEL_STREAM, p188 */
-#define STATE3D_MAP_TEX_STREAM_CMD (CMD_3D|(0x1c<<24)|(0x05<<19))
-#define DISABLE_TEX_STREAM_BUMP (1<<12)
-#define ENABLE_TEX_STREAM_BUMP ((1<<12)|(1<<11))
-#define TEX_MODIFY_UNIT_0 0
-#define TEX_MODIFY_UNIT_1 (1<<8)
-#define ENABLE_TEX_STREAM_COORD_SET (1<<7)
-#define TEX_STREAM_COORD_SET(x) ((x)<<4)
-#define ENABLE_TEX_STREAM_MAP_IDX (1<<3)
-#define TEX_STREAM_MAP_IDX(x) (x)
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c
deleted file mode 100644
index 45fcbd2e3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c
+++ /dev/null
@@ -1,626 +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.
- *
- * **************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_context.c,v 1.9 2003/02/06 04:18:00 dawes Exp $ */
-
-/**
- * \file i830_context.c
- *
- * Heavily Based on I810 driver written by Keith Whitwell.
- *
- * \author Jeff Hartmann <jhartmann@2d3d.com>
- * \author Graeme Fisher <graeme@2d3d.co.za>
- * \author Abraham vd Merwe <abraham@2d3d.co.za>
- * \author Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_span.h"
-#include "i830_tris.h"
-#include "i830_ioctl.h"
-
-
-#include "utils.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_secondary_color
-#include "extension_helper.h"
-
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-#ifndef I830_DEBUG
-int I830_DEBUG = (0);
-#endif
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-#define DRIVER_DATE "20041007"
-
-
-static const GLubyte *i830DDGetString( GLcontext *ctx, GLenum name )
-{
- const char * chipset;
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- switch (I830_CONTEXT(ctx)->i830Screen->deviceID) {
- case PCI_CHIP_845_G:
- return (GLubyte *)"2d3D, Inc";
-
- case PCI_CHIP_I830_M:
- return (GLubyte *)"VA Linux, Inc";
-
- case PCI_CHIP_I855_GM:
- case PCI_CHIP_I865_G:
- default:
- return (GLubyte *)"Tungsten Graphics, Inc";
- }
- break;
-
- case GL_RENDERER:
- switch (I830_CONTEXT(ctx)->i830Screen->deviceID) {
- case PCI_CHIP_845_G:
- chipset = "Intel(R) 845G"; break;
- case PCI_CHIP_I830_M:
- chipset = "Intel(R) 830M"; break;
- case PCI_CHIP_I855_GM:
- chipset = "Intel(R) 852GM/855GM"; break;
- case PCI_CHIP_I865_G:
- chipset = "Intel(R) 865G"; break;
- default:
- chipset = "Unknown Intel Chipset"; break;
- }
-
- (void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 );
- return (GLubyte *) buffer;
-
- default:
- return NULL;
- }
-}
-
-static void i830BufferSize(GLframebuffer *buffer,
- GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE(imesa);
- *width = imesa->driDrawable->w;
- *height = imesa->driDrawable->h;
- UNLOCK_HARDWARE(imesa);
-}
-
-
-/* Extension strings exported by the i830 driver.
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_texture_border_clamp", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_env_combine", NULL },
- { "GL_ARB_texture_env_crossbar", NULL },
- { "GL_ARB_texture_env_dot3", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_EXT_blend_color", GL_EXT_blend_color_functions },
- { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
- { "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_fog_coord", GL_EXT_fog_coord_functions },
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_EXT_texture_env_combine", NULL },
- { "GL_EXT_texture_env_dot3", NULL },
- { "GL_EXT_texture_filter_anisotropic", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_EXT_texture_rectangle", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-
-extern const struct tnl_pipeline_stage _i830_render_stage;
-
-static const struct tnl_pipeline_stage *i830_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
- &_i830_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "sleep", DEBUG_SLEEP },
- { NULL, 0 }
-};
-
-
-GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx , *shareCtx;
- i830ContextPtr imesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- i830ScreenPrivate *screen = (i830ScreenPrivate *)sPriv->private;
- I830SAREAPtr saPriv=(I830SAREAPtr)
- (((GLubyte *)sPriv->pSAREA)+screen->sarea_priv_offset);
- struct dd_function_table functions;
-
- /* Allocate i830 context */
- imesa = (i830ContextPtr) CALLOC_STRUCT(i830_context_t);
- if (!imesa)
- return GL_FALSE;
-
- /* Init default driver functions then plug in our I830-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions(&functions);
- i830InitIoctlFuncs(&functions);
- i830InitTextureFuncs(&functions);
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((i830ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- imesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
- &functions, (void*) imesa);
- if (!imesa->glCtx) {
- FREE(imesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = imesa;
-
-
- imesa->i830Screen = screen;
- imesa->driScreen = sPriv;
- imesa->sarea = saPriv;
- imesa->glBuffer = NULL;
-
- driParseConfigFiles (&imesa->optionCache, &screen->optionCache,
- screen->driScrnPriv->myNum, "i830");
-
- (void) memset( imesa->texture_heaps, 0, sizeof( imesa->texture_heaps ) );
- make_empty_list( & imesa->swapped );
-
- imesa->nr_heaps = 1;
- imesa->texture_heaps[0] = driCreateTextureHeap( 0, imesa,
- screen->textureSize,
- 12,
- I830_NR_TEX_REGIONS,
- imesa->sarea->texList,
- (unsigned *) & imesa->sarea->texAge, /* XXX shouldn't need cast! */
- & imesa->swapped,
- sizeof( struct i830_texture_object_t ),
- (destroy_texture_object_t *) i830DestroyTexObj );
-
- /* Set the maximum texture size small enough that we can guarantee
- * that every texture unit can bind a maximal texture and have them
- * in memory at once.
- */
-
- ctx = imesa->glCtx;
- ctx->Const.MaxTextureUnits = driQueryOptioni(&imesa->optionCache,
- "texture_units");
- ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
- ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
-
- /* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are tightly
- * FIXME: packed, but they're not in Intel graphics hardware.
- */
- driCalculateMaxTextureLevels( imesa->texture_heaps,
- imesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported */
- 0, /* cube textures unsupported. */
- 0, /* texture rectangles unsupported. */
- 12,
- GL_FALSE );
-
- ctx->Const.MaxTextureMaxAnisotropy = 2.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 3.0;
- ctx->Const.MaxLineWidthAA = 3.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 255.0;
- ctx->Const.MaxPointSizeAA = 3.0;
- ctx->Const.PointSizeGranularity = 1.0;
-
- ctx->Driver.GetBufferSize = i830BufferSize;
- ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
- ctx->Driver.GetString = i830DDGetString;
-
- /* Who owns who? */
- ctx->DriverCtx = (void *) imesa;
- imesa->glCtx = ctx;
-
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline: */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, i830_pipeline );
-
- /* Configure swrast and T&L 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 );
-
- /* Dri stuff */
- imesa->hHWContext = driContextPriv->hHWContext;
- imesa->driFd = sPriv->fd;
- /* drmLock ptr = &drm_hw_lock_t */
- imesa->driHwLock = (drmLock *) &sPriv->pSAREA->lock;
- imesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
-
- switch(mesaVis->depthBits) {
- case 16:
- imesa->depth_scale = 1.0/0xffff;
- imesa->depth_clear_mask = ~0;
- imesa->ClearDepth = 0xffff;
- break;
- case 24:
- imesa->depth_scale = 1.0/0xffffff;
- imesa->depth_clear_mask = 0x00ffffff;
- imesa->stencil_clear_mask = 0xff000000;
- imesa->ClearDepth = 0x00ffffff;
- break;
- case 32: /* Not supported */
- default:
- break;
- }
- /* Completely disable stenciling for now, there are some serious issues
- * with stencil.
- */
-#if 0
- imesa->hw_stencil = 0;
-#endif
-
- imesa->RenderIndex = ~0;
- imesa->dirty = ~0;
- imesa->upload_cliprects = GL_TRUE;
-
- imesa->CurrentTexObj[0] = 0;
- imesa->CurrentTexObj[1] = 0;
-
- imesa->do_irqs = (imesa->i830Screen->irq_active &&
- !getenv("I830_NO_IRQS"));
-
- _math_matrix_ctr (&imesa->ViewportMatrix);
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
-
- if (imesa->glCtx->Mesa_DXTn) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- _mesa_enable_extension( ctx, "GL_S3_s3tc" );
- }
- else if (driQueryOptionb (&imesa->optionCache, "force_s3tc_enable")) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- }
-
- _mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" );
-
- /* XXX these should really go right after _mesa_init_driver_functions() */
- i830DDInitStateFuncs( ctx );
- i830InitTriFuncs (ctx);
- i830DDInitSpanFuncs( ctx );
- i830DDInitState (ctx);
-
-#if DO_DEBUG
- I830_DEBUG = driParseDebugString( getenv( "I830_DEBUG" ),
- debug_control );
- I830_DEBUG |= driParseDebugString( getenv( "INTEL_DEBUG" ),
- debug_control );
-#endif
-
- if (getenv("I830_NO_RAST") ||
- getenv("INTEL_NO_RAST")) {
- fprintf(stderr, "disabling 3D rasterization\n");
- FALLBACK(imesa, I830_FALLBACK_USER, 1);
- }
-
- return GL_TRUE;
-}
-
-void i830DestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
-
- assert(imesa); /* should never be null */
- if (imesa) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (imesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext (imesa->glCtx);
- _tnl_DestroyContext (imesa->glCtx);
- _ac_DestroyContext (imesa->glCtx);
- _swrast_DestroyContext (imesa->glCtx);
-
- /* free the Mesa context */
- imesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(imesa->glCtx);
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( imesa->texture_heaps[ i ] );
- imesa->texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & imesa->swapped ) );
- }
-
- FREE(imesa);
- }
-}
-
-void i830XMesaSetFrontClipRects( i830ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
-
- i830EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-void i830XMesaSetBackClipRects( i830ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- if (imesa->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0) {
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
- } else {
- imesa->numClipRects = dPriv->numBackClipRects;
- imesa->pClipRects = dPriv->pBackClipRects;
- imesa->drawX = dPriv->backX;
- imesa->drawY = dPriv->backY;
- }
-
- i830EmitDrawingRectangle( imesa );
- imesa->upload_cliprects = GL_TRUE;
-}
-
-static void i830XMesaWindowMoved( i830ContextPtr imesa )
-{
- switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- i830XMesaSetFrontClipRects( imesa );
- break;
- case BUFFER_BIT_BACK_LEFT:
- i830XMesaSetBackClipRects( imesa );
- break;
- default:
- /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
- i830XMesaSetFrontClipRects( imesa );
- }
-}
-
-GLboolean i830UnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
- unsigned i;
-
- if (imesa) {
- /* Might want to change this so texblend isn't always updated */
- imesa->dirty |= (I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS |
- I830_UPLOAD_STIPPLE |
- I830_UPLOAD_TEXBLEND0 |
- I830_UPLOAD_TEXBLEND1 |
- I830_UPLOAD_TEXBLEND2 |
- I830_UPLOAD_TEXBLEND3);
-
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if (imesa->CurrentTexObj[i]) imesa->dirty |= I830_UPLOAD_TEX_N( i );
- }
- }
- return GL_TRUE;
-}
-
-GLboolean i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
-
- if (driContextPriv) {
- i830ContextPtr imesa = (i830ContextPtr) driContextPriv->driverPrivate;
-
- if ( imesa->driDrawable != driDrawPriv ) {
- imesa->driDrawable = driDrawPriv;
- i830XMesaWindowMoved( imesa );
- imesa->mesa_drawable = driDrawPriv;
- }
-
- imesa->driReadable = driReadPriv;
-
- _mesa_make_current(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
- } else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-void i830GetLock( i830ContextPtr imesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- __DRIscreenPrivate *sPriv = imesa->driScreen;
- I830SAREAPtr sarea = imesa->sarea;
- int me = imesa->hHWContext;
- unsigned i;
-
- drmGetLock(imesa->driFd, imesa->hHWContext, flags);
-
- /* If the window moved, may need to set a new cliprect now.
- *
- * NOTE: This releases and regains the hw lock, so all state
- * checking must be done *after* this call:
- */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv);
-
- /* If we lost context, need to dump all registers to hardware.
- * Note that we don't care about 2d contexts, even if they perform
- * accelerated commands, so the DRI locking in the X server is even
- * more broken than usual.
- */
-
- if (sarea->ctxOwner != me) {
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty |= (I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS |
- I830_UPLOAD_STIPPLE);
-
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if(imesa->CurrentTexObj[i]) imesa->dirty |= I830_UPLOAD_TEX_N( i );
- if(imesa->TexBlendWordsUsed[i]) imesa->dirty |= I830_UPLOAD_TEXBLEND_N( i );
- }
-
- sarea->perf_boxes = imesa->perf_boxes | I830_BOX_LOST_CONTEXT;
- sarea->ctxOwner = me;
- }
-
- /* Shared texture managment - if another client has played with
- * texture space, figure out which if any of our textures have been
- * ejected, and update our global LRU.
- */
-
- for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( imesa->texture_heaps[ i ] );
- }
-
- if (imesa->lastStamp != dPriv->lastStamp) {
- i830XMesaWindowMoved( imesa );
- imesa->lastStamp = dPriv->lastStamp;
- }
-
- sarea->last_quiescent = -1; /* just kill it for now */
-}
-
-void i830SwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- i830ContextPtr imesa;
- GLcontext *ctx;
- imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = imesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( 0 /*imesa->doPageFlip*/ ) { /* doPageFlip is never set !!! */
- i830PageFlip( dPriv );
- } else {
- i830CopyBuffer( dPriv );
- }
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!\n", __FUNCTION__);
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.h
deleted file mode 100644
index de141bd4a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i830
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- */
-
-/* Adapted for use in the I830M driver:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_context.h,v 1.7 2003/02/06 04:18:01 dawes Exp $ */
-
-#ifndef I830CONTEXT_INC
-#define I830CONTEXT_INC
-
-typedef struct i830_context_t i830Context;
-typedef struct i830_context_t *i830ContextPtr;
-typedef struct i830_texture_object_t *i830TextureObjectPtr;
-
-
-#include "mtypes.h"
-#include "drm.h"
-#include "mm.h"
-#include "tnl/t_vertex.h"
-
-#include "i830_screen.h"
-#include "i830_tex.h"
-
-#define TAG(x) i830##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-#define DV_PF_555 (1<<8)
-#define DV_PF_565 (2<<8)
-#define DV_PF_8888 (3<<8)
-
-#define I830_TEX_MAXLEVELS 10
-
-#define I830_CONTEXT(ctx) ((i830ContextPtr)(ctx->DriverCtx))
-#define GET_DISPATCH_AGE(imesa) imesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE(imesa) imesa->sarea->last_enqueue
-
-
-typedef void (*i830_tri_func)(i830ContextPtr, i830Vertex *, i830Vertex *,
- i830Vertex *);
-typedef void (*i830_line_func)(i830ContextPtr, i830Vertex *, i830Vertex *);
-typedef void (*i830_point_func)(i830ContextPtr, i830Vertex *);
-
-#define I830_MAX_TEXTURE_UNITS 4
-
-#define I830_FALLBACK_TEXTURE 0x1
-#define I830_FALLBACK_DRAW_BUFFER 0x2
-#define I830_FALLBACK_READ_BUFFER 0x4
-#define I830_FALLBACK_COLORMASK 0x8
-#define I830_FALLBACK_RENDERMODE 0x10
-#define I830_FALLBACK_STENCIL 0x20
-#define I830_FALLBACK_STIPPLE 0x40
-#define I830_FALLBACK_USER 0x80
-
-struct i830_context_t
-{
- GLint refcount;
- GLcontext *glCtx;
-
- /*From I830 stuff*/
- int TextureMode;
- GLuint renderindex;
- GLuint TexBlendWordsUsed[I830_MAX_TEXTURE_UNITS];
- GLuint TexBlend[I830_MAX_TEXTURE_UNITS][I830_TEXBLEND_SIZE];
- GLuint Init_TexBlend[I830_MAX_TEXTURE_UNITS][I830_TEXBLEND_SIZE];
- GLuint Init_TexBlendWordsUsed[I830_MAX_TEXTURE_UNITS];
- GLuint Init_BufferSetup[I830_DEST_SETUP_SIZE];
- GLuint LodBias[I830_MAX_TEXTURE_UNITS];
-
- GLenum palette_format;
- GLuint palette[256];
-
-
- GLuint Init_Setup[I830_CTX_SETUP_SIZE];
- GLuint vertex_prim;
- drmBufPtr vertex_dma_buffer;
-
- GLboolean mask_red;
- GLboolean mask_green;
- GLboolean mask_blue;
- GLboolean mask_alpha;
-
- GLubyte clear_red;
- GLubyte clear_green;
- GLubyte clear_blue;
- GLubyte clear_alpha;
-
- GLfloat depth_scale;
- int depth_clear_mask;
- int stencil_clear_mask;
- int ClearDepth;
- int hw_stencil;
-
- GLuint MonoColor;
-
- GLuint LastTexEnabled;
- GLuint TexEnabledMask;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[1];
- driTextureObject swapped;
-
- struct i830_texture_object_t *CurrentTexObj[I830_MAX_TEXTURE_UNITS];
-
- /* Rasterization and vertex state:
- */
- GLuint Fallback;
- GLuint NewGLState;
-
- /* Vertex state
- */
- GLuint vertex_size;
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
- char *verts; /* points to tnl->clipspace.vertex_buf */
-
-
- /* State for i830tris.c.
- */
- GLuint RenderIndex;
- GLmatrix ViewportMatrix;
- GLenum render_primitive;
- GLenum reduced_primitive;
- GLuint hw_primitive;
-
- drmBufPtr vertex_buffer;
- char *vertex_addr;
- GLuint vertex_low;
- GLuint vertex_high;
- GLuint vertex_last_prim;
-
- GLboolean upload_cliprects;
-
-
- /* Fallback rasterization functions
- */
- i830_point_func draw_point;
- i830_line_func draw_line;
- i830_tri_func draw_tri;
-
- /* Hardware state
- */
- GLuint dirty; /* I810_UPLOAD_* */
- GLuint Setup[I830_CTX_SETUP_SIZE];
- GLuint BufferSetup[I830_DEST_SETUP_SIZE];
- GLuint StippleSetup[I830_STP_SETUP_SIZE];
- unsigned int lastStamp;
- GLboolean hw_stipple;
-
- GLenum TexEnvImageFmt[2];
-
- /* State which can't be computed completely on the fly:
- */
- GLuint LcsCullMode;
- GLuint LcsLineWidth;
- GLuint LcsPointSize;
-
- /* Funny mesa mirrors
- */
- GLuint ClearColor;
-
- /* DRI stuff
- */
- GLuint needClip;
- GLframebuffer *glBuffer;
-
- /* These refer to the current draw (front vs. back) buffer:
- */
- char *drawMap; /* draw buffer address in virtual mem */
- char *readMap;
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- GLuint numClipRects; /* cliprects for that buffer */
- drm_clip_rect_t *pClipRects;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- int perf_boxes;
-
- int do_irqs;
-
- GLboolean scissor;
- drm_clip_rect_t draw_rect;
- drm_clip_rect_t scissor_rect;
-
- drm_context_t hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- __DRIdrawablePrivate *driDrawable; /**< DRI drawable bound to this
- * context for drawing.
- */
- __DRIdrawablePrivate *driReadable; /**< DRI drawable bound to this
- * context for reading.
- */
-
- /**
- * Drawable used by Mesa for software fallbacks for reading and
- * writing. It is set by Mesa's \c SetBuffer callback, and will always be
- * either \c i830_context_t::driDrawable or \c i830_context_t::driReadable.
- */
-
- __DRIdrawablePrivate * mesa_drawable;
-
- __DRIscreenPrivate *driScreen;
- i830ScreenPrivate *i830Screen;
- I830SAREAPtr sarea;
-
- /**
- * Configuration cache
- */
- driOptionCache optionCache;
-};
-
-
-#define I830_TEX_UNIT_ENABLED(unit) (1<<unit)
-#define VALID_I830_TEXTURE_OBJECT(tobj) (tobj)
-
-#define I830_CONTEXT(ctx) ((i830ContextPtr)(ctx->DriverCtx))
-#define I830_DRIVER_DATA(vb) ((i830VertexBufferPtr)((vb)->driver_data))
-#define GET_DISPATCH_AGE(imesa) imesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE(imesa) imesa->sarea->last_enqueue
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( imesa ) \
-do { \
- char __ret=0; \
- DRM_CAS(imesa->driHwLock, imesa->hHWContext, \
- (DRM_LOCK_HELD|imesa->hHWContext), __ret); \
- if (__ret) \
- i830GetLock( imesa, 0 ); \
-}while (0)
-
-
- /* Unlock the hardware using the global current context
- */
-#define UNLOCK_HARDWARE(imesa) \
-do { \
- imesa->perf_boxes |= imesa->sarea->perf_boxes; \
- DRM_UNLOCK(imesa->driFd, imesa->driHwLock, imesa->hHWContext); \
-} while (0)
-
- /* This is the wrong way to do it, I'm sure. Otherwise the drm
- * bitches that I've already got the heavyweight lock. At worst,
- * this is 3 ioctls. The best solution probably only gets me down
- * to 2 ioctls in the worst case.
- */
-#define LOCK_HARDWARE_QUIESCENT( imesa ) do { \
- LOCK_HARDWARE( imesa ); \
- i830RegetLockQuiescent( imesa ); \
-} while(0)
-
-
-
-extern void i830GetLock(i830ContextPtr imesa, GLuint flags);
-extern void i830EmitHwStateLocked(i830ContextPtr imesa);
-extern void i830EmitDrawingRectangle(i830ContextPtr imesa);
-extern void i830XMesaSetBackClipRects(i830ContextPtr imesa);
-extern void i830XMesaSetFrontClipRects(i830ContextPtr imesa);
-extern void i830DDExtensionsInit(GLcontext *ctx);
-extern void i830DDInitDriverFuncs(GLcontext *ctx);
-extern void i830DDUpdateHwState(GLcontext *ctx);
-
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-#if DO_DEBUG
-extern int I830_DEBUG;
-#else
-#define I830_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x1
-#define DEBUG_STATE 0x2
-#define DEBUG_IOCTL 0x4
-#define DEBUG_PRIMS 0x8
-#define DEBUG_VERTS 0x10
-#define DEBUG_FALLBACKS 0x20
-#define DEBUG_VERBOSE 0x40
-#define DEBUG_DRI 0x80
-#define DEBUG_DMA 0x100
-#define DEBUG_SANITY 0x200
-#define DEBUG_SYNC 0x400
-#define DEBUG_SLEEP 0x800
-
-
-#define PCI_CHIP_845_G 0x2562
-#define PCI_CHIP_I830_M 0x3577
-#define PCI_CHIP_I855_GM 0x3582
-#define PCI_CHIP_I865_G 0x2572
-
-
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.c
deleted file mode 100644
index eee48f1c1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_debug.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_tris.h"
-#include "i830_ioctl.h"
-#include "i830_debug.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-
-#define TINY_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_XYZ)
-
-#define NOTEX_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(0) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX0_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(1) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define TEX1_VERTEX_FORMAT (STATE3D_VERTEX_FORMAT_CMD | \
- VRTX_TEX_COORD_COUNT(2) | \
- VRTX_HAS_DIFFUSE | \
- VRTX_HAS_SPEC | \
- VRTX_HAS_XYZW)
-
-#define PROJ_VF2 (STATE3D_VERTEX_FORMAT_2_CMD | \
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_3D) | \
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_3D) | \
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_3D) | \
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_3D))
-
-#define NON_PROJ_VF2 (STATE3D_VERTEX_FORMAT_2_CMD | \
- VRTX_TEX_SET_0_FMT(TEXCOORDFMT_2D) | \
- VRTX_TEX_SET_1_FMT(TEXCOORDFMT_2D) | \
- VRTX_TEX_SET_2_FMT(TEXCOORDFMT_2D) | \
- VRTX_TEX_SET_3_FMT(TEXCOORDFMT_2D))
-
-void i830DumpContextState( i830ContextPtr imesa )
-{
- GLuint *Context = imesa->Setup;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
- fprintf(stderr, "STATE1 : 0x%08x\n", Context[I830_CTXREG_STATE1]);
- fprintf(stderr, "STATE2 : 0x%08x\n", Context[I830_CTXREG_STATE2]);
- fprintf(stderr, "STATE3 : 0x%08x\n", Context[I830_CTXREG_STATE3]);
- fprintf(stderr, "STATE4 : 0x%08x\n", Context[I830_CTXREG_STATE4]);
- fprintf(stderr, "STATE5 : 0x%08x\n", Context[I830_CTXREG_STATE5]);
- fprintf(stderr, "IALPHAB : 0x%08x\n", Context[I830_CTXREG_IALPHAB]);
- fprintf(stderr, "STENCILTST : 0x%08x\n", Context[I830_CTXREG_STENCILTST]);
- fprintf(stderr, "ENABLES_1 : 0x%08x\n", Context[I830_CTXREG_ENABLES_1]);
- fprintf(stderr, "ENABLES_2 : 0x%08x\n", Context[I830_CTXREG_ENABLES_2]);
- fprintf(stderr, "AA : 0x%08x\n", Context[I830_CTXREG_AA]);
- fprintf(stderr, "FOGCOLOR : 0x%08x\n", Context[I830_CTXREG_FOGCOLOR]);
- fprintf(stderr, "BCOLOR0 : 0x%08x\n", Context[I830_CTXREG_BLENDCOLR0]);
- fprintf(stderr, "BCOLOR : 0x%08x\n", Context[I830_CTXREG_BLENDCOLR]);
- fprintf(stderr, "VF : 0x%08x\n", Context[I830_CTXREG_VF]);
- fprintf(stderr, "VF2 : 0x%08x\n", Context[I830_CTXREG_VF2]);
- fprintf(stderr, "MCSB0 : 0x%08x\n", Context[I830_CTXREG_MCSB0]);
- fprintf(stderr, "MCSB1 : 0x%08x\n", Context[I830_CTXREG_MCSB1]);
-}
-
-void i830DumpBufferState( i830ContextPtr imesa )
-{
- GLuint *Buffer = imesa->BufferSetup;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
- fprintf(stderr, "CBUFADDR : 0x%08x\n", Buffer[I830_DESTREG_CBUFADDR]);
- fprintf(stderr, "DBUFADDR : 0x%08x\n", Buffer[I830_DESTREG_DBUFADDR]);
- fprintf(stderr, "DV0 : 0x%08x\n", Buffer[I830_DESTREG_DV0]);
- fprintf(stderr, "DV1 : 0x%08x\n", Buffer[I830_DESTREG_DV1]);
- fprintf(stderr, "SENABLE : 0x%08x\n", Buffer[I830_DESTREG_SENABLE]);
- fprintf(stderr, "SR0 : 0x%08x\n", Buffer[I830_DESTREG_SR0]);
- fprintf(stderr, "SR1 : 0x%08x\n", Buffer[I830_DESTREG_SR1]);
- fprintf(stderr, "SR2 : 0x%08x\n", Buffer[I830_DESTREG_SR2]);
- fprintf(stderr, "DR0 : 0x%08x\n", Buffer[I830_DESTREG_DR0]);
- fprintf(stderr, "DR1 : 0x%08x\n", Buffer[I830_DESTREG_DR1]);
- fprintf(stderr, "DR2 : 0x%08x\n", Buffer[I830_DESTREG_DR2]);
- fprintf(stderr, "DR3 : 0x%08x\n", Buffer[I830_DESTREG_DR3]);
- fprintf(stderr, "DR4 : 0x%08x\n", Buffer[I830_DESTREG_DR4]);
-}
-
-void i830DumpStippleState( i830ContextPtr imesa )
-{
- GLuint *Buffer = imesa->BufferSetup;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
- fprintf(stderr, "ST1 : 0x%08x\n", Buffer[I830_STPREG_ST1]);
-}
-
-void i830DumpTextureState( i830ContextPtr imesa, int unit )
-{
- i830TextureObjectPtr t = imesa->CurrentTexObj[unit];
-
- if(t) {
- fprintf(stderr, "%s : unit %d\n", __FUNCTION__, unit);
- fprintf(stderr, "TM0LI : 0x%08x\n", t->Setup[I830_TEXREG_TM0LI]);
- fprintf(stderr, "TM0S0 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S0]);
- fprintf(stderr, "TM0S1 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S1]);
- fprintf(stderr, "TM0S2 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S2]);
- fprintf(stderr, "TM0S3 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S3]);
- fprintf(stderr, "TM0S4 : 0x%08x\n", t->Setup[I830_TEXREG_TM0S4]);
- fprintf(stderr, "NOP0 : 0x%08x\n", t->Setup[I830_TEXREG_NOP0]);
- fprintf(stderr, "NOP1 : 0x%08x\n", t->Setup[I830_TEXREG_NOP1]);
- fprintf(stderr, "NOP2 : 0x%08x\n", t->Setup[I830_TEXREG_NOP2]);
- fprintf(stderr, "MCS : 0x%08x\n", t->Setup[I830_TEXREG_MCS]);
- }
-}
-
-void i830DumpTextureBlendState( i830ContextPtr imesa, int unit )
-{
- GLuint *TexBlend = imesa->TexBlend[unit];
- GLuint length = imesa->TexBlendWordsUsed[unit];
- int i;
-
- fprintf(stderr, "%s : unit %d : length %d\n", __FUNCTION__, unit, length);
- for(i = 0; i < length; i++) {
- fprintf(stderr, "[%d] : 0x%08x\n", i, TexBlend[i]);
- }
-}
-
-void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex )
-{
- I830SAREAPtr sarea = imesa->sarea;
- char *prim_name;
- int size = 0;
- int vfmt_size = 0;
- int hw_nr_vertex = 0;
- int hw_start_vertex = 0;
-
- /* Do a bunch of sanity checks on the vertices sent to the hardware */
-
- size = vertex.used - 4;
- if(imesa->vertex_size && (size % imesa->vertex_size) != 0) {
- fprintf(stderr, "\n\nVertex size does not match imesa "
- "internal state\n");
- fprintf(stderr, "Buffer size : %d\n", size);
- fprintf(stderr, "Vertex size : %d\n", imesa->vertex_size);
- }
-
- /* Check to see if the vertex format is good, and get its size */
- if (sarea->ContextState[I830_CTXREG_VF] == TINY_VERTEX_FORMAT) {
- vfmt_size = 16; /* 4 dwords */
- } else if (sarea->ContextState[I830_CTXREG_VF] ==
- NOTEX_VERTEX_FORMAT) {
- vfmt_size = 24; /* 6 dwords */
- } else if (sarea->ContextState[I830_CTXREG_VF] ==
- TEX0_VERTEX_FORMAT) {
- vfmt_size = 32; /* 8 dwords */
- if (sarea->ContextState[I830_CTXREG_VF2] != NON_PROJ_VF2) {
- fprintf(stderr, "\n\nTex 0 vertex format, but proj "
- "texturing\n");
- }
- } else if(sarea->ContextState[I830_CTXREG_VF] ==
- TEX1_VERTEX_FORMAT) {
- if (sarea->ContextState[I830_CTXREG_VF2] == NON_PROJ_VF2)
- vfmt_size = 40; /* 10 dwords */
- else
- vfmt_size = 48; /* 12 dwords */
- } else {
- fprintf(stderr, "\n\nUnknown vertex format : vf : %08x "
- "vf2 : %08x\n",
- sarea->ContextState[I830_CTXREG_VF],
- sarea->ContextState[I830_CTXREG_VF2]);
- }
-
- if(vfmt_size && (size % vfmt_size) != 0) {
- fprintf(stderr, "\n\nVertex size does not match hardware "
- "internal state\n");
- fprintf(stderr, "Buffer size : %d\n", size);
- fprintf(stderr, "Vertex size : %d\n", vfmt_size);
- }
-
- switch(sarea->vertex_prim) {
- case PRIM3D_POINTLIST:
- hw_start_vertex = 0;
- hw_nr_vertex = 1;
- prim_name = "PointList";
- break;
-
- case PRIM3D_LINELIST:
- hw_start_vertex = 0;
- hw_nr_vertex = 2;
- prim_name = "LineList";
- break;
-
- case PRIM3D_LINESTRIP:
- hw_start_vertex = 2;
- hw_nr_vertex = 1;
- prim_name = "LineStrip";
- break;
-
- case PRIM3D_TRILIST:
- hw_start_vertex = 0;
- hw_nr_vertex = 3;
- prim_name = "TriList";
- break;
-
- case PRIM3D_TRISTRIP:
- hw_start_vertex = 3;
- hw_nr_vertex = 1;
- prim_name = "TriStrip";
- break;
-
- case PRIM3D_TRIFAN:
- hw_start_vertex = 3;
- hw_nr_vertex = 1;
- prim_name = "TriFan";
- break;
-
- case PRIM3D_POLY:
- hw_start_vertex = 3;
- hw_nr_vertex = 1;
- prim_name = "Polygons";
- break;
- default:
- prim_name = "Unknown";
- fprintf(stderr, "\n\nUnknown primitive type : %08x\n",
- sarea->vertex_prim);
- }
-
- if (hw_nr_vertex && vfmt_size) {
- int temp_size = size - (hw_start_vertex * vfmt_size);
- int remaining = (temp_size % (hw_nr_vertex * vfmt_size));
-
- if (remaining != 0) {
- fprintf(stderr, "\n\nThis buffer contains an improper"
- " multiple of vertices for this primitive : %s\n",
- prim_name);
- fprintf(stderr, "Number of vertices in buffer : %d\n",
- size / vfmt_size);
- fprintf(stderr, "temp_size : %d\n", temp_size);
- fprintf(stderr, "remaining vertices : %d",
- remaining / vfmt_size);
- }
- }
- if (vfmt_size) {
- fprintf(stderr, "\n\nPrim name (%s), vertices (%d)\n",
- prim_name,
- size / vfmt_size);
- }
-}
-
-void i830EmitHwStateLockedDebug( i830ContextPtr imesa )
-{
- int i;
-
- if ((imesa->dirty & I830_UPLOAD_TEX0_IMAGE) && imesa->CurrentTexObj[0]) {
- i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[0]);
- }
-
- if ((imesa->dirty & I830_UPLOAD_TEX1_IMAGE) && imesa->CurrentTexObj[1]) {
- i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[1]);
- }
-
- if (imesa->dirty & I830_UPLOAD_CTX) {
- memcpy( imesa->sarea->ContextState,
- imesa->Setup, sizeof(imesa->Setup) );
- i830DumpContextState(imesa);
- }
-
- for(i = 0; i < I830_TEXTURE_COUNT; i++) {
- if ((imesa->dirty & I830_UPLOAD_TEX_N(i)) && imesa->CurrentTexObj[i]) {
- unsigned * TexState;
-
- imesa->sarea->dirty |= I830_UPLOAD_TEX_N(i);
-
- switch( i ) {
- case 0:
- case 1:
- TexState = imesa->sarea->TexState[i];
- break;
-
- case 2:
- TexState = imesa->sarea->TexState2;
- break;
-
- case 3:
- TexState = imesa->sarea->TexState3;
- break;
- }
-
- memcpy(TexState, imesa->CurrentTexObj[i]->Setup,
- sizeof(imesa->sarea->TexState[i]));
- i830DumpTextureState(imesa, i);
- }
- }
- /* Need to figure out if texturing state, or enable changed. */
-
- for(i = 0; i < I830_TEXBLEND_COUNT; i++) {
- if (imesa->dirty & I830_UPLOAD_TEXBLEND_N(i)) {
- unsigned * TexBlendState;
- unsigned * words_used;
-
- imesa->sarea->dirty |= I830_UPLOAD_TEXBLEND_N(i);
-
- switch( i ) {
- case 0:
- case 1:
- TexBlendState = imesa->sarea->TexBlendState[i];
- words_used = & imesa->sarea->TexBlendStateWordsUsed[i];
- break;
-
- case 2:
- TexBlendState = imesa->sarea->TexBlendState2;
- words_used = & imesa->sarea->TexBlendStateWordsUsed2;
- break;
-
- case 3:
- TexBlendState = imesa->sarea->TexBlendState3;
- words_used = & imesa->sarea->TexBlendStateWordsUsed3;
- break;
- }
-
- memcpy(TexBlendState, imesa->TexBlend[i],
- imesa->TexBlendWordsUsed[i] * 4);
- *words_used = imesa->TexBlendWordsUsed[i];
-
- i830DumpTextureBlendState(imesa, i);
- }
- }
-
- if (imesa->dirty & I830_UPLOAD_BUFFERS) {
- memcpy( imesa->sarea->BufferState,imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- i830DumpBufferState(imesa);
- }
-
- if (imesa->dirty & I830_UPLOAD_STIPPLE) {
- fprintf(stderr, "UPLOAD_STIPPLE\n");
- memcpy( imesa->sarea->StippleState,imesa->StippleSetup,
- sizeof(imesa->StippleSetup) );
- i830DumpStippleState(imesa);
- }
-
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_SHARED) {
- memcpy( imesa->sarea->Palette[0],imesa->palette,
- sizeof(imesa->sarea->Palette[0]));
- } else {
- i830TextureObjectPtr p;
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(0)) {
- p = imesa->CurrentTexObj[0];
- memcpy( imesa->sarea->Palette[0],p->palette,
- sizeof(imesa->sarea->Palette[0]));
- }
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(1)) {
- p = imesa->CurrentTexObj[1];
- memcpy( imesa->sarea->Palette[1],
- p->palette,
- sizeof(imesa->sarea->Palette[1]));
- }
- }
- imesa->sarea->dirty |= (imesa->dirty & ~(I830_UPLOAD_TEX_MASK |
- I830_UPLOAD_TEXBLEND_MASK));
-
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty = 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.h
deleted file mode 100644
index deb84f7b0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_debug.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_debug.h,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-/* Defines for sanity checking and debug output */
-#ifndef I830DEBUG_INC
-#define I830DEBUG_INC
-
-
-void i830DumpContextState( i830ContextPtr imesa );
-void i830DumpStippleState( i830ContextPtr imesa );
-void i830DumpBufferState( i830ContextPtr imesa );
-void i830DumpTextureState( i830ContextPtr imesa, int unit );
-void i830DumpTextureBlendState( i830ContextPtr imesa, int unit );
-void i830VertexSanity( i830ContextPtr imesa, drmI830Vertex vertex );
-void i830EmitHwStateLockedDebug( i830ContextPtr imesa );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.c
deleted file mode 100644
index cd0c143df..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.c
+++ /dev/null
@@ -1,841 +0,0 @@
-
-/**************************************************************************
-
-Copyright 2001 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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_ioctl.c,v 1.5 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- * Graeme Fisher <graeme@2d3d.co.za>
- * Abraham vd Merwe <abraham@2d3d.co.za>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_ioctl.h"
-#include "i830_state.h"
-#include "i830_debug.h"
-
-#include "drm.h"
-
-static drmBufPtr i830_get_buffer_ioctl( i830ContextPtr imesa )
-{
- drmI830DMA dma;
- drmBufPtr buf;
- int retcode,i = 0;
- while (1) {
- retcode = drmCommandWriteRead(imesa->driFd,
- DRM_I830_GETBUF,
- &dma,
- sizeof(drmI830DMA));
- if (dma.granted == 1 && retcode == 0)
- break;
-
- if (++i > 1000) {
- imesa->sarea->perf_boxes |= I830_BOX_WAIT;
- retcode = drmCommandNone(imesa->driFd, DRM_I830_FLUSH);
- i = 0;
- }
- }
-
- buf = &(imesa->i830Screen->bufs->list[dma.request_idx]);
- buf->idx = dma.request_idx;
- buf->used = 0;
- buf->total = dma.request_size;
- buf->address = (drmAddress)dma.virtual;
-
- return buf;
-}
-
-static void i830ClearDrawQuad(i830ContextPtr imesa, float left,
- float right,
- float bottom, float top, GLubyte red,
- GLubyte green, GLubyte blue, GLubyte alpha)
-{
- GLuint *vb = i830AllocDmaLowLocked( imesa, 128 );
- i830Vertex tmp;
- int i;
-
- /* PRIM3D_TRIFAN */
-
- /* initial vertex, left bottom */
- tmp.v.x = left;
- tmp.v.y = bottom;
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
- tmp.v.u0 = 0.0f;
- tmp.v.v0 = 0.0f;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right bottom */
- vb += 8;
- tmp.v.x = right;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right top */
- vb += 8;
- tmp.v.y = top;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* left top */
- vb += 8;
- tmp.v.x = left;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-}
-
-static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
- I830SAREAPtr sarea = imesa->sarea;
- GLuint old_vertex_prim;
- GLuint old_dirty;
- int x0, y0, x1, y1;
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "Clearing with triangles\n");
-
- old_dirty = imesa->dirty & ~I830_UPLOAD_CLIPRECTS;
- /* Discard all the dirty flags except the cliprect one, reset later */
- imesa->dirty &= I830_UPLOAD_CLIPRECTS;
-
- if(!all) {
- x0 = cx;
- y0 = cy;
- x1 = x0 + cw;
- y1 = y0 + ch;
- } else {
- x0 = 0;
- y0 = 0;
- x1 = x0 + dPriv->w;
- y1 = y0 + dPriv->h;
- }
-
- /* Clip to Screen */
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > i830Screen->width-1) x1 = i830Screen->width-1;
- if (y1 > i830Screen->height-1) y1 = i830Screen->height-1;
-
- LOCK_HARDWARE(imesa);
- memcpy(sarea->ContextState,
- imesa->Init_Setup,
- sizeof(imesa->Setup) );
- memcpy(sarea->BufferState,
- imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- sarea->StippleState[I830_STPREG_ST1] = 0;
-
- old_vertex_prim = imesa->hw_primitive;
- imesa->hw_primitive = PRIM3D_TRIFAN;
-
- if(mask & BUFFER_BIT_FRONT_LEFT) {
- GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
-
- sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendStateWordsUsed[0] = 4;
-
- tmp &= ~(ENABLE_STENCIL_WRITE | ENABLE_DEPTH_WRITE);
- tmp |= (DISABLE_STENCIL_WRITE |
- DISABLE_DEPTH_WRITE |
- (imesa->mask_red << WRITEMASK_RED_SHIFT) |
- (imesa->mask_green << WRITEMASK_GREEN_SHIFT) |
- (imesa->mask_blue << WRITEMASK_BLUE_SHIFT) |
- (imesa->mask_alpha << WRITEMASK_ALPHA_SHIFT));
- sarea->ContextState[I830_CTXREG_ENABLES_2] = tmp;
-
- if(0)
- fprintf(stderr, "fcdq : r_mask(%d) g_mask(%d) b_mask(%d) a_mask(%d)\n",
- imesa->mask_red, imesa->mask_green, imesa->mask_blue,
- imesa->mask_alpha);
-
- sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
-
- if(0)
- fprintf(stderr, "fcdq : x0(%d) x1(%d) y0(%d) y1(%d)\n"
- "r(0x%x) g(0x%x) b(0x%x) a(0x%x)\n",
- x0, x1, y0, y1, imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
-
- i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
- imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
- i830FlushPrimsLocked( imesa );
- }
-
- if(mask & BUFFER_BIT_BACK_LEFT) {
- GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
-
- sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendStateWordsUsed[0] = 4;
-
- tmp &= ~(ENABLE_STENCIL_WRITE | ENABLE_DEPTH_WRITE);
- tmp |= (DISABLE_STENCIL_WRITE |
- DISABLE_DEPTH_WRITE |
- (imesa->mask_red << WRITEMASK_RED_SHIFT) |
- (imesa->mask_green << WRITEMASK_GREEN_SHIFT) |
- (imesa->mask_blue << WRITEMASK_BLUE_SHIFT) |
- (imesa->mask_alpha << WRITEMASK_ALPHA_SHIFT));
-
- if(0)
- fprintf(stderr, "bcdq : r_mask(%d) g_mask(%d) b_mask(%d) a_mask(%d)\n",
- imesa->mask_red, imesa->mask_green, imesa->mask_blue,
- imesa->mask_alpha);
-
- sarea->ContextState[I830_CTXREG_ENABLES_2] = tmp;
-
- sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->backOffset;
-
- if(0)
- fprintf(stderr, "bcdq : x0(%d) x1(%d) y0(%d) y1(%d)\n"
- "r(0x%x) g(0x%x) b(0x%x) a(0x%x)\n",
- x0, x1, y0, y1, imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
-
- i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
- imesa->clear_red, imesa->clear_green,
- imesa->clear_blue, imesa->clear_alpha);
- i830FlushPrimsLocked( imesa );
- }
-
- if(mask & BUFFER_BIT_STENCIL) {
- GLuint s_mask = ctx->Stencil.WriteMask[0];
-
- sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- sarea->TexBlendState[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- sarea->TexBlendState[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendState[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG2 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- sarea->TexBlendStateWordsUsed[0] = 4;
-
- sarea->ContextState[I830_CTXREG_ENABLES_1] |= (ENABLE_STENCIL_TEST |
- ENABLE_DEPTH_TEST);
-
- sarea->ContextState[I830_CTXREG_ENABLES_2] &= ~(ENABLE_STENCIL_WRITE |
- ENABLE_DEPTH_WRITE |
- ENABLE_COLOR_WRITE);
-
- sarea->ContextState[I830_CTXREG_ENABLES_2] |=
- (ENABLE_STENCIL_WRITE |
- DISABLE_DEPTH_WRITE |
- (1 << WRITEMASK_RED_SHIFT) |
- (1 << WRITEMASK_GREEN_SHIFT) |
- (1 << WRITEMASK_BLUE_SHIFT) |
- (1 << WRITEMASK_ALPHA_SHIFT) |
- ENABLE_COLOR_WRITE);
-
- sarea->ContextState[I830_CTXREG_STATE4] &=
- ~MODE4_ENABLE_STENCIL_WRITE_MASK;
-
- sarea->ContextState[I830_CTXREG_STATE4] |=
- (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(s_mask));
-
- sarea->ContextState[I830_CTXREG_STENCILTST] &=
- ~(STENCIL_OPS_MASK |
- STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
-
- sarea->ContextState[I830_CTXREG_STENCILTST] |=
- (ENABLE_STENCIL_PARMS |
- ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_REPLACE) |
- STENCIL_REF_VALUE((ctx->Stencil.Clear & 0xff)) |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS));
-
- if(0)
- fprintf(stderr, "Enables_1 (0x%x) Enables_2 (0x%x) StenTst (0x%x)\n"
- "Modes_4 (0x%x)\n",
- sarea->ContextState[I830_CTXREG_ENABLES_1],
- sarea->ContextState[I830_CTXREG_ENABLES_2],
- sarea->ContextState[I830_CTXREG_STENCILTST],
- sarea->ContextState[I830_CTXREG_STATE4]);
-
- sarea->BufferState[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
-
- i830ClearDrawQuad(imesa, (float)x0, (float)x1, (float)y0, (float)y1,
- 255, 255, 255, 255);
- i830FlushPrimsLocked( imesa );
- }
-
- UNLOCK_HARDWARE(imesa);
- imesa->dirty = old_dirty;
- imesa->dirty |= (I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS |
- I830_UPLOAD_TEXBLEND0);
-
- imesa->hw_primitive = old_vertex_prim;
-}
-
-static void i830Clear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx1, GLint cy1, GLint cw, GLint ch)
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- drmI830Clear clear;
- GLbitfield tri_mask = 0;
- int i;
- GLint cx, cy;
-
- /* flip top to bottom */
- cy = dPriv->h-cy1-ch;
- cx = cx1 + imesa->drawX;
- cy += imesa->drawY;
-
- if(0) fprintf(stderr, "\nClearColor : 0x%08x\n", imesa->ClearColor);
-
- clear.flags = 0;
- clear.clear_color = imesa->ClearColor;
- clear.clear_depth = 0;
- clear.clear_colormask = 0;
- clear.clear_depthmask = 0;
-
- I830_FIREVERTICES( imesa );
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- if(colorMask == ~0) {
- clear.flags |= I830_FRONT;
- } else {
- tri_mask |= BUFFER_BIT_FRONT_LEFT;
- }
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if (mask & BUFFER_BIT_BACK_LEFT) {
- if(colorMask == ~0) {
- clear.flags |= I830_BACK;
- } else {
- tri_mask |= BUFFER_BIT_BACK_LEFT;
- }
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if (mask & BUFFER_BIT_DEPTH) {
- clear.flags |= I830_DEPTH;
- clear.clear_depthmask = imesa->depth_clear_mask;
- clear.clear_depth = (GLuint)(ctx->Depth.Clear * imesa->ClearDepth);
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if((mask & BUFFER_BIT_STENCIL) && imesa->hw_stencil) {
- if (ctx->Stencil.WriteMask[0] != 0xff) {
- tri_mask |= BUFFER_BIT_STENCIL;
- } else {
- clear.flags |= I830_DEPTH;
- clear.clear_depthmask |= imesa->stencil_clear_mask;
- clear.clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
- }
- mask &= ~BUFFER_BIT_STENCIL;
- }
-
- /* First check for clears that need to happen with triangles */
- if(tri_mask) {
- i830ClearWithTris(ctx, tri_mask, all, cx, cy, cw, ch);
- }
-
- if (clear.flags) {
- LOCK_HARDWARE( imesa );
-
- for (i = 0 ; i < imesa->numClipRects ; )
- {
- int nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, imesa->numClipRects);
- drm_clip_rect_t *box = imesa->pClipRects;
- drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
- int n = 0;
-
- if (!all) {
- for ( ; i < nr ; i++) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++) {
- *b++ = *(drm_clip_rect_t *)&box[i];
- n++;
- }
- }
-
- imesa->sarea->nbox = n;
- drmCommandWrite(imesa->driFd, DRM_I830_CLEAR,
- &clear, sizeof(drmI830Clear));
- }
-
- UNLOCK_HARDWARE( imesa );
- imesa->upload_cliprects = GL_TRUE;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask, all, cx1, cy1, cw, ch );
-}
-
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void i830CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- i830ContextPtr imesa;
- drm_clip_rect_t *pbox;
- int nbox, i, tmp;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I830_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- imesa->sarea->perf_boxes |= imesa->perf_boxes;
- imesa->perf_boxes = 0;
-
- pbox = dPriv->pClipRects;
- nbox = dPriv->numClipRects;
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
-
- imesa->sarea->nbox = nr - i;
-
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
- drmCommandNone(imesa->driFd, DRM_I830_SWAP);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i830WaitAge(imesa, imesa->lastSwap);
- }
-
- imesa->lastSwap = tmp;
- imesa->upload_cliprects = GL_TRUE;
-}
-
-/* Flip the front & back buffes
- */
-void i830PageFlip( const __DRIdrawablePrivate *dPriv )
-{
-#if 0
- i830ContextPtr imesa;
- int tmp, ret;
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (i830ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- I830_FIREVERTICES( imesa );
- LOCK_HARDWARE( imesa );
-
- imesa->sarea->perf_boxes |= imesa->perf_boxes;
- imesa->perf_boxes = 0;
-
- if (dPriv->pClipRects) {
- *(drm_clip_rect_t *)imesa->sarea->boxes = dPriv->pClipRects[0];
- imesa->sarea->nbox = 1;
- }
-
- ret = drmCommandNone(imesa->driFd, DRM_I830_FLIP);
- if (ret) {
- fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);
- UNLOCK_HARDWARE( imesa );
- exit(1);
- }
-
- tmp = GET_ENQUEUE_AGE(imesa);
- UNLOCK_HARDWARE( imesa );
-
- /* multiarb will suck the life out of the server without this throttle:
- */
- if (GET_DISPATCH_AGE(imesa) < imesa->lastSwap) {
- i830WaitAge(imesa, imesa->lastSwap);
- }
-
- i830SetDrawBuffer( imesa->glCtx, imesa->glCtx->Color.DriverDrawBuffer );
- imesa->upload_cliprects = GL_TRUE;
- imesa->lastSwap = tmp;
-#endif
-}
-
-/* This waits for *everybody* to finish rendering -- overkill.
- */
-void i830DmaFinish( i830ContextPtr imesa )
-{
- I830_FIREVERTICES( imesa );
- LOCK_HARDWARE_QUIESCENT( imesa );
- UNLOCK_HARDWARE( imesa );
-}
-
-void i830RegetLockQuiescent( i830ContextPtr imesa )
-{
- drmUnlock(imesa->driFd, imesa->hHWContext);
- i830GetLock( imesa, DRM_LOCK_QUIESCENT );
-}
-
-void i830WaitAgeLocked( i830ContextPtr imesa, int age )
-{
- int i = 0;
- while (++i < 5000) {
- drmCommandNone(imesa->driFd, DRM_I830_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age) return;
- imesa->sarea->perf_boxes |= I830_BOX_WAIT;
- UNLOCK_HARDWARE( imesa );
- if (I830_DEBUG & DEBUG_SLEEP) fprintf(stderr, ".");
- usleep(1);
- LOCK_HARDWARE( imesa );
- }
- /* If that didn't work, just do a flush:
- */
- drmCommandNone(imesa->driFd, DRM_I830_FLUSH);
-}
-
-void i830WaitAge( i830ContextPtr imesa, int age )
-{
- int i = 0;
- if (GET_DISPATCH_AGE(imesa) >= age) return;
-
- while (1) {
- drmCommandNone(imesa->driFd, DRM_I830_GETAGE);
- if (GET_DISPATCH_AGE(imesa) >= age) return;
- imesa->perf_boxes |= I830_BOX_WAIT;
-
- if (imesa->do_irqs) {
- drmI830IrqEmit ie;
- drmI830IrqWait iw;
- int ret;
-
- ie.irq_seq = &iw.irq_seq;
-
- LOCK_HARDWARE( imesa );
- ret = drmCommandWriteRead( imesa->driFd, DRM_I830_IRQ_EMIT, &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqEmit: %d\n", __FUNCTION__, ret );
- exit(1);
- }
- UNLOCK_HARDWARE(imesa);
-
- ret = drmCommandWrite( imesa->driFd, DRM_I830_IRQ_WAIT, &iw, sizeof(iw) );
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqWait: %d\n", __FUNCTION__, ret );
- exit(1);
- }
- } else {
- if (++i > 5000) usleep(1);
- }
- }
-}
-
-static void age_imesa( i830ContextPtr imesa, int age )
-{
- if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->base.timestamp = age;
- if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->base.timestamp = age;
-}
-
-void i830FlushPrimsLocked( i830ContextPtr imesa )
-{
- drm_clip_rect_t *pbox = imesa->pClipRects;
- int nbox = imesa->numClipRects;
- drmBufPtr buffer = imesa->vertex_buffer;
- I830SAREAPtr sarea = imesa->sarea;
- drmI830Vertex vertex;
- int i, nr;
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s dirty: %08x\n", __FUNCTION__, imesa->dirty);
-
-
- vertex.idx = buffer->idx;
- vertex.used = imesa->vertex_low;
- vertex.discard = 0;
- sarea->vertex_prim = imesa->hw_primitive;
-
- /* Reset imesa vars:
- */
- imesa->vertex_buffer = 0;
- imesa->vertex_addr = 0;
- imesa->vertex_low = 0;
- imesa->vertex_high = 0;
- imesa->vertex_last_prim = 0;
-
- if (imesa->dirty) {
- if (I830_DEBUG & DEBUG_SANITY)
- i830EmitHwStateLockedDebug(imesa);
- else
- i830EmitHwStateLocked(imesa);
- }
-
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr,"%s: Vertex idx %d used %d discard %d\n",
- __FUNCTION__, vertex.idx, vertex.used, vertex.discard);
-
- if (!nbox) {
- vertex.used = 0;
- vertex.discard = 1;
- if (drmCommandWrite (imesa->driFd, DRM_I830_VERTEX,
- &vertex, sizeof(drmI830Vertex))) {
- fprintf(stderr, "DRM_I830_VERTEX: %d\n", -errno);
- UNLOCK_HARDWARE(imesa);
- exit(1);
- }
- return;
- }
-
- for (i = 0 ; i < nbox ; i = nr ) {
- drm_clip_rect_t *b = sarea->boxes;
- int j;
-
- nr = MIN2(i + I830_NR_SAREA_CLIPRECTS, nbox);
- sarea->nbox = nr - i;
-
- for ( j = i ; j < nr ; j++) {
- b[j-i] = pbox[j];
- }
-
- /* Finished with the buffer?
- */
- if (nr == nbox)
- vertex.discard = 1;
-
- /* Do a bunch of sanity checks on the vertices sent to the hardware */
- if (I830_DEBUG & DEBUG_SANITY) {
- i830VertexSanity(imesa, vertex);
-
- for ( j = 0 ; j < sarea->nbox ; j++) {
- fprintf(stderr, "box %d/%d %d,%d %d,%d\n",
- j, sarea->nbox, b[j].x1, b[j].y1, b[j].x2, b[j].y2);
- }
- }
-
- drmCommandWrite (imesa->driFd, DRM_I830_VERTEX,
- &vertex, sizeof(drmI830Vertex));
- age_imesa(imesa, imesa->sarea->last_enqueue);
- }
-
- imesa->dirty = 0;
- imesa->upload_cliprects = GL_FALSE;
-}
-
-void i830FlushPrimsGetBufferLocked( i830ContextPtr imesa )
-{
- if (imesa->vertex_buffer)
- i830FlushPrimsLocked( imesa );
- imesa->vertex_buffer = i830_get_buffer_ioctl( imesa );
- imesa->vertex_addr = (char *)imesa->vertex_buffer->address;
-
- /* leave room for instruction header & footer:
- */
- imesa->vertex_high = imesa->vertex_buffer->total - 4;
- imesa->vertex_low = 4;
- imesa->vertex_last_prim = imesa->vertex_low;
-}
-
-void i830FlushPrimsGetBuffer( i830ContextPtr imesa )
-{
- LOCK_HARDWARE(imesa);
- i830FlushPrimsGetBufferLocked( imesa );
- UNLOCK_HARDWARE(imesa);
-}
-
-
-void i830FlushPrims( i830ContextPtr imesa )
-{
- if (imesa->vertex_buffer) {
- LOCK_HARDWARE( imesa );
- i830FlushPrimsLocked( imesa );
- UNLOCK_HARDWARE( imesa );
- }
-}
-
-int i830_check_copy(int fd)
-{
- return drmCommandNone(fd, DRM_I830_DOCOPY);
-}
-
-static void i830Flush( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- I830_FIREVERTICES( imesa );
-}
-
-static void i830Finish( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- i830DmaFinish( imesa );
-}
-
-void i830InitIoctlFuncs( struct dd_function_table *functions )
-{
- functions->Flush = i830Flush;
- functions->Clear = i830Clear;
- functions->Finish = i830Finish;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.h
deleted file mode 100644
index f92ff44ea..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_ioctl.h
+++ /dev/null
@@ -1,105 +0,0 @@
-
-/**************************************************************************
-
-Copyright 2001 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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_ioctl.h,v 1.3 2002/10/30 12:51:35 alanh Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- * Graeme Fisher <graeme@2d3d.co.za>
- * Abraham vd Merwe <abraham@2d3d.co.za>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef I830_IOCTL_H
-#define I830_IOCTL_H
-
-#include "i830_context.h"
-
-GLuint *i830AllocDwords (i830ContextPtr imesa, int dwords);
-void i830EmitPrim( i830ContextPtr imesa );
-void i830FlushPrims( i830ContextPtr mmesa );
-void i830FlushPrimsLocked( i830ContextPtr mmesa );
-void i830FlushPrimsGetBuffer( i830ContextPtr imesa );
-void i830FlushPrimsGetBufferLocked( i830ContextPtr imesa );
-void i830WaitAgeLocked( i830ContextPtr imesa, int age );
-void i830WaitAge( i830ContextPtr imesa, int age );
-void i830DmaFinish( i830ContextPtr imesa );
-void i830RegetLockQuiescent( i830ContextPtr imesa );
-void i830InitIoctlFuncs( struct dd_function_table *functions );
-void i830CopyBuffer( const __DRIdrawablePrivate *dpriv );
-void i830PageFlip( const __DRIdrawablePrivate *dpriv );
-int i830_check_copy(int fd);
-
-#define I830_STATECHANGE(imesa, flag) \
-do { \
- if (imesa->vertex_low != imesa->vertex_last_prim) \
- i830FlushPrims(imesa); \
- imesa->dirty |= flag; \
-} while (0)
-
-
-#define I830_FIREVERTICES(imesa) \
-do { \
- if (imesa->vertex_buffer) { \
- i830FlushPrims(imesa); \
-} \
-} while (0)
-
-
-static __inline GLuint *i830AllocDmaLow( i830ContextPtr imesa, int bytes )
-{
- if (imesa->vertex_low + bytes > imesa->vertex_high) {
- i830FlushPrimsGetBuffer( imesa );
- }
-
- {
- GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
- imesa->vertex_low += bytes;
- return start;
- }
-}
-
-static __inline GLuint *i830AllocDmaLowLocked( i830ContextPtr imesa,
- int bytes )
-{
- if (imesa->vertex_low + bytes > imesa->vertex_high) {
- i830FlushPrimsGetBufferLocked( imesa );
- }
-
- {
- GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
- imesa->vertex_low += bytes;
- return start;
- }
-}
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_render.c
deleted file mode 100644
index b0592e9cd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_render.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Intel i810 DRI driver for Mesa 3.5
- *
- * Copyright (C) 1999-2000 Keith Whitwell 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 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Adapted for use on the I830:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_render.c,v 1.2 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware acceleration where possible.
- *
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_tris.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 0 /* Has it, but can't use because subpixel has to
- * be adjusted for points on the I830/I845G
- */
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0
-
-static GLuint hw_prim[GL_POLYGON+1] = {
- 0,
- PRIM3D_LINELIST,
- PRIM3D_LINESTRIP,
- PRIM3D_LINESTRIP,
- PRIM3D_TRILIST,
- PRIM3D_TRISTRIP,
- PRIM3D_TRIFAN,
- 0,
- 0,
- PRIM3D_POLY
-};
-
-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 const int scale_prim[GL_POLYGON+1] = {
- 0, /* fallback case */
- 1,
- 2,
- 2,
- 1,
- 3,
- 3,
- 0, /* fallback case */
- 0, /* fallback case */
- 3
-};
-
-
-#define LOCAL_VARS i830ContextPtr imesa = I830_CONTEXT(ctx)
-#define INIT( prim ) do { \
- I830_STATECHANGE(imesa, 0); \
- i830RasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] ); \
-} while (0)
-
-#define FLUSH() I830_FIREVERTICES( imesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)imesa->vertex_high - (int)imesa->vertex_low) / (imesa->vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (I830_DMA_BUF_SZ-8) / (imesa->vertex_size * 4)
-
-
-#define ALLOC_VERTS( nr ) \
- i830AllocDmaLow( imesa, (nr) * imesa->vertex_size * 4)
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf)
-
-#define TAG(x) i830_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-/* Heuristic for i830, which can only emit a single primitive per dma
- * buffer, and has only a small number of dma buffers.
- */
-static GLboolean choose_render( struct vertex_buffer *VB, int bufsz )
-{
- int nr_prims = 0;
- int nr_rprims = 0;
- int nr_rverts = 0;
- int rprim = 0;
- int i;
-
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- if (!hw_prim[prim & PRIM_MODE_MASK])
- return GL_FALSE;
-
- nr_prims++;
- nr_rverts += length * scale_prim[prim & PRIM_MODE_MASK];
-
- if (reduced_prim[prim&PRIM_MODE_MASK] != rprim) {
- nr_rprims++;
- rprim = reduced_prim[prim&PRIM_MODE_MASK];
- }
- }
-
- nr_prims += i / bufsz;
- nr_rprims += nr_rverts / bufsz;
-
- if ((nr_prims > nr_rprims * 2) ||
- (nr_prims > nr_rprims + 3))
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-static GLboolean i830_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- /* Don't handle clipping or indexed vertices.
- */
- if (imesa->RenderIndex != 0 ||
- !i830_validate_render( ctx, VB ) ||
- !choose_render( VB, 200 )) { /* 200 is estimate of nr verts/buf */
- return GL_TRUE;
- }
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- i830_render_tab_verts[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 _i830_render_stage =
-{
- "i830 render",
- NULL,
- NULL,
- NULL,
- NULL,
- i830_run_render /* run */
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c
deleted file mode 100644
index 25def0b6f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c
+++ /dev/null
@@ -1,557 +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.
- *
- * **************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_screen.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/**
- * \file i830_screen.c
- *
- * Adapted for use on the I830M by Jeff Hartmann.
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- * \author Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_span.h"
-#include "i830_tris.h"
-#include "i830_ioctl.h"
-
-#include "i830_dri.h"
-
-#include "utils.h"
-#include "xmlpool.h"
-#include "drirenderbuffer.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_MAX_TEXTURE_UNITS(4,2,4)
- DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 2;
-
-extern const struct dri_extension card_extensions[];
-
-static int i830_malloc_proxy_buf(drmBufMapPtr buffers)
-{
- char *buffer;
- drmBufPtr buf;
- int i;
-
- buffer = ALIGN_MALLOC(I830_DMA_BUF_SZ, 32);
- if(buffer == NULL) return -1;
- for(i = 0; i < I830_DMA_BUF_NR; i++) {
- buf = &(buffers->list[i]);
- buf->address = (drmAddress)buffer;
- }
-
- return 0;
-}
-
-static drmBufMapPtr i830_create_empty_buffers(void)
-{
- drmBufMapPtr retval;
-
- retval = (drmBufMapPtr)ALIGN_MALLOC(sizeof(drmBufMap), 32);
- if(retval == NULL) return NULL;
- memset(retval, 0, sizeof(drmBufMap));
- retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I830_DMA_BUF_NR, 32);
- if(retval->list == NULL) {
- FREE(retval);
- return NULL;
- }
-
- memset(retval->list, 0, sizeof(drmBuf) * I830_DMA_BUF_NR);
- return retval;
-}
-
-static void i830PrintDRIInfo(i830ScreenPrivate *i830Screen,
- __DRIscreenPrivate *sPriv,
- I830DRIPtr gDRIPriv)
-{
- GLuint size = (gDRIPriv->ringSize +
- i830Screen->textureSize +
- i830Screen->depth.size +
- i830Screen->back.size +
- sPriv->fbSize +
- I830_DMA_BUF_NR * I830_DMA_BUF_SZ +
- 32768 /* Context Memory */ +
- 16*4096 /* Ring buffer */ +
- 64*1024 /* Scratch buffer */ +
- 4096 /* Cursor */);
- GLuint size_low = (gDRIPriv->ringSize +
- i830Screen->textureSize +
- sPriv->fbSize +
- I830_DMA_BUF_NR * I830_DMA_BUF_SZ +
- 32768 /* Context Memory */ +
- 16*4096 /* Ring buffer */ +
- 64*1024 /* Scratch buffer */);
-
- fprintf(stderr, "\nFront size : 0x%x\n", sPriv->fbSize);
- fprintf(stderr, "Front offset : 0x%x\n", i830Screen->fbOffset);
- fprintf(stderr, "Back size : 0x%x\n", i830Screen->back.size);
- fprintf(stderr, "Back offset : 0x%x\n", i830Screen->backOffset);
- fprintf(stderr, "Depth size : 0x%x\n", i830Screen->depth.size);
- fprintf(stderr, "Depth offset : 0x%x\n", i830Screen->depthOffset);
- fprintf(stderr, "Texture size : 0x%x\n", i830Screen->textureSize);
- fprintf(stderr, "Texture offset : 0x%x\n", i830Screen->textureOffset);
- fprintf(stderr, "Ring offset : 0x%x\n", gDRIPriv->ringOffset);
- fprintf(stderr, "Ring size : 0x%x\n", gDRIPriv->ringSize);
- fprintf(stderr, "Memory : 0x%x\n", gDRIPriv->mem);
- fprintf(stderr, "Used Memory : low(0x%x) high(0x%x)\n", size_low, size);
-}
-
-static GLboolean i830InitDriver(__DRIscreenPrivate *sPriv)
-{
- i830ScreenPrivate *i830Screen;
- I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- i830Screen = (i830ScreenPrivate *)CALLOC(sizeof(i830ScreenPrivate));
- if (!i830Screen) {
- fprintf(stderr,"\nERROR! Allocating private area failed\n");
- return GL_FALSE;
- }
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&i830Screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
-
- i830Screen->driScrnPriv = sPriv;
- sPriv->private = (void *)i830Screen;
-
- i830Screen->deviceID = gDRIPriv->deviceID;
- i830Screen->width = gDRIPriv->width;
- i830Screen->height = gDRIPriv->height;
- i830Screen->mem = gDRIPriv->mem;
- i830Screen->cpp = gDRIPriv->cpp;
- i830Screen->fbStride = gDRIPriv->fbStride;
- i830Screen->fbOffset = gDRIPriv->fbOffset;
-
- switch (gDRIPriv->bitsPerPixel) {
- case 15: i830Screen->fbFormat = DV_PF_555; break;
- case 16: i830Screen->fbFormat = DV_PF_565; break;
- case 32: i830Screen->fbFormat = DV_PF_8888; break;
- }
-
- i830Screen->backOffset = gDRIPriv->backOffset;
- i830Screen->depthOffset = gDRIPriv->depthOffset;
- i830Screen->backPitch = gDRIPriv->auxPitch;
- i830Screen->backPitchBits = gDRIPriv->auxPitchBits;
- i830Screen->textureOffset = gDRIPriv->textureOffset;
- i830Screen->textureSize = gDRIPriv->textureSize;
- i830Screen->logTextureGranularity = gDRIPriv->logTextureGranularity;
-
-
- i830Screen->bufs = i830_create_empty_buffers();
- if(i830Screen->bufs == NULL) {
- fprintf(stderr,"\nERROR: Failed to create empty buffers in %s \n",
- __FUNCTION__);
- FREE(i830Screen);
- return GL_FALSE;
- }
-
- /* Check if you need to create a fake buffer */
- if(i830_check_copy(sPriv->fd) == 1) {
- i830_malloc_proxy_buf(i830Screen->bufs);
- i830Screen->use_copy_buf = 1;
- } else {
- i830Screen->use_copy_buf = 0;
- }
-
- i830Screen->back.handle = gDRIPriv->backbuffer;
- i830Screen->back.size = gDRIPriv->backbufferSize;
-
- if (drmMap(sPriv->fd,
- i830Screen->back.handle,
- i830Screen->back.size,
- (drmAddress *)&i830Screen->back.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- FREE(i830Screen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- i830Screen->depth.handle = gDRIPriv->depthbuffer;
- i830Screen->depth.size = gDRIPriv->depthbufferSize;
-
- if (drmMap(sPriv->fd,
- i830Screen->depth.handle,
- i830Screen->depth.size,
- (drmAddress *)&i830Screen->depth.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- FREE(i830Screen);
- drmUnmap(i830Screen->back.map, i830Screen->back.size);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- i830Screen->tex.handle = gDRIPriv->textures;
- i830Screen->tex.size = gDRIPriv->textureSize;
-
- if (drmMap(sPriv->fd,
- i830Screen->tex.handle,
- i830Screen->tex.size,
- (drmAddress *)&i830Screen->tex.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- FREE(i830Screen);
- drmUnmap(i830Screen->back.map, i830Screen->back.size);
- drmUnmap(i830Screen->depth.map, i830Screen->depth.size);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- i830Screen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
- if (0) i830PrintDRIInfo(i830Screen, sPriv, gDRIPriv);
-
- i830Screen->drmMinor = sPriv->drmMinor;
-
- if (sPriv->drmMinor >= 3) {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_IRQ_ACTIVE;
- gp.value = &i830Screen->irq_active;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: %d\n", ret);
- return GL_FALSE;
- }
- }
-
-#if 0
- if (sPriv->drmMinor >= 3) {
- int ret;
- drmI830SetParam sp;
-
- sp.param = I830_SETPARAM_PERF_BOXES;
- sp.value = (getenv("I830_DO_BOXES") != 0);
-
- ret = drmCommandWrite( sPriv->fd, DRM_I830_SETPARAM,
- &sp, sizeof(sp));
- if (ret)
- fprintf(stderr, "Couldn't set perfboxes: %d\n", ret);
- }
-#endif
-
- if ( glx_enable_extension != NULL ) {
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- }
-
- return GL_TRUE;
-}
-
-
-static void i830DestroyScreen(__DRIscreenPrivate *sPriv)
-{
- i830ScreenPrivate *i830Screen = (i830ScreenPrivate *)sPriv->private;
-
- /* Need to unmap all the bufs and maps here:
- */
- drmUnmap(i830Screen->back.map, i830Screen->back.size);
- drmUnmap(i830Screen->depth.map, i830Screen->depth.size);
- drmUnmap(i830Screen->tex.map, i830Screen->tex.size);
- FREE(i830Screen);
- sPriv->private = NULL;
-}
-
-
-static GLboolean i830CreateBuffer(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- i830ScreenPrivate *screen = (i830ScreenPrivate *) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
-#if 0
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
-#else
- GLboolean swStencil = mesaVis->stencilBits > 0;
-#endif
-
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- /*screen->frontOffset*/0, screen->backPitch);
- i830SetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- i830SetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->backPitch);
- i830SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- if (mesaVis->stencilBits == 8) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->backPitch);
- i830SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else {
- /* not really 32-bit Z, but use GL_DEPTH_COMPONENT32 anyway */
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
- screen->depthOffset, screen->backPitch);
- i830SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->backPitch);
- i830SetSpanFunctions(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;
-#endif
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-static void i830DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static const struct __DriverAPIRec i830API = {
- .InitDriver = i830InitDriver,
- .DestroyScreen = i830DestroyScreen,
- .CreateContext = i830CreateContext,
- .DestroyContext = i830DestroyContext,
- .CreateBuffer = i830CreateBuffer,
- .DestroyBuffer = i830DestroyBuffer,
- .SwapBuffers = i830SwapBuffers,
- .MakeCurrent = i830MakeCurrent,
- .UnbindContext = i830UnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *
-i830FillInModes( 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;
-
- /* GLX_SWAP_COPY_OML is only supported because the MGA driver doesn't
- * support pageflipping at all.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_t stencil_bits_array[2];
-
-
- depth_bits_array[0] = 0;
- 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) ? 3 : 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_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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;
- }
-
- /* There's no direct color modes on i830? */
-
- /* 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 3, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "i830",
- 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, &i830API);
- if ( psp != NULL ) {
- I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
- *driver_modes = i830FillInModes( dri_priv->cpp * 8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.h
deleted file mode 100644
index edbe719e0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.h
+++ /dev/null
@@ -1,113 +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:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Adapted for use on the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#ifndef _I830_INIT_H_
-#define _I830_INIT_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-
-typedef struct {
- drm_handle_t handle;
- drmSize size;
- char *map;
-} i830Region, *i830RegionPtr;
-
-typedef struct
-{
-
- i830Region front;
- i830Region back;
- i830Region depth;
- i830Region tex;
-
- int deviceID;
- int width;
- int height;
- int mem;
-
- int cpp; /* for front and back buffers */
- int bitsPerPixel;
-
- int fbFormat;
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int depthOffset;
-
- int backPitch;
- int backPitchBits;
-
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-
- __DRIscreenPrivate *driScrnPriv;
- drmBufMapPtr bufs;
- int use_copy_buf;
- unsigned int sarea_priv_offset;
-
- int drmMinor;
- int irq_active;
-
- /**
- * Configuration cache with default values for all contexts
- */
- driOptionCache optionCache;
-}i830ScreenPrivate;
-
-
-extern GLboolean
-i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void
-i830DestroyContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i830UnbindContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
-extern void
-i830SwapBuffers(__DRIdrawablePrivate *driDrawPriv);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.c
deleted file mode 100644
index 4a86784e8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_span.c,v 1.4 2002/12/10 01:26:53 dawes Exp $ */
-
-/**
- * \file i830_span.c
- *
- * Heavily based on the I810 driver, which was written by Keith Whitwell.
- *
- * \author Jeff Hartmann <jhartmann@2d3d.com>
- * \author Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_span.h"
-#include "i830_ioctl.h"
-#include "swrast/swrast.h"
-
-
-#define DBG 0
-
-#define LOCAL_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- i830ScreenPrivate *i830Screen = imesa->i830Screen; \
- GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(imesa->drawMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- GLushort p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- i830ScreenPrivate *i830Screen = imesa->i830Screen; \
- GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(i830Screen->depth.map + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define INIT_MONO_PIXEL(p,color)\
- p = PACK_COLOR_565(color[0],color[1],color[2])
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-/* 16 bit, 565 rgb color spanline and pixel functions
- */
-#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 *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \
- rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \
- rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) i830##x##_565
-#include "spantmp.h"
-
-/* 15 bit, 555 rgb color spanline and pixel functions
- */
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \
- ((g & 0xf8) << 3) | \
- ((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 *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 7) & 0xf8; \
- rgba[1] = (p >> 3) & 0xf8; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) i830##x##_555
-#include "spantmp.h"
-
-/* 16 bit depthbuffer functions.
- */
-#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) i830##x##_16
-#include "depthtmp.h"
-
-
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->driDrawable; \
- i830ScreenPrivate *i830Screen = imesa->i830Screen; \
- GLuint pitch = i830Screen->backPitch * i830Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(imesa->drawMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(imesa->readMap + \
- dPriv->x * i830Screen->cpp + \
- dPriv->y * pitch); \
- GLuint p = I830_CONTEXT( ctx )->MonoColor; \
- (void) read_buf; (void) buf; (void) p
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p,color)\
- p = PACK_COLOR_888(color[0],color[1],color[2])
-
-/* 32 bit, 8888 argb color spanline and pixel functions
- */
-#define WRITE_RGBA(_x, _y, r, g, b, a) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((r << 16) | \
- (g << 8) | \
- (b << 0) | \
- (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 *)(read_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) i830##x##_8888
-#include "spantmp.h"
-
-/* 24 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = 0xffffff & d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xffffff;
-
-#define TAG(x) i830##x##_24
-#include "depthtmp.h"
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xff000000; \
- tmp |= (d) & 0xffffff; \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xffffff;
-
-
-#define TAG(x) i830##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \
- tmp &= 0xffffff; \
- tmp |= (d<<24); \
- *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + _x*4 + _y*pitch) >> 24;
-
-#define TAG(x) i830##x##_24_8
-#include "stenciltmp.h"
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void i830SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- assert( (colorBuffer == imesa->driDrawable->driverPrivate)
- || (colorBuffer == imesa->driReadable->driverPrivate) );
-
- imesa->mesa_drawable = (colorBuffer == imesa->driDrawable->driverPrivate)
- ? imesa->driDrawable : imesa->driReadable;
-
- if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- } else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
- imesa->drawMap = imesa->i830Screen->back.map;
- imesa->readMap = imesa->i830Screen->back.map;
- } else {
- ASSERT(0);
- }
-}
-
-
-
-/* Move locking out to get reasonable span performance.
- */
-void i830SpanRenderStart( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- I830_FIREVERTICES(imesa);
- LOCK_HARDWARE(imesa);
- i830RegetLockQuiescent( imesa );
-}
-
-void i830SpanRenderFinish( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( imesa );
-}
-
-void i830DDInitSpanFuncs( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
-
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = i830SetBuffer;
-
- switch (i830Screen->fbFormat) {
- case DV_PF_555:
-#if 0
- swdd->WriteRGBASpan = i830WriteRGBASpan_555;
- swdd->WriteRGBSpan = i830WriteRGBSpan_555;
- swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_555;
- swdd->WriteRGBAPixels = i830WriteRGBAPixels_555;
- swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_555;
- swdd->ReadRGBASpan = i830ReadRGBASpan_555;
- swdd->ReadRGBAPixels = i830ReadRGBAPixels_555;
- swdd->ReadDepthSpan = i830ReadDepthSpan_16;
- swdd->WriteDepthSpan = i830WriteDepthSpan_16;
- swdd->ReadDepthPixels = i830ReadDepthPixels_16;
- swdd->WriteDepthPixels = i830WriteDepthPixels_16;
-#endif
- break;
-
- case DV_PF_565:
-#if 0
- swdd->WriteRGBASpan = i830WriteRGBASpan_565;
- swdd->WriteRGBSpan = i830WriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = i830WriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = i830ReadRGBASpan_565;
- swdd->ReadRGBAPixels = i830ReadRGBAPixels_565;
- swdd->ReadDepthSpan = i830ReadDepthSpan_16;
- swdd->WriteDepthSpan = i830WriteDepthSpan_16;
- swdd->ReadDepthPixels = i830ReadDepthPixels_16;
- swdd->WriteDepthPixels = i830WriteDepthPixels_16;
-#endif
- break;
-
- case DV_PF_8888:
-#if 0
- swdd->WriteRGBASpan = i830WriteRGBASpan_8888;
- swdd->WriteRGBSpan = i830WriteRGBSpan_8888;
- swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_8888;
- swdd->WriteRGBAPixels = i830WriteRGBAPixels_8888;
- swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_8888;
- swdd->ReadRGBASpan = i830ReadRGBASpan_8888;
- swdd->ReadRGBAPixels = i830ReadRGBAPixels_8888;
-#endif
-
- if(imesa->hw_stencil) {
-#if 0
- swdd->ReadDepthSpan = i830ReadDepthSpan_24_8;
- swdd->WriteDepthSpan = i830WriteDepthSpan_24_8;
- swdd->ReadDepthPixels = i830ReadDepthPixels_24_8;
- swdd->WriteDepthPixels = i830WriteDepthPixels_24_8;
- swdd->WriteStencilSpan = i830WriteStencilSpan_24_8;
- swdd->ReadStencilSpan = i830ReadStencilSpan_24_8;
- swdd->WriteStencilPixels = i830WriteStencilPixels_24_8;
- swdd->ReadStencilPixels = i830ReadStencilPixels_24_8;
-#endif
- } else {
-#if 0
- swdd->ReadDepthSpan = i830ReadDepthSpan_24;
- swdd->WriteDepthSpan = i830WriteDepthSpan_24;
- swdd->ReadDepthPixels = i830ReadDepthPixels_24;
- swdd->WriteDepthPixels = i830WriteDepthPixels_24;
-#endif
- }
- break;
- }
-
- swdd->SpanRenderStart = i830SpanRenderStart;
- swdd->SpanRenderFinish = i830SpanRenderFinish;
-}
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-i830SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
- drb->Base.GetRow = i830ReadRGBASpan_555;
- drb->Base.GetValues = i830ReadRGBAPixels_555;
- drb->Base.PutRow = i830WriteRGBASpan_555;
- drb->Base.PutRowRGB = i830WriteRGBSpan_555;
- drb->Base.PutMonoRow = i830WriteMonoRGBASpan_555;
- drb->Base.PutValues = i830WriteRGBAPixels_555;
- drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_555;
- }
- else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = i830ReadRGBASpan_565;
- drb->Base.GetValues = i830ReadRGBAPixels_565;
- drb->Base.PutRow = i830WriteRGBASpan_565;
- drb->Base.PutRowRGB = i830WriteRGBSpan_565;
- drb->Base.PutMonoRow = i830WriteMonoRGBASpan_565;
- drb->Base.PutValues = i830WriteRGBAPixels_565;
- drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_565;
- }
- else {
- assert(vis->redBits == 8);
- assert(vis->greenBits == 8);
- assert(vis->blueBits == 8);
- drb->Base.GetRow = i830ReadRGBASpan_8888;
- drb->Base.GetValues = i830ReadRGBAPixels_8888;
- drb->Base.PutRow = i830WriteRGBASpan_8888;
- drb->Base.PutRowRGB = i830WriteRGBSpan_8888;
- drb->Base.PutMonoRow = i830WriteMonoRGBASpan_8888;
- drb->Base.PutValues = i830WriteRGBAPixels_8888;
- drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_8888;
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = i830ReadDepthSpan_16;
- drb->Base.GetValues = i830ReadDepthPixels_16;
- drb->Base.PutRow = i830WriteDepthSpan_16;
- drb->Base.PutMonoRow = i830WriteMonoDepthSpan_16;
- drb->Base.PutValues = i830WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = i830ReadDepthSpan_24_8;
- drb->Base.GetValues = i830ReadDepthPixels_24_8;
- drb->Base.PutRow = i830WriteDepthSpan_24_8;
- drb->Base.PutMonoRow = i830WriteMonoDepthSpan_24_8;
- drb->Base.PutValues = i830WriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
- /* not _really_ 32-bit Z */
- drb->Base.GetRow = i830ReadDepthSpan_24;
- drb->Base.GetValues = i830ReadDepthPixels_24;
- drb->Base.PutRow = i830WriteDepthSpan_24;
- drb->Base.PutMonoRow = i830WriteMonoDepthSpan_24;
- drb->Base.PutValues = i830WriteDepthPixels_24;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = i830ReadStencilSpan_24_8;
- drb->Base.GetValues = i830ReadStencilPixels_24_8;
- drb->Base.PutRow = i830WriteStencilSpan_24_8;
- drb->Base.PutMonoRow = i830WriteMonoStencilSpan_24_8;
- drb->Base.PutValues = i830WriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.h
deleted file mode 100644
index 4b8341971..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_span.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_span.h,v 1.2 2002/09/11 00:29:26 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef _I830_SPAN_H
-#define _I830_SPAN_H
-
-#include "drirenderbuffer.h"
-
-extern void i830DDInitSpanFuncs( GLcontext *ctx );
-
-extern void i830SpanRenderFinish( GLcontext *ctx );
-extern void i830SpanRenderStart( GLcontext *ctx );
-
-extern void
-i830SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.c
deleted file mode 100644
index 615348544..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.c
+++ /dev/null
@@ -1,1707 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_state.c,v 1.6 2003/01/28 22:47:06 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "buffers.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "texmem.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_state.h"
-#include "i830_tex.h"
-#include "i830_tris.h"
-#include "i830_ioctl.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-static __inline__ GLuint i830PackColor(GLuint format,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case DV_PF_555:
- return I830PACKCOLOR1555(r,g,b,a);
- case DV_PF_565:
- return I830PACKCOLOR565(r,g,b);
- case DV_PF_8888:
- return I830PACKCOLOR8888(r,g,b,a);
- default:
- fprintf(stderr, "unknown format %d\n", (int)format);
- return 0;
- }
-}
-
-static void i830StencilFunc(GLcontext *ctx, GLenum func, GLint ref,
- GLuint mask)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int test = 0;
-
- mask = mask & 0xff;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(func), ref, mask);
-
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- imesa->Setup[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(mask));
- imesa->Setup[I830_CTXREG_STENCILTST] &= ~(STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
- imesa->Setup[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_REF_VALUE(ref) |
- STENCIL_TEST_FUNC(test));
-}
-
-static void i830StencilMask(GLcontext *ctx, GLuint mask)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
-
- mask = mask & 0xff;
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- imesa->Setup[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(mask));
-}
-
-static void i830StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int fop, dfop, dpop;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(fail),
- _mesa_lookup_enum_by_nr(zfail),
- _mesa_lookup_enum_by_nr(zpass));
-
- fop = 0; dfop = 0; dpop = 0;
-
- switch(fail) {
- case GL_KEEP:
- fop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- fop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- fop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- fop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- fop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- fop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- fop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- fop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zfail) {
- case GL_KEEP:
- dfop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dfop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dfop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dfop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dfop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dfop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dfop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dfop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zpass) {
- case GL_KEEP:
- dpop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dpop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dpop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dpop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dpop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dpop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dpop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dpop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
-
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STENCILTST] &= ~(STENCIL_OPS_MASK);
- imesa->Setup[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(fop) |
- STENCIL_PASS_DEPTH_FAIL_OP(dfop) |
- STENCIL_PASS_DEPTH_PASS_OP(dpop));
-}
-
-static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int test = 0;
- GLuint refByte = (GLint) (ref * 255.0);
-
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE2] &= ~ALPHA_TEST_REF_MASK;
- imesa->Setup[I830_CTXREG_STATE2] |= (ENABLE_ALPHA_TEST_FUNC |
- ENABLE_ALPHA_REF_VALUE |
- ALPHA_TEST_FUNC(test) |
- ALPHA_REF_VALUE(refByte));
-}
-
-/* This function makes sure that the proper enables are
- * set for LogicOp, Independant Alpha Blend, and Blending.
- * It needs to be called from numerous places where we
- * could change the LogicOp or Independant Alpha Blend without subsequent
- * calls to glEnable.
- */
-static void i830EvalLogicOpBlendState(GLcontext *ctx)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- imesa->Setup[I830_CTXREG_IALPHAB] &= ~ENABLE_INDPT_ALPHA_BLEND;
-
- if (ctx->Color.ColorLogicOpEnabled) {
- imesa->Setup[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP);
- imesa->Setup[I830_CTXREG_IALPHAB] |= DISABLE_INDPT_ALPHA_BLEND;
- } else if (ctx->Color.BlendEnabled) {
- imesa->Setup[I830_CTXREG_ENABLES_1] |= (ENABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
-
- /* If the alpha blend state does not match the color blend state,
- * enable independent alpha blending. Otherwise, leave it disabled
- * and the hardware will use the color blend state for both.
- */
-
- if ( 0 && (imesa->Setup[I830_CTXREG_IALPHAB] & BLEND_STATE_MASK)
- != (imesa->Setup[I830_CTXREG_STATE1] & BLEND_STATE_MASK) ) {
- imesa->Setup[I830_CTXREG_IALPHAB] |= ENABLE_INDPT_ALPHA_BLEND;
- } else {
- imesa->Setup[I830_CTXREG_IALPHAB] |= DISABLE_INDPT_ALPHA_BLEND;
- }
- } else {
- imesa->Setup[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
- imesa->Setup[I830_CTXREG_IALPHAB] |= DISABLE_INDPT_ALPHA_BLEND;
- }
-}
-
-static void i830BlendColor(GLcontext *ctx, const GLfloat color[4])
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLubyte r, g, b, a;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- FLOAT_COLOR_TO_UBYTE_COLOR(r, color[RCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(g, color[GCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(b, color[BCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(a, color[ACOMP]);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_BLENDCOLR] = ((a << 24) |
- (r << 16) |
- (g << 8) |
- b);
-}
-
-/**
- * Calculate the hardware blend factor setting. This same function is used
- * for source and destination of both alpha and RGB.
- *
- * \returns
- * The hardware register value for the specified blend factor. This value
- * will need to be shifted into the correct position for either source or
- * destination factor.
- *
- * \todo
- * Since the two cases where source and destination are handled differently
- * are essentially error cases, they should never happen. Determine if these
- * cases can be removed.
- */
-static int blend_factor( GLenum factor, GLboolean is_src )
-{
- int func;
-
- switch( factor ) {
- case GL_ZERO:
- func = BLENDFACT_ZERO;
- break;
- case GL_ONE:
- func = BLENDFACT_ONE;
- break;
- case GL_SRC_COLOR:
- func = BLENDFACT_SRC_COLR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- func = BLENDFACT_INV_SRC_COLR;
- break;
- case GL_SRC_ALPHA:
- func = BLENDFACT_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func = BLENDFACT_INV_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- func = BLENDFACT_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func = BLENDFACT_INV_DST_ALPHA;
- break;
- case GL_DST_COLOR:
- func = BLENDFACT_DST_COLR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- func = BLENDFACT_INV_DST_COLR;
- break;
- case GL_SRC_ALPHA_SATURATE:
- func = (is_src) ? BLENDFACT_SRC_ALPHA_SATURATE : BLENDFACT_ZERO;
- break;
- case GL_CONSTANT_COLOR:
- func = BLENDFACT_CONST_COLOR;
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- func = BLENDFACT_INV_CONST_COLOR;
- break;
- case GL_CONSTANT_ALPHA:
- func = BLENDFACT_CONST_ALPHA;
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- func = BLENDFACT_INV_CONST_ALPHA;
- break;
- default:
- func = (is_src) ? BLENDFACT_ONE : BLENDFACT_ZERO;
- }
-
- return func;
-}
-
-
-/**
- * Sets both the blend equation (called "function" in i830 docs) and the
- * blend function (called "factor" in i830 docs). This is done in a single
- * function because some blend equations (i.e., \c GL_MIN and \c GL_MAX)
- * change the interpretation of the blend function.
- */
-
-static void i830_set_blend_state( GLcontext * ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int funcA;
- int funcRGB;
- int eqnA;
- int eqnRGB;
-
-
- funcRGB = SRC_BLND_FACT( blend_factor( ctx->Color.BlendSrcRGB, GL_TRUE ) )
- | DST_BLND_FACT( blend_factor( ctx->Color.BlendDstRGB, GL_FALSE ) );
-
- switch(ctx->Color.BlendEquationRGB) {
- case GL_FUNC_ADD:
- eqnRGB = BLENDFUNC_ADD;
- break;
- case GL_MIN:
- eqnRGB = BLENDFUNC_MIN;
- funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_MAX:
- eqnRGB = BLENDFUNC_MAX;
- funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_FUNC_SUBTRACT:
- eqnRGB = BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnRGB = BLENDFUNC_RVRSE_SUB;
- break;
- default:
- fprintf( stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n",
- __func__, __LINE__, ctx->Color.BlendEquationRGB );
- return;
- }
-
-
- funcA = SRC_ABLEND_FACT( blend_factor( ctx->Color.BlendSrcA, GL_TRUE ) )
- | DST_ABLEND_FACT( blend_factor( ctx->Color.BlendDstA, GL_FALSE ) );
-
- switch(ctx->Color.BlendEquationA) {
- case GL_FUNC_ADD:
- eqnA = BLENDFUNC_ADD;
- break;
- case GL_MIN:
- eqnA = BLENDFUNC_MIN;
- funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_MAX:
- eqnA = BLENDFUNC_MAX;
- funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_FUNC_SUBTRACT:
- eqnA = BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnA = BLENDFUNC_RVRSE_SUB;
- break;
- default:
- fprintf( stderr, "[%s:%u] Invalid alpha blend equation (0x%04x).\n",
- __func__, __LINE__, ctx->Color.BlendEquationA );
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
- imesa->Setup[I830_CTXREG_STATE1] = eqnRGB | funcRGB
- | STATE3D_MODES_1_CMD
- | ENABLE_SRC_BLND_FACTOR | ENABLE_DST_BLND_FACTOR
- | ENABLE_COLR_BLND_FUNC;
-
- imesa->Setup[I830_CTXREG_IALPHAB] = eqnA | funcA
- | STATE3D_INDPT_ALPHA_BLEND_CMD
- | ENABLE_SRC_ABLEND_FACTOR | ENABLE_DST_ABLEND_FACTOR
- | ENABLE_ALPHA_BLENDFUNC;
-
-
- /* This will catch a logicop blend equation. It will also ensure
- * independant alpha blend is really in the correct state (either enabled
- * or disabled) if blending is already enabled.
- */
-
- i830EvalLogicOpBlendState(ctx);
-
- if (0) {
- fprintf(stderr, "[%s:%u] STATE1: 0x%08x IALPHAB: 0x%08x blend is %sabled\n",
- __func__, __LINE__,
- imesa->Setup[I830_CTXREG_STATE1],
- imesa->Setup[I830_CTXREG_IALPHAB],
- (ctx->Color.BlendEnabled) ? "en" : "dis");
- }
-}
-
-static void i830BlendEquationSeparate(GLcontext *ctx,
- GLenum modeRGB, GLenum modeA)
-{
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s -> %s, %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(modeRGB),
- _mesa_lookup_enum_by_nr(modeA));
-
- (void) modeRGB;
- (void) modeA;
- i830_set_blend_state( ctx );
-}
-
-
-
-static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(sfactorRGB),
- _mesa_lookup_enum_by_nr(dfactorRGB),
- _mesa_lookup_enum_by_nr(sfactorA),
- _mesa_lookup_enum_by_nr(dfactorA));
-
- (void) sfactorRGB;
- (void) dfactorRGB;
- (void) sfactorA;
- (void) dfactorA;
- i830_set_blend_state( ctx );
-}
-
-static void i830DepthFunc(GLcontext *ctx, GLenum func)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int test = 0;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default: return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK;
- imesa->Setup[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(test));
-}
-
-static void i830DepthMask(GLcontext *ctx, GLboolean flag)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
- imesa->Setup[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
-
- if (flag && ctx->Depth.Test)
- imesa->Setup[I830_CTXREG_ENABLES_2] |= ENABLE_DEPTH_WRITE;
- else
- imesa->Setup[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE;
-}
-
-/* =============================================================
- * Polygon stipple
- *
- * The i830 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i830PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- imesa->reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I830_STATECHANGE(imesa, I830_UPLOAD_STIPPLE);
- imesa->StippleSetup[I830_STPREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 3 ; j >= 0; j--)
- for (i = 0 ; i < 4 ; i++, m++)
- if (*m != p[j]) {
- imesa->hw_stipple = 0;
- return;
- }
-
- newMask = (((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12));
-
-
- if (newMask == 0xffff || newMask == 0x0) {
- /* this is needed to make conform pass */
- imesa->hw_stipple = 0;
- return;
- }
-
- imesa->StippleSetup[I830_STPREG_ST1] &= ~0xffff;
- imesa->StippleSetup[I830_STPREG_ST1] |= newMask;
- imesa->hw_stipple = 1;
-
- if (active)
- imesa->StippleSetup[I830_STPREG_ST1] |= ST1_ENABLE;
-}
-
-static void i830PolygonStippleFallback( GLcontext *ctx, const GLubyte *mask )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- imesa->hw_stipple = 0;
- (void) i830PolygonStipple;
-}
-
-/* =============================================================
- * Hardware clipping
- */
-static void i830Scissor(GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int x1 = x;
- int y1 = imesa->driDrawable->h - (y + h);
- int x2 = x + w - 1;
- int y2 = y1 + h - 1;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
- x, y, w, h);
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
-
- if (x2 >= imesa->i830Screen->width) x2 = imesa->i830Screen->width-1;
- if (y2 >= imesa->i830Screen->height) y2 = imesa->i830Screen->height-1;
- if (x1 >= imesa->i830Screen->width) x1 = imesa->i830Screen->width-1;
- if (y1 >= imesa->i830Screen->height) y1 = imesa->i830Screen->height-1;
-
-
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
- imesa->BufferSetup[I830_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff);
- imesa->BufferSetup[I830_DESTREG_SR2] = (y2 << 16) | (x2 & 0xffff);
-}
-
-static void i830LogicOp(GLcontext *ctx, GLenum opcode)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int tmp = 0;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* FIXME: This should be a look-up table, like the r200 driver. */
- switch(opcode) {
- case GL_CLEAR:
- tmp = LOGICOP_CLEAR;
- break;
- case GL_AND:
- tmp = LOGICOP_AND;
- break;
- case GL_AND_REVERSE:
- tmp = LOGICOP_AND_RVRSE;
- break;
- case GL_COPY:
- tmp = LOGICOP_COPY;
- break;
- case GL_COPY_INVERTED:
- tmp = LOGICOP_COPY_INV;
- break;
- case GL_AND_INVERTED:
- tmp = LOGICOP_AND_INV;
- break;
- case GL_NOOP:
- tmp = LOGICOP_NOOP;
- break;
- case GL_XOR:
- tmp = LOGICOP_XOR;
- break;
- case GL_OR:
- tmp = LOGICOP_OR;
- break;
- case GL_OR_INVERTED:
- tmp = LOGICOP_OR_INV;
- break;
- case GL_NOR:
- tmp = LOGICOP_NOR;
- break;
- case GL_EQUIV:
- tmp = LOGICOP_EQUIV;
- break;
- case GL_INVERT:
- tmp = LOGICOP_INV;
- break;
- case GL_OR_REVERSE:
- tmp = LOGICOP_OR_RVRSE;
- break;
- case GL_NAND:
- tmp = LOGICOP_NAND;
- break;
- case GL_SET:
- tmp = LOGICOP_SET;
- break;
- default:
- return;
- }
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE4] &= ~LOGICOP_MASK;
- imesa->Setup[I830_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
-
- /* Make sure all the enables are correct */
- i830EvalLogicOpBlendState(ctx);
-}
-
-/* Fallback to swrast for select and feedback.
- */
-static void i830RenderMode( GLcontext *ctx, GLenum mode )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- FALLBACK( imesa, I830_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-static void i830DrawBuffer(GLcontext *ctx, GLenum mode )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- /*
- * _ColorDrawBufferMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- I830_FIREVERTICES(imesa);
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] = imesa->i830Screen->fbOffset;
- i830XMesaSetFrontClipRects( imesa );
- FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BUFFER_BIT_BACK_LEFT:
- I830_FIREVERTICES(imesa);
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] =
- imesa->i830Screen->backOffset;
- i830XMesaSetBackClipRects( imesa );
- FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that i830SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-static void i830ReadBuffer(GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-static void i830ClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_red, color[0]);
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_green, color[1]);
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_blue, color[2]);
- CLAMPED_FLOAT_TO_UBYTE(imesa->clear_alpha, color[3]);
-
- imesa->ClearColor = i830PackColor(imesa->i830Screen->fbFormat,
- imesa->clear_red,
- imesa->clear_green,
- imesa->clear_blue,
- imesa->clear_alpha);
-}
-
-static void i830CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint mode = CULLMODE_BOTH;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = CULLMODE_CW;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- }
-
- imesa->LcsCullMode = mode;
-
- if (ctx->Polygon.CullFlag) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE3] &= ~CULLMODE_MASK;
- imesa->Setup[I830_CTXREG_STATE3] |= ENABLE_CULL_MODE | mode;
- }
-}
-
-static void i830LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- int width;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- width = FloatToInt(widthf * 2);
- CLAMP_SELF(width, 1, 15);
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE5] &= ~FIXED_LINE_WIDTH_MASK;
- imesa->Setup[I830_CTXREG_STATE5] |= (ENABLE_FIXED_LINE_WIDTH |
- FIXED_LINE_WIDTH(width));
-}
-
-static void i830PointSize(GLcontext *ctx, GLfloat size)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLint point_size = FloatToInt(size);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- CLAMP_SELF(point_size, 1, 256);
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE5] &= ~FIXED_POINT_WIDTH_MASK;
- imesa->Setup[I830_CTXREG_STATE5] |= (ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(point_size));
-}
-
-
-/* =============================================================
- * Color masks
- */
-
-static void i830ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint tmp = 0;
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
-
- imesa->mask_red = !r;
- imesa->mask_green = !g;
- imesa->mask_blue = !b;
- imesa->mask_alpha = !a;
-
- tmp = (imesa->Setup[I830_CTXREG_ENABLES_2] & ~WRITEMASK_MASK) |
- ENABLE_COLOR_MASK |
- ENABLE_COLOR_WRITE |
- ((!r) << WRITEMASK_RED_SHIFT) |
- ((!g) << WRITEMASK_GREEN_SHIFT) |
- ((!b) << WRITEMASK_BLUE_SHIFT) |
- ((!a) << WRITEMASK_ALPHA_SHIFT);
-
- if (tmp != imesa->Setup[I830_CTXREG_ENABLES_2]) {
- I830_FIREVERTICES(imesa);
- imesa->dirty |= I830_UPLOAD_CTX;
- imesa->Setup[I830_CTXREG_ENABLES_2] = tmp;
- }
-}
-
-static void update_specular( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK;
-
- if (NEED_SECONDARY_COLOR(ctx))
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_SPEC_ADD;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_SPEC_ADD;
-}
-
-static void i830LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- update_specular( ctx );
- }
-}
-
-/* In Mesa 3.5 we can reliably do native flatshading.
- */
-static void i830ShadeModel(GLcontext *ctx, GLenum mode)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
-
-#define SHADE_MODE_MASK ((1<<10)|(1<<8)|(1<<6)|(1<<4))
-
- imesa->Setup[I830_CTXREG_STATE3] &= ~SHADE_MODE_MASK;
-
- if (mode == GL_FLAT) {
- imesa->Setup[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_FLAT) |
- FOG_SHADE_MODE(SHADE_MODE_FLAT) |
- SPEC_SHADE_MODE(SHADE_MODE_FLAT) |
- COLOR_SHADE_MODE(SHADE_MODE_FLAT));
- } else {
- imesa->Setup[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR));
- }
-}
-
-/* =============================================================
- * Fog
- */
-static void i830Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
-
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_FOGCOLOR] = (STATE3D_FOG_COLOR_CMD | color);
- }
-}
-
-/* =============================================================
- */
-
-static void i830Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- switch(cap) {
- case GL_LIGHTING:
- case GL_COLOR_SUM_EXT:
- update_specular( ctx );
- break;
-
- case GL_ALPHA_TEST:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_ALPHA_TEST_MASK;
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_ALPHA_TEST;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_ALPHA_TEST;
-
- break;
-
- case GL_BLEND:
- case GL_COLOR_LOGIC_OP:
- case GL_INDEX_LOGIC_OP:
- i830EvalLogicOpBlendState(ctx);
- break;
-
- case GL_DITHER:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_2] &= ~ENABLE_DITHER;
-
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_2] |= ENABLE_DITHER;
- else
- imesa->Setup[I830_CTXREG_ENABLES_2] |= DISABLE_DITHER;
- break;
-
- case GL_DEPTH_TEST:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
-
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST;
-
- /* Also turn off depth writes when GL_DEPTH_TEST is disabled:
- */
- i830DepthMask( ctx, state );
- break;
-
- case GL_SCISSOR_TEST:
- I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
-
- if (state)
- imesa->BufferSetup[I830_DESTREG_SENABLE] =
- (STATE3D_SCISSOR_ENABLE_CMD |
- ENABLE_SCISSOR_RECT);
- else
- imesa->BufferSetup[I830_DESTREG_SENABLE] =
- (STATE3D_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
-
- imesa->upload_cliprects = GL_TRUE;
- break;
-
- case GL_LINE_SMOOTH:
- if (imesa->reduced_primitive == GL_LINES) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
-
- imesa->Setup[I830_CTXREG_AA] &= ~AA_LINE_ENABLE;
- if (state)
- imesa->Setup[I830_CTXREG_AA] |= AA_LINE_ENABLE;
- else
- imesa->Setup[I830_CTXREG_AA] |= AA_LINE_DISABLE;
- }
- break;
-
- case GL_FOG:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_FOG_MASK;
- if (state)
- imesa->Setup[I830_CTXREG_ENABLES_1] |= I830_ENABLE_FOG;
- else
- imesa->Setup[I830_CTXREG_ENABLES_1] |= I830_DISABLE_FOG;
- break;
-
- case GL_CULL_FACE:
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_STATE3] &= ~CULLMODE_MASK;
- if (state)
- imesa->Setup[I830_CTXREG_STATE3] |= (ENABLE_CULL_MODE |
- imesa->LcsCullMode);
- else
- imesa->Setup[I830_CTXREG_STATE3] |= (ENABLE_CULL_MODE |
- CULLMODE_NONE);
- break;
-
- case GL_TEXTURE_2D:
-/* I830_STATECHANGE(imesa, I830_UPLOAD_CTX); */
-/* imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK; */
- break;
-
- case GL_STENCIL_TEST:
- if (imesa->hw_stencil) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST;
- imesa->Setup[I830_CTXREG_ENABLES_2] &= ~ENABLE_STENCIL_WRITE;
-
- if (state) {
- imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST;
- imesa->Setup[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE;
- } else {
- imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST;
- imesa->Setup[I830_CTXREG_ENABLES_2] |= DISABLE_STENCIL_WRITE;
- }
- } else {
- FALLBACK( imesa, I830_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_POLYGON_STIPPLE:
-#if 0
- /* The stipple command worked on my 855GM box, but not my 845G.
- * I'll do more testing later to find out exactly which hardware
- * supports it. Disabled for now.
- */
- if (imesa->hw_stipple && imesa->reduced_primitive == GL_TRIANGLES)
- {
- I830_STATECHANGE(imesa, I830_UPLOAD_STIPPLE);
- imesa->StippleSetup[I830_STPREG_ST1] &= ~ST1_ENABLE;
- if (state)
- imesa->StippleSetup[I830_STPREG_ST1] |= ST1_ENABLE;
- }
-#endif
- break;
-
- default:
- ;
- }
-}
-
-
-void i830EmitDrawingRectangle( i830ContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
- int x0 = imesa->drawX;
- int y0 = imesa->drawY;
- int x1 = x0 + dPriv->w;
- int y1 = y0 + dPriv->h;
-
- /* Don't set drawing rectangle */
- if (I830_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s x0(%d) x1(%d) y0(%d) y1(%d)\n", __FUNCTION__,
- x0, x1, y0, y1);
-
- /* Coordinate origin of the window - may be offscreen.
- */
- imesa->BufferSetup[I830_DESTREG_DR4] = ((y0<<16) |
- (((unsigned)x0)&0xFFFF));
-
- /* Clip to screen.
- */
- if (x0 < 0) x0 = 0;
- if (y0 < 0) y0 = 0;
- if (x1 > i830Screen->width-1) x1 = i830Screen->width-1;
- if (y1 > i830Screen->height-1) y1 = i830Screen->height-1;
-
-
- /* Onscreen drawing rectangle.
- */
- imesa->BufferSetup[I830_DESTREG_DR2] = ((y0<<16) | x0);
- imesa->BufferSetup[I830_DESTREG_DR3] = (((y1+1)<<16) | (x1+1));
-
-
- /* Just add in our dirty flag, since we might be called when locked */
- /* Might want to modify how this is done. */
- imesa->dirty |= I830_UPLOAD_BUFFERS;
-
- if (0)
- fprintf(stderr, "[%s] DR2(0x%08x) DR3(0x%08x) DR4(0x%08x)\n",
- __FUNCTION__,
- imesa->BufferSetup[I830_DESTREG_DR2],
- imesa->BufferSetup[I830_DESTREG_DR3],
- imesa->BufferSetup[I830_DESTREG_DR4]);
-}
-
-/* This could be done in hardware, will do once I have the driver
- * up and running.
- */
-static void i830CalcViewport( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = imesa->ViewportMatrix.m;
-
- /* See also i830_translate_vertex. SUBPIXEL adjustments can be done
- * via state vars, too.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + imesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * imesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * imesa->depth_scale;
-}
-
-static void i830Viewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- i830CalcViewport( ctx );
-}
-
-static void i830DepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- i830CalcViewport( ctx );
-}
-
-void i830PrintDirty( const char *msg, GLuint state )
-{
- fprintf(stderr, "%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & I830_UPLOAD_TEX0) ? "upload-tex0, " : "",
- (state & I830_UPLOAD_TEX1) ? "upload-tex1, " : "",
- (state & I830_UPLOAD_TEX2) ? "upload-tex2, " : "",
- (state & I830_UPLOAD_TEX3) ? "upload-tex3, " : "",
- (state & I830_UPLOAD_CTX) ? "upload-ctx, " : "",
- (state & I830_UPLOAD_BUFFERS) ? "upload-bufs, " : "",
- (state & I830_UPLOAD_TEXBLEND0) ? "upload-blend0, " : "",
- (state & I830_UPLOAD_TEXBLEND1) ? "upload-blend1, " : "",
- (state & I830_UPLOAD_TEXBLEND2) ? "upload-blend2, " : "",
- (state & I830_UPLOAD_TEXBLEND3) ? "upload-blend3, " : "",
- (state & I830_UPLOAD_STIPPLE) ? "stipple, " : ""
- );
-}
-
-/* Push the state into the sarea and/or texture memory.
- */
-void i830EmitHwStateLocked( i830ContextPtr imesa )
-{
- int i;
-
- if (I830_DEBUG & DEBUG_STATE)
- i830PrintDirty( __FUNCTION__, imesa->dirty );
-
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ( ((imesa->dirty & I830_UPLOAD_TEX_N_IMAGE( i )) != 0)
- && (imesa->CurrentTexObj[i] != NULL) ) {
- i830UploadTexImagesLocked(imesa, imesa->CurrentTexObj[i]);
- }
- }
-
- if (imesa->dirty & I830_UPLOAD_CTX) {
- memcpy( imesa->sarea->ContextState,
- imesa->Setup, sizeof(imesa->Setup) );
- }
-
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ((imesa->dirty & I830_UPLOAD_TEX_N(i)) && imesa->CurrentTexObj[i]) {
- unsigned * TexState;
-
- imesa->sarea->dirty |= I830_UPLOAD_TEX_N(i);
-
- switch( i ) {
- case 0:
- case 1:
- TexState = imesa->sarea->TexState[i];
- break;
-
- case 2:
- TexState = imesa->sarea->TexState2;
- break;
-
- case 3:
- TexState = imesa->sarea->TexState3;
- break;
- }
-
- memcpy(TexState, imesa->CurrentTexObj[i]->Setup,
- sizeof(imesa->sarea->TexState[i]));
-
- TexState[I830_TEXREG_TM0S3] &= ~TM0S3_LOD_BIAS_MASK;
- TexState[I830_TEXREG_TM0S3] |= imesa->LodBias[i];
-
- /* Update the LRU usage */
- if (imesa->CurrentTexObj[i]->base.memBlock)
- driUpdateTextureLRU( (driTextureObject *)
- imesa->CurrentTexObj[i] );
- }
- }
- /* Need to figure out if texturing state, or enable changed. */
-
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if (imesa->dirty & I830_UPLOAD_TEXBLEND_N(i)) {
- unsigned * TexBlendState;
- unsigned * words_used;
-
- imesa->sarea->dirty |= I830_UPLOAD_TEXBLEND_N(i);
-
- switch( i ) {
- case 0:
- case 1:
- TexBlendState = imesa->sarea->TexBlendState[i];
- words_used = & imesa->sarea->TexBlendStateWordsUsed[i];
- break;
-
- case 2:
- TexBlendState = imesa->sarea->TexBlendState2;
- words_used = & imesa->sarea->TexBlendStateWordsUsed2;
- break;
-
- case 3:
- TexBlendState = imesa->sarea->TexBlendState3;
- words_used = & imesa->sarea->TexBlendStateWordsUsed3;
- break;
- }
-
- memcpy(TexBlendState, imesa->TexBlend[i],
- imesa->TexBlendWordsUsed[i] * 4);
- *words_used = imesa->TexBlendWordsUsed[i];
- }
- }
-
- if (imesa->dirty & I830_UPLOAD_BUFFERS) {
- memcpy( imesa->sarea->BufferState,imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
- }
-
- if (imesa->dirty & I830_UPLOAD_STIPPLE) {
- memcpy( imesa->sarea->StippleState,imesa->StippleSetup,
- sizeof(imesa->StippleSetup) );
- }
-
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_SHARED) {
- memcpy( imesa->sarea->Palette[0],imesa->palette,
- sizeof(imesa->sarea->Palette[0]));
- } else {
- i830TextureObjectPtr p;
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(0)) {
- p = imesa->CurrentTexObj[0];
- memcpy( imesa->sarea->Palette[0],p->palette,
- sizeof(imesa->sarea->Palette[0]));
- }
- if (imesa->dirty & I830_UPLOAD_TEX_PALETTE_N(1)) {
- p = imesa->CurrentTexObj[1];
- memcpy( imesa->sarea->Palette[1],
- p->palette,
- sizeof(imesa->sarea->Palette[1]));
- }
- }
-
- imesa->sarea->dirty |= (imesa->dirty & ~(I830_UPLOAD_TEX_MASK |
- I830_UPLOAD_TEXBLEND_MASK));
-
- imesa->upload_cliprects = GL_TRUE;
- imesa->dirty = 0;
-}
-
-
-void i830DDInitState( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- i830ScreenPrivate *i830Screen = imesa->i830Screen;
- int i;
-
- imesa->clear_red = 0;
- imesa->clear_green = 0;
- imesa->clear_blue = 0;
- imesa->clear_alpha = 0;
-
- imesa->mask_red = GL_FALSE;
- imesa->mask_green = GL_FALSE;
- imesa->mask_blue = GL_FALSE;
- imesa->mask_alpha = GL_FALSE;
-
- /* Zero all texture state */
- for (i = 0; i < I830_MAX_TEXTURE_UNITS; i++) {
- (void) memset( imesa->TexBlend[i], 0, sizeof( imesa->TexBlend[i] ) );
- (void) memset( imesa->Init_TexBlend[i], 0, sizeof( imesa->Init_TexBlend[i] ) );
-
- imesa->TexBlendWordsUsed[i] = 0;
- imesa->Init_TexBlendWordsUsed[i] = 0;
- }
-
- /* Set default blend state */
- imesa->TexBlend[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
- imesa->TexBlend[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
-
- imesa->TexBlendWordsUsed[0] = 4;
-
- imesa->Init_TexBlend[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- imesa->Init_TexBlend[0][1] = (STATE3D_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->Init_TexBlend[0][2] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->Init_TexBlend[0][3] = (STATE3D_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->Init_TexBlendWordsUsed[0] = 4;
-
- memset(imesa->Setup, 0, sizeof(imesa->Setup));
-
- imesa->Setup[I830_CTXREG_VF] = 0;
- imesa->Setup[I830_CTXREG_VF2] = 0;
-
- imesa->Setup[I830_CTXREG_AA] = (STATE3D_AA_CMD |
- AA_LINE_ECAAR_WIDTH_ENABLE |
- AA_LINE_ECAAR_WIDTH_1_0 |
- AA_LINE_REGION_WIDTH_ENABLE |
- AA_LINE_REGION_WIDTH_1_0 |
- AA_LINE_DISABLE);
-
- imesa->Setup[I830_CTXREG_ENABLES_1] = (STATE3D_ENABLES_1_CMD |
- DISABLE_LOGIC_OP |
- DISABLE_STENCIL_TEST |
- DISABLE_DEPTH_BIAS |
- DISABLE_SPEC_ADD |
- I830_DISABLE_FOG |
- DISABLE_ALPHA_TEST |
- DISABLE_COLOR_BLEND |
- DISABLE_DEPTH_TEST);
-
- if (imesa->hw_stencil) {
- imesa->Setup[I830_CTXREG_ENABLES_2] = (STATE3D_ENABLES_2_CMD |
- ENABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- } else {
- imesa->Setup[I830_CTXREG_ENABLES_2] = (STATE3D_ENABLES_2_CMD |
- DISABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- }
-
- imesa->Setup[I830_CTXREG_STATE1] = (STATE3D_MODES_1_CMD |
- ENABLE_COLR_BLND_FUNC |
- BLENDFUNC_ADD |
- ENABLE_SRC_BLND_FACTOR |
- SRC_BLND_FACT(BLENDFACT_ONE) |
- ENABLE_DST_BLND_FACTOR |
- DST_BLND_FACT(BLENDFACT_ZERO) );
-
- imesa->Setup[I830_CTXREG_STATE2] = (STATE3D_MODES_2_CMD |
- ENABLE_GLOBAL_DEPTH_BIAS |
- GLOBAL_DEPTH_BIAS(0) |
- ENABLE_ALPHA_TEST_FUNC |
- ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ALPHA_REF_VALUE(0) );
-
- imesa->Setup[I830_CTXREG_STATE3] = (STATE3D_MODES_3_CMD |
- ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(COMPAREFUNC_LESS) |
- ENABLE_ALPHA_SHADE_MODE |
- ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_FOG_SHADE_MODE |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_SPEC_SHADE_MODE |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_COLOR_SHADE_MODE |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_CULL_MODE |
- CULLMODE_NONE);
-
- imesa->Setup[I830_CTXREG_STATE4] = (STATE3D_MODES_4_CMD |
- ENABLE_LOGIC_OP_FUNC |
- LOGIC_OP_FUNC(LOGICOP_COPY) |
- ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff) |
- ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(0xff));
-
- imesa->Setup[I830_CTXREG_STENCILTST] = (STATE3D_STENCIL_TEST_CMD |
- ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_KEEP) |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ENABLE_STENCIL_REF_VALUE |
- STENCIL_REF_VALUE(0) );
-
- imesa->Setup[I830_CTXREG_STATE5] = (STATE3D_MODES_5_CMD |
- FLUSH_TEXTURE_CACHE |
- ENABLE_SPRITE_POINT_TEX |
- SPRITE_POINT_TEX_OFF |
- ENABLE_FIXED_LINE_WIDTH |
- FIXED_LINE_WIDTH(0x2) | /* 1.0 */
- ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(1) );
-
- imesa->Setup[I830_CTXREG_IALPHAB] = (STATE3D_INDPT_ALPHA_BLEND_CMD |
- DISABLE_INDPT_ALPHA_BLEND |
- ENABLE_ALPHA_BLENDFUNC |
- ABLENDFUNC_ADD);
-
- imesa->Setup[I830_CTXREG_FOGCOLOR] = (STATE3D_FOG_COLOR_CMD |
- FOG_COLOR_RED(0) |
- FOG_COLOR_GREEN(0) |
- FOG_COLOR_BLUE(0));
-
- imesa->Setup[I830_CTXREG_BLENDCOLR0] = (STATE3D_CONST_BLEND_COLOR_CMD);
-
- imesa->Setup[I830_CTXREG_BLENDCOLR] = 0;
-
- imesa->Setup[I830_CTXREG_MCSB0] = STATE3D_MAP_COORD_SETBIND_CMD;
- imesa->Setup[I830_CTXREG_MCSB1] = (TEXBIND_SET3(TEXCOORDSRC_VTXSET_3) |
- TEXBIND_SET2(TEXCOORDSRC_VTXSET_2) |
- TEXBIND_SET1(TEXCOORDSRC_VTXSET_1) |
- TEXBIND_SET0(TEXCOORDSRC_VTXSET_0));
-
- imesa->LcsCullMode = CULLMODE_CW; /* GL default */
-
- memset(imesa->BufferSetup, 0, sizeof(imesa->BufferSetup));
- memset(imesa->StippleSetup, 0, sizeof(imesa->StippleSetup));
-
-
- if (imesa->glCtx->Visual.doubleBufferMode &&
- imesa->sarea->pf_current_page == 0) {
- imesa->drawMap = i830Screen->back.map;
- imesa->readMap = i830Screen->back.map;
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] = i830Screen->backOffset;
- imesa->BufferSetup[I830_DESTREG_DBUFADDR] = 0;
- } else {
- /* use front buffer by default */
- imesa->drawMap = (char *)imesa->driScreen->pFB;
- imesa->readMap = (char *)imesa->driScreen->pFB;
- imesa->BufferSetup[I830_DESTREG_CBUFADDR] = i830Screen->fbOffset;
- imesa->BufferSetup[I830_DESTREG_DBUFADDR] = 0;
- }
-
- imesa->BufferSetup[I830_DESTREG_DV0] = STATE3D_DST_BUF_VARS_CMD;
-
- switch (i830Screen->fbFormat) {
- case DV_PF_555:
- case DV_PF_565:
- imesa->BufferSetup[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- i830Screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_16_FIXED);
- break;
- case DV_PF_8888:
- imesa->BufferSetup[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- i830Screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_24_FIXED_8_OTHER);
- break;
- }
- imesa->BufferSetup[I830_DESTREG_SENABLE] = (STATE3D_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- imesa->BufferSetup[I830_DESTREG_SR0] = STATE3D_SCISSOR_RECT_0_CMD;
- imesa->BufferSetup[I830_DESTREG_SR1] = 0;
- imesa->BufferSetup[I830_DESTREG_SR2] = 0;
-
- imesa->BufferSetup[I830_DESTREG_DR0] = STATE3D_DRAW_RECT_CMD;
- imesa->BufferSetup[I830_DESTREG_DR1] = 0;
- imesa->BufferSetup[I830_DESTREG_DR2] = 0;
- imesa->BufferSetup[I830_DESTREG_DR3] = (((i830Screen->height)<<16) |
- (i830Screen->width));
- imesa->BufferSetup[I830_DESTREG_DR4] = 0;
-
- memcpy( imesa->Init_Setup,
- imesa->Setup,
- sizeof(imesa->Setup) );
- memcpy( imesa->Init_BufferSetup,
- imesa->BufferSetup,
- sizeof(imesa->BufferSetup) );
-
-}
-
-static void i830InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- I830_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-void i830DDInitStateFuncs(GLcontext *ctx)
-{
- /* Callbacks for internal Mesa events.
- */
- ctx->Driver.UpdateState = i830InvalidateState;
-
- /* API callbacks
- */
- ctx->Driver.AlphaFunc = i830AlphaFunc;
- ctx->Driver.BlendEquationSeparate = i830BlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = i830BlendFuncSeparate;
- ctx->Driver.BlendColor = i830BlendColor;
- ctx->Driver.ClearColor = i830ClearColor;
- ctx->Driver.ColorMask = i830ColorMask;
- ctx->Driver.CullFace = i830CullFaceFrontFace;
- ctx->Driver.DepthFunc = i830DepthFunc;
- ctx->Driver.DepthMask = i830DepthMask;
- ctx->Driver.Enable = i830Enable;
- ctx->Driver.Fogfv = i830Fogfv;
- ctx->Driver.FrontFace = i830CullFaceFrontFace;
- ctx->Driver.LineWidth = i830LineWidth;
- ctx->Driver.PointSize = i830PointSize;
- ctx->Driver.LogicOpcode = i830LogicOp;
- ctx->Driver.PolygonStipple = i830PolygonStippleFallback;
- ctx->Driver.RenderMode = i830RenderMode;
- ctx->Driver.Scissor = i830Scissor;
- ctx->Driver.DrawBuffer = i830DrawBuffer;
- ctx->Driver.ReadBuffer = i830ReadBuffer;
- ctx->Driver.ShadeModel = i830ShadeModel;
- ctx->Driver.DepthRange = i830DepthRange;
- ctx->Driver.Viewport = i830Viewport;
- ctx->Driver.LightModelfv = i830LightModelfv;
-
- ctx->Driver.StencilFunc = i830StencilFunc;
- ctx->Driver.StencilMask = i830StencilMask;
- ctx->Driver.StencilOp = i830StencilOp;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.h
deleted file mode 100644
index b65165124..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_state.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_state.h,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#ifndef _I830_STATE_H
-#define _I830_STATE_H
-
-#include "i830_context.h"
-#include "colormac.h"
-#define FloatToInt(F) ((int)(F))
-
-/*
- * * This function/macro is sensitive to precision. Test carefully
- * * if you change it.
- * */
-#define FLOAT_COLOR_TO_UBYTE_COLOR(b, f) \
- do { \
- union {GLfloat r; GLuint i; } tmp; \
- tmp.r = f; \
- b = ((tmp.i >= IEEE_ONE) \
- ? ((GLint)tmp.i < 0) ? (GLubyte)0 : (GLubyte)255 \
- : (tmp.r = tmp.r*(255.0F/256.0F) + 32768.0F, \
- (GLubyte)tmp.i)); \
- } while (0)
-
-
-
-extern void i830DDInitState( GLcontext *ctx );
-extern void i830DDInitStateFuncs( GLcontext *ctx );
-
-extern void i830PrintDirty( const char *msg, GLuint state );
-extern void i830SetDrawBuffer(GLcontext *ctx, GLenum mode );
-
-extern void i830Fallback( i830ContextPtr imesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) i830Fallback( imesa, bit, mode )
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c
deleted file mode 100644
index 41b5d9293..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_tex.c,v 1.5 2003/05/07 21:56:31 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keithw@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "texformat.h"
-#include "texmem.h"
-#include "texobj.h"
-#include "swrast/swrast.h"
-#include "texobj.h"
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-#include "i830_context.h"
-#include "i830_tex.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-
-/*
- * Compute the 'S2.4' lod bias factor from the floating point OpenGL bias.
- */
-static void i830ComputeLodBias( i830ContextPtr imesa, unsigned unit,
- GLfloat bias )
-{
- int b;
-
- b = (int) (bias * 16.0);
- if(b > 63) b = 63;
- else if (b < -64) b = -64;
- imesa->LodBias[ unit ] = ((b << TM0S3_LOD_BIAS_SHIFT) &
- TM0S3_LOD_BIAS_MASK);
-}
-
-
-/**
- * Set the texture wrap modes.
- *
- * The i830M (and related graphics cores) do not support GL_CLAMP. The Intel
- * drivers for "other operating systems" implement GL_CLAMP as
- * GL_CLAMP_TO_EDGE, so the same is done here.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void i830SetTexWrapping(i830TextureObjectPtr tex,
- GLenum swrap, GLenum twrap)
-{
- tex->Setup[I830_TEXREG_MCS] &= ~(TEXCOORD_ADDR_U_MASK|TEXCOORD_ADDR_V_MASK);
-
- switch( swrap ) {
- case GL_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP);
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP);
- break;
- case GL_CLAMP_TO_BORDER:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP_BORDER);
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_MIRROR);
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch( twrap ) {
- case GL_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP);
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP);
- break;
- case GL_CLAMP_TO_BORDER:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP_BORDER);
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_MIRROR);
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-}
-
-static void i830SetTexMaxAnisotropy( i830TextureObjectPtr t, GLfloat max )
-{
- t->max_anisotropy = max;
-}
-
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- * \param bias LOD bias for this texture unit.
- */
-
-static void i830SetTexFilter( i830TextureObjectPtr t,
- GLenum minf, GLenum magf )
-{
- int minFilt = 0, mipFilt = 0, magFilt = 0;
-
- if(I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if ( t->max_anisotropy > 1.0 ) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- }
- else {
- switch (minf) {
- case GL_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_LINEAR;
- break;
- default:
- _mesa_problem(NULL, "%s: Unsupported min. filter %d", __FUNCTION__,
- (int) minf );
- break;
- }
-
- switch (magf) {
- case GL_NEAREST:
- magFilt = FILTER_NEAREST;
- break;
- case GL_LINEAR:
- magFilt = FILTER_LINEAR;
- break;
- default:
- _mesa_problem(NULL, "%s: Unsupported mag. filter %d", __FUNCTION__,
- (int) magf );
- break;
- }
- }
-
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIN_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIP_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MAG_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] |= ((minFilt << TM0S3_MIN_FILTER_SHIFT) |
- (mipFilt << TM0S3_MIP_FILTER_SHIFT) |
- (magFilt << TM0S3_MAG_FILTER_SHIFT));
-}
-
-static void i830SetTexBorderColor(i830TextureObjectPtr t, GLubyte color[4])
-{
- if(I830_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- t->Setup[I830_TEXREG_TM0S4] =
- I830PACKCOLOR8888(color[0],color[1],color[2],color[3]);
-}
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static i830TextureObjectPtr i830AllocTexObj( struct gl_texture_object *texObj )
-{
- i830TextureObjectPtr t;
-
- t = CALLOC_STRUCT( i830_texture_object_t );
- texObj->DriverData = t;
- if ( t != NULL ) {
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
-
- t->Setup[I830_TEXREG_TM0LI] = STATE3D_LOAD_STATE_IMMEDIATE_2;
- t->Setup[I830_TEXREG_TM0S0] = TM0S0_USE_FENCE;
- t->Setup[I830_TEXREG_TM0S1] = 0;
- t->Setup[I830_TEXREG_TM0S2] = 0;
- t->Setup[I830_TEXREG_TM0S3] = 0;
-
- t->Setup[I830_TEXREG_NOP0] = 0;
- t->Setup[I830_TEXREG_NOP1] = 0;
- t->Setup[I830_TEXREG_NOP2] = 0;
-
- t->Setup[I830_TEXREG_MCS] = (STATE3D_MAP_COORD_SET_CMD |
- MAP_UNIT(0) |
- ENABLE_TEXCOORD_PARAMS |
- TEXCOORDS_ARE_NORMAL |
- TEXCOORDTYPE_CARTESIAN |
- ENABLE_ADDR_V_CNTL |
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP) |
- ENABLE_ADDR_U_CNTL |
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP));
-
- make_empty_list( & t->base );
-
- i830SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
- i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- i830SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- i830SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static void i830TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;
- GLuint unit = ctx->Texture.CurrentUnit;
-
- if (!t)
- return;
-
- if ( target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV )
- return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting imesa->NewGLState means that
- * i830UpdateTextureState() 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:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- i830SetTexMaxAnisotropy( t, tObj->MaxAnisotropy );
- i830SetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- i830SetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- i830SetTexBorderColor( t, tObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* The i830 and its successors can do a lot of this without
- * reloading the textures. A project for someone?
- */
- I830_FIREVERTICES( I830_CONTEXT(ctx) );
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- if (t == imesa->CurrentTexObj[unit]) {
- I830_STATECHANGE( imesa, I830_UPLOAD_TEX0 );
- }
-}
-
-
-static void i830TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- i830ContextPtr imesa = I830_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:
- case GL_TEXTURE_ENV_MODE:
- case GL_COMBINE_RGB_EXT:
- case GL_COMBINE_ALPHA_EXT:
- case GL_SOURCE0_RGB_EXT:
- case GL_SOURCE1_RGB_EXT:
- case GL_SOURCE2_RGB_EXT:
- case GL_SOURCE0_ALPHA_EXT:
- case GL_SOURCE1_ALPHA_EXT:
- case GL_SOURCE2_ALPHA_EXT:
- case GL_OPERAND0_RGB_EXT:
- case GL_OPERAND1_RGB_EXT:
- case GL_OPERAND2_RGB_EXT:
- case GL_OPERAND0_ALPHA_EXT:
- case GL_OPERAND1_ALPHA_EXT:
- case GL_OPERAND2_ALPHA_EXT:
- case GL_RGB_SCALE_EXT:
- case GL_ALPHA_SCALE:
- imesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
-
- case GL_TEXTURE_LOD_BIAS_EXT:
- i830ComputeLodBias( imesa, unit, *param );
- I830_STATECHANGE( imesa, I830_UPLOAD_TEX_N(unit) );
- break;
-
- default:
- break;
- }
-}
-
-static void i830TexImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- if (t) {
- I830_FIREVERTICES( I830_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) i830AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-}
-
-static void i830TexSubImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- if (t) {
- I830_FIREVERTICES( I830_CONTEXT(ctx) );
- driSwapOutTextureObject( t );
- }
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
-}
-
-
-
-static void i830CompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) i830AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-
- if (I830_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
-
- _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
- height, border, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void i830CompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) i830AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void i830BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) ||
- (tObj->DriverData != NULL) );
-}
-
-
-static void i830DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
- if ( t != NULL ) {
- i830ContextPtr imesa = I830_CONTEXT( ctx );
-
- if ( imesa ) {
- I830_FIREVERTICES( imesa );
- }
-
- driDestroyTextureObject( t );
- }
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
-}
-
-
-static const struct gl_texture_format *
-i830ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- const GLboolean do32bpt = ( imesa->i830Screen->cpp == 4 &&
- imesa->i830Screen->textureSize > 4*1024*1024);
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
- }
- else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_al88;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
-
- 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_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
- default:
- fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-/**
- * 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 *
-i830NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- i830AllocTexObj( obj );
- return obj;
-}
-
-void i830InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->NewTextureObject = i830NewTextureObject;
- functions->DeleteTexture = i830DeleteTexture;
- functions->ChooseTextureFormat = i830ChooseTextureFormat;
- functions->TexImage2D = i830TexImage2D;
- functions->TexSubImage2D = i830TexSubImage2D;
- functions->BindTexture = i830BindTexture;
- functions->TexParameter = i830TexParameter;
- functions->TexEnv = i830TexEnv;
- functions->IsTextureResident = driIsTextureResident;
- functions->CompressedTexImage2D = i830CompressedTexImage2D;
- functions->CompressedTexSubImage2D = i830CompressedTexSubImage2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.h
deleted file mode 100644
index 68c18b105..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- * Adapted for use in the I830M driver:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#ifndef I830TEX_INC
-#define I830TEX_INC
-
-#include "mtypes.h"
-#include "i830_context.h"
-#include "i830_3d_reg.h"
-#include "texmem.h"
-
-#define I830_TEX_MAXLEVELS 10
-
-struct i830_texture_object_t
-{
- driTextureObject base;
-
- int texelBytes;
- int Pitch;
- int Height;
- char *BufAddr;
- GLenum palette_format;
- GLuint palette[256];
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[6][I830_TEX_MAXLEVELS];
-
- /* Support for multitexture.
- */
-
- GLuint current_unit;
- GLuint Setup[I830_TEX_SETUP_SIZE];
- GLuint dirty;
-
- GLfloat max_anisotropy;
-};
-
-void i830UpdateTextureState( GLcontext *ctx );
-void i830InitTextureFuncs( struct dd_function_table *functions );
-
-void i830DestroyTexObj( i830ContextPtr imesa, i830TextureObjectPtr t );
-int i830UploadTexImagesLocked( i830ContextPtr imesa, i830TextureObjectPtr t );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c
deleted file mode 100644
index 7faf90874..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_texmem.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/*
- * Author:
- * Jeff Hartmann <jhartmann@2d3d.com>
- *
- * Heavily based on the I810 driver, which was written by:
- * Keith Whitwell <keithw@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_tex.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-
-
-void i830DestroyTexObj(i830ContextPtr imesa, i830TextureObjectPtr t)
-{
- unsigned i;
-
-
- /* See if it was the driver's current object.
- */
- if ( imesa != NULL ) {
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ( t == imesa->CurrentTexObj[ i ] ) {
- imesa->CurrentTexObj[ i ] = NULL;
- imesa->dirty &= ~I830_UPLOAD_TEX_N( i );
- }
- }
- }
-}
-
-#if defined(i386) || defined(__i386__)
-/* From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- */
-static __inline__ void * __memcpy(void * to, const void * from, size_t n)
-{
-int d0, d1, d2;
-__asm__ __volatile__(
- "rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n"
- "2:"
- : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- : "memory");
-return (to);
-}
-#else
-/* Allow compilation on other architectures */
-#define __memcpy memcpy
-#endif
-
-/* Upload an image from mesa's internal copy.
- */
-static void i830UploadTexLevel( i830ContextPtr imesa,
- i830TextureObjectPtr t, int hwlevel )
-{
- const struct gl_texture_image *image = t->image[0][hwlevel].image;
- int j;
-
- if (!image || !image->Data)
- return;
-
- if (image->IsCompressed) {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- if ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_FXT1)
- {
- for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
- __memcpy(dst, src, (image->Width*2) );
- src += image->Width*2;
- }
- }
- else if ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT1)
- {
- for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
- __memcpy(dst, src, (image->Width*2) );
- src += image->Width*2;
- }
- }
- else if (((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT2_3) || ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT4_5))
- {
- for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
- __memcpy(dst, src, (image->Width*4) );
- src += image->Width*4;
- }
- }
- }
- else if (image->Width * image->TexFormat->TexelBytes == t->Pitch) {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- memcpy( dst, src, t->Pitch * image->Height );
- }
- else switch (image->TexFormat->TexelBytes) {
- case 1:
- {
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) {
- __memcpy(dst, src, image->Width );
- src += image->Width;
- }
- }
- break;
-
- case 2:
- {
- GLushort *dst = (GLushort *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLushort *src = (GLushort *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/2)) {
- __memcpy(dst, src, image->Width * 2 );
- src += image->Width;
- }
- }
- break;
-
- case 4:
- {
- GLuint *dst = (GLuint *)(t->BufAddr + t->image[0][hwlevel].offset);
- GLuint *src = (GLuint *)image->Data;
-
- for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/4)) {
- __memcpy(dst, src, image->Width * 4 );
- src += image->Width;
- }
- }
- break;
-
- default:
- fprintf(stderr, "%s: Not supported texel size %d\n",
- __FUNCTION__, image->TexFormat->TexelBytes);
- }
-}
-
-
-/* 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.
- */
-
-int i830UploadTexImagesLocked( i830ContextPtr imesa, i830TextureObjectPtr t )
-{
- int ofs;
- int i;
-
- if ( t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( imesa->texture_heaps, imesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- return -1;
- }
-
- /* Set the base offset of the texture image */
- ofs = t->base.memBlock->ofs;
- t->BufAddr = imesa->i830Screen->tex.map + ofs;
- t->Setup[I830_TEXREG_TM0S0] = (TM0S0_USE_FENCE |
- (imesa->i830Screen->textureOffset + ofs));
-
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if (t == imesa->CurrentTexObj[i]) {
- imesa->dirty |= I830_UPLOAD_TEX_N( i );
- }
- }
- }
-
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
-
- if (imesa->texture_heaps[0]->timestamp >= GET_DISPATCH_AGE(imesa))
- i830WaitAgeLocked( imesa, imesa->texture_heaps[0]->timestamp );
-
- /* Upload any images that are new */
- if (t->base.dirty_images[0]) {
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- for (i = 0 ; i < numLevels ; i++) {
- if ( (t->base.dirty_images[0] & (1 << (i+t->base.firstLevel))) != 0 ) {
- i830UploadTexLevel( imesa, t, i );
- }
- }
- t->base.dirty_images[0] = 0;
- imesa->sarea->perf_boxes |= I830_BOX_TEXTURE_LOAD;
- }
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c
deleted file mode 100644
index 358c554f3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c
+++ /dev/null
@@ -1,716 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 2d3d Inc., Delray Beach, FL
-
-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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_texstate.c,v 1.3 2002/12/10 01:26:53 dawes Exp $ */
-
-/**
- * \file i830_texstate.c
- *
- * Heavily based on the I810 driver, which was written by Keith Whitwell.
- *
- * \author Jeff Hartmann <jhartmann@2d3d.com>
- * \author Keith Whitwell <keithw@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "mm.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_context.h"
-#include "i830_tex.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-
-#define I830_TEX_UNIT_ENABLED(unit) (1<<unit)
-
-static void i830SetTexImages( i830ContextPtr imesa,
- struct gl_texture_object *tObj )
-{
- GLuint total_height, pitch, i, textureFormat;
- i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint numLevels;
-
- switch( baseImage->TexFormat->MesaFormat ) {
- case MESA_FORMAT_L8:
- t->texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_L8;
- break;
-
- case MESA_FORMAT_I8:
- t->texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_I8;
- break;
-
- case MESA_FORMAT_AL88:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_AY88;
- break;
-
- case MESA_FORMAT_RGB565:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
- break;
-
- case MESA_FORMAT_ARGB1555:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
- break;
-
- case MESA_FORMAT_ARGB4444:
- t->texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB4444;
- break;
-
- case MESA_FORMAT_ARGB8888:
- t->texelBytes = 4;
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- break;
-
- case MESA_FORMAT_YCBCR_REV:
- t->texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_NORMAL |
- TM0S1_COLORSPACE_CONVERSION);
- break;
-
- case MESA_FORMAT_YCBCR:
- t->texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_SWAPY | /* ??? */
- TM0S1_COLORSPACE_CONVERSION);
- break;
-
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- t->texelBytes = 2;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
- break;
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGB_DXT1:
- /*
- * DXTn pitches are Width/4 * blocksize in bytes
- * for DXT1: blocksize=8 so Width/4*8 = Width * 2
- * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
- */
- t->texelBytes = 2;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
- break;
- case MESA_FORMAT_RGBA_DXT3:
- t->texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
- break;
- case MESA_FORMAT_RGBA_DXT5:
- t->texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
- break;
- default:
- fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
- free( t );
- return;
- }
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- /* Pitch would be subject to additional rules if texture memory were
- * tiled. Currently it isn't.
- */
- if (0) {
- pitch = 128;
- while (pitch < tObj->Image[0][t->base.firstLevel]->Width * t->texelBytes)
- pitch *= 2;
- }
- else {
- pitch = tObj->Image[0][t->base.firstLevel]->Width * t->texelBytes;
- pitch = (pitch + 3) & ~3;
- }
-
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- for ( total_height = i = 0 ; i < numLevels ; i++ ) {
- t->image[0][i].image = tObj->Image[0][t->base.firstLevel + i];
- if (!t->image[0][i].image)
- break;
-
- t->image[0][i].offset = total_height * pitch;
- if (t->image[0][i].image->IsCompressed)
- {
- if (t->image[0][i].image->Height > 4)
- total_height += t->image[0][i].image->Height/4;
- else
- total_height += 1;
- }
- else
- total_height += t->image[0][i].image->Height;
- t->image[0][i].internalFormat = baseImage->Format;
- }
-
- t->Pitch = pitch;
- t->base.totalSize = total_height*pitch;
- t->Setup[I830_TEXREG_TM0S1] =
- (((tObj->Image[0][t->base.firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) |
- ((tObj->Image[0][t->base.firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) |
- textureFormat);
- t->Setup[I830_TEXREG_TM0S2] =
- ((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT));
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MAX_MIP_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIN_MIP_MASK;
- t->Setup[I830_TEXREG_TM0S3] |= ((numLevels - 1)*4) << TM0S3_MIN_MIP_SHIFT;
- t->dirty = I830_UPLOAD_TEX0 | I830_UPLOAD_TEX1
- | I830_UPLOAD_TEX2 | I830_UPLOAD_TEX3;
-
- LOCK_HARDWARE( imesa );
- i830UploadTexImagesLocked( imesa, t );
- UNLOCK_HARDWARE( imesa );
-}
-
-/* ================================================================
- * Texture combine functions
- */
-
-
-/**
- * Calculate the hardware instuctions to setup the current texture enviromnemt
- * settings. Since \c gl_texture_unit::_CurrentCombine is used, both
- * "classic" texture enviroments and GL_ARB_texture_env_combine type texture
- * environments are treated identically.
- *
- * \todo
- * This function should return \c GLboolean. When \c GL_FALSE is returned,
- * it means that an environment is selected that the hardware cannot do. This
- * is the way the Radeon and R200 drivers work.
- *
- * \todo
- * Looking at i830_3d_regs.h, it seems the i830 can do part of
- * GL_ATI_texture_env_combine3. It can handle using \c GL_ONE and
- * \c GL_ZERO as combine inputs (which the code already supports). It can
- * also handle the \c GL_MODULATE_ADD_ATI mode. Is it worth investigating
- * partial support for the extension?
- *
- * \todo
- * Some thought needs to be put into the way combiners work. The driver
- * treats the hardware as if there's a specific combine unit tied to each
- * texture unit. That's why there's the special case for a disabled texture
- * unit. That's not the way the hardware works. In reality, there are 4
- * texture units and four general instruction slots. Each instruction slot
- * can use any texture as an input. There's no need for this wierd "no-op"
- * stuff. If texture units 0 and 3 are enabled, the instructions to combine
- * them should be in slots 0 and 1, not 0 and 3 with two no-ops inbetween.
- */
-
-static void i830UpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- const GLuint numColorArgs = texUnit->_CurrentCombine->_NumArgsRGB;
- const GLuint numAlphaArgs = texUnit->_CurrentCombine->_NumArgsA;
-
- GLboolean need_constant_color = GL_FALSE;
- GLuint blendop;
- GLuint ablendop;
- GLuint args_RGB[3];
- GLuint args_A[3];
- GLuint rgb_shift = texUnit->Combine.ScaleShiftRGB;
- GLuint alpha_shift = texUnit->Combine.ScaleShiftA;
- int i;
- unsigned used;
- static const GLuint tex_blend_rgb[3] = {
- TEXPIPE_COLOR | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_COLOR | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_COLOR | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
- };
- static const GLuint tex_blend_a[3] = {
- TEXPIPE_ALPHA | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_ALPHA | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_ALPHA | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
- };
- static const GLuint op_rgb[4] = {
- 0,
- TEXBLENDARG_INV_ARG,
- TEXBLENDARG_REPLICATE_ALPHA,
- TEXBLENDARG_REPLICATE_ALPHA | TEXBLENDARG_INV_ARG,
- };
-
-
-
- imesa->TexBlendWordsUsed[unit] = 0;
-
- if(I830_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "[%s:%u] env. mode = %s\n", __FUNCTION__, __LINE__,
- _mesa_lookup_enum_by_nr(texUnit->EnvMode));
-
-
- if ( !texUnit->_ReallyEnabled ) {
- imesa->TexBlend[unit][0] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[unit][1] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- imesa->TexBlend[unit][2] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlend[unit][3] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- imesa->TexBlendWordsUsed[unit] = 4;
- }
- else {
- switch(texUnit->_CurrentCombine->ModeRGB) {
- case GL_REPLACE:
- blendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- blendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- blendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- blendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- blendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- blendop = TEXBLENDOP_SUBTRACT;
- break;
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- rgb_shift = 0;
- alpha_shift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- blendop = TEXBLENDOP_DOT3;
- break;
- default:
- return;
- }
-
- blendop |= (rgb_shift << TEXOP_SCALE_SHIFT);
-
- switch(texUnit->_CurrentCombine->ModeA) {
- case GL_REPLACE:
- ablendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- ablendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- ablendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- ablendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- ablendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- ablendop = TEXBLENDOP_SUBTRACT;
- break;
- default:
- return;
- }
-
- if ( (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT)
- || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) ) {
- ablendop = TEXBLENDOP_DOT3;
- }
-
- ablendop |= (alpha_shift << TEXOP_SCALE_SHIFT);
-
- /* Handle RGB args */
- for( i = 0 ; i < numColorArgs ; i++ ) {
- const int op = texUnit->_CurrentCombine->OperandRGB[i] - GL_SRC_COLOR;
-
- assert( (op >= 0) && (op <= 3) );
- switch(texUnit->_CurrentCombine->SourceRGB[i]) {
- case GL_TEXTURE:
- args_RGB[i] = TEXBLENDARG_TEXEL0 + unit;
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- args_RGB[i] = TEXBLENDARG_TEXEL0
- + (texUnit->_CurrentCombine->SourceRGB[i] & 0x03);
- break;
- case GL_CONSTANT:
- args_RGB[i] = TEXBLENDARG_FACTOR_N;
- need_constant_color = GL_TRUE;
- break;
- case GL_PRIMARY_COLOR:
- args_RGB[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_RGB[i] = TEXBLENDARG_CURRENT;
- break;
- case GL_ONE:
- args_RGB[i] = TEXBLENDARG_ONE;
- break;
- case GL_ZERO:
- args_RGB[i] = TEXBLENDARG_ONE | TEXBLENDARG_INV_ARG;
- break;
- default:
- return;
- }
-
- /* Xor is used so that GL_ONE_MINUS_SRC_COLOR with GL_ZERO
- * works correctly.
- */
- args_RGB[i] ^= op_rgb[op];
- }
-
- /* Handle A args */
- for( i = 0 ; i < numAlphaArgs ; i++ ) {
- const int op = texUnit->_CurrentCombine->OperandA[i] - GL_SRC_ALPHA;
-
- assert( (op >= 0) && (op <= 1) );
- switch(texUnit->_CurrentCombine->SourceA[i]) {
- case GL_TEXTURE:
- args_A[i] = TEXBLENDARG_TEXEL0 + unit;
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- args_A[i] = TEXBLENDARG_TEXEL0
- + (texUnit->_CurrentCombine->SourceA[i] & 0x03);
- break;
- case GL_CONSTANT:
- args_A[i] = TEXBLENDARG_FACTOR_N;
- need_constant_color = GL_TRUE;
- break;
- case GL_PRIMARY_COLOR:
- args_A[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_A[i] = TEXBLENDARG_CURRENT;
- break;
- case GL_ONE:
- args_A[i] = TEXBLENDARG_ONE;
- break;
- case GL_ZERO:
- args_A[i] = TEXBLENDARG_ONE | TEXBLENDARG_INV_ARG;
- break;
- default:
- return;
- }
-
- /* We cheat. :) The register values for this are the same as for
- * RGB. Xor is used so that GL_ONE_MINUS_SRC_ALPHA with GL_ZERO
- * works correctly.
- */
- args_A[i] ^= op_rgb[op];
- }
-
- /* Native Arg1 == Arg0 in GL_EXT_texture_env_combine spec */
- /* Native Arg2 == Arg1 in GL_EXT_texture_env_combine spec */
- /* Native Arg0 == Arg2 in GL_EXT_texture_env_combine spec */
-
- /* Build color pipeline */
-
- used = 0;
- imesa->TexBlend[unit][used++] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_MODIFY_PARMS |
- blendop);
-
- imesa->TexBlend[unit][used++] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_MODIFY_PARMS |
- ablendop);
-
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- imesa->TexBlend[unit][used++] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- tex_blend_rgb[i] |
- args_RGB[i]);
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- imesa->TexBlend[unit][used++] = (STATE3D_MAP_BLEND_ARG_CMD(unit) |
- tex_blend_a[i] |
- args_A[i]);
- }
-
-
- if ( need_constant_color ) {
- GLubyte r, g, b, a;
- const GLfloat * const fc = texUnit->EnvColor;
-
- FLOAT_COLOR_TO_UBYTE_COLOR(r, fc[RCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(g, fc[GCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(b, fc[BCOMP]);
- FLOAT_COLOR_TO_UBYTE_COLOR(a, fc[ACOMP]);
-
- imesa->TexBlend[unit][used++] = STATE3D_COLOR_FACTOR_CMD(unit);
- imesa->TexBlend[unit][used++] = ((a << 24) | (r << 16) | (g << 8) | b);
- }
-
- imesa->TexBlendWordsUsed[unit] = used;
- }
-
- I830_STATECHANGE( imesa, I830_UPLOAD_TEXBLEND_N(unit) );
-}
-
-
-/* This is bogus -- can't load the same texture object on two units.
- */
-static void i830TexSetUnit( i830TextureObjectPtr t, GLuint unit )
-{
- if(I830_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s unit(%d)\n", __FUNCTION__, unit);
-
- t->Setup[I830_TEXREG_TM0LI] = (STATE3D_LOAD_STATE_IMMEDIATE_2 |
- (LOAD_TEXTURE_MAP0 << unit) | 4);
-
- I830_SET_FIELD(t->Setup[I830_TEXREG_MCS], MAP_UNIT_MASK, MAP_UNIT(unit));
-
- t->current_unit = unit;
- t->base.bound |= (1U << unit);
-}
-
-#define TEXCOORDTYPE_MASK (~((1<<13)|(1<<12)|(1<<11)))
-
-
-static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) {
- return GL_FALSE;
- }
-
- /* Upload teximages (not pipelined)
- */
- if (t->base.dirty_images[0]) {
- i830SetTexImages( imesa, tObj );
- if (!t->base.memBlock) {
- return GL_FALSE;
- }
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (imesa->CurrentTexObj[unit] != t) {
-
- if ( imesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- imesa->CurrentTexObj[unit]->base.bound &= ~(1U << unit);
- }
-
- I830_STATECHANGE( imesa, I830_UPLOAD_TEX_N(unit) );
- imesa->CurrentTexObj[unit] = t;
- i830TexSetUnit(t, unit);
- }
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- *
- * KW: doesn't work -- change from tex0 only to tex0+tex1 gets
- * missed (need to update last stage flag?). Call
- * i830UpdateTexEnv always.
- */
- if (tObj->Image[0][tObj->BaseLevel]->Format !=
- imesa->TexEnvImageFmt[unit]) {
- imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format;
- }
- i830UpdateTexEnv( ctx, unit );
- imesa->TexEnabledMask |= I830_TEX_UNIT_ENABLED(unit);
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint mcs = t->Setup[I830_TEXREG_MCS];
-
- mcs &= ~TEXCOORDS_ARE_NORMAL;
- mcs |= TEXCOORDS_ARE_IN_TEXELUNITS;
-
- if (mcs != t->Setup[I830_TEXREG_MCS]) {
- I830_STATECHANGE( imesa, I830_UPLOAD_TEX_N(unit) );
- t->Setup[I830_TEXREG_MCS] = mcs;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint mcs = t->Setup[I830_TEXREG_MCS];
-
- mcs &= ~TEXCOORDS_ARE_IN_TEXELUNITS;
- mcs |= TEXCOORDS_ARE_NORMAL;
-
- if (mcs != t->Setup[I830_TEXREG_MCS]) {
- I830_STATECHANGE( imesa, I830_UPLOAD_TEX_N(unit) );
- t->Setup[I830_TEXREG_MCS] = mcs;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean disable_tex( GLcontext *ctx, int unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- /* This is happening too often. I need to conditionally send diffuse
- * state to the card. Perhaps a diffuse dirty flag of some kind.
- * Will need to change this logic if more than 2 texture units are
- * used. We need to only do this up to the last unit enabled, or unit
- * one if nothing is enabled.
- */
-
- if ( imesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- imesa->CurrentTexObj[unit]->base.bound &= ~(1U << unit);
- imesa->CurrentTexObj[unit] = NULL;
- }
-
- imesa->TexEnvImageFmt[unit] = 0;
- imesa->dirty &= ~(I830_UPLOAD_TEX_N(unit));
-
- i830UpdateTexEnv( ctx, unit );
-
- return GL_TRUE;
-}
-
-static GLboolean i830UpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- imesa->TexEnabledMask &= ~(I830_TEX_UNIT_ENABLED(unit));
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT) {
- return (enable_tex_common( ctx, unit ) &&
- enable_tex_2d( ctx, unit ));
- }
- else if (texUnit->_ReallyEnabled == TEXTURE_RECT_BIT) {
- return (enable_tex_common( ctx, unit ) &&
- enable_tex_rect( ctx, unit ));
- }
- else if (texUnit->_ReallyEnabled) {
- return GL_FALSE;
- }
- else {
- return disable_tex( ctx, unit );
- }
-}
-
-
-
-void i830UpdateTextureState( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- int i;
- int last_stage = 0;
- GLboolean ok;
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- if ( (ctx->Texture.Unit[i]._ReallyEnabled == TEXTURE_2D_BIT)
- || (ctx->Texture.Unit[i]._ReallyEnabled == TEXTURE_RECT_BIT) ) {
- last_stage = i;
- }
- }
-
- ok = GL_TRUE;
- for ( i = 0 ; i <= last_stage ; i++ ) {
- ok = ok && i830UpdateTexUnit( ctx, i );
- }
-
- FALLBACK( imesa, I830_FALLBACK_TEXTURE, !ok );
-
-
- /* Make sure last stage is set correctly */
- imesa->TexBlend[last_stage][0] |= TEXOP_LAST_STAGE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.c
deleted file mode 100644
index e0907202d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.c
+++ /dev/null
@@ -1,1056 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_tris.c,v 1.4 2002/12/10 01:26:54 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2001 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, 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
-ATI, 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.
-
-**************************************************************************/
-
-/*
- * Original Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Adapted for use on the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "i830_screen.h"
-#include "i830_dri.h"
-
-#include "i830_tris.h"
-#include "i830_state.h"
-#include "i830_ioctl.h"
-#include "i830_span.h"
-
-static void i830RenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v) ); \
-} while (0)
-#else
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- for ( j = 0 ; j < vertsize ; j++ ) \
- vb[j] = ((GLuint *)v)[j]; \
- vb += vertsize; \
-} while (0)
-#endif
-
-static void __inline__ i830_draw_triangle( i830ContextPtr imesa,
- i830VertexPtr v0,
- i830VertexPtr v1,
- i830VertexPtr v2 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 3 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
-}
-
-
-static void __inline__ i830_draw_quad( i830ContextPtr imesa,
- i830VertexPtr v0,
- i830VertexPtr v1,
- i830VertexPtr v2,
- i830VertexPtr v3 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 6 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v3 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
- COPY_DWORDS( j, vb, vertsize, v3 );
-}
-
-
-static __inline__ void i830_draw_point( i830ContextPtr imesa,
- i830VertexPtr tmp )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 4 * vertsize );
- int j;
-
- /* Adjust for sub pixel position */
- *(float *)&vb[0] = tmp->v.x - 0.125;
- *(float *)&vb[1] = tmp->v.y - 0.125;
- for (j = 2 ; j < vertsize ; j++)
- vb[j] = tmp->ui[j];
-}
-
-
-static __inline__ void i830_draw_line( i830ContextPtr imesa,
- i830VertexPtr v0,
- i830VertexPtr v1 )
-{
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, 2 * 4 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
-}
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_tri( imesa, a, b, c ); \
- else \
- i830_draw_triangle( imesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- imesa->draw_tri( imesa, a, b, d ); \
- imesa->draw_tri( imesa, b, c, d ); \
- } else \
- i830_draw_quad( imesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_line( imesa, v0, v1 ); \
- else \
- i830_draw_line( imesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_point( imesa, v0 ); \
- else \
- i830_draw_point( imesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define I830_OFFSET_BIT 0x01
-#define I830_TWOSIDE_BIT 0x02
-#define I830_UNFILLED_BIT 0x04
-#define I830_FALLBACK_BIT 0x08
-#define I830_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[I830_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & I830_FALLBACK_BIT)
-#define DO_OFFSET (IND & I830_OFFSET_BIT)
-#define DO_UNFILLED (IND & I830_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & I830_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX i830Vertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE (imesa->depth_scale)
-#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) (imesa->verts + (e * imesa->vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- i830_color_t *color = (i830_color_t *)&((v)->ui[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-
-#define VERT_SET_SPEC( v0, c ) \
-do { \
- if (havespec) { \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- if (havespec) { \
- v0->v.specular.red = v1->v.specular.red; \
- v0->v.specular.green = v1->v.specular.green; \
- v0->v.specular.blue = v1->v.specular.blue; \
- } \
-} while (0)
-
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (imesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (imesa->vertex_size > 4); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PRIM3D_POINTLIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST
-};
-
-#define RASTERIZE(x) if (imesa->hw_primitive != hw_prim[x]) \
- i830RasterPrimitive( ctx, x, hw_prim[x] )
-#define RENDER_PRIMITIVE imesa->render_primitive
-#define TAG(x) x
-#define IND I830_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 (I830_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_OFFSET_BIT|I830_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT|I830_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_OFFSET_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_UNFILLED_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_OFFSET_BIT|I830_UNFILLED_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_UNFILLED_BIT|I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (I830_TWOSIDE_BIT|I830_OFFSET_BIT|I830_UNFILLED_BIT| \
- I830_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-/***********************************************************************
- * 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
-i830_fallback_tri( i830ContextPtr imesa,
- i830Vertex *v0,
- i830Vertex *v1,
- i830Vertex *v2 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[3];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swsetup_Translate( ctx, v2, &v[2] );
- i830SpanRenderStart( ctx );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
- i830SpanRenderFinish( ctx );
-}
-
-
-static void
-i830_fallback_line( i830ContextPtr imesa,
- i830Vertex *v0,
- i830Vertex *v1 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[2];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- i830SpanRenderStart( ctx );
- _swrast_Line( ctx, &v[0], &v[1] );
- i830SpanRenderFinish( ctx );
-}
-
-
-static void
-i830_fallback_point( i830ContextPtr imesa,
- i830Vertex *v0 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[1];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- i830SpanRenderStart( ctx );
- _swrast_Point( ctx, &v[0] );
- i830SpanRenderFinish( ctx );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define IND 0
-#define V(x) (i830Vertex *)(vertptr + ((x) * vertsize * sizeof(int)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) POINT( V(ELT(start)) );
-#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
-#define RENDER_TRI( v0, v1, v2 ) TRI( V(v0), V(v1), V(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) QUAD( V(v0), V(v1), V(v2), V(v3) )
-#define INIT(x) i830RenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- i830ContextPtr imesa = I830_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)imesa->verts; \
- const GLuint vertsize = imesa->vertex_size; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) i830_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) i830_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void i830RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = imesa->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 i830RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void i830FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- i830ContextPtr imesa = I830_CONTEXT( ctx );
- GLuint vertsize = imesa->vertex_size;
- GLuint *vb = i830AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
- GLubyte *vertptr = (GLubyte *)imesa->verts;
- const GLuint *start = (const GLuint *)V(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, V(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, V(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-#define _I830_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-#define POINT_FALLBACK (0)
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
-#define TRI_FALLBACK (0)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|\
- DD_TRI_STIPPLE)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-static void i830ChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (I830_DEBUG & DEBUG_STATE)
- fprintf(stderr,"\n%s\n",__FUNCTION__);
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= I830_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= I830_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= I830_UNFILLED_BIT;
- }
-
- imesa->draw_point = i830_draw_point;
- imesa->draw_line = i830_draw_line;
- imesa->draw_tri = i830_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & POINT_FALLBACK)
- imesa->draw_point = i830_fallback_point;
-
- if (flags & LINE_FALLBACK)
- imesa->draw_line = i830_fallback_line;
-
- if (flags & TRI_FALLBACK)
- imesa->draw_tri = i830_fallback_tri;
-
- if ((flags & DD_TRI_STIPPLE) && !imesa->hw_stipple) {
- imesa->draw_tri = i830_fallback_tri;
- }
-
- index |= I830_FALLBACK_BIT;
- }
- }
-
- if (imesa->RenderIndex != index) {
- imesa->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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = i830_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = i830_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = i830FastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = i830RenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = i830RenderClippedPoly;
- }
- }
-}
-
-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
-};
-
-
-/**********************************************************************/
-/* 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 i810render.c.
- */
-static void i830RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- imesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (imesa->reduced_primitive != rprim ||
- hw_prim[prim] != imesa->hw_primitive) {
- i830RasterPrimitive( ctx, rprim, hw_prim[prim] );
- }
-}
-
-static void i830RunPipeline( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
-
- if (imesa->NewGLState) {
- if (imesa->NewGLState & _NEW_TEXTURE) {
- I830_FIREVERTICES( imesa );
- i830UpdateTextureState( ctx ); /* may modify imesa->NewGLState */
- }
-
- if (!imesa->Fallback) {
- if (imesa->NewGLState & _I830_NEW_RENDERSTATE)
- i830ChooseRenderState( ctx );
- }
-
- imesa->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-
-#define TEXCOORDTYPE_MASK (3<<11)
-
-
-
-static void set_projective_texturing( i830ContextPtr imesa,
- GLuint i,
- GLuint mcs)
-{
- mcs |= (imesa->CurrentTexObj[i]->Setup[I830_TEXREG_MCS] &
- ~TEXCOORDTYPE_MASK);
-
- if (mcs != imesa->CurrentTexObj[i]->Setup[I830_TEXREG_MCS]) {
- I830_STATECHANGE(imesa, I830_UPLOAD_TEX_N(i));
- imesa->CurrentTexObj[i]->Setup[I830_TEXREG_MCS] = mcs;
- }
-}
-
-
-#define SZ_TO_HW(sz) ((sz-2)&0x3)
-#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1)
-#define EMIT_ATTR( ATTR, STYLE, V0 ) \
-do { \
- imesa->vertex_attrs[imesa->vertex_attr_count].attrib = (ATTR); \
- imesa->vertex_attrs[imesa->vertex_attr_count].format = (STYLE); \
- imesa->vertex_attr_count++; \
- v0 |= V0; \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- imesa->vertex_attrs[imesa->vertex_attr_count].attrib = 0; \
- imesa->vertex_attrs[imesa->vertex_attr_count].format = EMIT_PAD; \
- imesa->vertex_attrs[imesa->vertex_attr_count].offset = (N); \
- imesa->vertex_attr_count++; \
-} while (0)
-
-#define VRTX_TEX_SET_FMT(n, x) ((x)<<((n)*2))
-
-/* Make sure hardware vertex format is appropriate for VB state.
- */
-static void i830RenderStart( GLcontext *ctx )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLuint v0 = STATE3D_VERTEX_FORMAT_CMD;
- GLuint v2 = STATE3D_VERTEX_FORMAT_2_CMD;
- GLuint force_emit = 0;
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- imesa->vertex_attr_count = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if (index & _TNL_BITS_TEX_ANY) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VRTX_HAS_XYZW );
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, VRTX_HAS_XYZ );
- }
-
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VRTX_HAS_DIFFUSE );
-
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
-
- if (index & _TNL_BIT_COLOR1)
- {
- if (imesa->vertex_attrs[imesa->vertex_attr_count].format != EMIT_3UB_3F_BGR)
- force_emit=1;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VRTX_HAS_SPEC );
- }
- else
- {
- if (imesa->vertex_attrs[imesa->vertex_attr_count].format != EMIT_PAD)
- force_emit=1;
- EMIT_PAD( 3 );
- }
- if (index & _TNL_BIT_FOG)
- {
- if (imesa->vertex_attrs[imesa->vertex_attr_count].format != EMIT_1UB_1F)
- force_emit=1;
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VRTX_HAS_SPEC );
- }
- else
- {
- if (imesa->vertex_attrs[imesa->vertex_attr_count].format != EMIT_PAD)
- force_emit=1;
- EMIT_PAD( 1 );
- }
- }
-
- if (index & _TNL_BITS_TEX_ANY) {
- int i, last_stage = 0;
-
- for (i = 0; i < ctx->Const.MaxTextureUnits ; i++)
- if (index & _TNL_BIT_TEX(i))
- last_stage = i+1;
-
-
- for (i = 0; i < last_stage; i++) {
- GLuint sz = VB->TexCoordPtr[i]->size;
- GLuint emit;
- GLuint mcs;
-
- /* i830 doesn't like 1D or 4D texcoords:
- */
- switch (sz) {
- case 1:
- case 2:
- case 3: /* no attempt at cube texturing so far */
- emit = EMIT_2F;
- sz = 2;
- mcs = TEXCOORDTYPE_CARTESIAN;
- break;
- case 4:
- emit = EMIT_3F_XYW;
- sz = 3;
- mcs = TEXCOORDTYPE_HOMOGENEOUS;
- break;
- default:
- continue;
- };
-
- v2 |= VRTX_TEX_SET_FMT(i, SZ_TO_HW(sz));
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_SZ(sz), 0 );
-
- if (imesa->CurrentTexObj[i])
- set_projective_texturing( imesa, i, mcs );
- }
-
- v0 |= VRTX_TEX_COORD_COUNT(last_stage);
- }
-
- /* Only need to change the vertex emit code if there has been a
- * statechange to a new hardware vertex format:
- */
- if (v0 != imesa->Setup[I830_CTXREG_VF] ||
- v2 != imesa->Setup[I830_CTXREG_VF2] ||
- force_emit == 1) {
-
- I830_STATECHANGE( imesa, I830_UPLOAD_CTX );
-
- /* Must do this *after* statechange, so as not to affect
- * buffered vertices reliant on the old state:
- */
- imesa->vertex_size =
- _tnl_install_attrs( ctx,
- imesa->vertex_attrs,
- imesa->vertex_attr_count,
- imesa->ViewportMatrix.m, 0 );
-
- imesa->vertex_size >>= 2;
-
- imesa->Setup[I830_CTXREG_VF] = v0;
- imesa->Setup[I830_CTXREG_VF2] = v2;
- }
-}
-
-
-static void i830RenderFinish( GLcontext *ctx )
-{
- if (I830_CONTEXT(ctx)->RenderIndex & I830_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-
-/* System to flush dma and emit state changes based on the rasterized
- * primitive.
- */
-void i830RasterPrimitive( GLcontext *ctx,
- GLenum rprim,
- GLuint hwprim )
-{
- i830ContextPtr imesa = I830_CONTEXT(ctx);
- GLuint aa = imesa->Setup[I830_CTXREG_AA];
- GLuint st1 = imesa->StippleSetup[I830_STPREG_ST1];
-
- aa &= ~AA_LINE_ENABLE;
-
- if (I830_DEBUG & DEBUG_PRIMS) {
- /* Prints reduced prim, and hw prim */
- char *prim_name = "Unknown";
-
- switch(hwprim) {
- case PRIM3D_POINTLIST:
- prim_name = "PointList";
- break;
- case PRIM3D_LINELIST:
- prim_name = "LineList";
- break;
- case PRIM3D_LINESTRIP:
- prim_name = "LineStrip";
- break;
- case PRIM3D_TRILIST:
- prim_name = "TriList";
- break;
- case PRIM3D_TRISTRIP:
- prim_name = "TriStrip";
- break;
- case PRIM3D_TRIFAN:
- prim_name = "TriFan";
- break;
- case PRIM3D_POLY:
- prim_name = "Polygons";
- break;
- default:
- break;
- }
-
- fprintf(stderr, "%s : rprim(%s), hwprim(%s)\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(rprim),
- prim_name);
- }
-
- switch (rprim) {
- case GL_TRIANGLES:
- aa |= AA_LINE_DISABLE;
- if (ctx->Polygon.StippleFlag)
- st1 |= ST1_ENABLE;
- else
- st1 &= ~ST1_ENABLE;
- break;
- case GL_LINES:
- st1 &= ~ST1_ENABLE;
- if (ctx->Line.SmoothFlag) {
- aa |= AA_LINE_ENABLE;
- } else {
- aa |= AA_LINE_DISABLE;
- }
- break;
- case GL_POINTS:
- st1 &= ~ST1_ENABLE;
- aa |= AA_LINE_DISABLE;
- break;
- default:
- return;
- }
-
- imesa->reduced_primitive = rprim;
-
- if (aa != imesa->Setup[I830_CTXREG_AA]) {
- I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
- imesa->Setup[I830_CTXREG_AA] = aa;
- }
-
-#if 0
- if (st1 != imesa->StippleSetup[I830_STPREG_ST1]) {
- I830_STATECHANGE(imesa, I830_UPLOAD_STIPPLE);
- imesa->StippleSetup[I830_STPREG_ST1] = st1;
- }
-#endif
-
- if (hwprim != imesa->hw_primitive) {
- I830_STATECHANGE(imesa, 0);
- imesa->hw_primitive = hwprim;
- }
-}
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static char *fallbackStrings[] = {
- "Texture",
- "Draw buffer",
- "Read buffer",
- "Color mask",
- "Render mode",
- "Stencil",
- "Stipple",
- "User disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-
-void i830Fallback( i830ContextPtr imesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = imesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = imesa->Fallback;
-
- if (mode) {
- imesa->Fallback |= bit;
- if (oldfallback == 0) {
- I830_FIREVERTICES(imesa);
- if (I830_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "ENTER FALLBACK %s\n", getFallbackString( bit ));
- _swsetup_Wakeup( ctx );
- imesa->RenderIndex = ~0;
- }
- }
- else {
- imesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- if (I830_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "LEAVE FALLBACK %s\n", getFallbackString( bit ));
- tnl->Driver.Render.Start = i830RenderStart;
- tnl->Driver.Render.PrimitiveNotify = i830RenderPrimitive;
- tnl->Driver.Render.Finish = i830RenderFinish;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_invalidate_vertex_state( ctx, ~0 );
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_install_attrs( ctx,
- imesa->vertex_attrs,
- imesa->vertex_attr_count,
- imesa->ViewportMatrix.m, 0 );
-
- imesa->NewGLState |= _I830_NEW_RENDERSTATE;
- }
- }
-}
-
-
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-/**
- * \bug
- * How are the magic numbers 12 and 26 in the call to \c _tnl_init_vertices
- * derived?
- */
-void i830InitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = i830RunPipeline;
- tnl->Driver.Render.Start = i830RenderStart;
- tnl->Driver.Render.Finish = i830RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = i830RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- 26 * sizeof(GLfloat) );
-
- I830_CONTEXT(ctx)->verts = (char *)tnl->clipspace.vertex_buf;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.h
deleted file mode 100644
index ae4f0a5df..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/i830_tris.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- * Adapted for use in the I830M:
- * Jeff Hartmann <jhartmann@2d3d.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_tris.h,v 1.3 2002/09/09 19:18:48 dawes Exp $ */
-
-#ifndef I830TRIS_INC
-#define I830TRIS_INC
-
-#include "mtypes.h"
-
-extern void i830PrintRenderState( const char *msg, GLuint state );
-extern void i830InitTriFuncs( GLcontext *ctx );
-extern void i830RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_common.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_common.h
deleted file mode 100644
index 3367bfc16..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_common.h
+++ /dev/null
@@ -1,288 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-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
-on 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.2 2002/12/10 01:27:05 dawes Exp $ */
-
-/* Author: Jeff Hartmann <jhartmann@valinux.com>
-
- Converted to common header format:
- Jens Owen <jens@tungstengraphics.com>
- */
-
-#ifndef _I830_COMMON_H_
-#define _I830_COMMON_H_
-
-/* WARNING: These defines must be the same as what the Xserver uses.
- * if you change them, you must change the defines in the Xserver.
- */
-
-#ifndef _I830_DEFINES_
-#define _I830_DEFINES_
-
-#define I830_DMA_BUF_ORDER 12
-#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER)
-#define I830_DMA_BUF_NR 256
-#define I830_NR_SAREA_CLIPRECTS 8
-
-/* Each region is a minimum of 64k, and there are at most 64 of them.
- */
-#define I830_NR_TEX_REGIONS 64
-#define I830_LOG_MIN_TEX_REGION_SIZE 16
-
-/* if defining I830_ENABLE_4_TEXTURES, do it in i830_3d_reg.h, too */
-#if !defined(I830_ENABLE_4_TEXTURES)
-#define I830_TEXTURE_COUNT 2
-#define I830_TEXBLEND_COUNT 2 /* always same as TEXTURE_COUNT? */
-#else /* defined(I830_ENABLE_4_TEXTURES) */
-#define I830_TEXTURE_COUNT 4
-#define I830_TEXBLEND_COUNT 4 /* always same as TEXTURE_COUNT? */
-#endif /* I830_ENABLE_4_TEXTURES */
-
-#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */
-
-#define I830_UPLOAD_CTX 0x1
-#define I830_UPLOAD_BUFFERS 0x2
-#define I830_UPLOAD_CLIPRECTS 0x4
-#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */
-#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */
-#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */
-#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */
-#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */
-#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */
-#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */
-#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */
-#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2))
-#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2))
-#define I830_UPLOAD_TEXIMAGE_MASK 0xff00
-#define I830_UPLOAD_TEX0 0x10000
-#define I830_UPLOAD_TEX1 0x20000
-#define I830_UPLOAD_TEX2 0x40000
-#define I830_UPLOAD_TEX3 0x80000
-#define I830_UPLOAD_TEX_N(n) (0x10000 << (n))
-#define I830_UPLOAD_TEX_MASK 0xf0000
-#define I830_UPLOAD_TEXBLEND0 0x100000
-#define I830_UPLOAD_TEXBLEND1 0x200000
-#define I830_UPLOAD_TEXBLEND2 0x400000
-#define I830_UPLOAD_TEXBLEND3 0x800000
-#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n))
-#define I830_UPLOAD_TEXBLEND_MASK 0xf00000
-#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n))
-#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000
-#define I830_UPLOAD_STIPPLE 0x8000000
-
-/* Indices into buf.Setup where various bits of state are mirrored per
- * context and per buffer. These can be fired at the card as a unit,
- * or in a piecewise fashion as required.
- */
-
-/* Destbuffer state
- * - backbuffer linear offset and pitch -- invarient in the current dri
- * - zbuffer linear offset and pitch -- also invarient
- * - drawing origin in back and depth buffers.
- *
- * Keep the depth/back buffer state here to acommodate private buffers
- * in the future.
- */
-
-#define I830_DESTREG_CBUFADDR 0
-/* Invarient */
-#define I830_DESTREG_DBUFADDR 1
-#define I830_DESTREG_DV0 2
-#define I830_DESTREG_DV1 3
-#define I830_DESTREG_SENABLE 4
-#define I830_DESTREG_SR0 5
-#define I830_DESTREG_SR1 6
-#define I830_DESTREG_SR2 7
-#define I830_DESTREG_DR0 8
-#define I830_DESTREG_DR1 9
-#define I830_DESTREG_DR2 10
-#define I830_DESTREG_DR3 11
-#define I830_DESTREG_DR4 12
-#define I830_DEST_SETUP_SIZE 13
-
-/* Context state
- */
-#define I830_CTXREG_STATE1 0
-#define I830_CTXREG_STATE2 1
-#define I830_CTXREG_STATE3 2
-#define I830_CTXREG_STATE4 3
-#define I830_CTXREG_STATE5 4
-#define I830_CTXREG_IALPHAB 5
-#define I830_CTXREG_STENCILTST 6
-#define I830_CTXREG_ENABLES_1 7
-#define I830_CTXREG_ENABLES_2 8
-#define I830_CTXREG_AA 9
-#define I830_CTXREG_FOGCOLOR 10
-#define I830_CTXREG_BLENDCOLR0 11
-#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */
-#define I830_CTXREG_VF 13
-#define I830_CTXREG_VF2 14
-#define I830_CTXREG_MCSB0 15
-#define I830_CTXREG_MCSB1 16
-#define I830_CTX_SETUP_SIZE 17
-
-/* 1.3: Stipple state
- */
-#define I830_STPREG_ST0 0
-#define I830_STPREG_ST1 1
-#define I830_STP_SETUP_SIZE 2
-
-/* Texture state (per tex unit)
- */
-#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */
-#define I830_TEXREG_MI1 1
-#define I830_TEXREG_MI2 2
-#define I830_TEXREG_MI3 3
-#define I830_TEXREG_MI4 4
-#define I830_TEXREG_MI5 5
-#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */
-#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */
-#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */
-#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */
-#define I830_TEX_SETUP_SIZE 10
-
-/* New version. Kernel auto-detects.
- */
-#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */
-#define I830_TEXREG_TM0S0 1
-#define I830_TEXREG_TM0S1 2
-#define I830_TEXREG_TM0S2 3
-#define I830_TEXREG_TM0S3 4
-#define I830_TEXREG_TM0S4 5
-#define I830_TEXREG_NOP0 6 /* noop */
-#define I830_TEXREG_NOP1 7 /* noop */
-#define I830_TEXREG_NOP2 8 /* noop */
-#define __I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS -- shared */
-#define __I830_TEX_SETUP_SIZE 10
-
-
-#define I830_FRONT 0x1
-#define I830_BACK 0x2
-#define I830_DEPTH 0x4
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_I830_INIT 0x00
-#define DRM_I830_VERTEX 0x01
-#define DRM_I830_CLEAR 0x02
-#define DRM_I830_FLUSH 0x03
-#define DRM_I830_GETAGE 0x04
-#define DRM_I830_GETBUF 0x05
-#define DRM_I830_SWAP 0x06
-#define DRM_I830_COPY 0x07
-#define DRM_I830_DOCOPY 0x08
-#define DRM_I830_FLIP 0x09
-#define DRM_I830_IRQ_EMIT 0x0a
-#define DRM_I830_IRQ_WAIT 0x0b
-#define DRM_I830_GETPARAM 0x0c
-#define DRM_I830_SETPARAM 0x0d
-
-#endif /* _I830_DEFINES_ */
-
-typedef struct {
- enum {
- I830_INIT_DMA = 0x01,
- I830_CLEANUP_DMA = 0x02
- } func;
- unsigned int mmio_offset;
- unsigned int buffers_offset;
- int sarea_priv_offset;
- unsigned int ring_start;
- unsigned int ring_end;
- unsigned int ring_size;
- unsigned int front_offset;
- unsigned int back_offset;
- unsigned int depth_offset;
- unsigned int w;
- unsigned int h;
- unsigned int pitch;
- unsigned int pitch_bits;
- unsigned int back_pitch;
- unsigned int depth_pitch;
- unsigned int cpp;
-} drmI830Init;
-
-typedef struct {
- int clear_color;
- int clear_depth;
- int flags;
- unsigned int clear_colormask;
- unsigned int clear_depthmask;
-} drmI830Clear;
-
-/* These may be placeholders if we have more cliprects than
- * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to
- * false, indicating that the buffer will be dispatched again with a
- * new set of cliprects.
- */
-typedef struct {
- int idx; /* buffer index */
- int used; /* nr bytes in use */
- int discard; /* client is finished with the buffer? */
-} drmI830Vertex;
-
-typedef struct {
- int idx; /* buffer index */
- int used; /* nr bytes in use */
- void *address; /* Address to copy from */
-} drmI830Copy;
-
-typedef struct {
- void *virtual;
- int request_idx;
- int request_size;
- int granted;
-} drmI830DMA;
-
-typedef struct drm_i830_irq_emit {
- int *irq_seq;
-} drmI830IrqEmit;
-
-typedef struct drm_i830_irq_wait {
- int irq_seq;
-} drmI830IrqWait;
-
-typedef struct drm_i830_getparam {
- int param;
- int *value;
-} drmI830GetParam;
-
-#define I830_PARAM_IRQ_ACTIVE 1
-
-
-typedef struct drm_i830_setparam {
- int param;
- int value;
-} drmI830SetParam;
-
-#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
-
-
-
-#endif /* _I830_DRM_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_dri.h
deleted file mode 100644
index e4b36cc16..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i830/server/i830_dri.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.5 2002/12/10 01:27:05 dawes Exp $ */
-
-#ifndef _I830_DRI_H
-#define _I830_DRI_H
-
-#include "drm.h" /* HACK!!! why doesn't xf86drm.h work??? */
-/* #include "xf86drm.h" */
-#include "i830_common.h"
-
-#define I830_MAX_DRAWABLES 256
-
-#define I830_MAJOR_VERSION 1
-#define I830_MINOR_VERSION 3
-#define I830_PATCHLEVEL 0
-
-#define I830_REG_SIZE 0x80000
-
-typedef struct _I830DRIRec {
- drm_handle_t regs;
- drmSize regsSize;
-
- drmSize backbufferSize;
- drm_handle_t backbuffer;
-
- drmSize depthbufferSize;
- drm_handle_t depthbuffer;
-
- drm_handle_t textures;
- int textureSize;
-
- drm_handle_t agp_buffers;
- drmSize agp_buf_size;
-
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int bitsPerPixel;
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int depthOffset;
-
- int auxPitch;
- int auxPitchBits;
-
- int logTextureGranularity;
- int textureOffset;
-
- /* For non-dma direct rendering.
- */
- int ringOffset;
- int ringSize;
-
- drmBufMapPtr drmBufs;
- int irq;
- int sarea_priv_offset;
-} I830DRIRec, *I830DRIPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I830ConfigPrivRec, *I830ConfigPrivPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I830DRIContextRec, *I830DRIContextPtr;
-
-/* Warning: If you change the SAREA structure you must change the kernel
- * structure as well */
-
-typedef struct _I830SAREA {
- unsigned int ContextState[I830_CTX_SETUP_SIZE];
- unsigned int BufferState[I830_DEST_SETUP_SIZE];
- unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE];
- unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE];
- unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT];
- unsigned int Palette[2][256];
- unsigned int dirty;
-
- unsigned int nbox;
- drm_clip_rect_t boxes[I830_NR_SAREA_CLIPRECTS];
-
- /* 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.
- */
-
- drmTextureRegion texList[I830_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;
-
- int pf_enabled; /* is pageflipping allowed? */
- int pf_active; /* is pageflipping active right now? */
- int pf_current_page; /* which buffer is being displayed? */
-
- int perf_boxes; /* performance boxes to be displayed */
-
- /* Here's the state for texunits 2,3:
- */
- unsigned int TexState2[I830_TEX_SETUP_SIZE];
- unsigned int TexBlendState2[I830_TEXBLEND_SIZE];
- unsigned int TexBlendStateWordsUsed2;
-
- unsigned int TexState3[I830_TEX_SETUP_SIZE];
- unsigned int TexBlendState3[I830_TEXBLEND_SIZE];
- unsigned int TexBlendStateWordsUsed3;
-
- unsigned int StippleState[I830_STP_SETUP_SIZE];
-} I830SAREARec, *I830SAREAPtr;
-
-/* Flags for perf_boxes
- */
-#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
-#define I830_BOX_FLIP 0x2 /* populated by kernel */
-#define I830_BOX_WAIT 0x4 /* populated by kernel & client */
-#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
-#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/Makefile
deleted file mode 100644
index c269fb129..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = i915_dri.so
-
-DRIVER_SOURCES = \
- i915_context.c \
- i915_debug.c \
- i915_fragprog.c \
- i915_metaops.c \
- i915_program.c \
- i915_state.c \
- i915_tex.c \
- i915_texprog.c \
- i915_texstate.c \
- i915_vtbl.c \
- i830_context.c \
- i830_metaops.c \
- i830_state.c \
- i830_texblend.c \
- i830_tex.c \
- i830_texstate.c \
- i830_vtbl.c \
- intel_batchbuffer.c \
- intel_context.c \
- intel_ioctl.c \
- intel_pixel.c \
- intel_render.c \
- intel_screen.c \
- intel_span.c \
- intel_state.c \
- intel_tex.c \
- intel_tris.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(MINIGLX_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.c
deleted file mode 100644
index 6088db67e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "i830_context.h"
-#include "imports.h"
-#include "texmem.h"
-#include "intel_tex.h"
-#include "tnl/tnl.h"
-#include "tnl/t_vertex.h"
-#include "tnl/t_context.h"
-#include "utils.h"
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-static const struct dri_extension i830_extensions[] =
-{
- { "GL_ARB_texture_env_crossbar", NULL },
- { NULL, NULL }
-};
-
-
-static void i830InitDriverFunctions( struct dd_function_table *functions )
-{
- intelInitDriverFunctions( functions );
- i830InitStateFuncs( functions );
- i830InitTextureFuncs( functions );
-}
-
-
-GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- struct dd_function_table functions;
- i830ContextPtr i830 = (i830ContextPtr) CALLOC_STRUCT(i830_context);
- intelContextPtr intel = &i830->intel;
- GLcontext *ctx = &intel->ctx;
- if (!i830) return GL_FALSE;
-
- i830InitVtbl( i830 );
- i830InitDriverFunctions( &functions );
-
- if (!intelInitContext( intel, mesaVis, driContextPriv,
- sharedContextPrivate, &functions )) {
- FREE(i830);
- return GL_FALSE;
- }
-
- intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS;
- intel->ctx.Const.MaxTextureImageUnits = I830_TEX_UNITS;
- intel->ctx.Const.MaxTextureCoordUnits = I830_TEX_UNITS;
-
- intel->nr_heaps = 1;
- intel->texture_heaps[0] =
- driCreateTextureHeap( 0, intel,
- intel->intelScreen->textureSize,
- 12,
- I830_NR_TEX_REGIONS,
- intel->sarea->texList,
- & intel->sarea->texAge,
- & intel->swapped,
- sizeof( struct i830_texture_object ),
- (destroy_texture_object_t *)intelDestroyTexObj );
-
- /* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are tightly
- * FIXME: packed, but they're not in Intel graphics hardware.
- */
- intel->ctx.Const.MaxTextureUnits = 1;
- driCalculateMaxTextureLevels( intel->texture_heaps,
- intel->nr_heaps,
- &intel->ctx.Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 8, /* max 3D texture size is 256^3 */
- 10, /* max CUBE texture size is 1024x1024 */
- 11, /* max RECT. supported */
- 12,
- GL_FALSE );
- intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS;
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- 18 * sizeof(GLfloat) );
-
- intel->verts = TNL_CONTEXT(ctx)->clipspace.vertex_buf;
-
- driInitExtensions( ctx, i830_extensions, GL_FALSE );
-
- i830InitState( i830 );
-
-
- _tnl_allow_vertex_fog( ctx, 1 );
- _tnl_allow_pixel_fog( ctx, 0 );
-
- return GL_TRUE;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.h
deleted file mode 100644
index 62e20d0a0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_context.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef I830CONTEXT_INC
-#define I830CONTEXT_INC
-
-#include "intel_context.h"
-
-#define I830_FALLBACK_TEXTURE 0x1000
-#define I830_FALLBACK_COLORMASK 0x2000
-#define I830_FALLBACK_STENCIL 0x4000
-#define I830_FALLBACK_STIPPLE 0x8000
-#define I830_FALLBACK_LOGICOP 0x10000
-
-#define I830_UPLOAD_CTX 0x1
-#define I830_UPLOAD_BUFFERS 0x2
-#define I830_UPLOAD_STIPPLE 0x4
-#define I830_UPLOAD_TEX(i) (0x10<<(i))
-#define I830_UPLOAD_TEXBLEND(i) (0x100<<(i))
-#define I830_UPLOAD_TEX_ALL (0x0f0)
-#define I830_UPLOAD_TEXBLEND_ALL (0xf00)
-
-/* State structure offsets - these will probably disappear.
- */
-#define I830_DESTREG_CBUFADDR0 0
-#define I830_DESTREG_CBUFADDR1 1
-#define I830_DESTREG_CBUFADDR2 2
-#define I830_DESTREG_DBUFADDR0 3
-#define I830_DESTREG_DBUFADDR1 4
-#define I830_DESTREG_DBUFADDR2 5
-#define I830_DESTREG_DV0 6
-#define I830_DESTREG_DV1 7
-#define I830_DESTREG_SENABLE 8
-#define I830_DESTREG_SR0 9
-#define I830_DESTREG_SR1 10
-#define I830_DESTREG_SR2 11
-#define I830_DEST_SETUP_SIZE 12
-
-#define I830_CTXREG_STATE1 0
-#define I830_CTXREG_STATE2 1
-#define I830_CTXREG_STATE3 2
-#define I830_CTXREG_STATE4 3
-#define I830_CTXREG_STATE5 4
-#define I830_CTXREG_IALPHAB 5
-#define I830_CTXREG_STENCILTST 6
-#define I830_CTXREG_ENABLES_1 7
-#define I830_CTXREG_ENABLES_2 8
-#define I830_CTXREG_AA 9
-#define I830_CTXREG_FOGCOLOR 10
-#define I830_CTXREG_BLENDCOLOR0 11
-#define I830_CTXREG_BLENDCOLOR1 12
-#define I830_CTXREG_VF 13
-#define I830_CTXREG_VF2 14
-#define I830_CTXREG_MCSB0 15
-#define I830_CTXREG_MCSB1 16
-#define I830_CTX_SETUP_SIZE 17
-
-#define I830_STPREG_ST0 0
-#define I830_STPREG_ST1 1
-#define I830_STP_SETUP_SIZE 2
-
-#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */
-#define I830_TEXREG_TM0S0 1
-#define I830_TEXREG_TM0S1 2
-#define I830_TEXREG_TM0S2 3
-#define I830_TEXREG_TM0S3 4
-#define I830_TEXREG_TM0S4 5
-#define I830_TEXREG_MCS 6 /* _3DSTATE_MAP_COORD_SETS */
-#define I830_TEXREG_CUBE 7 /* _3DSTATE_MAP_SUBE */
-#define I830_TEX_SETUP_SIZE 8
-
-#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */
-
-struct i830_texture_object
-{
- struct intel_texture_object intel;
- GLuint Setup[I830_TEX_SETUP_SIZE];
-};
-
-#define I830_TEX_UNITS 4
-
-struct i830_hw_state {
- GLuint Ctx[I830_CTX_SETUP_SIZE];
- GLuint Buffer[I830_DEST_SETUP_SIZE];
- GLuint Stipple[I830_STP_SETUP_SIZE];
- GLuint Tex[I830_TEX_UNITS][I830_TEX_SETUP_SIZE];
- GLuint TexBlend[I830_TEX_UNITS][I830_TEXBLEND_SIZE];
- GLuint TexBlendWordsUsed[I830_TEX_UNITS];
- GLuint emitted; /* I810_UPLOAD_* */
- GLuint active;
-};
-
-struct i830_context
-{
- struct intel_context intel;
-
- GLuint last_index;
-
- struct i830_hw_state meta, initial, state, *current;
-};
-
-typedef struct i830_context *i830ContextPtr;
-typedef struct i830_texture_object *i830TextureObjectPtr;
-
-#define I830_CONTEXT(ctx) ((i830ContextPtr)(ctx))
-
-
-
-#define I830_STATECHANGE(i830, flag) \
-do { \
- INTEL_FIREVERTICES( &i830->intel ); \
- i830->state.emitted &= ~flag; \
-} while (0)
-
-#define I830_ACTIVESTATE(i830, flag, mode) \
-do { \
- INTEL_FIREVERTICES( &i830->intel ); \
- if (mode) \
- i830->state.active |= flag; \
- else \
- i830->state.active &= ~flag; \
-} while (0)
-
-/* i830_vtbl.c
- */
-extern void
-i830InitVtbl( i830ContextPtr i830 );
-
-/* i830_context.c
- */
-extern GLboolean
-i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-/* i830_tex.c, i830_texstate.c
- */
-extern void
-i830UpdateTextureState( intelContextPtr intel );
-
-extern void
-i830InitTextureFuncs( struct dd_function_table *functions );
-
-extern intelTextureObjectPtr
-i830AllocTexObj( struct gl_texture_object *tObj );
-
-/* i830_texblend.c
- */
-extern GLuint i830SetTexEnvCombine(i830ContextPtr i830,
- const struct gl_tex_env_combine_state * combine, GLint blendUnit,
- GLuint texel_op, GLuint *state, const GLfloat *factor );
-
-extern void
-i830EmitTextureBlend( i830ContextPtr i830 );
-
-
-/* i830_state.c
- */
-extern void
-i830InitStateFuncs( struct dd_function_table *functions );
-
-extern void
-i830EmitState( i830ContextPtr i830 );
-
-extern void
-i830InitState( i830ContextPtr i830 );
-
-/* i830_metaops.c
- */
-extern GLboolean
-i830TryTextureReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels );
-
-extern GLboolean
-i830TryTextureDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels );
-
-extern void
-i830ClearWithTris( intelContextPtr intel, GLbitfield mask,
- GLboolean all, GLint cx, GLint cy, GLint cw, GLint ch);
-
-
-
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_metaops.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_metaops.c
deleted file mode 100644
index dd238378b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_metaops.c
+++ /dev/null
@@ -1,733 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "utils.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-#include "intel_ioctl.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-/* A large amount of state doesn't need to be uploaded.
- */
-#define ACTIVE (I830_UPLOAD_TEXBLEND(0) | \
- I830_UPLOAD_STIPPLE | \
- I830_UPLOAD_CTX | \
- I830_UPLOAD_BUFFERS | \
- I830_UPLOAD_TEX(0))
-
-
-#define SET_STATE( i830, STATE ) \
-do { \
- i830->current->emitted &= ~ACTIVE; \
- i830->current = &i830->STATE; \
- i830->current->emitted &= ~ACTIVE; \
-} while (0)
-
-/* Operations where the 3D engine is decoupled temporarily from the
- * current GL state and used for other purposes than simply rendering
- * incoming triangles.
- */
-static void set_initial_state( i830ContextPtr i830 )
-{
- memcpy(&i830->meta, &i830->initial, sizeof(i830->meta) );
- i830->meta.active = ACTIVE;
- i830->meta.emitted = 0;
-}
-
-
-static void set_no_depth_stencil_write( i830ContextPtr i830 )
-{
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_FALSE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_STENCIL_WRITE;
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_STENCIL_WRITE;
-
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_FALSE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE;
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-/* Set stencil unit to replace always with the reference value.
- */
-static void set_stencil_replace( i830ContextPtr i830,
- GLuint s_mask,
- GLuint s_clear)
-{
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_TRUE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE;
-
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_FALSE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE;
-
- /* ctx->Driver.StencilMask( ctx, s_mask )
- */
- i830->meta.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- i830->meta.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK((s_mask&0xff)));
-
- /* ctx->Driver.StencilOp( ctx, GL_REPLACE, GL_REPLACE, GL_REPLACE )
- */
- i830->meta.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_OPS_MASK);
- i830->meta.Ctx[I830_CTXREG_STENCILTST] |=
- (ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_REPLACE));
-
- /* ctx->Driver.StencilFunc( ctx, GL_ALWAYS, s_clear, ~0 )
- */
- i830->meta.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i830->meta.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff));
-
- i830->meta.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
- i830->meta.Ctx[I830_CTXREG_STENCILTST] |=
- (ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_REF_VALUE((s_clear&0xff)) |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS));
-
-
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-
-static void set_color_mask( i830ContextPtr i830, GLboolean state )
-{
- const GLuint mask = ((1 << WRITEMASK_RED_SHIFT) |
- (1 << WRITEMASK_GREEN_SHIFT) |
- (1 << WRITEMASK_BLUE_SHIFT) |
- (1 << WRITEMASK_ALPHA_SHIFT));
-
- if (state) {
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~mask;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |=
- (i830->state.Ctx[I830_CTXREG_ENABLES_2] & mask);
- }
- else
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= mask;
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-/* Installs a one-stage passthrough texture blend pipeline. Is there
- * more that can be done to turn off texturing?
- */
-static void set_no_texture( i830ContextPtr i830 )
-{
- static const struct gl_tex_env_combine_state comb = {
- GL_NONE, GL_NONE,
- { GL_TEXTURE, 0, 0, }, { GL_TEXTURE, 0, 0, },
- { GL_SRC_COLOR, 0, 0 }, { GL_SRC_ALPHA, 0, 0 },
- 0, 0, 0, 0
- };
-
- i830->meta.TexBlendWordsUsed[0] =
- i830SetTexEnvCombine( i830, & comb, 0, TEXBLENDARG_TEXEL0,
- i830->meta.TexBlend[0], NULL);
-
- i830->meta.TexBlend[0][0] |= TEXOP_LAST_STAGE;
- i830->meta.emitted &= ~I830_UPLOAD_TEXBLEND(0);
-}
-
-/* Set up a single element blend stage for 'replace' texturing with no
- * funny ops.
- */
-static void enable_texture_blend_replace( i830ContextPtr i830,
- GLenum format )
-{
- static const struct gl_tex_env_combine_state comb = {
- GL_REPLACE, GL_REPLACE,
- { GL_TEXTURE, 0, 0, }, { GL_TEXTURE, 0, 0, },
- { GL_SRC_COLOR, 0, 0 }, { GL_SRC_ALPHA, 0, 0 },
- 0, 0, 1, 1
- };
-
- i830->meta.TexBlendWordsUsed[0] =
- i830SetTexEnvCombine( i830, & comb, 0, TEXBLENDARG_TEXEL0,
- i830->meta.TexBlend[0], NULL);
-
- i830->meta.TexBlend[0][0] |= TEXOP_LAST_STAGE;
- i830->meta.emitted &= ~I830_UPLOAD_TEXBLEND(0);
-
-/* fprintf(stderr, "%s: TexBlendWordsUsed[0]: %d\n", */
-/* __FUNCTION__, i830->meta.TexBlendWordsUsed[0]); */
-}
-
-
-
-/* Set up an arbitary piece of memory as a rectangular texture
- * (including the front or back buffer).
- */
-static void set_tex_rect_source( i830ContextPtr i830,
- GLuint offset,
- GLuint width,
- GLuint height,
- GLuint pitch,
- GLuint textureFormat )
-{
- GLint numLevels = 1;
- GLuint *setup = i830->meta.Tex[0];
-
- pitch *= i830->intel.intelScreen->cpp;
-
-/* fprintf(stderr, "%s: offset: %x w: %d h: %d pitch %d format %x\n", */
-/* __FUNCTION__, offset, width, height, pitch, textureFormat ); */
-
- setup[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
- (LOAD_TEXTURE_MAP0 << 0) | 4);
- setup[I830_TEXREG_TM0S0] = (TM0S0_USE_FENCE | offset);
- setup[I830_TEXREG_TM0S1] = (((height - 1) << TM0S1_HEIGHT_SHIFT) |
- ((width - 1) << TM0S1_WIDTH_SHIFT) |
- textureFormat);
- setup[I830_TEXREG_TM0S2] = ((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT));
- setup[I830_TEXREG_TM0S3] &= ~TM0S3_MAX_MIP_MASK;
- setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIN_MIP_MASK;
- setup[I830_TEXREG_TM0S3] |= ((numLevels - 1)*4) << TM0S3_MIN_MIP_SHIFT;
-
- setup[I830_TEXREG_MCS] = (_3DSTATE_MAP_COORD_SET_CMD |
- MAP_UNIT(0) |
- ENABLE_TEXCOORD_PARAMS |
- TEXCOORDS_ARE_IN_TEXELUNITS |
- TEXCOORDTYPE_CARTESIAN |
- ENABLE_ADDR_V_CNTL |
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP) |
- ENABLE_ADDR_U_CNTL |
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP));
-
- i830->meta.emitted &= ~I830_UPLOAD_TEX(0);
-}
-
-
-/* Select between front and back draw buffers.
- */
-static void set_draw_offset( i830ContextPtr i830,
- GLuint offset )
-{
- i830->meta.Buffer[I830_DESTREG_CBUFADDR2] = offset;
- i830->meta.emitted &= ~I830_UPLOAD_BUFFERS;
-}
-
-/* Setup an arbitary draw format, useful for targeting
- * texture or agp memory.
- */
-static void set_draw_format( i830ContextPtr i830,
- GLuint format,
- GLuint depth_format)
-{
- i830->meta.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- format |
- DEPTH_IS_Z |
- depth_format);
-}
-
-
-static void set_vertex_format( i830ContextPtr i830 )
-{
- i830->meta.Ctx[I830_CTXREG_VF] = (_3DSTATE_VFT0_CMD |
- VFT0_TEX_COUNT(1) |
- VFT0_DIFFUSE |
- VFT0_SPEC |
- VFT0_XYZW);
- i830->meta.Ctx[I830_CTXREG_VF2] = (_3DSTATE_VFT1_CMD |
- VFT1_TEX0_FMT(TEXCOORDFMT_2D) |
- VFT1_TEX1_FMT(TEXCOORDFMT_2D) |
- VFT1_TEX2_FMT(TEXCOORDFMT_2D) |
- VFT1_TEX3_FMT(TEXCOORDFMT_2D));
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-
-static void draw_quad(i830ContextPtr i830,
- GLfloat x0, GLfloat x1,
- GLfloat y0, GLfloat y1,
- GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha,
- GLfloat s0, GLfloat s1,
- GLfloat t0, GLfloat t1 )
-{
- GLuint vertex_size = 8;
- GLuint *vb = intelEmitInlinePrimitiveLocked( &i830->intel,
- PRIM3D_TRIFAN,
- 4*vertex_size,
- vertex_size );
- intelVertex tmp;
- int i;
-
-
-/* fprintf(stderr, "%s: %f,%f-%f,%f 0x%x%x%x%x %f,%f-%f,%f\n", */
-/* __FUNCTION__, */
-/* x0,y0,x1,y1,red,green,blue,alpha,s0,t0,s1,t1); */
-
-
- /* initial vertex, left bottom */
- tmp.v.x = x0;
- tmp.v.y = y0;
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
- tmp.v.u0 = s0;
- tmp.v.v0 = t0;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right bottom */
- vb += 8;
- tmp.v.x = x1;
- tmp.v.u0 = s1;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right top */
- vb += 8;
- tmp.v.y = y1;
- tmp.v.v0 = t1;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* left top */
- vb += 8;
- tmp.v.x = x0;
- tmp.v.u0 = s0;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
-/* fprintf(stderr, "%s: DV1: %x\n", */
-/* __FUNCTION__, i830->meta.Buffer[I830_DESTREG_DV1]); */
-}
-
-void
-i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- i830ContextPtr i830 = I830_CONTEXT( intel );
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- intelScreenPrivate *screen = intel->intelScreen;
- int x0, y0, x1, y1;
-
-
- SET_STATE( i830, meta );
- set_initial_state( i830 );
- set_no_texture( i830 );
- set_vertex_format( i830 );
-
- LOCK_HARDWARE(intel);
-
- if(!all) {
- x0 = cx;
- y0 = cy;
- x1 = x0 + cw;
- y1 = y0 + ch;
- } else {
- x0 = 0;
- y0 = 0;
- x1 = x0 + dPriv->w;
- y1 = y0 + dPriv->h;
- }
-
- /* Don't do any clipping to screen - these are window coordinates.
- * The active cliprects will be applied as for any other geometry.
- */
-
- if(mask & BUFFER_BIT_FRONT_LEFT) {
- set_no_depth_stencil_write( i830 );
- set_color_mask( i830, GL_TRUE );
- set_draw_offset( i830, screen->frontOffset );
- draw_quad(i830, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-
- if(mask & BUFFER_BIT_BACK_LEFT) {
- set_no_depth_stencil_write( i830 );
- set_color_mask( i830, GL_TRUE );
- set_draw_offset( i830, screen->backOffset );
-
- draw_quad(i830, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-
- if(mask & BUFFER_BIT_STENCIL) {
- set_stencil_replace( i830,
- intel->ctx.Stencil.WriteMask[0],
- intel->ctx.Stencil.Clear);
-
- set_color_mask( i830, GL_FALSE );
- set_draw_offset( i830, screen->frontOffset );
- draw_quad( i830, x0, x1, y0, y1, 0, 0, 0, 0, 0, 0, 0, 0 );
- }
-
- UNLOCK_HARDWARE(intel);
-
- SET_STATE( i830, state );
-}
-
-
-
-
-GLboolean
-i830TryTextureReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- intelScreenPrivate *screen = i830->intel.intelScreen;
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- __DRIdrawablePrivate *dPriv = i830->intel.driDrawable;
- int textureFormat;
- GLenum glTextureFormat;
- int src_offset = i830->meta.Buffer[I830_DESTREG_CBUFADDR2];
- int destOffset = intelAgpOffsetFromVirtual( &i830->intel, pixels);
- int destFormat, depthFormat, destPitch;
- drm_clip_rect_t tmp;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if ( ctx->_ImageTransferState ||
- pack->SwapBytes ||
- pack->LsbFirst ||
- !pack->Invert) {
- fprintf(stderr, "%s: check_color failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- switch (screen->fbFormat) {
- case DV_PF_565:
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
- glTextureFormat = GL_RGB;
- break;
- case DV_PF_555:
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
- glTextureFormat = GL_RGBA;
- break;
- case DV_PF_8888:
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- glTextureFormat = GL_RGBA;
- break;
- default:
- fprintf(stderr, "%s: textureFormat failed %x\n", __FUNCTION__,
- screen->fbFormat);
- return GL_FALSE;
- }
-
-
- switch (type) {
- case GL_UNSIGNED_SHORT_5_6_5:
- if (format != GL_RGB) return GL_FALSE;
- destFormat = COLR_BUF_RGB565;
- depthFormat = DEPTH_FRMT_16_FIXED;
- destPitch = pitch * 2;
- break;
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- if (format != GL_BGRA) return GL_FALSE;
- destFormat = COLR_BUF_ARGB8888;
- depthFormat = DEPTH_FRMT_24_FIXED_8_OTHER;
- destPitch = pitch * 4;
- break;
- default:
- fprintf(stderr, "%s: destFormat failed %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(type));
- return GL_FALSE;
- }
-
- destFormat |= (0x02<<24);
-
-/* fprintf(stderr, "type: %s destFormat: %x\n", */
-/* _mesa_lookup_enum_by_nr(type), */
-/* destFormat); */
-
- intelFlush( ctx );
-
- SET_STATE( i830, meta );
- set_initial_state( i830 );
- set_no_depth_stencil_write( i830 );
-
- LOCK_HARDWARE( intel );
- {
- intelWaitForIdle( intel ); /* required by GL */
-
- if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
- UNLOCK_HARDWARE( intel );
- SET_STATE(i830, state);
- fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
- return GL_TRUE;
- }
-
-#if 0
- /* FIXME -- Just emit the correct state
- */
- if (i830SetParam(i830->driFd, I830_SETPARAM_CBUFFER_PITCH,
- destPitch) != 0) {
- UNLOCK_HARDWARE( intel );
- SET_STATE(i830, state);
- fprintf(stderr, "%s: setparam failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-#endif
-
-
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
-
- /* Set the frontbuffer up as a large rectangular texture.
- */
- set_tex_rect_source( i830,
- src_offset,
- screen->width,
- screen->height,
- screen->frontPitch,
- textureFormat );
-
-
- enable_texture_blend_replace( i830, glTextureFormat );
-
-
- /* Set the 3d engine to draw into the agp memory
- */
-
- set_draw_offset( i830, destOffset );
- set_draw_format( i830, destFormat, depthFormat );
-
-
- /* Draw a single quad, no cliprects:
- */
- i830->intel.numClipRects = 1;
- i830->intel.pClipRects = &tmp;
- i830->intel.pClipRects[0].x1 = 0;
- i830->intel.pClipRects[0].y1 = 0;
- i830->intel.pClipRects[0].x2 = width;
- i830->intel.pClipRects[0].y2 = height;
-
- draw_quad( i830,
- 0, width, 0, height,
- 0, 255, 0, 0,
- x, x+width, y, y+height );
-
- intelWindowMoved( intel );
- }
- UNLOCK_HARDWARE( intel );
- intelFinish( ctx ); /* required by GL */
-
- SET_STATE( i830, state );
- return GL_TRUE;
-}
-
-
-GLboolean
-i830TryTextureDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int textureFormat;
- GLenum glTextureFormat;
- int dst_offset = i830->meta.Buffer[I830_DESTREG_CBUFADDR2];
- int src_offset = intelAgpOffsetFromVirtual( intel, pixels );
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Todo -- upload images that aren't in agp space, then texture
- * from them.
- */
-
- if ( !intelIsAgpMemory( intel, pixels, pitch*height ) ) {
- fprintf(stderr, "%s: intelIsAgpMemory failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Todo -- don't want to clobber all the drawing state like we do
- * for readpixels -- most of this state can be handled just fine.
- */
- if ( ctx->_ImageTransferState ||
- unpack->SwapBytes ||
- unpack->LsbFirst ||
- ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest) {
- fprintf(stderr, "%s: other tests failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Todo -- remove these restrictions:
- */
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != -1.0F)
- return GL_FALSE;
-
-
-
- switch (type) {
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- if (format != GL_BGRA) return GL_FALSE;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
- glTextureFormat = GL_RGBA;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- if (format != GL_RGB) return GL_FALSE;
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
- glTextureFormat = GL_RGB;
- break;
- case GL_UNSIGNED_SHORT_8_8_MESA:
- if (format != GL_YCBCR_MESA) return GL_FALSE;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_SWAPY
-/* | TM0S1_COLORSPACE_CONVERSION */
- );
- glTextureFormat = GL_YCBCR_MESA;
- break;
- case GL_UNSIGNED_SHORT_8_8_REV_MESA:
- if (format != GL_YCBCR_MESA) return GL_FALSE;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_NORMAL
-/* | TM0S1_COLORSPACE_CONVERSION */
- );
- glTextureFormat = GL_YCBCR_MESA;
- break;
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- if (format != GL_BGRA) return GL_FALSE;
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- glTextureFormat = GL_RGBA;
- break;
- default:
- fprintf(stderr, "%s: destFormat failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- intelFlush( ctx );
-
- SET_STATE( i830, meta );
-
- LOCK_HARDWARE( intel );
- {
- intelWaitForIdle( intel ); /* required by GL */
-
- y -= height; /* cope with pixel zoom */
-
- if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
- UNLOCK_HARDWARE( intel );
- SET_STATE(i830, state);
- fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
- return GL_TRUE;
- }
-
-
- y = dPriv->h - y - height;
-
- set_initial_state( i830 );
-
- /* Set the pixel image up as a rectangular texture.
- */
- set_tex_rect_source( i830,
- src_offset,
- width,
- height,
- pitch, /* XXXX!!!! -- /2 sometimes */
- textureFormat );
-
-
- enable_texture_blend_replace( i830, glTextureFormat );
-
-
- /* Draw to the current draw buffer:
- */
- set_draw_offset( i830, dst_offset );
-
- /* Draw a quad, use regular cliprects
- */
-/* fprintf(stderr, "x: %d y: %d width %d height %d\n", x, y, width, height); */
-
- draw_quad( i830,
- x, x+width, y, y+height,
- 0, 255, 0, 0,
- 0, width, 0, height );
-
- intelWindowMoved( intel );
- }
- UNLOCK_HARDWARE( intel );
- intelFinish( ctx ); /* required by GL */
-
- SET_STATE(i830, state);
-
- return GL_TRUE;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_reg.h
deleted file mode 100644
index c45b88ca5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_reg.h
+++ /dev/null
@@ -1,641 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-
-#ifndef _I830_REG_H_
-#define _I830_REG_H_
-
-
-#include "intel_reg.h"
-
-#define I830_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24))
-#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
-#define AA_LINE_ECAAR_WIDTH_0_5 0
-#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
-#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
-#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
-#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
-#define AA_LINE_REGION_WIDTH_0_5 0
-#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
-#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
-#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
-#define AA_LINE_ENABLE ((1<<1) | 1)
-#define AA_LINE_DISABLE (1<<1)
-
-#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
-/* Dword 1 */
-#define BUF_3D_ID_COLOR_BACK (0x3<<24)
-#define BUF_3D_ID_DEPTH (0x7<<24)
-#define BUF_3D_USE_FENCE (1<<23)
-#define BUF_3D_TILED_SURFACE (1<<22)
-#define BUF_3D_TILE_WALK_X 0
-#define BUF_3D_TILE_WALK_Y (1<<21)
-#define BUF_3D_PITCH(x) (((x)/4)<<2)
-/* Dword 2 */
-#define BUF_3D_ADDR(x) ((x) & ~0x3)
-
-
-#define _3DSTATE_COLOR_FACTOR_CMD (CMD_3D | (0x1d<<24) | (0x1<<16))
-
-#define _3DSTATE_COLOR_FACTOR_N_CMD(stage) (CMD_3D | (0x1d<<24) | \
- ((0x90+(stage))<<16))
-
-#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
-
-#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
-
-#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
-
-#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
-
-
-#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
-/* Dword 1 */
-#define DSTORG_HORT_BIAS(x) ((x)<<20)
-#define DSTORG_VERT_BIAS(x) ((x)<<16)
-#define COLOR_4_2_2_CHNL_WRT_ALL 0
-#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
-#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
-#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
-#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
-#define COLR_BUF_8BIT 0
-#define COLR_BUF_RGB555 (1<<8)
-#define COLR_BUF_RGB565 (2<<8)
-#define COLR_BUF_ARGB8888 (3<<8)
-#define DEPTH_IS_Z 0
-#define DEPTH_IS_W (1<<6)
-#define DEPTH_FRMT_16_FIXED 0
-#define DEPTH_FRMT_16_FLOAT (1<<2)
-#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
-#define DEPTH_FRMT_24_FLOAT_8_OTHER (3<<2)
-#define VERT_LINE_STRIDE_1 (1<<1)
-#define VERT_LINE_STRIDE_0 0
-#define VERT_LINE_STRIDE_OFS_1 1
-#define VERT_LINE_STRIDE_OFS_0 0
-
-
-#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
-/* Dword 1 */
-#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
-#define DRAW_DITHER_OFS_X(x) ((x)<<26)
-#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
-/* Dword 2 */
-#define DRAW_YMIN(x) ((x)<<16)
-#define DRAW_XMIN(x) (x)
-/* Dword 3 */
-#define DRAW_YMAX(x) ((x)<<16)
-#define DRAW_XMAX(x) (x)
-/* Dword 4 */
-#define DRAW_YORG(x) ((x)<<16)
-#define DRAW_XORG(x) (x)
-
-
-#define _3DSTATE_ENABLES_1_CMD (CMD_3D|(0x3<<24))
-#define ENABLE_LOGIC_OP_MASK ((1<<23)|(1<<22))
-#define ENABLE_LOGIC_OP ((1<<23)|(1<<22))
-#define DISABLE_LOGIC_OP (1<<23)
-#define ENABLE_STENCIL_TEST ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_TEST (1<<21)
-#define ENABLE_DEPTH_BIAS ((1<<11)|(1<<10))
-#define DISABLE_DEPTH_BIAS (1<<11)
-#define ENABLE_SPEC_ADD_MASK ((1<<9)|(1<<8))
-#define ENABLE_SPEC_ADD ((1<<9)|(1<<8))
-#define DISABLE_SPEC_ADD (1<<9)
-#define ENABLE_DIS_FOG_MASK ((1<<7)|(1<<6))
-#define ENABLE_FOG ((1<<7)|(1<<6))
-#define DISABLE_FOG (1<<7)
-#define ENABLE_DIS_ALPHA_TEST_MASK ((1<<5)|(1<<4))
-#define ENABLE_ALPHA_TEST ((1<<5)|(1<<4))
-#define DISABLE_ALPHA_TEST (1<<5)
-#define ENABLE_DIS_CBLEND_MASK ((1<<3)|(1<<2))
-#define ENABLE_COLOR_BLEND ((1<<3)|(1<<2))
-#define DISABLE_COLOR_BLEND (1<<3)
-#define ENABLE_DIS_DEPTH_TEST_MASK ((1<<1)|1)
-#define ENABLE_DEPTH_TEST ((1<<1)|1)
-#define DISABLE_DEPTH_TEST (1<<1)
-
-/* _3DSTATE_ENABLES_2, p138 */
-#define _3DSTATE_ENABLES_2_CMD (CMD_3D|(0x4<<24))
-#define ENABLE_STENCIL_WRITE ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_WRITE (1<<21)
-#define ENABLE_TEX_CACHE ((1<<17)|(1<<16))
-#define DISABLE_TEX_CACHE (1<<17)
-#define ENABLE_DITHER ((1<<9)|(1<<8))
-#define DISABLE_DITHER (1<<9)
-#define ENABLE_COLOR_MASK (1<<10)
-#define WRITEMASK_ALPHA (1<<7)
-#define WRITEMASK_ALPHA_SHIFT 7
-#define WRITEMASK_RED (1<<6)
-#define WRITEMASK_RED_SHIFT 6
-#define WRITEMASK_GREEN (1<<5)
-#define WRITEMASK_GREEN_SHIFT 5
-#define WRITEMASK_BLUE (1<<4)
-#define WRITEMASK_BLUE_SHIFT 4
-#define WRITEMASK_MASK ((1<<4)|(1<<5)|(1<<6)|(1<<7))
-#define ENABLE_COLOR_WRITE ((1<<3)|(1<<2))
-#define DISABLE_COLOR_WRITE (1<<3)
-#define ENABLE_DIS_DEPTH_WRITE_MASK 0x3
-#define ENABLE_DEPTH_WRITE ((1<<1)|1)
-#define DISABLE_DEPTH_WRITE (1<<1)
-
-/* _3DSTATE_FOG_COLOR, p139 */
-#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
-#define FOG_COLOR_RED(x) ((x)<<16)
-#define FOG_COLOR_GREEN(x) ((x)<<8)
-#define FOG_COLOR_BLUE(x) (x)
-
-/* _3DSTATE_FOG_MODE, p140 */
-#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
-/* Dword 1 */
-#define FOGFUNC_ENABLE (1<<31)
-#define FOGFUNC_VERTEX 0
-#define FOGFUNC_PIXEL_EXP (1<<28)
-#define FOGFUNC_PIXEL_EXP2 (2<<28)
-#define FOGFUNC_PIXEL_LINEAR (3<<28)
-#define FOGSRC_INDEX_Z (1<<27)
-#define FOGSRC_INDEX_W ((1<<27)|(1<<25))
-#define FOG_LINEAR_CONST (1<<24)
-#define FOG_CONST_1(x) ((x)<<4)
-#define ENABLE_FOG_DENSITY (1<<23)
-/* Dword 2 */
-#define FOG_CONST_2(x) (x)
-/* Dword 3 */
-#define FOG_DENSITY(x) (x)
-
-/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p142 */
-#define _3DSTATE_INDPT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
-#define ENABLE_INDPT_ALPHA_BLEND ((1<<23)|(1<<22))
-#define DISABLE_INDPT_ALPHA_BLEND (1<<23)
-#define ALPHA_BLENDFUNC_MASK 0x3f0000
-#define ENABLE_ALPHA_BLENDFUNC (1<<21)
-#define ABLENDFUNC_ADD 0
-#define ABLENDFUNC_SUB (1<<16)
-#define ABLENDFUNC_RVSE_SUB (2<<16)
-#define ABLENDFUNC_MIN (3<<16)
-#define ABLENDFUNC_MAX (4<<16)
-#define SRC_DST_ABLEND_MASK 0xfff
-#define ENABLE_SRC_ABLEND_FACTOR (1<<11)
-#define SRC_ABLEND_FACT(x) ((x)<<6)
-#define ENABLE_DST_ABLEND_FACTOR (1<<5)
-#define DST_ABLEND_FACT(x) (x)
-
-
-/* _3DSTATE_MAP_BLEND_ARG, p152 */
-#define _3DSTATE_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20))
-
-#define TEXPIPE_COLOR 0
-#define TEXPIPE_ALPHA (1<<18)
-#define TEXPIPE_KILL (2<<18)
-#define TEXBLEND_ARG0 0
-#define TEXBLEND_ARG1 (1<<15)
-#define TEXBLEND_ARG2 (2<<15)
-#define TEXBLEND_ARG3 (3<<15)
-#define TEXBLENDARG_MODIFY_PARMS (1<<6)
-#define TEXBLENDARG_REPLICATE_ALPHA (1<<5)
-#define TEXBLENDARG_INV_ARG (1<<4)
-#define TEXBLENDARG_ONE 0
-#define TEXBLENDARG_FACTOR 0x01
-#define TEXBLENDARG_ACCUM 0x02
-#define TEXBLENDARG_DIFFUSE 0x03
-#define TEXBLENDARG_SPEC 0x04
-#define TEXBLENDARG_CURRENT 0x05
-#define TEXBLENDARG_TEXEL0 0x06
-#define TEXBLENDARG_TEXEL1 0x07
-#define TEXBLENDARG_TEXEL2 0x08
-#define TEXBLENDARG_TEXEL3 0x09
-#define TEXBLENDARG_FACTOR_N 0x0e
-
-/* _3DSTATE_MAP_BLEND_OP, p155 */
-#define _3DSTATE_MAP_BLEND_OP_CMD(stage) (CMD_3D|(0x0d<<24)|((stage)<<20))
-#if 0
-# define TEXPIPE_COLOR 0
-# define TEXPIPE_ALPHA (1<<18)
-# define TEXPIPE_KILL (2<<18)
-#endif
-#define ENABLE_TEXOUTPUT_WRT_SEL (1<<17)
-#define TEXOP_OUTPUT_CURRENT 0
-#define TEXOP_OUTPUT_ACCUM (1<<15)
-#define ENABLE_TEX_CNTRL_STAGE ((1<<12)|(1<<11))
-#define DISABLE_TEX_CNTRL_STAGE (1<<12)
-#define TEXOP_SCALE_SHIFT 9
-#define TEXOP_SCALE_1X (0 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_2X (1 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_4X (2 << TEXOP_SCALE_SHIFT)
-#define TEXOP_MODIFY_PARMS (1<<8)
-#define TEXOP_LAST_STAGE (1<<7)
-#define TEXBLENDOP_KILLPIXEL 0x02
-#define TEXBLENDOP_ARG1 0x01
-#define TEXBLENDOP_ARG2 0x02
-#define TEXBLENDOP_MODULATE 0x03
-#define TEXBLENDOP_ADD 0x06
-#define TEXBLENDOP_ADDSIGNED 0x07
-#define TEXBLENDOP_BLEND 0x08
-#define TEXBLENDOP_BLEND_AND_ADD 0x09
-#define TEXBLENDOP_SUBTRACT 0x0a
-#define TEXBLENDOP_DOT3 0x0b
-#define TEXBLENDOP_DOT4 0x0c
-#define TEXBLENDOP_MODULATE_AND_ADD 0x0d
-#define TEXBLENDOP_MODULATE_2X_AND_ADD 0x0e
-#define TEXBLENDOP_MODULATE_4X_AND_ADD 0x0f
-
-/* _3DSTATE_MAP_BUMP_TABLE, p160 TODO */
-/* _3DSTATE_MAP_COLOR_CHROMA_KEY, p161 TODO */
-
-#define _3DSTATE_MAP_COORD_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8c<<16))
-#define DISABLE_TEX_TRANSFORM (1<<28)
-#define TEXTURE_SET(x) (x<<29)
-
-#define _3DSTATE_VERTEX_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8b<<16))
-#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
-#define DISABLE_PERSPECTIVE_DIVIDE (1<<29)
-
-
-/* _3DSTATE_MAP_COORD_SET_BINDINGS, p162 */
-#define _3DSTATE_MAP_COORD_SETBIND_CMD (CMD_3D|(0x1d<<24)|(0x02<<16))
-#define TEXBIND_MASK3 ((1<<15)|(1<<14)|(1<<13)|(1<<12))
-#define TEXBIND_MASK2 ((1<<11)|(1<<10)|(1<<9)|(1<<8))
-#define TEXBIND_MASK1 ((1<<7)|(1<<6)|(1<<5)|(1<<4))
-#define TEXBIND_MASK0 ((1<<3)|(1<<2)|(1<<1)|1)
-
-#define TEXBIND_SET3(x) ((x)<<12)
-#define TEXBIND_SET2(x) ((x)<<8)
-#define TEXBIND_SET1(x) ((x)<<4)
-#define TEXBIND_SET0(x) (x)
-
-#define TEXCOORDSRC_KEEP 0
-#define TEXCOORDSRC_DEFAULT 0x01
-#define TEXCOORDSRC_VTXSET_0 0x08
-#define TEXCOORDSRC_VTXSET_1 0x09
-#define TEXCOORDSRC_VTXSET_2 0x0a
-#define TEXCOORDSRC_VTXSET_3 0x0b
-#define TEXCOORDSRC_VTXSET_4 0x0c
-#define TEXCOORDSRC_VTXSET_5 0x0d
-#define TEXCOORDSRC_VTXSET_6 0x0e
-#define TEXCOORDSRC_VTXSET_7 0x0f
-
-#define MAP_UNIT(unit) ((unit)<<16)
-#define MAP_UNIT_MASK (0x7<<16)
-
-/* _3DSTATE_MAP_COORD_SETS, p164 */
-#define _3DSTATE_MAP_COORD_SET_CMD (CMD_3D|(0x1c<<24)|(0x01<<19))
-#define ENABLE_TEXCOORD_PARAMS (1<<15)
-#define TEXCOORDS_ARE_NORMAL (1<<14)
-#define TEXCOORDS_ARE_IN_TEXELUNITS 0
-#define TEXCOORDTYPE_CARTESIAN 0
-#define TEXCOORDTYPE_HOMOGENEOUS (1<<11)
-#define TEXCOORDTYPE_VECTOR (2<<11)
-#define TEXCOORDTYPE_MASK (0x7<<11)
-#define ENABLE_ADDR_V_CNTL (1<<7)
-#define ENABLE_ADDR_U_CNTL (1<<3)
-#define TEXCOORD_ADDR_V_MODE(x) ((x)<<4)
-#define TEXCOORD_ADDR_U_MODE(x) (x)
-#define TEXCOORDMODE_WRAP 0
-#define TEXCOORDMODE_MIRROR 1
-#define TEXCOORDMODE_CLAMP 2
-#define TEXCOORDMODE_WRAP_SHORTEST 3
-#define TEXCOORDMODE_CLAMP_BORDER 4
-#define TEXCOORD_ADDR_V_MASK 0x70
-#define TEXCOORD_ADDR_U_MASK 0x7
-
-/* _3DSTATE_MAP_CUBE, p168 TODO */
-#define _3DSTATE_MAP_CUBE (CMD_3D|(0x1c<<24)|(0x0a<<19))
-#define CUBE_NEGX_ENABLE (1<<5)
-#define CUBE_POSX_ENABLE (1<<4)
-#define CUBE_NEGY_ENABLE (1<<3)
-#define CUBE_POSY_ENABLE (1<<2)
-#define CUBE_NEGZ_ENABLE (1<<1)
-#define CUBE_POSZ_ENABLE (1<<0)
-
-
-/* _3DSTATE_MODES_1, p190 */
-#define _3DSTATE_MODES_1_CMD (CMD_3D|(0x08<<24))
-#define BLENDFUNC_MASK 0x3f0000
-#define ENABLE_COLR_BLND_FUNC (1<<21)
-#define BLENDFUNC_ADD 0
-#define BLENDFUNC_SUB (1<<16)
-#define BLENDFUNC_RVRSE_SUB (2<<16)
-#define BLENDFUNC_MIN (3<<16)
-#define BLENDFUNC_MAX (4<<16)
-#define SRC_DST_BLND_MASK 0xfff
-#define ENABLE_SRC_BLND_FACTOR (1<<11)
-#define ENABLE_DST_BLND_FACTOR (1<<5)
-#define SRC_BLND_FACT(x) ((x)<<6)
-#define DST_BLND_FACT(x) (x)
-
-
-/* _3DSTATE_MODES_2, p192 */
-#define _3DSTATE_MODES_2_CMD (CMD_3D|(0x0f<<24))
-#define ENABLE_GLOBAL_DEPTH_BIAS (1<<22)
-#define GLOBAL_DEPTH_BIAS(x) ((x)<<14)
-#define ENABLE_ALPHA_TEST_FUNC (1<<13)
-#define ENABLE_ALPHA_REF_VALUE (1<<8)
-#define ALPHA_TEST_FUNC(x) ((x)<<9)
-#define ALPHA_REF_VALUE(x) (x)
-
-#define ALPHA_TEST_REF_MASK 0x3fff
-
-/* _3DSTATE_MODES_3, p193 */
-#define _3DSTATE_MODES_3_CMD (CMD_3D|(0x02<<24))
-#define DEPTH_TEST_FUNC_MASK 0x1f0000
-#define ENABLE_DEPTH_TEST_FUNC (1<<20)
-/* Uses COMPAREFUNC */
-#define DEPTH_TEST_FUNC(x) ((x)<<16)
-#define ENABLE_ALPHA_SHADE_MODE (1<<11)
-#define ENABLE_FOG_SHADE_MODE (1<<9)
-#define ENABLE_SPEC_SHADE_MODE (1<<7)
-#define ENABLE_COLOR_SHADE_MODE (1<<5)
-#define ALPHA_SHADE_MODE(x) ((x)<<10)
-#define FOG_SHADE_MODE(x) ((x)<<8)
-#define SPEC_SHADE_MODE(x) ((x)<<6)
-#define COLOR_SHADE_MODE(x) ((x)<<4)
-#define CULLMODE_MASK 0xf
-#define ENABLE_CULL_MODE (1<<3)
-#define CULLMODE_BOTH 0
-#define CULLMODE_NONE 1
-#define CULLMODE_CW 2
-#define CULLMODE_CCW 3
-
-#define SHADE_MODE_LINEAR 0
-#define SHADE_MODE_FLAT 0x1
-
-/* _3DSTATE_MODES_4, p195 */
-#define _3DSTATE_MODES_4_CMD (CMD_3D|(0x16<<24))
-#define ENABLE_LOGIC_OP_FUNC (1<<23)
-#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK ((1<<18)|(1<<19)|(1<<20)|(1<<21))
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
-#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
-#define ENABLE_STENCIL_TEST_MASK (1<<17)
-#define STENCIL_TEST_MASK(x) ((x)<<8)
-#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
-#define ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define STENCIL_WRITE_MASK(x) (x)
-
-/* _3DSTATE_MODES_5, p196 */
-#define _3DSTATE_MODES_5_CMD (CMD_3D|(0x0c<<24))
-#define ENABLE_SPRITE_POINT_TEX (1<<23)
-#define SPRITE_POINT_TEX_ON (1<<22)
-#define SPRITE_POINT_TEX_OFF 0
-#define FLUSH_RENDER_CACHE (1<<18)
-#define FLUSH_TEXTURE_CACHE (1<<16)
-#define FIXED_LINE_WIDTH_MASK 0xfc00
-#define ENABLE_FIXED_LINE_WIDTH (1<<15)
-#define FIXED_LINE_WIDTH(x) ((x)<<10)
-#define FIXED_POINT_WIDTH_MASK 0x3ff
-#define ENABLE_FIXED_POINT_WIDTH (1<<9)
-#define FIXED_POINT_WIDTH(x) (x)
-
-/* _3DSTATE_RASTERIZATION_RULES, p198 */
-#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
-#define ENABLE_POINT_RASTER_RULE (1<<15)
-#define OGL_POINT_RASTER_RULE (1<<13)
-#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
-#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
-#define ENABLE_TRI_STRIP_PROVOKE_VRTX (1<<2)
-#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
-#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
-#define TRI_STRIP_PROVOKE_VRTX(x) (x)
-
-/* _3DSTATE_SCISSOR_ENABLE, p200 */
-#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
-#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
-#define DISABLE_SCISSOR_RECT (1<<1)
-
-/* _3DSTATE_SCISSOR_RECTANGLE_0, p201 */
-#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
-/* Dword 1 */
-#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMIN(x) (x)
-/* Dword 2 */
-#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMAX(x) (x)
-
-/* _3DSTATE_STENCIL_TEST, p202 */
-#define _3DSTATE_STENCIL_TEST_CMD (CMD_3D|(0x09<<24))
-#define ENABLE_STENCIL_PARMS (1<<23)
-#define STENCIL_OPS_MASK (0xffc000)
-#define STENCIL_FAIL_OP(x) ((x)<<20)
-#define STENCIL_PASS_DEPTH_FAIL_OP(x) ((x)<<17)
-#define STENCIL_PASS_DEPTH_PASS_OP(x) ((x)<<14)
-
-#define ENABLE_STENCIL_TEST_FUNC_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9))
-#define ENABLE_STENCIL_TEST_FUNC (1<<13)
-/* Uses COMPAREFUNC */
-#define STENCIL_TEST_FUNC(x) ((x)<<9)
-#define STENCIL_REF_VALUE_MASK ((1<<8)|0xff)
-#define ENABLE_STENCIL_REF_VALUE (1<<8)
-#define STENCIL_REF_VALUE(x) (x)
-
-/* _3DSTATE_VERTEX_FORMAT, p204 */
-#define _3DSTATE_VFT0_CMD (CMD_3D|(0x05<<24))
-#define VFT0_POINT_WIDTH (1<<12)
-#define VFT0_TEX_COUNT_MASK (7<<8)
-#define VFT0_TEX_COUNT_SHIFT 8
-#define VFT0_TEX_COUNT(x) ((x)<<8)
-#define VFT0_SPEC (1<<7)
-#define VFT0_DIFFUSE (1<<6)
-#define VFT0_DEPTH_OFFSET (1<<5)
-#define VFT0_XYZ (1<<1)
-#define VFT0_XYZW (2<<1)
-#define VFT0_XY (3<<1)
-#define VFT0_XYW (4<<1)
-#define VFT0_XYZW_MASK (7<<1)
-
-/* _3DSTATE_VERTEX_FORMAT_2, p206 */
-#define _3DSTATE_VFT1_CMD (CMD_3D|(0x0a<<24))
-#define VFT1_TEX7_FMT(x) ((x)<<14)
-#define VFT1_TEX6_FMT(x) ((x)<<12)
-#define VFT1_TEX5_FMT(x) ((x)<<10)
-#define VFT1_TEX4_FMT(x) ((x)<<8)
-#define VFT1_TEX3_FMT(x) ((x)<<6)
-#define VFT1_TEX2_FMT(x) ((x)<<4)
-#define VFT1_TEX1_FMT(x) ((x)<<2)
-#define VFT1_TEX0_FMT(x) (x)
-#define VFT1_TEX0_MASK 3
-#define VFT1_TEX1_SHIFT 2
-#define TEXCOORDFMT_2D 0
-#define TEXCOORDFMT_3D 1
-#define TEXCOORDFMT_4D 2
-#define TEXCOORDFMT_1D 3
-
-/*New stuff picked up along the way */
-
-#define MLC_LOD_BIAS_MASK ((1<<7)-1)
-
-
-/* _3DSTATE_VERTEX_TRANSFORM, p207 */
-#define _3DSTATE_VERTEX_TRANS_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|0)
-#define _3DSTATE_VERTEX_TRANS_MTX_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|6)
-/* Dword 1 */
-#define ENABLE_VIEWPORT_TRANSFORM ((1<<31)|(1<<30))
-#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
-#define ENABLE_PERSP_DIVIDE ((1<<29)|(1<<28))
-#define DISABLE_PERSP_DIVIDE (1<<29)
-#define VRTX_TRANS_LOAD_MATRICES 0x7421
-#define VRTX_TRANS_NO_LOAD_MATRICES 0x0000
-/* Dword 2 -> 7 are matrix elements */
-
-/* _3DSTATE_W_STATE, p209 */
-#define _3DSTATE_W_STATE_CMD (CMD_3D|(0x1d<<24)|(0x8d<<16)|1)
-/* Dword 1 */
-#define MAGIC_W_STATE_DWORD1 0x00000008
-/* Dword 2 */
-#define WFAR_VALUE(x) (x)
-
-
-/* Stipple command, carried over from the i810, apparently:
- */
-#define _3DSTATE_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-
-
-#define _3DSTATE_LOAD_STATE_IMMEDIATE_2 ((0x3<<29)|(0x1d<<24)|(0x03<<16))
-#define LOAD_TEXTURE_MAP0 (1<<11)
-#define LOAD_GLOBAL_COLOR_FACTOR (1<<6)
-
-#define TM0S0_ADDRESS_MASK 0xfffffffc
-#define TM0S0_USE_FENCE (1<<1)
-
-#define TM0S1_HEIGHT_SHIFT 21
-#define TM0S1_WIDTH_SHIFT 10
-#define TM0S1_PALETTE_SELECT (1<<9)
-#define TM0S1_MAPSURF_FORMAT_MASK (0x7 << 6)
-#define TM0S1_MAPSURF_FORMAT_SHIFT 6
-#define MAPSURF_8BIT_INDEXED (0<<6)
-#define MAPSURF_8BIT (1<<6)
-#define MAPSURF_16BIT (2<<6)
-#define MAPSURF_32BIT (3<<6)
-#define MAPSURF_411 (4<<6)
-#define MAPSURF_422 (5<<6)
-#define MAPSURF_COMPRESSED (6<<6)
-#define MAPSURF_4BIT_INDEXED (7<<6)
-#define TM0S1_MT_FORMAT_MASK (0x7 << 3)
-#define TM0S1_MT_FORMAT_SHIFT 3
-#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
-#define MT_8BIT_IDX_RGB565 (0<<3) /* SURFACE_8BIT_INDEXED */
-#define MT_8BIT_IDX_ARGB1555 (1<<3)
-#define MT_8BIT_IDX_ARGB4444 (2<<3)
-#define MT_8BIT_IDX_AY88 (3<<3)
-#define MT_8BIT_IDX_ABGR8888 (4<<3)
-#define MT_8BIT_IDX_BUMP_88DVDU (5<<3)
-#define MT_8BIT_IDX_BUMP_655LDVDU (6<<3)
-#define MT_8BIT_IDX_ARGB8888 (7<<3)
-#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
-#define MT_8BIT_L8 (1<<3)
-#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
-#define MT_16BIT_ARGB1555 (1<<3)
-#define MT_16BIT_ARGB4444 (2<<3)
-#define MT_16BIT_AY88 (3<<3)
-#define MT_16BIT_DIB_ARGB1555_8888 (4<<3)
-#define MT_16BIT_BUMP_88DVDU (5<<3)
-#define MT_16BIT_BUMP_655LDVDU (6<<3)
-#define MT_16BIT_DIB_RGB565_8888 (7<<3)
-#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
-#define MT_32BIT_ABGR8888 (1<<3)
-#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3)
-#define MT_32BIT_DIB_8888 (7<<3)
-#define MT_411_YUV411 (0<<3) /* SURFACE_411 */
-#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
-#define MT_422_YCRCB_NORMAL (1<<3)
-#define MT_422_YCRCB_SWAPUV (2<<3)
-#define MT_422_YCRCB_SWAPUVY (3<<3)
-#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
-#define MT_COMPRESS_DXT2_3 (1<<3)
-#define MT_COMPRESS_DXT4_5 (2<<3)
-#define MT_COMPRESS_FXT1 (3<<3)
-#define TM0S1_COLORSPACE_CONVERSION (1 << 2)
-#define TM0S1_TILED_SURFACE (1 << 1)
-#define TM0S1_TILE_WALK (1 << 0)
-
-#define TM0S2_PITCH_SHIFT 21
-#define TM0S2_CUBE_FACE_ENA_SHIFT 15
-#define TM0S2_CUBE_FACE_ENA_MASK (1<<15)
-#define TM0S2_MAP_FORMAT (1<<14)
-#define TM0S2_VERTICAL_LINE_STRIDE (1<<13)
-#define TM0S2_VERITCAL_LINE_STRIDE_OFF (1<<12)
-#define TM0S2_OUTPUT_CHAN_SHIFT 10
-#define TM0S2_OUTPUT_CHAN_MASK (3<<10)
-
-#define TM0S3_MIP_FILTER_MASK (0x3<<30)
-#define TM0S3_MIP_FILTER_SHIFT 30
-#define MIPFILTER_NONE 0
-#define MIPFILTER_NEAREST 1
-#define MIPFILTER_LINEAR 3
-#define TM0S3_MAG_FILTER_MASK (0x3<<28)
-#define TM0S3_MAG_FILTER_SHIFT 28
-#define TM0S3_MIN_FILTER_MASK (0x3<<26)
-#define TM0S3_MIN_FILTER_SHIFT 26
-#define FILTER_NEAREST 0
-#define FILTER_LINEAR 1
-#define FILTER_ANISOTROPIC 2
-
-#define TM0S3_LOD_BIAS_SHIFT 17
-#define TM0S3_LOD_BIAS_MASK (0x1ff<<17)
-#define TM0S3_MAX_MIP_SHIFT 9
-#define TM0S3_MAX_MIP_MASK (0xff<<9)
-#define TM0S3_MIN_MIP_SHIFT 3
-#define TM0S3_MIN_MIP_MASK (0x3f<<3)
-#define TM0S3_KILL_PIXEL (1<<2)
-#define TM0S3_KEYED_FILTER (1<<1)
-#define TM0S3_CHROMA_KEY (1<<0)
-
-
-/* _3DSTATE_MAP_TEXEL_STREAM, p188 */
-#define _3DSTATE_MAP_TEX_STREAM_CMD (CMD_3D|(0x1c<<24)|(0x05<<19))
-#define DISABLE_TEX_STREAM_BUMP (1<<12)
-#define ENABLE_TEX_STREAM_BUMP ((1<<12)|(1<<11))
-#define TEX_MODIFY_UNIT_0 0
-#define TEX_MODIFY_UNIT_1 (1<<8)
-#define ENABLE_TEX_STREAM_COORD_SET (1<<7)
-#define TEX_STREAM_COORD_SET(x) ((x)<<4)
-#define ENABLE_TEX_STREAM_MAP_IDX (1<<3)
-#define TEX_STREAM_MAP_IDX(x) (x)
-
-
-#define MI_FLUSH ((0<<29)|(4<<23))
-#define FLUSH_MAP_CACHE (1<<0)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_state.c
deleted file mode 100644
index ec19fe980..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_state.c
+++ /dev/null
@@ -1,1089 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "texmem.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-static void i830StencilFunc(GLcontext *ctx, GLenum func, GLint ref,
- GLuint mask)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- int test = intel_translate_compare_func(func);
-
- mask = mask & 0xff;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(func), ref, mask);
-
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i830->state.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(mask));
- i830->state.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
- i830->state.Ctx[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_REF_VALUE(ref) |
- STENCIL_TEST_FUNC(test));
-}
-
-static void i830StencilMask(GLcontext *ctx, GLuint mask)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
-
- mask = mask & 0xff;
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- i830->state.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(mask));
-}
-
-static void i830StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- int fop, dfop, dpop;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(fail),
- _mesa_lookup_enum_by_nr(zfail),
- _mesa_lookup_enum_by_nr(zpass));
-
- fop = 0; dfop = 0; dpop = 0;
-
- switch(fail) {
- case GL_KEEP:
- fop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- fop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- fop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- fop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- fop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- fop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- fop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- fop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zfail) {
- case GL_KEEP:
- dfop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dfop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dfop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dfop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dfop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dfop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dfop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dfop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zpass) {
- case GL_KEEP:
- dpop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dpop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dpop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dpop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dpop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dpop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dpop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dpop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
-
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_OPS_MASK);
- i830->state.Ctx[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(fop) |
- STENCIL_PASS_DEPTH_FAIL_OP(dfop) |
- STENCIL_PASS_DEPTH_PASS_OP(dpop));
-}
-
-static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- int test = intel_translate_compare_func(func);
- GLubyte refByte;
- GLuint refInt;
-
- UNCLAMPED_FLOAT_TO_UBYTE(refByte, ref);
- refInt = (GLuint)refByte;
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE2] &= ~ALPHA_TEST_REF_MASK;
- i830->state.Ctx[I830_CTXREG_STATE2] |= (ENABLE_ALPHA_TEST_FUNC |
- ENABLE_ALPHA_REF_VALUE |
- ALPHA_TEST_FUNC(test) |
- ALPHA_REF_VALUE(refInt));
-}
-
-/**
- * Makes sure that the proper enables are set for LogicOp, Independant Alpha
- * Blend, and Blending. It needs to be called from numerous places where we
- * could change the LogicOp or Independant Alpha Blend without subsequent
- * calls to glEnable.
- *
- * \todo
- * This function is substantially different from the old i830-specific driver.
- * I'm not sure which is correct.
- */
-static void i830EvalLogicOpBlendState(GLcontext *ctx)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- if (ctx->Color._LogicOpEnabled) {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP);
- } else if (ctx->Color.BlendEnabled) {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (ENABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
- } else {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
- }
-}
-
-static void i830BlendColor(GLcontext *ctx, const GLfloat color[4])
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- GLubyte r, g, b, a;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, color[ACOMP]);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = (a<<24) | (r<<16) | (g<<8) | b;
-}
-
-/**
- * Sets both the blend equation (called "function" in i830 docs) and the
- * blend function (called "factor" in i830 docs). This is done in a single
- * function because some blend equations (i.e., \c GL_MIN and \c GL_MAX)
- * change the interpretation of the blend function.
- */
-static void i830_set_blend_state( GLcontext * ctx )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- int funcA;
- int funcRGB;
- int eqnA;
- int eqnRGB;
- int iab;
- int s1;
-
-
- funcRGB = SRC_BLND_FACT( intel_translate_blend_factor( ctx->Color.BlendSrcRGB ) )
- | DST_BLND_FACT( intel_translate_blend_factor( ctx->Color.BlendDstRGB ) );
-
- switch(ctx->Color.BlendEquationRGB) {
- case GL_FUNC_ADD:
- eqnRGB = BLENDFUNC_ADD;
- break;
- case GL_MIN:
- eqnRGB = BLENDFUNC_MIN;
- funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_MAX:
- eqnRGB = BLENDFUNC_MAX;
- funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_FUNC_SUBTRACT:
- eqnRGB = BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnRGB = BLENDFUNC_RVRSE_SUB;
- break;
- default:
- fprintf( stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n",
- __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB );
- return;
- }
-
-
- funcA = SRC_ABLEND_FACT( intel_translate_blend_factor( ctx->Color.BlendSrcA ) )
- | DST_ABLEND_FACT( intel_translate_blend_factor( ctx->Color.BlendDstA ) );
-
- switch(ctx->Color.BlendEquationA) {
- case GL_FUNC_ADD:
- eqnA = BLENDFUNC_ADD;
- break;
- case GL_MIN:
- eqnA = BLENDFUNC_MIN;
- funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_MAX:
- eqnA = BLENDFUNC_MAX;
- funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_FUNC_SUBTRACT:
- eqnA = BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnA = BLENDFUNC_RVRSE_SUB;
- break;
- default:
- fprintf( stderr, "[%s:%u] Invalid alpha blend equation (0x%04x).\n",
- __FUNCTION__, __LINE__, ctx->Color.BlendEquationA );
- return;
- }
-
- iab = eqnA | funcA
- | _3DSTATE_INDPT_ALPHA_BLEND_CMD
- | ENABLE_SRC_ABLEND_FACTOR | ENABLE_DST_ABLEND_FACTOR
- | ENABLE_ALPHA_BLENDFUNC;
- s1 = eqnRGB | funcRGB
- | _3DSTATE_MODES_1_CMD
- | ENABLE_SRC_BLND_FACTOR | ENABLE_DST_BLND_FACTOR
- | ENABLE_COLR_BLND_FUNC;
-
- if ( (eqnA | funcA) != (eqnRGB | funcRGB) )
- iab |= ENABLE_INDPT_ALPHA_BLEND;
- else
- iab |= DISABLE_INDPT_ALPHA_BLEND;
-
- if (iab != i830->state.Ctx[I830_CTXREG_IALPHAB] ||
- s1 != i830->state.Ctx[I830_CTXREG_STATE1]) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_IALPHAB] = iab;
- i830->state.Ctx[I830_CTXREG_STATE1] = s1;
- }
-
- /* This will catch a logicop blend equation. It will also ensure
- * independant alpha blend is really in the correct state (either enabled
- * or disabled) if blending is already enabled.
- */
-
- i830EvalLogicOpBlendState(ctx);
-
- if (0) {
- fprintf(stderr, "[%s:%u] STATE1: 0x%08x IALPHAB: 0x%08x blend is %sabled\n",
- __FUNCTION__, __LINE__,
- i830->state.Ctx[I830_CTXREG_STATE1],
- i830->state.Ctx[I830_CTXREG_IALPHAB],
- (ctx->Color.BlendEnabled) ? "en" : "dis");
- }
-}
-
-
-static void i830BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB,
- GLenum modeA)
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s -> %s, %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(modeRGB),
- _mesa_lookup_enum_by_nr(modeA));
-
- (void) modeRGB;
- (void) modeA;
- i830_set_blend_state( ctx );
-}
-
-
-static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(sfactorRGB),
- _mesa_lookup_enum_by_nr(dfactorRGB),
- _mesa_lookup_enum_by_nr(sfactorA),
- _mesa_lookup_enum_by_nr(dfactorA));
-
- (void) sfactorRGB;
- (void) dfactorRGB;
- (void) sfactorA;
- (void) dfactorA;
- i830_set_blend_state( ctx );
-}
-
-
-
-static void i830DepthFunc(GLcontext *ctx, GLenum func)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- int test = intel_translate_compare_func(func);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK;
- i830->state.Ctx[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(test));
-}
-
-static void i830DepthMask(GLcontext *ctx, GLboolean flag)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
-
- if (flag && ctx->Depth.Test)
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_DEPTH_WRITE;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE;
-}
-
-/* =============================================================
- * Polygon stipple
- *
- * The i830 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i830PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- i830->intel.reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE);
- i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 3 ; j >= 0; j--)
- for (i = 0 ; i < 4 ; i++, m++)
- if (*m != p[j]) {
- i830->intel.hw_stipple = 0;
- return;
- }
-
- newMask = (((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12));
-
-
- if (newMask == 0xffff || newMask == 0x0) {
- /* this is needed to make conform pass */
- i830->intel.hw_stipple = 0;
- return;
- }
-
- i830->state.Stipple[I830_STPREG_ST1] &= ~0xffff;
- i830->state.Stipple[I830_STPREG_ST1] |= newMask;
- i830->intel.hw_stipple = 1;
-
- if (active)
- i830->state.Stipple[I830_STPREG_ST1] |= ST1_ENABLE;
-}
-
-
-/* =============================================================
- * Hardware clipping
- */
-static void i830Scissor(GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- intelScreenPrivate *screen = i830->intel.intelScreen;
- int x1, y1, x2, y2;
-
- if (!i830->intel.driDrawable)
- return;
-
- x1 = x;
- y1 = i830->intel.driDrawable->h - (y + h);
- x2 = x + w - 1;
- y2 = y1 + h - 1;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
- x, y, w, h);
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
-
- if (x2 >= screen->width) x2 = screen->width-1;
- if (y2 >= screen->height) y2 = screen->height-1;
- if (x1 >= screen->width) x1 = screen->width-1;
- if (y1 >= screen->height) y1 = screen->height-1;
-
-
- I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
- i830->state.Buffer[I830_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff);
- i830->state.Buffer[I830_DESTREG_SR2] = (y2 << 16) | (x2 & 0xffff);
-}
-
-static void i830LogicOp(GLcontext *ctx, GLenum opcode)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- int tmp = intel_translate_logic_op( opcode );
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE4] &= ~LOGICOP_MASK;
- i830->state.Ctx[I830_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
-}
-
-
-
-static void i830CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- GLuint mode;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!ctx->Polygon.CullFlag) {
- mode = CULLMODE_NONE;
- }
- else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = CULLMODE_CW;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- }
- else {
- mode = CULLMODE_BOTH;
- }
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE3] &= ~CULLMODE_MASK;
- i830->state.Ctx[I830_CTXREG_STATE3] |= ENABLE_CULL_MODE | mode;
-}
-
-static void i830LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- i830ContextPtr i830 = I830_CONTEXT( ctx );
- int width;
- int state5;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- width = (int)(widthf * 2);
- CLAMP_SELF(width, 1, 15);
-
- state5 = i830->state.Ctx[I830_CTXREG_STATE5] & ~FIXED_LINE_WIDTH_MASK;
- state5 |= (ENABLE_FIXED_LINE_WIDTH | FIXED_LINE_WIDTH(width));
-
- if (state5 != i830->state.Ctx[I830_CTXREG_STATE5]) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE5] = state5;
- }
-}
-
-static void i830PointSize(GLcontext *ctx, GLfloat size)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- GLint point_size = (int)size;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- CLAMP_SELF(point_size, 1, 256);
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE5] &= ~FIXED_POINT_WIDTH_MASK;
- i830->state.Ctx[I830_CTXREG_STATE5] |= (ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(point_size));
-}
-
-
-/* =============================================================
- * Color masks
- */
-
-static void i830ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- i830ContextPtr i830 = I830_CONTEXT( ctx );
- GLuint tmp = 0;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
-
- tmp = ((i830->state.Ctx[I830_CTXREG_ENABLES_2] & ~WRITEMASK_MASK) |
- ENABLE_COLOR_MASK |
- ENABLE_COLOR_WRITE |
- ((!r) << WRITEMASK_RED_SHIFT) |
- ((!g) << WRITEMASK_GREEN_SHIFT) |
- ((!b) << WRITEMASK_BLUE_SHIFT) |
- ((!a) << WRITEMASK_ALPHA_SHIFT));
-
- if (tmp != i830->state.Ctx[I830_CTXREG_ENABLES_2]) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_2] = tmp;
- }
-}
-
-static void update_specular( GLcontext *ctx )
-{
- i830ContextPtr i830 = I830_CONTEXT( ctx );
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK;
-
- if (NEED_SECONDARY_COLOR(ctx))
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_SPEC_ADD;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_SPEC_ADD;
-}
-
-static void i830LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- update_specular( ctx );
- }
-}
-
-/* In Mesa 3.5 we can reliably do native flatshading.
- */
-static void i830ShadeModel(GLcontext *ctx, GLenum mode)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
-
-#define SHADE_MODE_MASK ((1<<10)|(1<<8)|(1<<6)|(1<<4))
-
- i830->state.Ctx[I830_CTXREG_STATE3] &= ~SHADE_MODE_MASK;
-
- if (mode == GL_FLAT) {
- i830->state.Ctx[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_FLAT) |
- FOG_SHADE_MODE(SHADE_MODE_FLAT) |
- SPEC_SHADE_MODE(SHADE_MODE_FLAT) |
- COLOR_SHADE_MODE(SHADE_MODE_FLAT));
- } else {
- i830->state.Ctx[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR));
- }
-}
-
-/* =============================================================
- * Fog
- */
-static void i830Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_FOGCOLOR] = (_3DSTATE_FOG_COLOR_CMD | color);
- }
-}
-
-/* =============================================================
- */
-
-static void i830Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
-
- switch(cap) {
- case GL_LIGHTING:
- case GL_COLOR_SUM:
- update_specular( ctx );
- break;
-
- case GL_ALPHA_TEST:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_ALPHA_TEST_MASK;
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_ALPHA_TEST;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_ALPHA_TEST;
-
- break;
-
- case GL_BLEND:
- i830EvalLogicOpBlendState(ctx);
- break;
-
- case GL_COLOR_LOGIC_OP:
- i830EvalLogicOpBlendState(ctx);
-
- /* Logicop doesn't seem to work at 16bpp:
- */
- if (i830->intel.intelScreen->cpp == 2)
- FALLBACK( &i830->intel, I830_FALLBACK_LOGICOP, state );
- break;
-
- case GL_DITHER:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DITHER;
-
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_DITHER;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DITHER;
- break;
-
- case GL_DEPTH_TEST:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
-
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST;
-
- /* Also turn off depth writes when GL_DEPTH_TEST is disabled:
- */
- i830DepthMask( ctx, ctx->Depth.Mask );
- break;
-
- case GL_SCISSOR_TEST:
- I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
-
- if (state)
- i830->state.Buffer[I830_DESTREG_SENABLE] =
- (_3DSTATE_SCISSOR_ENABLE_CMD |
- ENABLE_SCISSOR_RECT);
- else
- i830->state.Buffer[I830_DESTREG_SENABLE] =
- (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
-
- break;
-
- case GL_LINE_SMOOTH:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- i830->state.Ctx[I830_CTXREG_AA] &= ~AA_LINE_ENABLE;
- if (state)
- i830->state.Ctx[I830_CTXREG_AA] |= AA_LINE_ENABLE;
- else
- i830->state.Ctx[I830_CTXREG_AA] |= AA_LINE_DISABLE;
- break;
-
- case GL_FOG:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_FOG_MASK;
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_FOG;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_FOG;
- break;
-
- case GL_CULL_FACE:
- i830CullFaceFrontFace(ctx, 0);
- break;
-
- case GL_TEXTURE_2D:
- break;
-
- case GL_STENCIL_TEST:
- if (i830->intel.hw_stencil) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- if (state) {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST;
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE;
- } else {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST;
- i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_STENCIL_WRITE;
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST;
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_STENCIL_WRITE;
- }
- } else {
- FALLBACK( &i830->intel, I830_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- /* The stipple command worked on my 855GM box, but not my 845G.
- * I'll do more testing later to find out exactly which hardware
- * supports it. Disabled for now.
- */
- if (i830->intel.hw_stipple &&
- i830->intel.reduced_primitive == GL_TRIANGLES)
- {
- I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE);
- i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE;
- if (state)
- i830->state.Stipple[I830_STPREG_ST1] |= ST1_ENABLE;
- }
- break;
-
- default:
- ;
- }
-}
-
-
-static void i830_init_packets( i830ContextPtr i830 )
-{
- intelScreenPrivate *screen = i830->intel.intelScreen;
-
- /* Zero all state */
- memset(&i830->state, 0, sizeof(i830->state));
-
- /* Set default blend state */
- i830->state.TexBlend[0][0] = (_3DSTATE_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- i830->state.TexBlend[0][1] = (_3DSTATE_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- i830->state.TexBlend[0][2] = (_3DSTATE_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
- i830->state.TexBlend[0][3] = (_3DSTATE_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
-
- i830->state.TexBlendWordsUsed[0] = 4;
-
-
- i830->state.Ctx[I830_CTXREG_VF] = 0;
- i830->state.Ctx[I830_CTXREG_VF2] = 0;
-
- i830->state.Ctx[I830_CTXREG_AA] = (_3DSTATE_AA_CMD |
- AA_LINE_ECAAR_WIDTH_ENABLE |
- AA_LINE_ECAAR_WIDTH_1_0 |
- AA_LINE_REGION_WIDTH_ENABLE |
- AA_LINE_REGION_WIDTH_1_0 |
- AA_LINE_DISABLE);
-
- i830->state.Ctx[I830_CTXREG_ENABLES_1] = (_3DSTATE_ENABLES_1_CMD |
- DISABLE_LOGIC_OP |
- DISABLE_STENCIL_TEST |
- DISABLE_DEPTH_BIAS |
- DISABLE_SPEC_ADD |
- DISABLE_FOG |
- DISABLE_ALPHA_TEST |
- DISABLE_COLOR_BLEND |
- DISABLE_DEPTH_TEST);
-
- if (i830->intel.hw_stencil) {
- i830->state.Ctx[I830_CTXREG_ENABLES_2] = (_3DSTATE_ENABLES_2_CMD |
- ENABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- } else {
- i830->state.Ctx[I830_CTXREG_ENABLES_2] = (_3DSTATE_ENABLES_2_CMD |
- DISABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- }
-
- i830->state.Ctx[I830_CTXREG_STATE1] = (_3DSTATE_MODES_1_CMD |
- ENABLE_COLR_BLND_FUNC |
- BLENDFUNC_ADD |
- ENABLE_SRC_BLND_FACTOR |
- SRC_BLND_FACT(BLENDFACT_ONE) |
- ENABLE_DST_BLND_FACTOR |
- DST_BLND_FACT(BLENDFACT_ZERO) );
-
- i830->state.Ctx[I830_CTXREG_STATE2] = (_3DSTATE_MODES_2_CMD |
- ENABLE_GLOBAL_DEPTH_BIAS |
- GLOBAL_DEPTH_BIAS(0) |
- ENABLE_ALPHA_TEST_FUNC |
- ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ALPHA_REF_VALUE(0) );
-
- i830->state.Ctx[I830_CTXREG_STATE3] = (_3DSTATE_MODES_3_CMD |
- ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(COMPAREFUNC_LESS) |
- ENABLE_ALPHA_SHADE_MODE |
- ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_FOG_SHADE_MODE |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_SPEC_SHADE_MODE |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_COLOR_SHADE_MODE |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_CULL_MODE |
- CULLMODE_NONE);
-
- i830->state.Ctx[I830_CTXREG_STATE4] = (_3DSTATE_MODES_4_CMD |
- ENABLE_LOGIC_OP_FUNC |
- LOGIC_OP_FUNC(LOGICOP_COPY) |
- ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff) |
- ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(0xff));
-
- i830->state.Ctx[I830_CTXREG_STENCILTST] = (_3DSTATE_STENCIL_TEST_CMD |
- ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_KEEP) |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ENABLE_STENCIL_REF_VALUE |
- STENCIL_REF_VALUE(0) );
-
- i830->state.Ctx[I830_CTXREG_STATE5] = (_3DSTATE_MODES_5_CMD |
- FLUSH_TEXTURE_CACHE |
- ENABLE_SPRITE_POINT_TEX |
- SPRITE_POINT_TEX_OFF |
- ENABLE_FIXED_LINE_WIDTH |
- FIXED_LINE_WIDTH(0x2) | /* 1.0 */
- ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(1) );
-
- i830->state.Ctx[I830_CTXREG_IALPHAB] = (_3DSTATE_INDPT_ALPHA_BLEND_CMD |
- DISABLE_INDPT_ALPHA_BLEND |
- ENABLE_ALPHA_BLENDFUNC |
- ABLENDFUNC_ADD);
-
- i830->state.Ctx[I830_CTXREG_FOGCOLOR] = (_3DSTATE_FOG_COLOR_CMD |
- FOG_COLOR_RED(0) |
- FOG_COLOR_GREEN(0) |
- FOG_COLOR_BLUE(0));
-
- i830->state.Ctx[I830_CTXREG_BLENDCOLOR0] = _3DSTATE_CONST_BLEND_COLOR_CMD;
- i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = 0;
-
- i830->state.Ctx[I830_CTXREG_MCSB0] = _3DSTATE_MAP_COORD_SETBIND_CMD;
- i830->state.Ctx[I830_CTXREG_MCSB1] = (TEXBIND_SET3(TEXCOORDSRC_VTXSET_3) |
- TEXBIND_SET2(TEXCOORDSRC_VTXSET_2) |
- TEXBIND_SET1(TEXCOORDSRC_VTXSET_1) |
- TEXBIND_SET0(TEXCOORDSRC_VTXSET_0));
-
-
- i830->state.Stipple[I830_STPREG_ST0] = _3DSTATE_STIPPLE;
-
- i830->state.Buffer[I830_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i830->state.Buffer[I830_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK |
- BUF_3D_PITCH(screen->frontPitch * screen->cpp) |
- BUF_3D_USE_FENCE);
-
-
- i830->state.Buffer[I830_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i830->state.Buffer[I830_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH |
- BUF_3D_PITCH(screen->depthPitch * screen->cpp) |
- BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_DBUFADDR2] = screen->depthOffset;
-
-
- i830->state.Buffer[I830_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD;
-
- switch (screen->fbFormat) {
- case DV_PF_555:
- case DV_PF_565:
- i830->state.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_16_FIXED);
- break;
- case DV_PF_8888:
- i830->state.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_24_FIXED_8_OTHER);
- break;
- }
-
- i830->state.Buffer[I830_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- i830->state.Buffer[I830_DESTREG_SR0] = _3DSTATE_SCISSOR_RECT_0_CMD;
- i830->state.Buffer[I830_DESTREG_SR1] = 0;
- i830->state.Buffer[I830_DESTREG_SR2] = 0;
-}
-
-
-void i830InitStateFuncs( struct dd_function_table *functions )
-{
- functions->AlphaFunc = i830AlphaFunc;
- functions->BlendColor = i830BlendColor;
- functions->BlendEquationSeparate = i830BlendEquationSeparate;
- functions->BlendFuncSeparate = i830BlendFuncSeparate;
- functions->ColorMask = i830ColorMask;
- functions->CullFace = i830CullFaceFrontFace;
- functions->DepthFunc = i830DepthFunc;
- functions->DepthMask = i830DepthMask;
- functions->Enable = i830Enable;
- functions->Fogfv = i830Fogfv;
- functions->FrontFace = i830CullFaceFrontFace;
- functions->LightModelfv = i830LightModelfv;
- functions->LineWidth = i830LineWidth;
- functions->LogicOpcode = i830LogicOp;
- functions->PointSize = i830PointSize;
- functions->PolygonStipple = i830PolygonStipple;
- functions->Scissor = i830Scissor;
- functions->ShadeModel = i830ShadeModel;
- functions->StencilFunc = i830StencilFunc;
- functions->StencilMask = i830StencilMask;
- functions->StencilOp = i830StencilOp;
-}
-
-void i830InitState( i830ContextPtr i830 )
-{
- GLcontext *ctx = &i830->intel.ctx;
-
- i830_init_packets( i830 );
-
- intelInitState( ctx );
-
- memcpy( &i830->initial, &i830->state, sizeof(i830->state) );
-
- i830->current = &i830->state;
- i830->state.emitted = 0;
- i830->state.active = (I830_UPLOAD_TEXBLEND(0) |
- I830_UPLOAD_STIPPLE |
- I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS);
-}
-
-
-
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_tex.c
deleted file mode 100644
index d56a4df8b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_tex.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "image.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "texmem.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "intel_ioctl.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-
-
-
-/**
- * Set the texture wrap modes.
- *
- * The i830M (and related graphics cores) do not support GL_CLAMP. The Intel
- * drivers for "other operating systems" implement GL_CLAMP as
- * GL_CLAMP_TO_EDGE, so the same is done here.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-static void i830SetTexWrapping(i830TextureObjectPtr tex,
- GLenum swrap,
- GLenum twrap)
-{
- tex->Setup[I830_TEXREG_MCS] &= ~(TEXCOORD_ADDR_U_MASK|TEXCOORD_ADDR_V_MASK);
-
- switch( swrap ) {
- case GL_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP);
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP);
- break;
- case GL_CLAMP_TO_BORDER:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_CLAMP_BORDER);
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_MIRROR);
- break;
- default:
- break;
- }
-
- switch( twrap ) {
- case GL_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP);
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- tex->Setup[I830_TEXREG_MCS] |= TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP);
- break;
- case GL_CLAMP_TO_BORDER:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_CLAMP_BORDER);
- break;
- case GL_MIRRORED_REPEAT:
- tex->Setup[I830_TEXREG_MCS] |=
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_MIRROR);
- break;
- default:
- break;
- }
-}
-
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- * \param bias LOD bias for this texture unit.
- */
-
-static void i830SetTexFilter( i830TextureObjectPtr t, GLenum minf, GLenum magf,
- GLfloat maxanisotropy )
-{
- int minFilt = 0, mipFilt = 0, magFilt = 0;
-
- if(INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if ( maxanisotropy > 1.0 ) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- }
- else {
- switch (minf) {
- case GL_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_LINEAR;
- break;
- default:
- break;
- }
-
- switch (magf) {
- case GL_NEAREST:
- magFilt = FILTER_NEAREST;
- break;
- case GL_LINEAR:
- magFilt = FILTER_LINEAR;
- break;
- default:
- break;
- }
- }
-
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIN_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIP_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MAG_FILTER_MASK;
- t->Setup[I830_TEXREG_TM0S3] |= ((minFilt << TM0S3_MIN_FILTER_SHIFT) |
- (mipFilt << TM0S3_MIP_FILTER_SHIFT) |
- (magFilt << TM0S3_MAG_FILTER_SHIFT));
-}
-
-static void i830SetTexBorderColor(i830TextureObjectPtr t, GLubyte color[4])
-{
- if(INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- t->Setup[I830_TEXREG_TM0S4] =
- INTEL_PACKCOLOR8888(color[0],color[1],color[2],color[3]);
-}
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-intelTextureObjectPtr i830AllocTexObj( struct gl_texture_object *texObj )
-{
- i830TextureObjectPtr t = CALLOC_STRUCT( i830_texture_object );
- if ( !t )
- return NULL;
-
- texObj->DriverData = t;
- t->intel.base.tObj = texObj;
- t->intel.dirty = I830_UPLOAD_TEX_ALL;
- make_empty_list( &t->intel.base );
-
- t->Setup[I830_TEXREG_TM0LI] = 0; /* not used */
- t->Setup[I830_TEXREG_TM0S0] = 0;
- t->Setup[I830_TEXREG_TM0S1] = 0;
- t->Setup[I830_TEXREG_TM0S2] = 0;
- t->Setup[I830_TEXREG_TM0S3] = 0;
- t->Setup[I830_TEXREG_MCS] = (_3DSTATE_MAP_COORD_SET_CMD |
- MAP_UNIT(0) |
- ENABLE_TEXCOORD_PARAMS |
- TEXCOORDS_ARE_NORMAL |
- TEXCOORDTYPE_CARTESIAN |
- ENABLE_ADDR_V_CNTL |
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP) |
- ENABLE_ADDR_U_CNTL |
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP));
-
-
- i830SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
- i830SetTexFilter( t, texObj->MinFilter, texObj->MagFilter,
- texObj->MaxAnisotropy );
- i830SetTexBorderColor( t, texObj->_BorderChan );
-
- return &t->intel;
-}
-
-
-static void i830TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;
- if (!t)
- return;
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- i830SetTexFilter( t, tObj->MinFilter, tObj->MagFilter,
- tObj->MaxAnisotropy);
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- i830SetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- i830SetTexBorderColor( t, tObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* The i830 and its successors can do a lot of this without
- * reloading the textures. A project for someone?
- */
- intelFlush( ctx );
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- t->intel.dirty = I830_UPLOAD_TEX_ALL;
-}
-
-
-static void i830TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- i830ContextPtr i830 = I830_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR:
-#if 0
- {
- GLubyte r, g, b, a;
- GLuint col;
-
- UNCLAMPED_FLOAT_TO_UBYTE(r, param[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, param[GCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, param[BCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, param[ACOMP]);
-
- col = ((a << 24) | (r << 16) | (g << 8) | b);
-
- if (col != i830->state.TexEnv[unit][I830_TEXENVREG_COL1]) {
- I830_STATECHANGE(i830, I830_UPLOAD_TEXENV);
- i830->state.TexEnv[unit][I830_TEXENVREG_COL1] = col;
- }
-
- break;
- }
-#endif
- case GL_TEXTURE_ENV_MODE:
- case GL_COMBINE_RGB:
- case GL_COMBINE_ALPHA:
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- break;
-
- case GL_TEXTURE_LOD_BIAS: {
- int b = (int) ((*param) * 16.0);
- if (b > 63) b = 63;
- if (b < -64) b = -64;
- I830_STATECHANGE(i830, I830_UPLOAD_TEX(unit));
- i830->state.Tex[unit][I830_TEXREG_TM0S3] &= ~TM0S3_LOD_BIAS_MASK;
- i830->state.Tex[unit][I830_TEXREG_TM0S3] |=
- ((b << TM0S3_LOD_BIAS_SHIFT) & TM0S3_LOD_BIAS_MASK);
- break;
- }
-
- default:
- break;
- }
-}
-
-
-
-
-void i830InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->TexEnv = i830TexEnv;
- functions->TexParameter = i830TexParameter;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texblend.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texblend.c
deleted file mode 100644
index 49e034764..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texblend.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "mm.h"
-
-#include "intel_screen.h"
-#include "intel_ioctl.h"
-#include "intel_tex.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-
-/* ================================================================
- * Texture combine functions
- */
-static GLuint pass_through( GLuint *state, GLuint blendUnit )
-{
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
-
- return 4;
-}
-
-static GLuint emit_factor( GLuint blendUnit, GLuint *state, GLuint count,
- const GLfloat *factor )
-{
- GLubyte r, g, b, a;
- GLuint col;
-
- if (0)
- fprintf(stderr, "emit constant %d: %.2f %.2f %.2f %.2f\n",
- blendUnit, factor[0], factor[1], factor[2], factor[3]);
-
- UNCLAMPED_FLOAT_TO_UBYTE(r, factor[0]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, factor[1]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, factor[2]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, factor[3]);
-
- col = ((a << 24) | (r << 16) | (g << 8) | b);
-
- state[count++] = _3DSTATE_COLOR_FACTOR_N_CMD(blendUnit);
- state[count++] = col;
-
- return count;
-}
-
-
-static __inline__ GLuint GetTexelOp(GLint unit)
-{
- switch(unit) {
- case 0: return TEXBLENDARG_TEXEL0;
- case 1: return TEXBLENDARG_TEXEL1;
- case 2: return TEXBLENDARG_TEXEL2;
- case 3: return TEXBLENDARG_TEXEL3;
- default: return TEXBLENDARG_TEXEL0;
- }
-}
-
-
-/**
- * Calculate the hardware instuctions to setup the current texture enviromnemt
- * settings. Since \c gl_texture_unit::_CurrentCombine is used, both
- * "classic" texture enviroments and GL_ARB_texture_env_combine type texture
- * environments are treated identically.
- *
- * \todo
- * This function should return \c GLboolean. When \c GL_FALSE is returned,
- * it means that an environment is selected that the hardware cannot do. This
- * is the way the Radeon and R200 drivers work.
- *
- * \todo
- * Looking at i830_3d_regs.h, it seems the i830 can do part of
- * GL_ATI_texture_env_combine3. It can handle using \c GL_ONE and
- * \c GL_ZERO as combine inputs (which the code already supports). It can
- * also handle the \c GL_MODULATE_ADD_ATI mode. Is it worth investigating
- * partial support for the extension?
- */
-GLuint
-i830SetTexEnvCombine(i830ContextPtr i830,
- const struct gl_tex_env_combine_state * combine,
- GLint blendUnit,
- GLuint texel_op,
- GLuint *state,
- const GLfloat *factor )
-{
- const GLuint numColorArgs = combine->_NumArgsRGB;
- const GLuint numAlphaArgs = combine->_NumArgsA;
-
- GLuint blendop;
- GLuint ablendop;
- GLuint args_RGB[3];
- GLuint args_A[3];
- GLuint rgb_shift;
- GLuint alpha_shift;
- GLboolean need_factor = 0;
- int i;
- unsigned used;
- static const GLuint tex_blend_rgb[3] = {
- TEXPIPE_COLOR | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_COLOR | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_COLOR | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
- };
- static const GLuint tex_blend_a[3] = {
- TEXPIPE_ALPHA | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_ALPHA | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_ALPHA | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
- };
-
- if(INTEL_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- switch (combine->ModeRGB) {
- case GL_DOT3_RGB_EXT:
- alpha_shift = combine->ScaleShiftA;
- rgb_shift = 0;
- break;
-
- case GL_DOT3_RGBA_EXT:
- alpha_shift = 0;
- rgb_shift = 0;
- break;
-
- default:
- rgb_shift = combine->ScaleShiftRGB;
- alpha_shift = combine->ScaleShiftA;
- break;
- }
-
-
- switch(combine->ModeRGB) {
- case GL_REPLACE:
- blendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- blendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- blendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- blendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- blendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- blendop = TEXBLENDOP_SUBTRACT;
- break;
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGB:
- blendop = TEXBLENDOP_DOT3;
- break;
- case GL_DOT3_RGBA_EXT:
- case GL_DOT3_RGBA:
- blendop = TEXBLENDOP_DOT3;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
- blendop |= (rgb_shift << TEXOP_SCALE_SHIFT);
-
-
- /* Handle RGB args */
- for(i = 0; i < 3; i++) {
- switch(combine->SourceRGB[i]) {
- case GL_TEXTURE:
- args_RGB[i] = texel_op;
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- args_RGB[i] = GetTexelOp( combine->SourceRGB[i] - GL_TEXTURE0 );
- break;
- case GL_CONSTANT:
- args_RGB[i] = TEXBLENDARG_FACTOR_N;
- need_factor = 1;
- break;
- case GL_PRIMARY_COLOR:
- args_RGB[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_RGB[i] = TEXBLENDARG_CURRENT;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
- switch(combine->OperandRGB[i]) {
- case GL_SRC_COLOR:
- args_RGB[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- args_RGB[i] |= TEXBLENDARG_INV_ARG;
- break;
- case GL_SRC_ALPHA:
- args_RGB[i] |= TEXBLENDARG_REPLICATE_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- args_RGB[i] |= (TEXBLENDARG_REPLICATE_ALPHA |
- TEXBLENDARG_INV_ARG);
- break;
- default:
- return pass_through( state, blendUnit );
- }
- }
-
-
- /* Need to knobble the alpha calculations of TEXBLENDOP_DOT4 to
- * match the spec. Can't use DOT3 as it won't propogate values
- * into alpha as required:
- *
- * Note - the global factor is set up with alpha == .5, so
- * the alpha part of the DOT4 calculation should be zero.
- */
- if ( combine->ModeRGB == GL_DOT3_RGBA_EXT ||
- combine->ModeRGB == GL_DOT3_RGBA ) {
- ablendop = TEXBLENDOP_DOT4;
- args_A[0] = TEXBLENDARG_FACTOR; /* the global factor */
- args_A[1] = TEXBLENDARG_FACTOR;
- args_A[2] = TEXBLENDARG_FACTOR;
- }
- else {
- switch(combine->ModeA) {
- case GL_REPLACE:
- ablendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- ablendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- ablendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- ablendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- ablendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- ablendop = TEXBLENDOP_SUBTRACT;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
-
- ablendop |= (alpha_shift << TEXOP_SCALE_SHIFT);
-
- /* Handle A args */
- for(i = 0; i < 3; i++) {
- switch(combine->SourceA[i]) {
- case GL_TEXTURE:
- args_A[i] = texel_op;
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- args_A[i] = GetTexelOp( combine->SourceA[i] - GL_TEXTURE0 );
- break;
- case GL_CONSTANT:
- args_A[i] = TEXBLENDARG_FACTOR_N;
- need_factor = 1;
- break;
- case GL_PRIMARY_COLOR:
- args_A[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_A[i] = TEXBLENDARG_CURRENT;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
- switch(combine->OperandA[i]) {
- case GL_SRC_ALPHA:
- args_A[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- args_A[i] |= TEXBLENDARG_INV_ARG;
- break;
- default:
- return pass_through( state, blendUnit );
- }
- }
- }
-
-
-
- /* Native Arg1 == Arg0 in GL_EXT_texture_env_combine spec */
- /* Native Arg2 == Arg1 in GL_EXT_texture_env_combine spec */
- /* Native Arg0 == Arg2 in GL_EXT_texture_env_combine spec */
-
- /* When we render we need to figure out which is the last really enabled
- * tex unit, and put last stage on it
- */
-
-
- /* Build color & alpha pipelines */
-
- used = 0;
- state[used++] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_MODIFY_PARMS |
- blendop);
- state[used++] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_MODIFY_PARMS |
- ablendop);
-
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- state[used++] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- tex_blend_rgb[i] | args_RGB[i]);
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- state[used++] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- tex_blend_a[i] | args_A[i]);
- }
-
-
- if (need_factor)
- return emit_factor( blendUnit, state, used, factor );
- else
- return used;
-}
-
-
-static void emit_texblend( i830ContextPtr i830, GLuint unit, GLuint blendUnit,
- GLboolean last_stage )
-{
- struct gl_texture_unit *texUnit = &i830->intel.ctx.Texture.Unit[unit];
- GLuint tmp[I830_TEXBLEND_SIZE], tmp_sz;
-
-
- if (0) fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
-
- /* Update i830->state.TexBlend
- */
- tmp_sz = i830SetTexEnvCombine(i830, texUnit->_CurrentCombine, blendUnit,
- GetTexelOp(unit), tmp,
- texUnit->EnvColor );
-
- if (last_stage)
- tmp[0] |= TEXOP_LAST_STAGE;
-
- if (tmp_sz != i830->state.TexBlendWordsUsed[blendUnit] ||
- memcmp( tmp, i830->state.TexBlend[blendUnit], tmp_sz * sizeof(GLuint))) {
-
- I830_STATECHANGE( i830, I830_UPLOAD_TEXBLEND(blendUnit) );
- memcpy( i830->state.TexBlend[blendUnit], tmp, tmp_sz * sizeof(GLuint));
- i830->state.TexBlendWordsUsed[blendUnit] = tmp_sz;
- }
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(blendUnit), GL_TRUE);
-}
-
-static void emit_passthrough( i830ContextPtr i830 )
-{
- GLuint tmp[I830_TEXBLEND_SIZE], tmp_sz;
- GLuint unit = 0;
-
- tmp_sz = pass_through( tmp, unit );
- tmp[0] |= TEXOP_LAST_STAGE;
-
- if (tmp_sz != i830->state.TexBlendWordsUsed[unit] ||
- memcmp( tmp, i830->state.TexBlend[unit], tmp_sz * sizeof(GLuint))) {
-
- I830_STATECHANGE( i830, I830_UPLOAD_TEXBLEND(unit) );
- memcpy( i830->state.TexBlend[unit], tmp, tmp_sz * sizeof(GLuint));
- i830->state.TexBlendWordsUsed[unit] = tmp_sz;
- }
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(unit), GL_TRUE);
-}
-
-void i830EmitTextureBlend( i830ContextPtr i830 )
-{
- GLcontext *ctx = &i830->intel.ctx;
- GLuint unit, last_stage = 0, blendunit = 0;
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, GL_FALSE);
-
- if (ctx->Texture._EnabledUnits) {
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled)
- last_stage = unit;
-
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled)
- emit_texblend( i830, unit, blendunit++, last_stage == unit );
- }
- else {
- emit_passthrough( i830 );
- }
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c
deleted file mode 100644
index ba452279b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c
+++ /dev/null
@@ -1,483 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "mm.h"
-
-#include "intel_screen.h"
-#include "intel_ioctl.h"
-#include "intel_tex.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-static const GLint initial_offsets[6][2] = { {0,0},
- {0,2},
- {1,0},
- {1,2},
- {1,1},
- {1,3} };
-
-static const GLint step_offsets[6][2] = { {0,2},
- {0,2},
- {-1,2},
- {-1,2},
- {-1,1},
- {-1,1} };
-
-#define I830_TEX_UNIT_ENABLED(unit) (1<<unit)
-
-static GLboolean i830SetTexImages( i830ContextPtr i830,
- struct gl_texture_object *tObj )
-{
- GLuint total_height, pitch, i, textureFormat;
- i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint firstLevel, lastLevel, numLevels;
-
- switch( baseImage->TexFormat->MesaFormat ) {
- case MESA_FORMAT_L8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_L8;
- break;
-
- case MESA_FORMAT_I8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_I8;
- break;
-
- case MESA_FORMAT_A8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_I8; /* Kludge -- check with conform, glean */
- break;
-
- case MESA_FORMAT_AL88:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_AY88;
- break;
-
- case MESA_FORMAT_RGB565:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
- break;
-
- case MESA_FORMAT_ARGB1555:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
- break;
-
- case MESA_FORMAT_ARGB4444:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB4444;
- break;
-
- case MESA_FORMAT_ARGB8888:
- t->intel.texelBytes = 4;
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- break;
-
- case MESA_FORMAT_YCBCR_REV:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_NORMAL |
- TM0S1_COLORSPACE_CONVERSION);
- break;
-
- case MESA_FORMAT_YCBCR:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_SWAPY | /* ??? */
- TM0S1_COLORSPACE_CONVERSION);
- break;
-
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_COMPRESSED | MT_COMPRESS_FXT1;
- break;
-
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGB_DXT1:
- /*
- * DXTn pitches are Width/4 * blocksize in bytes
- * for DXT1: blocksize=8 so Width/4*8 = Width * 2
- * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
- */
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
- break;
- case MESA_FORMAT_RGBA_DXT3:
- t->intel.texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
- break;
- case MESA_FORMAT_RGBA_DXT5:
- t->intel.texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
- break;
-
- default:
- fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
- abort();
- }
-
- /* 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.
- */
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- firstLevel = t->intel.base.firstLevel;
- lastLevel = t->intel.base.lastLevel;
- numLevels = lastLevel - firstLevel + 1;
-
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- switch (tObj->Target) {
- case GL_TEXTURE_CUBE_MAP: {
- const GLuint dim = tObj->Image[0][firstLevel]->Width;
- GLuint face;
-
- pitch = dim * t->intel.texelBytes;
- pitch *= 2; /* double pitch for cube layouts */
- pitch = (pitch + 3) & ~3;
-
- total_height = dim * 4;
-
- for ( face = 0 ; face < 6 ; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
-
- t->intel.base.dirty_images[face] = ~0;
-
- assert(tObj->Image[face][firstLevel]->Width == dim);
- assert(tObj->Image[face][firstLevel]->Height == dim);
-
- for (i = 0; i < numLevels; i++) {
- t->intel.image[face][i].image = tObj->Image[face][firstLevel + i];
- if (!t->intel.image[face][i].image) {
- fprintf(stderr, "no image %d %d\n", face, i);
- break; /* can't happen */
- }
-
- t->intel.image[face][i].offset =
- y * pitch + x * t->intel.texelBytes;
- t->intel.image[face][i].internalFormat = baseImage->Format;
-
- d >>= 1;
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- }
- }
- break;
- }
- default:
- pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
- pitch = (pitch + 3) & ~3;
- t->intel.base.dirty_images[0] = ~0;
-
- for ( total_height = i = 0 ; i < numLevels ; i++ ) {
- t->intel.image[0][i].image = tObj->Image[0][firstLevel + i];
- if (!t->intel.image[0][i].image)
- break;
-
- t->intel.image[0][i].offset = total_height * pitch;
- t->intel.image[0][i].internalFormat = baseImage->Format;
- if (t->intel.image[0][i].image->IsCompressed)
- {
- if (t->intel.image[0][i].image->Height > 4)
- total_height += t->intel.image[0][i].image->Height/4;
- else
- total_height += 1;
- }
- else
- total_height += MAX2(2, t->intel.image[0][i].image->Height);
- }
- break;
- }
-
- t->intel.Pitch = pitch;
- t->intel.base.totalSize = total_height*pitch;
- t->intel.max_level = i-1;
- t->Setup[I830_TEXREG_TM0S1] =
- (((tObj->Image[0][firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) |
- ((tObj->Image[0][firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) |
- textureFormat);
- t->Setup[I830_TEXREG_TM0S2] =
- (((pitch / 4) - 1) << TM0S2_PITCH_SHIFT) |
- TM0S2_CUBE_FACE_ENA_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MAX_MIP_MASK;
- t->Setup[I830_TEXREG_TM0S3] &= ~TM0S3_MIN_MIP_MASK;
- t->Setup[I830_TEXREG_TM0S3] |= ((numLevels - 1)*4) << TM0S3_MIN_MIP_SHIFT;
- t->intel.dirty = I830_UPLOAD_TEX_ALL;
-
- return intelUploadTexImages( &i830->intel, &t->intel, 0 );
-}
-
-
-static void i830_import_tex_unit( i830ContextPtr i830,
- i830TextureObjectPtr t,
- GLuint unit )
-{
- if(INTEL_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s unit(%d)\n", __FUNCTION__, unit);
-
- if (i830->intel.CurrentTexObj[unit])
- i830->intel.CurrentTexObj[unit]->base.bound &= ~(1U << unit);
-
- i830->intel.CurrentTexObj[unit] = (intelTextureObjectPtr)t;
- t->intel.base.bound |= (1 << unit);
-
- I830_STATECHANGE( i830, I830_UPLOAD_TEX(unit) );
-
- i830->state.Tex[unit][I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
- (LOAD_TEXTURE_MAP0 << unit) | 4);
- i830->state.Tex[unit][I830_TEXREG_TM0S0] = (TM0S0_USE_FENCE |
- t->intel.TextureOffset);
-
- i830->state.Tex[unit][I830_TEXREG_TM0S1] = t->Setup[I830_TEXREG_TM0S1];
- i830->state.Tex[unit][I830_TEXREG_TM0S2] = t->Setup[I830_TEXREG_TM0S2];
-
- i830->state.Tex[unit][I830_TEXREG_TM0S3] &= TM0S3_LOD_BIAS_MASK;
- i830->state.Tex[unit][I830_TEXREG_TM0S3] |= (t->Setup[I830_TEXREG_TM0S3] &
- ~TM0S3_LOD_BIAS_MASK);
-
- i830->state.Tex[unit][I830_TEXREG_TM0S4] = t->Setup[I830_TEXREG_TM0S4];
- i830->state.Tex[unit][I830_TEXREG_MCS] = (t->Setup[I830_TEXREG_MCS] &
- ~MAP_UNIT_MASK);
- i830->state.Tex[unit][I830_TEXREG_CUBE] = t->Setup[I830_TEXREG_CUBE];
- i830->state.Tex[unit][I830_TEXREG_MCS] |= MAP_UNIT(unit);
-
- t->intel.dirty &= ~I830_UPLOAD_TEX(unit);
-}
-
-
-
-static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) {
- fprintf(stderr, "Texture border\n");
- return GL_FALSE;
- }
-
- /* Upload teximages (not pipelined)
- */
- if (t->intel.base.dirty_images[0]) {
- if (!i830SetTexImages( i830, tObj )) {
- return GL_FALSE;
- }
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (i830->intel.CurrentTexObj[unit] != &t->intel ||
- (t->intel.dirty & I830_UPLOAD_TEX(unit))) {
- i830_import_tex_unit( i830, t, unit);
- }
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(unit), GL_TRUE);
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- GLuint mcs = i830->state.Tex[unit][I830_TEXREG_MCS];
-
- mcs &= ~TEXCOORDS_ARE_NORMAL;
- mcs |= TEXCOORDS_ARE_IN_TEXELUNITS;
-
- if ((mcs != i830->state.Tex[unit][I830_TEXREG_MCS])
- || (0 != i830->state.Tex[unit][I830_TEXREG_CUBE])) {
- I830_STATECHANGE(i830, I830_UPLOAD_TEX(unit));
- i830->state.Tex[unit][I830_TEXREG_MCS] = mcs;
- i830->state.Tex[unit][I830_TEXREG_CUBE] = 0;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- GLuint mcs = i830->state.Tex[unit][I830_TEXREG_MCS];
-
- mcs &= ~TEXCOORDS_ARE_IN_TEXELUNITS;
- mcs |= TEXCOORDS_ARE_NORMAL;
-
- if ((mcs != i830->state.Tex[unit][I830_TEXREG_MCS])
- || (0 != i830->state.Tex[unit][I830_TEXREG_CUBE])) {
- I830_STATECHANGE(i830, I830_UPLOAD_TEX(unit));
- i830->state.Tex[unit][I830_TEXREG_MCS] = mcs;
- i830->state.Tex[unit][I830_TEXREG_CUBE] = 0;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean enable_tex_cube( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData;
- GLuint mcs = i830->state.Tex[unit][I830_TEXREG_MCS];
- const GLuint cube = CUBE_NEGX_ENABLE | CUBE_POSX_ENABLE
- | CUBE_NEGY_ENABLE | CUBE_POSY_ENABLE
- | CUBE_NEGZ_ENABLE | CUBE_POSZ_ENABLE;
- GLuint face;
-
- mcs &= ~TEXCOORDS_ARE_IN_TEXELUNITS;
- mcs |= TEXCOORDS_ARE_NORMAL;
-
- if ((mcs != i830->state.Tex[unit][I830_TEXREG_MCS])
- || (cube != i830->state.Tex[unit][I830_TEXREG_CUBE])) {
- I830_STATECHANGE(i830, I830_UPLOAD_TEX(unit));
- i830->state.Tex[unit][I830_TEXREG_MCS] = mcs;
- i830->state.Tex[unit][I830_TEXREG_CUBE] = cube;
- }
-
- /* Upload teximages (not pipelined)
- */
- if ( t->intel.base.dirty_images[0] || t->intel.base.dirty_images[1] ||
- t->intel.base.dirty_images[2] || t->intel.base.dirty_images[3] ||
- t->intel.base.dirty_images[4] || t->intel.base.dirty_images[5] ) {
- i830SetTexImages( i830, tObj );
- }
-
- /* upload (per face) */
- for (face = 0; face < 6; face++) {
- if (t->intel.base.dirty_images[face]) {
- if (!intelUploadTexImages( &i830->intel, &t->intel, face )) {
- return GL_FALSE;
- }
- }
- }
-
-
- return GL_TRUE;
-}
-
-
-static GLboolean disable_tex( GLcontext *ctx, GLuint unit )
-{
- i830ContextPtr i830 = I830_CONTEXT(ctx);
-
- /* This is happening too often. I need to conditionally send diffuse
- * state to the card. Perhaps a diffuse dirty flag of some kind.
- * Will need to change this logic if more than 2 texture units are
- * used. We need to only do this up to the last unit enabled, or unit
- * one if nothing is enabled.
- */
-
- if ( i830->intel.CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- i830->intel.CurrentTexObj[unit]->base.bound &= ~(1U << 0);
- i830->intel.CurrentTexObj[unit] = NULL;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean i830UpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if (texUnit->_ReallyEnabled &&
- INTEL_CONTEXT(ctx)->intelScreen->textureSize < 2048 * 1024)
- return GL_FALSE;
-
- switch(texUnit->_ReallyEnabled) {
- case TEXTURE_1D_BIT:
- case TEXTURE_2D_BIT:
- return (enable_tex_common( ctx, unit ) &&
- enable_tex_2d( ctx, unit ));
- case TEXTURE_RECT_BIT:
- return (enable_tex_common( ctx, unit ) &&
- enable_tex_rect( ctx, unit ));
- case TEXTURE_CUBE_BIT:
- return (enable_tex_common( ctx, unit ) &&
- enable_tex_cube( ctx, unit ));
- case 0:
- return disable_tex( ctx, unit );
- default:
- return GL_FALSE;
- }
-}
-
-
-void i830UpdateTextureState( intelContextPtr intel )
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
- GLcontext *ctx = &intel->ctx;
- GLboolean ok;
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEX_ALL, GL_FALSE);
-
- ok = (i830UpdateTexUnit( ctx, 0 ) &&
- i830UpdateTexUnit( ctx, 1 ) &&
- i830UpdateTexUnit( ctx, 2 ) &&
- i830UpdateTexUnit( ctx, 3 ));
-
- FALLBACK( intel, I830_FALLBACK_TEXTURE, !ok );
-
- if (ok)
- i830EmitTextureBlend( i830 );
-}
-
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_vtbl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_vtbl.c
deleted file mode 100644
index 22939e8e5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "i830_context.h"
-#include "i830_reg.h"
-
-#include "intel_batchbuffer.h"
-
-#include "tnl/t_context.h"
-#include "tnl/t_vertex.h"
-
-static GLboolean i830_check_vertex_size( intelContextPtr intel,
- GLuint expected );
-
-#define SZ_TO_HW(sz) ((sz-2)&0x3)
-#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1)
-#define EMIT_ATTR( ATTR, STYLE, V0 ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = (ATTR); \
- intel->vertex_attrs[intel->vertex_attr_count].format = (STYLE); \
- intel->vertex_attr_count++; \
- v0 |= V0; \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = 0; \
- intel->vertex_attrs[intel->vertex_attr_count].format = EMIT_PAD; \
- intel->vertex_attrs[intel->vertex_attr_count].offset = (N); \
- intel->vertex_attr_count++; \
-} while (0)
-
-
-#define VRTX_TEX_SET_FMT(n, x) ((x)<<((n)*2))
-#define TEXBIND_SET(n, x) ((x)<<((n)*4))
-
-static void i830_render_start( intelContextPtr intel )
-{
- GLcontext *ctx = &intel->ctx;
- i830ContextPtr i830 = I830_CONTEXT(intel);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLuint v0 = _3DSTATE_VFT0_CMD;
- GLuint v2 = _3DSTATE_VFT1_CMD;
- GLuint mcsb1 = 0;
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- intel->vertex_attr_count = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if (index & _TNL_BITS_TEX_ANY) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VFT0_XYZW );
- intel->coloroffset = 4;
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, VFT0_XYZ );
- intel->coloroffset = 3;
- }
-
- if (index & _TNL_BIT_POINTSIZE) {
- EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, VFT0_POINT_WIDTH );
- }
-
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VFT0_DIFFUSE );
-
- intel->specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if (index & _TNL_BIT_COLOR1) {
- intel->specoffset = intel->coloroffset + 1;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VFT0_SPEC );
- }
- else
- EMIT_PAD( 3 );
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VFT0_SPEC );
- else
- EMIT_PAD( 1 );
- }
-
- if (index & _TNL_BITS_TEX_ANY) {
- int i, count = 0;
-
- for (i = 0; i < I830_TEX_UNITS; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- GLuint sz = VB->TexCoordPtr[i]->size;
- GLuint emit;
- GLuint mcs = (i830->state.Tex[i][I830_TEXREG_MCS] &
- ~TEXCOORDTYPE_MASK);
-
- switch (sz) {
- case 1:
- case 2:
- emit = EMIT_2F;
- sz = 2;
- mcs |= TEXCOORDTYPE_CARTESIAN;
- break;
- case 3:
- emit = EMIT_3F;
- sz = 3;
- mcs |= TEXCOORDTYPE_VECTOR;
- break;
- case 4:
- emit = EMIT_3F_XYW;
- sz = 3;
- mcs |= TEXCOORDTYPE_HOMOGENEOUS;
- break;
- default:
- continue;
- };
-
-
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, emit, 0 );
- v2 |= VRTX_TEX_SET_FMT(count, SZ_TO_HW(sz));
- mcsb1 |= (count+8)<<(i*4);
-
- if (mcs != i830->state.Tex[i][I830_TEXREG_MCS]) {
- I830_STATECHANGE(i830, I830_UPLOAD_TEX(i));
- i830->state.Tex[i][I830_TEXREG_MCS] = mcs;
- }
-
- count++;
- }
- }
-
- v0 |= VFT0_TEX_COUNT(count);
- }
-
- /* Only need to change the vertex emit code if there has been a
- * statechange to a new hardware vertex format:
- */
- if (v0 != i830->state.Ctx[I830_CTXREG_VF] ||
- v2 != i830->state.Ctx[I830_CTXREG_VF2] ||
- mcsb1 != i830->state.Ctx[I830_CTXREG_MCSB1] ||
- index != i830->last_index) {
-
- I830_STATECHANGE( i830, I830_UPLOAD_CTX );
-
- /* Must do this *after* statechange, so as not to affect
- * buffered vertices reliant on the old state:
- */
- intel->vertex_size =
- _tnl_install_attrs( ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->vertex_size >>= 2;
-
- i830->state.Ctx[I830_CTXREG_VF] = v0;
- i830->state.Ctx[I830_CTXREG_VF2] = v2;
- i830->state.Ctx[I830_CTXREG_MCSB1] = mcsb1;
- i830->last_index = index;
-
- assert(i830_check_vertex_size( intel, intel->vertex_size ));
- }
-}
-
-static void i830_reduced_primitive_state( intelContextPtr intel,
- GLenum rprim )
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
- GLuint st1 = i830->state.Stipple[I830_STPREG_ST1];
-
- st1 &= ~ST1_ENABLE;
-
- switch (rprim) {
- case GL_TRIANGLES:
- if (intel->ctx.Polygon.StippleFlag &&
- intel->hw_stipple)
- st1 |= ST1_ENABLE;
- break;
- case GL_LINES:
- case GL_POINTS:
- default:
- break;
- }
-
- i830->intel.reduced_primitive = rprim;
-
- if (st1 != i830->state.Stipple[I830_STPREG_ST1]) {
- I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE);
- i830->state.Stipple[I830_STPREG_ST1] = st1;
- }
-}
-
-/* Pull apart the vertex format registers and figure out how large a
- * vertex is supposed to be.
- */
-static GLboolean i830_check_vertex_size( intelContextPtr intel,
- GLuint expected )
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
- int vft0 = i830->current->Ctx[I830_CTXREG_VF];
- int vft1 = i830->current->Ctx[I830_CTXREG_VF2];
- int nrtex = (vft0 & VFT0_TEX_COUNT_MASK) >> VFT0_TEX_COUNT_SHIFT;
- int i, sz = 0;
-
- switch (vft0 & VFT0_XYZW_MASK) {
- case VFT0_XY: sz = 2; break;
- case VFT0_XYZ: sz = 3; break;
- case VFT0_XYW: sz = 3; break;
- case VFT0_XYZW: sz = 4; break;
- default:
- fprintf(stderr, "no xyzw specified\n");
- return 0;
- }
-
- if (vft0 & VFT0_SPEC) sz++;
- if (vft0 & VFT0_DIFFUSE) sz++;
- if (vft0 & VFT0_DEPTH_OFFSET) sz++;
- if (vft0 & VFT0_POINT_WIDTH) sz++;
-
- for (i = 0 ; i < nrtex ; i++) {
- switch (vft1 & VFT1_TEX0_MASK) {
- case TEXCOORDFMT_2D: sz += 2; break;
- case TEXCOORDFMT_3D: sz += 3; break;
- case TEXCOORDFMT_4D: sz += 4; break;
- case TEXCOORDFMT_1D: sz += 1; break;
- }
- vft1 >>= VFT1_TEX1_SHIFT;
- }
-
- if (sz != expected)
- fprintf(stderr, "vertex size mismatch %d/%d\n", sz, expected);
-
- return sz == expected;
-}
-
-static void i830_emit_invarient_state( intelContextPtr intel )
-{
- BATCH_LOCALS;
-
- BEGIN_BATCH( 200 );
-
- OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(0));
- OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(1));
- OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(2));
- OUT_BATCH(_3DSTATE_MAP_CUBE | MAP_UNIT(3));
-
- OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_Z_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_FOG_MODE_CMD);
- OUT_BATCH(FOGFUNC_ENABLE |
- FOG_LINEAR_CONST |
- FOGSRC_INDEX_Z |
- ENABLE_FOG_DENSITY);
- OUT_BATCH(0);
- OUT_BATCH(0);
-
-
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(0) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(0) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(0));
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(1) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(1) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(1));
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(2) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(2) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(2));
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(3) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(3) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(3));
-
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(0));
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(1));
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(2));
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(3));
-
- OUT_BATCH(_3DSTATE_RASTER_RULES_CMD |
- ENABLE_POINT_RASTER_RULE |
- OGL_POINT_RASTER_RULE |
- ENABLE_LINE_STRIP_PROVOKE_VRTX |
- ENABLE_TRI_FAN_PROVOKE_VRTX |
- ENABLE_TRI_STRIP_PROVOKE_VRTX |
- LINE_STRIP_PROVOKE_VRTX(1) |
- TRI_FAN_PROVOKE_VRTX(2) |
- TRI_STRIP_PROVOKE_VRTX(2));
-
- OUT_BATCH(_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
-
- OUT_BATCH(_3DSTATE_SCISSOR_RECT_0_CMD);
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_VERTEX_TRANSFORM);
- OUT_BATCH(DISABLE_VIEWPORT_TRANSFORM | DISABLE_PERSPECTIVE_DIVIDE);
-
- OUT_BATCH(_3DSTATE_W_STATE_CMD);
- OUT_BATCH(MAGIC_W_STATE_DWORD1);
- OUT_BATCH(0x3f800000 /* 1.0 in IEEE float */ );
-
-
- OUT_BATCH(_3DSTATE_COLOR_FACTOR_CMD);
- OUT_BATCH(0x80808080); /* .5 required in alpha for GL_DOT3_RGBA_EXT */
-
- ADVANCE_BATCH();
-}
-
-
-#define emit( intel, state, size ) \
-do { \
- int k; \
- BEGIN_BATCH( size / sizeof(GLuint)); \
- for (k = 0 ; k < size / sizeof(GLuint) ; k++) \
- OUT_BATCH(state[k]); \
- ADVANCE_BATCH(); \
-} while (0);
-
-
-/* Push the state into the sarea and/or texture memory.
- */
-static void i830_emit_state( intelContextPtr intel )
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
- struct i830_hw_state *state = i830->current;
- int i;
- GLuint dirty;
- BATCH_LOCALS;
-
- dirty = state->active & ~state->emitted;
-
- if (dirty & I830_UPLOAD_CTX) {
- if (VERBOSE) fprintf(stderr, "I830_UPLOAD_CTX:\n");
- emit( i830, state->Ctx, sizeof(state->Ctx) );
- }
-
- if (dirty & I830_UPLOAD_BUFFERS) {
- if (VERBOSE) fprintf(stderr, "I830_UPLOAD_BUFFERS:\n");
- emit( i830, state->Buffer, sizeof(state->Buffer) );
- }
-
- if (dirty & I830_UPLOAD_STIPPLE) {
- if (VERBOSE) fprintf(stderr, "I830_UPLOAD_STIPPLE:\n");
- emit( i830, state->Stipple, sizeof(state->Stipple) );
- }
-
- for (i = 0; i < I830_TEX_UNITS; i++) {
- if ((dirty & I830_UPLOAD_TEX(i))) {
- if (VERBOSE) fprintf(stderr, "I830_UPLOAD_TEX(%d):\n", i);
- emit( i830, state->Tex[i], sizeof(state->Tex[i]));
- }
-
- if (dirty & I830_UPLOAD_TEXBLEND(i)) {
- if (VERBOSE) fprintf(stderr, "I830_UPLOAD_TEXBLEND(%d):\n", i);
- emit( i830, state->TexBlend[i],
- state->TexBlendWordsUsed[i] * 4 );
- }
- }
-
- state->emitted |= dirty;
-}
-
-static void i830_destroy_context( intelContextPtr intel )
-{
- _tnl_free_vertices(&intel->ctx);
-}
-
-static void i830_set_draw_offset( intelContextPtr intel, int offset )
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
- I830_STATECHANGE( i830, I830_UPLOAD_BUFFERS );
- i830->state.Buffer[I830_DESTREG_CBUFADDR2] = offset;
-}
-
-/* This isn't really handled at the moment.
- */
-static void i830_lost_hardware( intelContextPtr intel )
-{
- I830_CONTEXT(intel)->state.emitted = 0;
-}
-
-
-
-static void i830_emit_flush( intelContextPtr intel )
-{
- BATCH_LOCALS;
-
- BEGIN_BATCH(2);
- OUT_BATCH( MI_FLUSH | FLUSH_MAP_CACHE );
- OUT_BATCH( 0 );
- ADVANCE_BATCH();
-}
-
-
-
-
-void i830InitVtbl( i830ContextPtr i830 )
-{
- i830->intel.vtbl.alloc_tex_obj = i830AllocTexObj;
- i830->intel.vtbl.check_vertex_size = i830_check_vertex_size;
- i830->intel.vtbl.clear_with_tris = i830ClearWithTris;
- i830->intel.vtbl.destroy = i830_destroy_context;
- i830->intel.vtbl.emit_invarient_state = i830_emit_invarient_state;
- i830->intel.vtbl.emit_state = i830_emit_state;
- i830->intel.vtbl.lost_hardware = i830_lost_hardware;
- i830->intel.vtbl.reduced_primitive_state = i830_reduced_primitive_state;
- i830->intel.vtbl.set_draw_offset = i830_set_draw_offset;
- i830->intel.vtbl.update_texture_state = i830UpdateTextureState;
- i830->intel.vtbl.emit_flush = i830_emit_flush;
- i830->intel.vtbl.render_start = i830_render_start;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.c
deleted file mode 100644
index 42f91241b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "i915_context.h"
-#include "imports.h"
-#include "intel_tex.h"
-#include "intel_tris.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "utils.h"
-#include "i915_reg.h"
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-static const struct dri_extension i915_extensions[] =
-{
- { "GL_ARB_depth_texture", NULL },
- { "GL_ARB_fragment_program", NULL },
- { "GL_ARB_shadow", NULL },
- { "GL_EXT_shadow_funcs", NULL },
- /* ARB extn won't work if not enabled */
- { "GL_SGIX_depth_texture", NULL },
- { NULL, NULL }
-};
-
-/* Override intel default.
- */
-static void i915InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _tnl_invalidate_vertex_state( ctx, new_state );
- INTEL_CONTEXT(ctx)->NewGLState |= new_state;
-
- /* Todo: gather state values under which tracked parameters become
- * invalidated, add callbacks for things like
- * ProgramLocalParameters, etc.
- */
- {
- struct i915_fragment_program *p =
- (struct i915_fragment_program *)ctx->FragmentProgram._Current;
- if (p && p->nr_params)
- p->params_uptodate = 0;
- }
-
- if (new_state & (_NEW_FOG|_NEW_HINT|_NEW_PROGRAM))
- i915_update_fog(ctx);
-}
-
-
-static void i915InitDriverFunctions( struct dd_function_table *functions )
-{
- intelInitDriverFunctions( functions );
- i915InitStateFunctions( functions );
- i915InitTextureFuncs( functions );
- i915InitFragProgFuncs( functions );
- functions->UpdateState = i915InvalidateState;
-}
-
-
-
-GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- struct dd_function_table functions;
- i915ContextPtr i915 = (i915ContextPtr) CALLOC_STRUCT(i915_context);
- intelContextPtr intel = &i915->intel;
- GLcontext *ctx = &intel->ctx;
-
- if (!i915) return GL_FALSE;
-
- i915InitVtbl( i915 );
-
- i915InitDriverFunctions( &functions );
-
- if (!intelInitContext( intel, mesaVis, driContextPriv,
- sharedContextPrivate, &functions )) {
- FREE(i915);
- return GL_FALSE;
- }
-
- ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
- ctx->Const.MaxTextureImageUnits = I915_TEX_UNITS;
- ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS;
-
- intel->nr_heaps = 1;
- intel->texture_heaps[0] =
- driCreateTextureHeap( 0, intel,
- intel->intelScreen->textureSize,
- 12,
- I830_NR_TEX_REGIONS,
- intel->sarea->texList,
- & intel->sarea->texAge,
- & intel->swapped,
- sizeof( struct i915_texture_object ),
- (destroy_texture_object_t *)intelDestroyTexObj );
-
- /* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are
- * tightly packed, but they're not in Intel graphics
- * hardware.
- */
- ctx->Const.MaxTextureUnits = 1;
- driCalculateMaxTextureLevels( intel->texture_heaps,
- intel->nr_heaps,
- &intel->ctx.Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 8, /* 3D texture */
- 11, /* cube texture. */
- 11, /* rect texture */
- 12,
- GL_FALSE );
- ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
-
- /* GL_ARB_fragment_program limits - don't think Mesa actually
- * validates programs against these, and in any case one ARB
- * instruction can translate to more than one HW instruction, so
- * we'll still have to check and fallback each time.
- */
-
- ctx->Const.MaxFragmentProgramTemps = I915_MAX_TEMPORARY;
- ctx->Const.MaxFragmentProgramAttribs = 11; /* 8 tex, 2 color, fog */
- ctx->Const.MaxFragmentProgramLocalParams = I915_MAX_CONSTANT;
- ctx->Const.MaxFragmentProgramEnvParams = I915_MAX_CONSTANT;
- ctx->Const.MaxFragmentProgramAluInstructions = I915_MAX_ALU_INSN;
- ctx->Const.MaxFragmentProgramTexInstructions = I915_MAX_TEX_INSN;
- ctx->Const.MaxFragmentProgramInstructions = (I915_MAX_ALU_INSN +
- I915_MAX_TEX_INSN);
- ctx->Const.MaxFragmentProgramTexIndirections = I915_MAX_TEX_INDIRECT;
- ctx->Const.MaxFragmentProgramAddressRegs = 0; /* I don't think we have one */
-
-
- driInitExtensions( ctx, i915_extensions, GL_FALSE );
-
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- 36 * sizeof(GLfloat) );
-
- intel->verts = TNL_CONTEXT(ctx)->clipspace.vertex_buf;
-
- i915InitState( i915 );
-
- return GL_TRUE;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.h
deleted file mode 100644
index 804627764..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_context.h
+++ /dev/null
@@ -1,351 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef I915CONTEXT_INC
-#define I915CONTEXT_INC
-
-#include "intel_context.h"
-
-#define I915_FALLBACK_TEXTURE 0x1000
-#define I915_FALLBACK_COLORMASK 0x2000
-#define I915_FALLBACK_STENCIL 0x4000
-#define I915_FALLBACK_STIPPLE 0x8000
-#define I915_FALLBACK_PROGRAM 0x10000
-#define I915_FALLBACK_LOGICOP 0x20000
-
-#define I915_UPLOAD_CTX 0x1
-#define I915_UPLOAD_BUFFERS 0x2
-#define I915_UPLOAD_STIPPLE 0x4
-#define I915_UPLOAD_PROGRAM 0x8
-#define I915_UPLOAD_CONSTANTS 0x10
-#define I915_UPLOAD_FOG 0x20
-#define I915_UPLOAD_TEX(i) (0x00010000<<(i))
-#define I915_UPLOAD_TEX_ALL (0x00ff0000)
-#define I915_UPLOAD_TEX_0_SHIFT 16
-
-
-/* State structure offsets - these will probably disappear.
- */
-#define I915_DESTREG_CBUFADDR0 0
-#define I915_DESTREG_CBUFADDR1 1
-#define I915_DESTREG_CBUFADDR2 2
-#define I915_DESTREG_DBUFADDR0 3
-#define I915_DESTREG_DBUFADDR1 4
-#define I915_DESTREG_DBUFADDR2 5
-#define I915_DESTREG_DV0 6
-#define I915_DESTREG_DV1 7
-#define I915_DESTREG_SENABLE 8
-#define I915_DESTREG_SR0 9
-#define I915_DESTREG_SR1 10
-#define I915_DESTREG_SR2 11
-#define I915_DEST_SETUP_SIZE 12
-
-#define I915_CTXREG_STATE4 0
-#define I915_CTXREG_LI 1
-#define I915_CTXREG_LIS2 2
-#define I915_CTXREG_LIS4 3
-#define I915_CTXREG_LIS5 4
-#define I915_CTXREG_LIS6 5
-#define I915_CTXREG_IAB 6
-#define I915_CTXREG_BLENDCOLOR0 7
-#define I915_CTXREG_BLENDCOLOR1 8
-#define I915_CTX_SETUP_SIZE 9
-
-#define I915_FOGREG_COLOR 0
-#define I915_FOGREG_MODE0 1
-#define I915_FOGREG_MODE1 2
-#define I915_FOGREG_MODE2 3
-#define I915_FOGREG_MODE3 4
-#define I915_FOG_SETUP_SIZE 5
-
-#define I915_STPREG_ST0 0
-#define I915_STPREG_ST1 1
-#define I915_STP_SETUP_SIZE 2
-
-#define I915_TEXREG_MS2 0
-#define I915_TEXREG_MS3 1
-#define I915_TEXREG_MS4 2
-#define I915_TEXREG_SS2 3
-#define I915_TEXREG_SS3 4
-#define I915_TEXREG_SS4 5
-#define I915_TEX_SETUP_SIZE 6
-
-#define I915_MAX_CONSTANT 32
-#define I915_CONSTANT_SIZE (2+(4*I915_MAX_CONSTANT))
-
-
-#define I915_PROGRAM_SIZE 192
-
-
-/* Hardware version of a parsed fragment program. "Derived" from the
- * mesa fragment_program struct.
- */
-struct i915_fragment_program {
- struct fragment_program FragProg;
-
- GLboolean translated;
- GLboolean params_uptodate;
- GLboolean on_hardware;
- GLboolean error; /* If program is malformed for any reason. */
-
- GLuint nr_tex_indirect;
- GLuint nr_tex_insn;
- GLuint nr_alu_insn;
- GLuint nr_decl_insn;
-
-
-
-
- /* TODO: split between the stored representation of a program and
- * the state used to build that representation.
- */
- GLcontext *ctx;
-
- GLuint declarations[I915_PROGRAM_SIZE];
- GLuint program[I915_PROGRAM_SIZE];
-
- GLfloat constant[I915_MAX_CONSTANT][4];
- GLuint constant_flags[I915_MAX_CONSTANT];
- GLuint nr_constants;
-
- GLuint *csr; /* Cursor, points into program.
- */
-
- GLuint *decl; /* Cursor, points into declarations.
- */
-
- GLuint decl_s; /* flags for which s regs need to be decl'd */
- GLuint decl_t; /* flags for which t regs need to be decl'd */
-
- GLuint temp_flag; /* Tracks temporary regs which are in
- * use.
- */
-
- GLuint utemp_flag; /* Tracks TYPE_U temporary regs which are in
- * use.
- */
-
-
-
- /* Helpers for i915_fragprog.c:
- */
- GLuint wpos_tex;
- GLboolean depth_written;
-
- struct {
- GLuint reg; /* Hardware constant idx */
- const GLfloat *values; /* Pointer to tracked values */
- } param[I915_MAX_CONSTANT];
- GLuint nr_params;
-
-
-
-
- /* Helpers for i915_texprog.c:
- */
- GLuint src_texture; /* Reg containing sampled texture color,
- * else UREG_BAD.
- */
-
- GLuint src_previous; /* Reg containing color from previous
- * stage. May need to be decl'd.
- */
-
- GLuint last_tex_stage; /* Number of last enabled texture unit */
-
- struct vertex_buffer *VB;
-};
-
-
-
-
-
-
-struct i915_texture_object
-{
- struct intel_texture_object intel;
- GLenum lastTarget;
- GLboolean refs_border_color;
- GLuint Setup[I915_TEX_SETUP_SIZE];
-};
-
-#define I915_TEX_UNITS 8
-
-
-struct i915_hw_state {
- GLuint Ctx[I915_CTX_SETUP_SIZE];
- GLuint Buffer[I915_DEST_SETUP_SIZE];
- GLuint Stipple[I915_STP_SETUP_SIZE];
- GLuint Fog[I915_FOG_SETUP_SIZE];
- GLuint Tex[I915_TEX_UNITS][I915_TEX_SETUP_SIZE];
- GLuint Constant[I915_CONSTANT_SIZE];
- GLuint ConstantSize;
- GLuint Program[I915_PROGRAM_SIZE];
- GLuint ProgramSize;
- GLuint active; /* I915_UPLOAD_* */
- GLuint emitted; /* I915_UPLOAD_* */
-};
-
-#define I915_FOG_PIXEL 2
-#define I915_FOG_VERTEX 1
-#define I915_FOG_NONE 0
-
-struct i915_context
-{
- struct intel_context intel;
-
- GLuint last_ReallyEnabled;
- GLuint vertex_fog;
-
- struct i915_fragment_program tex_program;
- struct i915_fragment_program *current_program;
-
- struct i915_hw_state meta, initial, state, *current;
-};
-
-
-typedef struct i915_context *i915ContextPtr;
-typedef struct i915_texture_object *i915TextureObjectPtr;
-
-#define I915_CONTEXT(ctx) ((i915ContextPtr)(ctx))
-
-
-
-#define I915_STATECHANGE(i915, flag) \
-do { \
- if (0) fprintf(stderr, "I915_STATECHANGE %x in %s\n", flag, __FUNCTION__); \
- INTEL_FIREVERTICES( &(i915)->intel ); \
- (i915)->state.emitted &= ~(flag); \
-} while (0)
-
-#define I915_ACTIVESTATE(i915, flag, mode) \
-do { \
- if (0) fprintf(stderr, "I915_ACTIVESTATE %x %d in %s\n", \
- flag, mode, __FUNCTION__); \
- INTEL_FIREVERTICES( &(i915)->intel ); \
- if (mode) \
- (i915)->state.active |= (flag); \
- else \
- (i915)->state.active &= ~(flag); \
-} while (0)
-
-
-/*======================================================================
- * i915_vtbl.c
- */
-extern void i915InitVtbl( i915ContextPtr i915 );
-
-
-
-#define SZ_TO_HW(sz) ((sz-2)&0x3)
-#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1)
-#define EMIT_ATTR( ATTR, STYLE, S4, SZ ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = (ATTR); \
- intel->vertex_attrs[intel->vertex_attr_count].format = (STYLE); \
- s4 |= S4; \
- intel->vertex_attr_count++; \
- offset += (SZ); \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = 0; \
- intel->vertex_attrs[intel->vertex_attr_count].format = EMIT_PAD; \
- intel->vertex_attrs[intel->vertex_attr_count].offset = (N); \
- intel->vertex_attr_count++; \
- offset += (N); \
-} while (0)
-
-
-
-/*======================================================================
- * i915_context.c
- */
-extern GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-
-/*======================================================================
- * i915_texprog.c
- */
-extern void i915ValidateTextureProgram( i915ContextPtr i915 );
-
-
-/*======================================================================
- * i915_debug.c
- */
-extern void i915_disassemble_program( const GLuint *program, GLuint sz );
-extern void i915_print_ureg( const char *msg, GLuint ureg );
-
-
-/*======================================================================
- * i915_state.c
- */
-extern void i915InitStateFunctions( struct dd_function_table *functions );
-extern void i915InitState( i915ContextPtr i915 );
-extern void i915_update_fog( GLcontext *ctx );
-
-
-/*======================================================================
- * i915_tex.c
- */
-extern void i915UpdateTextureState( intelContextPtr intel );
-extern void i915InitTextureFuncs( struct dd_function_table *functions );
-extern intelTextureObjectPtr i915AllocTexObj( struct gl_texture_object *texObj );
-
-/*======================================================================
- * i915_metaops.c
- */
-extern GLboolean
-i915TryTextureReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels );
-
-extern GLboolean
-i915TryTextureDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels );
-
-extern void
-i915ClearWithTris( intelContextPtr intel, GLbitfield mask,
- GLboolean all, GLint cx, GLint cy, GLint cw, GLint ch);
-
-
-/*======================================================================
- * i915_fragprog.c
- */
-extern void i915ValidateFragmentProgram( i915ContextPtr i915 );
-extern void i915InitFragProgFuncs( struct dd_function_table *functions );
-
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_debug.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_debug.c
deleted file mode 100644
index 054b56160..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_debug.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "i915_reg.h"
-#include "i915_context.h"
-#include <stdio.h>
-
-
-static const char *opcodes[0x20] = {
- "NOP",
- "ADD",
- "MOV",
- "MUL",
- "MAD",
- "DP2ADD",
- "DP3",
- "DP4",
- "FRC",
- "RCP",
- "RSQ",
- "EXP",
- "LOG",
- "CMP",
- "MIN",
- "MAX",
- "FLR",
- "MOD",
- "TRC",
- "SGE",
- "SLT",
- "TEXLD",
- "TEXLDP",
- "TEXLDB",
- "TEXKILL",
- "DCL",
- "0x1a",
- "0x1b",
- "0x1c",
- "0x1d",
- "0x1e",
- "0x1f",
-};
-
-
-static const int args[0x20] = {
- 0, /* 0 nop */
- 2, /* 1 add */
- 1, /* 2 mov */
- 2, /* 3 m ul */
- 3, /* 4 mad */
- 3, /* 5 dp2add */
- 2, /* 6 dp3 */
- 2, /* 7 dp4 */
- 1, /* 8 frc */
- 1, /* 9 rcp */
- 1, /* a rsq */
- 1, /* b exp */
- 1, /* c log */
- 3, /* d cmp */
- 2, /* e min */
- 2, /* f max */
- 1, /* 10 flr */
- 1, /* 11 mod */
- 1, /* 12 trc */
- 2, /* 13 sge */
- 2, /* 14 slt */
- 1,
- 1,
- 1,
- 1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-
-static const char *regname[0x8] = {
- "R",
- "T",
- "CONST",
- "S",
- "OC",
- "OD",
- "U",
- "UNKNOWN",
-};
-
-static void print_reg_type_nr( GLuint type, GLuint nr )
-{
- switch (type) {
- case REG_TYPE_T:
- switch (nr) {
- case T_DIFFUSE: fprintf(stderr, "T_DIFFUSE"); return;
- case T_SPECULAR: fprintf(stderr, "T_SPECULAR"); return;
- case T_FOG_W: fprintf(stderr, "T_FOG_W"); return;
- default: fprintf(stderr, "T_TEX%d", nr); return;
- }
- case REG_TYPE_OC:
- if (nr == 0) {
- fprintf(stderr, "oC");
- return;
- }
- break;
- case REG_TYPE_OD:
- if (nr == 0) {
- fprintf(stderr, "oD");
- return;
- }
- break;
- default:
- break;
- }
-
- fprintf(stderr, "%s[%d]", regname[type], nr);
-}
-
-#define REG_SWIZZLE_MASK 0x7777
-#define REG_NEGATE_MASK 0x8888
-
-#define REG_SWIZZLE_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) | \
- (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) | \
- (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) | \
- (SRC_W << A2_SRC2_CHANNEL_W_SHIFT))
-
-
-static void print_reg_neg_swizzle( GLuint reg )
-{
- int i;
-
- if ((reg & REG_SWIZZLE_MASK) == REG_SWIZZLE_XYZW &&
- (reg & REG_NEGATE_MASK) == 0)
- return;
-
- fprintf(stderr, ".");
-
- for (i = 3 ; i >= 0; i--) {
- if (reg & (1<<((i*4)+3)))
- fprintf(stderr, "-");
-
- switch ((reg>>(i*4)) & 0x7) {
- case 0: fprintf(stderr, "x"); break;
- case 1: fprintf(stderr, "y"); break;
- case 2: fprintf(stderr, "z"); break;
- case 3: fprintf(stderr, "w"); break;
- case 4: fprintf(stderr, "0"); break;
- case 5: fprintf(stderr, "1"); break;
- default: fprintf(stderr, "?"); break;
- }
- }
-}
-
-
-static void print_src_reg( GLuint dword )
-{
- GLuint nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK;
- GLuint type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK;
- print_reg_type_nr( type, nr );
- print_reg_neg_swizzle( dword );
-}
-
-void i915_print_ureg( const char *msg, GLuint ureg )
-{
- fprintf(stderr, "%s: ", msg);
- print_src_reg( ureg >> 8 );
- fprintf(stderr, "\n");
-}
-
-static void print_dest_reg( GLuint dword )
-{
- GLuint nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK;
- GLuint type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK;
- print_reg_type_nr( type, nr );
- if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL)
- return;
- fprintf(stderr, ".");
- if (dword & A0_DEST_CHANNEL_X) fprintf(stderr, "x");
- if (dword & A0_DEST_CHANNEL_Y) fprintf(stderr, "y");
- if (dword & A0_DEST_CHANNEL_Z) fprintf(stderr, "z");
- if (dword & A0_DEST_CHANNEL_W) fprintf(stderr, "w");
-}
-
-
-#define GET_SRC0_REG(r0, r1) ((r0<<14)|(r1>>A1_SRC0_CHANNEL_W_SHIFT))
-#define GET_SRC1_REG(r0, r1) ((r0<<8)|(r1>>A2_SRC1_CHANNEL_W_SHIFT))
-#define GET_SRC2_REG(r) (r)
-
-
-static void print_arith_op( GLuint opcode, const GLuint *program )
-{
- if (opcode != A0_NOP) {
- print_dest_reg(program[0]);
- if (program[0] & A0_DEST_SATURATE)
- fprintf(stderr, " = SATURATE ");
- else
- fprintf(stderr, " = ");
- }
-
- fprintf(stderr, "%s ", opcodes[opcode]);
-
- print_src_reg(GET_SRC0_REG(program[0], program[1]));
- if (args[opcode] == 1) {
- fprintf(stderr, "\n");
- return;
- }
-
- fprintf(stderr, ", ");
- print_src_reg(GET_SRC1_REG(program[1], program[2]));
- if (args[opcode] == 2) {
- fprintf(stderr, "\n");
- return;
- }
-
- fprintf(stderr, ", ");
- print_src_reg(GET_SRC2_REG(program[2]));
- fprintf(stderr, "\n");
- return;
-}
-
-
-static void print_tex_op( GLuint opcode, const GLuint *program )
-{
- print_dest_reg(program[0] | A0_DEST_CHANNEL_ALL);
- fprintf(stderr, " = ");
-
- fprintf(stderr, "%s ", opcodes[opcode]);
-
- fprintf(stderr, "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 );
- fprintf(stderr, "\n");
-}
-
-static void print_dcl_op( GLuint opcode, const GLuint *program )
-{
- fprintf(stderr, "%s ", opcodes[opcode]);
- print_dest_reg(program[0] | A0_DEST_CHANNEL_ALL);
- fprintf(stderr, "\n");
-}
-
-
-void i915_disassemble_program( const GLuint *program, GLuint sz )
-{
- GLuint size = program[0] & 0x1ff;
- GLint i;
-
- fprintf(stderr, "BEGIN\n");
-
- if (size+2 != sz) {
- fprintf(stderr, "%s: program size mismatch %d/%d\n", __FUNCTION__,
- size+2, sz);
- exit(1);
- }
-
- program ++;
- for (i = 1 ; i < sz ; i+=3, program+=3) {
- GLuint opcode = program[0] & (0x1f<<24);
-
- if ((GLint) opcode >= A0_NOP && opcode <= A0_SLT)
- print_arith_op(opcode >> 24, program);
- else if (opcode >= T0_TEXLD && opcode <= T0_TEXKILL)
- print_tex_op(opcode >> 24, program);
- else if (opcode == D0_DCL)
- print_dcl_op(opcode >> 24, program);
- else
- fprintf(stderr, "Unknown opcode 0x%x\n", opcode);
- }
-
- fprintf(stderr, "END\n\n");
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_fragprog.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_fragprog.c
deleted file mode 100644
index b69252d2a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ /dev/null
@@ -1,1065 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_program.h"
-
-#include "nvfragprog.h"
-#include "program.h"
-#include "arbfragparse.h"
-
-
-
-#undef PI
-#define PI 3.141592
-
-
-/* 1, -1/3!, 1/5!, -1/7! */
-static const GLfloat sin_constants[4] = { 1.0,
- -1.0/(3*2*1),
- 1.0/(5*4*3*2*1),
- -1.0/(7*6*5*4*3*2*1) };
-
-/* 1, -1/2!, 1/4!, -1/6! */
-static const GLfloat cos_constants[4] = { 1.0,
- -1.0/(2*1),
- 1.0/(4*3*2*1),
- -1.0/(6*5*4*3*2*1) };
-
-/**
- * Retrieve a ureg for the given source register. Will emit
- * constants, apply swizzling and negation as needed.
- */
-static GLuint src_vector( struct i915_fragment_program *p,
- const struct fp_src_register *source,
- const struct fragment_program *program )
-{
- GLuint src;
-
- switch (source->File) {
-
- /* Registers:
- */
- case PROGRAM_TEMPORARY:
- if (source->Index >= I915_MAX_TEMPORARY) {
- i915_program_error( p, "Exceeded max temporary reg" );
- return 0;
- }
- src = UREG( REG_TYPE_R, source->Index );
- break;
- case PROGRAM_INPUT:
- switch (source->Index) {
- case FRAG_ATTRIB_WPOS:
- src = i915_emit_decl( p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL );
- break;
- case FRAG_ATTRIB_COL0:
- src = i915_emit_decl( p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL );
- break;
- case FRAG_ATTRIB_COL1:
- src = i915_emit_decl( p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ );
- src = swizzle( src, X, Y, Z, ONE );
- break;
- case FRAG_ATTRIB_FOGC:
- src = i915_emit_decl( p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W );
- src = swizzle( src, W, W, W, W );
- break;
- case FRAG_ATTRIB_TEX0:
- case FRAG_ATTRIB_TEX1:
- case FRAG_ATTRIB_TEX2:
- case FRAG_ATTRIB_TEX3:
- case FRAG_ATTRIB_TEX4:
- case FRAG_ATTRIB_TEX5:
- case FRAG_ATTRIB_TEX6:
- case FRAG_ATTRIB_TEX7:
- src = i915_emit_decl( p, REG_TYPE_T,
- T_TEX0 + (source->Index - FRAG_ATTRIB_TEX0),
- D0_CHANNEL_ALL );
- break;
-
- default:
- i915_program_error( p, "Bad source->Index" );
- return 0;
- }
- break;
-
- /* Various paramters and env values. All emitted to
- * hardware as program constants.
- */
- case PROGRAM_LOCAL_PARAM:
- src = i915_emit_param4fv(
- p, program->Base.LocalParams[source->Index]);
- break;
-
- case PROGRAM_ENV_PARAM:
- src = i915_emit_param4fv(
- p, p->ctx->FragmentProgram.Parameters[source->Index]);
- break;
-
- case PROGRAM_STATE_VAR:
- case PROGRAM_NAMED_PARAM:
- src = i915_emit_param4fv(
- p, program->Parameters->ParameterValues[source->Index] );
- break;
-
- default:
- i915_program_error( p, "Bad source->File" );
- return 0;
- }
-
- src = swizzle(src,
- GET_SWZ(source->Swizzle, 0),
- GET_SWZ(source->Swizzle, 1),
- GET_SWZ(source->Swizzle, 2),
- GET_SWZ(source->Swizzle, 3));
-
- if (source->NegateBase)
- src = negate( src, 1,1,1,1 );
-
- return src;
-}
-
-
-static GLuint get_result_vector( struct i915_fragment_program *p,
- const struct fp_instruction *inst )
-{
- switch (inst->DstReg.File) {
- case PROGRAM_OUTPUT:
- switch (inst->DstReg.Index) {
- case FRAG_OUTPUT_COLR:
- return UREG(REG_TYPE_OC, 0);
- case FRAG_OUTPUT_DEPR:
- p->depth_written = 1;
- return UREG(REG_TYPE_OD, 0);
- default:
- i915_program_error( p, "Bad inst->DstReg.Index" );
- return 0;
- }
- case PROGRAM_TEMPORARY:
- return UREG(REG_TYPE_R, inst->DstReg.Index);
- default:
- i915_program_error( p, "Bad inst->DstReg.File" );
- return 0;
- }
-}
-
-static GLuint get_result_flags( const struct fp_instruction *inst )
-{
- GLuint flags = 0;
-
- if (inst->Saturate) flags |= A0_DEST_SATURATE;
- if (inst->DstReg.WriteMask & WRITEMASK_X) flags |= A0_DEST_CHANNEL_X;
- if (inst->DstReg.WriteMask & WRITEMASK_Y) flags |= A0_DEST_CHANNEL_Y;
- if (inst->DstReg.WriteMask & WRITEMASK_Z) flags |= A0_DEST_CHANNEL_Z;
- if (inst->DstReg.WriteMask & WRITEMASK_W) flags |= A0_DEST_CHANNEL_W;
-
- return flags;
-}
-
-static GLuint translate_tex_src_idx( struct i915_fragment_program *p,
- GLubyte bit )
-{
- switch (bit) {
- case TEXTURE_1D_INDEX: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_2D_INDEX: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_RECT_INDEX: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_3D_INDEX: return D0_SAMPLE_TYPE_VOLUME;
- case TEXTURE_CUBE_INDEX: return D0_SAMPLE_TYPE_CUBE;
- default: i915_program_error(p, "TexSrcBit"); return 0;
- }
-}
-
-#define EMIT_TEX( OP ) \
-do { \
- GLuint dim = translate_tex_src_idx( p, inst->TexSrcIdx ); \
- GLuint sampler = i915_emit_decl(p, REG_TYPE_S, \
- inst->TexSrcUnit, dim); \
- GLuint coord = src_vector( p, &inst->SrcReg[0], program); \
- /* Texel lookup */ \
- \
- i915_emit_texld( p, \
- get_result_vector( p, inst ), \
- get_result_flags( inst ), \
- sampler, \
- coord, \
- OP); \
-} while (0)
-
-#define EMIT_ARITH( OP, N ) \
-do { \
- i915_emit_arith( p, \
- OP, \
- get_result_vector( p, inst ), \
- get_result_flags( inst ), 0, \
- (N<1)?0:src_vector( p, &inst->SrcReg[0], program), \
- (N<2)?0:src_vector( p, &inst->SrcReg[1], program), \
- (N<3)?0:src_vector( p, &inst->SrcReg[2], program)); \
-} while (0)
-
-#define EMIT_1ARG_ARITH( OP ) EMIT_ARITH( OP, 1 )
-#define EMIT_2ARG_ARITH( OP ) EMIT_ARITH( OP, 2 )
-#define EMIT_3ARG_ARITH( OP ) EMIT_ARITH( OP, 3 )
-
-
-/* Possible concerns:
- *
- * SIN, COS -- could use another taylor step?
- * LIT -- results seem a little different to sw mesa
- * LOG -- different to mesa on negative numbers, but this is conformant.
- *
- * Parse failures -- Mesa doesn't currently give a good indication
- * internally whether a particular program string parsed or not. This
- * can lead to confusion -- hopefully we cope with it ok now.
- *
- */
-static void upload_program( struct i915_fragment_program *p )
-{
- const struct fragment_program *program = p->ctx->FragmentProgram._Current;
- const struct fp_instruction *inst = program->Instructions;
-
-/* _mesa_debug_fp_inst(program->Base.NumInstructions, inst); */
-
- /* Is this a parse-failed program? Ensure a valid program is
- * loaded, as the flagging of an error isn't sufficient to stop
- * this being uploaded to hardware.
- */
- if (inst[0].Opcode == FP_OPCODE_END) {
- GLuint tmp = i915_get_utemp( p );
- i915_emit_arith( p,
- A0_MOV,
- UREG(REG_TYPE_OC, 0),
- A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp,ONE,ZERO,ONE,ONE), 0, 0);
- return;
- }
-
- while (1) {
- GLuint src0, src1, src2, flags;
- GLuint tmp = 0;
-
- switch (inst->Opcode) {
- case FP_OPCODE_ABS:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- i915_emit_arith( p,
- A0_MAX,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- src0, negate(src0, 1,1,1,1), 0);
- break;
-
- case FP_OPCODE_ADD:
- EMIT_2ARG_ARITH( A0_ADD );
- break;
-
- case FP_OPCODE_CMP:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- src2 = src_vector( p, &inst->SrcReg[2], program);
- i915_emit_arith( p,
- A0_CMP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- src0, src2, src1); /* NOTE: order of src2, src1 */
- break;
-
- case FP_OPCODE_COS:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- src0,
- i915_emit_const1f(p, 1.0/(PI * 2)),
- 0);
-
- i915_emit_arith( p,
- A0_MOD,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- 0, 0 );
-
- /* By choosing different taylor constants, could get rid of this mul:
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- i915_emit_const1f(p, (PI * 2)),
- 0);
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, 1
- * t0 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
- * result = DP4 t0, cos_constants
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X,X,ONE,ONE),
- swizzle(tmp, X,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,Y,X,ONE),
- swizzle(tmp, X,X,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,X,Z,ONE),
- swizzle(tmp, Z,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(tmp, ONE,Z,Y,X),
- i915_emit_const4fv( p, cos_constants ), 0);
-
- break;
-
- case FP_OPCODE_DP3:
- EMIT_2ARG_ARITH( A0_DP3 );
- break;
-
- case FP_OPCODE_DP4:
- EMIT_2ARG_ARITH( A0_DP4 );
- break;
-
- case FP_OPCODE_DPH:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0, X,Y,Z,ONE), src1, 0);
- break;
-
- case FP_OPCODE_DST:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
-
- /* result[0] = 1 * 1;
- * result[1] = a[1] * b[1];
- * result[2] = a[2] * 1;
- * result[3] = 1 * b[3];
- */
- i915_emit_arith( p,
- A0_MUL,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0, ONE, Y, Z, ONE),
- swizzle(src1, ONE, Y, ONE, W ),
- 0);
- break;
-
- case FP_OPCODE_EX2:
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_EXP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case FP_OPCODE_FLR:
- EMIT_1ARG_ARITH( A0_FLR );
- break;
-
- case FP_OPCODE_FRC:
- EMIT_1ARG_ARITH( A0_FRC );
- break;
-
- case FP_OPCODE_KIL:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_texld( p,
- tmp, A0_DEST_CHANNEL_ALL, /* use a dummy dest reg */
- 0,
- src0,
- T0_TEXKILL );
- break;
-
- case FP_OPCODE_LG2:
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_LOG,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case FP_OPCODE_LIT:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- /* tmp = max( a.xyzw, a.00zw )
- * XXX: Clamp tmp.w to -128..128
- * tmp.y = log(tmp.y)
- * tmp.y = tmp.w * tmp.y
- * tmp.y = exp(tmp.y)
- * result = cmp (a.11-x1, a.1x01, a.1xy1 )
- */
- i915_emit_arith( p, A0_MAX, tmp, A0_DEST_CHANNEL_ALL, 0,
- src0, swizzle(src0, ZERO, ZERO, Z, W), 0 );
-
- i915_emit_arith( p, A0_LOG, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, Y, Y, Y, Y), 0, 0 );
-
- i915_emit_arith( p, A0_MUL, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, ZERO, Y, ZERO, ZERO),
- swizzle(tmp, ZERO, W, ZERO, ZERO), 0 );
-
- i915_emit_arith( p, A0_EXP, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, Y, Y, Y, Y), 0, 0 );
-
- i915_emit_arith( p, A0_CMP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- negate(swizzle(tmp, ONE, ONE, X, ONE),0,0,1,0),
- swizzle(tmp, ONE, X, ZERO, ONE),
- swizzle(tmp, ONE, X, Y, ONE));
-
- break;
-
- case FP_OPCODE_LRP:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- src2 = src_vector( p, &inst->SrcReg[2], program);
- flags = get_result_flags( inst );
- tmp = i915_get_utemp( p );
-
- /* b*a + c*(1-a)
- *
- * b*a + c - ca
- *
- * tmp = b*a + c,
- * result = (-c)*a + tmp
- */
- i915_emit_arith( p, A0_MAD, tmp,
- flags & A0_DEST_CHANNEL_ALL, 0,
- src1, src0, src2 );
-
- i915_emit_arith( p, A0_MAD,
- get_result_vector( p, inst ),
- flags, 0,
- negate(src2, 1,1,1,1), src0, tmp );
- break;
-
- case FP_OPCODE_MAD:
- EMIT_3ARG_ARITH( A0_MAD );
- break;
-
- case FP_OPCODE_MAX:
- EMIT_2ARG_ARITH( A0_MAX );
- break;
-
- case FP_OPCODE_MIN:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- tmp = i915_get_utemp( p );
- flags = get_result_flags( inst );
-
- i915_emit_arith( p,
- A0_MAX,
- tmp, flags & A0_DEST_CHANNEL_ALL, 0,
- negate(src0,1,1,1,1),
- negate(src1,1,1,1,1), 0);
-
- i915_emit_arith( p,
- A0_MOV,
- get_result_vector( p, inst ),
- flags, 0,
- negate(tmp, 1,1,1,1), 0, 0);
- break;
-
- case FP_OPCODE_MOV:
- EMIT_1ARG_ARITH( A0_MOV );
- break;
-
- case FP_OPCODE_MUL:
- EMIT_2ARG_ARITH( A0_MUL );
- break;
-
- case FP_OPCODE_POW:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- tmp = i915_get_utemp( p );
- flags = get_result_flags( inst );
-
- /* XXX: masking on intermediate values, here and elsewhere.
- */
- i915_emit_arith( p,
- A0_LOG,
- tmp, A0_DEST_CHANNEL_X, 0,
- swizzle(src0,X,X,X,X), 0, 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp, src1, 0);
-
-
- i915_emit_arith( p,
- A0_EXP,
- get_result_vector( p, inst ),
- flags, 0,
- swizzle(tmp,X,X,X,X), 0, 0);
-
- break;
-
- case FP_OPCODE_RCP:
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_RCP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case FP_OPCODE_RSQ:
-
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_RSQ,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case FP_OPCODE_SCS:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
- * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
- * scs.x = DP4 t1, sin_constants
- * t1 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
- * scs.y = DP4 t1, cos_constants
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(src0, X,X,ONE,ONE),
- swizzle(src0, X,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,X,Y),
- swizzle(tmp, X,X,ONE,ONE), 0);
-
- if (inst->DstReg.WriteMask & WRITEMASK_Y) {
- GLuint tmp1;
-
- if (inst->DstReg.WriteMask & WRITEMASK_X)
- tmp1 = i915_get_utemp( p );
- else
- tmp1 = tmp;
-
- i915_emit_arith( p,
- A0_MUL,
- tmp1, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,Y,W),
- swizzle(tmp, X,Z,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp1, W,Z,Y,X),
- i915_emit_const4fv( p, sin_constants ), 0);
- }
-
- if (inst->DstReg.WriteMask & WRITEMASK_X) {
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,X,Z,ONE),
- swizzle(tmp, Z,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- A0_DEST_CHANNEL_X, 0,
- swizzle(tmp, ONE,Z,Y,X),
- i915_emit_const4fv( p, cos_constants ), 0);
- }
- break;
-
- case FP_OPCODE_SGE:
- EMIT_2ARG_ARITH( A0_SGE );
- break;
-
- case FP_OPCODE_SIN:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- src0,
- i915_emit_const1f(p, 1.0/(PI * 2)),
- 0);
-
- i915_emit_arith( p,
- A0_MOD,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- 0, 0 );
-
- /* By choosing different taylor constants, could get rid of this mul:
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- i915_emit_const1f(p, (PI * 2)),
- 0);
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
- * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
- * result = DP4 t1.wzyx, sin_constants
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X,X,ONE,ONE),
- swizzle(tmp, X,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,X,Y),
- swizzle(tmp, X,X,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,Y,W),
- swizzle(tmp, X,Z,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(tmp, W, Z, Y, X ),
- i915_emit_const4fv( p, sin_constants ), 0);
- break;
-
- case FP_OPCODE_SLT:
- EMIT_2ARG_ARITH( A0_SLT );
- break;
-
- case FP_OPCODE_SUB:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
-
- i915_emit_arith( p,
- A0_ADD,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- src0, negate(src1, 1,1,1,1), 0);
- break;
-
- case FP_OPCODE_SWZ:
- EMIT_1ARG_ARITH( A0_MOV ); /* extended swizzle handled natively */
- break;
-
- case FP_OPCODE_TEX:
- EMIT_TEX( T0_TEXLD );
- break;
-
- case FP_OPCODE_TXB:
- EMIT_TEX( T0_TEXLDB );
- break;
-
- case FP_OPCODE_TXP:
- EMIT_TEX( T0_TEXLDP );
- break;
-
- case FP_OPCODE_XPD:
- /* Cross product:
- * result.x = src0.y * src1.z - src0.z * src1.y;
- * result.y = src0.z * src1.x - src0.x * src1.z;
- * result.z = src0.x * src1.y - src0.y * src1.x;
- * result.w = undef;
- */
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(src0,Z,X,Y,ONE),
- swizzle(src1,Y,Z,X,ONE), 0);
-
- i915_emit_arith( p,
- A0_MAD,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,Y,Z,X,ONE),
- swizzle(src1,Z,X,Y,ONE),
- negate(tmp,1,1,1,0));
- break;
-
- case FP_OPCODE_END:
- return;
-
- default:
- i915_program_error( p, "bad opcode" );
- return;
- }
-
- inst++;
- i915_release_utemps( p );
- }
-}
-
-/* Rather than trying to intercept and jiggle depth writes during
- * emit, just move the value into its correct position at the end of
- * the program:
- */
-static void fixup_depth_write( struct i915_fragment_program *p )
-{
- if (p->depth_written) {
- GLuint depth = UREG(REG_TYPE_OD, 0);
-
- i915_emit_arith( p,
- A0_MOV,
- depth, A0_DEST_CHANNEL_W, 0,
- swizzle(depth,X,Y,Z,Z),
- 0, 0);
- }
-}
-
-
-#define FRAG_BIT_TEX(n) (FRAG_BIT_TEX0 << (n))
-
-
-static void check_wpos( struct i915_fragment_program *p )
-{
- GLuint inputs = p->FragProg.InputsRead;
- GLint i;
-
- p->wpos_tex = -1;
-
- for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
- if (inputs & FRAG_BIT_TEX(i))
- continue;
- else if (inputs & FRAG_BIT_WPOS) {
- p->wpos_tex = i;
- inputs &= ~FRAG_BIT_WPOS;
- }
- }
-
- if (inputs & FRAG_BIT_WPOS) {
- i915_program_error(p, "No free texcoord for wpos value");
- }
-}
-
-
-static void translate_program( struct i915_fragment_program *p )
-{
- i915ContextPtr i915 = I915_CONTEXT(p->ctx);
-
- i915_init_program( i915, p );
- check_wpos( p );
- upload_program( p );
- fixup_depth_write( p );
- i915_fini_program( p );
-
- p->translated = 1;
-}
-
-
-static void track_params( struct i915_fragment_program *p )
-{
- GLint i;
-
- if (p->nr_params)
- _mesa_load_state_parameters(p->ctx, p->FragProg.Parameters);
-
- for (i = 0; i < p->nr_params; i++) {
- GLint reg = p->param[i].reg;
- COPY_4V( p->constant[reg], p->param[i].values );
- }
-
- p->params_uptodate = 1;
- p->on_hardware = 0; /* overkill */
-}
-
-
-static void i915BindProgram( GLcontext *ctx,
- GLenum target,
- struct program *prog )
-{
- if (target == GL_FRAGMENT_PROGRAM_ARB) {
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
-
- if (i915->current_program == p)
- return;
-
- if (i915->current_program) {
- i915->current_program->on_hardware = 0;
- i915->current_program->params_uptodate = 0;
- }
-
- i915->current_program = p;
-
- assert(p->on_hardware == 0);
- assert(p->params_uptodate == 0);
-
- /* Hack: make sure fog is correctly enabled according to this
- * fragment program's fog options.
- */
- ctx->Driver.Enable( ctx, GL_FRAGMENT_PROGRAM_ARB,
- ctx->FragmentProgram.Enabled );
- }
-}
-
-static struct program *i915NewProgram( GLcontext *ctx,
- GLenum target,
- GLuint id )
-{
- switch (target) {
- case GL_VERTEX_PROGRAM_ARB:
- return _mesa_init_vertex_program( ctx, CALLOC_STRUCT(vertex_program),
- target, id );
-
- case GL_FRAGMENT_PROGRAM_ARB: {
- struct i915_fragment_program *prog = CALLOC_STRUCT(i915_fragment_program);
- if (prog) {
- i915_init_program( I915_CONTEXT(ctx), prog );
-
- return _mesa_init_fragment_program( ctx, &prog->FragProg,
- target, id );
- }
- else
- return NULL;
- }
-
- default:
- /* Just fallback:
- */
- return _mesa_new_program( ctx, target, id );
- }
-}
-
-static void i915DeleteProgram( GLcontext *ctx,
- struct program *prog )
-{
- if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
-
- if (i915->current_program == p)
- i915->current_program = 0;
- }
-
- _mesa_delete_program( ctx, prog );
-}
-
-
-static GLboolean i915IsProgramNative( GLcontext *ctx,
- GLenum target,
- struct program *prog )
-{
- if (target == GL_FRAGMENT_PROGRAM_ARB) {
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
-
- if (!p->translated)
- translate_program( p );
-
- return !p->error;
- }
- else
- return GL_TRUE;
-}
-
-static void i915ProgramStringNotify( GLcontext *ctx,
- GLenum target,
- struct program *prog )
-{
- if (target == GL_FRAGMENT_PROGRAM_ARB) {
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
- p->translated = 0;
-
- /* Hack: make sure fog is correctly enabled according to this
- * fragment program's fog options.
- */
- ctx->Driver.Enable( ctx, GL_FRAGMENT_PROGRAM_ARB,
- ctx->FragmentProgram.Enabled );
- }
-}
-
-
-void i915ValidateFragmentProgram( i915ContextPtr i915 )
-{
- GLcontext *ctx = &i915->intel.ctx;
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
-
- struct i915_fragment_program *p =
- (struct i915_fragment_program *)ctx->FragmentProgram._Current;
-
- GLuint inputsRead = p->FragProg.InputsRead;
- GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
- GLuint s2 = S2_TEXCOORD_NONE;
- int i, offset = 0;
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
-
- if (!p->translated)
- translate_program( p );
-
- intel->vertex_attr_count = 0;
- intel->wpos_offset = 0;
- intel->wpos_size = 0;
- intel->coloroffset = 0;
- intel->specoffset = 0;
-
- if (inputsRead & FRAG_BITS_TEX_ANY) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, S4_VFMT_XYZ, 12 );
- }
-
- if (inputsRead & FRAG_BIT_COL0) {
- intel->coloroffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4 );
- }
-
- if ((inputsRead & (FRAG_BIT_COL1|FRAG_BIT_FOGC)) ||
- i915->vertex_fog != I915_FOG_NONE) {
-
- if (inputsRead & FRAG_BIT_COL1) {
- intel->specoffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, S4_VFMT_SPEC_FOG, 3 );
- }
- else
- EMIT_PAD(3);
-
- if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, S4_VFMT_SPEC_FOG, 1 );
- else
- EMIT_PAD( 1 );
- }
-
-#if 0
- if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE) {
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4 );
- }
-#endif
-
- for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
- if (inputsRead & FRAG_BIT_TEX(i)) {
- int sz = VB->TexCoordPtr[i]->size;
-
- s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
- s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(sz));
-
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_SZ(sz), 0, sz * 4 );
- }
- else if (i == p->wpos_tex) {
-
- /* If WPOS is required, duplicate the XYZ position data in an
- * unused texture coordinate:
- */
- s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
- s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(3));
-
- intel->wpos_offset = offset;
- intel->wpos_size = 3 * sizeof(GLuint);
-
- EMIT_PAD( intel->wpos_size );
- }
- }
-
- if (s2 != i915->state.Ctx[I915_CTXREG_LIS2] ||
- s4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
-
- I915_STATECHANGE( i915, I915_UPLOAD_CTX );
-
- /* Must do this *after* statechange, so as not to affect
- * buffered vertices reliant on the old state:
- */
- intel->vertex_size = _tnl_install_attrs( &intel->ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->vertex_size >>= 2;
-
- i915->state.Ctx[I915_CTXREG_LIS2] = s2;
- i915->state.Ctx[I915_CTXREG_LIS4] = s4;
-
- assert(intel->vtbl.check_vertex_size( intel, intel->vertex_size ));
- }
-
- if (!p->params_uptodate)
- track_params( p );
-
- if (!p->on_hardware)
- i915_upload_program( i915, p );
-}
-
-void i915InitFragProgFuncs( struct dd_function_table *functions )
-{
- functions->BindProgram = i915BindProgram;
- functions->NewProgram = i915NewProgram;
- functions->DeleteProgram = i915DeleteProgram;
- functions->IsProgramNative = i915IsProgramNative;
- functions->ProgramStringNotify = i915ProgramStringNotify;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_metaops.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_metaops.c
deleted file mode 100644
index 2e9063edf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_metaops.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "utils.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-#include "intel_ioctl.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-/* A large amount of state doesn't need to be uploaded.
- */
-#define ACTIVE (I915_UPLOAD_PROGRAM | \
- I915_UPLOAD_STIPPLE | \
- I915_UPLOAD_CTX | \
- I915_UPLOAD_BUFFERS | \
- I915_UPLOAD_TEX(0))
-
-#define SET_STATE( i915, STATE ) \
-do { \
- i915->current->emitted &= ~ACTIVE; \
- i915->current = &i915->STATE; \
- i915->current->emitted &= ~ACTIVE; \
-} while (0)
-
-/* Operations where the 3D engine is decoupled temporarily from the
- * current GL state and used for other purposes than simply rendering
- * incoming triangles.
- */
-static void set_initial_state( i915ContextPtr i915 )
-{
- memcpy(&i915->meta, &i915->initial, sizeof(i915->meta) );
- i915->meta.active = ACTIVE;
- i915->meta.emitted = 0;
-}
-
-
-static void set_no_depth_stencil_write( i915ContextPtr i915 )
-{
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_FALSE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_FALSE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS6] &= ~(S6_DEPTH_TEST_ENABLE |
- S6_DEPTH_WRITE_ENABLE);
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-/* Set stencil unit to replace always with the reference value.
- */
-static void set_stencil_replace( i915ContextPtr i915,
- GLuint s_mask,
- GLuint s_clear)
-{
- GLuint op = STENCILOP_REPLACE;
- GLuint func = COMPAREFUNC_ALWAYS;
-
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_TRUE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS5] |= (S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
-
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_FALSE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS6] &= ~(S6_DEPTH_TEST_ENABLE |
- S6_DEPTH_WRITE_ENABLE);
-
-
- /* ctx->Driver.StencilMask( ctx, s_mask )
- */
- i915->meta.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
-
- i915->meta.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(s_mask));
-
-
- /* ctx->Driver.StencilOp( ctx, GL_REPLACE, GL_REPLACE, GL_REPLACE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_FAIL_MASK |
- S5_STENCIL_PASS_Z_FAIL_MASK |
- S5_STENCIL_PASS_Z_PASS_MASK);
-
- i915->meta.Ctx[I915_CTXREG_LIS5] |= ((op << S5_STENCIL_FAIL_SHIFT) |
- (op << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
- (op << S5_STENCIL_PASS_Z_PASS_SHIFT));
-
-
- /* ctx->Driver.StencilFunc( ctx, GL_ALWAYS, s_ref, ~0 )
- */
- i915->meta.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i915->meta.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff));
-
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_REF_MASK |
- S5_STENCIL_TEST_FUNC_MASK);
-
- i915->meta.Ctx[I915_CTXREG_LIS5] |= ((s_clear << S5_STENCIL_REF_SHIFT) |
- (func << S5_STENCIL_TEST_FUNC_SHIFT));
-
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-
-static void set_color_mask( i915ContextPtr i915, GLboolean state )
-{
- const GLuint mask = (S5_WRITEDISABLE_RED |
- S5_WRITEDISABLE_GREEN |
- S5_WRITEDISABLE_BLUE |
- S5_WRITEDISABLE_ALPHA);
-
- /* Copy colormask state from "regular" hw context.
- */
- if (state) {
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~mask;
- i915->meta.Ctx[I915_CTXREG_LIS5] |=
- (i915->state.Ctx[I915_CTXREG_LIS5] & mask);
- }
- else
- i915->meta.Ctx[I915_CTXREG_LIS5] |= mask;
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-
-
-
-#define REG( type, nr ) (((type)<<5)|(nr))
-
-#define REG_R(x) REG(REG_TYPE_R, x)
-#define REG_T(x) REG(REG_TYPE_T, x)
-#define REG_CONST(x) REG(REG_TYPE_CONST, x)
-#define REG_S(x) REG(REG_TYPE_S, x)
-#define REG_OC REG(REG_TYPE_OC, 0)
-#define REG_OD REG(REG_TYPE_OD, 0)
-#define REG_U(x) REG(REG_TYPE_U, x)
-
-#define REG_T_DIFFUSE REG(REG_TYPE_T, T_DIFFUSE)
-#define REG_T_SPECULAR REG(REG_TYPE_T, T_SPECULAR)
-#define REG_T_FOG_W REG(REG_TYPE_T, T_FOG_W)
-#define REG_T_TEX(x) REG(REG_TYPE_T, x)
-
-
-#define A0_DEST_REG( reg ) ( (reg) << A0_DEST_NR_SHIFT )
-#define A0_SRC0_REG( reg ) ( (reg) << A0_SRC0_NR_SHIFT )
-#define A1_SRC1_REG( reg ) ( (reg) << A1_SRC1_NR_SHIFT )
-#define A1_SRC2_REG( reg ) ( (reg) << A1_SRC2_NR_SHIFT )
-#define A2_SRC2_REG( reg ) ( (reg) << A2_SRC2_NR_SHIFT )
-#define D0_DECL_REG( reg ) ( (reg) << D0_NR_SHIFT )
-#define T0_DEST_REG( reg ) ( (reg) << T0_DEST_NR_SHIFT )
-
-#define T0_SAMPLER( unit ) ((unit)<<T0_SAMPLER_NR_SHIFT)
-
-#define T1_ADDRESS_REG( type, nr ) (((type)<<T1_ADDRESS_REG_TYPE_SHIFT)| \
- ((nr)<<T1_ADDRESS_REG_NR_SHIFT))
-
-
-#define A1_SRC0_XYZW ((SRC_X << A1_SRC0_CHANNEL_X_SHIFT) | \
- (SRC_Y << A1_SRC0_CHANNEL_Y_SHIFT) | \
- (SRC_Z << A1_SRC0_CHANNEL_Z_SHIFT) | \
- (SRC_W << A1_SRC0_CHANNEL_W_SHIFT))
-
-#define A1_SRC1_XY ((SRC_X << A1_SRC1_CHANNEL_X_SHIFT) | \
- (SRC_Y << A1_SRC1_CHANNEL_Y_SHIFT))
-
-#define A2_SRC1_ZW ((SRC_Z << A2_SRC1_CHANNEL_Z_SHIFT) | \
- (SRC_W << A2_SRC1_CHANNEL_W_SHIFT))
-
-#define A2_SRC2_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) | \
- (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) | \
- (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) | \
- (SRC_W << A2_SRC2_CHANNEL_W_SHIFT))
-
-
-
-
-
-static void set_no_texture( i915ContextPtr i915 )
-{
- static const GLuint prog[] = {
- _3DSTATE_PIXEL_SHADER_PROGRAM,
-
- /* Declare incoming diffuse color:
- */
- (D0_DCL |
- D0_DECL_REG( REG_T_DIFFUSE ) |
- D0_CHANNEL_ALL),
- D1_MBZ,
- D2_MBZ,
-
- /* output-color = mov(t_diffuse)
- */
- (A0_MOV |
- A0_DEST_REG( REG_OC ) |
- A0_DEST_CHANNEL_ALL |
- A0_SRC0_REG( REG_T_DIFFUSE )),
- (A1_SRC0_XYZW),
- 0,
- };
-
-
- memcpy( i915->meta.Program, prog, sizeof(prog) );
- i915->meta.ProgramSize = sizeof(prog) / sizeof(*prog);
- i915->meta.Program[0] |= i915->meta.ProgramSize - 2;
- i915->meta.emitted &= ~I915_UPLOAD_PROGRAM;
-}
-
-#if 0
-static void enable_texture_blend_replace( i915ContextPtr i915 )
-{
- static const GLuint prog[] = {
- _3DSTATE_PIXEL_SHADER_PROGRAM,
-
- /* Declare the sampler:
- */
- (D0_DCL |
- D0_DECL_REG( REG_S(0) ) |
- D0_SAMPLE_TYPE_2D |
- D0_CHANNEL_NONE),
- D1_MBZ,
- D2_MBZ,
-
- /* Declare the interpolated texture coordinate:
- */
- (D0_DCL |
- D0_DECL_REG( REG_T_TEX(0) ) |
- D0_CHANNEL_ALL),
- D1_MBZ,
- D2_MBZ,
-
- /* output-color = texld(sample0, texcoord0)
- */
- (T0_TEXLD |
- T0_DEST_REG( REG_OC ) |
- T0_SAMPLER( 0 )),
- T1_ADDRESS_REG(REG_TYPE_T, 0),
- T2_MBZ
- };
-
- memcpy( i915->meta.Program, prog, sizeof(prog) );
- i915->meta.ProgramSize = sizeof(prog) / sizeof(*prog);
- i915->meta.Program[0] |= i915->meta.ProgramSize - 2;
- i915->meta.emitted &= ~I915_UPLOAD_PROGRAM;
-}
-
-
-
-
-
-/* Set up an arbitary piece of memory as a rectangular texture
- * (including the front or back buffer).
- */
-static void set_tex_rect_source( i915ContextPtr i915,
- GLuint offset,
- GLuint width,
- GLuint height,
- GLuint pitch,
- GLuint textureFormat )
-{
- GLuint unit = 0;
- GLint numLevels = 1;
- GLuint *state = i915->meta.Tex[0];
-
- pitch *= i915->intel.intelScreen->cpp;
-
-/* fprintf(stderr, "%s: offset: %x w: %d h: %d pitch %d format %x\n", */
-/* __FUNCTION__, offset, width, height, pitch, textureFormat ); */
-
- state[I915_TEXREG_MS2] = offset;
- state[I915_TEXREG_MS3] = (((height - 1) << MS3_HEIGHT_SHIFT) |
- ((width - 1) << MS3_WIDTH_SHIFT) |
- textureFormat |
- MS3_USE_FENCE_REGS);
-
- state[I915_TEXREG_MS4] = ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) |
- MS4_CUBE_FACE_ENA_MASK |
- ((((numLevels-1) * 4)) << MS4_MAX_LOD_SHIFT));
-
- state[I915_TEXREG_SS2] = ((FILTER_NEAREST << SS2_MIN_FILTER_SHIFT) |
- (MIPFILTER_NONE << SS2_MIP_FILTER_SHIFT) |
- (FILTER_NEAREST << SS2_MAG_FILTER_SHIFT));
- state[I915_TEXREG_SS3] = ((TEXCOORDMODE_WRAP << SS3_TCX_ADDR_MODE_SHIFT) |
- (TEXCOORDMODE_WRAP << SS3_TCY_ADDR_MODE_SHIFT) |
- (TEXCOORDMODE_WRAP << SS3_TCZ_ADDR_MODE_SHIFT) |
- (unit<<SS3_TEXTUREMAP_INDEX_SHIFT));
-
- state[I915_TEXREG_SS4] = 0;
-
- i915->meta.emitted &= ~I915_UPLOAD_TEX(0);
-}
-#endif
-
-/* Select between front and back draw buffers.
- */
-static void set_draw_offset( i915ContextPtr i915,
- GLuint offset )
-{
- i915->meta.Buffer[I915_DESTREG_CBUFADDR2] = offset;
- i915->meta.emitted &= ~I915_UPLOAD_BUFFERS;
-}
-
-#if 0
-/* Setup an arbitary draw format, useful for targeting texture or agp
- * memory.
- */
-static void set_draw_format( i915ContextPtr i915,
- GLuint format,
- GLuint depth_format)
-{
- i915->meta.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- format |
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- depth_format);
-
- i915->meta.emitted &= ~I915_UPLOAD_BUFFERS;
-/* fprintf(stderr, "%s: DV1: %x\n", */
-/* __FUNCTION__, i915->meta.Buffer[I915_DESTREG_DV1]); */
-}
-#endif
-
-static void set_vertex_format( i915ContextPtr i915 )
-{
- i915->meta.Ctx[I915_CTXREG_LIS2] =
- (S2_TEXCOORD_FMT(0, TEXCOORDFMT_2D) |
- S2_TEXCOORD_FMT(1, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(2, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(3, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(4, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(5, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(6, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(7, TEXCOORDFMT_NOT_PRESENT));
-
- i915->meta.Ctx[I915_CTXREG_LIS4] &= ~S4_VFMT_MASK;
-
- i915->meta.Ctx[I915_CTXREG_LIS4] |=
- (S4_VFMT_COLOR |
- S4_VFMT_SPEC_FOG |
- S4_VFMT_XYZW);
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-
-}
-
-
-static void draw_quad(i915ContextPtr i915,
- GLfloat x0, GLfloat x1,
- GLfloat y0, GLfloat y1,
- GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha,
- GLfloat s0, GLfloat s1,
- GLfloat t0, GLfloat t1 )
-{
- GLuint vertex_size = 8;
- GLuint *vb = intelEmitInlinePrimitiveLocked( &i915->intel,
- PRIM3D_TRIFAN,
- 4 * vertex_size,
- vertex_size );
- intelVertex tmp;
- int i;
-
- if (0)
- fprintf(stderr, "%s: %f,%f-%f,%f 0x%x%x%x%x %f,%f-%f,%f\n",
- __FUNCTION__,
- x0,y0,x1,y1,red,green,blue,alpha,s0,t0,s1,t1);
-
-
- /* initial vertex, left bottom */
- tmp.v.x = x0;
- tmp.v.y = y0;
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
- tmp.v.u0 = s0;
- tmp.v.v0 = t0;
-
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- /* right bottom */
- vb += vertex_size;
- tmp.v.x = x1;
- tmp.v.u0 = s1;
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- /* right top */
- vb += vertex_size;
- tmp.v.y = y1;
- tmp.v.v0 = t1;
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- /* left top */
- vb += vertex_size;
- tmp.v.x = x0;
- tmp.v.u0 = s0;
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-}
-
-void
-i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- i915ContextPtr i915 = I915_CONTEXT( intel );
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- intelScreenPrivate *screen = intel->intelScreen;
- int x0, y0, x1, y1;
-
- SET_STATE( i915, meta );
- set_initial_state( i915 );
- set_no_texture( i915 );
- set_vertex_format( i915 );
-
- LOCK_HARDWARE(intel);
-
- if(!all) {
- x0 = cx;
- y0 = cy;
- x1 = x0 + cw;
- y1 = y0 + ch;
- } else {
- x0 = 0;
- y0 = 0;
- x1 = x0 + dPriv->w;
- y1 = y0 + dPriv->h;
- }
-
- /* Don't do any clipping to screen - these are window coordinates.
- * The active cliprects will be applied as for any other geometry.
- */
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- set_no_depth_stencil_write( i915 );
- set_color_mask( i915, GL_TRUE );
- set_draw_offset( i915, screen->frontOffset );
-
- draw_quad(i915, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-
- if (mask & BUFFER_BIT_BACK_LEFT) {
- set_no_depth_stencil_write( i915 );
- set_color_mask( i915, GL_TRUE );
- set_draw_offset( i915, screen->backOffset );
-
- draw_quad(i915, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-
- if (mask & BUFFER_BIT_STENCIL) {
- set_stencil_replace( i915,
- intel->ctx.Stencil.WriteMask[0],
- intel->ctx.Stencil.Clear);
-
- set_color_mask( i915, GL_FALSE );
- set_draw_offset( i915, screen->frontOffset ); /* could be either? */
-
- draw_quad( i915, x0, x1, y0, y1, 0, 0, 0, 0, 0, 0, 0, 0 );
- }
-
- UNLOCK_HARDWARE(intel);
-
- SET_STATE( i915, state );
-}
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.c
deleted file mode 100644
index cf3ebc171..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 <strings.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_program.h"
-
-
-#define A0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define D0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define T0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define A0_SRC0( reg ) (((reg)&UREG_MASK)>>UREG_A0_SRC0_SHIFT_LEFT)
-#define A1_SRC0( reg ) (((reg)&UREG_MASK)<<UREG_A1_SRC0_SHIFT_RIGHT)
-#define A1_SRC1( reg ) (((reg)&UREG_MASK)>>UREG_A1_SRC1_SHIFT_LEFT)
-#define A2_SRC1( reg ) (((reg)&UREG_MASK)<<UREG_A2_SRC1_SHIFT_RIGHT)
-#define A2_SRC2( reg ) (((reg)&UREG_MASK)>>UREG_A2_SRC2_SHIFT_LEFT)
-
-/* These are special, and don't have swizzle/negate bits.
- */
-#define T0_SAMPLER( reg ) (GET_UREG_NR(reg)<<T0_SAMPLER_NR_SHIFT)
-#define T1_ADDRESS_REG( reg ) ((GET_UREG_NR(reg)<<T1_ADDRESS_REG_NR_SHIFT) | \
- (GET_UREG_TYPE(reg)<<T1_ADDRESS_REG_TYPE_SHIFT))
-
-
-/* Macros for translating UREG's into the various register fields used
- * by the I915 programmable unit.
- */
-#define UREG_A0_DEST_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_DEST_TYPE_SHIFT)
-#define UREG_A0_SRC0_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_SRC0_TYPE_SHIFT)
-#define UREG_A1_SRC0_SHIFT_RIGHT (A1_SRC0_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT)
-#define UREG_A1_SRC1_SHIFT_LEFT (UREG_TYPE_SHIFT - A1_SRC1_TYPE_SHIFT)
-#define UREG_A2_SRC1_SHIFT_RIGHT (A2_SRC1_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT)
-#define UREG_A2_SRC2_SHIFT_LEFT (UREG_TYPE_SHIFT - A2_SRC2_TYPE_SHIFT)
-
-#define UREG_MASK 0xffffff00
-#define UREG_TYPE_NR_MASK ((REG_TYPE_MASK << UREG_TYPE_SHIFT) | \
- (REG_NR_MASK << UREG_NR_SHIFT))
-
-
-#define I915_CONSTFLAG_PARAM 0x1f
-
-GLuint i915_get_temp( struct i915_fragment_program *p )
-{
- int bit = ffs( ~p->temp_flag );
- if (!bit) {
- fprintf(stderr, "%s: out of temporaries\n", __FILE__);
- exit(1);
- }
-
- p->temp_flag |= 1<<(bit-1);
- return UREG(REG_TYPE_R, (bit-1));
-}
-
-
-GLuint i915_get_utemp( struct i915_fragment_program *p )
-{
- int bit = ffs( ~p->utemp_flag );
- if (!bit) {
- fprintf(stderr, "%s: out of temporaries\n", __FILE__);
- exit(1);
- }
-
- p->utemp_flag |= 1<<(bit-1);
- return UREG(REG_TYPE_U, (bit-1));
-}
-
-void i915_release_utemps( struct i915_fragment_program *p )
-{
- p->utemp_flag = ~0x7;
-}
-
-
-GLuint i915_emit_decl( struct i915_fragment_program *p,
- GLuint type, GLuint nr, GLuint d0_flags )
-{
- GLuint reg = UREG(type, nr);
-
- if (type == REG_TYPE_T) {
- if (p->decl_t & (1<<nr))
- return reg;
-
- p->decl_t |= (1<<nr);
- }
- else if (type == REG_TYPE_S) {
- if (p->decl_s & (1<<nr))
- return reg;
-
- p->decl_s |= (1<<nr);
- }
- else
- return reg;
-
- *(p->decl++) = (D0_DCL | D0_DEST( reg ) | d0_flags);
- *(p->decl++) = D1_MBZ;
- *(p->decl++) = D2_MBZ;
-
- p->nr_decl_insn++;
- return reg;
-}
-
-GLuint i915_emit_arith( struct i915_fragment_program *p,
- GLuint op,
- GLuint dest,
- GLuint mask,
- GLuint saturate,
- GLuint src0,
- GLuint src1,
- GLuint src2 )
-{
- GLuint c[3];
- GLuint nr_const = 0;
-
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
-
- if (GET_UREG_TYPE(src0) == REG_TYPE_CONST) c[nr_const++] = 0;
- if (GET_UREG_TYPE(src1) == REG_TYPE_CONST) c[nr_const++] = 1;
- if (GET_UREG_TYPE(src2) == REG_TYPE_CONST) c[nr_const++] = 2;
-
- /* Recursively call this function to MOV additional const values
- * into temporary registers. Use utemp registers for this -
- * currently shouldn't be possible to run out, but keep an eye on
- * this.
- */
- if (nr_const > 1) {
- GLuint s[3], first, i, old_utemp_flag;
-
- s[0] = src0;
- s[1] = src1;
- s[2] = src2;
- old_utemp_flag = p->utemp_flag;
-
- first = GET_UREG_NR(s[c[0]]);
- for (i = 1 ; i < nr_const ; i++) {
- if (GET_UREG_NR(s[c[i]]) != first) {
- GLuint tmp = i915_get_utemp(p);
-
- i915_emit_arith( p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0,
- s[c[i]], 0, 0 );
- s[c[i]] = tmp;
- }
- }
-
- src0 = s[0];
- src1 = s[1];
- src2 = s[2];
- p->utemp_flag = old_utemp_flag; /* restore */
- }
-
- *(p->csr++) = (op |
- A0_DEST( dest ) |
- mask |
- saturate |
- A0_SRC0( src0 ));
- *(p->csr++) = (A1_SRC0( src0 ) |
- A1_SRC1( src1 ));
- *(p->csr++) = (A2_SRC1( src1 ) |
- A2_SRC2( src2 ));
-
- p->nr_alu_insn++;
- return dest;
-}
-
-GLuint i915_emit_texld( struct i915_fragment_program *p,
- GLuint dest,
- GLuint destmask,
- GLuint sampler,
- GLuint coord,
- GLuint op )
-{
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
-
- if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
- p->nr_tex_indirect++;
- }
-
- *(p->csr++) = (op |
- T0_DEST( dest ) |
- destmask |
- T0_SAMPLER( sampler ));
-
- *(p->csr++) = T1_ADDRESS_REG( coord );
- *(p->csr++) = T2_MBZ;
-
- p->nr_tex_insn++;
- return dest;
-}
-
-
-GLuint i915_emit_const1f( struct i915_fragment_program *p, GLfloat c0 )
-{
- GLint reg, idx;
-
- if (c0 == 0.0) return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO);
- if (c0 == 1.0) return swizzle(UREG(REG_TYPE_R, 0), ONE, ONE, ONE, ONE );
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == I915_CONSTFLAG_PARAM)
- continue;
- for (idx = 0; idx < 4; idx++) {
- if (!(p->constant_flags[reg] & (1<<idx)) ||
- p->constant[reg][idx] == c0) {
- p->constant[reg][idx] = c0;
- p->constant_flags[reg] |= 1<<idx;
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return swizzle(UREG(REG_TYPE_CONST, reg),idx,ZERO,ZERO,ONE);
- }
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-GLuint i915_emit_const2f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1 )
-{
- GLint reg, idx;
-
- if (c0 == 0.0) return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W);
- if (c0 == 1.0) return swizzle(i915_emit_const1f(p, c1), ONE, X, Z, W);
-
- if (c1 == 0.0) return swizzle(i915_emit_const1f(p, c0), X, ZERO, Z, W);
- if (c1 == 1.0) return swizzle(i915_emit_const1f(p, c0), X, ONE, Z, W);
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0xf ||
- p->constant_flags[reg] == I915_CONSTFLAG_PARAM)
- continue;
- for (idx = 0; idx < 3; idx++) {
- if (!(p->constant_flags[reg] & (3<<idx))) {
- p->constant[reg][idx] = c0;
- p->constant[reg][idx+1] = c1;
- p->constant_flags[reg] |= 3<<idx;
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return swizzle(UREG(REG_TYPE_CONST, reg),idx,idx+1,ZERO,ONE);
- }
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-
-
-GLuint i915_emit_const4f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1, GLfloat c2, GLfloat c3 )
-{
- GLint reg;
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0xf &&
- p->constant[reg][0] == c0 &&
- p->constant[reg][1] == c1 &&
- p->constant[reg][2] == c2 &&
- p->constant[reg][3] == c3) {
- return UREG(REG_TYPE_CONST, reg);
- }
- else if (p->constant_flags[reg] == 0) {
- p->constant[reg][0] = c0;
- p->constant[reg][1] = c1;
- p->constant[reg][2] = c2;
- p->constant[reg][3] = c3;
- p->constant_flags[reg] = 0xf;
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return UREG(REG_TYPE_CONST, reg);
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-
-GLuint i915_emit_const4fv( struct i915_fragment_program *p, const GLfloat *c )
-{
- return i915_emit_const4f( p, c[0], c[1], c[2], c[3] );
-}
-
-
-GLuint i915_emit_param4fv( struct i915_fragment_program *p,
- const GLfloat *values )
-{
- GLint reg, i;
-
- for (i = 0; i < p->nr_params; i++) {
- if (p->param[i].values == values)
- return UREG(REG_TYPE_CONST, p->param[i].reg);
- }
-
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0) {
- p->constant_flags[reg] = I915_CONSTFLAG_PARAM;
- i = p->nr_params++;
-
- p->param[i].values = values;
- p->param[i].reg = reg;
- p->params_uptodate = 0;
-
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return UREG(REG_TYPE_CONST, reg);
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-
-
-
-void i915_program_error( struct i915_fragment_program *p, const GLubyte *msg )
-{
- fprintf(stderr, "%s\n", msg);
- p->error = 1;
-}
-
-void i915_init_program( i915ContextPtr i915, struct i915_fragment_program *p )
-{
- GLcontext *ctx = &i915->intel.ctx;
- TNLcontext *tnl = TNL_CONTEXT( ctx );
-
- p->translated = 0;
- p->params_uptodate = 0;
- p->on_hardware = 0;
- p->error = 0;
-
- p->nr_tex_indirect = 1; /* correct? */
- p->nr_tex_insn = 0;
- p->nr_alu_insn = 0;
- p->nr_decl_insn = 0;
-
- p->ctx = ctx;
- memset( p->constant_flags, 0, sizeof(p->constant_flags) );
-
- p->nr_constants = 0;
- p->csr = p->program;
- p->decl = p->declarations;
- p->decl_s = 0;
- p->decl_t = 0;
- p->temp_flag = 0xffff000;
- p->utemp_flag = ~0x7;
- p->wpos_tex = -1;
- p->depth_written = 0;
- p->nr_params = 0;
-
- p->src_texture = UREG_BAD;
- p->src_previous = UREG(REG_TYPE_T, T_DIFFUSE);
- p->last_tex_stage = 0;
- p->VB = &tnl->vb;
-
- *(p->decl++) = _3DSTATE_PIXEL_SHADER_PROGRAM;
-}
-
-
-void i915_fini_program( struct i915_fragment_program *p )
-{
- GLuint program_size = p->csr - p->program;
- GLuint decl_size = p->decl - p->declarations;
-
- if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT)
- i915_program_error(p, "Exceeded max nr indirect texture lookups");
-
- if (p->nr_tex_insn > I915_MAX_TEX_INSN)
- i915_program_error(p, "Exceeded max TEX instructions");
-
- if (p->nr_alu_insn > I915_MAX_ALU_INSN)
- i915_program_error(p, "Exceeded max ALU instructions");
-
- if (p->nr_decl_insn > I915_MAX_DECL_INSN)
- i915_program_error(p, "Exceeded max DECL instructions");
-
- p->declarations[0] |= program_size + decl_size - 2;
-}
-
-void i915_upload_program( i915ContextPtr i915, struct i915_fragment_program *p )
-{
- GLuint program_size = p->csr - p->program;
- GLuint decl_size = p->decl - p->declarations;
-
- FALLBACK( &i915->intel, I915_FALLBACK_PROGRAM, p->error );
-
- /* Could just go straight to the batchbuffer from here:
- */
- if (i915->state.ProgramSize != (program_size + decl_size) ||
- memcmp(i915->state.Program + decl_size, p->program,
- program_size*sizeof(int)) != 0) {
- I915_STATECHANGE( i915, I915_UPLOAD_PROGRAM );
- memcpy(i915->state.Program, p->declarations, decl_size*sizeof(int));
- memcpy(i915->state.Program + decl_size, p->program,
- program_size*sizeof(int));
- i915->state.ProgramSize = decl_size + program_size;
- }
-
- /* Always seemed to get a failure if I used memcmp() to
- * shortcircuit this state upload. Needs further investigation?
- */
- if (p->nr_constants) {
- GLuint nr = p->nr_constants;
-
- I915_ACTIVESTATE( i915, I915_UPLOAD_CONSTANTS, 1 );
- I915_STATECHANGE( i915, I915_UPLOAD_CONSTANTS );
-
- i915->state.Constant[0] = _3DSTATE_PIXEL_SHADER_CONSTANTS | ((nr) * 4);
- i915->state.Constant[1] = (1<<(nr-1)) | ((1<<(nr-1))-1);
-
- memcpy(&i915->state.Constant[2], p->constant, 4*sizeof(int)*(nr));
- i915->state.ConstantSize = 2 + (nr) * 4;
-
- if (0) {
- GLuint i;
- for (i = 0; i < nr; i++) {
- fprintf(stderr, "const[%d]: %f %f %f %f\n", i,
- p->constant[i][0],
- p->constant[i][1],
- p->constant[i][2],
- p->constant[i][3]);
- }
- }
- }
- else {
- I915_ACTIVESTATE( i915, I915_UPLOAD_CONSTANTS, 0 );
- }
-
- p->on_hardware = 1;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.h
deleted file mode 100644
index c53ebead6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_program.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-
-#ifndef I915_PROGRAM_H
-#define I915_PROGRAM_H
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-
-/* Having zero and one in here makes the definition of swizzle a lot
- * easier.
- */
-#define UREG_TYPE_SHIFT 29
-#define UREG_NR_SHIFT 24
-#define UREG_CHANNEL_X_NEGATE_SHIFT 23
-#define UREG_CHANNEL_X_SHIFT 20
-#define UREG_CHANNEL_Y_NEGATE_SHIFT 19
-#define UREG_CHANNEL_Y_SHIFT 16
-#define UREG_CHANNEL_Z_NEGATE_SHIFT 15
-#define UREG_CHANNEL_Z_SHIFT 12
-#define UREG_CHANNEL_W_NEGATE_SHIFT 11
-#define UREG_CHANNEL_W_SHIFT 8
-#define UREG_CHANNEL_ZERO_NEGATE_MBZ 5
-#define UREG_CHANNEL_ZERO_SHIFT 4
-#define UREG_CHANNEL_ONE_NEGATE_MBZ 1
-#define UREG_CHANNEL_ONE_SHIFT 0
-
-#define UREG_BAD 0xffffffff /* not a valid ureg */
-
-#define X SRC_X
-#define Y SRC_Y
-#define Z SRC_Z
-#define W SRC_W
-#define ZERO SRC_ZERO
-#define ONE SRC_ONE
-
-/* Construct a ureg:
- */
-#define UREG( type, nr ) (((type)<< UREG_TYPE_SHIFT) | \
- ((nr) << UREG_NR_SHIFT) | \
- (X << UREG_CHANNEL_X_SHIFT) | \
- (Y << UREG_CHANNEL_Y_SHIFT) | \
- (Z << UREG_CHANNEL_Z_SHIFT) | \
- (W << UREG_CHANNEL_W_SHIFT) | \
- (ZERO << UREG_CHANNEL_ZERO_SHIFT) | \
- (ONE << UREG_CHANNEL_ONE_SHIFT))
-
-#define GET_CHANNEL_SRC( reg, channel ) ((reg<<(channel*4)) & (0xf<<20))
-#define CHANNEL_SRC( src, channel ) (src>>(channel*4))
-
-#define GET_UREG_TYPE(reg) (((reg)>>UREG_TYPE_SHIFT)&REG_TYPE_MASK)
-#define GET_UREG_NR(reg) (((reg)>>UREG_NR_SHIFT)&REG_NR_MASK)
-
-
-
-#define UREG_XYZW_CHANNEL_MASK 0x00ffff00
-
-/* One neat thing about the UREG representation:
- */
-static __inline int swizzle( int reg, int x, int y, int z, int w )
-{
- return ((reg & ~UREG_XYZW_CHANNEL_MASK) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, x ), 0 ) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, y ), 1 ) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, z ), 2 ) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, w ), 3 ));
-}
-
-/* Another neat thing about the UREG representation:
- */
-static __inline int negate( int reg, int x, int y, int z, int w )
-{
- return reg ^ (((x&1)<<UREG_CHANNEL_X_NEGATE_SHIFT)|
- ((y&1)<<UREG_CHANNEL_Y_NEGATE_SHIFT)|
- ((z&1)<<UREG_CHANNEL_Z_NEGATE_SHIFT)|
- ((w&1)<<UREG_CHANNEL_W_NEGATE_SHIFT));
-}
-
-
-extern GLuint i915_get_temp( struct i915_fragment_program *p );
-extern GLuint i915_get_utemp( struct i915_fragment_program *p );
-extern void i915_release_utemps( struct i915_fragment_program *p );
-
-
-extern GLuint i915_emit_texld( struct i915_fragment_program *p,
- GLuint dest,
- GLuint destmask,
- GLuint sampler,
- GLuint coord,
- GLuint op );
-
-extern GLuint i915_emit_arith( struct i915_fragment_program *p,
- GLuint op,
- GLuint dest,
- GLuint mask,
- GLuint saturate,
- GLuint src0,
- GLuint src1,
- GLuint src2 );
-
-extern GLuint i915_emit_decl( struct i915_fragment_program *p,
- GLuint type, GLuint nr, GLuint d0_flags );
-
-
-extern GLuint i915_emit_const1f( struct i915_fragment_program *p,
- GLfloat c0 );
-
-extern GLuint i915_emit_const2f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1 );
-
-extern GLuint i915_emit_const4fv( struct i915_fragment_program *p,
- const GLfloat *c );
-
-extern GLuint i915_emit_const4f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1,
- GLfloat c2, GLfloat c3 );
-
-
-extern GLuint i915_emit_param4fv( struct i915_fragment_program *p,
- const GLfloat *values );
-
-extern void i915_program_error( struct i915_fragment_program *p,
- const GLubyte *msg );
-
-extern void i915_init_program( i915ContextPtr i915,
- struct i915_fragment_program *p );
-
-extern void i915_upload_program( i915ContextPtr i915,
- struct i915_fragment_program *p );
-
-extern void i915_fini_program( struct i915_fragment_program *p );
-
-
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_reg.h
deleted file mode 100644
index 3241b36b6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_reg.h
+++ /dev/null
@@ -1,833 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-
-#ifndef _I915_REG_H_
-#define _I915_REG_H_
-
-
-#include "intel_reg.h"
-
-#define I915_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#define CMD_3D (0x3<<29)
-
-#define PRIM3D_INLINE (CMD_3D | (0x1f<<24))
-#define PRIM3D_TRILIST (0x0<<18)
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-#define PRIM3D_CLEAR_RECT (0xa<<18)
-#define PRIM3D_ZONE_INIT (0xd<<18)
-#define PRIM3D_MASK (0x1f<<18)
-
-/* p137 */
-#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24))
-#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
-#define AA_LINE_ECAAR_WIDTH_0_5 0
-#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
-#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
-#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
-#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
-#define AA_LINE_REGION_WIDTH_0_5 0
-#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
-#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
-#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
-
-/* 3DSTATE_BACKFACE_STENCIL_OPS, p138*/
-#define _3DSTATE_BACKFACE_STENCIL_OPS (CMD_3D | (0x8<<24))
-#define BFO_ENABLE_STENCIL_REF (1<<23)
-#define BFO_STENCIL_REF_SHIFT 15
-#define BFO_STENCIL_REF_MASK (0xff<<15)
-#define BFO_ENABLE_STENCIL_FUNCS (1<<14)
-#define BFO_STENCIL_TEST_SHIFT 11
-#define BFO_STENCIL_TEST_MASK (0x7<<11)
-#define BFO_STENCIL_FAIL_SHIFT 8
-#define BFO_STENCIL_FAIL_MASK (0x7<<8)
-#define BFO_STENCIL_PASS_Z_FAIL_SHIFT 5
-#define BFO_STENCIL_PASS_Z_FAIL_MASK (0x7<<5)
-#define BFO_STENCIL_PASS_Z_PASS_SHIFT 2
-#define BFO_STENCIL_PASS_Z_PASS_MASK (0x7<<2)
-#define BFO_ENABLE_STENCIL_TWO_SIDE (1<<1)
-#define BFO_STENCIL_TWO_SIDE (1<<0)
-
-
-/* 3DSTATE_BACKFACE_STENCIL_MASKS, p140 */
-#define _3DSTATE_BACKFACE_STENCIL_MASKS (CMD_3D | (0x9<<24))
-#define BFM_ENABLE_STENCIL_TEST_MASK (1<<17)
-#define BFM_ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define BFM_STENCIL_TEST_MASK_SHIFT 8
-#define BFM_STENCIL_TEST_MASK_MASK (0xff<<8)
-#define BFM_STENCIL_WRITE_MASK_SHIFT 0
-#define BFM_STENCIL_WRITE_MASK_MASK (0xff<<0)
-
-
-
-/* 3DSTATE_BIN_CONTROL p141 */
-
-/* p143 */
-#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
-/* Dword 1 */
-#define BUF_3D_ID_COLOR_BACK (0x3<<24)
-#define BUF_3D_ID_DEPTH (0x7<<24)
-#define BUF_3D_USE_FENCE (1<<23)
-#define BUF_3D_TILED_SURFACE (1<<22)
-#define BUF_3D_TILE_WALK_X 0
-#define BUF_3D_TILE_WALK_Y (1<<21)
-#define BUF_3D_PITCH(x) (((x)/4)<<2)
-/* Dword 2 */
-#define BUF_3D_ADDR(x) ((x) & ~0x3)
-
-
-/* 3DSTATE_CHROMA_KEY */
-
-/* 3DSTATE_CLEAR_PARAMETERS, p150 */
-
-/* 3DSTATE_CONSTANT_BLEND_COLOR, p153 */
-#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
-
-
-
-/* 3DSTATE_COORD_SET_BINDINGS, p154 */
-#define _3DSTATE_COORD_SET_BINDINGS (CMD_3D | (0x16<<24))
-#define CSB_TCB(iunit, eunit) ((eunit)<<(iunit*3))
-
-/* p156 */
-#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
-
-/* p157 */
-#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
-
-/* p158 */
-#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
-
-
-/* 3DSTATE_DEPTH_OFFSET_SCALE, p159 */
-#define _3DSTATE_DEPTH_OFFSET_SCALE (CMD_3D | (0x1d<<24) | (0x97<<16))
-/* scale in dword 1 */
-
-
-/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */
-#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<19) | 0x2)
-
-/* p161 */
-#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
-/* Dword 1 */
-#define TEX_DEFAULT_COLOR_OGL (0<<30)
-#define TEX_DEFAULT_COLOR_D3D (1<<30)
-#define ZR_EARLY_DEPTH (1<<29)
-#define LOD_PRECLAMP_OGL (1<<28)
-#define LOD_PRECLAMP_D3D (0<<28)
-#define DITHER_FULL_ALWAYS (0<<26)
-#define DITHER_FULL_ON_FB_BLEND (1<<26)
-#define DITHER_CLAMPED_ALWAYS (2<<26)
-#define LINEAR_GAMMA_BLEND_32BPP (1<<25)
-#define DEBUG_DISABLE_ENH_DITHER (1<<24)
-#define DSTORG_HORT_BIAS(x) ((x)<<20)
-#define DSTORG_VERT_BIAS(x) ((x)<<16)
-#define COLOR_4_2_2_CHNL_WRT_ALL 0
-#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
-#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
-#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
-#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
-#define COLR_BUF_8BIT 0
-#define COLR_BUF_RGB555 (1<<8)
-#define COLR_BUF_RGB565 (2<<8)
-#define COLR_BUF_ARGB8888 (3<<8)
-#define DEPTH_FRMT_16_FIXED 0
-#define DEPTH_FRMT_16_FLOAT (1<<2)
-#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
-#define VERT_LINE_STRIDE_1 (1<<1)
-#define VERT_LINE_STRIDE_0 (0<<1)
-#define VERT_LINE_STRIDE_OFS_1 1
-#define VERT_LINE_STRIDE_OFS_0 0
-
-/* p166 */
-#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
-/* Dword 1 */
-#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
-#define DRAW_DITHER_OFS_X(x) ((x)<<26)
-#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
-/* Dword 2 */
-#define DRAW_YMIN(x) ((x)<<16)
-#define DRAW_XMIN(x) (x)
-/* Dword 3 */
-#define DRAW_YMAX(x) ((x)<<16)
-#define DRAW_XMAX(x) (x)
-/* Dword 4 */
-#define DRAW_YORG(x) ((x)<<16)
-#define DRAW_XORG(x) (x)
-
-
-/* 3DSTATE_FILTER_COEFFICIENTS_4X4, p170 */
-
-/* 3DSTATE_FILTER_COEFFICIENTS_6X5, p172 */
-
-
-/* _3DSTATE_FOG_COLOR, p173 */
-#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
-#define FOG_COLOR_RED(x) ((x)<<16)
-#define FOG_COLOR_GREEN(x) ((x)<<8)
-#define FOG_COLOR_BLUE(x) (x)
-
-/* _3DSTATE_FOG_MODE, p174 */
-#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
-/* Dword 1 */
-#define FMC1_FOGFUNC_MODIFY_ENABLE (1<<31)
-#define FMC1_FOGFUNC_VERTEX (0<<28)
-#define FMC1_FOGFUNC_PIXEL_EXP (1<<28)
-#define FMC1_FOGFUNC_PIXEL_EXP2 (2<<28)
-#define FMC1_FOGFUNC_PIXEL_LINEAR (3<<28)
-#define FMC1_FOGFUNC_MASK (3<<28)
-#define FMC1_FOGINDEX_MODIFY_ENABLE (1<<27)
-#define FMC1_FOGINDEX_Z (0<<25)
-#define FMC1_FOGINDEX_W (1<<25)
-#define FMC1_C1_C2_MODIFY_ENABLE (1<<24)
-#define FMC1_DENSITY_MODIFY_ENABLE (1<<23)
-#define FMC1_C1_ONE (1<<13)
-#define FMC1_C1_MASK (0xffff<<4)
-/* Dword 2 */
-#define FMC2_C2_ONE (1<<16)
-/* Dword 3 */
-#define FMC3_D_ONE (1<<16)
-
-
-
-/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p177 */
-#define _3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
-#define IAB_MODIFY_ENABLE (1<<23)
-#define IAB_ENABLE (1<<22)
-#define IAB_MODIFY_FUNC (1<<21)
-#define IAB_FUNC_SHIFT 16
-#define IAB_MODIFY_SRC_FACTOR (1<<11)
-#define IAB_SRC_FACTOR_SHIFT 6
-#define IAB_SRC_FACTOR_MASK (BLENDFACT_MASK<<6)
-#define IAB_MODIFY_DST_FACTOR (1<<5)
-#define IAB_DST_FACTOR_SHIFT 0
-#define IAB_DST_FACTOR_MASK (BLENDFACT_MASK<<0)
-
-
-#define BLENDFUNC_ADD 0x0
-#define BLENDFUNC_SUBTRACT 0x1
-#define BLENDFUNC_REVERSE_SUBTRACT 0x2
-#define BLENDFUNC_MIN 0x3
-#define BLENDFUNC_MAX 0x4
-#define BLENDFUNC_MASK 0x7
-
-/* 3DSTATE_LOAD_INDIRECT, p180 */
-
-#define _3DSTATE_LOAD_INDIRECT (CMD_3D|(0x1d<<24)|(0x7<<16))
-#define LI0_STATE_STATIC_INDIRECT (0x01<<8)
-#define LI0_STATE_DYNAMIC_INDIRECT (0x02<<8)
-#define LI0_STATE_SAMPLER (0x04<<8)
-#define LI0_STATE_MAP (0x08<<8)
-#define LI0_STATE_PROGRAM (0x10<<8)
-#define LI0_STATE_CONSTANTS (0x20<<8)
-
-#define SIS0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define SIS0_FORCE_LOAD (1<<1)
-#define SIS0_BUFFER_VALID (1<<0)
-#define SIS1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define DIS0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define DIS0_BUFFER_RESET (1<<1)
-#define DIS0_BUFFER_VALID (1<<0)
-
-#define SSB0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define SSB0_FORCE_LOAD (1<<1)
-#define SSB0_BUFFER_VALID (1<<0)
-#define SSB1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define MSB0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define MSB0_FORCE_LOAD (1<<1)
-#define MSB0_BUFFER_VALID (1<<0)
-#define MSB1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define PSP0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define PSP0_FORCE_LOAD (1<<1)
-#define PSP0_BUFFER_VALID (1<<0)
-#define PSP1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define PSC0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define PSC0_FORCE_LOAD (1<<1)
-#define PSC0_BUFFER_VALID (1<<0)
-#define PSC1_BUFFER_LENGTH(x) ((x)&0xff)
-
-
-
-
-
-/* _3DSTATE_RASTERIZATION_RULES */
-#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
-#define ENABLE_POINT_RASTER_RULE (1<<15)
-#define OGL_POINT_RASTER_RULE (1<<13)
-#define ENABLE_TEXKILL_3D_4D (1<<10)
-#define TEXKILL_3D (0<<9)
-#define TEXKILL_4D (1<<9)
-#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
-#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
-#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
-#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
-
-/* _3DSTATE_SCISSOR_ENABLE, p256 */
-#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
-#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
-#define DISABLE_SCISSOR_RECT (1<<1)
-
-/* _3DSTATE_SCISSOR_RECTANGLE_0, p257 */
-#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
-/* Dword 1 */
-#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMIN(x) (x)
-/* Dword 2 */
-#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMAX(x) (x)
-
-/* p189 */
-#define _3DSTATE_LOAD_STATE_IMMEDIATE_1 ((0x3<<29)|(0x1d<<24)|(0x04<<16))
-#define I1_LOAD_S(n) (1<<(4+n))
-
-#define S0_VB_OFFSET_MASK 0xffffffc
-#define S0_AUTO_CACHE_INV_DISABLE (1<<0)
-
-#define S1_VERTEX_WIDTH_SHIFT 24
-#define S1_VERTEX_WIDTH_MASK (0x3f<<24)
-#define S1_VERTEX_PITCH_SHIFT 16
-#define S1_VERTEX_PITCH_MASK (0x3f<<16)
-
-#define TEXCOORDFMT_2D 0x0
-#define TEXCOORDFMT_3D 0x1
-#define TEXCOORDFMT_4D 0x2
-#define TEXCOORDFMT_1D 0x3
-#define TEXCOORDFMT_2D_16 0x4
-#define TEXCOORDFMT_4D_16 0x5
-#define TEXCOORDFMT_NOT_PRESENT 0xf
-#define S2_TEXCOORD_FMT0_MASK 0xf
-#define S2_TEXCOORD_FMT1_SHIFT 4
-#define S2_TEXCOORD_FMT(unit, type) ((type)<<(unit*4))
-#define S2_TEXCOORD_NONE (~0)
-
-/* S3 not interesting */
-
-#define S4_POINT_WIDTH_SHIFT 23
-#define S4_POINT_WIDTH_MASK (0x1ff<<23)
-#define S4_LINE_WIDTH_SHIFT 19
-#define S4_LINE_WIDTH_ONE (0x2<<19)
-#define S4_LINE_WIDTH_MASK (0xf<<19)
-#define S4_FLATSHADE_ALPHA (1<<18)
-#define S4_FLATSHADE_FOG (1<<17)
-#define S4_FLATSHADE_SPECULAR (1<<16)
-#define S4_FLATSHADE_COLOR (1<<15)
-#define S4_CULLMODE_BOTH (0<<13)
-#define S4_CULLMODE_NONE (1<<13)
-#define S4_CULLMODE_CW (2<<13)
-#define S4_CULLMODE_CCW (3<<13)
-#define S4_CULLMODE_MASK (3<<13)
-#define S4_VFMT_POINT_WIDTH (1<<12)
-#define S4_VFMT_SPEC_FOG (1<<11)
-#define S4_VFMT_COLOR (1<<10)
-#define S4_VFMT_DEPTH_OFFSET (1<<9)
-#define S4_VFMT_XYZ (1<<6)
-#define S4_VFMT_XYZW (2<<6)
-#define S4_VFMT_XY (3<<6)
-#define S4_VFMT_XYW (4<<6)
-#define S4_VFMT_XYZW_MASK (7<<6)
-#define S4_FORCE_DEFAULT_DIFFUSE (1<<5)
-#define S4_FORCE_DEFAULT_SPECULAR (1<<4)
-#define S4_LOCAL_DEPTH_OFFSET_ENABLE (1<<3)
-#define S4_VFMT_FOG_PARAM (1<<2)
-#define S4_SPRITE_POINT_ENABLE (1<<1)
-#define S4_LINE_ANTIALIAS_ENABLE (1<<0)
-
-#define S4_VFMT_MASK (S4_VFMT_POINT_WIDTH | \
- S4_VFMT_SPEC_FOG | \
- S4_VFMT_COLOR | \
- S4_VFMT_DEPTH_OFFSET | \
- S4_VFMT_XYZW_MASK | \
- S4_VFMT_FOG_PARAM)
-
-
-#define S5_WRITEDISABLE_ALPHA (1<<31)
-#define S5_WRITEDISABLE_RED (1<<30)
-#define S5_WRITEDISABLE_GREEN (1<<29)
-#define S5_WRITEDISABLE_BLUE (1<<28)
-#define S5_WRITEDISABLE_MASK (0xf<<28)
-#define S5_FORCE_DEFAULT_POINT_SIZE (1<<27)
-#define S5_LAST_PIXEL_ENABLE (1<<26)
-#define S5_GLOBAL_DEPTH_OFFSET_ENABLE (1<<25)
-#define S5_FOG_ENABLE (1<<24)
-#define S5_STENCIL_REF_SHIFT 16
-#define S5_STENCIL_REF_MASK (0xff<<16)
-#define S5_STENCIL_TEST_FUNC_SHIFT 13
-#define S5_STENCIL_TEST_FUNC_MASK (0x7<<13)
-#define S5_STENCIL_FAIL_SHIFT 10
-#define S5_STENCIL_FAIL_MASK (0x7<<10)
-#define S5_STENCIL_PASS_Z_FAIL_SHIFT 7
-#define S5_STENCIL_PASS_Z_FAIL_MASK (0x7<<7)
-#define S5_STENCIL_PASS_Z_PASS_SHIFT 4
-#define S5_STENCIL_PASS_Z_PASS_MASK (0x7<<4)
-#define S5_STENCIL_WRITE_ENABLE (1<<3)
-#define S5_STENCIL_TEST_ENABLE (1<<2)
-#define S5_COLOR_DITHER_ENABLE (1<<1)
-#define S5_LOGICOP_ENABLE (1<<0)
-
-
-#define S6_ALPHA_TEST_ENABLE (1<<31)
-#define S6_ALPHA_TEST_FUNC_SHIFT 28
-#define S6_ALPHA_TEST_FUNC_MASK (0x7<<28)
-#define S6_ALPHA_REF_SHIFT 20
-#define S6_ALPHA_REF_MASK (0xff<<20)
-#define S6_DEPTH_TEST_ENABLE (1<<19)
-#define S6_DEPTH_TEST_FUNC_SHIFT 16
-#define S6_DEPTH_TEST_FUNC_MASK (0x7<<16)
-#define S6_CBUF_BLEND_ENABLE (1<<15)
-#define S6_CBUF_BLEND_FUNC_SHIFT 12
-#define S6_CBUF_BLEND_FUNC_MASK (0x7<<12)
-#define S6_CBUF_SRC_BLEND_FACT_SHIFT 8
-#define S6_CBUF_SRC_BLEND_FACT_MASK (0xf<<8)
-#define S6_CBUF_DST_BLEND_FACT_SHIFT 4
-#define S6_CBUF_DST_BLEND_FACT_MASK (0xf<<4)
-#define S6_DEPTH_WRITE_ENABLE (1<<3)
-#define S6_COLOR_WRITE_ENABLE (1<<2)
-#define S6_TRISTRIP_PV_SHIFT 0
-#define S6_TRISTRIP_PV_MASK (0x3<<0)
-
-#define S7_DEPTH_OFFSET_CONST_MASK ~0
-
-/* 3DSTATE_MAP_DEINTERLACER_PARAMETERS */
-/* 3DSTATE_MAP_PALETTE_LOAD_32, p206 */
-
-
-/* _3DSTATE_MODES_4, p218 */
-#define _3DSTATE_MODES_4_CMD (CMD_3D|(0x0d<<24))
-#define ENABLE_LOGIC_OP_FUNC (1<<23)
-#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK (0xf<<18)
-#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
-#define ENABLE_STENCIL_TEST_MASK (1<<17)
-#define STENCIL_TEST_MASK(x) ((x)<<8)
-#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
-#define ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define STENCIL_WRITE_MASK(x) (x)
-
-/* _3DSTATE_MODES_5, p220 */
-#define _3DSTATE_MODES_5_CMD (CMD_3D|(0x0c<<24))
-#define PIPELINE_FLUSH_RENDER_CACHE (1<<18)
-#define PIPELINE_FLUSH_TEXTURE_CACHE (1<<16)
-
-
-/* p221 */
-#define _3DSTATE_PIXEL_SHADER_CONSTANTS (CMD_3D|(0x1d<<24)|(0x6<<16))
-#define PS1_REG(n) (1<<(n))
-#define PS2_CONST_X(n) (n)
-#define PS3_CONST_Y(n) (n)
-#define PS4_CONST_Z(n) (n)
-#define PS5_CONST_W(n) (n)
-
-/* p222 */
-
-
-#define I915_MAX_TEX_INDIRECT 4
-#define I915_MAX_TEX_INSN 32
-#define I915_MAX_ALU_INSN 64
-#define I915_MAX_DECL_INSN 27
-#define I915_MAX_TEMPORARY 16
-
-
-/* Each instruction is 3 dwords long, though most don't require all
- * this space. Maximum of 123 instructions. Smaller maxes per insn
- * type.
- */
-#define _3DSTATE_PIXEL_SHADER_PROGRAM (CMD_3D|(0x1d<<24)|(0x5<<16))
-
-#define REG_TYPE_R 0 /* temporary regs, no need to
- * dcl, must be written before
- * read -- Preserved between
- * phases.
- */
-#define REG_TYPE_T 1 /* Interpolated values, must be
- * dcl'ed before use.
- *
- * 0..7: texture coord,
- * 8: diffuse spec,
- * 9: specular color,
- * 10: fog parameter in w.
- */
-#define REG_TYPE_CONST 2 /* Restriction: only one const
- * can be referenced per
- * instruction, though it may be
- * selected for multiple inputs.
- * Constants not initialized
- * default to zero.
- */
-#define REG_TYPE_S 3 /* sampler */
-#define REG_TYPE_OC 4 /* output color (rgba) */
-#define REG_TYPE_OD 5 /* output depth (w), xyz are
- * temporaries. If not written,
- * interpolated depth is used?
- */
-#define REG_TYPE_U 6 /* unpreserved temporaries */
-#define REG_TYPE_MASK 0x7
-#define REG_NR_MASK 0xf
-
-
-/* REG_TYPE_T:
- */
-#define T_TEX0 0
-#define T_TEX1 1
-#define T_TEX2 2
-#define T_TEX3 3
-#define T_TEX4 4
-#define T_TEX5 5
-#define T_TEX6 6
-#define T_TEX7 7
-#define T_DIFFUSE 8
-#define T_SPECULAR 9
-#define T_FOG_W 10 /* interpolated fog is in W coord */
-
-/* Arithmetic instructions */
-
-/* .replicate_swizzle == selection and replication of a particular
- * scalar channel, ie., .xxxx, .yyyy, .zzzz or .wwww
- */
-#define A0_NOP (0x0<<24) /* no operation */
-#define A0_ADD (0x1<<24) /* dst = src0 + src1 */
-#define A0_MOV (0x2<<24) /* dst = src0 */
-#define A0_MUL (0x3<<24) /* dst = src0 * src1 */
-#define A0_MAD (0x4<<24) /* dst = src0 * src1 + src2 */
-#define A0_DP2ADD (0x5<<24) /* dst.xyzw = src0.xy dot src1.xy + src2.replicate_swizzle */
-#define A0_DP3 (0x6<<24) /* dst.xyzw = src0.xyz dot src1.xyz */
-#define A0_DP4 (0x7<<24) /* dst.xyzw = src0.xyzw dot src1.xyzw */
-#define A0_FRC (0x8<<24) /* dst = src0 - floor(src0) */
-#define A0_RCP (0x9<<24) /* dst.xyzw = 1/(src0.replicate_swizzle) */
-#define A0_RSQ (0xa<<24) /* dst.xyzw = 1/(sqrt(abs(src0.replicate_swizzle))) */
-#define A0_EXP (0xb<<24) /* dst.xyzw = exp2(src0.replicate_swizzle) */
-#define A0_LOG (0xc<<24) /* dst.xyzw = log2(abs(src0.replicate_swizzle)) */
-#define A0_CMP (0xd<<24) /* dst = (src0 >= 0.0) ? src1 : src2 */
-#define A0_MIN (0xe<<24) /* dst = (src0 < src1) ? src0 : src1 */
-#define A0_MAX (0xf<<24) /* dst = (src0 >= src1) ? src0 : src1 */
-#define A0_FLR (0x10<<24) /* dst = floor(src0) */
-#define A0_MOD (0x11<<24) /* dst = src0 fmod 1.0 */
-#define A0_TRC (0x12<<24) /* dst = int(src0) */
-#define A0_SGE (0x13<<24) /* dst = src0 >= src1 ? 1.0 : 0.0 */
-#define A0_SLT (0x14<<24) /* dst = src0 < src1 ? 1.0 : 0.0 */
-#define A0_DEST_SATURATE (1<<22)
-#define A0_DEST_TYPE_SHIFT 19
-/* Allow: R, OC, OD, U */
-#define A0_DEST_NR_SHIFT 14
-/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
-#define A0_DEST_CHANNEL_X (1<<10)
-#define A0_DEST_CHANNEL_Y (2<<10)
-#define A0_DEST_CHANNEL_Z (4<<10)
-#define A0_DEST_CHANNEL_W (8<<10)
-#define A0_DEST_CHANNEL_ALL (0xf<<10)
-#define A0_DEST_CHANNEL_SHIFT 10
-#define A0_SRC0_TYPE_SHIFT 7
-#define A0_SRC0_NR_SHIFT 2
-
-#define A0_DEST_CHANNEL_XY (A0_DEST_CHANNEL_X|A0_DEST_CHANNEL_Y)
-#define A0_DEST_CHANNEL_XYZ (A0_DEST_CHANNEL_XY|A0_DEST_CHANNEL_Z)
-
-
-#define SRC_X 0
-#define SRC_Y 1
-#define SRC_Z 2
-#define SRC_W 3
-#define SRC_ZERO 4
-#define SRC_ONE 5
-
-#define A1_SRC0_CHANNEL_X_NEGATE (1<<31)
-#define A1_SRC0_CHANNEL_X_SHIFT 28
-#define A1_SRC0_CHANNEL_Y_NEGATE (1<<27)
-#define A1_SRC0_CHANNEL_Y_SHIFT 24
-#define A1_SRC0_CHANNEL_Z_NEGATE (1<<23)
-#define A1_SRC0_CHANNEL_Z_SHIFT 20
-#define A1_SRC0_CHANNEL_W_NEGATE (1<<19)
-#define A1_SRC0_CHANNEL_W_SHIFT 16
-#define A1_SRC1_TYPE_SHIFT 13
-#define A1_SRC1_NR_SHIFT 8
-#define A1_SRC1_CHANNEL_X_NEGATE (1<<7)
-#define A1_SRC1_CHANNEL_X_SHIFT 4
-#define A1_SRC1_CHANNEL_Y_NEGATE (1<<3)
-#define A1_SRC1_CHANNEL_Y_SHIFT 0
-
-#define A2_SRC1_CHANNEL_Z_NEGATE (1<<31)
-#define A2_SRC1_CHANNEL_Z_SHIFT 28
-#define A2_SRC1_CHANNEL_W_NEGATE (1<<27)
-#define A2_SRC1_CHANNEL_W_SHIFT 24
-#define A2_SRC2_TYPE_SHIFT 21
-#define A2_SRC2_NR_SHIFT 16
-#define A2_SRC2_CHANNEL_X_NEGATE (1<<15)
-#define A2_SRC2_CHANNEL_X_SHIFT 12
-#define A2_SRC2_CHANNEL_Y_NEGATE (1<<11)
-#define A2_SRC2_CHANNEL_Y_SHIFT 8
-#define A2_SRC2_CHANNEL_Z_NEGATE (1<<7)
-#define A2_SRC2_CHANNEL_Z_SHIFT 4
-#define A2_SRC2_CHANNEL_W_NEGATE (1<<3)
-#define A2_SRC2_CHANNEL_W_SHIFT 0
-
-
-
-/* Texture instructions */
-#define T0_TEXLD (0x15<<24) /* Sample texture using predeclared
- * sampler and address, and output
- * filtered texel data to destination
- * register */
-#define T0_TEXLDP (0x16<<24) /* Same as texld but performs a
- * perspective divide of the texture
- * coordinate .xyz values by .w before
- * sampling. */
-#define T0_TEXLDB (0x17<<24) /* Same as texld but biases the
- * computed LOD by w. Only S4.6 two's
- * comp is used. This implies that a
- * float to fixed conversion is
- * done. */
-#define T0_TEXKILL (0x18<<24) /* Does not perform a sampling
- * operation. Simply kills the pixel
- * if any channel of the address
- * register is < 0.0. */
-#define T0_DEST_TYPE_SHIFT 19
-/* Allow: R, OC, OD, U */
-/* Note: U (unpreserved) regs do not retain their values between
- * phases (cannot be used for feedback)
- *
- * Note: oC and OD registers can only be used as the destination of a
- * texture instruction once per phase (this is an implementation
- * restriction).
- */
-#define T0_DEST_NR_SHIFT 14
-/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
-#define T0_SAMPLER_NR_SHIFT 0 /* This field ignored for TEXKILL */
-#define T0_SAMPLER_NR_MASK (0xf<<0)
-
-#define T1_ADDRESS_REG_TYPE_SHIFT 24 /* Reg to use as texture coord */
-/* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */
-#define T1_ADDRESS_REG_NR_SHIFT 17
-#define T2_MBZ 0
-
-/* Declaration instructions */
-#define D0_DCL (0x19<<24) /* Declare a t (interpolated attrib)
- * register or an s (sampler)
- * register. */
-#define D0_SAMPLE_TYPE_SHIFT 22
-#define D0_SAMPLE_TYPE_2D (0x0<<22)
-#define D0_SAMPLE_TYPE_CUBE (0x1<<22)
-#define D0_SAMPLE_TYPE_VOLUME (0x2<<22)
-#define D0_SAMPLE_TYPE_MASK (0x3<<22)
-
-#define D0_TYPE_SHIFT 19
-/* Allow: T, S */
-#define D0_NR_SHIFT 14
-/* Allow T: 0..10, S: 0..15 */
-#define D0_CHANNEL_X (1<<10)
-#define D0_CHANNEL_Y (2<<10)
-#define D0_CHANNEL_Z (4<<10)
-#define D0_CHANNEL_W (8<<10)
-#define D0_CHANNEL_ALL (0xf<<10)
-#define D0_CHANNEL_NONE (0<<10)
-
-#define D0_CHANNEL_XY (D0_CHANNEL_X|D0_CHANNEL_Y)
-#define D0_CHANNEL_XYZ (D0_CHANNEL_XY|D0_CHANNEL_Z)
-
-/* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse
- * or specular declarations.
- *
- * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw)
- *
- * Must be zero for S (sampler) dcls
- */
-#define D1_MBZ 0
-#define D2_MBZ 0
-
-
-
-/* p207 */
-#define _3DSTATE_MAP_STATE (CMD_3D|(0x1d<<24)|(0x0<<16))
-
-#define MS1_MAPMASK_SHIFT 0
-#define MS1_MAPMASK_MASK (0x8fff<<0)
-
-#define MS2_UNTRUSTED_SURFACE (1<<31)
-#define MS2_ADDRESS_MASK 0xfffffffc
-#define MS2_VERTICAL_LINE_STRIDE (1<<1)
-#define MS2_VERTICAL_OFFSET (1<<1)
-
-#define MS3_HEIGHT_SHIFT 21
-#define MS3_WIDTH_SHIFT 10
-#define MS3_PALETTE_SELECT (1<<9)
-#define MS3_MAPSURF_FORMAT_SHIFT 7
-#define MS3_MAPSURF_FORMAT_MASK (0x7<<7)
-#define MAPSURF_8BIT (1<<7)
-#define MAPSURF_16BIT (2<<7)
-#define MAPSURF_32BIT (3<<7)
-#define MAPSURF_422 (5<<7)
-#define MAPSURF_COMPRESSED (6<<7)
-#define MAPSURF_4BIT_INDEXED (7<<7)
-#define MS3_MT_FORMAT_MASK (0x7 << 3)
-#define MS3_MT_FORMAT_SHIFT 3
-#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
-#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
-#define MT_8BIT_L8 (1<<3)
-#define MT_8BIT_A8 (4<<3)
-#define MT_8BIT_MONO8 (5<<3)
-#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
-#define MT_16BIT_ARGB1555 (1<<3)
-#define MT_16BIT_ARGB4444 (2<<3)
-#define MT_16BIT_AY88 (3<<3)
-#define MT_16BIT_88DVDU (5<<3)
-#define MT_16BIT_BUMP_655LDVDU (6<<3)
-#define MT_16BIT_I16 (7<<3)
-#define MT_16BIT_L16 (8<<3)
-#define MT_16BIT_A16 (9<<3)
-#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
-#define MT_32BIT_ABGR8888 (1<<3)
-#define MT_32BIT_XRGB8888 (2<<3)
-#define MT_32BIT_XBGR8888 (3<<3)
-#define MT_32BIT_QWVU8888 (4<<3)
-#define MT_32BIT_AXVU8888 (5<<3)
-#define MT_32BIT_LXVU8888 (6<<3)
-#define MT_32BIT_XLVU8888 (7<<3)
-#define MT_32BIT_ARGB2101010 (8<<3)
-#define MT_32BIT_ABGR2101010 (9<<3)
-#define MT_32BIT_AWVU2101010 (0xA<<3)
-#define MT_32BIT_GR1616 (0xB<<3)
-#define MT_32BIT_VU1616 (0xC<<3)
-#define MT_32BIT_xI824 (0xD<<3)
-#define MT_32BIT_xA824 (0xE<<3)
-#define MT_32BIT_xL824 (0xF<<3)
-#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
-#define MT_422_YCRCB_NORMAL (1<<3)
-#define MT_422_YCRCB_SWAPUV (2<<3)
-#define MT_422_YCRCB_SWAPUVY (3<<3)
-#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
-#define MT_COMPRESS_DXT2_3 (1<<3)
-#define MT_COMPRESS_DXT4_5 (2<<3)
-#define MT_COMPRESS_FXT1 (3<<3)
-#define MT_COMPRESS_DXT1_RGB (4<<3)
-#define MS3_USE_FENCE_REGS (1<<2)
-#define MS3_TILED_SURFACE (1<<1)
-#define MS3_TILE_WALK (1<<0)
-
-#define MS4_PITCH_SHIFT 21
-#define MS4_CUBE_FACE_ENA_NEGX (1<<20)
-#define MS4_CUBE_FACE_ENA_POSX (1<<19)
-#define MS4_CUBE_FACE_ENA_NEGY (1<<18)
-#define MS4_CUBE_FACE_ENA_POSY (1<<17)
-#define MS4_CUBE_FACE_ENA_NEGZ (1<<16)
-#define MS4_CUBE_FACE_ENA_POSZ (1<<15)
-#define MS4_CUBE_FACE_ENA_MASK (0x3f<<15)
-#define MS4_MAX_LOD_SHIFT 9
-#define MS4_MAX_LOD_MASK (0x3f<<9)
-#define MS4_MIP_LAYOUT_LEGACY (0<<8)
-#define MS4_VOLUME_DEPTH_SHIFT 0
-#define MS4_VOLUME_DEPTH_MASK (0xff<<0)
-
-/* p244 */
-#define _3DSTATE_SAMPLER_STATE (CMD_3D|(0x1d<<24)|(0x1<<16))
-
-#define SS1_MAPMASK_SHIFT 0
-#define SS1_MAPMASK_MASK (0x8fff<<0)
-
-#define SS2_REVERSE_GAMMA_ENABLE (1<<31)
-#define SS2_PACKED_TO_PLANAR_ENABLE (1<<30)
-#define SS2_COLORSPACE_CONVERSION (1<<29)
-#define SS2_CHROMAKEY_SHIFT 27
-#define SS2_BASE_MIP_LEVEL_SHIFT 22
-#define SS2_BASE_MIP_LEVEL_MASK (0x1f<<22)
-#define SS2_MIP_FILTER_SHIFT 20
-#define SS2_MIP_FILTER_MASK (0x3<<20)
-#define MIPFILTER_NONE 0
-#define MIPFILTER_NEAREST 1
-#define MIPFILTER_LINEAR 3
-#define SS2_MAG_FILTER_SHIFT 17
-#define SS2_MAG_FILTER_MASK (0x7<<17)
-#define FILTER_NEAREST 0
-#define FILTER_LINEAR 1
-#define FILTER_ANISOTROPIC 2
-#define FILTER_4X4_1 3
-#define FILTER_4X4_2 4
-#define FILTER_4X4_FLAT 5
-#define FILTER_6X5_MONO 6 /* XXX - check */
-#define SS2_MIN_FILTER_SHIFT 14
-#define SS2_MIN_FILTER_MASK (0x7<<14)
-#define SS2_LOD_BIAS_SHIFT 5
-#define SS2_LOD_BIAS_ONE (0x10<<5)
-#define SS2_LOD_BIAS_MASK (0x1ff<<5)
-/* Shadow requires:
- * MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format
- * FILTER_4X4_x MIN and MAG filters
- */
-#define SS2_SHADOW_ENABLE (1<<4)
-#define SS2_MAX_ANISO_MASK (1<<3)
-#define SS2_MAX_ANISO_2 (0<<3)
-#define SS2_MAX_ANISO_4 (1<<3)
-#define SS2_SHADOW_FUNC_SHIFT 0
-#define SS2_SHADOW_FUNC_MASK (0x7<<0)
-/* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */
-
-#define SS3_MIN_LOD_SHIFT 24
-#define SS3_MIN_LOD_ONE (0x10<<24)
-#define SS3_MIN_LOD_MASK (0xff<<24)
-#define SS3_KILL_PIXEL_ENABLE (1<<17)
-#define SS3_TCX_ADDR_MODE_SHIFT 12
-#define SS3_TCX_ADDR_MODE_MASK (0x7<<12)
-#define TEXCOORDMODE_WRAP 0
-#define TEXCOORDMODE_MIRROR 1
-#define TEXCOORDMODE_CLAMP_EDGE 2
-#define TEXCOORDMODE_CUBE 3
-#define TEXCOORDMODE_CLAMP_BORDER 4
-#define TEXCOORDMODE_MIRROR_ONCE 5
-#define SS3_TCY_ADDR_MODE_SHIFT 9
-#define SS3_TCY_ADDR_MODE_MASK (0x7<<9)
-#define SS3_TCZ_ADDR_MODE_SHIFT 6
-#define SS3_TCZ_ADDR_MODE_MASK (0x7<<6)
-#define SS3_NORMALIZED_COORDS (1<<5)
-#define SS3_TEXTUREMAP_INDEX_SHIFT 1
-#define SS3_TEXTUREMAP_INDEX_MASK (0xf<<1)
-#define SS3_DEINTERLACER_ENABLE (1<<0)
-
-#define SS4_BORDER_COLOR_MASK (~0)
-
-/* 3DSTATE_SPAN_STIPPLE, p258
- */
-#define _3DSTATE_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-
-#define MI_FLUSH ((0<<29)|(4<<23))
-#define FLUSH_MAP_CACHE (1<<0)
-#define FLUSH_RENDER_CACHE (1<<1)
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_state.c
deleted file mode 100644
index adb17b218..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_state.c
+++ /dev/null
@@ -1,954 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "texmem.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-
-static void i915StencilFunc(GLcontext *ctx, GLenum func, GLint ref,
- GLuint mask)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- int test = intel_translate_compare_func( func );
-
- mask = mask & 0xff;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(func), ref, mask);
-
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i915->state.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(mask));
-
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_REF_MASK |
- S5_STENCIL_TEST_FUNC_MASK);
-
- i915->state.Ctx[I915_CTXREG_LIS5] |= ((ref << S5_STENCIL_REF_SHIFT) |
- (test << S5_STENCIL_TEST_FUNC_SHIFT));
-}
-
-static void i915StencilMask(GLcontext *ctx, GLuint mask)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
-
- mask = mask & 0xff;
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- i915->state.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(mask));
-}
-
-
-static void i915StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- int fop = intel_translate_stencil_op(fail);
- int dfop = intel_translate_stencil_op(zfail);
- int dpop = intel_translate_stencil_op(zpass);
-
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(fail),
- _mesa_lookup_enum_by_nr(zfail),
- _mesa_lookup_enum_by_nr(zpass));
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_FAIL_MASK |
- S5_STENCIL_PASS_Z_FAIL_MASK |
- S5_STENCIL_PASS_Z_PASS_MASK);
-
- i915->state.Ctx[I915_CTXREG_LIS5] |= ((fop << S5_STENCIL_FAIL_SHIFT) |
- (dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
- (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT));
-}
-
-static void i915AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- int test = intel_translate_compare_func( func );
- GLubyte refByte;
-
- UNCLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~(S6_ALPHA_TEST_FUNC_MASK |
- S6_ALPHA_REF_MASK);
- i915->state.Ctx[I915_CTXREG_LIS6] |= ((test << S6_ALPHA_TEST_FUNC_SHIFT) |
- (((GLuint)refByte) << S6_ALPHA_REF_SHIFT));
-}
-
-/* This function makes sure that the proper enables are
- * set for LogicOp, Independant Alpha Blend, and Blending.
- * It needs to be called from numerous places where we
- * could change the LogicOp or Independant Alpha Blend without subsequent
- * calls to glEnable.
- */
-static void i915EvalLogicOpBlendState(GLcontext *ctx)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- if (ctx->Color._LogicOpEnabled) {
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_LOGICOP_ENABLE;
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_CBUF_BLEND_ENABLE;
- } else {
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_LOGICOP_ENABLE;
-
- if (ctx->Color.BlendEnabled) {
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_CBUF_BLEND_ENABLE;
- } else {
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_CBUF_BLEND_ENABLE;
- }
- }
-}
-
-static void i915BlendColor(GLcontext *ctx, const GLfloat color[4])
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- GLubyte r, g, b, a;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, color[ACOMP]);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_BLENDCOLOR1] = (a<<24) | (r<<16) | (g<<8) | b;
-}
-
-
-#define DST_BLND_FACT(f) ((f)<<S6_CBUF_DST_BLEND_FACT_SHIFT)
-#define SRC_BLND_FACT(f) ((f)<<S6_CBUF_SRC_BLEND_FACT_SHIFT)
-#define DST_ABLND_FACT(f) ((f)<<IAB_DST_FACTOR_SHIFT)
-#define SRC_ABLND_FACT(f) ((f)<<IAB_SRC_FACTOR_SHIFT)
-
-
-
-static GLuint translate_blend_equation( GLenum mode )
-{
- switch (mode) {
- case GL_FUNC_ADD: return BLENDFUNC_ADD;
- case GL_MIN: return BLENDFUNC_MIN;
- case GL_MAX: return BLENDFUNC_MAX;
- case GL_FUNC_SUBTRACT: return BLENDFUNC_SUBTRACT;
- case GL_FUNC_REVERSE_SUBTRACT: return BLENDFUNC_REVERSE_SUBTRACT;
- default: return 0;
- }
-}
-
-static void i915UpdateBlendState( GLcontext *ctx )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- GLuint iab = (i915->state.Ctx[I915_CTXREG_IAB] &
- ~(IAB_SRC_FACTOR_MASK |
- IAB_DST_FACTOR_MASK |
- (BLENDFUNC_MASK << IAB_FUNC_SHIFT) |
- IAB_ENABLE));
-
- GLuint lis6 = (i915->state.Ctx[I915_CTXREG_LIS6] &
- ~(S6_CBUF_SRC_BLEND_FACT_MASK |
- S6_CBUF_DST_BLEND_FACT_MASK |
- S6_CBUF_BLEND_FUNC_MASK));
-
- GLuint eqRGB = ctx->Color.BlendEquationRGB;
- GLuint eqA = ctx->Color.BlendEquationA;
- GLuint srcRGB = ctx->Color.BlendSrcRGB;
- GLuint dstRGB = ctx->Color.BlendDstRGB;
- GLuint srcA = ctx->Color.BlendSrcA;
- GLuint dstA = ctx->Color.BlendDstA;
-
- if (eqRGB == GL_MIN || eqRGB == GL_MAX) {
- srcRGB = dstRGB = GL_ONE;
- }
-
- if (eqA == GL_MIN || eqA == GL_MAX) {
- srcA = dstA = GL_ONE;
- }
-
- lis6 |= SRC_BLND_FACT(intel_translate_blend_factor(srcRGB));
- lis6 |= DST_BLND_FACT(intel_translate_blend_factor(dstRGB));
- lis6 |= translate_blend_equation( eqRGB ) << S6_CBUF_BLEND_FUNC_SHIFT;
-
- iab |= SRC_ABLND_FACT(intel_translate_blend_factor(srcA));
- iab |= DST_ABLND_FACT(intel_translate_blend_factor(dstA));
- iab |= translate_blend_equation( eqA ) << IAB_FUNC_SHIFT;
-
- if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB)
- iab |= IAB_ENABLE;
-
- if (iab != i915->state.Ctx[I915_CTXREG_IAB] ||
- lis6 != i915->state.Ctx[I915_CTXREG_LIS6]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_IAB] = iab;
- i915->state.Ctx[I915_CTXREG_LIS6] = lis6;
- }
-
- /* This will catch a logicop blend equation */
- i915EvalLogicOpBlendState(ctx);
-}
-
-
-static void i915BlendFuncSeparate(GLcontext *ctx, GLenum srcRGB,
- GLenum dstRGB, GLenum srcA,
- GLenum dstA )
-{
- i915UpdateBlendState( ctx );
-}
-
-
-static void i915BlendEquationSeparate(GLcontext *ctx, GLenum eqRGB,
- GLenum eqA)
-{
- i915UpdateBlendState( ctx );
-}
-
-
-static void i915DepthFunc(GLcontext *ctx, GLenum func)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- int test = intel_translate_compare_func( func );
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_TEST_FUNC_MASK;
- i915->state.Ctx[I915_CTXREG_LIS6] |= test << S6_DEPTH_TEST_FUNC_SHIFT;
-}
-
-static void i915DepthMask(GLcontext *ctx, GLboolean flag)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- if (flag && ctx->Depth.Test)
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_DEPTH_WRITE_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_WRITE_ENABLE;
-}
-
-/* =============================================================
- * Polygon stipple
- *
- * The i915 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i915PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- i915->intel.reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- i915->state.Stipple[I915_STPREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 3 ; j >= 0; j--)
- for (i = 0 ; i < 4 ; i++, m++)
- if (*m != p[j]) {
- i915->intel.hw_stipple = 0;
- return;
- }
-
- newMask = (((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12));
-
-
- if (newMask == 0xffff || newMask == 0x0) {
- /* this is needed to make conform pass */
- i915->intel.hw_stipple = 0;
- return;
- }
-
- i915->state.Stipple[I915_STPREG_ST1] &= ~0xffff;
- i915->state.Stipple[I915_STPREG_ST1] |= newMask;
- i915->intel.hw_stipple = 1;
-
- if (active)
- i915->state.Stipple[I915_STPREG_ST1] |= ST1_ENABLE;
-}
-
-
-/* =============================================================
- * Hardware clipping
- */
-static void i915Scissor(GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- intelScreenPrivate *screen = i915->intel.intelScreen;
- int x1, y1, x2, y2;
-
- if (!i915->intel.driDrawable)
- return;
-
- x1 = x;
- y1 = i915->intel.driDrawable->h - (y + h);
- x2 = x + w - 1;
- y2 = y1 + h - 1;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
- x, y, w, h);
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
-
- if (x2 >= screen->width) x2 = screen->width-1;
- if (y2 >= screen->height) y2 = screen->height-1;
- if (x1 >= screen->width) x1 = screen->width-1;
- if (y1 >= screen->height) y1 = screen->height-1;
-
-
- I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
- i915->state.Buffer[I915_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff);
- i915->state.Buffer[I915_DESTREG_SR2] = (y2 << 16) | (x2 & 0xffff);
-}
-
-static void i915LogicOp(GLcontext *ctx, GLenum opcode)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- int tmp = intel_translate_logic_op(opcode);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_STATE4] &= ~LOGICOP_MASK;
- i915->state.Ctx[I915_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
-}
-
-
-
-static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- GLuint mode;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!ctx->Polygon.CullFlag) {
- mode = S4_CULLMODE_NONE;
- }
- else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = S4_CULLMODE_CW;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
- }
- else {
- mode = S4_CULLMODE_BOTH;
- }
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS4] &= ~S4_CULLMODE_MASK;
- i915->state.Ctx[I915_CTXREG_LIS4] |= mode;
-}
-
-static void i915LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- i915ContextPtr i915 = I915_CONTEXT( ctx );
- int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_LINE_WIDTH_MASK;
- int width;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- width = (int)(widthf * 2);
- CLAMP_SELF(width, 1, 0xf);
- lis4 |= width << S4_LINE_WIDTH_SHIFT;
-
- if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS4] = lis4;
- }
-}
-
-static void i915PointSize(GLcontext *ctx, GLfloat size)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_POINT_WIDTH_MASK;
- GLint point_size = (int)size;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- CLAMP_SELF(point_size, 1, 255);
- lis4 |= point_size << S4_POINT_WIDTH_SHIFT;
-
- if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS4] = lis4;
- }
-}
-
-
-/* =============================================================
- * Color masks
- */
-
-static void i915ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- i915ContextPtr i915 = I915_CONTEXT( ctx );
- GLuint tmp = i915->state.Ctx[I915_CTXREG_LIS5] & ~S5_WRITEDISABLE_MASK;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
-
- if (!r) tmp |= S5_WRITEDISABLE_RED;
- if (!g) tmp |= S5_WRITEDISABLE_GREEN;
- if (!b) tmp |= S5_WRITEDISABLE_BLUE;
- if (!a) tmp |= S5_WRITEDISABLE_ALPHA;
-
- if (tmp != i915->state.Ctx[I915_CTXREG_LIS5]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS5] = tmp;
- }
-}
-
-static void update_specular( GLcontext *ctx )
-{
- /* A hack to trigger the rebuild of the fragment program.
- */
- INTEL_CONTEXT(ctx)->NewGLState |= _NEW_TEXTURE;
- I915_CONTEXT(ctx)->tex_program.translated = 0;
-}
-
-static void i915LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- update_specular( ctx );
- }
-}
-
-static void i915ShadeModel(GLcontext *ctx, GLenum mode)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- if (mode == GL_SMOOTH) {
- i915->state.Ctx[I915_CTXREG_LIS4] &= ~(S4_FLATSHADE_ALPHA |
- S4_FLATSHADE_COLOR |
- S4_FLATSHADE_SPECULAR);
- } else {
- i915->state.Ctx[I915_CTXREG_LIS4] |= (S4_FLATSHADE_ALPHA |
- S4_FLATSHADE_COLOR |
- S4_FLATSHADE_SPECULAR);
- }
-}
-
-/* =============================================================
- * Fog
- */
-void i915_update_fog( GLcontext *ctx )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- GLenum mode;
- GLboolean enabled;
- GLboolean try_pixel_fog;
-
- if (ctx->FragmentProgram._Active) {
- /* Pull in static fog state from program */
-
- mode = ctx->FragmentProgram._Current->FogOption;
- enabled = (mode != GL_NONE);
- try_pixel_fog = 0;
- }
- else {
- enabled = ctx->Fog.Enabled;
- mode = ctx->Fog.Mode;
-
- try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT &&
- ctx->Hint.Fog == GL_NICEST &&
- 0); /* XXX - DISABLE -- Need ortho fallback */
- }
-
- if (!enabled) {
- i915->vertex_fog = I915_FOG_NONE;
- }
- else if (try_pixel_fog) {
-
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK;
- i915->vertex_fog = I915_FOG_PIXEL;
-
- switch (mode) {
- case GL_LINEAR:
- if (ctx->Fog.End <= ctx->Fog.Start) {
- /* XXX - this won't work with fragment programs. Need to
- * either fallback or append fog instructions to end of
- * program in the case of linear fog.
- */
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX;
- i915->vertex_fog = I915_FOG_VERTEX;
- }
- else {
- GLfloat c1 = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- GLfloat c2 = 1.0/(ctx->Fog.End-ctx->Fog.Start);
-
- i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_C1_MASK;
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_LINEAR;
- i915->state.Fog[I915_FOGREG_MODE1] |=
- ((GLuint)(c1 * FMC1_C1_ONE)) & FMC1_C1_MASK;
-
- if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
- i915->state.Fog[I915_FOGREG_MODE2] = (GLuint)(c2 * FMC2_C2_ONE);
- }
- else {
- union { float f; int i; } fi;
- fi.f = c2;
- i915->state.Fog[I915_FOGREG_MODE2] = fi.i;
- }
- }
- break;
- case GL_EXP:
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_EXP;
- break;
- case GL_EXP2:
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_EXP2;
- break;
- default:
- break;
- }
- }
- else /* if (i915->vertex_fog != I915_FOG_VERTEX) */ {
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK;
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX;
- i915->vertex_fog = I915_FOG_VERTEX;
- }
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled);
- if (enabled)
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
- }
-
- if (enabled) {
- _tnl_allow_vertex_fog( ctx, (i915->vertex_fog == I915_FOG_VERTEX) );
- _tnl_allow_pixel_fog( ctx, (i915->vertex_fog != I915_FOG_VERTEX) );
- }
-}
-
-static void i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
-
- switch (pname) {
- case GL_FOG_COORDINATE_SOURCE_EXT:
- case GL_FOG_MODE:
- case GL_FOG_START:
- case GL_FOG_END:
- break;
-
- case GL_FOG_DENSITY:
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
-
- if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
- i915->state.Fog[I915_FOGREG_MODE3] = (GLuint)(ctx->Fog.Density *
- FMC3_D_ONE);
- }
- else {
- union { float f; int i; } fi;
- fi.f = ctx->Fog.Density;
- i915->state.Fog[I915_FOGREG_MODE3] = fi.i;
- }
- break;
-
- case GL_FOG_COLOR:
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_COLOR] =
- (_3DSTATE_FOG_COLOR_CMD |
- ((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
- break;
-
- default:
- break;
- }
-}
-
-static void i915Hint(GLcontext *ctx, GLenum target, GLenum state)
-{
- switch (target) {
- case GL_FOG_HINT:
- break;
- default:
- break;
- }
-}
-
-/* =============================================================
- */
-
-static void i915Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
-
- switch(cap) {
- case GL_TEXTURE_2D:
- break;
-
- case GL_LIGHTING:
- case GL_COLOR_SUM:
- update_specular( ctx );
- break;
-
- case GL_ALPHA_TEST:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_ALPHA_TEST_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_ALPHA_TEST_ENABLE;
- break;
-
- case GL_BLEND:
- i915EvalLogicOpBlendState(ctx);
- break;
-
- case GL_COLOR_LOGIC_OP:
- i915EvalLogicOpBlendState(ctx);
-
- /* Logicop doesn't seem to work at 16bpp:
- */
- if (i915->intel.intelScreen->cpp == 2)
- FALLBACK( &i915->intel, I915_FALLBACK_LOGICOP, state );
- break;
-
- case GL_FRAGMENT_PROGRAM_ARB:
- break;
-
- case GL_DITHER:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_COLOR_DITHER_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_COLOR_DITHER_ENABLE;
- break;
-
- case GL_DEPTH_TEST:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_DEPTH_TEST_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_TEST_ENABLE;
-
- i915DepthMask( ctx, ctx->Depth.Mask );
- break;
-
- case GL_SCISSOR_TEST:
- I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
- if (state)
- i915->state.Buffer[I915_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- ENABLE_SCISSOR_RECT);
- else
- i915->state.Buffer[I915_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- break;
-
- case GL_LINE_SMOOTH:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS4] |= S4_LINE_ANTIALIAS_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS4] &= ~S4_LINE_ANTIALIAS_ENABLE;
- break;
-
- case GL_FOG:
- break;
-
- case GL_CULL_FACE:
- i915CullFaceFrontFace(ctx, 0);
- break;
-
- case GL_STENCIL_TEST:
- if (i915->intel.hw_stencil) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS5] |= (S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
- else
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
- } else {
- FALLBACK( &i915->intel, I915_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- /* The stipple command worked on my 855GM box, but not my 845G.
- * I'll do more testing later to find out exactly which hardware
- * supports it. Disabled for now.
- */
- if (i915->intel.hw_stipple &&
- i915->intel.reduced_primitive == GL_TRIANGLES)
- {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- if (state)
- i915->state.Stipple[I915_STPREG_ST1] |= ST1_ENABLE;
- else
- i915->state.Stipple[I915_STPREG_ST1] &= ~ST1_ENABLE;
- }
- break;
-
- default:
- ;
- }
-}
-
-
-static void i915_init_packets( i915ContextPtr i915 )
-{
- intelScreenPrivate *screen = i915->intel.intelScreen;
-
- /* Zero all state */
- memset(&i915->state, 0, sizeof(i915->state));
-
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- /* Probably don't want to upload all this stuff every time one
- * piece changes.
- */
- i915->state.Ctx[I915_CTXREG_LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
- I1_LOAD_S(2) |
- I1_LOAD_S(4) |
- I1_LOAD_S(5) |
- I1_LOAD_S(6) |
- (4));
- i915->state.Ctx[I915_CTXREG_LIS2] = 0;
- i915->state.Ctx[I915_CTXREG_LIS4] = 0;
- i915->state.Ctx[I915_CTXREG_LIS5] = 0;
-
- if (screen->cpp == 2)
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_COLOR_DITHER_ENABLE;
-
-
- i915->state.Ctx[I915_CTXREG_LIS6] = (S6_COLOR_WRITE_ENABLE |
- (2 << S6_TRISTRIP_PV_SHIFT));
-
- i915->state.Ctx[I915_CTXREG_STATE4] = (_3DSTATE_MODES_4_CMD |
- ENABLE_LOGIC_OP_FUNC |
- LOGIC_OP_FUNC(LOGICOP_COPY) |
- ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff) |
- ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(0xff));
-
-
- i915->state.Ctx[I915_CTXREG_IAB] = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD |
- IAB_MODIFY_ENABLE |
- IAB_MODIFY_FUNC |
- IAB_MODIFY_SRC_FACTOR |
- IAB_MODIFY_DST_FACTOR);
-
- i915->state.Ctx[I915_CTXREG_BLENDCOLOR0] = _3DSTATE_CONST_BLEND_COLOR_CMD;
- i915->state.Ctx[I915_CTXREG_BLENDCOLOR1] = 0;
-
- }
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- i915->state.Stipple[I915_STPREG_ST0] = _3DSTATE_STIPPLE;
- }
-
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_MODE0] = _3DSTATE_FOG_MODE_CMD;
- i915->state.Fog[I915_FOGREG_MODE1] = (FMC1_FOGFUNC_MODIFY_ENABLE |
- FMC1_FOGFUNC_VERTEX |
- FMC1_FOGINDEX_MODIFY_ENABLE |
- FMC1_FOGINDEX_W |
- FMC1_C1_C2_MODIFY_ENABLE |
- FMC1_DENSITY_MODIFY_ENABLE);
- i915->state.Fog[I915_FOGREG_COLOR] = _3DSTATE_FOG_COLOR_CMD;
- }
-
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
- i915->state.Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i915->state.Buffer[I915_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK |
- BUF_3D_PITCH(screen->frontPitch * screen->cpp) |
- BUF_3D_USE_FENCE);
-
-
- i915->state.Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i915->state.Buffer[I915_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH |
- BUF_3D_PITCH(screen->depthPitch * screen->cpp) |
- BUF_3D_USE_FENCE);
- i915->state.Buffer[I915_DESTREG_DBUFADDR2] = screen->depthOffset;
-
-
- i915->state.Buffer[I915_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD;
-
- switch (screen->fbFormat) {
- case DV_PF_555:
- case DV_PF_565:
- i915->state.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- DITHER_FULL_ALWAYS |
- screen->fbFormat |
- DEPTH_FRMT_16_FIXED);
- break;
- case DV_PF_8888:
- i915->state.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- screen->fbFormat |
- DEPTH_FRMT_24_FIXED_8_OTHER);
- break;
- }
- i915->state.Buffer[I915_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- i915->state.Buffer[I915_DESTREG_SR0] = _3DSTATE_SCISSOR_RECT_0_CMD;
- i915->state.Buffer[I915_DESTREG_SR1] = 0;
- i915->state.Buffer[I915_DESTREG_SR2] = 0;
- }
-
-
- /* These will be emitted every at the head of every buffer, unless
- * we get hardware contexts working.
- */
- i915->state.active = (I915_UPLOAD_PROGRAM |
- I915_UPLOAD_STIPPLE |
- I915_UPLOAD_CTX |
- I915_UPLOAD_BUFFERS);
-}
-
-void i915InitStateFunctions( struct dd_function_table *functions )
-{
- functions->AlphaFunc = i915AlphaFunc;
- functions->BlendColor = i915BlendColor;
- functions->BlendEquationSeparate = i915BlendEquationSeparate;
- functions->BlendFuncSeparate = i915BlendFuncSeparate;
- functions->ColorMask = i915ColorMask;
- functions->CullFace = i915CullFaceFrontFace;
- functions->DepthFunc = i915DepthFunc;
- functions->DepthMask = i915DepthMask;
- functions->Enable = i915Enable;
- functions->Fogfv = i915Fogfv;
- functions->FrontFace = i915CullFaceFrontFace;
- functions->Hint = i915Hint;
- functions->LightModelfv = i915LightModelfv;
- functions->LineWidth = i915LineWidth;
- functions->LogicOpcode = i915LogicOp;
- functions->PointSize = i915PointSize;
- functions->PolygonStipple = i915PolygonStipple;
- functions->Scissor = i915Scissor;
- functions->ShadeModel = i915ShadeModel;
- functions->StencilFunc = i915StencilFunc;
- functions->StencilMask = i915StencilMask;
- functions->StencilOp = i915StencilOp;
-}
-
-
-void i915InitState( i915ContextPtr i915 )
-{
- GLcontext *ctx = &i915->intel.ctx;
-
- i915_init_packets( i915 );
-
- intelInitState( ctx );
-
- memcpy( &i915->initial, &i915->state, sizeof(i915->state) );
- i915->current = &i915->state;
-}
-
-
-
-
-
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_tex.c
deleted file mode 100644
index 4f77833e1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_tex.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "image.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "texmem.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "intel_ioctl.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-
-
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-intelTextureObjectPtr i915AllocTexObj( struct gl_texture_object *texObj )
-{
- i915TextureObjectPtr t = CALLOC_STRUCT( i915_texture_object );
- if ( !t )
- return NULL;
-
- texObj->DriverData = t;
- t->intel.base.tObj = texObj;
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
- make_empty_list( &t->intel.base );
- return &t->intel;
-}
-
-
-static void i915TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- case GL_TEXTURE_BORDER_COLOR:
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
- break;
-
- case GL_TEXTURE_COMPARE_MODE:
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
- break;
- case GL_TEXTURE_COMPARE_FUNC:
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- /* The i915 and its successors can do a lot of this without
- * reloading the textures. A project for someone?
- */
- intelFlush( ctx );
- driSwapOutTextureObject( (driTextureObject *) t );
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
- break;
-
- default:
- return;
- }
-}
-
-
-static void i915TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- i915ContextPtr i915 = I915_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR: /* Should be a tracked param */
- case GL_TEXTURE_ENV_MODE:
- case GL_COMBINE_RGB:
- case GL_COMBINE_ALPHA:
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- i915->tex_program.translated = 0;
- break;
-
- case GL_TEXTURE_LOD_BIAS: {
- int b = (int) ((*param) * 16.0);
- if (b > 255) b = 255;
- if (b < -256) b = -256;
- I915_STATECHANGE(i915, I915_UPLOAD_TEX(unit));
- i915->state.Tex[unit][I915_TEXREG_SS2] &= ~SS2_LOD_BIAS_MASK;
- i915->state.Tex[unit][I915_TEXREG_SS2] |=
- ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK);
- break;
- }
-
- default:
- break;
- }
-}
-
-
-static void i915BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- i915TextureObjectPtr tex = (i915TextureObjectPtr)texObj->DriverData;
-
- if (tex->lastTarget != texObj->Target) {
- tex->intel.dirty = I915_UPLOAD_TEX_ALL;
- tex->lastTarget = texObj->Target;
- }
-
- /* Need this if image format changes between bound textures.
- * Could try and shortcircuit by checking for differences in
- * state between incoming and outgoing textures:
- */
- I915_CONTEXT(ctx)->tex_program.translated = 0;
-}
-
-
-
-void i915InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->BindTexture = i915BindTexture;
- functions->TexEnv = i915TexEnv;
- functions->TexParameter = i915TexParameter;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texprog.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texprog.c
deleted file mode 100644
index 3eaf53d7d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texprog.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 <strings.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_program.h"
-
-static GLuint translate_tex_src_bit( struct i915_fragment_program *p,
- GLubyte bit )
-{
- switch (bit) {
- case TEXTURE_1D_BIT: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_2D_BIT: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_RECT_BIT: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_3D_BIT: return D0_SAMPLE_TYPE_VOLUME;
- case TEXTURE_CUBE_BIT: return D0_SAMPLE_TYPE_CUBE;
- default: i915_program_error(p, "TexSrcBit"); return 0;
- }
-}
-
-static GLuint get_source( struct i915_fragment_program *p,
- GLenum src, GLuint unit )
-{
- switch (src) {
- case GL_TEXTURE:
- if (p->src_texture == UREG_BAD) {
-
- /* TODO: Use D0_CHANNEL_XY where possible.
- */
- GLuint dim = translate_tex_src_bit( p, p->ctx->Texture.Unit[unit]._ReallyEnabled);
- GLuint sampler = i915_emit_decl(p, REG_TYPE_S, unit, dim);
- GLuint texcoord = i915_emit_decl(p, REG_TYPE_T, unit, D0_CHANNEL_ALL);
- GLuint tmp = i915_get_temp( p );
- GLuint op = T0_TEXLD;
-
- if (p->VB->TexCoordPtr[unit]->size == 4)
- op = T0_TEXLDP;
-
- p->src_texture = i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL,
- sampler, texcoord, op );
- }
-
- return p->src_texture;
-
- /* Crossbar: */
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- case GL_TEXTURE4:
- case GL_TEXTURE5:
- case GL_TEXTURE6:
- case GL_TEXTURE7: {
- return UREG_BAD;
- }
-
- case GL_CONSTANT:
- return i915_emit_const4fv( p, p->ctx->Texture.Unit[unit].EnvColor );
- case GL_PRIMARY_COLOR:
- return i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL);
- case GL_PREVIOUS:
- default:
- i915_emit_decl(p,
- GET_UREG_TYPE(p->src_previous),
- GET_UREG_NR(p->src_previous), D0_CHANNEL_ALL);
- return p->src_previous;
- }
-}
-
-
-static GLuint emit_combine_source( struct i915_fragment_program *p,
- GLuint mask,
- GLuint unit,
- GLenum source,
- GLenum operand )
-{
- GLuint arg, src;
-
- src = get_source(p, source, unit);
-
- switch (operand) {
- case GL_ONE_MINUS_SRC_COLOR:
- /* Get unused tmp,
- * Emit tmp = 1.0 + arg.-x-y-z-w
- */
- arg = i915_get_temp( p );
- return i915_emit_arith( p, A0_ADD, arg, mask, 0,
- swizzle(src, ONE, ONE, ONE, ONE ),
- negate(src, 1,1,1,1), 0);
-
- case GL_SRC_ALPHA:
- if (mask == A0_DEST_CHANNEL_W)
- return src;
- else
- return swizzle( src, W, W, W, W );
- case GL_ONE_MINUS_SRC_ALPHA:
- /* Get unused tmp,
- * Emit tmp = 1.0 + arg.-w-w-w-w
- */
- arg = i915_get_temp( p );
- return i915_emit_arith( p, A0_ADD, arg, mask, 0,
- swizzle(src, ONE, ONE, ONE, ONE ),
- negate( swizzle(src,W,W,W,W), 1,1,1,1), 0);
- case GL_SRC_COLOR:
- default:
- return src;
- }
-}
-
-
-
-static int nr_args( GLenum mode )
-{
- switch (mode) {
- case GL_REPLACE: return 1;
- case GL_MODULATE: return 2;
- case GL_ADD: return 2;
- case GL_ADD_SIGNED: return 2;
- case GL_INTERPOLATE: return 3;
- case GL_SUBTRACT: return 2;
- case GL_DOT3_RGB_EXT: return 2;
- case GL_DOT3_RGBA_EXT: return 2;
- case GL_DOT3_RGB: return 2;
- case GL_DOT3_RGBA: return 2;
- default: return 0;
- }
-}
-
-
-static GLboolean args_match( struct gl_texture_unit *texUnit )
-{
- int i, nr = nr_args(texUnit->Combine.ModeRGB);
-
- for (i = 0 ; i < nr ; i++) {
- if (texUnit->Combine.SourceA[i] != texUnit->Combine.SourceRGB[i])
- return GL_FALSE;
-
- switch(texUnit->Combine.OperandA[i]) {
- case GL_SRC_ALPHA:
- switch(texUnit->Combine.OperandRGB[i]) {
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- switch(texUnit->Combine.OperandRGB[i]) {
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- break;
- default:
- return GL_FALSE;
- }
- break;
- default:
- return GL_FALSE; /* impossible */
- }
- }
-
- return GL_TRUE;
-}
-
-
-static GLuint emit_combine( struct i915_fragment_program *p,
- GLuint dest,
- GLuint mask,
- GLuint saturate,
- GLuint unit,
- GLenum mode,
- const GLenum *source,
- const GLenum *operand)
-{
- int tmp, src[3], nr = nr_args(mode);
- int i;
-
- for (i = 0; i < nr; i++)
- src[i] = emit_combine_source( p, mask, unit, source[i], operand[i] );
-
- switch (mode) {
- case GL_REPLACE:
- if (mask == A0_DEST_CHANNEL_ALL && !saturate)
- return src[0];
- else
- return i915_emit_arith( p, A0_MOV, dest, mask, saturate, src[0], 0, 0 );
- case GL_MODULATE:
- return i915_emit_arith( p, A0_MUL, dest, mask, saturate,
- src[0], src[1], 0 );
- case GL_ADD:
- return i915_emit_arith( p, A0_ADD, dest, mask, saturate,
- src[0], src[1], 0 );
- case GL_ADD_SIGNED:
- /* tmp = arg0 + arg1
- * result = tmp + -.5
- */
- tmp = i915_emit_const1f(p, .5);
- tmp = negate(swizzle(tmp,X,X,X,X),1,1,1,1);
- i915_emit_arith( p, A0_ADD, dest, mask, 0, src[0], src[1], 0 );
- i915_emit_arith( p, A0_ADD, dest, mask, saturate, dest, tmp, 0 );
- return dest;
- case GL_INTERPOLATE: /* TWO INSTRUCTIONS */
- /* Arg0 * (Arg2) + Arg1 * (1-Arg2)
- *
- * Arg0*Arg2 + Arg1 - Arg1Arg2
- *
- * tmp = Arg0*Arg2 + Arg1,
- * result = (-Arg1)Arg2 + tmp
- */
- tmp = i915_get_temp( p );
- i915_emit_arith( p, A0_MAD, tmp, mask, 0, src[0], src[2], src[1] );
- i915_emit_arith( p, A0_MAD, dest, mask, saturate,
- negate(src[1], 1,1,1,1), src[2], tmp );
- return dest;
- case GL_SUBTRACT:
- /* negate src[1] */
- return i915_emit_arith( p, A0_ADD, dest, mask, saturate, src[0],
- negate(src[1],1,1,1,1), 0 );
-
- case GL_DOT3_RGBA:
- case GL_DOT3_RGBA_EXT:
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGB: {
- GLuint tmp0 = i915_get_temp( p );
- GLuint tmp1 = i915_get_temp( p );
- GLuint neg1 = negate(swizzle(i915_emit_const1f(p, 1),X,X,X,X), 1,1,1,1);
- GLuint two = swizzle(i915_emit_const1f(p, 2),X,X,X,X);
- i915_emit_arith( p, A0_MAD, tmp0, A0_DEST_CHANNEL_ALL, 0,
- two, src[0], neg1);
- if (src[0] == src[1])
- tmp1 = tmp0;
- else
- i915_emit_arith( p, A0_MAD, tmp1, A0_DEST_CHANNEL_ALL, 0,
- two, src[1], neg1);
- i915_emit_arith( p, A0_DP3, dest, mask, saturate, tmp0, tmp1, 0);
- return dest;
- }
-
- default:
- return src[0];
- }
-}
-
-static GLuint get_dest( struct i915_fragment_program *p, int unit )
-{
- if (p->ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- return i915_get_temp( p );
- else if (unit != p->last_tex_stage)
- return i915_get_temp( p );
- else
- return UREG(REG_TYPE_OC, 0);
-}
-
-
-
-static GLuint emit_texenv( struct i915_fragment_program *p, int unit )
-{
- struct gl_texture_unit *texUnit = &p->ctx->Texture.Unit[unit];
- GLenum envMode = texUnit->EnvMode;
- struct gl_texture_object *tObj = texUnit->_Current;
- GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
- GLuint saturate = unit < p->last_tex_stage ? A0_DEST_SATURATE : 0;
-
- switch(envMode) {
- case GL_BLEND: {
- const int cf = get_source(p, GL_PREVIOUS, unit);
- const int cc = get_source(p, GL_CONSTANT, unit);
- const int cs = get_source(p, GL_TEXTURE, unit);
- const int out = get_dest(p, unit);
-
- if (format == GL_INTENSITY) {
- /* cv = cf(1 - cs) + cc.cs
- * cv = cf - cf.cs + cc.cs
- */
- /* u[2] = MAD( -cf * cs + cf )
- * cv = MAD( cc * cs + u[2] )
- */
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, 0,
- negate(cf,1,1,1,1), cs, cf );
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- cc, cs, out );
-
- return out;
- } else {
- /* cv = cf(1 - cs) + cc.cs
- * cv = cf - cf.cs + cc.cs
- * av = af.as
- */
- /* u[2] = MAD( cf.-x-y-zw * cs.xyzw + cf.xyz0 )
- * oC = MAD( cc.xyz0 * cs.xyz0 + u[2].xyzw )
- */
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, 0,
- negate(cf,1,1,1,0),
- cs,
- swizzle(cf,X,Y,Z,ZERO) );
-
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cc,X,Y,Z,ZERO),
- swizzle(cs,X,Y,Z,ZERO),
- out );
-
- return out;
- }
- }
-
- case GL_DECAL: {
- if (format == GL_RGB ||
- format == GL_RGBA) {
- int cf = get_source( p, GL_PREVIOUS, unit );
- int cs = get_source( p, GL_TEXTURE, unit );
- int out = get_dest(p, unit);
-
- /* cv = cf(1-as) + cs.as
- * cv = cf.(-as) + cf + cs.as
- * av = af
- */
-
- /* u[2] = mad( cf.xyzw * cs.-w-w-w1 + cf.xyz0 )
- * oc = mad( cs.xyz0 * cs.www0 + u[2].xyzw )
- */
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, 0,
- cf,
- negate(swizzle(cs,W,W,W,ONE),1,1,1,0),
- swizzle(cf,X,Y,Z,ZERO) );
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cs,X,Y,Z,ZERO),
- swizzle(cs,W,W,W,ZERO),
- out );
- return out;
- }
- else {
- return get_source( p, GL_PREVIOUS, unit );
- }
- }
-
- case GL_REPLACE: {
- const int cs = get_source( p, GL_TEXTURE, unit ); /* saturated */
- switch (format) {
- case GL_ALPHA: {
- const int cf = get_source( p, GL_PREVIOUS, unit ); /* saturated */
- i915_emit_arith( p, A0_MOV, cs, A0_DEST_CHANNEL_XYZ, 0, cf, 0, 0 );
- return cs;
- }
- case GL_RGB:
- case GL_LUMINANCE: {
- const int cf = get_source( p, GL_PREVIOUS, unit ); /* saturated */
- i915_emit_arith( p, A0_MOV, cs, A0_DEST_CHANNEL_W, 0, cf, 0, 0 );
- return cs;
- }
- default:
- return cs;
- }
- }
-
- case GL_MODULATE: {
- const int cf = get_source( p, GL_PREVIOUS, unit );
- const int cs = get_source( p, GL_TEXTURE, unit );
- const int out = get_dest(p, unit);
- switch (format) {
- case GL_ALPHA:
- i915_emit_arith( p, A0_MUL, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cs, ONE, ONE, ONE, W), cf, 0 );
- break;
- default:
- i915_emit_arith( p, A0_MUL, out, A0_DEST_CHANNEL_ALL, saturate,
- cs, cf, 0 );
- break;
- }
- return out;
- }
- case GL_ADD: {
- int cf = get_source( p, GL_PREVIOUS, unit );
- int cs = get_source( p, GL_TEXTURE, unit );
- const int out = get_dest( p, unit );
-
- if (format == GL_INTENSITY) {
- /* output-color.rgba = add( incoming, u[1] )
- */
- i915_emit_arith( p, A0_ADD, out, A0_DEST_CHANNEL_ALL, saturate,
- cs, cf, 0 );
- return out;
- }
- else {
- /* cv.xyz = cf.xyz + cs.xyz
- * cv.w = cf.w * cs.w
- *
- * cv.xyzw = MAD( cf.111w * cs.xyzw + cf.xyz0 )
- */
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cf,ONE,ONE,ONE,W),
- cs,
- swizzle(cf,X,Y,Z,ZERO) );
- return out;
- }
- break;
- }
- case GL_COMBINE: {
- GLuint rgb_shift, alpha_shift, out, shift;
- GLuint dest = get_dest(p, unit);
-
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- switch (texUnit->Combine.ModeRGB) {
- case GL_DOT3_RGB_EXT:
- alpha_shift = texUnit->Combine.ScaleShiftA;
- rgb_shift = 0;
- break;
-
- case GL_DOT3_RGBA_EXT:
- alpha_shift = 0;
- rgb_shift = 0;
- break;
-
- default:
- rgb_shift = texUnit->Combine.ScaleShiftRGB;
- alpha_shift = texUnit->Combine.ScaleShiftA;
- break;
- }
-
-
- /* Emit the RGB and A combine ops
- */
- if (texUnit->Combine.ModeRGB == texUnit->Combine.ModeA &&
- args_match( texUnit )) {
- out = emit_combine( p, dest, A0_DEST_CHANNEL_ALL, saturate,
- unit,
- texUnit->Combine.ModeRGB,
- texUnit->Combine.SourceRGB,
- texUnit->Combine.OperandRGB );
- }
- else if (texUnit->Combine.ModeRGB == GL_DOT3_RGBA_EXT ||
- texUnit->Combine.ModeRGB == GL_DOT3_RGBA) {
-
- out = emit_combine( p, dest, A0_DEST_CHANNEL_ALL, saturate,
- unit,
- texUnit->Combine.ModeRGB,
- texUnit->Combine.SourceRGB,
- texUnit->Combine.OperandRGB );
- }
- else {
- /* Need to do something to stop from re-emitting identical
- * argument calculations here:
- */
- out = emit_combine( p, dest, A0_DEST_CHANNEL_XYZ, saturate,
- unit,
- texUnit->Combine.ModeRGB,
- texUnit->Combine.SourceRGB,
- texUnit->Combine.OperandRGB );
- out = emit_combine( p, dest, A0_DEST_CHANNEL_W, saturate,
- unit,
- texUnit->Combine.ModeA,
- texUnit->Combine.SourceA,
- texUnit->Combine.OperandA );
- }
-
- /* Deal with the final shift:
- */
- if (alpha_shift || rgb_shift) {
- if (rgb_shift == alpha_shift) {
- shift = i915_emit_const1f(p, 1<<rgb_shift);
- shift = swizzle(shift,X,X,X,X);
- }
- else {
- shift = i915_emit_const2f(p, 1<<rgb_shift, 1<<alpha_shift);
- shift = swizzle(shift,X,X,X,Y);
- }
- return i915_emit_arith( p, A0_MUL, dest, A0_DEST_CHANNEL_ALL,
- saturate, out, shift, 0 );
- }
-
- return out;
- }
-
- default:
- return get_source(p, GL_PREVIOUS, 0);
- }
-}
-
-static void emit_program_fini( struct i915_fragment_program *p )
-{
- int cf = get_source( p, GL_PREVIOUS, 0 );
- int out = UREG( REG_TYPE_OC, 0 );
-
- if (p->ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- /* Emit specular add.
- */
- GLuint s = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_ALL);
- i915_emit_arith( p, A0_ADD, out, A0_DEST_CHANNEL_ALL, 0, cf,
- swizzle(s, X,Y,Z,ZERO), 0 );
- }
- else if (cf != out) {
- /* Will wind up in here if no texture enabled or a couple of
- * other scenarios (GL_REPLACE for instance).
- */
- i915_emit_arith( p, A0_MOV, out, A0_DEST_CHANNEL_ALL, 0, cf, 0, 0 );
- }
-}
-
-
-static void i915EmitTextureProgram( i915ContextPtr i915 )
-{
- GLcontext *ctx = &i915->intel.ctx;
- struct i915_fragment_program *p = &i915->tex_program;
- GLuint unit;
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- i915_init_program( i915, p );
-
- if (ctx->Texture._EnabledUnits) {
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- p->last_tex_stage = unit;
- }
-
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- p->src_previous = emit_texenv( p, unit );
- p->src_texture = UREG_BAD;
- p->temp_flag = 0xffff000;
- p->temp_flag |= 1 << GET_UREG_NR(p->src_previous);
- }
- }
-
- emit_program_fini( p );
-
- i915_fini_program( p );
- i915_upload_program( i915, p );
-
- p->translated = 1;
-}
-
-
-void i915ValidateTextureProgram( i915ContextPtr i915 )
-{
- intelContextPtr intel = &i915->intel;
- GLcontext *ctx = &intel->ctx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- int i, offset;
- GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
- GLuint s2 = S2_TEXCOORD_NONE;
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- intel->vertex_attr_count = 0;
- intel->coloroffset = 0;
- intel->specoffset = 0;
- offset = 0;
-
- if (i915->vertex_fog == I915_FOG_PIXEL) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
- index &= ~_TNL_BIT_FOG;
- }
- else if (index & _TNL_BITS_TEX_ANY) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, S4_VFMT_XYZ, 12 );
- }
-
- /* How undefined is undefined? */
- if (index & _TNL_BIT_POINTSIZE) {
- EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, S4_VFMT_POINT_WIDTH, 4 );
- }
-
- intel->coloroffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4 );
-
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if (index & _TNL_BIT_COLOR1) {
- intel->specoffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, S4_VFMT_SPEC_FOG, 3 );
- } else
- EMIT_PAD( 3 );
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, S4_VFMT_SPEC_FOG, 1 );
- else
- EMIT_PAD( 1 );
- }
-
- if (index & _TNL_BITS_TEX_ANY) {
- for (i = 0; i < 8; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- int sz = VB->TexCoordPtr[i]->size;
-
- s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
- s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(sz));
-
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_SZ(sz), 0, sz * 4 );
- }
- }
- }
-
- /* Only need to change the vertex emit code if there has been a
- * statechange to a new hardware vertex format:
- */
- if (s2 != i915->state.Ctx[I915_CTXREG_LIS2] ||
- s4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
-
- I915_STATECHANGE( i915, I915_UPLOAD_CTX );
-
- i915->tex_program.translated = 0;
-
- /* Must do this *after* statechange, so as not to affect
- * buffered vertices reliant on the old state:
- */
- intel->vertex_size = _tnl_install_attrs( ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->vertex_size >>= 2;
-
- i915->state.Ctx[I915_CTXREG_LIS2] = s2;
- i915->state.Ctx[I915_CTXREG_LIS4] = s4;
-
- assert(intel->vtbl.check_vertex_size( intel, intel->vertex_size ));
- }
-
- if (!i915->tex_program.translated ||
- i915->last_ReallyEnabled != ctx->Texture._EnabledUnits) {
- i915EmitTextureProgram( i915 );
- i915->last_ReallyEnabled = ctx->Texture._EnabledUnits;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c
deleted file mode 100644
index 7a274bb69..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c
+++ /dev/null
@@ -1,922 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "mm.h"
-
-#include "intel_screen.h"
-#include "intel_ioctl.h"
-#include "intel_tex.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-static GLint initial_offsets[6][2] = { {0,0},
- {0,2},
- {1,0},
- {1,2},
- {1,1},
- {1,3} };
-
-
-static GLint step_offsets[6][2] = { {0,2},
- {0,2},
- {-1,2},
- {-1,2},
- {-1,1},
- {-1,1} };
-
-
-#define I915_TEX_UNIT_ENABLED(unit) (1<<unit)
-
-static void i915LayoutTextureImages( i915ContextPtr i915,
- struct gl_texture_object *tObj )
-{
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
- GLint firstLevel, lastLevel, numLevels;
- GLint i, total_height, pitch;
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- firstLevel = t->intel.base.firstLevel;
- lastLevel = t->intel.base.lastLevel;
- numLevels = lastLevel - firstLevel + 1;
-
-
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- switch (tObj->Target) {
- case GL_TEXTURE_CUBE_MAP: {
- const GLuint dim = tObj->Image[0][firstLevel]->Width;
- GLuint face;
-
- pitch = dim * t->intel.texelBytes;
- pitch *= 2; /* double pitch for cube layouts */
- pitch = (pitch + 3) & ~3;
-
- total_height = dim * 4;
-
- for ( face = 0 ; face < 6 ; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
-
- t->intel.base.dirty_images[face] = ~0;
-
- assert(tObj->Image[face][firstLevel]->Width == dim);
- assert(tObj->Image[face][firstLevel]->Height == dim);
-
- for (i = 0; i < numLevels; i++) {
- t->intel.image[face][i].image = tObj->Image[face][firstLevel + i];
- if (!t->intel.image[face][i].image) {
- fprintf(stderr, "no image %d %d\n", face, i);
- break; /* can't happen */
- }
-
- t->intel.image[face][i].offset =
- y * pitch + x * t->intel.texelBytes;
- t->intel.image[face][i].internalFormat = baseImage->Format;
-
- d >>= 1;
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- }
- }
- break;
- }
- case GL_TEXTURE_3D: {
- GLuint virtual_height;
- GLuint tmp_numLevels = numLevels;
- pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
- pitch = (pitch + 3) & ~3;
- t->intel.base.dirty_images[0] = ~0;
-
- /* Calculate the size of a single slice. Hardware demands a
- * minimum of 8 mipmaps, some of which might ultimately not be
- * used:
- */
- if (tmp_numLevels < 9)
- tmp_numLevels = 9;
-
- virtual_height = tObj->Image[0][firstLevel]->Height;
-
- for ( total_height = i = 0 ; i < tmp_numLevels ; i++ ) {
- t->intel.image[0][i].image = tObj->Image[0][firstLevel + i];
- if (t->intel.image[0][i].image) {
- t->intel.image[0][i].offset = total_height * pitch;
- t->intel.image[0][i].internalFormat = baseImage->Format;
- }
-
- total_height += MAX2(2, virtual_height);
- virtual_height >>= 1;
- }
-
- t->intel.depth_pitch = total_height * pitch;
-
- /* Multiply slice size by texture depth for total size. It's
- * remarkable how wasteful of memory all the i8x0 texture
- * layouts are.
- */
- total_height *= t->intel.image[0][0].image->Depth;
- break;
- }
- default:
- pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
- pitch = (pitch + 3) & ~3;
- t->intel.base.dirty_images[0] = ~0;
-
- for ( total_height = i = 0 ; i < numLevels ; i++ ) {
- t->intel.image[0][i].image = tObj->Image[0][firstLevel + i];
- if (!t->intel.image[0][i].image)
- break;
-
- t->intel.image[0][i].offset = total_height * pitch;
- t->intel.image[0][i].internalFormat = baseImage->Format;
- if (t->intel.image[0][i].image->IsCompressed)
- {
- if (t->intel.image[0][i].image->Height > 4)
- total_height += t->intel.image[0][i].image->Height/4;
- else
- total_height += 1;
- }
- else
- total_height += MAX2(2, t->intel.image[0][i].image->Height);
- }
- break;
- }
-
- t->intel.Pitch = pitch;
- t->intel.base.totalSize = total_height*pitch;
- t->intel.max_level = numLevels-1;
-}
-
-
-static void i945LayoutTextureImages( i915ContextPtr i915,
- struct gl_texture_object *tObj )
-{
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
- GLint firstLevel, lastLevel, numLevels;
- GLint i, total_height, pitch, sz, max_offset = 0, offset;
-
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
- /* Figure out the amount of memory required to hold all the mipmap
- * levels. Choose the smallest pitch to accomodate the largest
- * mipmap:
- */
- firstLevel = t->intel.base.firstLevel;
- lastLevel = t->intel.base.lastLevel;
- numLevels = lastLevel - firstLevel + 1;
-
-
-
- /* All images must be loaded at this pitch. Count the number of
- * lines required:
- */
- switch (tObj->Target) {
- case GL_TEXTURE_CUBE_MAP: {
- const GLuint dim = tObj->Image[0][firstLevel]->Width;
- GLuint face;
-
- /* Depending on the size of the largest images, pitch can be
- * determined either by the old-style packing of cubemap faces,
- * or the final row of 4x4, 2x2 and 1x1 faces below this.
- */
- if (dim > 32) {
- pitch = dim * t->intel.texelBytes;
- pitch *= 2; /* double pitch for cube layouts */
- pitch = (pitch + 3) & ~3;
- }
- else {
- pitch = 14 * 8 * t->intel.texelBytes; /* determined by row of
- * little maps at
- * bottom */
- }
-
- total_height = dim * 4 + 4;
-
- for ( face = 0 ; face < 6 ; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
-
- if (dim == 4 && face >= 4) {
- y = total_height - 4;
- x = (face - 4) * 8;
- }
- else if (dim < 4) {
- y = total_height - 4;
- x = face * 8;
- }
-
- t->intel.base.dirty_images[face] = ~0;
-
- assert(tObj->Image[face][firstLevel]->Width == dim);
- assert(tObj->Image[face][firstLevel]->Height == dim);
-
- for (i = 0; i < numLevels; i++) {
-
-
- t->intel.image[face][i].image = tObj->Image[face][firstLevel + i];
- assert(t->intel.image[face][i].image);
-
- t->intel.image[face][i].offset =
- y * pitch + x * t->intel.texelBytes;
- t->intel.image[face][i].internalFormat = baseImage->Format;
-
- d >>= 1;
-
- switch (d) {
- case 4:
- switch (face) {
- case FACE_POS_X:
- case FACE_NEG_X:
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- break;
- case FACE_POS_Y:
- case FACE_NEG_Y:
- y += 12;
- x -= 8;
- break;
- case FACE_POS_Z:
- case FACE_NEG_Z:
- y = total_height - 4;
- x = (face - 4) * 8;
- break;
- }
-
- case 2:
- y = total_height - 4;
- x = 16 + face * 8;
- break;
-
- case 1:
- x += 48;
- break;
-
- default:
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- break;
- }
- }
- }
- max_offset = total_height * pitch;
- break;
- }
- case GL_TEXTURE_3D: {
- GLuint depth_packing = 0, depth_pack_pitch;
- GLuint tmp_numLevels = numLevels;
- pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
- pitch = (pitch + 3) & ~3;
- depth_pack_pitch = pitch;
-
- t->intel.base.dirty_images[0] = ~0;
-
-
- for ( total_height = i = 0 ; i < tmp_numLevels ; i++ ) {
- t->intel.image[0][i].image = tObj->Image[0][firstLevel + i];
- if (!t->intel.image[0][i].image)
- break;
-
-
- t->intel.image[0][i].offset = total_height * pitch;
- t->intel.image[0][i].internalFormat = baseImage->Format;
-
-
-
- total_height += MAX2(2, t->intel.image[0][i].image->Height) *
- MAX2((t->intel.image[0][i].image->Depth >> depth_packing), 1);
-
- /* When alignment dominates, can't increase depth packing?
- * Or does pitch grow??? What are the alignment constraints,
- * anyway?
- */
- if (depth_pack_pitch > 4) {
- depth_packing++;
- depth_pack_pitch <<= 2;
- }
- }
-
- max_offset = total_height * pitch;
- break;
- }
- default:
- pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
- pitch = (pitch + 3) & ~3;
- t->intel.base.dirty_images[0] = ~0;
- max_offset = 0;
-
- for ( offset = i = 0 ; i < numLevels ; i++ ) {
- t->intel.image[0][i].image = tObj->Image[0][firstLevel + i];
- if (!t->intel.image[0][i].image)
- break;
-
- t->intel.image[0][i].offset = offset;
- t->intel.image[0][i].internalFormat = baseImage->Format;
-
- if (t->intel.image[0][i].image->IsCompressed)
- sz = MAX2(1, t->intel.image[0][i].image->Height/4) * pitch;
- else
- sz = MAX2(2, t->intel.image[0][i].image->Height) * pitch;
-
- /* Because the images are packed better, the final offset
- * might not be the maximal one:
- */
- max_offset = MAX2(max_offset, offset + sz);
-
- /* LPT change: step right after second mipmap.
- */
- if (i == 1)
- offset += pitch / 2;
- else
- offset += sz;
-
- }
- break;
- }
-
- t->intel.Pitch = pitch;
- t->intel.base.totalSize = max_offset;
- t->intel.max_level = numLevels-1;
-}
-
-
-
-
-static void i915SetTexImages( i915ContextPtr i915,
- struct gl_texture_object *tObj )
-{
- GLuint textureFormat;
- i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint ss2 = 0;
-
- switch( baseImage->TexFormat->MesaFormat ) {
- case MESA_FORMAT_L8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_L8;
- break;
-
- case MESA_FORMAT_I8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_I8;
- break;
-
- case MESA_FORMAT_A8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_A8;
- break;
-
- case MESA_FORMAT_AL88:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_AY88;
- break;
-
- case MESA_FORMAT_RGB565:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
- break;
-
- case MESA_FORMAT_ARGB1555:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
- break;
-
- case MESA_FORMAT_ARGB4444:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB4444;
- break;
-
- case MESA_FORMAT_ARGB8888:
- t->intel.texelBytes = 4;
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- break;
-
- case MESA_FORMAT_YCBCR_REV:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_NORMAL);
- ss2 |= SS2_COLORSPACE_CONVERSION;
- break;
-
- case MESA_FORMAT_YCBCR:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_SWAPY);
- ss2 |= SS2_COLORSPACE_CONVERSION;
- break;
-
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
- break;
-
- case MESA_FORMAT_DEPTH_COMPONENT16:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_16BIT | MT_16BIT_L16);
- break;
-
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGB_DXT1:
- /*
- * DXTn pitches are Width/4 * blocksize in bytes
- * for DXT1: blocksize=8 so Width/4*8 = Width * 2
- * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
- */
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
- break;
-
- case MESA_FORMAT_RGBA_DXT3:
- t->intel.texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
- break;
-
- case MESA_FORMAT_RGBA_DXT5:
- t->intel.texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
- break;
-
-#if 0
- case MESA_FORMAT_DEPTH_COMPONENT_X8Z24:
- t->intel.texelBytes = 4;
- textureFormat = (MAPSURF_32BIT | MT_32BIT_xL824);
- break;
-#endif
-
- default:
- fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__,
- baseImage->TexFormat->MesaFormat);
- abort();
- }
-
-
- if (i915->intel.intelScreen->deviceID == PCI_CHIP_I945_G)
- i945LayoutTextureImages( i915, tObj );
- else
- i915LayoutTextureImages( i915, tObj );
-
- t->Setup[I915_TEXREG_MS3] =
- (((tObj->Image[0][t->intel.base.firstLevel]->Height - 1) << MS3_HEIGHT_SHIFT) |
- ((tObj->Image[0][t->intel.base.firstLevel]->Width - 1) << MS3_WIDTH_SHIFT) |
- textureFormat |
- MS3_USE_FENCE_REGS);
-
- t->Setup[I915_TEXREG_MS4] =
- ((((t->intel.Pitch / 4) - 1) << MS4_PITCH_SHIFT) |
- MS4_CUBE_FACE_ENA_MASK |
- (((t->intel.max_level * 4)) << MS4_MAX_LOD_SHIFT) |
- ((tObj->Image[0][t->intel.base.firstLevel]->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
-
- t->Setup[I915_TEXREG_SS2] &= ~(SS2_COLORSPACE_CONVERSION);
- t->Setup[I915_TEXREG_SS2] |= ss2;
-
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
-
-}
-
-
-/* The i915 (and related graphics cores) do not support GL_CLAMP. The
- * Intel drivers for "other operating systems" implement GL_CLAMP as
- * GL_CLAMP_TO_EDGE, so the same is done here.
- */
-static GLuint translate_wrap_mode( GLenum wrap )
-{
- switch( wrap ) {
- case GL_REPEAT: return TEXCOORDMODE_WRAP;
- case GL_CLAMP: return TEXCOORDMODE_CLAMP_EDGE; /* not quite correct */
- case GL_CLAMP_TO_EDGE: return TEXCOORDMODE_CLAMP_EDGE;
- case GL_CLAMP_TO_BORDER: return TEXCOORDMODE_CLAMP_BORDER;
- case GL_MIRRORED_REPEAT: return TEXCOORDMODE_MIRROR;
- default: return TEXCOORDMODE_WRAP;
- }
-}
-
-
-/**
- */
-static void i915ImportTexObjState( struct gl_texture_object *texObj )
-{
- i915TextureObjectPtr t = (i915TextureObjectPtr)texObj->DriverData;
- int minFilt = 0, mipFilt = 0, magFilt = 0, shadow = 0;
-
- if(INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (texObj->MinFilter) {
- case GL_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_LINEAR;
- break;
- default:
- break;
- }
-
- if ( texObj->MaxAnisotropy > 1.0 ) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- }
- else {
- switch (texObj->MagFilter) {
- case GL_NEAREST:
- magFilt = FILTER_NEAREST;
- break;
- case GL_LINEAR:
- magFilt = FILTER_LINEAR;
- break;
- default:
- break;
- }
- }
-
- if (texObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB &&
- texObj->Target != GL_TEXTURE_3D) {
-
- shadow = SS2_SHADOW_ENABLE;
- shadow |= intel_translate_compare_func( texObj->CompareFunc );
-
- minFilt = FILTER_4X4_FLAT;
- magFilt = FILTER_4X4_FLAT;
- }
-
-
- t->Setup[I915_TEXREG_SS2] &= ~(SS2_MIN_FILTER_MASK |
- SS2_MIP_FILTER_MASK |
- SS2_MAG_FILTER_MASK |
- SS2_SHADOW_ENABLE |
- SS2_SHADOW_FUNC_MASK);
- t->Setup[I915_TEXREG_SS2] |= ((minFilt << SS2_MIN_FILTER_SHIFT) |
- (mipFilt << SS2_MIP_FILTER_SHIFT) |
- (magFilt << SS2_MAG_FILTER_SHIFT) |
- shadow);
-
- {
- GLuint ss3 = t->Setup[I915_TEXREG_SS3] & ~(SS3_TCX_ADDR_MODE_MASK |
- SS3_TCY_ADDR_MODE_MASK |
- SS3_TCZ_ADDR_MODE_MASK);
- GLenum ws = texObj->WrapS;
- GLenum wt = texObj->WrapT;
- GLenum wr = texObj->WrapR;
-
- t->refs_border_color = 0;
-
- if (texObj->Target == GL_TEXTURE_3D &&
- (texObj->MinFilter != GL_NEAREST ||
- texObj->MagFilter != GL_NEAREST)) {
-
- /* Try to mimic GL_CLAMP functionality a little better -
- * switch to CLAMP_TO_BORDER whenever a non-NEAREST filter is
- * in use. Only do this for 3D textures at the moment --
- * doing it universally would fix the conform texbc.c
- * failure, though.
- */
- if (ws == GL_CLAMP) ws = GL_CLAMP_TO_BORDER;
- if (wt == GL_CLAMP) wt = GL_CLAMP_TO_BORDER;
- if (wr == GL_CLAMP) wr = GL_CLAMP_TO_BORDER;
-
- /* 3D textures don't seem to respect the border color.
- * Fallback if there's ever a danger that they might refer to
- * it.
- */
- if (ws == GL_CLAMP_TO_BORDER) t->refs_border_color = 1;
- if (wt == GL_CLAMP_TO_BORDER) t->refs_border_color = 1;
- if (wr == GL_CLAMP_TO_BORDER) t->refs_border_color = 1;
- }
-
- ss3 |= translate_wrap_mode(ws) << SS3_TCX_ADDR_MODE_SHIFT;
- ss3 |= translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT;
- ss3 |= translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT;
-
- if (ss3 != t->Setup[I915_TEXREG_SS3]) {
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
- t->Setup[I915_TEXREG_SS3] = ss3;
- }
- }
-
- {
- const GLubyte *color = texObj->_BorderChan;
-
- t->Setup[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(color[0],color[1],
- color[2],color[3]);
- }
-}
-
-
-
-static void i915_import_tex_unit( i915ContextPtr i915,
- i915TextureObjectPtr t,
- GLuint unit )
-{
- GLuint state[I915_TEX_SETUP_SIZE];
-
- if(INTEL_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s unit(%d)\n", __FUNCTION__, unit);
-
- if (i915->intel.CurrentTexObj[unit])
- i915->intel.CurrentTexObj[unit]->base.bound &= ~(1U << unit);
-
- i915->intel.CurrentTexObj[unit] = (intelTextureObjectPtr)t;
- t->intel.base.bound |= (1 << unit);
-
- if (t->intel.dirty & I915_UPLOAD_TEX(unit)) {
- i915ImportTexObjState( t->intel.base.tObj );
- t->intel.dirty &= ~I915_UPLOAD_TEX(unit);
- }
-
- state[I915_TEXREG_MS2] = t->intel.TextureOffset;
- state[I915_TEXREG_MS3] = t->Setup[I915_TEXREG_MS3];
- state[I915_TEXREG_MS4] = t->Setup[I915_TEXREG_MS4];
-
- state[I915_TEXREG_SS2] = (i915->state.Tex[unit][I915_TEXREG_SS2] &
- SS2_LOD_BIAS_MASK);
- state[I915_TEXREG_SS2] |= (t->Setup[I915_TEXREG_SS2] & ~SS2_LOD_BIAS_MASK);
-
- state[I915_TEXREG_SS3] = (i915->state.Tex[unit][I915_TEXREG_SS3] &
- SS3_NORMALIZED_COORDS);
- state[I915_TEXREG_SS3] |= (t->Setup[I915_TEXREG_SS3] &
- ~(SS3_NORMALIZED_COORDS|
- SS3_TEXTUREMAP_INDEX_MASK));
-
- state[I915_TEXREG_SS3] |= (unit<<SS3_TEXTUREMAP_INDEX_SHIFT);
-
- state[I915_TEXREG_SS4] = t->Setup[I915_TEXREG_SS4];
-
-
- if (memcmp(state, i915->state.Tex[unit], sizeof(state)) != 0) {
- I915_STATECHANGE( i915, I915_UPLOAD_TEX(unit) );
- memcpy(i915->state.Tex[unit], state, sizeof(state));
- }
-}
-
-
-
-static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i915TextureObjectPtr t = (i915TextureObjectPtr)tObj->DriverData;
-
- if (0) fprintf(stderr, "%s %d\n", __FUNCTION__, unit);
-
- if (!(i915->state.active & I915_UPLOAD_TEX(unit))) {
- I915_ACTIVESTATE(i915, I915_UPLOAD_TEX(unit), GL_TRUE);
- }
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) {
- return GL_FALSE;
- }
-
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (i915->intel.CurrentTexObj[unit] != &t->intel ||
- (t->intel.dirty & I915_UPLOAD_TEX(unit))) {
- i915_import_tex_unit( i915, t, unit);
- i915->tex_program.translated = 0;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i915TextureObjectPtr t = (i915TextureObjectPtr)tObj->DriverData;
- GLuint ss3 = i915->state.Tex[unit][I915_TEXREG_SS3];
-
- ss3 &= ~SS3_NORMALIZED_COORDS;
-
- if (ss3 != i915->state.Tex[unit][I915_TEXREG_SS3]) {
- I915_STATECHANGE(i915, I915_UPLOAD_TEX(unit));
- i915->state.Tex[unit][I915_TEXREG_SS3] = ss3;
- }
-
- /* Upload teximages (not pipelined)
- */
- if (t->intel.base.dirty_images[0]) {
- i915SetTexImages( i915, tObj );
- if (!intelUploadTexImages( &i915->intel, &t->intel, 0 )) {
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i915TextureObjectPtr t = (i915TextureObjectPtr)tObj->DriverData;
- GLuint ss3 = i915->state.Tex[unit][I915_TEXREG_SS3];
-
- ss3 |= SS3_NORMALIZED_COORDS;
-
- if (ss3 != i915->state.Tex[unit][I915_TEXREG_SS3]) {
- I915_STATECHANGE(i915, I915_UPLOAD_TEX(unit));
- i915->state.Tex[unit][I915_TEXREG_SS3] = ss3;
- }
-
- /* Upload teximages (not pipelined)
- */
- if (t->intel.base.dirty_images[0]) {
- i915SetTexImages( i915, tObj );
- if (!intelUploadTexImages( &i915->intel, &t->intel, 0 )) {
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_cube( GLcontext *ctx, GLuint unit )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- i915TextureObjectPtr t = (i915TextureObjectPtr)tObj->DriverData;
- GLuint ss3 = i915->state.Tex[unit][I915_TEXREG_SS3];
- GLuint face;
-
- ss3 |= SS3_NORMALIZED_COORDS;
-
- if (ss3 != i915->state.Tex[unit][I915_TEXREG_SS3]) {
- I915_STATECHANGE(i915, I915_UPLOAD_TEX(unit));
- i915->state.Tex[unit][I915_TEXREG_SS3] = ss3;
- }
-
- /* Upload teximages (not pipelined)
- */
- if ( t->intel.base.dirty_images[0] || t->intel.base.dirty_images[1] ||
- t->intel.base.dirty_images[2] || t->intel.base.dirty_images[3] ||
- t->intel.base.dirty_images[4] || t->intel.base.dirty_images[5] ) {
- i915SetTexImages( i915, tObj );
- }
-
- /* upload (per face) */
- for (face = 0; face < 6; face++) {
- if (t->intel.base.dirty_images[face]) {
- if (!intelUploadTexImages( &i915->intel, &t->intel, face )) {
- return GL_FALSE;
- }
- }
- }
-
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_3d( GLcontext *ctx, GLuint unit )
-{
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- i915TextureObjectPtr t = (i915TextureObjectPtr)tObj->DriverData;
-
- /* 3D textures on I915 seem to get bogus border colors, hence this
- * fallback:
- */
- if (t->refs_border_color)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-
-
-static GLboolean disable_tex( GLcontext *ctx, GLuint unit )
-{
- i915ContextPtr i915 = I915_CONTEXT(ctx);
-
- if (i915->state.active & I915_UPLOAD_TEX(unit)) {
- I915_ACTIVESTATE(i915, I915_UPLOAD_TEX(unit), GL_FALSE);
- }
-
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
- if ( i915->intel.CurrentTexObj[unit] != NULL ) {
- i915->intel.CurrentTexObj[unit]->base.bound &= ~(1U << 0);
- i915->intel.CurrentTexObj[unit] = NULL;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean i915UpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if (texUnit->_ReallyEnabled &&
- INTEL_CONTEXT(ctx)->intelScreen->textureSize < 2048 * 1024)
- return GL_FALSE;
-
- switch (texUnit->_ReallyEnabled) {
- case TEXTURE_1D_BIT:
- case TEXTURE_2D_BIT:
- return (enable_tex_2d( ctx, unit ) &&
- enable_tex_common( ctx, unit ));
- case TEXTURE_RECT_BIT:
- return (enable_tex_rect( ctx, unit ) &&
- enable_tex_common( ctx, unit ));
- case TEXTURE_CUBE_BIT:
- return (enable_tex_cube( ctx, unit ) &&
- enable_tex_common( ctx, unit ));
- case TEXTURE_3D_BIT:
- return (enable_tex_2d( ctx, unit ) &&
- enable_tex_common( ctx, unit ) &&
- enable_tex_3d( ctx, unit));
- case 0:
- return disable_tex( ctx, unit );
- default:
- return GL_FALSE;
- }
-}
-
-
-void i915UpdateTextureState( intelContextPtr intel )
-{
- GLcontext *ctx = &intel->ctx;
- GLboolean ok = GL_TRUE;
- GLuint i;
-
- for (i = 0 ; i < I915_TEX_UNITS && ok ; i++) {
- ok = i915UpdateTexUnit( ctx, i );
- }
-
- FALLBACK( intel, I915_FALLBACK_TEXTURE, !ok );
-}
-
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_vtbl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_vtbl.c
deleted file mode 100644
index 795286601..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "tnl/t_context.h"
-#include "tnl/t_vertex.h"
-
-#include "intel_batchbuffer.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-
-static void i915_render_start( intelContextPtr intel )
-{
- GLcontext *ctx = &intel->ctx;
- i915ContextPtr i915 = I915_CONTEXT(intel);
-
- if (ctx->FragmentProgram._Active)
- i915ValidateFragmentProgram( i915 );
- else
- i915ValidateTextureProgram( i915 );
-}
-
-
-static void i915_reduced_primitive_state( intelContextPtr intel,
- GLenum rprim )
-{
- i915ContextPtr i915 = I915_CONTEXT(intel);
- GLuint st1 = i915->state.Stipple[I915_STPREG_ST1];
-
- st1 &= ~ST1_ENABLE;
-
- switch (rprim) {
- case GL_TRIANGLES:
- if (intel->ctx.Polygon.StippleFlag &&
- intel->hw_stipple)
- st1 |= ST1_ENABLE;
- break;
- case GL_LINES:
- case GL_POINTS:
- default:
- break;
- }
-
- i915->intel.reduced_primitive = rprim;
-
- if (st1 != i915->state.Stipple[I915_STPREG_ST1]) {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- i915->state.Stipple[I915_STPREG_ST1] = st1;
- }
-}
-
-
-/* Pull apart the vertex format registers and figure out how large a
- * vertex is supposed to be.
- */
-static GLboolean i915_check_vertex_size( intelContextPtr intel,
- GLuint expected )
-{
- i915ContextPtr i915 = I915_CONTEXT(intel);
- int lis2 = i915->current->Ctx[I915_CTXREG_LIS2];
- int lis4 = i915->current->Ctx[I915_CTXREG_LIS4];
- int i, sz = 0;
-
- switch (lis4 & S4_VFMT_XYZW_MASK) {
- case S4_VFMT_XY: sz = 2; break;
- case S4_VFMT_XYZ: sz = 3; break;
- case S4_VFMT_XYW: sz = 3; break;
- case S4_VFMT_XYZW: sz = 4; break;
- default:
- fprintf(stderr, "no xyzw specified\n");
- return 0;
- }
-
- if (lis4 & S4_VFMT_SPEC_FOG) sz++;
- if (lis4 & S4_VFMT_COLOR) sz++;
- if (lis4 & S4_VFMT_DEPTH_OFFSET) sz++;
- if (lis4 & S4_VFMT_POINT_WIDTH) sz++;
- if (lis4 & S4_VFMT_FOG_PARAM) sz++;
-
- for (i = 0 ; i < 8 ; i++) {
- switch (lis2 & S2_TEXCOORD_FMT0_MASK) {
- case TEXCOORDFMT_2D: sz += 2; break;
- case TEXCOORDFMT_3D: sz += 3; break;
- case TEXCOORDFMT_4D: sz += 4; break;
- case TEXCOORDFMT_1D: sz += 1; break;
- case TEXCOORDFMT_2D_16: sz += 1; break;
- case TEXCOORDFMT_4D_16: sz += 2; break;
- case TEXCOORDFMT_NOT_PRESENT: break;
- default:
- fprintf(stderr, "bad texcoord fmt %d\n", i);
- return GL_FALSE;
- }
- lis2 >>= S2_TEXCOORD_FMT1_SHIFT;
- }
-
- if (sz != expected)
- fprintf(stderr, "vertex size mismatch %d/%d\n", sz, expected);
-
- return sz == expected;
-}
-
-
-static void i915_emit_invarient_state( intelContextPtr intel )
-{
- BATCH_LOCALS;
-
- BEGIN_BATCH( 200 );
-
- OUT_BATCH(_3DSTATE_AA_CMD |
- AA_LINE_ECAAR_WIDTH_ENABLE |
- AA_LINE_ECAAR_WIDTH_1_0 |
- AA_LINE_REGION_WIDTH_ENABLE |
- AA_LINE_REGION_WIDTH_1_0);
-
- OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_Z_CMD);
- OUT_BATCH(0);
-
- /* Don't support texture crossbar yet */
- OUT_BATCH(_3DSTATE_COORD_SET_BINDINGS |
- CSB_TCB(0, 0) |
- CSB_TCB(1, 1) |
- CSB_TCB(2, 2) |
- CSB_TCB(3, 3) |
- CSB_TCB(4, 4) |
- CSB_TCB(5, 5) |
- CSB_TCB(6, 6) |
- CSB_TCB(7, 7));
-
- OUT_BATCH(_3DSTATE_RASTER_RULES_CMD |
- ENABLE_POINT_RASTER_RULE |
- OGL_POINT_RASTER_RULE |
- ENABLE_LINE_STRIP_PROVOKE_VRTX |
- ENABLE_TRI_FAN_PROVOKE_VRTX |
- LINE_STRIP_PROVOKE_VRTX(1) |
- TRI_FAN_PROVOKE_VRTX(2) |
- ENABLE_TEXKILL_3D_4D |
- TEXKILL_4D);
-
- /* Need to initialize this to zero.
- */
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
- I1_LOAD_S(3) |
- (1));
- OUT_BATCH(0);
-
- /* XXX: Use this */
- OUT_BATCH(_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
-
- OUT_BATCH(_3DSTATE_SCISSOR_RECT_0_CMD);
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DEPTH_SUBRECT_DISABLE);
-
- OUT_BATCH(_3DSTATE_LOAD_INDIRECT | 0); /* disable indirect state */
- OUT_BATCH(0);
-
-
- /* Don't support twosided stencil yet */
- OUT_BATCH(_3DSTATE_BACKFACE_STENCIL_OPS |
- BFO_ENABLE_STENCIL_TWO_SIDE |
- 0 );
-
- ADVANCE_BATCH();
-}
-
-
-#define emit( intel, state, size ) \
-do { \
- int k; \
- BEGIN_BATCH( (size) / sizeof(GLuint)); \
- for (k = 0 ; k < (size) / sizeof(GLuint) ; k++) \
- OUT_BATCH((state)[k]); \
- ADVANCE_BATCH(); \
-} while (0);
-
-
-/* Push the state into the sarea and/or texture memory.
- */
-static void i915_emit_state( intelContextPtr intel )
-{
- i915ContextPtr i915 = I915_CONTEXT(intel);
- struct i915_hw_state *state = i915->current;
- int i;
- GLuint dirty;
- BATCH_LOCALS;
-
- /* More to workaround the multitex hang - if one texture unit state
- * is modified, emit all texture units.
- */
- dirty = state->active & ~state->emitted;
- if (dirty & I915_UPLOAD_TEX_ALL)
- state->emitted &= ~I915_UPLOAD_TEX_ALL;
- dirty = state->active & ~state->emitted;
-
-
- if (VERBOSE)
- fprintf(stderr, "%s dirty: %x\n", __FUNCTION__, dirty);
-
- if (dirty & I915_UPLOAD_CTX) {
- if (VERBOSE) fprintf(stderr, "I915_UPLOAD_CTX:\n");
- emit( i915, state->Ctx, sizeof(state->Ctx) );
- }
-
- if (dirty & I915_UPLOAD_BUFFERS) {
- if (VERBOSE) fprintf(stderr, "I915_UPLOAD_BUFFERS:\n");
- emit( i915, state->Buffer, sizeof(state->Buffer) );
- }
-
- if (dirty & I915_UPLOAD_STIPPLE) {
- if (VERBOSE) fprintf(stderr, "I915_UPLOAD_STIPPLE:\n");
- emit( i915, state->Stipple, sizeof(state->Stipple) );
- }
-
- if (dirty & I915_UPLOAD_FOG) {
- if (VERBOSE) fprintf(stderr, "I915_UPLOAD_FOG:\n");
- emit( i915, state->Fog, sizeof(state->Fog) );
- }
-
- /* Combine all the dirty texture state into a single command to
- * avoid lockups on I915 hardware.
- */
- if (dirty & I915_UPLOAD_TEX_ALL) {
- int nr = 0;
-
- for (i = 0; i < I915_TEX_UNITS; i++)
- if (dirty & I915_UPLOAD_TEX(i))
- nr++;
-
- BEGIN_BATCH(2+nr*3);
- OUT_BATCH(_3DSTATE_MAP_STATE | (3*nr));
- OUT_BATCH((dirty & I915_UPLOAD_TEX_ALL) >> I915_UPLOAD_TEX_0_SHIFT);
- for (i = 0 ; i < I915_TEX_UNITS ; i++)
- if (dirty & I915_UPLOAD_TEX(i)) {
- OUT_BATCH(state->Tex[i][I915_TEXREG_MS2]);
- OUT_BATCH(state->Tex[i][I915_TEXREG_MS3]);
- OUT_BATCH(state->Tex[i][I915_TEXREG_MS4]);
- }
- ADVANCE_BATCH();
-
- BEGIN_BATCH(2+nr*3);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE | (3*nr));
- OUT_BATCH((dirty & I915_UPLOAD_TEX_ALL) >> I915_UPLOAD_TEX_0_SHIFT);
- for (i = 0 ; i < I915_TEX_UNITS ; i++)
- if (dirty & I915_UPLOAD_TEX(i)) {
- OUT_BATCH(state->Tex[i][I915_TEXREG_SS2]);
- OUT_BATCH(state->Tex[i][I915_TEXREG_SS3]);
- OUT_BATCH(state->Tex[i][I915_TEXREG_SS4]);
- }
- ADVANCE_BATCH();
- }
-
- if (dirty & I915_UPLOAD_CONSTANTS) {
- if (VERBOSE) fprintf(stderr, "I915_UPLOAD_CONSTANTS:\n");
- emit( i915, state->Constant, state->ConstantSize * sizeof(GLuint) );
- }
-
- if (dirty & I915_UPLOAD_PROGRAM) {
- if (VERBOSE) fprintf(stderr, "I915_UPLOAD_PROGRAM:\n");
-
- assert((state->Program[0] & 0x1ff)+2 == state->ProgramSize);
-
- emit( i915, state->Program, state->ProgramSize * sizeof(GLuint) );
- if (VERBOSE)
- i915_disassemble_program( state->Program, state->ProgramSize );
- }
-
- state->emitted |= dirty;
-}
-
-static void i915_destroy_context( intelContextPtr intel )
-{
- _tnl_free_vertices(&intel->ctx);
-}
-
-static void i915_set_draw_offset( intelContextPtr intel, int offset )
-{
- i915ContextPtr i915 = I915_CONTEXT(intel);
- I915_STATECHANGE( i915, I915_UPLOAD_BUFFERS );
- i915->state.Buffer[I915_DESTREG_CBUFADDR2] = offset;
-}
-
-static void i915_lost_hardware( intelContextPtr intel )
-{
- I915_CONTEXT(intel)->state.emitted = 0;
-}
-
-static void i915_emit_flush( intelContextPtr intel )
-{
- BATCH_LOCALS;
-
- BEGIN_BATCH(2);
- OUT_BATCH( MI_FLUSH | FLUSH_MAP_CACHE | FLUSH_RENDER_CACHE );
- OUT_BATCH( 0 );
- ADVANCE_BATCH();
-}
-
-
-void i915InitVtbl( i915ContextPtr i915 )
-{
- i915->intel.vtbl.alloc_tex_obj = i915AllocTexObj;
- i915->intel.vtbl.check_vertex_size = i915_check_vertex_size;
- i915->intel.vtbl.clear_with_tris = i915ClearWithTris;
- i915->intel.vtbl.destroy = i915_destroy_context;
- i915->intel.vtbl.emit_invarient_state = i915_emit_invarient_state;
- i915->intel.vtbl.emit_state = i915_emit_state;
- i915->intel.vtbl.lost_hardware = i915_lost_hardware;
- i915->intel.vtbl.reduced_primitive_state = i915_reduced_primitive_state;
- i915->intel.vtbl.render_start = i915_render_start;
- i915->intel.vtbl.set_draw_offset = i915_set_draw_offset;
- i915->intel.vtbl.update_texture_state = i915UpdateTextureState;
- i915->intel.vtbl.emit_flush = i915_emit_flush;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.c
deleted file mode 100644
index 7c9ad87be..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.c
+++ /dev/null
@@ -1,688 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 <errno.h>
-
-#include "mtypes.h"
-#include "context.h"
-#include "enums.h"
-
-#include "intel_reg.h"
-#include "intel_batchbuffer.h"
-#include "intel_context.h"
-
-
-
-
-/* ================================================================
- * Performance monitoring functions
- */
-
-static void intel_fill_box( intelContextPtr intel,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLubyte r, GLubyte g, GLubyte b )
-{
- intelEmitFillBlitLocked( intel,
- intel->intelScreen->cpp,
- intel->intelScreen->backPitch,
- intel->intelScreen->frontOffset,
- x, y, w, h,
- INTEL_PACKCOLOR(intel->intelScreen->fbFormat,
- r,g,b,0xff));
-}
-
-static void intel_draw_performance_boxes( intelContextPtr intel )
-{
- /* Purple box for page flipping
- */
- if ( intel->perf_boxes & I830_BOX_FLIP )
- intel_fill_box( intel, 4, 4, 8, 8, 255, 0, 255 );
-
- /* Red box if we have to wait for idle at any point
- */
- if ( intel->perf_boxes & I830_BOX_WAIT )
- intel_fill_box( intel, 16, 4, 8, 8, 255, 0, 0 );
-
- /* Blue box: lost context?
- */
- if ( intel->perf_boxes & I830_BOX_LOST_CONTEXT )
- intel_fill_box( intel, 28, 4, 8, 8, 0, 0, 255 );
-
- /* Yellow box for texture swaps
- */
- if ( intel->perf_boxes & I830_BOX_TEXTURE_LOAD )
- intel_fill_box( intel, 40, 4, 8, 8, 255, 255, 0 );
-
- /* Green box if hardware never idles (as far as we can tell)
- */
- if ( !(intel->perf_boxes & I830_BOX_RING_EMPTY) )
- intel_fill_box( intel, 64, 4, 8, 8, 0, 255, 0 );
-
-
- /* Draw bars indicating number of buffers allocated
- * (not a great measure, easily confused)
- */
-#if 0
- if (intel->dma_used) {
- int bar = intel->dma_used / 10240;
- if (bar > 100) bar = 100;
- if (bar < 1) bar = 1;
- intel_fill_box( intel, 4, 16, bar, 4, 196, 128, 128 );
- intel->dma_used = 0;
- }
-#endif
-
- intel->perf_boxes = 0;
-}
-
-
-
-
-
-
-static int bad_prim_vertex_nr( int primitive, int nr )
-{
- switch (primitive & PRIM3D_MASK) {
- case PRIM3D_POINTLIST:
- return nr < 1;
- case PRIM3D_LINELIST:
- return (nr & 1) || nr == 0;
- case PRIM3D_LINESTRIP:
- return nr < 2;
- case PRIM3D_TRILIST:
- case PRIM3D_RECTLIST:
- return nr % 3 || nr == 0;
- case PRIM3D_POLY:
- case PRIM3D_TRIFAN:
- case PRIM3D_TRISTRIP:
- case PRIM3D_TRISTRIP_RVRSE:
- return nr < 3;
- default:
- return 1;
- }
-}
-
-static void intel_flush_inline_primitive( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- GLuint used = intel->batch.ptr - intel->prim.start_ptr;
- GLuint vertcount;
-
- assert(intel->prim.primitive != ~0);
-
- if (1) {
- /* Check vertex size against the vertex we're specifying to
- * hardware. If it's wrong, ditch the primitive.
- */
- if (!intel->vtbl.check_vertex_size( intel, intel->vertex_size ))
- goto do_discard;
-
- vertcount = (used - 4)/ (intel->vertex_size * 4);
-
- if (!vertcount)
- goto do_discard;
-
- if (vertcount * intel->vertex_size * 4 != used - 4) {
- fprintf(stderr, "vertex size confusion %d %d\n", used,
- intel->vertex_size * vertcount * 4);
- goto do_discard;
- }
-
- if (bad_prim_vertex_nr( intel->prim.primitive, vertcount )) {
- fprintf(stderr, "bad_prim_vertex_nr %x %d\n", intel->prim.primitive,
- vertcount);
- goto do_discard;
- }
- }
-
- if (used < 8)
- goto do_discard;
-
- *(int *)intel->prim.start_ptr = (_3DPRIMITIVE |
- intel->prim.primitive |
- (used/4-2));
-
- goto finished;
-
- do_discard:
- intel->batch.ptr -= used;
- intel->batch.space += used;
- assert(intel->batch.space >= 0);
-
- finished:
- intel->prim.primitive = ~0;
- intel->prim.start_ptr = 0;
- intel->prim.flush = 0;
-}
-
-
-/* Emit a primitive referencing vertices in a vertex buffer.
- */
-void intelStartInlinePrimitive( intelContextPtr intel, GLuint prim )
-{
- BATCH_LOCALS;
-
- if (0)
- fprintf(stderr, "%s %x\n", __FUNCTION__, prim);
-
-
- /* Finish any in-progress primitive:
- */
- INTEL_FIREVERTICES( intel );
-
- /* Emit outstanding state:
- */
- intel->vtbl.emit_state( intel );
-
- /* Make sure there is some space in this buffer:
- */
- if (intel->vertex_size * 10 * sizeof(GLuint) >= intel->batch.space)
- intelFlushBatch(intel, GL_TRUE);
-
-
-#if 1
- if (((int)intel->batch.ptr) & 0x4) {
- BEGIN_BATCH(1);
- OUT_BATCH(0);
- ADVANCE_BATCH();
- }
-#endif
-
- /* Emit a slot which will be filled with the inline primitive
- * command later.
- */
- BEGIN_BATCH(2);
- OUT_BATCH( 0 );
-
- intel->prim.start_ptr = batch_ptr;
- intel->prim.primitive = prim;
- intel->prim.flush = intel_flush_inline_primitive;
-
- OUT_BATCH( 0 );
- ADVANCE_BATCH();
-}
-
-
-void intelRestartInlinePrimitive( intelContextPtr intel )
-{
- GLuint prim = intel->prim.primitive;
-
- intel_flush_inline_primitive( &intel->ctx );
- if (1) intelFlushBatch(intel, GL_TRUE); /* GL_TRUE - is critical */
- intelStartInlinePrimitive( intel, prim );
-}
-
-
-
-void intelWrapInlinePrimitive( intelContextPtr intel )
-{
- GLuint prim = intel->prim.primitive;
-
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
- intel_flush_inline_primitive( &intel->ctx );
- intelFlushBatch(intel, GL_TRUE);
- intelStartInlinePrimitive( intel, prim );
-}
-
-
-/* Emit a primitive with space for inline vertices.
- */
-GLuint *intelEmitInlinePrimitiveLocked(intelContextPtr intel,
- int primitive,
- int dwords,
- int vertex_size )
-{
- GLuint *tmp = 0;
- BATCH_LOCALS;
-
- if (0)
- fprintf(stderr, "%s 0x%x %d\n", __FUNCTION__, primitive, dwords);
-
- /* Emit outstanding state:
- */
- intel->vtbl.emit_state( intel );
-
-
- if (1) {
- int used = dwords * 4;
- int vertcount;
-
- /* Check vertex size against the vertex we're specifying to
- * hardware. If it's wrong, ditch the primitive.
- */
- if (!intel->vtbl.check_vertex_size( intel, vertex_size ))
- goto do_discard;
-
- vertcount = dwords / vertex_size;
-
- if (dwords % vertex_size) {
- fprintf(stderr, "did not request a whole number of vertices\n");
- goto do_discard;
- }
-
- if (bad_prim_vertex_nr( primitive, vertcount )) {
- fprintf(stderr, "bad_prim_vertex_nr %x %d\n", primitive, vertcount);
- goto do_discard;
- }
-
- if (used < 8)
- goto do_discard;
- }
-
- /* Emit 3D_PRIMITIVE commands:
- */
- BEGIN_BATCH(1 + dwords);
- OUT_BATCH( _3DPRIMITIVE |
- primitive |
- (dwords-1) );
-
- tmp = (GLuint *)batch_ptr;
- batch_ptr += dwords * 4;
-
- ADVANCE_BATCH();
-
- do_discard:
- return tmp;
-}
-
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- intelContextPtr intel;
-
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
- {
- intelScreenPrivate *intelScreen = intel->intelScreen;
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *pbox = dPriv->pClipRects;
- int pitch = intelScreen->frontPitch;
- int cpp = intelScreen->cpp;
- int i;
- GLuint CMD, BR13;
- BATCH_LOCALS;
-
- switch(cpp) {
- case 2:
- BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24);
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
- case 4:
- BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24) | (1<<25);
- CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- XY_SRC_COPY_BLT_WRITE_RGB);
- break;
- default:
- BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24);
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
- }
-
- if (0)
- intel_draw_performance_boxes( intel );
-
- for (i = 0 ; i < nbox; i++, pbox++)
- {
- if (pbox->x1 > pbox->x2 ||
- pbox->y1 > pbox->y2 ||
- pbox->x2 > intelScreen->width ||
- pbox->y2 > intelScreen->height)
- continue;
-
- BEGIN_BATCH( 8);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
- OUT_BATCH( (pbox->y2 << 16) | pbox->x2 );
-
- if (intel->sarea->pf_current_page == 0)
- OUT_BATCH( intelScreen->frontOffset );
- else
- OUT_BATCH( intelScreen->backOffset );
-
- OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
- OUT_BATCH( BR13 & 0xffff );
-
- if (intel->sarea->pf_current_page == 0)
- OUT_BATCH( intelScreen->backOffset );
- else
- OUT_BATCH( intelScreen->frontOffset );
-
- ADVANCE_BATCH();
- }
- }
- intelFlushBatchLocked( intel, GL_TRUE, GL_TRUE, GL_TRUE );
- UNLOCK_HARDWARE( intel );
-}
-
-
-
-
-void intelEmitFillBlitLocked( intelContextPtr intel,
- GLuint cpp,
- GLshort dst_pitch,
- GLuint dst_offset,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLuint color )
-{
- GLuint BR13, CMD;
- BATCH_LOCALS;
-
- dst_pitch *= cpp;
-
- switch(cpp) {
- case 1:
- case 2:
- case 3:
- BR13 = dst_pitch | (0xF0 << 16) | (1<<24);
- CMD = XY_COLOR_BLT_CMD;
- break;
- case 4:
- BR13 = dst_pitch | (0xF0 << 16) | (1<<24) | (1<<25);
- CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA |
- XY_COLOR_BLT_WRITE_RGB);
- break;
- default:
- return;
- }
-
- BEGIN_BATCH( 6);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (y << 16) | x );
- OUT_BATCH( ((y+h) << 16) | (x+w) );
- OUT_BATCH( dst_offset );
- OUT_BATCH( color );
- ADVANCE_BATCH();
-}
-
-
-/* Copy BitBlt
- */
-void intelEmitCopyBlitLocked( intelContextPtr intel,
- GLuint cpp,
- GLshort src_pitch,
- GLuint src_offset,
- GLshort dst_pitch,
- GLuint dst_offset,
- GLshort src_x, GLshort src_y,
- GLshort dst_x, GLshort dst_y,
- GLshort w, GLshort h )
-{
- GLuint CMD, BR13;
- int dst_y2 = dst_y + h;
- int dst_x2 = dst_x + w;
- BATCH_LOCALS;
-
- src_pitch *= cpp;
- dst_pitch *= cpp;
-
- switch(cpp) {
- case 1:
- case 2:
- case 3:
- BR13 = dst_pitch | (0xCC << 16) | (1<<24);
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
- case 4:
- BR13 = dst_pitch | (0xCC << 16) | (1<<24) | (1<<25);
- CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- XY_SRC_COPY_BLT_WRITE_RGB);
- break;
- default:
- return;
- }
-
- if (dst_y2 < dst_y ||
- dst_x2 < dst_x) {
- return;
- }
-
- BEGIN_BATCH( 12);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (dst_y << 16) | dst_x );
- OUT_BATCH( (dst_y2 << 16) | dst_x2 );
- OUT_BATCH( dst_offset );
- OUT_BATCH( (src_y << 16) | src_x );
- OUT_BATCH( src_pitch );
- OUT_BATCH( src_offset );
- ADVANCE_BATCH();
-}
-
-
-
-void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
- GLint cx1, GLint cy1, GLint cw, GLint ch)
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- intelScreenPrivate *intelScreen = intel->intelScreen;
- GLuint clear_depth, clear_color;
- GLint cx, cy;
- GLint pitch = intelScreen->frontPitch;
- GLint cpp = intelScreen->cpp;
- GLint i;
- GLuint BR13, CMD, D_CMD;
- BATCH_LOCALS;
-
-
- clear_color = intel->ClearColor;
- clear_depth = 0;
-
- if (flags & BUFFER_BIT_DEPTH) {
- clear_depth = (GLuint)(ctx->Depth.Clear * intel->ClearDepth);
- }
-
- if (flags & BUFFER_BIT_STENCIL) {
- clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
- }
-
- switch(cpp) {
- case 2:
- BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24);
- D_CMD = CMD = XY_COLOR_BLT_CMD;
- break;
- case 4:
- BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24) | (1<<25);
- CMD = (XY_COLOR_BLT_CMD |
- XY_COLOR_BLT_WRITE_ALPHA |
- XY_COLOR_BLT_WRITE_RGB);
- D_CMD = XY_COLOR_BLT_CMD;
- if (flags & BUFFER_BIT_DEPTH) D_CMD |= XY_COLOR_BLT_WRITE_RGB;
- if (flags & BUFFER_BIT_STENCIL) D_CMD |= XY_COLOR_BLT_WRITE_ALPHA;
- break;
- default:
- BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24);
- D_CMD = CMD = XY_COLOR_BLT_CMD;
- break;
- }
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
- {
- /* flip top to bottom */
- cy = intel->driDrawable->h-cy1-ch;
- cx = cx1 + intel->drawX;
- cy += intel->drawY;
-
- /* adjust for page flipping */
- if ( intel->sarea->pf_current_page == 1 ) {
- GLuint tmp = flags;
-
- flags &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
- if ( tmp & BUFFER_BIT_FRONT_LEFT ) flags |= BUFFER_BIT_BACK_LEFT;
- if ( tmp & BUFFER_BIT_BACK_LEFT ) flags |= BUFFER_BIT_FRONT_LEFT;
- }
-
- for (i = 0 ; i < intel->numClipRects ; i++)
- {
- drm_clip_rect_t *box = &intel->pClipRects[i];
- drm_clip_rect_t b;
-
- if (!all) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b.x1 = x;
- b.y1 = y;
- b.x2 = x + w;
- b.y2 = y + h;
- } else {
- b = *box;
- }
-
-
- if (b.x1 > b.x2 ||
- b.y1 > b.y2 ||
- b.x2 > intelScreen->width ||
- b.y2 > intelScreen->height)
- continue;
-
- if ( flags & BUFFER_BIT_FRONT_LEFT ) {
- BEGIN_BATCH( 6);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (b.y1 << 16) | b.x1 );
- OUT_BATCH( (b.y2 << 16) | b.x2 );
- OUT_BATCH( intelScreen->frontOffset );
- OUT_BATCH( clear_color );
- ADVANCE_BATCH();
- }
-
- if ( flags & BUFFER_BIT_BACK_LEFT ) {
- BEGIN_BATCH( 6);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (b.y1 << 16) | b.x1 );
- OUT_BATCH( (b.y2 << 16) | b.x2 );
- OUT_BATCH( intelScreen->backOffset );
- OUT_BATCH( clear_color );
- ADVANCE_BATCH();
- }
-
- if ( flags & (BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH) ) {
- BEGIN_BATCH( 6);
- OUT_BATCH( D_CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (b.y1 << 16) | b.x1 );
- OUT_BATCH( (b.y2 << 16) | b.x2 );
- OUT_BATCH( intelScreen->depthOffset );
- OUT_BATCH( clear_depth );
- ADVANCE_BATCH();
- }
- }
- }
- intelFlushBatchLocked( intel, GL_TRUE, GL_FALSE, GL_TRUE );
- UNLOCK_HARDWARE( intel );
-}
-
-
-
-
-void intelDestroyBatchBuffer( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- if (intel->alloc.ptr) {
- intelFreeAGP( intel, intel->alloc.ptr );
- intel->alloc.ptr = 0;
- }
-}
-
-
-void intelInitBatchBuffer( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- if (!intel->intelScreen->allow_batchbuffer || getenv("INTEL_NO_BATCH")) {
- intel->alloc.size = 8 * 1024;
- intel->alloc.ptr = malloc( intel->alloc.size );
- intel->alloc.offset = 0;
- }
- else {
- switch (intel->intelScreen->deviceID) {
- case PCI_CHIP_I865_G:
- /* HW bug? Seems to crash if batchbuffer crosses 4k boundary.
- */
- intel->alloc.size = 8 * 1024;
- break;
- default:
- /* This is the smallest amount of memory the kernel deals with.
- * We'd ideally like to make this smaller.
- */
- intel->alloc.size = 1 << intel->intelScreen->logTextureGranularity;
- break;
- }
-
- intel->alloc.ptr = intelAllocateAGP( intel, intel->alloc.size );
- if (intel->alloc.ptr)
- intel->alloc.offset =
- intelAgpOffsetFromVirtual( intel, intel->alloc.ptr );
- }
-
- if (!intel->alloc.ptr) {
- FALLBACK(intel, INTEL_FALLBACK_NO_BATCHBUFFER, 1);
- }
- else {
- intel->prim.flush = 0;
- intel->vtbl.emit_invarient_state( intel );
-
- /* Make sure this gets to the hardware, even if we have no cliprects:
- */
- LOCK_HARDWARE( intel );
- intelFlushBatchLocked( intel, GL_TRUE, GL_FALSE, GL_TRUE );
- UNLOCK_HARDWARE( intel );
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.h
deleted file mode 100644
index bd879af15..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_BATCHBUFFER_H
-#define INTEL_BATCHBUFFER_H
-
-#include "intel_context.h"
-#include "intel_ioctl.h"
-
-
-#define BATCH_LOCALS GLubyte *batch_ptr;
-
-/* #define VERBOSE 0 */
-#ifndef VERBOSE
-extern int VERBOSE;
-#endif
-
-
-#define BEGIN_BATCH(n) \
-do { \
- if (VERBOSE) fprintf(stderr, \
- "BEGIN_BATCH(%d) in %s, %d dwords free\n", \
- (n), __FUNCTION__, intel->batch.space/4); \
- if (intel->batch.space < (n)*4) \
- intelFlushBatch(intel, GL_TRUE); \
- batch_ptr = intel->batch.ptr; \
-} while (0)
-
-#define OUT_BATCH(n) \
-do { \
- *(GLuint *)batch_ptr = (n); \
- if (VERBOSE) fprintf(stderr, " -- %08x at %s/%d\n", (n), __FILE__, __LINE__); \
- batch_ptr += 4; \
-} while (0)
-
-#define ADVANCE_BATCH() \
-do { \
- if (VERBOSE) fprintf(stderr, "ADVANCE_BATCH()\n"); \
- intel->batch.space -= (batch_ptr - intel->batch.ptr); \
- intel->batch.ptr = batch_ptr; \
- assert(intel->batch.space >= 0); \
-} while(0)
-
-extern void intelInitBatchBuffer( GLcontext *ctx );
-extern void intelDestroyBatchBuffer( GLcontext *ctx );
-
-extern void intelStartInlinePrimitive( intelContextPtr intel, GLuint prim );
-extern void intelWrapInlinePrimitive( intelContextPtr intel );
-extern void intelRestartInlinePrimitive( intelContextPtr intel );
-extern GLuint *intelEmitInlinePrimitiveLocked(intelContextPtr intel,
- int primitive, int dwords,
- int vertex_size);
-extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv );
-extern void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx1, GLint cy1, GLint cw, GLint ch);
-
-extern void intelEmitCopyBlitLocked( intelContextPtr intel,
- GLuint cpp,
- GLshort src_pitch,
- GLuint src_offset,
- GLshort dst_pitch,
- GLuint dst_offset,
- GLshort srcx, GLshort srcy,
- GLshort dstx, GLshort dsty,
- GLshort w, GLshort h );
-
-extern void intelEmitFillBlitLocked( intelContextPtr intel,
- GLuint cpp,
- GLshort dst_pitch,
- GLuint dst_offset,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLuint color );
-
-
-
-
-static __inline GLuint *intelExtendInlinePrimitive( intelContextPtr intel,
- GLuint dwords )
-{
- GLuint sz = dwords * sizeof(GLuint);
- GLuint *ptr;
-
- if (intel->batch.space < sz) {
- intelWrapInlinePrimitive( intel );
-/* assert(intel->batch.space >= sz); */
- }
-
-/* assert(intel->prim.primitive != ~0); */
- ptr = (GLuint *)intel->batch.ptr;
- intel->batch.ptr += sz;
- intel->batch.space -= sz;
-
- return ptr;
-}
-
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c
deleted file mode 100644
index bdf02c766..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "intel_screen.h"
-
-#include "i830_dri.h"
-#include "i830_common.h"
-
-#include "intel_tex.h"
-#include "intel_span.h"
-#include "intel_tris.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-
-#include "utils.h"
-#ifndef INTEL_DEBUG
-int INTEL_DEBUG = (0);
-#endif
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_window_pos
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_secondary_color
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-#ifndef VERBOSE
-int VERBOSE = 0;
-#endif
-
-#if DEBUG_LOCKING
-char *prevLockFile;
-int prevLockLine;
-#endif
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-#define DRIVER_DATE "20050225"
-
-const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
-{
- const char * chipset;
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *)"Tungsten Graphics, Inc";
- break;
-
- case GL_RENDERER:
- switch (INTEL_CONTEXT(ctx)->intelScreen->deviceID) {
- case PCI_CHIP_845_G:
- chipset = "Intel(R) 845G"; break;
- case PCI_CHIP_I830_M:
- chipset = "Intel(R) 830M"; break;
- case PCI_CHIP_I855_GM:
- chipset = "Intel(R) 852GM/855GM"; break;
- case PCI_CHIP_I865_G:
- chipset = "Intel(R) 865G"; break;
- case PCI_CHIP_I915_G:
- chipset = "Intel(R) 915G"; break;
- case PCI_CHIP_I915_GM:
- chipset = "Intel(R) 915GM"; break;
- case PCI_CHIP_I945_G:
- chipset = "Intel(R) 945G"; break;
- default:
- chipset = "Unknown Intel Chipset"; break;
- }
-
- (void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 );
- return (GLubyte *) buffer;
-
- default:
- return NULL;
- }
-}
-
-static void intelBufferSize(GLframebuffer *buffer,
- GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE(intel);
- *width = intel->driDrawable->w;
- *height = intel->driDrawable->h;
- UNLOCK_HARDWARE(intel);
-}
-
-
-/**
- * Extension strings exported by the intel driver.
- *
- * \note
- * It appears that ARB_texture_env_crossbar has "disappeared" compared to the
- * old i830-specific driver.
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
- { "GL_ARB_texture_border_clamp", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_cube_map", NULL },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_env_combine", NULL },
- { "GL_ARB_texture_env_dot3", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_ARB_texture_rectangle", NULL },
- { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
- { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
- { "GL_ARB_window_pos", GL_ARB_window_pos_functions },
- { "GL_EXT_blend_color", GL_EXT_blend_color_functions },
- { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
- { "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_cull_vertex", GL_EXT_cull_vertex_functions },
- { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
- { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_EXT_texture_env_combine", NULL },
- { "GL_EXT_texture_env_dot3", NULL },
- { "GL_EXT_texture_filter_anisotropic", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_3DFX_texture_compression_FXT1", NULL },
- { "GL_APPLE_client_storage", NULL },
- { "GL_MESA_pack_invert", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_NV_vertex_program", GL_NV_vertex_program_functions },
- { "GL_NV_vertex_program1_1", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-extern const struct tnl_pipeline_stage _intel_render_stage;
-
-static const struct tnl_pipeline_stage *intel_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_vertex_cull_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_tnl_arb_vertex_program_stage,
- &_tnl_vertex_program_stage,
-#if 1
- &_intel_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "sleep", DEBUG_SLEEP },
- { "pix", DEBUG_PIXEL },
- { NULL, 0 }
-};
-
-
-static void intelInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _tnl_invalidate_vertex_state( ctx, new_state );
- INTEL_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-
-void intelInitDriverFunctions( struct dd_function_table *functions )
-{
- _mesa_init_driver_functions( functions );
-
- functions->Flush = intelFlush;
- functions->Clear = intelClear;
- functions->Finish = intelFinish;
- functions->GetBufferSize = intelBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = intelGetString;
- functions->UpdateState = intelInvalidateState;
- functions->CopyColorTable = _swrast_CopyColorTable;
- functions->CopyColorSubTable = _swrast_CopyColorSubTable;
- functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- intelInitTextureFuncs( functions );
- intelInitPixelFuncs( functions );
- intelInitStateFuncs( functions );
-}
-
-
-
-GLboolean intelInitContext( intelContextPtr intel,
- const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate,
- struct dd_function_table *functions )
-{
- GLcontext *ctx = &intel->ctx;
- GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
- drmI830Sarea *saPriv = (drmI830Sarea *)
- (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset);
-
- if (!_mesa_initialize_context(&intel->ctx,
- mesaVis, shareCtx,
- functions,
- (void*) intel))
- return GL_FALSE;
-
- driContextPriv->driverPrivate = intel;
- intel->intelScreen = intelScreen;
- intel->driScreen = sPriv;
- intel->sarea = saPriv;
-
-
- (void) memset( intel->texture_heaps, 0, sizeof( intel->texture_heaps ) );
- make_empty_list( & intel->swapped );
-
- ctx->Const.MaxTextureMaxAnisotropy = 2.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 3.0;
- ctx->Const.MaxLineWidthAA = 3.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 255.0;
- ctx->Const.MaxPointSizeAA = 3.0;
- ctx->Const.PointSizeGranularity = 1.0;
-
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline: */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, intel_pipeline );
-
- /* Configure swrast to match hardware characteristics: */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- /* Dri stuff */
- intel->hHWContext = driContextPriv->hHWContext;
- intel->driFd = sPriv->fd;
- intel->driHwLock = (drmLock *) &sPriv->pSAREA->lock;
-
- intel->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
- intel->hw_stipple = 1;
-
- switch(mesaVis->depthBits) {
- case 0: /* what to do in this case? */
- case 16:
- intel->depth_scale = 1.0/0xffff;
- intel->polygon_offset_scale = 1.0/0xffff;
- intel->depth_clear_mask = ~0;
- intel->ClearDepth = 0xffff;
- break;
- case 24:
- intel->depth_scale = 1.0/0xffffff;
- intel->polygon_offset_scale = 2.0/0xffffff; /* req'd to pass glean */
- intel->depth_clear_mask = 0x00ffffff;
- intel->stencil_clear_mask = 0xff000000;
- intel->ClearDepth = 0x00ffffff;
- break;
- default:
- assert(0);
- break;
- }
-
- /* Initialize swrast, tnl driver tables: */
- intelInitSpanFuncs( ctx );
- intelInitTriFuncs( ctx );
-
-
- intel->RenderIndex = ~0;
-
- intel->do_irqs = (intel->intelScreen->irq_active &&
- !getenv("INTEL_NO_IRQS"));
-
- _math_matrix_ctr (&intel->ViewportMatrix);
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
-
- if (intel->ctx.Mesa_DXTn) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- _mesa_enable_extension( ctx, "GL_S3_s3tc" );
- }
- else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- }
-
-/* driInitTextureObjects( ctx, & intel->swapped, */
-/* DRI_TEXMGR_DO_TEXTURE_1D | */
-/* DRI_TEXMGR_DO_TEXTURE_2D | */
-/* DRI_TEXMGR_DO_TEXTURE_RECT ); */
-
-
- intel->prim.flush = intelInitBatchBuffer;
- intel->prim.primitive = ~0;
-
-
-#if DO_DEBUG
- INTEL_DEBUG = driParseDebugString( getenv( "INTEL_DEBUG" ),
- debug_control );
- INTEL_DEBUG |= driParseDebugString( getenv( "INTEL_DEBUG" ),
- debug_control );
-#endif
-
-#ifndef VERBOSE
- if (getenv("INTEL_VERBOSE"))
- VERBOSE=1;
-#endif
-
- if (getenv("INTEL_NO_RAST") ||
- getenv("INTEL_NO_RAST")) {
- fprintf(stderr, "disabling 3D rasterization\n");
- FALLBACK(intel, INTEL_FALLBACK_USER, 1);
- }
-
- return GL_TRUE;
-}
-
-void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- intelContextPtr intel = (intelContextPtr) driContextPriv->driverPrivate;
-
- assert(intel); /* should never be null */
- if (intel) {
- GLboolean release_texture_heaps;
-
-
- intel->vtbl.destroy( intel );
-
- release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
- _swsetup_DestroyContext (&intel->ctx);
- _tnl_DestroyContext (&intel->ctx);
- _ac_DestroyContext (&intel->ctx);
-
- _swrast_DestroyContext (&intel->ctx);
- intel->Fallback = 0; /* don't call _swrast_Flush later */
-
- intelDestroyBatchBuffer(&intel->ctx);
-
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- for ( i = 0 ; i < intel->nr_heaps ; i++ ) {
- driDestroyTextureHeap( intel->texture_heaps[ i ] );
- intel->texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & intel->swapped ) );
- }
-
- /* free the Mesa context */
- _mesa_destroy_context(&intel->ctx);
- }
-}
-
-void intelSetFrontClipRects( intelContextPtr intel )
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
- if (!dPriv) return;
-
- intel->numClipRects = dPriv->numClipRects;
- intel->pClipRects = dPriv->pClipRects;
- intel->drawX = dPriv->x;
- intel->drawY = dPriv->y;
-}
-
-
-void intelSetBackClipRects( intelContextPtr intel )
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
- if (!dPriv) return;
-
- if (intel->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0) {
- intel->numClipRects = dPriv->numClipRects;
- intel->pClipRects = dPriv->pClipRects;
- intel->drawX = dPriv->x;
- intel->drawY = dPriv->y;
- } else {
- intel->numClipRects = dPriv->numBackClipRects;
- intel->pClipRects = dPriv->pBackClipRects;
- intel->drawX = dPriv->backX;
- intel->drawY = dPriv->backY;
-
- if (dPriv->numBackClipRects == 1 &&
- dPriv->x == dPriv->backX &&
- dPriv->y == dPriv->backY) {
-
- /* Repeat the calculation of the back cliprect dimensions here
- * as early versions of dri.a in the Xserver are incorrect. Try
- * very hard not to restrict future versions of dri.a which
- * might eg. allocate truly private back buffers.
- */
- int x1, y1;
- int x2, y2;
-
- x1 = dPriv->x;
- y1 = dPriv->y;
- x2 = dPriv->x + dPriv->w;
- y2 = dPriv->y + dPriv->h;
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 > intel->intelScreen->width) x2 = intel->intelScreen->width;
- if (y2 > intel->intelScreen->height) y2 = intel->intelScreen->height;
-
- if (x1 == dPriv->pBackClipRects[0].x1 &&
- y1 == dPriv->pBackClipRects[0].y1) {
-
- dPriv->pBackClipRects[0].x2 = x2;
- dPriv->pBackClipRects[0].y2 = y2;
- }
- }
- }
-}
-
-
-void intelWindowMoved( intelContextPtr intel )
-{
- if (!intel->ctx.DrawBuffer) {
- intelSetFrontClipRects( intel );
- }
- else {
- switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- intelSetFrontClipRects( intel );
- break;
- case BUFFER_BIT_BACK_LEFT:
- intelSetBackClipRects( intel );
- break;
- default:
- /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
- intelSetFrontClipRects( intel );
- }
- }
-}
-
-GLboolean intelUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
-
- if (driContextPriv) {
- intelContextPtr intel = (intelContextPtr) driContextPriv->driverPrivate;
-
- if ( intel->driDrawable != driDrawPriv ) {
- /* Shouldn't the readbuffer be stored also? */
- intel->driDrawable = driDrawPriv;
- intelWindowMoved( intel );
- }
-
- _mesa_make_current(&intel->ctx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- intel->ctx.Driver.DrawBuffer( &intel->ctx, intel->ctx.Color.DrawBuffer[0] );
- } else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-void intelGetLock( intelContextPtr intel, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- __DRIscreenPrivate *sPriv = intel->driScreen;
- drmI830Sarea * sarea = intel->sarea;
- int me = intel->hHWContext;
- unsigned i;
-
- drmGetLock(intel->driFd, intel->hHWContext, flags);
-
- /* If the window moved, may need to set a new cliprect now.
- *
- * NOTE: This releases and regains the hw lock, so all state
- * checking must be done *after* this call:
- */
- if (dPriv)
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
- /* If we lost context, need to dump all registers to hardware.
- * Note that we don't care about 2d contexts, even if they perform
- * accelerated commands, so the DRI locking in the X server is even
- * more broken than usual.
- */
-
- if (sarea->ctxOwner != me) {
- intel->perf_boxes |= I830_BOX_LOST_CONTEXT;
- sarea->ctxOwner = me;
- }
-
- /* Shared texture managment - if another client has played with
- * texture space, figure out which if any of our textures have been
- * ejected, and update our global LRU.
- */
-
- for ( i = 0 ; i < intel->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( intel->texture_heaps[ i ] );
- }
-
- if (dPriv && intel->lastStamp != dPriv->lastStamp) {
- intelWindowMoved( intel );
- intel->lastStamp = dPriv->lastStamp;
- }
-}
-
-void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- intelContextPtr intel;
- GLcontext *ctx;
- intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = &intel->ctx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( 0 /*intel->doPageFlip*/ ) { /* doPageFlip is never set !!! */
- intelPageFlip( dPriv );
- } else {
- intelCopyBuffer( dPriv );
- }
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
- }
-}
-
-
-void intelInitState( GLcontext *ctx )
-{
- /* Mesa should do this for us:
- */
- ctx->Driver.AlphaFunc( ctx,
- ctx->Color.AlphaFunc,
- ctx->Color.AlphaRef);
-
- ctx->Driver.BlendColor( ctx,
- ctx->Color.BlendColor );
-
- ctx->Driver.BlendEquationSeparate( ctx,
- ctx->Color.BlendEquationRGB,
- ctx->Color.BlendEquationA);
-
- ctx->Driver.BlendFuncSeparate( ctx,
- ctx->Color.BlendSrcRGB,
- ctx->Color.BlendDstRGB,
- ctx->Color.BlendSrcA,
- ctx->Color.BlendDstA);
-
- ctx->Driver.ColorMask( ctx,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode );
- ctx->Driver.DepthFunc( ctx, ctx->Depth.Func );
- ctx->Driver.DepthMask( ctx, ctx->Depth.Mask );
-
- ctx->Driver.Enable( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled );
- ctx->Driver.Enable( ctx, GL_BLEND, ctx->Color.BlendEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled );
- ctx->Driver.Enable( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag );
- ctx->Driver.Enable( ctx, GL_DEPTH_TEST, ctx->Depth.Test );
- ctx->Driver.Enable( ctx, GL_DITHER, ctx->Color.DitherFlag );
- ctx->Driver.Enable( ctx, GL_FOG, ctx->Fog.Enabled );
- ctx->Driver.Enable( ctx, GL_LIGHTING, ctx->Light.Enabled );
- ctx->Driver.Enable( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag );
- ctx->Driver.Enable( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag );
- ctx->Driver.Enable( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled );
- ctx->Driver.Enable( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled );
- ctx->Driver.Enable( ctx, GL_TEXTURE_1D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_2D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_3D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE );
-
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
-
- ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace );
-
- {
- GLfloat f = (GLfloat)ctx->Light.Model.ColorControl;
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f );
- }
-
- ctx->Driver.LineWidth( ctx, ctx->Line.Width );
- ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
- ctx->Driver.PointSize( ctx, ctx->Point.Size );
- ctx->Driver.PolygonStipple( ctx, (const GLubyte *)ctx->PolygonStipple );
- ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height );
- ctx->Driver.ShadeModel( ctx, ctx->Light.ShadeModel );
- ctx->Driver.StencilFunc( ctx,
- ctx->Stencil.Function[0],
- ctx->Stencil.Ref[0],
- ctx->Stencil.ValueMask[0] );
- ctx->Driver.StencilMask( ctx, ctx->Stencil.WriteMask[0] );
- ctx->Driver.StencilOp( ctx,
- ctx->Stencil.FailFunc[0],
- ctx->Stencil.ZFailFunc[0],
- ctx->Stencil.ZPassFunc[0]);
-
-
- ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h
deleted file mode 100644
index da1ef701b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h
+++ /dev/null
@@ -1,519 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef INTELCONTEXT_INC
-#define INTELCONTEXT_INC
-
-
-
-#include "mtypes.h"
-#include "drm.h"
-#include "mm.h"
-#include "texmem.h"
-
-#include "intel_screen.h"
-#include "i830_common.h"
-#include "tnl/t_vertex.h"
-
-#define TAG(x) intel##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-#define DV_PF_555 (1<<8)
-#define DV_PF_565 (2<<8)
-#define DV_PF_8888 (3<<8)
-
-#define INTEL_CONTEXT(ctx) ((intelContextPtr)(ctx))
-
-typedef struct intel_context intelContext;
-typedef struct intel_context *intelContextPtr;
-typedef struct intel_texture_object *intelTextureObjectPtr;
-
-typedef void (*intel_tri_func)(intelContextPtr, intelVertex *, intelVertex *,
- intelVertex *);
-typedef void (*intel_line_func)(intelContextPtr, intelVertex *, intelVertex *);
-typedef void (*intel_point_func)(intelContextPtr, intelVertex *);
-
-#define INTEL_FALLBACK_DRAW_BUFFER 0x1
-#define INTEL_FALLBACK_READ_BUFFER 0x2
-#define INTEL_FALLBACK_USER 0x4
-#define INTEL_FALLBACK_NO_BATCHBUFFER 0x8
-#define INTEL_FALLBACK_NO_TEXMEM 0x10
-#define INTEL_FALLBACK_RENDERMODE 0x20
-
-extern void intelFallback( intelContextPtr intel, GLuint bit, GLboolean mode );
-#define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode )
-
-
-#define INTEL_TEX_MAXLEVELS 10
-
-
-struct intel_texture_object
-{
- driTextureObject base; /* the parent class */
-
- GLuint texelBytes;
- GLuint age;
- GLuint Pitch;
- GLuint Height;
- GLuint TextureOffset;
- GLubyte *BufAddr;
-
- GLuint min_level;
- GLuint max_level;
- GLuint depth_pitch;
-
- struct {
- const struct gl_texture_image *image;
- GLuint offset; /* into BufAddr */
- GLuint height;
- GLuint internalFormat;
- } image[6][INTEL_TEX_MAXLEVELS];
-
- GLuint dirty;
- GLuint firstLevel,lastLevel;
-};
-
-
-struct intel_context
-{
- GLcontext ctx; /* the parent class */
-
- struct {
- void (*destroy)( intelContextPtr intel );
- void (*emit_state)( intelContextPtr intel );
- void (*emit_invarient_state)( intelContextPtr intel );
- void (*lost_hardware)( intelContextPtr intel );
- void (*update_texture_state)( intelContextPtr intel );
-
- void (*render_start)( intelContextPtr intel );
- void (*set_draw_offset)( intelContextPtr intel, int offset );
- void (*emit_flush)( intelContextPtr intel );
-
- void (*reduced_primitive_state)( intelContextPtr intel, GLenum rprim );
-
- GLboolean (*check_vertex_size)( intelContextPtr intel, GLuint expected );
-
- void (*clear_with_tris)( intelContextPtr intel, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch);
-
- intelTextureObjectPtr (*alloc_tex_obj)( struct gl_texture_object *tObj );
-
- } vtbl;
-
- GLint refcount;
- GLuint Fallback;
- GLuint NewGLState;
-
- struct {
- GLuint start_offset;
- GLint size;
- GLint space;
- GLubyte *ptr;
- } batch;
-
- struct {
- void *ptr;
- GLint size;
- GLuint offset;
- GLuint active_buf;
- GLuint irq_emitted;
- } alloc;
-
- struct {
- GLuint primitive;
- GLubyte *start_ptr;
- void (*flush)( GLcontext * );
- } prim;
-
- GLboolean locked;
-
- GLubyte clear_red;
- GLubyte clear_green;
- GLubyte clear_blue;
- GLubyte clear_alpha;
- GLuint ClearColor;
- GLuint ClearDepth;
-
- GLuint coloroffset;
- GLuint specoffset;
-
- /* Support for duplicating XYZW as WPOS parameter (crutch for I915).
- */
- GLuint wpos_offset;
- GLuint wpos_size;
-
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
-
- GLfloat depth_scale;
- GLfloat polygon_offset_scale; /* dependent on depth_scale, bpp */
- GLuint depth_clear_mask;
- GLuint stencil_clear_mask;
-
- GLboolean hw_stencil;
- GLboolean hw_stipple;
-
- /* Texture object bookkeeping
- */
- GLuint nr_heaps;
- driTexHeap * texture_heaps[1];
- driTextureObject swapped;
- GLuint lastStamp;
-
- struct intel_texture_object *CurrentTexObj[MAX_TEXTURE_UNITS];
-
- /* State for intelvb.c and inteltris.c.
- */
- GLuint RenderIndex;
- GLmatrix ViewportMatrix;
- GLenum render_primitive;
- GLenum reduced_primitive;
- GLuint vertex_size;
- char *verts; /* points to tnl->clipspace.vertex_buf */
-
-
- /* Fallback rasterization functions
- */
- intel_point_func draw_point;
- intel_line_func draw_line;
- intel_tri_func draw_tri;
-
- /* These refer to the current draw (front vs. back) buffer:
- */
- char *drawMap; /* draw buffer address in virtual mem */
- char *readMap;
- GLuint drawOffset; /* agp offset of drawbuffer */
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- GLuint numClipRects; /* cliprects for that buffer */
- drm_clip_rect_t *pClipRects;
-
- int dirtyAge;
- int perf_boxes;
- int do_irqs;
-
- GLboolean scissor;
- drm_clip_rect_t draw_rect;
- drm_clip_rect_t scissor_rect;
-
- drm_context_t hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *driScreen;
- intelScreenPrivate *intelScreen;
- drmI830Sarea *sarea;
-
- /**
- * Configuration cache
- */
- driOptionCache optionCache;
-};
-
-
-#define DEBUG_LOCKING 1
-
-#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)
-
-/* Slightly less broken way of detecting recursive locking in a
- * threaded environment. The right way to do this would be to make
- * prevLockFile, prevLockLine thread-local.
- *
- * This technique instead checks to see if the same context is
- * requesting the lock twice -- this will not catch application
- * breakages where the same context is active in two different threads
- * at once, but it will catch driver breakages (recursive locking) in
- * threaded apps.
- */
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( *((volatile int *)intel->driHwLock) == \
- (DRM_LOCK_HELD | intel->hHWContext) ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- prevLockFile, prevLockLine, __FILE__, __LINE__ ); \
- abort(); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( intel ) \
-do { \
- char __ret=0; \
- DEBUG_CHECK_LOCK(); \
- assert(!(intel)->locked); \
- DRM_CAS((intel)->driHwLock, (intel)->hHWContext, \
- (DRM_LOCK_HELD|(intel)->hHWContext), __ret); \
- if (__ret) \
- intelGetLock( (intel), 0 ); \
- DEBUG_LOCK(); \
- (intel)->locked = 1; \
-}while (0)
-
-
- /* Unlock the hardware using the global current context
- */
-#define UNLOCK_HARDWARE(intel) \
-do { \
- intel->locked = 0; \
- if (0) { \
- intel->perf_boxes |= intel->sarea->perf_boxes; \
- intel->sarea->perf_boxes = 0; \
- } \
- DRM_UNLOCK((intel)->driFd, (intel)->driHwLock, (intel)->hHWContext); \
- DEBUG_RESET(); \
-} while (0)
-
-
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-#define INTEL_FIREVERTICES(intel) \
-do { \
- if ((intel)->prim.flush) \
- (intel)->prim.flush(&(intel)->ctx); \
-} while (0)
-
-/* ================================================================
- * Color packing:
- */
-
-#define INTEL_PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define INTEL_PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define INTEL_PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define INTEL_PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-
-#define INTEL_PACKCOLOR(format, r, g, b, a) \
-(format == DV_PF_555 ? INTEL_PACKCOLOR1555(r,g,b,a) : \
- (format == DV_PF_565 ? INTEL_PACKCOLOR565(r,g,b) : \
- (format == DV_PF_8888 ? INTEL_PACKCOLOR8888(r,g,b,a) : \
- 0)))
-
-
-
-/* ================================================================
- * From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- */
-#if defined(i386) || defined(__i386__)
-static __inline__ void * __memcpy(void * to, const void * from, size_t n)
-{
- int d0, d1, d2;
- __asm__ __volatile__(
- "rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n"
- "2:"
- : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- : "memory");
- return (to);
-}
-#else
-#define __memcpy(a,b,c) memcpy(a,b,c)
-#endif
-
-
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-#if DO_DEBUG
-extern int INTEL_DEBUG;
-#else
-#define INTEL_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x1
-#define DEBUG_STATE 0x2
-#define DEBUG_IOCTL 0x4
-#define DEBUG_PRIMS 0x8
-#define DEBUG_VERTS 0x10
-#define DEBUG_FALLBACKS 0x20
-#define DEBUG_VERBOSE 0x40
-#define DEBUG_DRI 0x80
-#define DEBUG_DMA 0x100
-#define DEBUG_SANITY 0x200
-#define DEBUG_SYNC 0x400
-#define DEBUG_SLEEP 0x800
-#define DEBUG_PIXEL 0x1000
-
-
-#define PCI_CHIP_845_G 0x2562
-#define PCI_CHIP_I830_M 0x3577
-#define PCI_CHIP_I855_GM 0x3582
-#define PCI_CHIP_I865_G 0x2572
-#define PCI_CHIP_I915_G 0x2582
-#define PCI_CHIP_I915_GM 0x2592
-#define PCI_CHIP_I945_G 0x2772
-
-
-/* ================================================================
- * intel_context.c:
- */
-
-extern void intelInitDriverFunctions( struct dd_function_table *functions );
-
-extern GLboolean intelInitContext( intelContextPtr intel,
- const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate,
- struct dd_function_table *functions );
-
-extern void intelGetLock(intelContextPtr intel, GLuint flags);
-extern void intelSetBackClipRects(intelContextPtr intel);
-extern void intelSetFrontClipRects(intelContextPtr intel);
-extern void intelWindowMoved( intelContextPtr intel );
-
-extern void intelInitState( GLcontext *ctx );
-extern const GLubyte *intelGetString( GLcontext *ctx, GLenum name );
-
-
-/* ================================================================
- * intel_state.c:
- */
-extern void intelInitStateFuncs( struct dd_function_table *functions );
-
-#define COMPAREFUNC_ALWAYS 0
-#define COMPAREFUNC_NEVER 0x1
-#define COMPAREFUNC_LESS 0x2
-#define COMPAREFUNC_EQUAL 0x3
-#define COMPAREFUNC_LEQUAL 0x4
-#define COMPAREFUNC_GREATER 0x5
-#define COMPAREFUNC_NOTEQUAL 0x6
-#define COMPAREFUNC_GEQUAL 0x7
-
-#define STENCILOP_KEEP 0
-#define STENCILOP_ZERO 0x1
-#define STENCILOP_REPLACE 0x2
-#define STENCILOP_INCRSAT 0x3
-#define STENCILOP_DECRSAT 0x4
-#define STENCILOP_INCR 0x5
-#define STENCILOP_DECR 0x6
-#define STENCILOP_INVERT 0x7
-
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
-
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_DST_COLR 0x09
-#define BLENDFACT_INV_DST_COLR 0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
-#define BLENDFACT_CONST_COLOR 0x0c
-#define BLENDFACT_INV_CONST_COLOR 0x0d
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-#define BLENDFACT_MASK 0x0f
-
-
-extern int intel_translate_compare_func( GLenum func );
-extern int intel_translate_stencil_op( GLenum op );
-extern int intel_translate_blend_factor( GLenum factor );
-extern int intel_translate_logic_op( GLenum opcode );
-
-
-/* ================================================================
- * intel_ioctl.c:
- */
-extern void intel_dump_batchbuffer( long offset,
- int *ptr,
- int count );
-
-
-/* ================================================================
- * intel_pixel.c:
- */
-extern void intelInitPixelFuncs( struct dd_function_table *functions );
-
-
-
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.c
deleted file mode 100644
index 83bb77f38..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 <unistd.h>
-#include <errno.h>
-#include <sched.h>
-
-#include "mtypes.h"
-#include "context.h"
-#include "swrast/swrast.h"
-
-#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-#include "drm.h"
-
-
-
-static int intelEmitIrqLocked( intelContextPtr intel )
-{
- drmI830IrqEmit ie;
- int ret, seq = 0;
-
- assert(((*(int *)intel->driHwLock) & ~DRM_LOCK_CONT) ==
- (DRM_LOCK_HELD|intel->hHWContext));
-
- ie.irq_seq = &seq;
-
- ret = drmCommandWriteRead( intel->driFd, DRM_I830_IRQ_EMIT,
- &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqEmit: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- if (0)
- fprintf(stderr, "%s --> %d\n", __FUNCTION__, seq );
-
- return seq;
-}
-
-static void intelWaitIrq( intelContextPtr intel, int seq )
-{
- drmI830IrqWait iw;
- int ret;
-
- if (0)
- fprintf(stderr, "%s %d\n", __FUNCTION__, seq );
-
- iw.irq_seq = seq;
-
- do {
- ret = drmCommandWrite( intel->driFd, DRM_I830_IRQ_WAIT, &iw, sizeof(iw) );
- } while (ret == -EAGAIN || ret == -EINTR);
-
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqWait: %d\n", __FUNCTION__, ret );
- if (0)
- intel_dump_batchbuffer( intel->alloc.offset,
- intel->alloc.ptr,
- intel->alloc.size );
- exit(1);
- }
-}
-
-
-
-static void age_intel( intelContextPtr intel, int age )
-{
- GLuint i;
-
- for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
- if (intel->CurrentTexObj[i])
- intel->CurrentTexObj[i]->age = age;
-}
-
-void intel_dump_batchbuffer( long offset,
- int *ptr,
- int count )
-{
- int i;
- fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count);
- for (i = 0; i < count/4; i += 4)
- fprintf(stderr, "\t0x%lx: 0x%08x 0x%08x 0x%08x 0x%08x\n",
- (unsigned int)offset + i*4, ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]);
- fprintf(stderr, "END BATCH\n\n\n");
-}
-
-void intelRefillBatchLocked( intelContextPtr intel, GLboolean allow_unlock )
-{
- GLuint last_irq = intel->alloc.irq_emitted;
- GLuint half = intel->alloc.size / 2;
- GLuint buf = (intel->alloc.active_buf ^= 1);
-
- intel->alloc.irq_emitted = intelEmitIrqLocked( intel );
-
- if (last_irq) {
- if (allow_unlock) UNLOCK_HARDWARE( intel );
- intelWaitIrq( intel, last_irq );
- if (allow_unlock) LOCK_HARDWARE( intel );
- }
-
- if (0)
- fprintf(stderr, "%s: now using half %d\n", __FUNCTION__, buf);
-
- intel->batch.start_offset = intel->alloc.offset + buf * half;
- intel->batch.ptr = (char *)intel->alloc.ptr + buf * half;
- intel->batch.size = half - 8;
- intel->batch.space = half - 8;
- assert(intel->batch.space >= 0);
-}
-
-#define MI_BATCH_BUFFER_END (0xA<<23)
-
-
-void intelFlushBatchLocked( intelContextPtr intel,
- GLboolean ignore_cliprects,
- GLboolean refill,
- GLboolean allow_unlock)
-{
- drmI830BatchBuffer batch;
-
- assert(intel->locked);
-
- if (0)
- fprintf(stderr, "%s used %d of %d offset %x..%x refill %d\n",
- __FUNCTION__,
- (intel->batch.size - intel->batch.space),
- intel->batch.size,
- intel->batch.start_offset,
- intel->batch.start_offset +
- (intel->batch.size - intel->batch.space),
- refill);
-
- /* Throw away non-effective packets. Won't work once we have
- * hardware contexts which would preserve statechanges beyond a
- * single buffer.
- */
- if (intel->numClipRects == 0 && !ignore_cliprects) {
-
- /* Without this yeild, an application with no cliprects can hog
- * the hardware. Without unlocking, the effect is much worse -
- * effectively a lock-out of other contexts.
- */
- if (allow_unlock) {
- UNLOCK_HARDWARE( intel );
- sched_yield();
- LOCK_HARDWARE( intel );
- }
-
- /* Note that any state thought to have been emitted actually
- * hasn't:
- */
- intel->batch.ptr -= (intel->batch.size - intel->batch.space);
- intel->batch.space = intel->batch.size;
- intel->vtbl.lost_hardware( intel );
- }
-
- if (intel->batch.space != intel->batch.size) {
- batch.start = intel->batch.start_offset;
- batch.used = intel->batch.size - intel->batch.space;
- batch.cliprects = intel->pClipRects;
- batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
- batch.DR1 = 0;
- batch.DR4 = ((((GLuint)intel->drawX) & 0xffff) |
- (((GLuint)intel->drawY) << 16));
-
- if (intel->alloc.offset) {
- if ((batch.used & 0x4) == 0) {
- ((int *)intel->batch.ptr)[0] = 0;
- ((int *)intel->batch.ptr)[1] = MI_BATCH_BUFFER_END;
- batch.used += 0x8;
- intel->batch.ptr += 0x8;
- }
- else {
- ((int *)intel->batch.ptr)[0] = MI_BATCH_BUFFER_END;
- batch.used += 0x4;
- intel->batch.ptr += 0x4;
- }
- }
-
- if (0)
- intel_dump_batchbuffer( batch.start,
- (int *)(intel->batch.ptr - batch.used),
- batch.used );
-
- if (0)
- fprintf(stderr, "%s: 0x%x..0x%x DR4: %x cliprects: %d\n",
- __FUNCTION__,
- batch.start,
- batch.start + batch.used,
- batch.DR4, batch.num_cliprects);
-
- intel->batch.start_offset += batch.used;
- intel->batch.size -= batch.used;
-
- if (intel->batch.size < 8) {
- refill = GL_TRUE;
- intel->batch.space = intel->batch.size = 0;
- }
- else {
- intel->batch.size -= 8;
- intel->batch.space = intel->batch.size;
- }
-
-
- assert(intel->batch.space >= 0);
- assert(batch.start >= intel->alloc.offset);
- assert(batch.start < intel->alloc.offset + intel->alloc.size);
- assert(batch.start + batch.used > intel->alloc.offset);
- assert(batch.start + batch.used <=
- intel->alloc.offset + intel->alloc.size);
-
-
- if (intel->alloc.offset) {
- if (drmCommandWrite (intel->driFd, DRM_I830_BATCHBUFFER, &batch,
- sizeof(batch))) {
- fprintf(stderr, "DRM_I830_BATCHBUFFER: %d\n", -errno);
- UNLOCK_HARDWARE(intel);
- exit(1);
- }
- } else {
- drmI830CmdBuffer cmd;
- cmd.buf = (GLubyte *)intel->alloc.ptr + batch.start;
- cmd.sz = batch.used;
- cmd.DR1 = batch.DR1;
- cmd.DR4 = batch.DR4;
- cmd.num_cliprects = batch.num_cliprects;
- cmd.cliprects = batch.cliprects;
-
- if (drmCommandWrite (intel->driFd, DRM_I830_CMDBUFFER, &cmd,
- sizeof(cmd))) {
- fprintf(stderr, "DRM_I830_CMDBUFFER: %d\n", -errno);
- UNLOCK_HARDWARE(intel);
- exit(1);
- }
- }
-
-
- age_intel(intel, intel->sarea->last_enqueue);
-
- /* FIXME: use hardware contexts to avoid 'losing' hardware after
- * each buffer flush.
- */
- intel->vtbl.lost_hardware( intel );
- }
-
- if (refill)
- intelRefillBatchLocked( intel, allow_unlock );
-}
-
-void intelFlushBatch( intelContextPtr intel, GLboolean refill )
-{
- if (intel->locked) {
- intelFlushBatchLocked( intel, GL_FALSE, refill, GL_FALSE );
- }
- else {
- LOCK_HARDWARE(intel);
- intelFlushBatchLocked( intel, GL_FALSE, refill, GL_TRUE );
- UNLOCK_HARDWARE(intel);
- }
-}
-
-
-
-
-
-
-
-void intelWaitForIdle( intelContextPtr intel )
-{
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- intel->vtbl.emit_flush( intel );
- intelFlushBatch( intel, GL_TRUE );
-
- /* Use an irq to wait for dma idle -- Need to track lost contexts
- * to shortcircuit consecutive calls to this function:
- */
- intelWaitIrq( intel, intel->alloc.irq_emitted );
- intel->alloc.irq_emitted = 0;
-}
-
-
-
-void intelFlush( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
-
- if (intel->Fallback)
- _swrast_flush( ctx );
-
- INTEL_FIREVERTICES( intel );
-
- if (intel->batch.size != intel->batch.space)
- intelFlushBatch( intel, GL_FALSE );
-}
-
-void intelFinish( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- intelFlush( ctx );
- intelWaitForIdle( intel );
-}
-
-
-void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- GLbitfield tri_mask = 0;
- GLbitfield blit_mask = 0;
- GLbitfield swrast_mask = 0;
-
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Take care of cliprects, which are handled differently for
- * clears, etc.
- */
- intelFlush( &intel->ctx );
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- if (colorMask == ~0) {
- blit_mask |= BUFFER_BIT_FRONT_LEFT;
- }
- else {
- tri_mask |= BUFFER_BIT_FRONT_LEFT;
- }
- }
-
- if (mask & BUFFER_BIT_BACK_LEFT) {
- if (colorMask == ~0) {
- blit_mask |= BUFFER_BIT_BACK_LEFT;
- }
- else {
- tri_mask |= BUFFER_BIT_BACK_LEFT;
- }
- }
-
- if (mask & BUFFER_BIT_DEPTH) {
- blit_mask |= BUFFER_BIT_DEPTH;
- }
-
- if (mask & BUFFER_BIT_STENCIL) {
- if (!intel->hw_stencil) {
- swrast_mask |= BUFFER_BIT_STENCIL;
- }
- else if (ctx->Stencil.WriteMask[0] != 0xff) {
- tri_mask |= BUFFER_BIT_STENCIL;
- }
- else {
- blit_mask |= BUFFER_BIT_STENCIL;
- }
- }
-
- swrast_mask |= (mask & BUFFER_BIT_ACCUM);
-
- if (blit_mask)
- intelClearWithBlit( ctx, blit_mask, all, cx, cy, cw, ch );
-
- if (tri_mask)
- intel->vtbl.clear_with_tris( intel, tri_mask, all, cx, cy, cw, ch);
-
- if (swrast_mask)
- _swrast_Clear( ctx, swrast_mask, all, cx, cy, cw, ch );
-}
-
-
-
-void *intelAllocateAGP( intelContextPtr intel, GLsizei size )
-{
- int region_offset = 0;
- drmI830MemAlloc alloc;
- int ret;
-
- if (0)
- fprintf(stderr, "%s: %d bytes\n", __FUNCTION__, size);
-
- alloc.region = I830_MEM_REGION_AGP;
- alloc.alignment = 0;
- alloc.size = size;
- alloc.region_offset = &region_offset;
-
- LOCK_HARDWARE(intel);
-
- /* Make sure the global heap is initialized
- */
- if (intel->texture_heaps[0])
- driAgeTextures( intel->texture_heaps[0] );
-
-
- ret = drmCommandWriteRead( intel->driFd,
- DRM_I830_ALLOC,
- &alloc, sizeof(alloc));
-
- if (ret) {
- fprintf(stderr, "%s: DRM_I830_ALLOC ret %d\n", __FUNCTION__, ret);
- UNLOCK_HARDWARE(intel);
- return NULL;
- }
-
- if (0)
- fprintf(stderr, "%s: allocated %d bytes\n", __FUNCTION__, size);
-
- /* Need to propogate this information (agp memory in use) to our
- * local texture lru. The kernel has already updated the global
- * lru. An alternative would have been to allocate memory the
- * usual way and then notify the kernel to pin the allocation.
- */
- if (intel->texture_heaps[0])
- driAgeTextures( intel->texture_heaps[0] );
-
- UNLOCK_HARDWARE(intel);
-
- return (void *)((char *)intel->intelScreen->tex.map + region_offset);
-}
-
-void intelFreeAGP( intelContextPtr intel, void *pointer )
-{
- int region_offset;
- drmI830MemFree memfree;
- int ret;
-
- region_offset = (char *)pointer - (char *)intel->intelScreen->tex.map;
-
- if (region_offset < 0 ||
- region_offset > intel->intelScreen->tex.size) {
- fprintf(stderr, "offset %d outside range 0..%d\n", region_offset,
- intel->intelScreen->tex.size);
- return;
- }
-
- memfree.region = I830_MEM_REGION_AGP;
- memfree.region_offset = region_offset;
-
- ret = drmCommandWrite( intel->driFd,
- DRM_I830_FREE,
- &memfree, sizeof(memfree));
-
- if (ret)
- fprintf(stderr, "%s: DRM_I830_FREE ret %d\n", __FUNCTION__, ret);
-}
-
-/* This version of AllocateMemoryMESA allocates only agp memory, and
- * only does so after the point at which the driver has been
- * initialized.
- *
- * Theoretically a valid context isn't required. However, in this
- * implementation, it is, as I'm using the hardware lock to protect
- * the kernel data structures, and the current context to get the
- * device fd.
- */
-void *intelAllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn,
- GLsizei size, GLfloat readfreq,
- GLfloat writefreq, GLfloat priority)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (INTEL_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq,
- writefreq, priority);
-
- if (getenv("INTEL_NO_ALLOC"))
- return NULL;
-
- if (!ctx || INTEL_CONTEXT(ctx) == 0)
- return NULL;
-
- return intelAllocateAGP( INTEL_CONTEXT(ctx), size );
-}
-
-
-/* Called via glXFreeMemoryMESA() */
-void intelFreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (INTEL_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %p\n", __FUNCTION__, pointer);
-
- if (!ctx || INTEL_CONTEXT(ctx) == 0) {
- fprintf(stderr, "%s: no context\n", __FUNCTION__);
- return;
- }
-
- intelFreeAGP( INTEL_CONTEXT(ctx), pointer );
-}
-
-/* Called via glXGetMemoryOffsetMESA()
- *
- * Returns offset of pointer from the start of agp aperture.
- */
-GLuint intelGetMemoryOffsetMESA(__DRInativeDisplay *dpy, int scrn,
- const GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- intelContextPtr intel;
-
- if (!ctx || !(intel = INTEL_CONTEXT(ctx)) ) {
- fprintf(stderr, "%s: no context\n", __FUNCTION__);
- return ~0;
- }
-
- if (!intelIsAgpMemory( intel, pointer, 0 ))
- return ~0;
-
- return intelAgpOffsetFromVirtual( intel, pointer );
-}
-
-
-GLboolean intelIsAgpMemory( intelContextPtr intel, const GLvoid *pointer,
- GLint size )
-{
- int offset = (char *)pointer - (char *)intel->intelScreen->tex.map;
- int valid = (size >= 0 &&
- offset >= 0 &&
- offset + size < intel->intelScreen->tex.size);
-
- if (INTEL_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "intelIsAgpMemory( %p ) : %d\n", pointer, valid );
-
- return valid;
-}
-
-
-GLuint intelAgpOffsetFromVirtual( intelContextPtr intel, const GLvoid *pointer )
-{
- int offset = (char *)pointer - (char *)intel->intelScreen->tex.map;
-
- if (offset < 0 || offset > intel->intelScreen->tex.size)
- return ~0;
- else
- return intel->intelScreen->textureOffset + offset;
-}
-
-
-
-
-
-/* Flip the front & back buffes
- */
-void intelPageFlip( const __DRIdrawablePrivate *dPriv )
-{
-#if 0
- intelContextPtr intel;
- int tmp, ret;
-
- if (INTEL_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
-
- if (dPriv->pClipRects) {
- *(drm_clip_rect_t *)intel->sarea->boxes = dPriv->pClipRects[0];
- intel->sarea->nbox = 1;
- }
-
- ret = drmCommandNone(intel->driFd, DRM_I830_FLIP);
- if (ret) {
- fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);
- UNLOCK_HARDWARE( intel );
- exit(1);
- }
-
- tmp = intel->sarea->last_enqueue;
- intelRefillBatchLocked( intel );
- UNLOCK_HARDWARE( intel );
-
-
- intelSetDrawBuffer( &intel->ctx, intel->ctx.Color.DriverDrawBuffer );
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.h
deleted file mode 100644
index 7e6295167..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_ioctl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_IOCTL_H
-#define INTEL_IOCTL_H
-
-#include "intel_context.h"
-
-extern void intelWaitAgeLocked( intelContextPtr intel, int age, GLboolean unlock );
-
-extern void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch);
-
-extern void intelPageFlip( const __DRIdrawablePrivate *dpriv );
-extern void intelWaitForIdle( intelContextPtr intel );
-extern void intelFlushBatch( intelContextPtr intel, GLboolean refill );
-extern void intelFlushBatchLocked( intelContextPtr intel,
- GLboolean ignore_cliprects,
- GLboolean refill,
- GLboolean allow_unlock);
-extern void intelRefillBatchLocked( intelContextPtr intel, GLboolean allow_unlock );
-extern void intelFinish( GLcontext *ctx );
-extern void intelFlush( GLcontext *ctx );
-
-extern void *intelAllocateAGP( intelContextPtr intel, GLsizei size );
-extern void intelFreeAGP( intelContextPtr intel, void *pointer );
-
-extern void *intelAllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn,
- GLsizei size, GLfloat readfreq,
- GLfloat writefreq, GLfloat priority );
-
-extern void intelFreeMemoryMESA( __DRInativeDisplay *dpy, int scrn,
- GLvoid *pointer );
-
-extern GLuint intelGetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer );
-extern GLboolean intelIsAgpMemory( intelContextPtr intel, const GLvoid *pointer,
- GLint size );
-
-extern GLuint intelAgpOffsetFromVirtual( intelContextPtr intel, const GLvoid *p );
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_pixel.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_pixel.c
deleted file mode 100644
index e56e46b4d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_pixel.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "swrast/swrast.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-
-
-
-static GLboolean
-check_color( const GLcontext *ctx, GLenum type, GLenum format,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- GLuint cpp = intel->intelScreen->cpp;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if ( (pitch & 63) ||
- ctx->_ImageTransferState ||
- packing->SwapBytes ||
- packing->LsbFirst) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: failed 1\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV &&
- cpp == 4 &&
- format == GL_BGRA ) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: passed 2\n", __FUNCTION__);
- return GL_TRUE;
- }
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- return GL_FALSE;
-}
-
-static GLboolean
-check_color_per_fragment_ops( const GLcontext *ctx )
-{
- int result;
- result = (!( ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest
- ) &&
- ctx->Current.RasterPosValid);
-
- return result;
-}
-
-
-
-static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height,
- GLint *size )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- *size = ((*y + *height - 1) * intel->intelScreen->frontPitch +
- (*x + *width - 1) * intel->intelScreen->cpp);
-
- return GL_TRUE;
-}
-
-static GLboolean
-intelTryReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- GLint size = 0;
- GLint pitch = pack->RowLength ? pack->RowLength : width;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Only accelerate reading to agp buffers.
- */
- if ( !intelIsAgpMemory(intel, pixels,
- pitch * height * intel->intelScreen->cpp ) ) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: dest not agp\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Need GL_PACK_INVERT_MESA to cope with upsidedown results from
- * blitter:
- */
- if (!pack->Invert) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: MESA_PACK_INVERT not set\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, pack, pixels, size, pitch))
- return GL_FALSE;
-
- switch ( intel->intelScreen->cpp ) {
- case 4:
- break;
- default:
- return GL_FALSE;
- }
-
-
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects and drawOffset are
- * correct.
- *
- * This is an unusual situation however, as the code which flushes
- * a full command buffer expects to be called unlocked. As a
- * workaround, immediately flush the buffer on aquiring the lock.
- */
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
- {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- int src_offset = intel->drawOffset;
- int src_pitch = intel->intelScreen->frontPitch;
- int dst_offset = intelAgpOffsetFromVirtual( intel, pixels);
- drm_clip_rect_t *box = dPriv->pClipRects;
- int i;
-
- if (!clip_pixelrect(ctx, ctx->ReadBuffer, &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( intel );
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s totally clipped -- nothing to do\n",
- __FUNCTION__);
- return GL_TRUE;
- }
-
-
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "readpixel blit src_pitch %d dst_pitch %d\n",
- src_pitch, pitch);
-
- for (i = 0 ; i < nbox ; i++)
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- intelEmitCopyBlitLocked( intel,
- intel->intelScreen->cpp,
- src_pitch, src_offset,
- pitch, dst_offset,
- bx, by,
- bx - x, by - y,
- bw, bh );
- }
- }
- UNLOCK_HARDWARE( intel );
- intelFinish( &intel->ctx );
-
- return GL_TRUE;
-}
-
-static void
-intelReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!intelTryReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels))
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels);
-}
-
-
-
-
-static void do_draw_pix( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint pitch,
- const void *pixels,
- GLuint dest )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
- int nbox = dPriv->numClipRects;
- int i;
- int size;
- int src_offset = intelAgpOffsetFromVirtual( intel, pixels);
- int src_pitch = pitch;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
- if (ctx->DrawBuffer)
- {
- y -= height; /* cope with pixel zoom */
-
- if (!clip_pixelrect(ctx, ctx->DrawBuffer,
- &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( intel );
- return;
- }
-
- y = dPriv->h - y - height; /* convert from gl to hardware coords */
- x += dPriv->x;
- y += dPriv->y;
-
-
- for (i = 0 ; i < nbox ; i++ )
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- intelEmitCopyBlitLocked( intel,
- intel->intelScreen->cpp,
- src_pitch, src_offset,
- intel->intelScreen->frontPitch,
- intel->drawOffset,
- bx - x, by - y,
- bx, by,
- bw, bh );
- }
- }
- UNLOCK_HARDWARE( intel );
- intelFinish( &intel->ctx );
-}
-
-
-
-
-static GLboolean
-intelTryDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint dest;
- GLuint cpp = intel->intelScreen->cpp;
- GLint size = width * pitch * cpp;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case GL_RGB:
- case GL_RGBA:
- case GL_BGRA:
- dest = intel->drawOffset;
-
- /* Planemask doesn't have full support in blits.
- */
- if (!ctx->Color.ColorMask[RCOMP] ||
- !ctx->Color.ColorMask[GCOMP] ||
- !ctx->Color.ColorMask[BCOMP] ||
- !ctx->Color.ColorMask[ACOMP]) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: planemask\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Can't do conversions on agp reads/draws.
- */
- if ( !intelIsAgpMemory( intel, pixels, size ) ) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: not agp memory\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, unpack, pixels, size, pitch)) {
- return GL_FALSE;
- }
- if (!check_color_per_fragment_ops(ctx)) {
- return GL_FALSE;
- }
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != -1.0F)
- return GL_FALSE;
- break;
-
- default:
- return GL_FALSE;
- }
-
- if ( intelIsAgpMemory(intel, pixels, size) )
- {
- do_draw_pix( ctx, x, y, width, height, pitch, pixels,
- dest );
- return GL_TRUE;
- }
- else if (0)
- {
- /* Pixels is in regular memory -- get dma buffers and perform
- * upload through them. No point doing this for regular uploads
- * but once we remove some of the restrictions above (colormask,
- * pixelformat conversion, zoom?, etc), this could be a win.
- */
- }
- else
- return GL_FALSE;
-}
-
-static void
-intelDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!intelTryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-
-
-
-
-/**
- * Implement glCopyPixels for the front color buffer (or back buffer Pixmap)
- * for the color buffer. Don't support zooming, pixel transfer, etc.
- * We do support copying from one window to another, ala glXMakeCurrentRead.
- */
-static void
-intelCopyPixels( GLcontext *ctx,
- GLint srcx, GLint srcy, GLsizei width, GLsizei height,
- GLint destx, GLint desty, GLenum type )
-{
-#if 0
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- const SWcontext *swrast = SWRAST_CONTEXT( ctx );
- XMesaDisplay *dpy = xmesa->xm_visual->display;
- const XMesaDrawable drawBuffer = xmesa->xm_draw_buffer->buffer;
- const XMesaDrawable readBuffer = xmesa->xm_read_buffer->buffer;
- const XMesaGC gc = xmesa->xm_draw_buffer->gc;
-
- ASSERT(dpy);
- ASSERT(gc);
-
- if (drawBuffer && /* buffer != 0 means it's a Window or Pixmap */
- readBuffer &&
- type == GL_COLOR &&
- (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */
- ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */
- ctx->Pixel.ZoomX == 1.0 && /* no zooming */
- ctx->Pixel.ZoomY == 1.0) {
- /* Note: we don't do any special clipping work here. We could,
- * but X will do it for us.
- */
- srcy = FLIP(xmesa->xm_read_buffer, srcy) - height + 1;
- desty = FLIP(xmesa->xm_draw_buffer, desty) - height + 1;
- XCopyArea(dpy, readBuffer, drawBuffer, gc,
- srcx, srcy, width, height, destx, desty);
- }
-#else
- _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type );
-#endif
-}
-
-
-
-
-void intelInitPixelFuncs( struct dd_function_table *functions )
-{
- /* Pixel path fallbacks.
- */
- functions->Accum = _swrast_Accum;
- functions->Bitmap = _swrast_Bitmap;
- functions->CopyPixels = intelCopyPixels;
-
- if (!getenv("INTEL_NO_BLITS")) {
- functions->ReadPixels = intelReadPixels;
- functions->DrawPixels = intelDrawPixels;
- }
- else {
- functions->ReadPixels = _swrast_ReadPixels;
- functions->DrawPixels = _swrast_DrawPixels;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_reg.h
deleted file mode 100644
index 1ec153266..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_reg.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-
-#ifndef _INTEL_REG_H_
-#define _INTEL_REG_H_
-
-
-
-#define CMD_3D (0x3<<29)
-
-
-#define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24))
-#define PRIM_INDIRECT (1<<23)
-#define PRIM_INLINE (0<<23)
-#define PRIM_INDIRECT_SEQUENTIAL (0<<17)
-#define PRIM_INDIRECT_ELTS (1<<17)
-
-#define PRIM3D_TRILIST (0x0<<18)
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-#define PRIM3D_MASK (0x1f<<18)
-
-#define I915PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define I915PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define I915PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define I915PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-
-
-
-#define BR00_BITBLT_CLIENT 0x40000000
-#define BR00_OP_COLOR_BLT 0x10000000
-#define BR00_OP_SRC_COPY_BLT 0x10C00000
-#define BR13_SOLID_PATTERN 0x80000000
-
-#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4)
-#define XY_COLOR_BLT_WRITE_ALPHA (1<<21)
-#define XY_COLOR_BLT_WRITE_RGB (1<<20)
-
-#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
-#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
-#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_render.c
deleted file mode 100644
index d9438ba0f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_render.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware acceleration where possible.
- *
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "tnl/t_vertex.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_tris.h"
-#include "intel_batchbuffer.h"
-#include "intel_reg.h"
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 0 /* Has it, but can't use because subpixel has to
- * be adjusted for points on the INTEL/I845G
- */
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0
-
-static GLuint hw_prim[GL_POLYGON+1] = {
- 0,
- PRIM3D_LINELIST,
- PRIM3D_LINESTRIP,
- PRIM3D_LINESTRIP,
- PRIM3D_TRILIST,
- PRIM3D_TRISTRIP,
- PRIM3D_TRIFAN,
- 0,
- 0,
- PRIM3D_POLY
-};
-
-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 const int scale_prim[GL_POLYGON+1] = {
- 0, /* fallback case */
- 1,
- 2,
- 2,
- 1,
- 3,
- 3,
- 0, /* fallback case */
- 0, /* fallback case */
- 3
-};
-
-
-static void intelDmaPrimitive( intelContextPtr intel, GLenum prim )
-{
- if (0) fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(prim));
- INTEL_FIREVERTICES(intel);
- intel->vtbl.reduced_primitive_state( intel, reduced_prim[prim] );
- intelStartInlinePrimitive( intel, hw_prim[prim] );
-}
-
-
-#define LOCAL_VARS intelContextPtr intel = INTEL_CONTEXT(ctx)
-#define INIT( prim ) \
-do { \
- intelDmaPrimitive( intel, prim ); \
-} while (0)
-#define FLUSH() INTEL_FIREVERTICES( intel )
-
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (((intel->alloc.size / 2) - 1500) / (intel->vertex_size*4))
-#define GET_CURRENT_VB_MAX_VERTS() GET_SUBSEQUENT_VB_MAX_VERTS()
-
-#define ALLOC_VERTS( nr ) \
- intelExtendInlinePrimitive( intel, (nr) * intel->vertex_size )
-
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf )
-
-#define TAG(x) intel_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-/* Heuristic to choose between the two render paths:
- */
-static GLboolean choose_render( intelContextPtr intel,
- struct vertex_buffer *VB )
-{
- int vertsz = intel->vertex_size;
- int cost_render = 0;
- int cost_fallback = 0;
- int nr_prims = 0;
- int nr_rprims = 0;
- int nr_rverts = 0;
- int rprim = intel->reduced_primitive;
- int i = 0;
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++) {
- GLuint prim = VB->Primitive[i].mode;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- nr_prims++;
- nr_rverts += length * scale_prim[prim & PRIM_MODE_MASK];
-
- if (reduced_prim[prim & PRIM_MODE_MASK] != rprim) {
- nr_rprims++;
- rprim = reduced_prim[prim & PRIM_MODE_MASK];
- }
- }
-
- /* One point for each generated primitive:
- */
- cost_render = nr_prims;
- cost_fallback = nr_rprims;
-
- /* One point for every 1024 dwords (4k) of dma:
- */
- cost_render += (vertsz * i) / 1024;
- cost_fallback += (vertsz * nr_rverts) / 1024;
-
- if (0)
- fprintf(stderr, "cost render: %d fallback: %d\n",
- cost_render, cost_fallback);
-
- if (cost_render > cost_fallback)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-static GLboolean intel_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- /* Don't handle clipping or indexed vertices.
- */
- if (intel->RenderIndex != 0 ||
- !intel_validate_render( ctx, VB ) ||
- !choose_render( intel, VB )) {
- return GL_TRUE;
- }
-
- tnl->clipspace.new_inputs |= VERT_BIT_POS;
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- intel_render_tab_verts[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 _intel_render_stage =
-{
- "intel render",
- NULL,
- NULL,
- NULL,
- NULL,
- intel_run_render /* run */
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c
deleted file mode 100644
index 57c7504bf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "context.h"
-#include "framebuffer.h"
-#include "matrix.h"
-#include "renderbuffer.h"
-#include "simple_list.h"
-#include "utils.h"
-#include "xmlpool.h"
-
-
-#include "intel_screen.h"
-
-#include "intel_tex.h"
-#include "intel_span.h"
-#include "intel_tris.h"
-#include "intel_ioctl.h"
-
-
-
-#include "i830_dri.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 1;
-
-extern const struct dri_extension card_extensions[];
-
-static void intelPrintDRIInfo(intelScreenPrivate *intelScreen,
- __DRIscreenPrivate *sPriv,
- I830DRIPtr gDRIPriv)
-{
- fprintf(stderr, "Front size : 0x%x\n", sPriv->fbSize);
- fprintf(stderr, "Front offset : 0x%x\n", intelScreen->frontOffset);
- fprintf(stderr, "Back size : 0x%x\n", intelScreen->back.size);
- fprintf(stderr, "Back offset : 0x%x\n", intelScreen->backOffset);
- fprintf(stderr, "Depth size : 0x%x\n", intelScreen->depth.size);
- fprintf(stderr, "Depth offset : 0x%x\n", intelScreen->depthOffset);
- fprintf(stderr, "Texture size : 0x%x\n", intelScreen->textureSize);
- fprintf(stderr, "Texture offset : 0x%x\n", intelScreen->textureOffset);
- fprintf(stderr, "Memory : 0x%x\n", gDRIPriv->mem);
-}
-
-static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
-{
- intelScreenPrivate *intelScreen;
- I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- intelScreen = (intelScreenPrivate *)CALLOC(sizeof(intelScreenPrivate));
- if (!intelScreen) {
- fprintf(stderr,"\nERROR! Allocating private area failed\n");
- return GL_FALSE;
- }
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&intelScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- intelScreen->driScrnPriv = sPriv;
- sPriv->private = (void *)intelScreen;
-
- intelScreen->deviceID = gDRIPriv->deviceID;
- intelScreen->width = gDRIPriv->width;
- intelScreen->height = gDRIPriv->height;
- intelScreen->mem = gDRIPriv->mem;
- intelScreen->cpp = gDRIPriv->cpp;
- intelScreen->frontPitch = gDRIPriv->fbStride;
- intelScreen->frontOffset = gDRIPriv->fbOffset;
-
- switch (gDRIPriv->bitsPerPixel) {
- case 15: intelScreen->fbFormat = DV_PF_555; break;
- case 16: intelScreen->fbFormat = DV_PF_565; break;
- case 32: intelScreen->fbFormat = DV_PF_8888; break;
- }
-
- intelScreen->backOffset = gDRIPriv->backOffset;
- intelScreen->backPitch = gDRIPriv->backPitch;
- intelScreen->depthOffset = gDRIPriv->depthOffset;
- intelScreen->depthPitch = gDRIPriv->depthPitch;
- intelScreen->textureOffset = gDRIPriv->textureOffset;
- intelScreen->textureSize = gDRIPriv->textureSize;
- intelScreen->logTextureGranularity = gDRIPriv->logTextureGranularity;
- intelScreen->back.handle = gDRIPriv->backbuffer;
- intelScreen->back.size = gDRIPriv->backbufferSize;
-
- if (drmMap(sPriv->fd,
- intelScreen->back.handle,
- intelScreen->back.size,
- (drmAddress *)&intelScreen->back.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- FREE(intelScreen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- intelScreen->depth.handle = gDRIPriv->depthbuffer;
- intelScreen->depth.size = gDRIPriv->depthbufferSize;
-
- if (drmMap(sPriv->fd,
- intelScreen->depth.handle,
- intelScreen->depth.size,
- (drmAddress *)&intelScreen->depth.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- FREE(intelScreen);
- drmUnmap(intelScreen->back.map, intelScreen->back.size);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- intelScreen->tex.handle = gDRIPriv->textures;
- intelScreen->tex.size = gDRIPriv->textureSize;
-
- if (drmMap(sPriv->fd,
- intelScreen->tex.handle,
- intelScreen->tex.size,
- (drmAddress *)&intelScreen->tex.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- FREE(intelScreen);
- drmUnmap(intelScreen->back.map, intelScreen->back.size);
- drmUnmap(intelScreen->depth.map, intelScreen->depth.size);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
- if (0) intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);
-
- intelScreen->drmMinor = sPriv->drmMinor;
-
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_IRQ_ACTIVE;
- gp.value = &intelScreen->irq_active;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: %d\n", ret);
- return GL_FALSE;
- }
- }
-
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_ALLOW_BATCHBUFFER;
- gp.value = &intelScreen->allow_batchbuffer;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: (%d) %d\n", gp.param, ret);
- return GL_FALSE;
- }
- }
-
- if (glx_enable_extension != NULL) {
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
- }
-
- sPriv->psc->allocateMemory = (void *) intelAllocateMemoryMESA;
- sPriv->psc->freeMemory = (void *) intelFreeMemoryMESA;
- sPriv->psc->memoryOffset = (void *) intelGetMemoryOffsetMESA;
-
- return GL_TRUE;
-}
-
-
-static void intelDestroyScreen(__DRIscreenPrivate *sPriv)
-{
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
-
- /* Need to unmap all the bufs and maps here:
- */
- drmUnmap(intelScreen->back.map, intelScreen->back.size);
- drmUnmap(intelScreen->depth.map, intelScreen->depth.size);
- drmUnmap(intelScreen->tex.map, intelScreen->tex.size);
- FREE(intelScreen);
- sPriv->private = NULL;
-}
-
-
-static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- intelScreenPrivate *screen = (intelScreenPrivate *) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- } else {
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
-
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- intelSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- intelSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- intelSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- intelSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- intelSetSpanFunctions(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;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-/* There are probably better ways to do this, such as an
- * init-designated function to register chipids and createcontext
- * functions.
- */
-extern GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-extern GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-
-
-
-static GLboolean intelCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
-
- switch (intelScreen->deviceID) {
- case PCI_CHIP_845_G:
- case PCI_CHIP_I830_M:
- case PCI_CHIP_I855_GM:
- case PCI_CHIP_I865_G:
- return i830CreateContext( mesaVis, driContextPriv,
- sharedContextPrivate );
-
- case PCI_CHIP_I915_G:
- case PCI_CHIP_I915_GM:
- case PCI_CHIP_I945_G:
- return i915CreateContext( mesaVis, driContextPriv,
- sharedContextPrivate );
-
- default:
- fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID);
- return GL_FALSE;
- }
-}
-
-
-static const struct __DriverAPIRec intelAPI = {
- .InitDriver = intelInitDriver,
- .DestroyScreen = intelDestroyScreen,
- .CreateContext = intelCreateContext,
- .DestroyContext = intelDestroyContext,
- .CreateBuffer = intelCreateBuffer,
- .DestroyBuffer = intelDestroyBuffer,
- .SwapBuffers = intelSwapBuffers,
- .MakeCurrent = intelMakeCurrent,
- .UnbindContext = intelUnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *
-intelFillInModes( 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;
-
- /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
- * support pageflipping at all.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
- };
-
- u_int8_t depth_bits_array[3];
- u_int8_t stencil_bits_array[3];
-
-
- 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;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
- back_buffer_factor = (have_back_buffer) ? 3 : 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_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 4, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 1, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "i915",
- 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, &intelAPI);
- if ( psp != NULL ) {
- I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
- *driver_modes = intelFillInModes( dri_priv->cpp * 8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h
deleted file mode 100644
index f2fb1c6bc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef _INTEL_INIT_H_
-#define _INTEL_INIT_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-typedef struct {
- drm_handle_t handle;
- drmSize size;
- char *map;
-} intelRegion;
-
-typedef struct
-{
- intelRegion front;
- intelRegion back;
- intelRegion depth;
- intelRegion tex;
-
- int deviceID;
- int width;
- int height;
- int mem;
-
- int cpp; /* for front and back buffers */
- int bitsPerPixel;
-
- int fbFormat;
-
- int frontOffset;
- int frontPitch;
-
- int backOffset;
- int backPitch;
-
- int depthOffset;
- int depthPitch;
-
-
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-
- __DRIscreenPrivate *driScrnPriv;
- unsigned int sarea_priv_offset;
-
- int drmMinor;
-
- int irq_active;
- int allow_batchbuffer;
-
- /**
- * Configuration cache with default values for all contexts
- */
- driOptionCache optionCache;
-} intelScreenPrivate;
-
-
-extern void
-intelDestroyContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-intelUnbindContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
-extern void
-intelSwapBuffers( __DRIdrawablePrivate *dPriv);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.c
deleted file mode 100644
index 3522f4f38..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-#include "intel_screen.h"
-
-#include "intel_span.h"
-#include "intel_ioctl.h"
-#include "swrast/swrast.h"
-
-
-#define DBG 0
-
-#define LOCAL_VARS \
- intelContextPtr intel = INTEL_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = intel->driDrawable; \
- intelScreenPrivate *intelScreen = intel->intelScreen; \
- GLuint pitch = intelScreen->backPitch * intelScreen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(intel->drawMap + \
- dPriv->x * intelScreen->cpp + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(intel->readMap + \
- dPriv->x * intelScreen->cpp + \
- dPriv->y * pitch); \
- GLushort p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- intelContextPtr intel = INTEL_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = intel->driDrawable; \
- intelScreenPrivate *intelScreen = intel->intelScreen; \
- GLuint pitch = intelScreen->backPitch * intelScreen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(intelScreen->depth.map + \
- dPriv->x * intelScreen->cpp + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define INIT_MONO_PIXEL(p,color)\
- p = INTEL_PACKCOLOR565(color[0],color[1],color[2])
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-/* 16 bit, 565 rgb color spanline and pixel functions
- */
-#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 *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (((p >> 11) & 0x1f) * 255) / 31; \
- rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \
- rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) intel##x##_565
-#include "spantmp.h"
-
-/* 15 bit, 555 rgb color spanline and pixel functions
- */
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \
- ((g & 0xf8) << 3) | \
- ((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 *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 7) & 0xf8; \
- rgba[1] = (p >> 3) & 0xf8; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = 255; \
-} while(0)
-
-#define TAG(x) intel##x##_555
-#include "spantmp.h"
-
-/* 16 bit depthbuffer functions.
- */
-#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) intel##x##_16
-#include "depthtmp.h"
-
-
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- intelContextPtr intel = INTEL_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = intel->driDrawable; \
- intelScreenPrivate *intelScreen = intel->intelScreen; \
- GLuint pitch = intelScreen->backPitch * intelScreen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(intel->drawMap + \
- dPriv->x * intelScreen->cpp + \
- dPriv->y * pitch); \
- char *read_buf = (char *)(intel->readMap + \
- dPriv->x * intelScreen->cpp + \
- dPriv->y * pitch); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p,color)\
- p = INTEL_PACKCOLOR8888(color[0],color[1],color[2],color[3])
-
-/* 32 bit, 8888 argb color spanline and pixel functions
- */
-#define WRITE_RGBA(_x, _y, r, g, b, a) \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((r << 16) | \
- (g << 8) | \
- (b << 0) | \
- (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 *)(read_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) intel##x##_8888
-#include "spantmp.h"
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
- tmp &= 0xff000000; \
- tmp |= (d) & 0xffffff; \
- *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) & 0xffffff;
-
-
-#define TAG(x) intel##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
- tmp &= 0xffffff; \
- tmp |= ((d)<<24); \
- *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) >> 24;
-
-#define TAG(x) intel##x##_24_8
-#include "stenciltmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void intelSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit)
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
- intel->drawMap = (char *)intel->driScreen->pFB;
- intel->readMap = (char *)intel->driScreen->pFB;
- } else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
- intel->drawMap = intel->intelScreen->back.map;
- intel->readMap = intel->intelScreen->back.map;
- } else {
- ASSERT(0);
- }
-}
-
-
-/* Move locking out to get reasonable span performance.
- */
-void intelSpanRenderStart( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
- intelWaitForIdle(intel);
-}
-
-void intelSpanRenderFinish( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( intel );
-}
-
-void intelInitSpanFuncs( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- intelScreenPrivate *intelScreen = intel->intelScreen;
-
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = intelSetBuffer;
-
- switch (intelScreen->fbFormat) {
- case DV_PF_555:
-#if 0
- swdd->WriteRGBASpan = intelWriteRGBASpan_555;
- swdd->WriteRGBSpan = intelWriteRGBSpan_555;
- swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_555;
- swdd->WriteRGBAPixels = intelWriteRGBAPixels_555;
- swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_555;
- swdd->ReadRGBASpan = intelReadRGBASpan_555;
- swdd->ReadRGBAPixels = intelReadRGBAPixels_555;
- swdd->ReadDepthSpan = intelReadDepthSpan_16;
- swdd->WriteDepthSpan = intelWriteDepthSpan_16;
- swdd->ReadDepthPixels = intelReadDepthPixels_16;
- swdd->WriteDepthPixels = intelWriteDepthPixels_16;
-#endif
- break;
-
- case DV_PF_565:
-#if 0
- swdd->WriteRGBASpan = intelWriteRGBASpan_565;
- swdd->WriteRGBSpan = intelWriteRGBSpan_565;
- swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_565;
- swdd->WriteRGBAPixels = intelWriteRGBAPixels_565;
- swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_565;
- swdd->ReadRGBASpan = intelReadRGBASpan_565;
- swdd->ReadRGBAPixels = intelReadRGBAPixels_565;
- swdd->ReadDepthSpan = intelReadDepthSpan_16;
- swdd->WriteDepthSpan = intelWriteDepthSpan_16;
- swdd->ReadDepthPixels = intelReadDepthPixels_16;
- swdd->WriteDepthPixels = intelWriteDepthPixels_16;
-#endif
- break;
-
- case DV_PF_8888:
-#if 0
- swdd->WriteRGBASpan = intelWriteRGBASpan_8888;
- swdd->WriteRGBSpan = intelWriteRGBSpan_8888;
- swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_8888;
- swdd->WriteRGBAPixels = intelWriteRGBAPixels_8888;
- swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_8888;
- swdd->ReadRGBASpan = intelReadRGBASpan_8888;
- swdd->ReadRGBAPixels = intelReadRGBAPixels_8888;
- swdd->ReadDepthSpan = intelReadDepthSpan_24_8;
- swdd->WriteDepthSpan = intelWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = intelReadDepthPixels_24_8;
- swdd->WriteDepthPixels = intelWriteDepthPixels_24_8;
-
- swdd->WriteStencilSpan = intelWriteStencilSpan_24_8;
- swdd->ReadStencilSpan = intelReadStencilSpan_24_8;
- swdd->WriteStencilPixels = intelWriteStencilPixels_24_8;
- swdd->ReadStencilPixels = intelReadStencilPixels_24_8;
-#endif
- break;
- }
-
- swdd->SpanRenderStart = intelSpanRenderStart;
- swdd->SpanRenderFinish = intelSpanRenderFinish;
-}
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-intelSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
- drb->Base.GetRow = intelReadRGBASpan_555;
- drb->Base.GetValues = intelReadRGBAPixels_555;
- drb->Base.PutRow = intelWriteRGBASpan_555;
- drb->Base.PutRowRGB = intelWriteRGBSpan_555;
- drb->Base.PutMonoRow = intelWriteMonoRGBASpan_555;
- drb->Base.PutValues = intelWriteRGBAPixels_555;
- drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_555;
- }
- else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = intelReadRGBASpan_565;
- drb->Base.GetValues = intelReadRGBAPixels_565;
- drb->Base.PutRow = intelWriteRGBASpan_565;
- drb->Base.PutRowRGB = intelWriteRGBSpan_565;
- drb->Base.PutMonoRow = intelWriteMonoRGBASpan_565;
- drb->Base.PutValues = intelWriteRGBAPixels_565;
- drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_565;
- }
- else {
- assert(vis->redBits == 8);
- assert(vis->greenBits == 8);
- assert(vis->blueBits == 8);
- drb->Base.GetRow = intelReadRGBASpan_8888;
- drb->Base.GetValues = intelReadRGBAPixels_8888;
- drb->Base.PutRow = intelWriteRGBASpan_8888;
- drb->Base.PutRowRGB = intelWriteRGBSpan_8888;
- drb->Base.PutMonoRow = intelWriteMonoRGBASpan_8888;
- drb->Base.PutValues = intelWriteRGBAPixels_8888;
- drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_8888;
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = intelReadDepthSpan_16;
- drb->Base.GetValues = intelReadDepthPixels_16;
- drb->Base.PutRow = intelWriteDepthSpan_16;
- drb->Base.PutMonoRow = intelWriteMonoDepthSpan_16;
- drb->Base.PutValues = intelWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = intelReadDepthSpan_24_8;
- drb->Base.GetValues = intelReadDepthPixels_24_8;
- drb->Base.PutRow = intelWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = intelWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = intelWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = intelReadStencilSpan_24_8;
- drb->Base.GetValues = intelReadStencilPixels_24_8;
- drb->Base.PutRow = intelWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = intelWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = intelWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.h
deleted file mode 100644
index 2d4f8589d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_span.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef _INTEL_SPAN_H
-#define _INTEL_SPAN_H
-
-#include "drirenderbuffer.h"
-
-extern void intelInitSpanFuncs( GLcontext *ctx );
-
-extern void intelSpanRenderFinish( GLcontext *ctx );
-extern void intelSpanRenderStart( GLcontext *ctx );
-
-extern void
-intelSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_state.c
deleted file mode 100644
index cf1f3c580..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_state.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "swrast/swrast.h"
-
-int intel_translate_compare_func( GLenum func )
-{
- switch(func) {
- case GL_NEVER:
- return COMPAREFUNC_NEVER;
- case GL_LESS:
- return COMPAREFUNC_LESS;
- case GL_LEQUAL:
- return COMPAREFUNC_LEQUAL;
- case GL_GREATER:
- return COMPAREFUNC_GREATER;
- case GL_GEQUAL:
- return COMPAREFUNC_GEQUAL;
- case GL_NOTEQUAL:
- return COMPAREFUNC_NOTEQUAL;
- case GL_EQUAL:
- return COMPAREFUNC_EQUAL;
- case GL_ALWAYS:
- return COMPAREFUNC_ALWAYS;
- }
-
- fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
- return COMPAREFUNC_ALWAYS;
-}
-
-int intel_translate_stencil_op( GLenum op )
-{
- switch(op) {
- case GL_KEEP:
- return STENCILOP_KEEP;
- case GL_ZERO:
- return STENCILOP_ZERO;
- case GL_REPLACE:
- return STENCILOP_REPLACE;
- case GL_INCR:
- return STENCILOP_INCRSAT;
- case GL_DECR:
- return STENCILOP_DECRSAT;
- case GL_INCR_WRAP:
- return STENCILOP_INCR;
- case GL_DECR_WRAP:
- return STENCILOP_DECR;
- case GL_INVERT:
- return STENCILOP_INVERT;
- default:
- return STENCILOP_ZERO;
- }
-}
-
-int intel_translate_blend_factor( GLenum factor )
-{
- switch(factor) {
- case GL_ZERO:
- return BLENDFACT_ZERO;
- case GL_SRC_ALPHA:
- return BLENDFACT_SRC_ALPHA;
- case GL_ONE:
- return BLENDFACT_ONE;
- case GL_SRC_COLOR:
- return BLENDFACT_SRC_COLR;
- case GL_ONE_MINUS_SRC_COLOR:
- return BLENDFACT_INV_SRC_COLR;
- case GL_DST_COLOR:
- return BLENDFACT_DST_COLR;
- case GL_ONE_MINUS_DST_COLOR:
- return BLENDFACT_INV_DST_COLR;
- case GL_ONE_MINUS_SRC_ALPHA:
- return BLENDFACT_INV_SRC_ALPHA;
- case GL_DST_ALPHA:
- return BLENDFACT_DST_ALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return BLENDFACT_INV_DST_ALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return BLENDFACT_SRC_ALPHA_SATURATE;
- case GL_CONSTANT_COLOR:
- return BLENDFACT_CONST_COLOR;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- return BLENDFACT_INV_CONST_COLOR;
- case GL_CONSTANT_ALPHA:
- return BLENDFACT_CONST_ALPHA;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- return BLENDFACT_INV_CONST_ALPHA;
- }
-
- fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, factor);
- return BLENDFACT_ZERO;
-}
-
-int intel_translate_logic_op( GLenum opcode )
-{
- switch(opcode) {
- case GL_CLEAR:
- return LOGICOP_CLEAR;
- case GL_AND:
- return LOGICOP_AND;
- case GL_AND_REVERSE:
- return LOGICOP_AND_RVRSE;
- case GL_COPY:
- return LOGICOP_COPY;
- case GL_COPY_INVERTED:
- return LOGICOP_COPY_INV;
- case GL_AND_INVERTED:
- return LOGICOP_AND_INV;
- case GL_NOOP:
- return LOGICOP_NOOP;
- case GL_XOR:
- return LOGICOP_XOR;
- case GL_OR:
- return LOGICOP_OR;
- case GL_OR_INVERTED:
- return LOGICOP_OR_INV;
- case GL_NOR:
- return LOGICOP_NOR;
- case GL_EQUIV:
- return LOGICOP_EQUIV;
- case GL_INVERT:
- return LOGICOP_INV;
- case GL_OR_REVERSE:
- return LOGICOP_OR_RVRSE;
- case GL_NAND:
- return LOGICOP_NAND;
- case GL_SET:
- return LOGICOP_SET;
- default:
- return LOGICOP_SET;
- }
-}
-
-static void intelDrawBuffer(GLcontext *ctx, GLenum mode )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- intelScreenPrivate *screen = intel->intelScreen;
- int front = 0;
-
- if (!ctx->DrawBuffer)
- return;
-
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- front = 1;
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BUFFER_BIT_BACK_LEFT:
- front = 0;
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- if ( intel->sarea->pf_current_page == 1 )
- front ^= 1;
-
- intelSetFrontClipRects( intel );
-
- if (front) {
- intel->drawOffset = screen->frontOffset;
- intel->drawMap = (char *)intel->driScreen->pFB;
- intel->readMap = (char *)intel->driScreen->pFB;
- } else {
- intel->drawOffset = screen->backOffset;
- intel->drawMap = screen->back.map;
- intel->readMap = screen->back.map;
- }
-
- intel->vtbl.set_draw_offset( intel, intel->drawOffset );
-}
-
-static void intelReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-
-static void intelClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- intelScreenPrivate *screen = intel->intelScreen;
-
- CLAMPED_FLOAT_TO_UBYTE(intel->clear_red, color[0]);
- CLAMPED_FLOAT_TO_UBYTE(intel->clear_green, color[1]);
- CLAMPED_FLOAT_TO_UBYTE(intel->clear_blue, color[2]);
- CLAMPED_FLOAT_TO_UBYTE(intel->clear_alpha, color[3]);
-
- intel->ClearColor = INTEL_PACKCOLOR(screen->fbFormat,
- intel->clear_red,
- intel->clear_green,
- intel->clear_blue,
- intel->clear_alpha);
-}
-
-
-static void intelCalcViewport( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = intel->ViewportMatrix.m;
-
- /* See also intel_translate_vertex. SUBPIXEL adjustments can be done
- * via state vars, too.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + intel->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * intel->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * intel->depth_scale;
-}
-
-static void intelViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- intelCalcViewport( ctx );
-}
-
-static void intelDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- intelCalcViewport( ctx );
-}
-
-/* Fallback to swrast for select and feedback.
- */
-static void intelRenderMode( GLcontext *ctx, GLenum mode )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- FALLBACK( intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-
-void intelInitStateFuncs( struct dd_function_table *functions )
-{
- functions->DrawBuffer = intelDrawBuffer;
- functions->ReadBuffer = intelReadBuffer;
- functions->RenderMode = intelRenderMode;
- functions->Viewport = intelViewport;
- functions->DepthRange = intelDepthRange;
- functions->ClearColor = intelClearColor;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c
deleted file mode 100644
index 5fc904e60..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c
+++ /dev/null
@@ -1,831 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "image.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texmem.h"
-#include "texobj.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-#include "intel_context.h"
-#include "intel_tex.h"
-#include "intel_ioctl.h"
-
-
-
-static GLboolean
-intelValidateClientStorage( intelContextPtr intel, GLenum target,
- GLint internalFormat,
- GLint srcWidth, GLint srcHeight,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-
-{
- GLcontext *ctx = &intel->ctx;
- int texelBytes;
-
- if (0)
- fprintf(stderr, "intformat %s format %s type %s\n",
- _mesa_lookup_enum_by_nr( internalFormat ),
- _mesa_lookup_enum_by_nr( format ),
- _mesa_lookup_enum_by_nr( type ));
-
- if (!ctx->Unpack.ClientStorage)
- return 0;
-
- if (ctx->_ImageTransferState ||
- texImage->IsCompressed ||
- texObj->GenerateMipmap)
- return 0;
-
-
- /* This list is incomplete
- */
- switch ( internalFormat ) {
- case GL_RGBA:
- if ( format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- texImage->TexFormat = &_mesa_texformat_argb8888;
- texelBytes = 4;
- }
- else
- return 0;
- break;
-
- case GL_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- texImage->TexFormat = &_mesa_texformat_rgb565;
- texelBytes = 2;
- }
- else
- return 0;
- break;
-
- case GL_YCBCR_MESA:
- if ( format == GL_YCBCR_MESA &&
- type == GL_UNSIGNED_SHORT_8_8_REV_APPLE ) {
- texImage->TexFormat = &_mesa_texformat_ycbcr_rev;
- texelBytes = 2;
- }
- else if ( format == GL_YCBCR_MESA &&
- (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)) {
- texImage->TexFormat = &_mesa_texformat_ycbcr;
- texelBytes = 2;
- }
- else
- return 0;
- break;
-
-
- default:
- return 0;
- }
-
- /* Could deal with these packing issues, but currently don't:
- */
- if (packing->SkipPixels ||
- packing->SkipRows ||
- packing->SwapBytes ||
- packing->LsbFirst) {
- return 0;
- }
-
- {
- GLint srcRowStride = _mesa_image_row_stride(packing, srcWidth,
- format, type);
-
-
- if (0)
- fprintf(stderr, "%s: srcRowStride %d/%x\n",
- __FUNCTION__, srcRowStride, srcRowStride);
-
- /* Could check this later in upload, pitch restrictions could be
- * relaxed, but would need to store the image pitch somewhere,
- * as packing details might change before image is uploaded:
- */
- if (!intelIsAgpMemory( intel, pixels, srcHeight * srcRowStride ) ||
- (srcRowStride & 63))
- return 0;
-
-
- /* Have validated that _mesa_transfer_teximage would be a straight
- * memcpy at this point. NOTE: future calls to TexSubImage will
- * overwrite the client data. This is explicitly mentioned in the
- * extension spec.
- */
- texImage->Data = (void *)pixels;
- texImage->IsClientData = GL_TRUE;
- texImage->RowStride = srcRowStride / texelBytes;
- return 1;
- }
-}
-
-
-
-static void intelTexImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert(t);
- intelFlush( ctx );
- driSwapOutTextureObject( t );
-
- texImage->IsClientData = GL_FALSE;
-
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, packing, texObj, texImage );
-
- t->dirty_images[0] |= (1 << level);
-}
-
-static void intelTexSubImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert(t);
- intelFlush( ctx );
- driSwapOutTextureObject( t );
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-}
-
-
-/* Handles 2D, CUBE, RECT:
- */
-static void intelTexImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert(t);
- intelFlush( ctx );
- driSwapOutTextureObject( t );
- texImage->IsClientData = GL_FALSE;
-
- if (intelValidateClientStorage( INTEL_CONTEXT(ctx), target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
- }
- else {
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-
- t->dirty_images[face] |= (1 << level);
- }
-}
-
-static void intelTexSubImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if (texImage->IsClientData &&
- (char *)pixels == (char *)texImage->Data +
- ((xoffset + yoffset * texImage->RowStride) *
- texImage->TexFormat->TexelBytes)) {
-
- /* Notification only - no upload required */
- }
- else {
- assert( t ); /* this _should_ be true */
- intelFlush( ctx );
- driSwapOutTextureObject( t );
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[face] |= (1 << level);
- }
-}
-
-static void intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert(t);
- intelFlush( ctx );
-
- driSwapOutTextureObject( t );
- texImage->IsClientData = GL_FALSE;
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
-
- _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
- height, border, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void intelCompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- intelFlush( ctx );
- driSwapOutTextureObject( t );
-
- _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void intelTexImage3D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert(t);
- driSwapOutTextureObject( t );
- texImage->IsClientData = GL_FALSE;
-
- _mesa_store_teximage3d(ctx, target, level, internalFormat,
- width, height, depth, border,
- format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void
-intelTexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- driSwapOutTextureObject( t );
-
- _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels, packing, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-
-
-static void intelDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
-
- if ( t != NULL ) {
- intelFlush( ctx );
- driDestroyTextureObject( t );
- }
-
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
-}
-
-
-static const struct gl_texture_format *
-intelChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- const GLboolean do32bpt = ( intel->intelScreen->cpp == 4 &&
- intel->intelScreen->textureSize > 4*1024*1024);
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
- }
- else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
-
- 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_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
- return &_mesa_texformat_depth_component16;
-
- default:
- fprintf(stderr, "unexpected texture format %s in %s\n",
- _mesa_lookup_enum_by_nr(internalFormat),
- __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-
-
-void intelDestroyTexObj(intelContextPtr intel, intelTextureObjectPtr t)
-{
- unsigned i;
-
- if ( intel == NULL )
- return;
-
- if ( t->age > intel->dirtyAge )
- intel->dirtyAge = t->age;
-
- for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) {
- if ( t == intel->CurrentTexObj[ i ] )
- intel->CurrentTexObj[ i ] = NULL;
- }
-}
-
-
-
-/* Upload an image from mesa's internal copy. Image may be 1D, 2D or
- * 3D. Cubemaps are expanded elsewhere.
- */
-static void intelUploadTexImage( intelContextPtr intel,
- intelTextureObjectPtr t,
- const struct gl_texture_image *image,
- const GLuint offset )
-{
-
- if (!image || !image->Data)
- return;
-
- if (image->Depth == 1 && image->IsClientData) {
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Blit uploading\n");
-
- /* Do it with a blit.
- */
- intelEmitCopyBlitLocked( intel,
- image->TexFormat->TexelBytes,
- image->RowStride, /* ? */
- intelGetMemoryOffsetMESA( NULL, 0, image->Data ),
- t->Pitch / image->TexFormat->TexelBytes,
- intelGetMemoryOffsetMESA( NULL, 0, t->BufAddr + offset ),
- 0, 0,
- 0, 0,
- image->Width,
- image->Height);
- }
- else if (image->IsCompressed) {
- GLuint row_len = image->Width * 2;
- GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
- GLubyte *src = (GLubyte *)image->Data;
- GLuint j;
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Upload image %dx%dx%d offset %xm row_len %x "
- "pitch %x depth_pitch %x\n",
- image->Width, image->Height, image->Depth, offset,
- row_len, t->Pitch, t->depth_pitch);
-
- switch(image->IntFormat)
- {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
- __memcpy(dst, src, row_len );
- src += row_len;
- }
- break;
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
- __memcpy(dst, src, (image->Width*4) );
- src += image->Width*4;
- }
- break;
- default:
- fprintf(stderr,"Internal Compressed format not supported %d\n", image->IntFormat);
- break;
- }
- }
- else {
- GLuint row_len = image->Width * image->TexFormat->TexelBytes;
- GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
- GLubyte *src = (GLubyte *)image->Data;
- GLuint d, j;
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Upload image %dx%dx%d offset %xm row_len %x "
- "pitch %x depth_pitch %x\n",
- image->Width, image->Height, image->Depth, offset,
- row_len, t->Pitch, t->depth_pitch);
-
- if (row_len == t->Pitch) {
- for (d = 0; d < image->Depth; d++) {
- memcpy( dst, src, t->Pitch * image->Height );
- dst += t->depth_pitch;
- src += row_len * image->Height;
- }
- }
- else {
- for (d = 0 ; d < image->Depth ; d++) {
- for (j = 0 ; j < image->Height ; j++) {
- __memcpy(dst, src, row_len );
- src += row_len;
- dst += t->Pitch;
- }
-
- dst += t->depth_pitch - (t->Pitch * image->Height);
- }
- }
- }
-}
-
-
-
-int intelUploadTexImages( intelContextPtr intel,
- intelTextureObjectPtr t,
- GLuint face)
-{
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- const struct gl_texture_image *firstImage = t->image[face][t->base.firstLevel].image;
- int pitch = firstImage->RowStride * firstImage->TexFormat->TexelBytes;
-
- /* Can we texture out of the existing client data? */
- if ( numLevels == 1 &&
- firstImage->IsClientData &&
- (pitch & 3) == 0) {
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "AGP texturing from client memory\n");
-
- t->TextureOffset = intelAgpOffsetFromVirtual( intel, firstImage->Data );
- t->BufAddr = 0;
- t->dirty = ~0;
- return GL_TRUE;
- }
- else {
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Uploading client data to agp\n");
-
- INTEL_FIREVERTICES( intel );
- LOCK_HARDWARE( intel );
-
- if ( t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( intel->texture_heaps, intel->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( intel );
- return GL_FALSE;
- }
-
- /* Set the base offset of the texture image */
- t->BufAddr = intel->intelScreen->tex.map + t->base.memBlock->ofs;
- t->TextureOffset = intel->intelScreen->textureOffset + t->base.memBlock->ofs;
- t->dirty = ~0;
- }
-
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
-
-
- /* Upload any images that are new */
- if (t->base.dirty_images[face]) {
- int i;
-
- intelWaitForIdle( intel );
-
- for (i = 0 ; i < numLevels ; i++) {
- int level = i + t->base.firstLevel;
-
- if (t->base.dirty_images[face] & (1<<level)) {
-
- const struct gl_texture_image *image = t->image[face][i].image;
- GLuint offset = t->image[face][i].offset;
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "upload level %d, offset %x\n",
- level, offset);
-
- intelUploadTexImage( intel, t, image, offset );
- }
- }
- t->base.dirty_images[face] = 0;
- intel->perf_boxes |= I830_BOX_TEXTURE_LOAD;
- }
-
- UNLOCK_HARDWARE( intel );
- return GL_TRUE;
- }
-}
-
-/**
- * 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 *
-intelNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj = _mesa_new_texture_object(ctx, name, target);
- INTEL_CONTEXT(ctx)->vtbl.alloc_tex_obj( obj );
- return obj;
-}
-
-
-void intelInitTextureFuncs( struct dd_function_table *functions )
-{
- functions->NewTextureObject = intelNewTextureObject;
- functions->ChooseTextureFormat = intelChooseTextureFormat;
- functions->TexImage1D = intelTexImage1D;
- functions->TexImage2D = intelTexImage2D;
- functions->TexImage3D = intelTexImage3D;
- functions->TexSubImage1D = intelTexSubImage1D;
- functions->TexSubImage2D = intelTexSubImage2D;
- functions->TexSubImage3D = intelTexSubImage3D;
- functions->CopyTexImage1D = _swrast_copy_teximage1d;
- functions->CopyTexImage2D = _swrast_copy_teximage2d;
- functions->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- functions->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- functions->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- functions->DeleteTexture = intelDeleteTexture;
- functions->UpdateTexturePalette = NULL;
- functions->IsTextureResident = driIsTextureResident;
- functions->TestProxyTexImage = _mesa_test_proxy_teximage;
- functions->DeleteTexture = intelDeleteTexture;
- functions->CompressedTexImage2D = intelCompressedTexImage2D;
- functions->CompressedTexSubImage2D = intelCompressedTexSubImage2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.h
deleted file mode 100644
index 0a1f697e9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef INTELTEX_INC
-#define INTELTEX_INC
-
-#include "mtypes.h"
-#include "intel_context.h"
-#include "texmem.h"
-
-
-void intelInitTextureFuncs( struct dd_function_table *functions );
-
-void intelDestroyTexObj( intelContextPtr intel, intelTextureObjectPtr t );
-int intelUploadTexImages( intelContextPtr intel, intelTextureObjectPtr t,
- GLuint face );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.c
deleted file mode 100644
index bb0a7713e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.c
+++ /dev/null
@@ -1,920 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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 "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-
-#include "intel_screen.h"
-#include "intel_tris.h"
-#include "intel_batchbuffer.h"
-#include "intel_reg.h"
-#include "intel_span.h"
-
-static void intelRenderPrimitive( GLcontext *ctx, GLenum prim );
-static void intelRasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#ifdef __i386__
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v) ); \
-} while (0)
-#else
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- if (0) fprintf(stderr, "\n"); \
- for ( j = 0 ; j < vertsize ; j++ ) { \
- if (0) fprintf(stderr, " -- v(%d): %x/%f\n",j, \
- ((GLuint *)v)[j], \
- ((GLfloat *)v)[j]); \
- vb[j] = ((GLuint *)v)[j]; \
- } \
- vb += vertsize; \
-} while (0)
-#endif
-
-static void __inline__ intel_draw_quad( intelContextPtr intel,
- intelVertexPtr v0,
- intelVertexPtr v1,
- intelVertexPtr v2,
- intelVertexPtr v3 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, 6 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v3 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
- COPY_DWORDS( j, vb, vertsize, v3 );
-}
-
-static void __inline__ intel_draw_triangle( intelContextPtr intel,
- intelVertexPtr v0,
- intelVertexPtr v1,
- intelVertexPtr v2 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, 3 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
-}
-
-
-static __inline__ void intel_draw_line( intelContextPtr intel,
- intelVertexPtr v0,
- intelVertexPtr v1 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, 2 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
-}
-
-
-static __inline__ void intel_draw_point( intelContextPtr intel,
- intelVertexPtr v0 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, vertsize );
- int j;
-
- /* Adjust for sub pixel position -- still required for conform. */
- *(float *)&vb[0] = v0->v.x - 0.125;
- *(float *)&vb[1] = v0->v.y - 0.125;
- for (j = 2 ; j < vertsize ; j++)
- vb[j] = v0->ui[j];
-}
-
-
-
-/***********************************************************************
- * Fixup for ARB_point_parameters *
- ***********************************************************************/
-
-static void intel_atten_point( intelContextPtr intel, intelVertexPtr v0 )
-{
- GLcontext *ctx = &intel->ctx;
- GLfloat psz[4], col[4], restore_psz, restore_alpha;
-
- _tnl_get_attr( ctx, v0, _TNL_ATTRIB_POINTSIZE, psz );
- _tnl_get_attr( ctx, v0, _TNL_ATTRIB_COLOR0, col );
-
- restore_psz = psz[0];
- restore_alpha = col[3];
-
- if (psz[0] >= ctx->Point.Threshold) {
- psz[0] = MIN2(psz[0], ctx->Point.MaxSize);
- }
- else {
- GLfloat dsize = psz[0] / ctx->Point.Threshold;
- psz[0] = MAX2(ctx->Point.Threshold, ctx->Point.MinSize);
- col[3] *= dsize * dsize;
- }
-
- if (psz[0] < 1.0)
- psz[0] = 1.0;
-
- if (restore_psz != psz[0] || restore_alpha != col[3]) {
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_COLOR0, col);
-
- intel_draw_point( intel, v0 );
-
- psz[0] = restore_psz;
- col[3] = restore_alpha;
-
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_COLOR0, col);
- }
- else
- intel_draw_point( intel, v0 );
-}
-
-
-
-
-
-/***********************************************************************
- * Fixup for I915 WPOS texture coordinate *
- ***********************************************************************/
-
-
-
-static void intel_wpos_triangle( intelContextPtr intel,
- intelVertexPtr v0,
- intelVertexPtr v1,
- intelVertexPtr v2 )
-{
- GLuint offset = intel->wpos_offset;
- GLuint size = intel->wpos_size;
-
- __memcpy( ((char *)v0) + offset, v0, size );
- __memcpy( ((char *)v1) + offset, v1, size );
- __memcpy( ((char *)v2) + offset, v2, size );
-
- intel_draw_triangle( intel, v0, v1, v2 );
-}
-
-
-static void intel_wpos_line( intelContextPtr intel,
- intelVertexPtr v0,
- intelVertexPtr v1 )
-{
- GLuint offset = intel->wpos_offset;
- GLuint size = intel->wpos_size;
-
- __memcpy( ((char *)v0) + offset, v0, size );
- __memcpy( ((char *)v1) + offset, v1, size );
-
- intel_draw_line( intel, v0, v1 );
-}
-
-
-static void intel_wpos_point( intelContextPtr intel,
- intelVertexPtr v0 )
-{
- GLuint offset = intel->wpos_offset;
- GLuint size = intel->wpos_size;
-
- __memcpy( ((char *)v0) + offset, v0, size );
-
- intel_draw_point( intel, v0 );
-}
-
-
-
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- intel->draw_tri( intel, a, b, c ); \
- else \
- intel_draw_triangle( intel, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- intel->draw_tri( intel, a, b, d ); \
- intel->draw_tri( intel, b, c, d ); \
- } else \
- intel_draw_quad( intel, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- intel->draw_line( intel, v0, v1 ); \
- else \
- intel_draw_line( intel, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- intel->draw_point( intel, v0 ); \
- else \
- intel_draw_point( intel, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define INTEL_OFFSET_BIT 0x01
-#define INTEL_TWOSIDE_BIT 0x02
-#define INTEL_UNFILLED_BIT 0x04
-#define INTEL_FALLBACK_BIT 0x08
-#define INTEL_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[INTEL_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & INTEL_FALLBACK_BIT)
-#define DO_OFFSET (IND & INTEL_OFFSET_BIT)
-#define DO_UNFILLED (IND & INTEL_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & INTEL_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX intelVertex
-#define TAB rast_tab
-
-/* Only used to pull back colors into vertices (ie, we know color is
- * floating point).
- */
-#define INTEL_COLOR( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[0], (src)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[1], (src)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[2], (src)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[3], (src)[3]); \
-} while (0)
-
-#define INTEL_SPEC( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[0], (src)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[1], (src)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[2], (src)[0]); \
-} while (0)
-
-
-#define DEPTH_SCALE intel->polygon_offset_scale
-#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) (intel->verts + (e * intel->vertex_size * sizeof(GLuint)))
-
-#define VERT_SET_RGBA( v, c ) if (coloroffset) INTEL_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) if (coloroffset) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) if (coloroffset) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) if (coloroffset) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (specoffset) INTEL_SPEC( v->ub4[specoffset], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (specoffset) COPY_3V(v0->ub4[specoffset], v1->ub4[specoffset])
-#define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
-
-#define LOCAL_VARS(n) \
- intelContextPtr intel = INTEL_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = intel->coloroffset; \
- GLboolean specoffset = intel->specoffset; \
- (void) color; (void) spec; (void) coloroffset; (void) specoffset;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PRIM3D_POINTLIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST
-};
-
-#define RASTERIZE(x) intelRasterPrimitive( ctx, x, hw_prim[x] )
-#define RENDER_PRIMITIVE intel->render_primitive
-#define TAG(x) x
-#define IND INTEL_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 (INTEL_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_OFFSET_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT| \
- INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-/***********************************************************************
- * 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
-intel_fallback_tri( intelContextPtr intel,
- intelVertex *v0,
- intelVertex *v1,
- intelVertex *v2 )
-{
- GLcontext *ctx = &intel->ctx;
- SWvertex v[3];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swsetup_Translate( ctx, v2, &v[2] );
- intelSpanRenderStart( ctx );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
- intelSpanRenderFinish( ctx );
-}
-
-
-static void
-intel_fallback_line( intelContextPtr intel,
- intelVertex *v0,
- intelVertex *v1 )
-{
- GLcontext *ctx = &intel->ctx;
- SWvertex v[2];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- intelSpanRenderStart( ctx );
- _swrast_Line( ctx, &v[0], &v[1] );
- intelSpanRenderFinish( ctx );
-}
-
-
-static void
-intel_fallback_point( intelContextPtr intel,
- intelVertex *v0 )
-{
- GLcontext *ctx = &intel->ctx;
- SWvertex v[1];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- intelSpanRenderStart( ctx );
- _swrast_Point( ctx, &v[0] );
- intelSpanRenderFinish( ctx );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define IND 0
-#define V(x) (intelVertex *)(vertptr + ((x)*vertsize*sizeof(GLuint)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) POINT( V(ELT(start)) );
-#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
-#define RENDER_TRI( v0, v1, v2 ) TRI( V(v0), V(v1), V(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) QUAD( V(v0), V(v1), V(v2), V(v3) )
-#define INIT(x) intelRenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- intelContextPtr intel = INTEL_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)intel->verts; \
- const GLuint vertsize = intel->vertex_size; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) intel_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) intel_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void intelRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = intel->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 intelRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void intelFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- const GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, (n-2) * 3 * vertsize );
- GLubyte *vertptr = (GLubyte *)intel->verts;
- const GLuint *start = (const GLuint *)V(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, V(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, V(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-
-#define POINT_FALLBACK (0)
-#define LINE_FALLBACK (DD_LINE_STIPPLE)
-#define TRI_FALLBACK (0)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|\
- DD_TRI_STIPPLE|DD_POINT_ATTEN)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-void intelChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- struct fragment_program *program = ctx->FragmentProgram._Current;
- GLboolean have_wpos = (program && (program->InputsRead & FRAG_BIT_WPOS));
- GLuint index = 0;
-
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr,"\n%s\n",__FUNCTION__);
-
- if ((flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) || have_wpos) {
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= INTEL_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= INTEL_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= INTEL_UNFILLED_BIT;
- }
-
- if (have_wpos) {
- intel->draw_point = intel_wpos_point;
- intel->draw_line = intel_wpos_line;
- intel->draw_tri = intel_wpos_triangle;
-
- /* Make sure these get called:
- */
- index |= INTEL_FALLBACK_BIT;
- }
- else {
- intel->draw_point = intel_draw_point;
- intel->draw_line = intel_draw_line;
- intel->draw_tri = intel_draw_triangle;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & POINT_FALLBACK)
- intel->draw_point = intel_fallback_point;
-
- if (flags & LINE_FALLBACK)
- intel->draw_line = intel_fallback_line;
-
- if (flags & TRI_FALLBACK)
- intel->draw_tri = intel_fallback_tri;
-
- if ((flags & DD_TRI_STIPPLE) && !intel->hw_stipple)
- intel->draw_tri = intel_fallback_tri;
-
- if (flags & DD_POINT_ATTEN)
- intel->draw_point = intel_atten_point;
-
- index |= INTEL_FALLBACK_BIT;
- }
- }
-
- if (intel->RenderIndex != index) {
- intel->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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = intel_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = intel_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = intelFastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = intelRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = intelRenderClippedPoly;
- }
- }
-}
-
-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
-};
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-
-static void intelRunPipeline( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- if (intel->NewGLState) {
- if (intel->NewGLState & _NEW_TEXTURE) {
- intel->vtbl.update_texture_state( intel );
- }
-
- if (!intel->Fallback) {
- if (intel->NewGLState & _INTEL_NEW_RENDERSTATE)
- intelChooseRenderState( ctx );
- }
-
- intel->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void intelRenderStart( GLcontext *ctx )
-{
- INTEL_CONTEXT(ctx)->vtbl.render_start( INTEL_CONTEXT(ctx) );
-}
-
-static void intelRenderFinish( GLcontext *ctx )
-{
- if (INTEL_CONTEXT(ctx)->RenderIndex & INTEL_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-
- /* System to flush dma and emit state changes based on the rasterized
- * primitive.
- */
-static void intelRasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- if (0)
- fprintf(stderr, "%s %s %x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(rprim), hwprim);
-
- intel->vtbl.reduced_primitive_state( intel, rprim );
-
- /* Start a new primitive. Arrange to have it flushed later on.
- */
- if (hwprim != intel->prim.primitive)
- intelStartInlinePrimitive( intel, hwprim );
-}
-
-
- /*
- */
- static void intelRenderPrimitive( GLcontext *ctx, GLenum prim )
- {
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- if (0)
- fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(prim));
-
- /* Let some clipping routines know which primitive they're dealing
- * with.
- */
- intel->render_primitive = prim;
-
- /* Shortcircuit this when called from t_dd_rendertmp.h for unfilled
- * triangles. The rasterized primitive will always be reset by
- * lower level functions in that case, potentially pingponging the
- * state:
- */
- if (reduced_prim[prim] == GL_TRIANGLES &&
- (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- /* Set some primitive-dependent state and Start? a new primitive.
- */
- intelRasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] );
- }
-
-
- /**********************************************************************/
- /* Transition to/from hardware rasterization. */
- /**********************************************************************/
-
- static char *fallbackStrings[] = {
- "Texture",
- "Draw buffer",
- "Read buffer",
- "Color mask",
- "Render mode",
- "Stencil",
- "Stipple",
- "User disable"
- };
-
-
- static char *getFallbackString(GLuint bit)
- {
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
- }
-
-
-
- void intelFallback( intelContextPtr intel, GLuint bit, GLboolean mode )
- {
- GLcontext *ctx = &intel->ctx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = intel->Fallback;
-
- if (mode) {
- intel->Fallback |= bit;
- if (oldfallback == 0) {
- intelFlush(ctx);
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "ENTER FALLBACK %x: %s\n",
- bit, getFallbackString( bit ));
- _swsetup_Wakeup( ctx );
- intel->RenderIndex = ~0;
- }
- }
- else {
- intel->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "LEAVE FALLBACK %s\n", getFallbackString( bit ));
- tnl->Driver.Render.Start = intelRenderStart;
- tnl->Driver.Render.PrimitiveNotify = intelRenderPrimitive;
- tnl->Driver.Render.Finish = intelRenderFinish;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_invalidate_vertex_state( ctx, ~0 );
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_install_attrs( ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->NewGLState |= _INTEL_NEW_RENDERSTATE;
- }
- }
- }
-
-
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void intelInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = intelRunPipeline;
- tnl->Driver.Render.Start = intelRenderStart;
- tnl->Driver.Render.Finish = intelRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = intelRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.h
deleted file mode 100644
index d7e382fdb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/intel_tris.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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, 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 TUNGSTEN 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.
- *
- **************************************************************************/
-
-#ifndef INTELTRIS_INC
-#define INTELTRIS_INC
-
-#include "mtypes.h"
-
-#define _INTEL_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_PROGRAM | \
- _NEW_POLYGONSTIPPLE)
-
-extern void intelInitTriFuncs( GLcontext *ctx );
-
-extern void intelPrintRenderState( const char *msg, GLuint state );
-extern void intelChooseRenderState( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_common.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_common.h
deleted file mode 100644
index c03f74289..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_common.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-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
-on 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
-ATI, 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */
-
-#ifndef _I830_COMMON_H_
-#define _I830_COMMON_H_
-
-
-#define I830_NR_TEX_REGIONS 255 /* maximum due to use of chars for next/prev */
-#define I830_LOG_MIN_TEX_REGION_SIZE 14
-
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_I830_INIT 0x00
-#define DRM_I830_FLUSH 0x01
-#define DRM_I830_FLIP 0x02
-#define DRM_I830_BATCHBUFFER 0x03
-#define DRM_I830_IRQ_EMIT 0x04
-#define DRM_I830_IRQ_WAIT 0x05
-#define DRM_I830_GETPARAM 0x06
-#define DRM_I830_SETPARAM 0x07
-#define DRM_I830_ALLOC 0x08
-#define DRM_I830_FREE 0x09
-#define DRM_I830_INIT_HEAP 0x0a
-#define DRM_I830_CMDBUFFER 0x0b
-
-typedef struct {
- enum {
- I830_INIT_DMA = 0x01,
- I830_CLEANUP_DMA = 0x02,
- I830_RESUME_DMA = 0x03
- } func;
- unsigned int mmio_offset;
- int sarea_priv_offset;
- unsigned int ring_start;
- unsigned int ring_end;
- unsigned int ring_size;
- unsigned int front_offset;
- unsigned int back_offset;
- unsigned int depth_offset;
- unsigned int w;
- unsigned int h;
- unsigned int pitch;
- unsigned int pitch_bits;
- unsigned int back_pitch;
- unsigned int depth_pitch;
- unsigned int cpp;
- unsigned int chipset;
-} drmI830Init;
-
-typedef struct {
- drmTextureRegion texList[I830_NR_TEX_REGIONS+1];
- int last_upload; /* 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 ctxOwner; /* last context to upload state */
- int texAge;
- int pf_enabled; /* is pageflipping allowed? */
- int pf_active;
- int pf_current_page; /* which buffer is being displayed? */
- int perf_boxes; /* performance boxes to be displayed */
-} drmI830Sarea;
-
-/* Flags for perf_boxes
- */
-#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
-#define I830_BOX_FLIP 0x2 /* populated by kernel */
-#define I830_BOX_WAIT 0x4 /* populated by kernel & client */
-#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
-#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
-
-
-typedef struct {
- int start; /* agp offset */
- int used; /* nr bytes in use */
- int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
- int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
- int num_cliprects; /* mulitpass with multiple cliprects? */
- drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
-} drmI830BatchBuffer;
-
-typedef struct {
- char *buf; /* agp offset */
- int sz; /* nr bytes in use */
- int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
- int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
- int num_cliprects; /* mulitpass with multiple cliprects? */
- drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
-} drmI830CmdBuffer;
-
-
-typedef struct {
- int *irq_seq;
-} drmI830IrqEmit;
-
-typedef struct {
- int irq_seq;
-} drmI830IrqWait;
-
-typedef struct {
- int param;
- int *value;
-} drmI830GetParam;
-
-#define I830_PARAM_IRQ_ACTIVE 1
-#define I830_PARAM_ALLOW_BATCHBUFFER 2
-
-typedef struct {
- int param;
- int value;
-} drmI830SetParam;
-
-#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
-#define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
-#define I830_SETPARAM_ALLOW_BATCHBUFFER 3
-
-
-/* A memory manager for regions of shared memory:
- */
-#define I830_MEM_REGION_AGP 1
-
-typedef struct {
- int region;
- int alignment;
- int size;
- int *region_offset; /* offset from start of fb or agp */
-} drmI830MemAlloc;
-
-typedef struct {
- int region;
- int region_offset;
-} drmI830MemFree;
-
-typedef struct {
- int region;
- int size;
- int start;
-} drmI830MemInitHeap;
-
-
-#endif /* _I830_DRM_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_dri.h
deleted file mode 100644
index 978f47a2b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/i915/server/i830_dri.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.4 2002/10/30 12:52:18 alanh Exp $ */
-
-#ifndef _I830_DRI_H
-#define _I830_DRI_H
-
-#include "xf86drm.h"
-#include "i830_common.h"
-
-#define I830_MAX_DRAWABLES 256
-
-#define I830_MAJOR_VERSION 1
-#define I830_MINOR_VERSION 3
-#define I830_PATCHLEVEL 0
-
-#define I830_REG_SIZE 0x80000
-
-/* Note: This structure has changed slightly from what is expected by
- * the i830_drv.o driver. Maybe that should be reverted.
- */
-typedef struct _I830DRIRec {
- drm_handle_t regs;
- drmSize regsSize;
-
- drmSize backbufferSize;
- drm_handle_t backbuffer;
-
- drmSize depthbufferSize;
- drm_handle_t depthbuffer;
-
- drm_handle_t textures;
- int textureSize;
-
- drm_handle_t agp_buffers;
- drmSize agp_buf_size;
-
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int bitsPerPixel;
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int backPitch;
-
- int depthOffset;
- int depthPitch;
-
- int logTextureGranularity;
- int textureOffset;
-
- int irq;
- int sarea_priv_offset;
-} I830DRIRec, *I830DRIPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I830ConfigPrivRec, *I830ConfigPrivPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I830DRIContextRec, *I830DRIContextPtr;
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/Makefile
deleted file mode 100644
index 7246d51f5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-# src/mesa/drivers/dri/mach64/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = mach64_dri.so
-
-# Not yet
-# MINIGLX_SOURCES = server/mach64_dri.c
-
-DRIVER_SOURCES = \
- mach64_context.c \
- mach64_ioctl.c \
- mach64_screen.c \
- mach64_span.c \
- mach64_state.c \
- mach64_tex.c \
- mach64_texmem.c \
- mach64_texstate.c \
- mach64_tris.c \
- mach64_vb.c \
- mach64_dd.c \
- mach64_lock.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.c
deleted file mode 100644
index 717b9b9e8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "mach64_context.h"
-#include "mach64_ioctl.h"
-#include "mach64_dd.h"
-#include "mach64_span.h"
-#include "mach64_state.h"
-#include "mach64_tex.h"
-#include "mach64_tris.h"
-#include "mach64_vb.h"
-
-#include "utils.h"
-#include "vblank.h"
-
-#define need_GL_ARB_multisample
-#include "extension_helper.h"
-
-#ifndef MACH64_DEBUG
-int MACH64_DEBUG = (0);
-#endif
-
-static const struct dri_debug_control debug_control[] =
-{
- { "sync", DEBUG_ALWAYS_SYNC },
- { "api", DEBUG_VERBOSE_API },
- { "msg", DEBUG_VERBOSE_MSG },
- { "lru", DEBUG_VERBOSE_LRU },
- { "dri", DEBUG_VERBOSE_DRI },
- { "ioctl", DEBUG_VERBOSE_IOCTL },
- { "prims", DEBUG_VERBOSE_PRIMS },
- { "count", DEBUG_VERBOSE_COUNT },
- { "nowait", DEBUG_NOWAIT },
- { "fall", DEBUG_VERBOSE_FALLBACK },
- { NULL, 0 }
-};
-
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-
-/* Create the device specific context.
- */
-GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *driScreen = driContextPriv->driScreenPriv;
- struct dd_function_table functions;
- mach64ContextPtr mmesa;
- mach64ScreenPtr mach64Screen;
- int i, heap;
-
-#if DO_DEBUG
- MACH64_DEBUG = driParseDebugString(getenv("MACH64_DEBUG"), debug_control);
-#endif
-
- /* Allocate the mach64 context */
- mmesa = (mach64ContextPtr) CALLOC( sizeof(*mmesa) );
- if ( !mmesa )
- return GL_FALSE;
-
- /* Init default driver functions then plug in our Mach64-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions( &functions );
- mach64InitDriverFuncs( &functions );
- mach64InitIoctlFuncs( &functions );
- mach64InitTextureFuncs( &functions );
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((mach64ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- mmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
- &functions, (void *)mmesa);
- if (!mmesa->glCtx) {
- FREE(mmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = mmesa;
- ctx = mmesa->glCtx;
-
- mmesa->driContext = driContextPriv;
- mmesa->driScreen = driScreen;
- mmesa->driDrawable = NULL;
- mmesa->hHWContext = driContextPriv->hHWContext;
- mmesa->driHwLock = &driScreen->pSAREA->lock;
- mmesa->driFd = driScreen->fd;
-
- mach64Screen = mmesa->mach64Screen = (mach64ScreenPtr)driScreen->private;
-
- /* Parse configuration files */
- driParseConfigFiles (&mmesa->optionCache, &mach64Screen->optionCache,
- mach64Screen->driScreen->myNum, "mach64");
-
- mmesa->sarea = (drm_mach64_sarea_t *)((char *)driScreen->pSAREA +
- sizeof(drm_sarea_t));
-
- mmesa->CurrentTexObj[0] = NULL;
- mmesa->CurrentTexObj[1] = NULL;
-
- make_empty_list( &mmesa->SwappedOut );
-
- mmesa->firstTexHeap = mach64Screen->firstTexHeap;
- mmesa->lastTexHeap = mach64Screen->firstTexHeap + mach64Screen->numTexHeaps;
-
- for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) {
- make_empty_list( &mmesa->TexObjList[i] );
- mmesa->texHeap[i] = mmInit( 0, mach64Screen->texSize[i] );
- mmesa->lastTexAge[i] = -1;
- }
-
- mmesa->RenderIndex = -1; /* Impossible value */
- mmesa->vert_buf = NULL;
- mmesa->num_verts = 0;
- mmesa->new_state = MACH64_NEW_ALL;
- mmesa->dirty = MACH64_UPLOAD_ALL;
-
- /* Set the maximum texture size small enough that we can
- * guarentee that both texture units can bind a maximal texture
- * and have them both in memory (on-card or AGP) at once.
- * Test for 2 textures * bytes/texel * size * size. There's no
- * need to account for mipmaps since we only upload one level.
- */
- heap = mach64Screen->IsPCI ? MACH64_CARD_HEAP : MACH64_AGP_HEAP;
-
- if ( mach64Screen->texSize[heap] >= 2 * mach64Screen->cpp * 1024*1024 ) {
- ctx->Const.MaxTextureLevels = 11; /* 1024x1024 */
- } else if ( mach64Screen->texSize[heap] >= 2 * mach64Screen->cpp * 512*512 ) {
- ctx->Const.MaxTextureLevels = 10; /* 512x512 */
- } else {
- ctx->Const.MaxTextureLevels = 9; /* 256x256 */
- }
-
- ctx->Const.MaxTextureUnits = 2;
-
-#if ENABLE_PERF_BOXES
- mmesa->boxes = ( getenv( "LIBGL_PERFORMANCE_BOXES" ) != NULL );
-#endif
-
- /* Allocate the vertex buffer
- */
- mmesa->vert_buf = ALIGN_MALLOC(MACH64_BUFFER_SIZE, 32);
- if ( !mmesa->vert_buf )
- return GL_FALSE;
- mmesa->vert_used = 0;
- mmesa->vert_total = MACH64_BUFFER_SIZE;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
-/* _tnl_destroy_pipeline( ctx ); */
-/* _tnl_install_pipeline( ctx, mach64_pipeline ); */
-
- /* Configure swrast and T&L 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 );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
-
- mach64InitVB( ctx );
- mach64InitTriFuncs( ctx );
- mach64DDInitStateFuncs( ctx );
- mach64DDInitSpanFuncs( ctx );
- mach64DDInitState( mmesa );
-
- mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS"));
-
- mmesa->vblank_flags = (mmesa->do_irqs)
- ? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- driContextPriv->driverPrivate = (void *)mmesa;
-
- if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(mmesa, MACH64_FALLBACK_DISABLE, 1);
- }
-
- return GL_TRUE;
-}
-
-/* Destroy the device specific context.
- */
-void mach64DestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- mach64ContextPtr mmesa = (mach64ContextPtr) driContextPriv->driverPrivate;
-
- assert(mmesa); /* should never be null */
- if ( mmesa ) {
- if (mmesa->glCtx->Shared->RefCount == 1) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- mach64TexObjPtr t, next_t;
- int i;
-
- for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) {
- foreach_s ( t, next_t, &mmesa->TexObjList[i] ) {
- mach64DestroyTexObj( mmesa, t );
- }
- mmDestroy( mmesa->texHeap[i] );
- mmesa->texHeap[i] = NULL;
- }
-
- foreach_s ( t, next_t, &mmesa->SwappedOut ) {
- mach64DestroyTexObj( mmesa, t );
- }
- }
-
- _swsetup_DestroyContext( mmesa->glCtx );
- _tnl_DestroyContext( mmesa->glCtx );
- _ac_DestroyContext( mmesa->glCtx );
- _swrast_DestroyContext( mmesa->glCtx );
-
- mach64FreeVB( mmesa->glCtx );
-
- /* Free the vertex buffer */
- if ( mmesa->vert_buf )
- ALIGN_FREE( mmesa->vert_buf );
-
- /* free the Mesa context */
- mmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(mmesa->glCtx);
-
- FREE( mmesa );
- }
-}
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean
-mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- GET_CURRENT_CONTEXT(ctx);
- mach64ContextPtr oldMach64Ctx = ctx ? MACH64_CONTEXT(ctx) : NULL;
- mach64ContextPtr newMach64Ctx = (mach64ContextPtr) driContextPriv->driverPrivate;
-
- if ( newMach64Ctx != oldMach64Ctx ) {
- newMach64Ctx->new_state |= MACH64_NEW_CONTEXT;
- newMach64Ctx->dirty = MACH64_UPLOAD_ALL;
- }
-
-
- driDrawableInitVBlank( driDrawPriv, newMach64Ctx->vblank_flags );
-
- if ( newMach64Ctx->driDrawable != driDrawPriv ) {
- newMach64Ctx->driDrawable = driDrawPriv;
- mach64CalcViewport( newMach64Ctx->glCtx );
- }
-
- _mesa_make_current( newMach64Ctx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
-
- newMach64Ctx->new_state |= MACH64_NEW_CLIP;
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return GL_TRUE;
-}
-
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-mach64UnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.h
deleted file mode 100644
index c541f77ab..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_context.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#ifndef __MACH64_CONTEXT_H__
-#define __MACH64_CONTEXT_H__
-
-#include "dri_util.h"
-#include "drm.h"
-#include "mach64_drm.h"
-
-#include "mtypes.h"
-
-#include "mach64_reg.h"
-
-#include "texmem.h"
-
-struct mach64_context;
-typedef struct mach64_context mach64ContextRec;
-typedef struct mach64_context *mach64ContextPtr;
-
-#include "mach64_lock.h"
-#include "mach64_screen.h"
-
-/* Experimental driver options */
-#define MACH64_CLIENT_STATE_EMITS 0
-
-/* Performace monitoring */
-#define ENABLE_PERF_BOXES 1
-
-/* Native vertex format */
-#define MACH64_NATIVE_VTXFMT 1
-
-/* Flags for what context state needs to be updated:
- */
-#define MACH64_NEW_ALPHA 0x0001
-#define MACH64_NEW_DEPTH 0x0002
-#define MACH64_NEW_FOG 0x0004
-#define MACH64_NEW_CLIP 0x0008
-#define MACH64_NEW_CULL 0x0010
-#define MACH64_NEW_MASKS 0x0020
-#define MACH64_NEW_RENDER_UNUSED 0x0040
-#define MACH64_NEW_WINDOW 0x0080
-#define MACH64_NEW_TEXTURE 0x0100
-#define MACH64_NEW_CONTEXT 0x0200
-#define MACH64_NEW_ALL 0x03ff
-
-/* Flags for software fallback cases:
- */
-#define MACH64_FALLBACK_TEXTURE 0x0001
-#define MACH64_FALLBACK_DRAW_BUFFER 0x0002
-#define MACH64_FALLBACK_READ_BUFFER 0x0004
-#define MACH64_FALLBACK_STENCIL 0x0008
-#define MACH64_FALLBACK_RENDER_MODE 0x0010
-#define MACH64_FALLBACK_LOGICOP 0x0020
-#define MACH64_FALLBACK_SEP_SPECULAR 0x0040
-#define MACH64_FALLBACK_BLEND_EQ 0x0080
-#define MACH64_FALLBACK_BLEND_FUNC 0x0100
-#define MACH64_FALLBACK_DISABLE 0x0200
-
-#define CARD32 GLuint /* KW: For building in mesa tree */
-
-#if MACH64_NATIVE_VTXFMT
-
-/* The vertex structures.
- */
-
-/* The size of this union is not of relevence:
- */
-union mach64_vertex_t {
- GLfloat f[16];
- GLuint ui[16];
- GLushort us2[16][2];
- GLubyte ub4[16][4];
-};
-
-typedef union mach64_vertex_t mach64Vertex, *mach64VertexPtr;
-
-#else
-
-/* Use the templated vertex format:
- */
-#define TAG(x) mach64##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-#endif /* MACH64_NATIVE_VTXFMT */
-
-/* Subpixel offsets for window coordinates:
- * These are enough to fix most glean tests except polygonOffset.
- * There are also still some gaps that show in e.g. the tunnel Mesa demo
- * or the lament xscreensaver hack.
- */
-#define SUBPIXEL_X (0.0125F)
-#define SUBPIXEL_Y (0.15F)
-
-
-typedef void (*mach64_tri_func)( mach64ContextPtr,
- mach64Vertex *,
- mach64Vertex *,
- mach64Vertex * );
-
-typedef void (*mach64_line_func)( mach64ContextPtr,
- mach64Vertex *,
- mach64Vertex * );
-
-typedef void (*mach64_point_func)( mach64ContextPtr,
- mach64Vertex * );
-
-#ifdef TEXMEM
-struct mach64_texture_object {
- driTextureObject base;
-
- GLuint offset;
-
- GLuint dirty;
- GLuint age;
-
- GLint widthLog2;
- GLint heightLog2;
- GLint maxLog2;
-
- GLint hasAlpha;
- GLint textureFormat;
-
- /* Have to keep these separate due to how they are programmed.
- * FIXME: Why don't we just use the tObj values?
- */
- GLboolean BilinearMin;
- GLboolean BilinearMag;
- GLboolean ClampS;
- GLboolean ClampT;
-};
-#else
-struct mach64_texture_object {
- struct mach64_texture_object *next;
- struct mach64_texture_object *prev;
- struct gl_texture_object *tObj;
-
- PMemBlock memBlock;
- GLuint offset;
- GLuint size;
-
- GLuint dirty;
- GLuint age;
-
- GLint bound;
- GLint heap;
-
- GLint widthLog2;
- GLint heightLog2;
- GLint maxLog2;
-
- GLint hasAlpha;
- GLint textureFormat;
-
- /* Have to keep these separate due to how they are programmed.
- * FIXME: Why don't we just use the tObj values?
- */
- GLboolean BilinearMin;
- GLboolean BilinearMag;
- GLboolean ClampS;
- GLboolean ClampT;
-};
-#endif
-
-typedef struct mach64_texture_object mach64TexObj, *mach64TexObjPtr;
-
-
-struct mach64_context {
- GLcontext *glCtx;
-
- /* Driver and hardware state management
- */
- GLuint new_state;
- GLuint dirty; /* Hardware state to be updated */
- drm_mach64_context_regs_t setup;
-
- GLuint NewGLState;
- GLuint Fallback;
- GLuint SetupIndex;
- GLuint SetupNewInputs;
- GLuint RenderIndex;
- GLfloat hw_viewport[16];
- GLfloat depth_scale;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
- GLuint num_verts;
- GLubyte *verts;
-
- CARD32 Color; /* Current draw color */
- CARD32 ClearColor; /* Color used to clear color buffer */
- CARD32 ClearDepth; /* Value used to clear depth buffer */
-
- /* Map GL texture units onto hardware
- */
- GLint multitex;
- GLint tmu_source[2];
- GLint tex_dest[2];
-
- /* Texture object bookkeeping
- */
- mach64TexObjPtr CurrentTexObj[2];
-#ifdef TEXMEM
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ R128_NR_TEX_HEAPS ];
- driTextureObject swapped;
-#else
- mach64TexObj TexObjList[MACH64_NR_TEX_HEAPS];
- mach64TexObj SwappedOut;
- memHeap_t *texHeap[MACH64_NR_TEX_HEAPS];
- GLuint lastTexAge[MACH64_NR_TEX_HEAPS];
- GLint firstTexHeap, lastTexHeap;
-#endif
-
- /* Fallback rasterization functions
- */
- mach64_point_func draw_point;
- mach64_line_func draw_line;
- mach64_tri_func draw_tri;
-
- /* Culling */
- GLfloat backface_sign;
-
- /* DMA buffers
- */
- void *vert_buf;
- size_t vert_total;
- unsigned vert_used;
-
- GLuint hw_primitive;
- GLenum render_primitive;
-
- /* Visual, drawable, cliprect and scissor information
- */
- GLint drawOffset, drawPitch;
- GLint drawX, drawY; /* origin of drawable in draw buffer */
- GLint readOffset, readPitch;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
-
- GLint scissor;
- drm_clip_rect_t ScissorRect; /* Current software scissor */
-
- /* Mirrors of some DRI state
- */
- __DRIcontextPrivate *driContext; /* DRI context */
- __DRIscreenPrivate *driScreen; /* DRI screen */
- __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
-
- unsigned int lastStamp; /* mirror driDrawable->lastStamp */
-
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
-
- mach64ScreenPtr mach64Screen; /* Screen private DRI data */
- drm_mach64_sarea_t *sarea; /* Private SAREA data */
-
- GLuint hardwareWentIdle;
-
-#if ENABLE_PERF_BOXES
- /* Performance counters
- */
- GLuint boxes; /* Draw performance boxes */
- GLuint c_clears;
- GLuint c_drawWaits;
- GLuint c_textureSwaps;
- GLuint c_textureBytes;
- GLuint c_agpTextureBytes;
- GLuint c_texsrc_agp;
- GLuint c_texsrc_card;
- GLuint c_vertexBuffers;
-#endif
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
- GLuint do_irqs;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define MACH64_CONTEXT(ctx) ((mach64ContextPtr)(ctx->DriverCtx))
-
-
-extern GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void mach64DestroyContext( __DRIcontextPrivate * );
-
-extern GLboolean mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-
-extern GLboolean mach64UnbindContext( __DRIcontextPrivate *driContextPriv );
-
-/* ================================================================
- * Byte ordering
- */
-#if MESA_LITTLE_ENDIAN == 1
-#define LE32_IN( x ) ( *(GLuint *)(x) )
-#define LE32_IN_FLOAT( x ) ( *(GLfloat *)(x) )
-#define LE32_OUT( x, y ) do { *(GLuint *)(x) = (y); } while (0)
-#define LE32_OUT_FLOAT( x, y ) do { *(GLfloat *)(x) = (y); } while (0)
-#else
-#include <byteswap.h>
-#define LE32_IN( x ) bswap_32( *(GLuint *)(x) )
-#define LE32_IN_FLOAT( x ) \
-({ \
- GLuint __tmp = bswap_32( *(GLuint *)(x) ); \
- *(GLfloat *)&__tmp; \
-})
-#define LE32_OUT( x, y ) do { *(GLuint *)(x) = bswap_32( y ); } while (0)
-#define LE32_OUT_FLOAT( x, y ) \
-do { \
- GLuint __tmp; \
- *(GLfloat *)&__tmp = (y); \
- *(GLuint *)(x) = bswap_32( __tmp ); \
-} while (0)
-#endif
-
-/* ================================================================
- * DMA buffers
- */
-
-#define DMALOCALS CARD32 *buf=NULL; int requested=0; int outcount=0
-
-/* called while locked for interleaved client-side state emits */
-#define DMAGETPTR( dwords ) \
-do { \
- requested = (dwords); \
- buf = (CARD32 *)mach64AllocDmaLocked( mmesa, ((dwords)*4) ); \
- outcount = 0; \
-} while(0)
-
-#define DMAOUTREG( reg, val ) \
-do { \
- LE32_OUT( &buf[outcount++], ADRINDEX( reg ) ); \
- LE32_OUT( &buf[outcount++], ( val ) ); \
-} while(0)
-
-#define DMAADVANCE() \
-do { \
- if (outcount < requested) { \
- mmesa->vert_used -= (requested - outcount) * 4; \
- } \
-} while(0)
-
-/* ================================================================
- * Debugging:
- */
-
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int MACH64_DEBUG;
-#else
-#define MACH64_DEBUG 0
-#endif
-
-#define DEBUG_ALWAYS_SYNC 0x001
-#define DEBUG_VERBOSE_API 0x002
-#define DEBUG_VERBOSE_MSG 0x004
-#define DEBUG_VERBOSE_LRU 0x008
-#define DEBUG_VERBOSE_DRI 0x010
-#define DEBUG_VERBOSE_IOCTL 0x020
-#define DEBUG_VERBOSE_PRIMS 0x040
-#define DEBUG_VERBOSE_COUNT 0x080
-#define DEBUG_NOWAIT 0x100
-#define DEBUG_VERBOSE_FALLBACK 0x200
-#endif /* __MACH64_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.c
deleted file mode 100644
index 7c27c5856..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "mach64_context.h"
-#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
-#include "mach64_dd.h"
-
-#include "context.h"
-#include "utils.h"
-#include "framebuffer.h"
-
-#define DRIVER_DATE "20051019"
-
-/* Return the current color buffer size.
- */
-static void mach64DDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- LOCK_HARDWARE( mmesa );
- *width = mmesa->driDrawable->w;
- *height = mmesa->driDrawable->h;
- UNLOCK_HARDWARE( mmesa );
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *mach64DDGetString( GLcontext *ctx, GLenum name )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- const char * card_name = "Mach64 [Rage Pro]";
- GLuint agp_mode = mmesa->mach64Screen->IsPCI ? 0 :
- mmesa->mach64Screen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte*)"Gareth Hughes, Leif Delgass, José Fonseca";
-
- case GL_RENDERER:
-
- offset = driGetRendererString( buffer, card_name, DRIVER_DATE,
- agp_mode );
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Send all commands to the hardware. If vertex buffers or indirect
- * buffers are in use, then we need to make sure they are sent to the
- * hardware. All commands that are normally sent to the ring are
- * already considered `flushed'.
- */
-static void mach64DDFlush( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- LOCK_HARDWARE( mmesa );
- FLUSH_DMA_LOCKED( mmesa );
- UNLOCK_HARDWARE( mmesa );
-
-#if ENABLE_PERF_BOXES
- if ( mmesa->boxes ) {
- LOCK_HARDWARE( mmesa );
- mach64PerformanceBoxesLocked( mmesa );
- UNLOCK_HARDWARE( mmesa );
- }
-
- /* Log the performance counters if necessary */
- mach64PerformanceCounters( mmesa );
-#endif
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-static void mach64DDFinish( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- mmesa->c_drawWaits++;
-#endif
-
- mach64DDFlush( ctx );
- mach64WaitForIdle( mmesa );
-}
-
-/* Initialize the driver's misc functions.
- */
-void mach64InitDriverFuncs( struct dd_function_table *functions )
-{
- functions->GetBufferSize = mach64DDGetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = mach64DDGetString;
- functions->Finish = mach64DDFinish;
- functions->Flush = mach64DDFlush;
-
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.h
deleted file mode 100644
index 74cf1d304..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_dd.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __MACH64_DD_H__
-#define __MACH64_DD_H__
-
-extern void mach64InitDriverFuncs( struct dd_function_table *functions );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.c
deleted file mode 100644
index 1889dc2b9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.c
+++ /dev/null
@@ -1,912 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-#include <errno.h>
-
-#include "mach64_context.h"
-#include "mach64_state.h"
-#include "mach64_ioctl.h"
-#include "mach64_tex.h"
-
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast/swrast.h"
-
-#include "vblank.h"
-
-#define MACH64_TIMEOUT 10 /* the DRM already has a timeout, so keep this small */
-
-
-/* =============================================================
- * Hardware vertex buffer handling
- */
-
-/* Get a new VB from the pool of vertex buffers in AGP space.
- */
-drmBufPtr mach64GetBufferLocked( mach64ContextPtr mmesa )
-{
- int fd = mmesa->mach64Screen->driScreen->fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- drmBufPtr buf = NULL;
- int to = 0;
- int ret;
-
- dma.context = mmesa->hHWContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = MACH64_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- while ( !buf && ( to++ < MACH64_TIMEOUT ) ) {
- ret = drmDMA( fd, &dma );
-
- if ( ret == 0 ) {
- buf = &mmesa->mach64Screen->buffers->list[index];
- buf->used = 0;
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- mmesa->c_vertexBuffers++;
-#endif
- return buf;
- }
- }
-
- if ( !buf ) {
- drmCommandNone( fd, DRM_MACH64_RESET );
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "Error: Could not get new VB... exiting\n" );
- exit( -1 );
- }
-
- return buf;
-}
-
-void mach64FlushVerticesLocked( mach64ContextPtr mmesa )
-{
- drm_clip_rect_t *pbox = mmesa->pClipRects;
- int nbox = mmesa->numClipRects;
- void *buffer = mmesa->vert_buf;
- int count = mmesa->vert_used;
- int prim = mmesa->hw_primitive;
- int fd = mmesa->driScreen->fd;
- drm_mach64_vertex_t vertex;
- int i, ret;
-
- mmesa->num_verts = 0;
- mmesa->vert_used = 0;
-
- if ( !count )
- return;
-
- if ( mmesa->dirty & ~MACH64_UPLOAD_CLIPRECTS )
- mach64EmitHwStateLocked( mmesa );
-
- if ( !nbox )
- count = 0;
-
- if ( nbox > MACH64_NR_SAREA_CLIPRECTS )
- mmesa->dirty |= MACH64_UPLOAD_CLIPRECTS;
-
- if ( !count || !(mmesa->dirty & MACH64_UPLOAD_CLIPRECTS) ) {
- /* FIXME: Is this really necessary */
- if ( nbox == 1 )
- mmesa->sarea->nbox = 0;
- else
- mmesa->sarea->nbox = nbox;
-
- vertex.prim = prim;
- vertex.buf = buffer;
- vertex.used = count;
- vertex.discard = 1;
- ret = drmCommandWrite( fd, DRM_MACH64_VERTEX, &vertex, sizeof(drm_mach64_vertex_t) );
- if ( ret ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "Error flushing vertex buffer: return = %d\n", ret );
- exit( -1 );
- }
-
- } else {
-
- for ( i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS, nbox );
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- int discard = 0;
-
- mmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++ ) {
- *b++ = pbox[i];
- }
-
- /* Finished with the buffer?
- */
- if ( nr == nbox ) {
- discard = 1;
- }
-
- mmesa->sarea->dirty |= MACH64_UPLOAD_CLIPRECTS;
-
- vertex.prim = prim;
- vertex.buf = buffer;
- vertex.used = count;
- vertex.discard = discard;
- ret = drmCommandWrite( fd, DRM_MACH64_VERTEX, &vertex, sizeof(drm_mach64_vertex_t) );
- if ( ret ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "Error flushing vertex buffer: return = %d\n", ret );
- exit( -1 );
- }
- }
- }
-
- mmesa->dirty &= ~MACH64_UPLOAD_CLIPRECTS;
-}
-
-/* ================================================================
- * Texture uploads
- */
-
-void mach64FireBlitLocked( mach64ContextPtr mmesa, drmBufPtr buffer,
- GLint offset, GLint pitch, GLint format,
- GLint x, GLint y, GLint width, GLint height )
-{
- drm_mach64_blit_t blit;
- GLint ret;
-
- blit.idx = buffer->idx;
- blit.offset = offset;
- blit.pitch = pitch;
- blit.format = format;
- blit.x = x;
- blit.y = y;
- blit.width = width;
- blit.height = height;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_BLIT,
- &blit, sizeof(drm_mach64_blit_t) );
-
- if ( ret ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_BLIT: return = %d\n", ret );
- exit( -1 );
- }
-}
-
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-static void delay( void ) {
-/* Prevent an optimizing compiler from removing a spin loop */
-}
-
-/* Throttle the frame rate -- only allow MACH64_MAX_QUEUED_FRAMES
- * pending swap buffers requests at a time.
- *
- * GH: We probably don't want a timeout here, as we can wait as
- * long as we want for a frame to complete. If it never does, then
- * the card has locked.
- */
-static int mach64WaitForFrameCompletion( mach64ContextPtr mmesa )
-{
- int fd = mmesa->driFd;
- int i;
- int wait = 0;
- int frames;
-
- while ( 1 ) {
- drm_mach64_getparam_t gp;
- int ret;
-
- if ( mmesa->sarea->frames_queued < MACH64_MAX_QUEUED_FRAMES ) {
- break;
- }
-
- if (MACH64_DEBUG & DEBUG_NOWAIT) {
- return 1;
- }
-
- gp.param = MACH64_PARAM_FRAMES_QUEUED;
- gp.value = &frames; /* also copied into sarea->frames_queued by DRM */
-
- ret = drmCommandWriteRead( fd, DRM_MACH64_GETPARAM, &gp, sizeof(gp) );
-
- if ( ret ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_GETPARAM: return = %d\n", ret );
- exit( -1 );
- }
-
- /* Spin in place a bit so we aren't hammering the register */
- wait++;
-
- for ( i = 0 ; i < 1024 ; i++ ) {
- delay();
- }
-
- }
-
- return wait;
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- mach64ContextPtr mmesa;
- GLint nbox, i, ret;
- drm_clip_rect_t *pbox;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- mmesa = (mach64ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "\n********************************\n" );
- fprintf( stderr, "\n%s( %p )\n\n",
- __FUNCTION__, mmesa->glCtx );
- fflush( stderr );
- }
-
- /* Flush any outstanding vertex buffers */
- FLUSH_BATCH( mmesa );
-
- LOCK_HARDWARE( mmesa );
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- if ( !mach64WaitForFrameCompletion( mmesa ) ) {
- mmesa->hardwareWentIdle = 1;
- } else {
- mmesa->hardwareWentIdle = 0;
- }
-
-#if ENABLE_PERF_BOXES
- if ( mmesa->boxes ) {
- mach64PerformanceBoxesLocked( mmesa );
- }
-#endif
-
- UNLOCK_HARDWARE( mmesa );
- driWaitForVBlank( dPriv, &mmesa->vbl_seq, mmesa->vblank_flags, &missed_target );
- LOCK_HARDWARE( mmesa );
-
- /* use front buffer cliprects */
- nbox = dPriv->numClipRects;
- pbox = dPriv->pClipRects;
-
- for ( i = 0 ; i < nbox ; ) {
- GLint nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS , nbox );
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = pbox[i];
- n++;
- }
- mmesa->sarea->nbox = n;
-
- ret = drmCommandNone( mmesa->driFd, DRM_MACH64_SWAP );
-
- if ( ret ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_SWAP: return = %d\n", ret );
- exit( -1 );
- }
- }
-
- if ( MACH64_DEBUG & DEBUG_ALWAYS_SYNC ) {
- mach64WaitForIdleLocked( mmesa );
- }
-
- UNLOCK_HARDWARE( mmesa );
-
- mmesa->dirty |= (MACH64_UPLOAD_CONTEXT |
- MACH64_UPLOAD_MISC |
- MACH64_UPLOAD_CLIPRECTS);
-
-#if ENABLE_PERF_BOXES
- /* Log the performance counters if necessary */
- mach64PerformanceCounters( mmesa );
-#endif
-}
-
-#if ENABLE_PERF_BOXES
-/* ================================================================
- * Performance monitoring
- */
-
-void mach64PerformanceCounters( mach64ContextPtr mmesa )
-{
-
- if (MACH64_DEBUG & DEBUG_VERBOSE_COUNT) {
- /* report performance counters */
- fprintf( stderr, "mach64CopyBuffer: vertexBuffers:%i drawWaits:%i clears:%i\n",
- mmesa->c_vertexBuffers, mmesa->c_drawWaits, mmesa->c_clears );
- }
-
- mmesa->c_vertexBuffers = 0;
- mmesa->c_drawWaits = 0;
- mmesa->c_clears = 0;
-
- if ( mmesa->c_textureSwaps || mmesa->c_textureBytes || mmesa->c_agpTextureBytes ) {
- if (MACH64_DEBUG & DEBUG_VERBOSE_COUNT) {
- fprintf( stderr, " textureSwaps:%i textureBytes:%i agpTextureBytes:%i\n",
- mmesa->c_textureSwaps, mmesa->c_textureBytes, mmesa->c_agpTextureBytes );
- }
- mmesa->c_textureSwaps = 0;
- mmesa->c_textureBytes = 0;
- mmesa->c_agpTextureBytes = 0;
- }
-
- mmesa->c_texsrc_agp = 0;
- mmesa->c_texsrc_card = 0;
-
- if (MACH64_DEBUG & DEBUG_VERBOSE_COUNT)
- fprintf( stderr, "---------------------------------------------------------\n" );
-}
-
-
-void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa )
-{
- GLint ret;
- drm_mach64_clear_t clear;
- GLint x, y, w, h;
- GLuint color;
- GLint nbox;
- GLint x1, y1, x2, y2;
- drm_clip_rect_t *b = mmesa->sarea->boxes;
-
- /* save cliprects */
- nbox = mmesa->sarea->nbox;
- x1 = b[0].x1;
- y1 = b[0].y1;
- x2 = b[0].x2;
- y2 = b[0].y2;
-
- /* setup a single cliprect and call the clear ioctl for each box */
- mmesa->sarea->nbox = 1;
-
- w = h = 8;
- x = mmesa->drawX;
- y = mmesa->drawY;
- b[0].x1 = x;
- b[0].x2 = x + w;
- b[0].y1 = y;
- b[0].y2 = y + h;
-
- clear.flags = MACH64_BACK;
- clear.clear_depth = 0;
-
- /* Red box if DDFinish was called to wait for rendering to complete */
- if ( mmesa->c_drawWaits ) {
- color = mach64PackColor( mmesa->mach64Screen->cpp, 255, 0, 0, 0 );
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
-
- }
-
- x += w;
- b[0].x1 = x;
- b[0].x2 = x + w;
-
- /* draw a green box if we had to wait for previous frame(s) to complete */
- if ( !mmesa->hardwareWentIdle ) {
- color = mach64PackColor( mmesa->mach64Screen->cpp, 0, 255, 0, 0 );
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
-
- }
-
- x += w;
- w = 20;
- b[0].x1 = x;
-
- /* show approx. ratio of AGP/card textures used - Blue = AGP, Purple = Card */
- if ( mmesa->c_texsrc_agp || mmesa->c_texsrc_card ) {
- color = mach64PackColor( mmesa->mach64Screen->cpp, 0, 0, 255, 0 );
- w = ((GLfloat)mmesa->c_texsrc_agp / (GLfloat)(mmesa->c_texsrc_agp + mmesa->c_texsrc_card))*20;
- if (w > 1) {
-
- b[0].x2 = x + w;
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
- }
-
- x += w;
- w = 20 - w;
-
- if (w > 1) {
- b[0].x1 = x;
- b[0].x2 = x + w;
-
- color = mach64PackColor( mmesa->mach64Screen->cpp, 255, 0, 255, 0 );
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
- }
- }
-
- x += w;
- w = 8;
- b[0].x1 = x;
- b[0].x2 = x + w;
-
- /* Yellow box if we swapped textures */
- if ( mmesa->c_textureSwaps ) {
- color = mach64PackColor( mmesa->mach64Screen->cpp, 255, 255, 0, 0 );
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
-
- }
-
- h = 4;
- x += 8;
- b[0].x1 = x;
- b[0].y2 = y + h;
-
- /* Purple bar for card memory texture blits/uploads */
- if ( mmesa->c_textureBytes ) {
- color = mach64PackColor( mmesa->mach64Screen->cpp, 255, 0, 255, 0 );
- w = mmesa->c_textureBytes / 16384;
- if ( w <= 0 )
- w = 1;
- if (w > (mmesa->driDrawable->w - 44))
- w = mmesa->driDrawable->w - 44;
-
- b[0].x2 = x + w;
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
- }
-
- /* Blue bar for AGP memory texture blits/uploads */
- if ( mmesa->c_agpTextureBytes ) {
- color = mach64PackColor( mmesa->mach64Screen->cpp, 0, 0, 255, 0 );
- w = mmesa->c_agpTextureBytes / 16384;
- if ( w <= 0 )
- w = 1;
- if (w > (mmesa->driDrawable->w - 44))
- w = mmesa->driDrawable->w - 44;
-
- y += 4;
- b[0].x2 = x + w;
- b[0].y1 = y;
- b[0].y2 = y + h;
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
- }
-
- /* Pink bar for number of vertex buffers used */
- if ( mmesa->c_vertexBuffers ) {
- color = mach64PackColor( mmesa->mach64Screen->cpp, 196, 128, 128, 0 );
-
- w = mmesa->c_vertexBuffers;
- if (w > (mmesa->driDrawable->w))
- w = mmesa->driDrawable->w;
-
- h = 8;
- x = mmesa->drawX;
- y = mmesa->drawY + 8;
- b[0].x1 = x;
- b[0].x2 = x + w;
- b[0].y1 = y;
- b[0].y2 = y + h;
-
- clear.x = x;
- clear.y = y;
- clear.w = w;
- clear.h = h;
- clear.clear_color = color;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if (ret < 0) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
- }
-
- /* restore cliprects */
- mmesa->sarea->nbox = nbox;
- b[0].x1 = x1;
- b[0].y1 = y1;
- b[0].x2 = x2;
- b[0].y2 = y2;
-
-}
-
-#endif
-
-/* ================================================================
- * Buffer clear
- */
-
-static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- drm_mach64_clear_t clear;
- GLuint flags = 0;
- GLint i;
- GLint ret;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s: all=%d %d,%d %dx%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
- }
-
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- mmesa->c_clears++;
-#endif
-
- FLUSH_BATCH( mmesa );
-
- /* The only state changes we care about here are the RGBA colormask
- * and scissor/clipping. We'll just update that state, if needed.
- */
- if ( mmesa->new_state & (MACH64_NEW_MASKS | MACH64_NEW_CLIP) ) {
- const GLuint save_state = mmesa->new_state;
- mmesa->new_state &= (MACH64_NEW_MASKS | MACH64_NEW_CLIP);
- mach64DDUpdateHWState( ctx );
- mmesa->new_state = save_state & ~(MACH64_NEW_MASKS | MACH64_NEW_CLIP);
- }
-
- if ( mask & BUFFER_BIT_FRONT_LEFT ) {
- flags |= MACH64_FRONT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ( mask & BUFFER_BIT_BACK_LEFT ) {
- flags |= MACH64_BACK;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) {
- flags |= MACH64_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-
- if ( !flags )
- return;
-
- LOCK_HARDWARE( mmesa );
-
- /* This needs to be in the locked region, so updated drawable origin is used */
- /* Flip top to bottom */
- cx += mmesa->drawX;
- cy = mmesa->drawY + dPriv->h - cy - ch;
-
- /* HACK?
- */
- if ( mmesa->dirty & ~MACH64_UPLOAD_CLIPRECTS ) {
- mach64EmitHwStateLocked( mmesa );
- }
-
- for ( i = 0 ; i < mmesa->numClipRects ; ) {
- int nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS, mmesa->numClipRects );
- drm_clip_rect_t *box = mmesa->pClipRects;
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- mmesa->sarea->nbox = n;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_IOCTL ) {
- fprintf( stderr,
- "DRM_MACH64_CLEAR: flag 0x%x color %x depth %x nbox %d\n",
- flags,
- (GLuint)mmesa->ClearColor,
- (GLuint)mmesa->ClearDepth,
- mmesa->sarea->nbox );
- }
-
- clear.flags = flags;
- clear.x = cx;
- clear.y = cy;
- clear.w = cw;
- clear.h = ch;
- clear.clear_color = mmesa->ClearColor;
- clear.clear_depth = mmesa->ClearDepth;
-
- ret = drmCommandWrite( mmesa->driFd, DRM_MACH64_CLEAR,
- &clear, sizeof(drm_mach64_clear_t) );
-
- if ( ret ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "DRM_MACH64_CLEAR: return = %d\n", ret );
- exit( -1 );
- }
- }
-
- UNLOCK_HARDWARE( mmesa );
-
- mmesa->dirty |= (MACH64_UPLOAD_CONTEXT |
- MACH64_UPLOAD_MISC |
- MACH64_UPLOAD_CLIPRECTS);
-
-}
-
-
-void mach64WaitForIdleLocked( mach64ContextPtr mmesa )
-{
- int fd = mmesa->driFd;
- int to = 0;
- int ret;
-
- do {
- ret = drmCommandNone( fd, DRM_MACH64_IDLE );
- } while ( ( ret == -EBUSY ) && ( to++ < MACH64_TIMEOUT ) );
-
- if ( ret < 0 ) {
- drmCommandNone( fd, DRM_MACH64_RESET );
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "Error: Mach64 timed out... exiting\n" );
- exit( -1 );
- }
-}
-
-/* Flush the DMA queue to the hardware */
-void mach64FlushDMALocked( mach64ContextPtr mmesa )
-{
- int fd = mmesa->driFd;
- int ret;
-
- ret = drmCommandNone( fd, DRM_MACH64_FLUSH );
-
- if ( ret < 0 ) {
- drmCommandNone( fd, DRM_MACH64_RESET );
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "Error flushing DMA... exiting\n" );
- exit( -1 );
- }
-
- mmesa->dirty |= (MACH64_UPLOAD_CONTEXT |
- MACH64_UPLOAD_MISC |
- MACH64_UPLOAD_CLIPRECTS);
-
-}
-
-/* For client-side state emits - currently unused */
-void mach64UploadHwStateLocked( mach64ContextPtr mmesa )
-{
- drm_mach64_sarea_t *sarea = mmesa->sarea;
-
- drm_mach64_context_regs_t *regs = &sarea->context_state;
- unsigned int dirty = sarea->dirty;
- CARD32 offset = ((regs->tex_size_pitch & 0xf0) >> 2);
-
- DMALOCALS;
-
- DMAGETPTR( 19*2 );
-
- if ( dirty & MACH64_UPLOAD_MISC ) {
- DMAOUTREG( MACH64_DP_MIX, regs->dp_mix );
- DMAOUTREG( MACH64_DP_SRC, regs->dp_src );
- DMAOUTREG( MACH64_CLR_CMP_CNTL, regs->clr_cmp_cntl );
- DMAOUTREG( MACH64_GUI_TRAJ_CNTL, regs->gui_traj_cntl );
- DMAOUTREG( MACH64_SC_LEFT_RIGHT, regs->sc_left_right );
- DMAOUTREG( MACH64_SC_TOP_BOTTOM, regs->sc_top_bottom );
- sarea->dirty &= ~MACH64_UPLOAD_MISC;
- }
-
- if ( dirty & MACH64_UPLOAD_DST_OFF_PITCH ) {
- DMAOUTREG( MACH64_DST_OFF_PITCH, regs->dst_off_pitch );
- sarea->dirty &= ~MACH64_UPLOAD_DST_OFF_PITCH;
- }
- if ( dirty & MACH64_UPLOAD_Z_OFF_PITCH ) {
- DMAOUTREG( MACH64_Z_OFF_PITCH, regs->z_off_pitch );
- sarea->dirty &= ~MACH64_UPLOAD_Z_OFF_PITCH;
- }
- if ( dirty & MACH64_UPLOAD_Z_ALPHA_CNTL ) {
- DMAOUTREG( MACH64_Z_CNTL, regs->z_cntl );
- DMAOUTREG( MACH64_ALPHA_TST_CNTL, regs->alpha_tst_cntl );
- sarea->dirty &= ~MACH64_UPLOAD_Z_ALPHA_CNTL;
- }
- if ( dirty & MACH64_UPLOAD_SCALE_3D_CNTL ) {
- DMAOUTREG( MACH64_SCALE_3D_CNTL, regs->scale_3d_cntl );
- sarea->dirty &= ~MACH64_UPLOAD_SCALE_3D_CNTL;
- }
- if ( dirty & MACH64_UPLOAD_DP_FOG_CLR ) {
- DMAOUTREG( MACH64_DP_FOG_CLR, regs->dp_fog_clr );
- sarea->dirty &= ~MACH64_UPLOAD_DP_FOG_CLR;
- }
- if ( dirty & MACH64_UPLOAD_DP_WRITE_MASK ) {
- DMAOUTREG( MACH64_DP_WRITE_MASK, regs->dp_write_mask );
- sarea->dirty &= ~MACH64_UPLOAD_DP_WRITE_MASK;
- }
- if ( dirty & MACH64_UPLOAD_DP_PIX_WIDTH ) {
- DMAOUTREG( MACH64_DP_PIX_WIDTH, regs->dp_pix_width );
- sarea->dirty &= ~MACH64_UPLOAD_DP_PIX_WIDTH;
- }
- if ( dirty & MACH64_UPLOAD_SETUP_CNTL ) {
- DMAOUTREG( MACH64_SETUP_CNTL, regs->setup_cntl );
- sarea->dirty &= ~MACH64_UPLOAD_SETUP_CNTL;
- }
-
- if ( dirty & MACH64_UPLOAD_TEXTURE ) {
- DMAOUTREG( MACH64_TEX_SIZE_PITCH, regs->tex_size_pitch );
- DMAOUTREG( MACH64_TEX_CNTL, regs->tex_cntl );
- DMAOUTREG( MACH64_SECONDARY_TEX_OFF, regs->secondary_tex_off );
- DMAOUTREG( MACH64_TEX_0_OFF + offset, regs->tex_offset );
- sarea->dirty &= ~MACH64_UPLOAD_TEXTURE;
- }
-
-#if 0
- if ( dirty & MACH64_UPLOAD_CLIPRECTS ) {
- DMAOUTREG( MACH64_SC_LEFT_RIGHT, regs->sc_left_right );
- DMAOUTREG( MACH64_SC_TOP_BOTTOM, regs->sc_top_bottom );
- sarea->dirty &= ~MACH64_UPLOAD_CLIPRECTS;
- }
-#endif
-
- sarea->dirty = 0;
-
- DMAADVANCE();
-}
-
-void mach64InitIoctlFuncs( struct dd_function_table *functions )
-{
- functions->Clear = mach64DDClear;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.h
deleted file mode 100644
index 8bd958531..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_ioctl.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#ifndef __MACH64_IOCTL_H__
-#define __MACH64_IOCTL_H__
-
-#include "mach64_dri.h"
-#include "mach64_reg.h"
-#include "mach64_lock.h"
-
-#define MACH64_BUFFER_MAX_DWORDS (MACH64_BUFFER_SIZE / sizeof(CARD32))
-
-
-extern drmBufPtr mach64GetBufferLocked( mach64ContextPtr mmesa );
-extern void mach64FlushVerticesLocked( mach64ContextPtr mmesa );
-extern void mach64FlushDMALocked( mach64ContextPtr mmesa );
-extern void mach64UploadHwStateLocked( mach64ContextPtr mmesa );
-
-static __inline void *mach64AllocDmaLow( mach64ContextPtr mmesa, int bytes )
-{
- CARD32 *head;
-
- if ( mmesa->vert_used + bytes > mmesa->vert_total ) {
- LOCK_HARDWARE( mmesa );
- mach64FlushVerticesLocked( mmesa );
- UNLOCK_HARDWARE( mmesa );
- }
-
- head = (CARD32 *)((char *)mmesa->vert_buf + mmesa->vert_used);
- mmesa->vert_used += bytes;
-
- return head;
-}
-
-static __inline void *mach64AllocDmaLocked( mach64ContextPtr mmesa, int bytes )
-{
- CARD32 *head;
-
- if ( mmesa->vert_used + bytes > mmesa->vert_total ) {
- mach64FlushVerticesLocked( mmesa );
- }
-
- head = (CARD32 *)((char *)mmesa->vert_buf + mmesa->vert_used);
- mmesa->vert_used += bytes;
-
- return head;
-}
-
-extern void mach64FireBlitLocked( mach64ContextPtr mmesa, drmBufPtr buffer,
- GLint offset, GLint pitch, GLint format,
- GLint x, GLint y, GLint width, GLint height );
-
-extern void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv );
-#if ENABLE_PERF_BOXES
-extern void mach64PerformanceCounters( mach64ContextPtr mmesa );
-extern void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa );
-#endif
-extern void mach64WaitForIdleLocked( mach64ContextPtr mmesa );
-
-extern void mach64InitIoctlFuncs( struct dd_function_table *functions );
-
-/* ================================================================
- * Helper macros:
- */
-
-#define FLUSH_BATCH( mmesa ) \
-do { \
- if ( MACH64_DEBUG & DEBUG_VERBOSE_IOCTL ) \
- fprintf( stderr, "FLUSH_BATCH in %s\n", __FUNCTION__ ); \
- if ( mmesa->vert_used ) { \
- mach64FlushVertices( mmesa ); \
- } \
-} while (0)
-
-/* According to a comment in ATIMach64Sync (atimach64.c) in the DDX:
- *
- * "For VTB's and later, the first CPU read of the framebuffer will return
- * zeroes [...] This appears to be due to some kind of engine
- * caching of framebuffer data I haven't found any way of disabling, or
- * otherwise circumventing."
- */
-#define FINISH_DMA_LOCKED( mmesa ) \
-do { \
- CARD32 _tmp; \
- if ( MACH64_DEBUG & DEBUG_VERBOSE_IOCTL ) \
- fprintf( stderr, "FINISH_DMA_LOCKED in %s\n", __FUNCTION__ ); \
- if ( mmesa->vert_used ) { \
- mach64FlushVerticesLocked( mmesa ); \
- } \
- mach64WaitForIdleLocked( mmesa ); \
- /* pre-read framebuffer to counter caching problem */ \
- _tmp = *(volatile CARD32 *)mmesa->driScreen->pFB; \
-} while (0)
-
-#define FLUSH_DMA_LOCKED( mmesa ) \
-do { \
- if ( MACH64_DEBUG & DEBUG_VERBOSE_IOCTL ) \
- fprintf( stderr, "FLUSH_DMA_LOCKED in %s\n", __FUNCTION__ ); \
- if ( mmesa->vert_used ) { \
- mach64FlushVerticesLocked( mmesa ); \
- } \
- mach64FlushDMALocked( mmesa ); \
-} while (0)
-
-#define mach64FlushVertices( mmesa ) \
-do { \
- LOCK_HARDWARE( mmesa ); \
- mach64FlushVerticesLocked( mmesa ); \
- UNLOCK_HARDWARE( mmesa ); \
-} while (0)
-
-#define mach64WaitForIdle( mmesa ) \
-do { \
- LOCK_HARDWARE( mmesa ); \
- mach64WaitForIdleLocked( mmesa ); \
- UNLOCK_HARDWARE( mmesa ); \
-} while (0)
-
-
-#endif /* __MACH64_IOCTL_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.c
deleted file mode 100644
index 3d41d71b3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "mach64_context.h"
-#include "mach64_state.h"
-#include "mach64_lock.h"
-#include "mach64_tex.h"
-
-#if 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 mach64GetLock( mach64ContextPtr mmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- __DRIscreenPrivate *sPriv = mmesa->driScreen;
- drm_mach64_sarea_t *sarea = mmesa->sarea;
- int i;
-
- drmGetLock( mmesa->driFd, mmesa->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 ( mmesa->lastStamp != dPriv->lastStamp ) {
- mmesa->lastStamp = dPriv->lastStamp;
- if (mmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- mach64SetCliprects( mmesa->glCtx, GL_BACK_LEFT );
- else
- mach64SetCliprects( mmesa->glCtx, GL_FRONT_LEFT );
- mach64CalcViewport( mmesa->glCtx );
- }
-
- mmesa->dirty |= (MACH64_UPLOAD_CONTEXT
- | MACH64_UPLOAD_MISC
- | MACH64_UPLOAD_CLIPRECTS);
-
- if ( sarea->ctx_owner != mmesa->hHWContext ) {
- sarea->ctx_owner = mmesa->hHWContext;
- mmesa->dirty = MACH64_UPLOAD_ALL;
- }
-
- for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) {
- if ( mmesa->texHeap[i] && (sarea->tex_age[i] != mmesa->lastTexAge[i]) ) {
- mach64AgeTextures( mmesa, i );
- }
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.h
deleted file mode 100644
index 973880ee2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_lock.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __MACH64_LOCK_H__
-#define __MACH64_LOCK_H__
-
-extern void mach64GetLock( mach64ContextPtr mmesa, GLuint flags );
-
-
-/* Turn DEBUG_LOCKING on to find locking conflicts.
- */
-#define DEBUG_LOCKING 1
-
-#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( mmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( mmesa->driHwLock, mmesa->hHWContext, \
- (DRM_LOCK_HELD | mmesa->hHWContext), __ret ); \
- if ( __ret ) \
- mach64GetLock( mmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( mmesa ) \
- do { \
- DRM_UNLOCK( mmesa->driFd, \
- mmesa->driHwLock, \
- mmesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif /* __MACH64_LOCK_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vb.c
deleted file mode 100644
index 7872c206f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vb.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * 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.
- *
- * Original authors:
- * Keith Whitwell <keithw@valinux.com>
- *
- * Adapted to Mach64 by:
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "math/m_translate.h"
-
-#ifndef LOCALVARS
-#define LOCALVARS
-#endif
-
-void TAG(translate_vertex)(GLcontext *ctx,
- const VERTEX *src,
- SWvertex *dst)
-{
- LOCALVARS
- GLuint format = GET_VERTEX_FORMAT();
- UNVIEWPORT_VARS;
- CARD32 *p = (CARD32 *)src + 10 - mmesa->vertex_size;
-
- dst->win[3] = 1.0;
-
- switch ( format ) {
- case TEX1_VERTEX_FORMAT:
-#ifdef MACH64_PREMULT_TEXCOORDS
- {
- float rhw = 1.0 / LE32_IN_FLOAT( p + 2 );
-
- dst->texcoord[1][0] = rhw*LE32_IN_FLOAT( p++ );
- dst->texcoord[1][1] = rhw*LE32_IN_FLOAT( p++ );
- }
-#else
- dst->texcoord[1][0] = LE32_IN_FLOAT( p++ );
- dst->texcoord[1][1] = LE32_IN_FLOAT( p++ );
-#endif
- dst->texcoord[1][3] = 1.0;
- p++;
-
- case TEX0_VERTEX_FORMAT:
-#ifdef MACH64_PREMULT_TEXCOORDS
- {
- float rhw = 1.0 / LE32_IN_FLOAT( p + 2 );
-
- dst->texcoord[0][0] = rhw*LE32_IN_FLOAT( p++ );
- dst->texcoord[0][1] = rhw*LE32_IN_FLOAT( p++ );
- }
-#else
- dst->texcoord[0][0] = LE32_IN_FLOAT( p++ );
- dst->texcoord[0][1] = LE32_IN_FLOAT( p++ );
-#endif
- dst->texcoord[0][3] = 1.0;
- dst->win[3] = LE32_IN_FLOAT( p++ );
-
- case NOTEX_VERTEX_FORMAT:
- dst->specular[2] = ((GLubyte *)p)[0];
- dst->specular[1] = ((GLubyte *)p)[1];
- dst->specular[0] = ((GLubyte *)p)[2];
- dst->fog = ((GLubyte *)p)[3];
- p++;
-
- case TINY_VERTEX_FORMAT:
- dst->win[2] = UNVIEWPORT_Z( LE32_IN( p++ ) );
-
- dst->color[2] = ((GLubyte *)p)[0];
- dst->color[1] = ((GLubyte *)p)[1];
- dst->color[0] = ((GLubyte *)p)[2];
- dst->color[3] = ((GLubyte *)p)[3];
- p++;
-
- {
- GLuint xy = LE32_IN( p );
-
- dst->win[0] = UNVIEWPORT_X( (GLfloat)(GLshort)( xy >> 16 ) );
- dst->win[1] = UNVIEWPORT_Y( (GLfloat)(GLshort)( xy & 0xffff ) );
- }
- }
-
- assert( p + 1 - (CARD32 *)src == 10 );
-
- dst->pointSize = ctx->Point._Size;
-}
-
-
-
-void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v )
-{
- LOCALVARS
- GLuint format = GET_VERTEX_FORMAT();
- CARD32 *p = (CARD32 *)v + 10 - mmesa->vertex_size;
-
- switch ( format ) {
- case TEX1_VERTEX_FORMAT:
- {
- GLfloat u, v, w;
-#ifdef MACH64_PREMULT_TEXCOORDS
- float rhw = 1.0 / LE32_IN_FLOAT( p + 2 );
-
- u = rhw*LE32_IN_FLOAT( p++ );
- v = rhw*LE32_IN_FLOAT( p++ );
-#else
- u = LE32_IN_FLOAT( p++ );
- v = LE32_IN_FLOAT( p++ );
-#endif
- w = LE32_IN_FLOAT( p++ );
- fprintf( stderr, "u1 %f v1 %f w1 %f\n", u, v, w );
- }
-
- case TEX0_VERTEX_FORMAT:
- {
- GLfloat u, v, w;
-#ifdef MACH64_PREMULT_TEXCOORDS
- float rhw = 1.0 / LE32_IN_FLOAT( p + 2 );
-
- u = rhw*LE32_IN_FLOAT( p++ );
- v = rhw*LE32_IN_FLOAT( p++ );
-#else
- u = LE32_IN_FLOAT( p++ );
- v = LE32_IN_FLOAT( p++ );
-#endif
- w = LE32_IN_FLOAT( p++ );
- fprintf( stderr, "u0 %f v0 %f w0 %f\n", u, v, w );
- }
-
- case NOTEX_VERTEX_FORMAT:
- {
- GLubyte r, g, b, a;
-
- b = ((GLubyte *)p)[0];
- g = ((GLubyte *)p)[1];
- r = ((GLubyte *)p)[2];
- a = ((GLubyte *)p)[3];
- p++;
- fprintf(stderr, "spec: r %d g %d b %d a %d\n", r, g, b, a);
- }
-
- case TINY_VERTEX_FORMAT:
- {
- GLuint xy;
- GLfloat x, y, z;
- GLubyte r, g, b, a;
-
- z = LE32_IN( p++ ) / 65536.0;
-
- b = ((GLubyte *)p)[0];
- g = ((GLubyte *)p)[1];
- r = ((GLubyte *)p)[2];
- a = ((GLubyte *)p)[3];
- p++;
- xy = LE32_IN( p );
- x = (GLfloat)(GLshort)( xy >> 16 ) / 4.0;
- y = (GLfloat)(GLshort)( xy & 0xffff ) / 4.0;
-
- fprintf(stderr, "x %f y %f z %f\n", x, y, z);
- fprintf(stderr, "r %d g %d b %d a %d\n", r, g, b, a);
- }
- }
-
- assert( p + 1 - (CARD32 *)v == 10 );
-
- fprintf(stderr, "\n");
-}
-
-/* Interpolate the elements of the VB not included in typical hardware
- * vertices.
- *
- * NOTE: All these arrays are guarenteed by tnl to be writeable and
- * have good stride.
- */
-#ifndef INTERP_QUALIFIER
-#define INTERP_QUALIFIER static
-#endif
-
-#define GET_COLOR(ptr, idx) ((ptr)->data[idx])
-
-
-INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
- GLfloat t,
- GLuint dst, GLuint out, GLuint in,
- GLboolean force_boundary )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (VB->ColorPtr[1]) {
- assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
-
- INTERP_4F( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
-
- if (VB->SecondaryColorPtr[1]) {
- INTERP_3F( t,
- GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], out),
- GET_COLOR(VB->SecondaryColorPtr[1], in) );
- }
- }
-
- if (VB->EdgeFlag) {
- VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
- }
-
- INTERP_VERTEX(ctx, t, dst, out, in, force_boundary);
-}
-
-INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx,
- GLuint dst, GLuint src )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (VB->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
-
- if (VB->SecondaryColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], src) );
- }
- }
-
- COPY_PV_VERTEX(ctx, dst, src);
-}
-
-
-#undef INTERP_QUALIFIER
-#undef GET_COLOR
-
-#undef IND
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
deleted file mode 100644
index f64b808ee..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h
+++ /dev/null
@@ -1,562 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * 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.
- *
- * Original authors:
- * Keith Whitwell <keithw@valinux.com>
- *
- * Adapted to Mach64 by:
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-
-/* DO_XYZW: Emit xyz and maybe w coordinates.
- * DO_RGBA: Emit color.
- * DO_SPEC: Emit specular color.
- * DO_FOG: Emit fog coordinate in specular alpha.
- * DO_TEX0: Emit tex0 u,v coordinates.
- * DO_TEX1: Emit tex1 u,v coordinates.
- * DO_PTEX: Emit tex0,1 q coordinates where possible.
- *
- * Additionally, this template assumes it is emitting *transformed*
- * vertices; the modifications to emit untransformed vertices (ie. to
- * t&l hardware) are probably too great to cooexist with the code
- * already in this file.
- */
-
-#define VIEWPORT_X(x) ((GLint) ((s[0] * (x) + s[12]) * 4.0))
-#define VIEWPORT_Y(y) ((GLint) ((s[5] * (y) + s[13]) * 4.0))
-#define VIEWPORT_Z(z) (((GLuint) (s[10] * (z) + s[14])) << 15)
-
-#ifndef LOCALVARS
-#define LOCALVARS
-#endif
-
-static void TAG(emit)( GLcontext *ctx,
- GLuint start, GLuint end,
- void *dest,
- GLuint stride )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-#if DO_TEX1
- GLfloat (*tc1)[4];
- GLuint tc1_stride;
-#if DO_PTEX
- GLuint tc1_size;
-#endif
-#endif
-#if DO_TEX0
- GLfloat (*tc0)[4];
- GLuint tc0_stride;
-#if DO_PTEX
- GLuint tc0_size;
-#endif
-#endif
-#if DO_SPEC
- GLfloat (*spec)[4];
- GLuint spec_stride;
-#endif
-#if DO_FOG
- GLfloat (*fog)[4];
- GLuint fog_stride;
-#endif
-#if DO_RGBA
- GLfloat (*col)[4];
- GLuint col_stride;
-#endif
- GLfloat (*coord)[4];
- GLuint coord_stride;
- VERTEX *v = (VERTEX *)dest;
- const GLfloat *s = GET_VIEWPORT_MAT();
-#if DO_TEX1 || DO_TEX0 || DO_XYZW
- const GLubyte *mask = VB->ClipMask;
-#endif
- int i;
-
-#if !DO_XYZW
- (void) s; /* Quiet compiler */
-#endif
-/* fprintf(stderr, "%s(big) importable %d %d..%d\n", */
-/* __FUNCTION__, VB->importable_data, start, end); */
-
-#if DO_TEX1
- {
- const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
-#if DO_PTEX
- tc1_size = VB->TexCoordPtr[t1]->size;
-#endif
- }
-#endif
-
-#if DO_TEX0
- {
- const GLuint t0 = GET_TEXSOURCE(0);
- tc0 = VB->TexCoordPtr[t0]->data;
- tc0_stride = VB->TexCoordPtr[t0]->stride;
-#if DO_PTEX
- tc0_size = VB->TexCoordPtr[t0]->size;
-#endif
- }
-#endif
-
-#if DO_SPEC
- if (VB->SecondaryColorPtr[0]) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
- } else {
- spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
- spec_stride = 0;
- }
-#endif
-
-#if DO_FOG
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
- } else {
- static GLfloat tmp[4] = {0, 0, 0, 0};
- fog = &tmp;
- fog_stride = 0;
- }
-#endif
-
-#if DO_RGBA
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
-#endif
-
- coord = VB->NdcPtr->data;
- coord_stride = VB->NdcPtr->stride;
-
- if (start) {
-#if DO_TEX1
- STRIDE_4F(tc1, start * tc1_stride);
-#endif
-#if DO_TEX0
- STRIDE_4F(tc0, start * tc0_stride);
-#endif
-#if DO_SPEC
- STRIDE_4F(spec, start * spec_stride);
-#endif
-#if DO_FOG
- STRIDE_4F(fog, start * fog_stride);
-#endif
-#if DO_RGBA
- STRIDE_4F(col, start * col_stride);
-#endif
- STRIDE_4F(coord, start * coord_stride);
- }
-
- for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) {
- CARD32 *p = (CARD32 *)v;
-#if DO_TEX1 || DO_TEX0
- GLfloat w;
-
- if (mask[i] == 0) {
- /* unclipped */
- w = coord[0][3];
- } else {
- /* clipped */
- w = 1.0;
- }
-#endif
-
-#if DO_TEX1
-#if DO_PTEX
- if (tc1_size == 4) {
-#ifdef MACH64_PREMULT_TEXCOORDS
- LE32_OUT_FLOAT( p++, w*tc1[0][0] ); /* VERTEX_?_SECONDARY_S */
- LE32_OUT_FLOAT( p++, w*tc1[0][1] ); /* VERTEX_?_SECONDARY_T */
- LE32_OUT_FLOAT( p++, w*tc1[0][3] ); /* VERTEX_?_SECONDARY_W */
-#else /* !MACH64_PREMULT_TEXCOORDS */
- float rhw = 1.0 / tc1[0][3];
- LE32_OUT_FLOAT( p++, rhw*tc1[0][0] ); /* VERTEX_?_SECONDARY_S */
- LE32_OUT_FLOAT( p++, rhw*tc1[0][1] ); /* VERTEX_?_SECONDARY_T */
- LE32_OUT_FLOAT( p++, w*tc1[0][3] ); /* VERTEX_?_SECONDARY_W */
-#endif /* !MACH64_PREMULT_TEXCOORDS */
- } else {
-#endif /* DO_PTEX */
-#ifdef MACH64_PREMULT_TEXCOORDS
- LE32_OUT_FLOAT( p++, w*tc1[0][0] ); /* VERTEX_?_SECONDARY_S */
- LE32_OUT_FLOAT( p++, w*tc1[0][1] ); /* VERTEX_?_SECONDARY_T */
- LE32_OUT_FLOAT( p++, w ); /* VERTEX_?_SECONDARY_W */
-#else /* !MACH64_PREMULT_TEXCOORDS */
- LE32_OUT_FLOAT( p++, tc1[0][0] ); /* VERTEX_?_SECONDARY_S */
- LE32_OUT_FLOAT( p++, tc1[0][1] ); /* VERTEX_?_SECONDARY_T */
- LE32_OUT_FLOAT( p++, w ); /* VERTEX_?_SECONDARY_W */
-#endif /* !MACH64_PREMULT_TEXCOORDS */
-#if DO_PTEX
- }
-#endif /* DO_PTEX */
- STRIDE_4F(tc1, tc1_stride);
-#else /* !DO_TEX1 */
- p += 3;
-#endif /* !DO_TEX1 */
-
-#if DO_TEX0
-#if DO_PTEX
- if (tc0_size == 4) {
-#ifdef MACH64_PREMULT_TEXCOORDS
- LE32_OUT_FLOAT( p++, w*tc0[0][0] ); /* VERTEX_?_S */
- LE32_OUT_FLOAT( p++, w*tc0[0][1] ); /* VERTEX_?_T */
- LE32_OUT_FLOAT( p++, w*tc0[0][3] ); /* VERTEX_?_W */
-#else /* !MACH64_PREMULT_TEXCOORDS */
- float rhw = 1.0 / tc0[0][3];
- LE32_OUT_FLOAT( p++, rhw*tc0[0][0] ); /* VERTEX_?_S */
- LE32_OUT_FLOAT( p++, rhw*tc0[0][1] ); /* VERTEX_?_T */
- LE32_OUT_FLOAT( p++, w*tc0[0][3] ); /* VERTEX_?_W */
-#endif /* !MACH64_PREMULT_TEXCOORDS */
- } else {
-#endif /* DO_PTEX */
-#ifdef MACH64_PREMULT_TEXCOORDS
- LE32_OUT_FLOAT( p++, w*tc0[0][0] ); /* VERTEX_?_S */
- LE32_OUT_FLOAT( p++, w*tc0[0][1] ); /* VERTEX_?_T */
- LE32_OUT_FLOAT( p++, w ); /* VERTEX_?_W */
-#else /* !MACH64_PREMULT_TEXCOORDS */
- LE32_OUT_FLOAT( p++, tc0[0][0] ); /* VERTEX_?_S */
- LE32_OUT_FLOAT( p++, tc0[0][1] ); /* VERTEX_?_T */
- LE32_OUT_FLOAT( p++, w ); /* VERTEX_?_W */
-#endif /* !MACH64_PREMULT_TEXCOORDS */
-#if DO_PTEX
- }
-#endif /* DO_PTEX */
- STRIDE_4F(tc0, tc0_stride);
-#else /* !DO_TEX0 */
- p += 3;
-#endif /* !DO_TEX0 */
-
-#if DO_SPEC
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[0], spec[0][2]); /* VERTEX_?_SPEC_B */
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[1], spec[0][1]); /* VERTEX_?_SPEC_G */
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[2], spec[0][0]); /* VERTEX_?_SPEC_R */
-
- STRIDE_4F(spec, spec_stride);
-#endif
-#if DO_FOG
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[3], fog[0][0]); /* VERTEX_?_SPEC_A */
- /* ((GLubyte *)p)[3] = fog[0][0] * 255.0; */
- STRIDE_4F(fog, fog_stride);
-#endif
- p++;
-
-#if DO_XYZW
- if (mask[i] == 0) {
- /* unclipped */
- LE32_OUT( p++, VIEWPORT_Z( coord[0][2] ) ); /* VERTEX_?_Z */
- } else {
-#endif
- p++;
-#if DO_XYZW
- }
-#endif
-
-#if DO_RGBA
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[0], col[0][2]);
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[1], col[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[2], col[0][0]);
- UNCLAMPED_FLOAT_TO_UBYTE(((GLubyte *)p)[3], col[0][3]);
- p++;
- STRIDE_4F(col, col_stride);
-#else
- p++;
-#endif
-
-#if DO_XYZW
- if (mask[i] == 0) {
- /* unclipped */
- LE32_OUT( p,
- (VIEWPORT_X( coord[0][0] ) << 16) | /* VERTEX_?_X */
- (VIEWPORT_Y( coord[0][1] ) & 0xffff) ); /* VERTEX_?_Y */
-
- if (MACH64_DEBUG & DEBUG_VERBOSE_PRIMS) {
- fprintf( stderr, "%s: vert %d: %.2f %.2f %.2f %x\n",
- __FUNCTION__,
- i,
- (LE32_IN( p ) >> 16)/4.0,
- (LE32_IN( p ) & 0xffff)/4.0,
- LE32_IN( p - 2 )/65536.0,
- *(GLuint *)(p - 1) );
- }
- }
-#endif
-#if DO_TEX1 || DO_TEX0 || DO_XYZW
- STRIDE_4F(coord, coord_stride);
-#endif
-
- assert( p + 1 - (CARD32 *)v == 10 );
- }
-}
-
-#if DO_XYZW && DO_RGBA
-
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- /* Force 'missing' texcoords to something valid.
- */
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
-
- if (DO_PTEX)
- return GL_TRUE;
-
- /* No hardware support for projective texture. Can fake it for
- * TEX0 only.
- */
- if ((DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) {
- PTEX_FALLBACK();
- return GL_FALSE;
- }
-
- if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) {
- if (DO_TEX1) {
- PTEX_FALLBACK();
- }
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static void TAG(interp)( GLcontext *ctx,
- GLfloat t,
- GLuint edst, GLuint eout, GLuint ein,
- GLboolean force_boundary )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte *ddverts = GET_VERTEX_STORE();
- GLuint size = GET_VERTEX_SIZE();
- const GLfloat *dstclip = VB->ClipPtr->data[edst];
- GLfloat w;
- const GLfloat *s = GET_VIEWPORT_MAT();
-
- CARD32 *dst = (CARD32 *)(ddverts + (edst * size));
- CARD32 *in = (CARD32 *)(ddverts + (ein * size));
- CARD32 *out = (CARD32 *)(ddverts + (eout * size));
-
- (void)s;
-
- w = (dstclip[3] == 0.0F) ? 1.0 : (1.0 / dstclip[3]);
-
-#if DO_TEX1
- {
- GLfloat temp;
-#if DO_PTEX
- GLfloat wout = VB->NdcPtr->data[eout][3];
- GLfloat win = VB->NdcPtr->data[ein][3];
- GLfloat qout = LE32_IN_FLOAT( out + 2 ) / wout;
- GLfloat qin = LE32_IN_FLOAT( in + 2 ) / win;
- GLfloat qdst, rqdst;
-
- INTERP_F( t, qdst, qout, qin );
- rqdst = 1.0 / qdst;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp*rqdst ); /* VERTEX_?_SECONDARY_S */
- dst++; out++; in++;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp*rqdst ); /* VERTEX_?_SECONDARY_T */
- dst++; out++; in++;
-
- LE32_OUT_FLOAT( dst, w*rqdst ); /* VERTEX_?_SECONDARY_W */
- dst++; out++; in++;
-#else /* !DO_PTEX */
-#ifdef MACH64_PREMULT_TEXCOORDS
- GLfloat qout = w / LE32_IN_FLOAT( out + 2 );
- GLfloat qin = w / LE32_IN_FLOAT( in + 2 );
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_SECONDARY_S */
- dst++; out++; in++;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_SECONDARY_T */
- dst++; out++; in++;
-#else /* !MACH64_PREMULT_TEXCOORDS */
- INTERP_F( t, temp, LE32_IN_FLOAT( out ), LE32_IN_FLOAT( in ) );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_SECONDARY_S */
- dst++; out++; in++;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ), LE32_IN_FLOAT( in ) );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_SECONDARY_T */
- dst++; out++; in++;
-#endif /* !MACH64_PREMULT_TEXCOORDS */
- LE32_OUT_FLOAT( dst, w ); /* VERTEX_?_SECONDARY_W */
- dst++; out++; in++;
-#endif /* !DO_PTEX */
- }
-#else /* !DO_TEX1 */
- dst += 3; out += 3; in += 3;
-#endif /* !DO_TEX1 */
-
-#if DO_TEX0
- {
- GLfloat temp;
-#if DO_PTEX
- GLfloat wout = VB->NdcPtr->data[eout][3];
- GLfloat win = VB->NdcPtr->data[ein][3];
- GLfloat qout = LE32_IN_FLOAT( out + 2 ) / wout;
- GLfloat qin = LE32_IN_FLOAT( in + 2 ) / win;
- GLfloat qdst, rqdst;
-
- INTERP_F( t, qdst, qout, qin );
- rqdst = 1.0 / qdst;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp*rqdst ); /* VERTEX_?_S */
- dst++; out++; in++;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp*rqdst ); /* VERTEX_?_T */
- dst++; out++; in++;
-
- LE32_OUT_FLOAT( dst, w*rqdst ); /* VERTEX_?_W */
- dst++; out++; in++;
-#else /* !DO_PTEX */
-#ifdef MACH64_PREMULT_TEXCOORDS
- GLfloat qout = w / LE32_IN_FLOAT( out + 2 );
- GLfloat qin = w / LE32_IN_FLOAT( in + 2 );
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_S */
- dst++; out++; in++;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ) * qout, LE32_IN_FLOAT( in ) * qin );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_T */
- dst++; out++; in++;
-#else /* !MACH64_PREMULT_TEXCOORDS */
- INTERP_F( t, temp, LE32_IN_FLOAT( out ), LE32_IN_FLOAT( in ) );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_S */
- dst++; out++; in++;
-
- INTERP_F( t, temp, LE32_IN_FLOAT( out ), LE32_IN_FLOAT( in ) );
- LE32_OUT_FLOAT( dst, temp ); /* VERTEX_?_T */
- dst++; out++; in++;
-#endif /* !MACH64_PREMULT_TEXCOORDS */
- LE32_OUT_FLOAT( dst, w ); /* VERTEX_?_W */
- dst++; out++; in++;
-#endif /* !DO_PTEX */
- }
-#else /* !DO_TEX0 */
- dst += 3; out += 3; in += 3;
-#endif /* !DO_TEX0 */
-
-#if DO_SPEC
- INTERP_UB( t, ((GLubyte *)dst)[0], ((GLubyte *)out)[0], ((GLubyte *)in)[0] ); /* VERTEX_?_SPEC_B */
- INTERP_UB( t, ((GLubyte *)dst)[1], ((GLubyte *)out)[1], ((GLubyte *)in)[1] ); /* VERTEX_?_SPEC_G */
- INTERP_UB( t, ((GLubyte *)dst)[2], ((GLubyte *)out)[2], ((GLubyte *)in)[2] ); /* VERTEX_?_SPEC_R */
-#endif
-
-#if DO_FOG
- INTERP_UB( t, ((GLubyte *)dst)[3], ((GLubyte *)out)[3], ((GLubyte *)in)[3] ); /* VERTEX_?_SPEC_A */
-#endif /* DO_FOG */
-
- dst++; out++; in++;
-
- LE32_OUT( dst, VIEWPORT_Z( dstclip[2] * w ) ); /* VERTEX_?_Z */
- dst++; out++; in++;
-
- INTERP_UB( t, ((GLubyte *)dst)[0], ((GLubyte *)out)[0], ((GLubyte *)in)[0] ); /* VERTEX_?_B */
- INTERP_UB( t, ((GLubyte *)dst)[1], ((GLubyte *)out)[1], ((GLubyte *)in)[1] ); /* VERTEX_?_G */
- INTERP_UB( t, ((GLubyte *)dst)[2], ((GLubyte *)out)[2], ((GLubyte *)in)[2] ); /* VERTEX_?_R */
- INTERP_UB( t, ((GLubyte *)dst)[3], ((GLubyte *)out)[3], ((GLubyte *)in)[3] ); /* VERTEX_?_A */
- dst++; /*out++; in++;*/
-
- LE32_OUT( dst,
- (VIEWPORT_X( dstclip[0] * w ) << 16) | /* VERTEX_?_X */
- (VIEWPORT_Y( dstclip[1] * w ) & 0xffff) ); /* VERTEX_?_Y */
-
- assert( dst + 1 - (CARD32 *)(ddverts + (edst * size)) == 10 );
- assert( in + 2 - (CARD32 *)(ddverts + (ein * size)) == 10 );
- assert( out + 2 - (CARD32 *)(ddverts + (eout * size)) == 10 );
-
- if (MACH64_DEBUG & DEBUG_VERBOSE_PRIMS) {
- fprintf( stderr, "%s: dst vert: %.2f %.2f %.2f %x\n",
- __FUNCTION__,
- (GLshort)(LE32_IN( dst ) >> 16)/4.0,
- (GLshort)(LE32_IN( dst ) & 0xffff)/4.0,
- LE32_IN( dst - 2 )/65536.0,
- *(GLuint *)(dst - 1) );
- }
-}
-
-#endif /* DO_RGBA && DO_XYZW */
-
-
-static void TAG(copy_pv)( GLcontext *ctx, GLuint edst, GLuint esrc )
-{
-#if DO_SPEC || DO_FOG || DO_RGBA
- LOCALVARS
- GLubyte *verts = GET_VERTEX_STORE();
- GLuint size = GET_VERTEX_SIZE();
- GLuint *dst = (GLuint *)(verts + (edst * size));
- GLuint *src = (GLuint *)(verts + (esrc * size));
-#endif
-
-#if DO_SPEC || DO_FOG
- dst[6] = src[6]; /* VERTEX_?_SPEC_ARGB */
-#endif
-
-#if DO_RGBA
- dst[8] = src[8]; /* VERTEX_?_ARGB */
-#endif
-}
-
-static void TAG(init)( void )
-{
- setup_tab[IND].emit = TAG(emit);
-
-#if DO_XYZW && DO_RGBA
- setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes);
- setup_tab[IND].interp = TAG(interp);
-#endif
-
- setup_tab[IND].copy_pv = TAG(copy_pv);
-
-#if DO_TEX1
- setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 10;
-#elif DO_TEX0
- setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 7;
-#elif DO_SPEC || DO_FOG
- setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 4;
-#else
- setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 3;
-#endif
-
-}
-
-
-#undef IND
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_reg.h
deleted file mode 100644
index abbba295a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_reg.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#ifndef __MACH64_REG_H__
-#define __MACH64_REG_H__
-
-/*
- * Not sure how this compares with the G200, but the Rage Pro has two
- * banks of registers, with bank 0 at (aperture base + memmap offset - 1KB)
- * and bank 1 at (aperture base + memmap offset - 2KB). But, to send them
- * via DMA, we need to encode them as memory map select rather than physical
- * offsets.
- */
-#define DWMREG0 0x0400
-#define DWMREG0_END 0x07ff
-#define DWMREG1 0x0000
-#define DWMREG1_END 0x03ff
-
-#define ISREG0(r) ( ( (r) >= DWMREG0 ) && ( (r) <= DWMREG0_END ) )
-#define ADRINDEX0(r) ( ((r) - DWMREG0) >> 2 )
-#define ADRINDEX1(r) ( ( ((r) - DWMREG1) >> 2 ) | 0x0100 )
-#define ADRINDEX(r) ( ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r) )
-
-#define MMREG0 0x0000
-#define MMREG0_END 0x00ff
-
-#define ISMMREG0(r) ( ( (r) >= MMREG0 ) && ( (r) <= MMREG0_END ) )
-#define MMSELECT0(r) ( ((r)<<2) + DWMREG0 )
-#define MMSELECT1(r) ( ( (((r) & 0xff)<<2) + DWMREG1 ) )
-#define MMSELECT(r) ( ISMMREG0(r) ? MMSELECT0(r) : MMSELECT1(r) )
-
-/* FIXME: If register reads are necessary, we should account for endianess here */
-#define MACH64_BASE(reg) ((CARD32)(mmesa->mach64Screen->mmio.map))
-#define MACH64_ADDR(reg) (MACH64_BASE(reg) + reg)
-
-#define MACH64_DEREF(reg) *(__volatile__ CARD32 *)MACH64_ADDR(reg)
-#define MACH64_READ(reg) MACH64_DEREF(reg)
-
-
-/* ================================================================
- * Registers
- */
-
-#define MACH64_ALPHA_TST_CNTL 0x0550
-# define MACH64_ALPHA_TEST_EN (1 << 0)
-# define MACH64_ALPHA_TEST_MASK (7 << 4)
-# define MACH64_ALPHA_TEST_NEVER (0 << 4)
-# define MACH64_ALPHA_TEST_LESS (1 << 4)
-# define MACH64_ALPHA_TEST_LEQUAL (2 << 4)
-# define MACH64_ALPHA_TEST_EQUAL (3 << 4)
-# define MACH64_ALPHA_TEST_GEQUAL (4 << 4)
-# define MACH64_ALPHA_TEST_GREATER (5 << 4)
-# define MACH64_ALPHA_TEST_NOTEQUAL (6 << 4)
-# define MACH64_ALPHA_TEST_ALWAYS (7 << 4)
-# define MACH64_ALPHA_MOD_MSB (1 << 7)
-# define MACH64_ALPHA_DST_MASK (7 << 8)
-# define MACH64_ALPHA_DST_ZERO (0 << 8)
-# define MACH64_ALPHA_DST_ONE (1 << 8)
-# define MACH64_ALPHA_DST_SRCALPHA (4 << 8)
-# define MACH64_ALPHA_DST_INVSRCALPHA (5 << 8)
-# define MACH64_ALPHA_DST_DSTALPHA (6 << 8)
-# define MACH64_ALPHA_DST_INVDSTALPHA (7 << 8)
-# define MACH64_ALPHA_TST_SRC_TEXEL (0 << 12)
-# define MACH64_ALPHA_TST_SRC_SRCALPHA (1 << 12)
-# define MACH64_REF_ALPHA_MASK (0xff << 16)
-# define MACH64_REF_ALPHA_SHIFT 16
-# define MACH64_COMPOSITE_SHADOW (1 << 30)
-# define MACH64_SPECULAR_LIGHT_EN (1 << 31)
-
-#define MACH64_BUS_CNTL 0x04a0
-# define MACH64_BUS_MSTR_RESET (1 << 1)
-# define MACH64_BUS_FLUSH_BUF (1 << 2)
-# define MACH64_BUS_MASTER_DIS (1 << 6)
-# define MACH64_BUS_EXT_REG_EN (1 << 27)
-
-#define MACH64_COMPOSITE_SHADOW_ID 0x0798
-
-#define MACH64_CLR_CMP_CLR 0x0700
-#define MACH64_CLR_CMP_CNTL 0x0708
-#define MACH64_CLR_CMP_MASK 0x0704
-
-#define MACH64_DP_BKGD_CLR 0x06c0
-#define MACH64_DP_FOG_CLR 0x06c4
-#define MACH64_DP_FGRD_BKGD_CLR 0x06e0
-#define MACH64_DP_FRGD_CLR 0x06c4
-#define MACH64_DP_FGRD_CLR_MIX 0x06dc
-
-#define MACH64_DP_MIX 0x06d4
-# define BKGD_MIX_NOT_D (0 << 0)
-# define BKGD_MIX_ZERO (1 << 0)
-# define BKGD_MIX_ONE (2 << 0)
-# define MACH64_BKGD_MIX_D (3 << 0)
-# define BKGD_MIX_NOT_S (4 << 0)
-# define BKGD_MIX_D_XOR_S (5 << 0)
-# define BKGD_MIX_NOT_D_XOR_S (6 << 0)
-# define MACH64_BKGD_MIX_S (7 << 0)
-# define BKGD_MIX_NOT_D_OR_NOT_S (8 << 0)
-# define BKGD_MIX_D_OR_NOT_S (9 << 0)
-# define BKGD_MIX_NOT_D_OR_S (10 << 0)
-# define BKGD_MIX_D_OR_S (11 << 0)
-# define BKGD_MIX_D_AND_S (12 << 0)
-# define BKGD_MIX_NOT_D_AND_S (13 << 0)
-# define BKGD_MIX_D_AND_NOT_S (14 << 0)
-# define BKGD_MIX_NOT_D_AND_NOT_S (15 << 0)
-# define BKGD_MIX_D_PLUS_S_DIV2 (23 << 0)
-# define FRGD_MIX_NOT_D (0 << 16)
-# define FRGD_MIX_ZERO (1 << 16)
-# define FRGD_MIX_ONE (2 << 16)
-# define FRGD_MIX_D (3 << 16)
-# define FRGD_MIX_NOT_S (4 << 16)
-# define FRGD_MIX_D_XOR_S (5 << 16)
-# define FRGD_MIX_NOT_D_XOR_S (6 << 16)
-# define MACH64_FRGD_MIX_S (7 << 16)
-# define FRGD_MIX_NOT_D_OR_NOT_S (8 << 16)
-# define FRGD_MIX_D_OR_NOT_S (9 << 16)
-# define FRGD_MIX_NOT_D_OR_S (10 << 16)
-# define FRGD_MIX_D_OR_S (11 << 16)
-# define FRGD_MIX_D_AND_S (12 << 16)
-# define FRGD_MIX_NOT_D_AND_S (13 << 16)
-# define FRGD_MIX_D_AND_NOT_S (14 << 16)
-# define FRGD_MIX_NOT_D_AND_NOT_S (15 << 16)
-# define FRGD_MIX_D_PLUS_S_DIV2 (23 << 16)
-
-#define MACH64_DP_PIX_WIDTH 0x06d0
-# define MACH64_COMPOSITE_PIX_WIDTH_MASK (0xf << 4)
-# define MACH64_HOST_TRIPLE_ENABLE (1 << 13)
-# define MACH64_BYTE_ORDER_MSB_TO_LSB (0 << 24)
-# define MACH64_BYTE_ORDER_LSB_TO_MSB (1 << 24)
-# define MACH64_SCALE_PIX_WIDTH_MASK (0xf << 28)
-
-#define MACH64_DP_SRC 0x06d8
-# define MACH64_BKGD_SRC_BKGD_CLR (0 << 0)
-# define MACH64_BKGD_SRC_FRGD_CLR (1 << 0)
-# define MACH64_BKGD_SRC_HOST (2 << 0)
-# define MACH64_BKGD_SRC_BLIT (3 << 0)
-# define MACH64_BKGD_SRC_PATTERN (4 << 0)
-# define MACH64_BKGD_SRC_3D (5 << 0)
-# define MACH64_FRGD_SRC_BKGD_CLR (0 << 8)
-# define MACH64_FRGD_SRC_FRGD_CLR (1 << 8)
-# define MACH64_FRGD_SRC_HOST (2 << 8)
-# define MACH64_FRGD_SRC_BLIT (3 << 8)
-# define MACH64_FRGD_SRC_PATTERN (4 << 8)
-# define MACH64_FRGD_SRC_3D (5 << 8)
-# define MACH64_MONO_SRC_ONE (0 << 16)
-# define MACH64_MONO_SRC_PATTERN (1 << 16)
-# define MACH64_MONO_SRC_HOST (2 << 16)
-# define MACH64_MONO_SRC_BLIT (3 << 16)
-
-#define MACH64_DP_WRITE_MASK 0x06c8
-
-#define MACH64_DST_CNTL 0x0530
-# define MACH64_DST_X_RIGHT_TO_LEFT (0 << 0)
-# define MACH64_DST_X_LEFT_TO_RIGHT (1 << 0)
-# define MACH64_DST_Y_BOTTOM_TO_TOP (0 << 1)
-# define MACH64_DST_Y_TOP_TO_BOTTOM (1 << 1)
-# define MACH64_DST_X_MAJOR (0 << 2)
-# define MACH64_DST_Y_MAJOR (1 << 2)
-# define MACH64_DST_X_TILE (1 << 3)
-# define MACH64_DST_Y_TILE (1 << 4)
-# define MACH64_DST_LAST_PEL (1 << 5)
-# define MACH64_DST_POLYGON_ENABLE (1 << 6)
-# define MACH64_DST_24_ROTATION_ENABLE (1 << 7)
-
-#define MACH64_DST_HEIGHT_WIDTH 0x0518
-#define MACH64_DST_OFF_PITCH 0x0500
-#define MACH64_DST_WIDTH_HEIGHT 0x06ec
-#define MACH64_DST_X_Y 0x06e8
-#define MACH64_DST_Y_X 0x050c
-
-#define MACH64_FIFO_STAT 0x0710
-# define MACH64_FIFO_SLOT_MASK 0x0000ffff
-# define MACH64_FIFO_ERR (1 << 31)
-
-#define MACH64_GEN_TEST_CNTL 0x04d0
-#define MACH64_GUI_CMDFIFO_DEBUG 0x0170
-#define MACH64_GUI_CMDFIFO_DATA 0x0174
-#define MACH64_GUI_CNTL 0x0178
-#define MACH64_GUI_STAT 0x0738
-# define MACH64_GUI_ACTIVE (1 << 0)
-#define MACH64_GUI_TRAJ_CNTL 0x0730
-
-#define MACH64_HOST_CNTL 0x0640
-#define MACH64_HOST_DATA0 0x0600
-#define MACH64_HW_DEBUG 0x047c
-
-#define MACH64_ONE_OVER_AREA 0x029c
-#define MACH64_ONE_OVER_AREA_UC 0x0300
-
-#define MACH64_PAT_REG0 0x0680
-#define MACH64_PAT_REG1 0x0684
-
-#define MACH64_SC_LEFT_RIGHT 0x06a8
-#define MACH64_SC_TOP_BOTTOM 0x06b4
-#define MACH64_SCALE_3D_CNTL 0x05fc
-# define MACH64_SCALE_PIX_EXPAND_ZERO_EXTEND (0 << 0)
-# define MACH64_SCALE_PIX_EXPAND_DYNAMIC_RANGE (1 << 0)
-# define MACH64_SCALE_DITHER_ERROR_DIFFUSE (0 << 1)
-# define MACH64_SCALE_DITHER_2D_TABLE (1 << 1)
-# define MACH64_DITHER_EN (1 << 2)
-# define MACH64_DITHER_INIT_CURRENT (O << 3)
-# define MACH64_DITHER_INIT_RESET (1 << 3)
-# define MACH64_ROUND_EN (1 << 4)
-# define MACH64_TEX_CACHE_DIS (1 << 5)
-# define MACH64_SCALE_3D_FCN_MASK (3 << 6)
-# define MACH64_SCALE_3D_FCN_NOP (0 << 6)
-# define MACH64_SCALE_3D_FCN_SCALE (1 << 6)
-# define MACH64_SCALE_3D_FCN_TEXTURE (2 << 6)
-# define MACH64_SCALE_3D_FCN_SHADE (3 << 6)
-# define MACH64_TEXTURE_DISABLE (1 << 6)
-# define MACH64_EDGE_ANTI_ALIAS (1 << 8)
-# define MACH64_TEX_CACHE_SPLIT (1 << 9)
-# define MACH64_APPLE_YUV_MODE (1 << 10)
-# define MACH64_ALPHA_FOG_EN_MASK (3 << 11)
-# define MACH64_ALPHA_FOG_DIS (0 << 11)
-# define MACH64_ALPHA_FOG_EN_ALPHA (1 << 11)
-# define MACH64_ALPHA_FOG_EN_FOG (2 << 11)
-# define MACH64_ALPHA_BLEND_SAT (1 << 13)
-# define MACH64_RED_DITHER_MAX (1 << 14)
-# define MACH64_SIGNED_DST_CLAMP (1 << 15)
-# define MACH64_ALPHA_BLEND_SRC_MASK (7 << 16)
-# define MACH64_ALPHA_BLEND_SRC_ZERO (0 << 16)
-# define MACH64_ALPHA_BLEND_SRC_ONE (1 << 16)
-# define MACH64_ALPHA_BLEND_SRC_DSTCOLOR (2 << 16)
-# define MACH64_ALPHA_BLEND_SRC_INVDSTCOLOR (3 << 16)
-# define MACH64_ALPHA_BLEND_SRC_SRCALPHA (4 << 16)
-# define MACH64_ALPHA_BLEND_SRC_INVSRCALPHA (5 << 16)
-# define MACH64_ALPHA_BLEND_SRC_DSTALPHA (6 << 16)
-# define MACH64_ALPHA_BLEND_SRC_INVDSTALPHA (7 << 16)
-# define MACH64_ALPHA_BLEND_DST_MASK (7 << 19)
-# define MACH64_ALPHA_BLEND_DST_ZERO (0 << 19)
-# define MACH64_ALPHA_BLEND_DST_ONE (1 << 19)
-# define MACH64_ALPHA_BLEND_DST_SRCCOLOR (2 << 19)
-# define MACH64_ALPHA_BLEND_DST_INVSRCCOLOR (3 << 19)
-# define MACH64_ALPHA_BLEND_DST_SRCALPHA (4 << 19)
-# define MACH64_ALPHA_BLEND_DST_INVSRCALPHA (5 << 19)
-# define MACH64_ALPHA_BLEND_DST_DSTALPHA (6 << 19)
-# define MACH64_ALPHA_BLEND_DST_INVDSTALPHA (7 << 19)
-# define MACH64_TEX_LIGHT_FCN_MASK (3 << 22)
-# define MACH64_TEX_LIGHT_FCN_REPLACE (0 << 22)
-# define MACH64_TEX_LIGHT_FCN_MODULATE (1 << 22)
-# define MACH64_TEX_LIGHT_FCN_ALPHA_DECAL (2 << 22)
-# define MACH64_MIP_MAP_DISABLE (1 << 24)
-# define MACH64_BILINEAR_TEX_EN (1 << 25)
-# define MACH64_TEX_BLEND_FCN_MASK (3 << 26)
-# define MACH64_TEX_BLEND_FCN_NEAREST (0 << 26)
-# define MACH64_TEX_BLEND_FCN_LINEAR (2 << 26)
-# define MACH64_TEX_BLEND_FCN_TRILINEAR (3 << 26)
-# define MACH64_TEX_AMASK_AEN (1 << 28)
-# define MACH64_TEX_AMASK_BLEND_EDGE (1 << 29)
-# define MACH64_TEX_MAP_AEN (1 << 30)
-# define MACH64_SRC_3D_HOST_FIFO (1 << 31)
-#define MACH64_SCRATCH_REG0 0x0480
-#define MACH64_SCRATCH_REG1 0x0484
-#define MACH64_SECONDARY_TEX_OFF 0x0778
-#define MACH64_SETUP_CNTL 0x0304
-# define MACH64_DONT_START_TRI (1 << 0)
-# define MACH64_DONT_START_ANY (1 << 2)
-# define MACH64_FLAT_SHADE_MASK (3 << 3)
-# define MACH64_FLAT_SHADE_OFF (0 << 3)
-# define MACH64_FLAT_SHADE_VERTEX_1 (1 << 3)
-# define MACH64_FLAT_SHADE_VERTEX_2 (2 << 3)
-# define MACH64_FLAT_SHADE_VERTEX_3 (3 << 3)
-# define MACH64_SOLID_MODE_OFF (0 << 5)
-# define MACH64_SOLID_MODE_ON (1 << 5)
-# define MACH64_LOG_MAX_INC_ADJ (1 << 6)
-# define MACH64_SET_UP_CONTINUE (1 << 31)
-#define MACH64_SRC_CNTL 0x05b4
-#define MACH64_SRC_HEIGHT1 0x0594
-#define MACH64_SRC_HEIGHT2 0x05ac
-#define MACH64_SRC_HEIGHT1_WIDTH1 0x0598
-#define MACH64_SRC_HEIGHT2_WIDTH2 0x05b0
-#define MACH64_SRC_OFF_PITCH 0x0580
-#define MACH64_SRC_WIDTH1 0x0590
-#define MACH64_SRC_Y_X 0x058c
-
-#define MACH64_TEX_0_OFF 0x05c0
-#define MACH64_TEX_CNTL 0x0774
-# define MACH64_LOD_BIAS_SHIFT 0
-# define MACH64_LOD_BIAS_MASK (0xf << 0)
-# define MACH64_COMP_FACTOR_SHIFT 4
-# define MACH64_COMP_FACTOR_MASK (0xf << 4)
-# define MACH64_TEXTURE_COMPOSITE (1 << 8)
-# define MACH64_COMP_COMBINE_BLEND (0 << 9)
-# define MACH64_COMP_COMBINE_MODULATE (1 << 9)
-# define MACH64_COMP_BLEND_NEAREST (0 << 11)
-# define MACH64_COMP_BLEND_BILINEAR (1 << 11)
-# define MACH64_COMP_FILTER_NEAREST (0 << 12)
-# define MACH64_COMP_FILTER_BILINEAR (1 << 12)
-# define MACH64_COMP_ALPHA (1 << 13)
-# define MACH64_TEXTURE_TILING (1 << 14)
-# define MACH64_COMPOSITE_TEX_TILING (1 << 15)
-# define MACH64_TEX_COLLISION_DISABLE (1 << 16)
-# define MACH64_TEXTURE_CLAMP_S (1 << 17)
-# define MACH64_TEXTURE_CLAMP_T (1 << 18)
-# define MACH64_TEX_ST_MULT_W (0 << 19)
-# define MACH64_TEX_ST_DIRECT (1 << 19)
-# define MACH64_TEX_SRC_LOCAL (0 << 20)
-# define MACH64_TEX_SRC_AGP (1 << 20)
-# define MACH64_TEX_UNCOMPRESSED (0 << 21)
-# define MACH64_TEX_VQ_COMPRESSED (1 << 21)
-# define MACH64_COMP_TEX_UNCOMPRESSED (0 << 22)
-# define MACH64_COMP_TEX_VQ_COMPRESSED (1 << 22)
-# define MACH64_TEX_CACHE_FLUSH (1 << 23)
-# define MACH64_SEC_TEX_CLAMP_S (1 << 24)
-# define MACH64_SEC_TEX_CLAMP_T (1 << 25)
-# define MACH64_TEX_WRAP_S (1 << 28)
-# define MACH64_TEX_WRAP_T (1 << 29)
-# define MACH64_TEX_CACHE_SIZE_4K (1 << 30)
-# define MACH64_TEX_CACHE_SIZE_2K (1 << 30)
-# define MACH64_SECONDARY_STW (1 << 31)
-#define MACH64_TEX_PALETTE 0x077c
-#define MACH64_TEX_PALETTE_INDEX 0x0740
-#define MACH64_TEX_SIZE_PITCH 0x0770
-
-#define MACH64_VERTEX_1_ARGB 0x0254
-#define MACH64_VERTEX_1_S 0x0240
-#define MACH64_VERTEX_1_SECONDARY_S 0x0328
-#define MACH64_VERTEX_1_SECONDARY_T 0x032c
-#define MACH64_VERTEX_1_SECONDARY_W 0x0330
-#define MACH64_VERTEX_1_SPEC_ARGB 0x024c
-#define MACH64_VERTEX_1_T 0x0244
-#define MACH64_VERTEX_1_W 0x0248
-#define MACH64_VERTEX_1_X_Y 0x0258
-#define MACH64_VERTEX_1_Z 0x0250
-#define MACH64_VERTEX_2_ARGB 0x0274
-#define MACH64_VERTEX_2_S 0x0260
-#define MACH64_VERTEX_2_SECONDARY_S 0x0334
-#define MACH64_VERTEX_2_SECONDARY_T 0x0338
-#define MACH64_VERTEX_2_SECONDARY_W 0x033c
-#define MACH64_VERTEX_2_SPEC_ARGB 0x026c
-#define MACH64_VERTEX_2_T 0x0264
-#define MACH64_VERTEX_2_W 0x0268
-#define MACH64_VERTEX_2_X_Y 0x0278
-#define MACH64_VERTEX_2_Z 0x0270
-#define MACH64_VERTEX_3_ARGB 0x0294
-#define MACH64_VERTEX_3_S 0x0280
-#define MACH64_VERTEX_3_SECONDARY_S 0x02a0
-#define MACH64_VERTEX_3_SECONDARY_T 0x02a4
-#define MACH64_VERTEX_3_SECONDARY_W 0x02a8
-#define MACH64_VERTEX_3_SPEC_ARGB 0x028c
-#define MACH64_VERTEX_3_T 0x0284
-#define MACH64_VERTEX_3_W 0x0288
-#define MACH64_VERTEX_3_X_Y 0x0298
-#define MACH64_VERTEX_3_Z 0x0290
-
-#define MACH64_Z_CNTL 0x054c
-# define MACH64_Z_EN (1 << 0)
-# define MACH64_Z_SRC_2D (1 << 1)
-# define MACH64_Z_TEST_MASK (7 << 4)
-# define MACH64_Z_TEST_NEVER (0 << 4)
-# define MACH64_Z_TEST_LESS (1 << 4)
-# define MACH64_Z_TEST_LEQUAL (2 << 4)
-# define MACH64_Z_TEST_EQUAL (3 << 4)
-# define MACH64_Z_TEST_GEQUAL (4 << 4)
-# define MACH64_Z_TEST_GREATER (5 << 4)
-# define MACH64_Z_TEST_NOTEQUAL (6 << 4)
-# define MACH64_Z_TEST_ALWAYS (7 << 4)
-# define MACH64_Z_MASK_EN (1 << 8)
-#define MACH64_Z_OFF_PITCH 0x0548
-
-
-
-#define MACH64_DATATYPE_CI8 2
-#define MACH64_DATATYPE_ARGB1555 3
-#define MACH64_DATATYPE_RGB565 4
-#define MACH64_DATATYPE_ARGB8888 6
-#define MACH64_DATATYPE_RGB332 7
-#define MACH64_DATATYPE_Y8 8
-#define MACH64_DATATYPE_RGB8 9
-#define MACH64_DATATYPE_VYUY422 11
-#define MACH64_DATATYPE_YVYU422 12
-#define MACH64_DATATYPE_AYUV444 14
-#define MACH64_DATATYPE_ARGB4444 15
-
-#define MACH64_LAST_FRAME_REG MACH64_PAT_REG0
-#define MACH64_LAST_DISPATCH_REG MACH64_PAT_REG1
-
-#endif /* __MACH64_REG_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.c
deleted file mode 100644
index 3403434a5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "mach64_context.h"
-#include "mach64_ioctl.h"
-#include "mach64_tris.h"
-#include "mach64_vb.h"
-#include "mach64_span.h"
-
-#include "context.h"
-#include "imports.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#include "utils.h"
-#include "vblank.h"
-
-#include "GL/internal/dri_interface.h"
-
-/* Mach64 configuration
- */
-#include "xmlpool.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
-#if ENABLE_PERF_BOXES
- DRI_CONF_PERFORMANCE_BOXES(false)
-#endif
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-#if ENABLE_PERF_BOXES
-static const GLuint __driNConfigOptions = 3;
-#else
-static const GLuint __driNConfigOptions = 2;
-#endif
-
-extern const struct dri_extension card_extensions[];
-
-static __GLcontextModes * fill_in_modes( __GLcontextModes * modes,
- unsigned pixel_bits,
- unsigned depth_bits,
- unsigned stencil_bits,
- const GLenum * db_modes,
- unsigned num_db_modes,
- int visType )
-{
- static const u_int8_t bits[2][4] = {
- { 5, 6, 5, 0 },
- { 8, 8, 8, 0 }
- };
-
- static const u_int32_t masks[2][4] = {
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 },
- { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }
- };
-
- unsigned i;
- unsigned j;
- const unsigned index = ((pixel_bits + 15) / 16) - 1;
-
- for ( i = 0 ; i < num_db_modes ; i++ ) {
- for ( j = 0 ; j < 2 ; j++ ) {
-
- modes->redBits = bits[index][0];
- modes->greenBits = bits[index][1];
- modes->blueBits = bits[index][2];
- modes->alphaBits = bits[index][3];
- modes->redMask = masks[index][0];
- modes->greenMask = masks[index][1];
- modes->blueMask = masks[index][2];
- modes->alphaMask = masks[index][3];
- modes->rgbBits = modes->redBits + modes->greenBits
- + modes->blueBits + modes->alphaBits;
-
- modes->accumRedBits = 16 * j;
- modes->accumGreenBits = 16 * j;
- modes->accumBlueBits = 16 * j;
- modes->accumAlphaBits = 0;
- modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG;
- modes->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
- modes->stencilBits = stencil_bits;
- modes->depthBits = depth_bits;
-
- modes->visualType = visType;
- modes->renderType = GLX_RGBA_BIT;
- modes->rgbMode = GL_TRUE;
-
- if ( db_modes[i] == GLX_NONE ) {
-
- modes->doubleBufferMode = GL_FALSE;
- }
- else {
- modes->doubleBufferMode = GL_TRUE;
- modes->swapMethod = db_modes[i];
- }
-
- modes = modes->next;
- }
- }
-
- return modes;
-}
-
-
-static __GLcontextModes *
-mach64FillInModes( 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;
- unsigned i;
-
- /* 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 */
- };
-
- int depth_buffer_modes[2][2];
-
-
- depth_buffer_modes[0][0] = depth_bits;
- depth_buffer_modes[1][0] = 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.
- */
- depth_buffer_modes[0][1] = 0;
- depth_buffer_modes[1][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;
-
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR );
- }
-
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR );
- }
-
- /* 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;
-}
-
-
-/* Create the device specific screen private data struct.
- */
-static mach64ScreenRec *
-mach64CreateScreen( __DRIscreenPrivate *sPriv )
-{
- mach64ScreenPtr mach64Screen;
- ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(ATIDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_DRI )
- fprintf( stderr, "%s\n", __FUNCTION__ );
-
- /* Allocate the private area */
- mach64Screen = (mach64ScreenPtr) CALLOC( sizeof(*mach64Screen) );
- if ( !mach64Screen ) return NULL;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&mach64Screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- mach64Screen->IsPCI = serverInfo->IsPCI;
-
- {
- drm_mach64_getparam_t gp;
- int ret;
-
- gp.param = MACH64_PARAM_IRQ_NR;
- gp.value = (void *) &mach64Screen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_MACH64_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "DRM_MACH64_GETPARAM (MACH64_PARAM_IRQ_NR): %d\n", ret);
- FREE( mach64Screen );
- return NULL;
- }
- }
-
- mach64Screen->mmio.handle = serverInfo->regs;
- mach64Screen->mmio.size = serverInfo->regsSize;
- if ( drmMap( sPriv->fd,
- mach64Screen->mmio.handle,
- mach64Screen->mmio.size,
- (drmAddressPtr)&mach64Screen->mmio.map ) != 0 ) {
- FREE( mach64Screen );
- return NULL;
- }
-
- mach64Screen->buffers = drmMapBufs( sPriv->fd );
- if ( !mach64Screen->buffers ) {
- drmUnmap( (drmAddress)mach64Screen->mmio.map,
- mach64Screen->mmio.size );
- FREE( mach64Screen );
- return NULL;
- }
-
- if ( !mach64Screen->IsPCI ) {
- mach64Screen->agpTextures.handle = serverInfo->agp;
- mach64Screen->agpTextures.size = serverInfo->agpSize;
- if ( drmMap( sPriv->fd,
- mach64Screen->agpTextures.handle,
- mach64Screen->agpTextures.size,
- (drmAddressPtr)&mach64Screen->agpTextures.map ) ) {
- drmUnmapBufs( mach64Screen->buffers );
- drmUnmap( (drmAddress)mach64Screen->mmio.map, mach64Screen->mmio.size );
- FREE( mach64Screen );
- return NULL;
- }
- }
-
- mach64Screen->AGPMode = serverInfo->AGPMode;
-
- mach64Screen->chipset = serverInfo->chipset;
- mach64Screen->width = serverInfo->width;
- mach64Screen->height = serverInfo->height;
- mach64Screen->mem = serverInfo->mem;
- mach64Screen->cpp = serverInfo->cpp;
-
- mach64Screen->frontOffset = serverInfo->frontOffset;
- mach64Screen->frontPitch = serverInfo->frontPitch;
- mach64Screen->backOffset = serverInfo->backOffset;
- mach64Screen->backPitch = serverInfo->backPitch;
- mach64Screen->depthOffset = serverInfo->depthOffset;
- mach64Screen->depthPitch = serverInfo->depthPitch;
-
- mach64Screen->texOffset[MACH64_CARD_HEAP] = serverInfo->textureOffset;
- mach64Screen->texSize[MACH64_CARD_HEAP] = serverInfo->textureSize;
- mach64Screen->logTexGranularity[MACH64_CARD_HEAP] =
- serverInfo->logTextureGranularity;
-
- if ( mach64Screen->IsPCI ) {
- mach64Screen->numTexHeaps = MACH64_NR_TEX_HEAPS - 1;
- mach64Screen->firstTexHeap = MACH64_CARD_HEAP;
- mach64Screen->texOffset[MACH64_AGP_HEAP] = 0;
- mach64Screen->texSize[MACH64_AGP_HEAP] = 0;
- mach64Screen->logTexGranularity[MACH64_AGP_HEAP] = 0;
- } else {
- if (mach64Screen->texSize[MACH64_CARD_HEAP] > 0) {
- mach64Screen->numTexHeaps = MACH64_NR_TEX_HEAPS;
- mach64Screen->firstTexHeap = MACH64_CARD_HEAP;
- } else {
- mach64Screen->numTexHeaps = MACH64_NR_TEX_HEAPS - 1;
- mach64Screen->firstTexHeap = MACH64_AGP_HEAP;
- }
- mach64Screen->texOffset[MACH64_AGP_HEAP] = serverInfo->agpTextureOffset;
- mach64Screen->texSize[MACH64_AGP_HEAP] = serverInfo->agpSize;
- mach64Screen->logTexGranularity[MACH64_AGP_HEAP] = serverInfo->logAgpTextureGranularity;
- }
-
- mach64Screen->driScreen = sPriv;
-
- if ( glx_enable_extension != NULL ) {
- if ( mach64Screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- }
-
- return mach64Screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-mach64DestroyScreen( __DRIscreenPrivate *driScreen )
-{
- mach64ScreenRec *mach64Screen = (mach64ScreenRec *) driScreen->private;
-
- if ( !mach64Screen )
- return;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_DRI )
- fprintf( stderr, "%s\n", __FUNCTION__ );
-
- if ( !mach64Screen->IsPCI ) {
- drmUnmap( (drmAddress)mach64Screen->agpTextures.map,
- mach64Screen->agpTextures.size );
- }
-
- drmUnmapBufs( mach64Screen->buffers );
- drmUnmap( (drmAddress)mach64Screen->mmio.map, mach64Screen->mmio.size );
-
- FREE( mach64Screen );
- driScreen->private = NULL;
-}
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- mach64ScreenPtr screen = (mach64ScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- mach64SetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- mach64SetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- mach64SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- mach64SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-mach64DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-/* Copy the back color buffer to the front color buffer */
-static void
-mach64SwapBuffers(__DRIdrawablePrivate *dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- mach64ContextPtr mmesa;
- GLcontext *ctx;
- mmesa = (mach64ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = mmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- mach64CopyBuffer( dPriv );
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-mach64InitDriver( __DRIscreenPrivate *driScreen )
-{
- driScreen->private = (void *) mach64CreateScreen( driScreen );
-
- if ( !driScreen->private ) {
- mach64DestroyScreen( driScreen );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static struct __DriverAPIRec mach64API = {
- .InitDriver = mach64InitDriver,
- .DestroyScreen = mach64DestroyScreen,
- .CreateContext = mach64CreateContext,
- .DestroyContext = mach64DestroyContext,
- .CreateBuffer = mach64CreateBuffer,
- .DestroyBuffer = mach64DestroyBuffer,
- .SwapBuffers = mach64SwapBuffers,
- .MakeCurrent = mach64MakeCurrent,
- .UnbindContext = mach64UnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/**
- * 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 6, 4, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 0, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "Mach64",
- 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, &mach64API);
- if ( psp != NULL ) {
- ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv;
- *driver_modes = mach64FillInModes( dri_priv->cpp * 8,
- 16,
- 0,
- 1);
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.h
deleted file mode 100644
index 5305058e2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_screen.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#ifndef __MACH64_SCREEN_H__
-#define __MACH64_SCREEN_H__
-
-#include "xmlconfig.h"
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress *map; /* Mapping of the DRM region */
-} mach64RegionRec, *mach64RegionPtr;
-
-typedef struct {
- int chipset;
- int width;
- int height;
- int mem;
- int cpp;
-
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- int IsPCI;
- int AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- /* Shared Texture data */
- int firstTexHeap, numTexHeaps;
- int texOffset[MACH64_NR_TEX_HEAPS];
- int texSize[MACH64_NR_TEX_HEAPS];
- int logTexGranularity[MACH64_NR_TEX_HEAPS];
-
- mach64RegionRec mmio;
- mach64RegionRec agpTextures;
-
- drmBufMapPtr buffers;
-
- __DRIscreenPrivate *driScreen;
-
- driOptionCache optionCache;
-} mach64ScreenRec, *mach64ScreenPtr;
-
-#endif /* __MACH64_SCREEN_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.c
deleted file mode 100644
index 0ac0eeaa6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "mach64_context.h"
-#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_span.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- mach64ScreenRec *mach64Screen = mmesa->mach64Screen; \
- __DRIscreenPrivate *driScreen = mmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
- GLuint pitch = mmesa->drawPitch * mach64Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(driScreen->pFB + \
- mmesa->drawOffset + \
- (dPriv->x * mach64Screen->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(driScreen->pFB + \
- mmesa->readOffset + \
- (dPriv->x * mach64Screen->cpp) + \
- (dPriv->y * pitch)); \
- GLushort p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- mach64ScreenRec *mach64Screen = mmesa->mach64Screen; \
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
- __DRIscreenPrivate *driScreen = mmesa->driScreen; \
- GLuint pitch = mach64Screen->depthPitch * 2; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(driScreen->pFB + \
- mach64Screen->depthOffset + \
- dPriv->x * 2 + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#define HW_LOCK()
-
-/* FIXME could/should we use dPriv->numClipRects like the other drivers? */
-#define HW_CLIPLOOP() \
- do { \
- int _nc = mmesa->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = mmesa->pClipRects[_nc].x1 - mmesa->drawX; \
- int miny = mmesa->pClipRects[_nc].y1 - mmesa->drawY; \
- int maxx = mmesa->pClipRects[_nc].x2 - mmesa->drawX; \
- int maxy = mmesa->pClipRects[_nc].y2 - mmesa->drawY;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK()
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) mach64##x##_RGB565
-#define TAG2(x,y) mach64##x##_RGB565##y
-#include "spantmp2.h"
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-/* FIXME the old code always read back alpha as 0xff, i.e. fully opaque.
- Was there a reason to do so ? If so that'll won't work with that template... */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) mach64##x##_ARGB8888
-#define TAG2(x,y) mach64##x##_ARGB8888##y
-#include "spantmp2.h"
-
-
-/* ================================================================
- * Depth buffer
- */
-
-/* 16 bit depthbuffer functions.
- */
-#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) mach64##x##_16
-#include "depthtmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void mach64DDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->frontOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->frontPitch;
- break;
- case BUFFER_BIT_BACK_LEFT:
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->backOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->backPitch;
- break;
- default:
- break;
- }
-}
-
-static void mach64SpanRenderStart( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- LOCK_HARDWARE( mmesa );
- FINISH_DMA_LOCKED( mmesa );
-}
-
-static void mach64SpanRenderFinish( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( mmesa );
-}
-
-void mach64DDInitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = mach64DDSetBuffer;
- swdd->SpanRenderStart = mach64SpanRenderStart;
- swdd->SpanRenderFinish = mach64SpanRenderFinish;
-}
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- mach64InitPointers_RGB565(&drb->Base);
- }
- else {
- mach64InitPointers_ARGB8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = mach64ReadDepthSpan_16;
- drb->Base.GetValues = mach64ReadDepthPixels_16;
- drb->Base.PutRow = mach64WriteDepthSpan_16;
- drb->Base.PutMonoRow = mach64WriteMonoDepthSpan_16;
- drb->Base.PutValues = mach64WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- /* never */
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- /* never */
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.h
deleted file mode 100644
index 0f4c76647..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_span.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __MACH64_SPAN_H__
-#define __MACH64_SPAN_H__
-
-#include "drirenderbuffer.h"
-
-extern void mach64DDInitSpanFuncs( GLcontext *ctx );
-
-extern void
-mach64SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.c
deleted file mode 100644
index d9b5725a6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.c
+++ /dev/null
@@ -1,1216 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * Jos�Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "mach64_context.h"
-#include "mach64_state.h"
-#include "mach64_ioctl.h"
-#include "mach64_tris.h"
-#include "mach64_vb.h"
-#include "mach64_tex.h"
-
-#include "context.h"
-#include "buffers.h"
-#include "enums.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void mach64UpdateAlphaMode( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint a = mmesa->setup.alpha_tst_cntl;
- GLuint s = mmesa->setup.scale_3d_cntl;
- GLuint m = mmesa->setup.dp_write_mask;
-
- if ( ctx->Color.AlphaEnabled ) {
- GLubyte ref;
-
- CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
-
- a &= ~(MACH64_ALPHA_TEST_MASK | MACH64_REF_ALPHA_MASK);
-
- switch ( ctx->Color.AlphaFunc ) {
- case GL_NEVER:
- a |= MACH64_ALPHA_TEST_NEVER;
- break;
- case GL_LESS:
- a |= MACH64_ALPHA_TEST_LESS;
- break;
- case GL_LEQUAL:
- a |= MACH64_ALPHA_TEST_LEQUAL;
- break;
- case GL_EQUAL:
- a |= MACH64_ALPHA_TEST_EQUAL;
- break;
- case GL_GEQUAL:
- a |= MACH64_ALPHA_TEST_GEQUAL;
- break;
- case GL_GREATER:
- a |= MACH64_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- a |= MACH64_ALPHA_TEST_NOTEQUAL;
- break;
- case GL_ALWAYS:
- a |= MACH64_ALPHA_TEST_ALWAYS;
- break;
- }
-
- a |= (ref << MACH64_REF_ALPHA_SHIFT);
- a |= MACH64_ALPHA_TEST_EN;
- } else {
- a &= ~MACH64_ALPHA_TEST_EN;
- }
-
- FALLBACK( mmesa, MACH64_FALLBACK_BLEND_FUNC, GL_FALSE );
-
- if ( ctx->Color.BlendEnabled ) {
- s &= ~(MACH64_ALPHA_BLEND_SRC_MASK |
- MACH64_ALPHA_BLEND_DST_MASK |
- MACH64_ALPHA_BLEND_SAT);
-
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- s |= MACH64_ALPHA_BLEND_SRC_ZERO;
- break;
- case GL_ONE:
- s |= MACH64_ALPHA_BLEND_SRC_ONE;
- break;
- case GL_DST_COLOR:
- s |= MACH64_ALPHA_BLEND_SRC_DSTCOLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- s |= MACH64_ALPHA_BLEND_SRC_INVDSTCOLOR;
- break;
- case GL_SRC_ALPHA:
- s |= MACH64_ALPHA_BLEND_SRC_SRCALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- s |= MACH64_ALPHA_BLEND_SRC_INVSRCALPHA;
- break;
- case GL_DST_ALPHA:
- s |= MACH64_ALPHA_BLEND_SRC_DSTALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- s |= MACH64_ALPHA_BLEND_SRC_INVDSTALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- s |= (MACH64_ALPHA_BLEND_SRC_SRCALPHA |
- MACH64_ALPHA_BLEND_SAT);
- break;
- default:
- FALLBACK( mmesa, MACH64_FALLBACK_BLEND_FUNC, GL_TRUE );
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- s |= MACH64_ALPHA_BLEND_DST_ZERO;
- break;
- case GL_ONE:
- s |= MACH64_ALPHA_BLEND_DST_ONE;
- break;
- case GL_SRC_COLOR:
- s |= MACH64_ALPHA_BLEND_DST_SRCCOLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- s |= MACH64_ALPHA_BLEND_DST_INVSRCCOLOR;
- break;
- case GL_SRC_ALPHA:
- s |= MACH64_ALPHA_BLEND_DST_SRCALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- s |= MACH64_ALPHA_BLEND_DST_INVSRCALPHA;
- break;
- case GL_DST_ALPHA:
- s |= MACH64_ALPHA_BLEND_DST_DSTALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- s |= MACH64_ALPHA_BLEND_DST_INVDSTALPHA;
- break;
- default:
- FALLBACK( mmesa, MACH64_FALLBACK_BLEND_FUNC, GL_TRUE );
- }
-
- m = 0xffffffff; /* Can't color mask and blend at the same time */
- s &= ~MACH64_ALPHA_FOG_EN_FOG; /* Can't fog and blend at the same time */
- s |= MACH64_ALPHA_FOG_EN_ALPHA;
- } else {
- s &= ~MACH64_ALPHA_FOG_EN_ALPHA;
- }
-
- if ( mmesa->setup.alpha_tst_cntl != a ) {
- mmesa->setup.alpha_tst_cntl = a;
- mmesa->dirty |= MACH64_UPLOAD_Z_ALPHA_CNTL;
- }
- if ( mmesa->setup.scale_3d_cntl != s ) {
- mmesa->setup.scale_3d_cntl = s;
- mmesa->dirty |= MACH64_UPLOAD_SCALE_3D_CNTL;
- }
- if ( mmesa->setup.dp_write_mask != m ) {
- mmesa->setup.dp_write_mask = m;
- mmesa->dirty |= MACH64_UPLOAD_DP_WRITE_MASK;
- }
-}
-
-static void mach64DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_ALPHA;
-}
-
-static void mach64DDBlendEquationSeparate( GLcontext *ctx,
- GLenum modeRGB, GLenum modeA )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- assert( modeRGB == modeA );
- FLUSH_BATCH( mmesa );
-
- /* BlendEquation affects ColorLogicOpEnabled
- */
- FALLBACK( MACH64_CONTEXT(ctx), MACH64_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
-
- /* Can only do blend addition, not min, max, subtract, etc. */
- FALLBACK( MACH64_CONTEXT(ctx), MACH64_FALLBACK_BLEND_EQ,
- modeRGB != GL_FUNC_ADD);
-
- mmesa->new_state |= MACH64_NEW_ALPHA;
-}
-
-static void mach64DDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_ALPHA;
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void mach64UpdateZMode( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint z = mmesa->setup.z_cntl;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_MSG ) {
- fprintf( stderr, "%s:\n", __FUNCTION__ );
- }
-
- if ( ctx->Depth.Test ) {
- z &= ~MACH64_Z_TEST_MASK;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- z |= MACH64_Z_TEST_NEVER;
- break;
- case GL_ALWAYS:
- z |= MACH64_Z_TEST_ALWAYS;
- break;
- case GL_LESS:
- z |= MACH64_Z_TEST_LESS;
- break;
- case GL_LEQUAL:
- z |= MACH64_Z_TEST_LEQUAL;
- break;
- case GL_EQUAL:
- z |= MACH64_Z_TEST_EQUAL;
- break;
- case GL_GEQUAL:
- z |= MACH64_Z_TEST_GEQUAL;
- break;
- case GL_GREATER:
- z |= MACH64_Z_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- z |= MACH64_Z_TEST_NOTEQUAL;
- break;
- }
-
- z |= MACH64_Z_EN;
- } else {
- z &= ~MACH64_Z_EN;
- }
-
- if ( ctx->Depth.Mask ) {
- z |= MACH64_Z_MASK_EN;
- } else {
- z &= ~MACH64_Z_MASK_EN;
- }
-
- if ( mmesa->setup.z_cntl != z ) {
- mmesa->setup.z_cntl = z;
- mmesa->dirty |= MACH64_UPLOAD_Z_ALPHA_CNTL;
- }
-}
-
-static void mach64DDDepthFunc( GLcontext *ctx, GLenum func )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_DEPTH;
-}
-
-static void mach64DDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_DEPTH;
-}
-
-static void mach64DDClearDepth( GLcontext *ctx, GLclampd d )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- /* Always have a 16-bit depth buffer.
- */
- mmesa->ClearDepth = d * 0xffff;
-}
-
-
-/* =============================================================
- * Fog
- */
-
-static void mach64UpdateFogAttrib( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- CARD32 s = mmesa->setup.scale_3d_cntl;
- GLubyte c[4];
- CARD32 col;
-
- /* Can't fog if blending is on */
- if ( ctx->Color.BlendEnabled )
- return;
-
- if ( ctx->Fog.Enabled ) {
- s |= MACH64_ALPHA_FOG_EN_FOG;
- s &= ~(MACH64_ALPHA_BLEND_SRC_MASK |
- MACH64_ALPHA_BLEND_DST_MASK |
- MACH64_ALPHA_BLEND_SAT);
- /* From Utah-glx: "fog color is now dest and fog factor is alpha, so
- * use GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA"
- */
- s |= (MACH64_ALPHA_BLEND_SRC_SRCALPHA |
- MACH64_ALPHA_BLEND_DST_INVSRCALPHA);
- /* From Utah-glx: "can't use texture alpha when fogging" */
- s &= ~MACH64_TEX_MAP_AEN;
- } else {
- s &= ~(MACH64_ALPHA_BLEND_SRC_MASK |
- MACH64_ALPHA_BLEND_DST_MASK |
- MACH64_ALPHA_BLEND_SAT);
- s |= (MACH64_ALPHA_BLEND_SRC_ONE |
- MACH64_ALPHA_BLEND_DST_ZERO);
- s &= ~MACH64_ALPHA_FOG_EN_FOG;
- }
-
- c[0] = FLOAT_TO_UBYTE( ctx->Fog.Color[0] );
- c[1] = FLOAT_TO_UBYTE( ctx->Fog.Color[1] );
- c[2] = FLOAT_TO_UBYTE( ctx->Fog.Color[2] );
- c[3] = FLOAT_TO_UBYTE( ctx->Fog.Color[3] );
-
- col = mach64PackColor( 4, c[0], c[1], c[2], c[3] );
-
- if ( mmesa->setup.dp_fog_clr != col ) {
- mmesa->setup.dp_fog_clr = col;
- mmesa->dirty |= MACH64_UPLOAD_DP_FOG_CLR;
- }
- if ( mmesa->setup.scale_3d_cntl != s ) {
- mmesa->setup.scale_3d_cntl = s;
- mmesa->dirty |= MACH64_UPLOAD_SCALE_3D_CNTL;
- }
-
-}
-
-static void mach64DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_FOG;
-}
-
-
-/* =============================================================
- * Clipping
- */
-
-static void mach64UpdateClipping( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- mach64ScreenPtr mach64Screen = mmesa->mach64Screen;
-
- if ( mmesa->driDrawable ) {
- __DRIdrawablePrivate *drawable = mmesa->driDrawable;
- int x1 = 0;
- int y1 = 0;
- int x2 = drawable->w - 1;
- int y2 = drawable->h - 1;
-
- if ( ctx->Scissor.Enabled ) {
- if ( ctx->Scissor.X > x1 ) {
- x1 = ctx->Scissor.X;
- }
- if ( drawable->h - ctx->Scissor.Y - ctx->Scissor.Height > y1 ) {
- y1 = drawable->h - ctx->Scissor.Y - ctx->Scissor.Height;
- }
- if ( ctx->Scissor.X + ctx->Scissor.Width - 1 < x2 ) {
- x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
- }
- if ( drawable->h - ctx->Scissor.Y - 1 < y2 ) {
- y2 = drawable->h - ctx->Scissor.Y - 1;
- }
- }
-
- x1 += drawable->x;
- y1 += drawable->y;
- x2 += drawable->x;
- y2 += drawable->y;
-
- /* clamp to screen borders */
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
- if (x2 > mach64Screen->width-1) x2 = mach64Screen->width-1;
- if (y2 > mach64Screen->height-1) y2 = mach64Screen->height-1;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_MSG ) {
- fprintf( stderr, "%s: drawable %3d %3d %3d %3d\n",
- __FUNCTION__,
- drawable->x,
- drawable->y,
- drawable->w,
- drawable->h );
- fprintf( stderr, "%s: scissor %3d %3d %3d %3d\n",
- __FUNCTION__,
- ctx->Scissor.X,
- ctx->Scissor.Y,
- ctx->Scissor.Width,
- ctx->Scissor.Height );
- fprintf( stderr, "%s: final %3d %3d %3d %3d\n",
- __FUNCTION__, x1, y1, x2, y2 );
- fprintf( stderr, "\n" );
- }
-
- mmesa->setup.sc_top_bottom = ((y1 << 0) |
- (y2 << 16));
-
- mmesa->setup.sc_left_right = ((x1 << 0) |
- (x2 << 16));
-
- /* UPLOAD_MISC reduces the dirty state, we just need to
- * emit the scissor to the SAREA. We need to dirty cliprects
- * since the scissor and cliprects are intersected to update the
- * single hardware scissor
- */
- mmesa->dirty |= MACH64_UPLOAD_MISC | MACH64_UPLOAD_CLIPRECTS;
- }
-}
-
-static void mach64DDScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_CLIP;
-}
-
-
-/* =============================================================
- * Culling
- */
-
-static void mach64UpdateCull( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLfloat backface_sign = 1;
-
- if ( ctx->Polygon.CullFlag /*&& ctx->PB->primitive == GL_POLYGON*/ ) {
- 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:
- case GL_FRONT_AND_BACK:
- backface_sign = 0;
- break;
- }
- } else {
- backface_sign = 0;
- }
-
- mmesa->backface_sign = backface_sign;
-
-}
-
-static void mach64DDCullFace( GLcontext *ctx, GLenum mode )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_CULL;
-}
-
-static void mach64DDFrontFace( GLcontext *ctx, GLenum mode )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_CULL;
-}
-
-
-/* =============================================================
- * Masks
- */
-
-static void mach64UpdateMasks( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint mask = 0xffffffff;
-
- /* mach64 can't color mask with alpha blending enabled */
- if ( !ctx->Color.BlendEnabled ) {
- mask = mach64PackColor( mmesa->mach64Screen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
- }
-
- if ( mmesa->setup.dp_write_mask != mask ) {
- mmesa->setup.dp_write_mask = mask;
- mmesa->dirty |= MACH64_UPLOAD_DP_WRITE_MASK;
- }
-}
-
-static void mach64DDColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_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.
- */
-
-static void mach64UpdateSpecularLighting( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint a = mmesa->setup.alpha_tst_cntl;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_MSG ) {
- fprintf( stderr, "%s:\n", __FUNCTION__ );
- }
-
- if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
- ctx->Light.Enabled ) {
- a |= MACH64_SPECULAR_LIGHT_EN;
- } else {
- a &= ~MACH64_SPECULAR_LIGHT_EN;
- }
-
- if ( mmesa->setup.alpha_tst_cntl != a ) {
- mmesa->setup.alpha_tst_cntl = a;
- mmesa->dirty |= MACH64_UPLOAD_Z_ALPHA_CNTL;
- mmesa->new_state |= MACH64_NEW_CONTEXT;
- }
-}
-
-static void mach64DDLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) {
- FLUSH_BATCH( mmesa );
- mach64UpdateSpecularLighting(ctx);
- }
-}
-
-static void mach64DDShadeModel( GLcontext *ctx, GLenum mode )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint s = mmesa->setup.setup_cntl;
-
- s &= ~MACH64_FLAT_SHADE_MASK;
-
- switch ( mode ) {
- case GL_FLAT:
- s |= MACH64_FLAT_SHADE_VERTEX_3;
- break;
- case GL_SMOOTH:
- s |= MACH64_FLAT_SHADE_OFF;
- break;
- default:
- return;
- }
-
- if ( mmesa->setup.setup_cntl != s ) {
- FLUSH_BATCH( mmesa );
- mmesa->setup.setup_cntl = s;
-
- mmesa->dirty |= MACH64_UPLOAD_SETUP_CNTL;
- }
-}
-
-
-/* =============================================================
- * Viewport
- */
-
-
-void mach64CalcViewport( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = mmesa->hw_viewport;
-
- /* See also mach64_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + (GLfloat)mmesa->drawX + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + mmesa->driDrawable->h + (GLfloat)mmesa->drawY + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * mmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * mmesa->depth_scale;
-
- mmesa->SetupNewInputs = ~0;
-}
-
-static void mach64Viewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- mach64CalcViewport( ctx );
-}
-
-static void mach64DepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- mach64CalcViewport( ctx );
-}
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void mach64DDClearColor( GLcontext *ctx,
- const GLfloat color[4] )
-{
- mach64ContextPtr mmesa = MACH64_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]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- mmesa->ClearColor = mach64PackColor( mmesa->mach64Screen->cpp,
- c[0], c[1], c[2], c[3] );
-}
-
-static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- if ( ctx->Color.ColorLogicOpEnabled ) {
- FLUSH_BATCH( mmesa );
-
- FALLBACK( mmesa, MACH64_FALLBACK_LOGICOP, opcode != GL_COPY);
- }
-}
-
-void mach64SetCliprects( GLcontext *ctx, GLenum mode )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- mmesa->numClipRects = dPriv->numClipRects;
- mmesa->pClipRects = dPriv->pClipRects;
- mmesa->drawX = dPriv->x;
- mmesa->drawY = dPriv->y;
- break;
- case GL_BACK_LEFT:
- if ( dPriv->numBackClipRects == 0 ) {
- mmesa->numClipRects = dPriv->numClipRects;
- mmesa->pClipRects = dPriv->pClipRects;
- mmesa->drawX = dPriv->x;
- mmesa->drawY = dPriv->y;
- } else {
- mmesa->numClipRects = dPriv->numBackClipRects;
- mmesa->pClipRects = dPriv->pBackClipRects;
- mmesa->drawX = dPriv->backX;
- mmesa->drawY = dPriv->backY;
- }
- break;
- default:
- return;
- }
-
- mach64UpdateClipping( ctx );
-
- mmesa->dirty |= MACH64_UPLOAD_CLIPRECTS;
-}
-
-static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
- mach64SetCliprects( ctx, GL_FRONT_LEFT );
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
- break;
- case BUFFER_BIT_BACK_LEFT:
- FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
- mach64SetCliprects( ctx, GL_BACK_LEFT );
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_TRUE );
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: fallback (mode=%d)\n", __FUNCTION__, mode);
- break;
- }
-
- /* We want to update the s/w rast state too so that mach64SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- mmesa->setup.dst_off_pitch = (((mmesa->drawPitch/8) << 22) |
- (mmesa->drawOffset >> 3));
-
- mmesa->dirty |= MACH64_UPLOAD_DST_OFF_PITCH;
-}
-
-static void mach64DDReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-/* =============================================================
- * State enable/disable
- */
-
-static void mach64DDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s = %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( cap ),
- state ? "GL_TRUE" : "GL_FALSE" );
- }
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_ALPHA;
- break;
-
- case GL_BLEND:
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_ALPHA;
-
- /* enable(GL_BLEND) affects ColorLogicOpEnabled.
- */
- FALLBACK( mmesa, MACH64_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
-
- case GL_CULL_FACE:
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_CULL;
- break;
-
- case GL_DEPTH_TEST:
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_DEPTH;
- break;
-
- case GL_DITHER:
- do {
- GLuint s = mmesa->setup.scale_3d_cntl;
- FLUSH_BATCH( mmesa );
-
- if ( ctx->Color.DitherFlag ) {
- /* Dithering causes problems w/ 24bpp depth */
- if ( mmesa->mach64Screen->cpp == 4 )
- s |= MACH64_ROUND_EN;
- else
- s |= MACH64_DITHER_EN;
- } else {
- s &= ~MACH64_DITHER_EN;
- s &= ~MACH64_ROUND_EN;
- }
-
- if ( mmesa->setup.scale_3d_cntl != s ) {
- mmesa->setup.scale_3d_cntl = s;
- mmesa->dirty |= ( MACH64_UPLOAD_SCALE_3D_CNTL );
- }
- } while (0);
- break;
-
- case GL_FOG:
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_FOG;
- break;
-
- case GL_INDEX_LOGIC_OP:
- case GL_COLOR_LOGIC_OP:
- FLUSH_BATCH( mmesa );
- FALLBACK( mmesa, MACH64_FALLBACK_LOGICOP,
- state && ctx->Color.LogicOp != GL_COPY );
- break;
-
- case GL_LIGHTING:
- mach64UpdateSpecularLighting(ctx);
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( mmesa );
- mmesa->scissor = state;
- mmesa->new_state |= MACH64_NEW_CLIP;
- break;
-
- case GL_STENCIL_TEST:
- FLUSH_BATCH( mmesa );
- FALLBACK( mmesa, MACH64_FALLBACK_STENCIL, state );
- break;
-
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_TEXTURE;
- break;
-
- default:
- return;
- }
-}
-
-/* =============================================================
- * Render mode
- */
-
-static void mach64DDRenderMode( GLcontext *ctx, GLenum mode )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- FALLBACK( mmesa, MACH64_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-/* =============================================================
- * State initialization, management
- */
-
-static void mach64DDPrintDirty( const char *msg, GLuint state )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\n",
- msg,
- state,
- (state & MACH64_UPLOAD_DST_OFF_PITCH) ? "dst_off_pitch, " : "",
- (state & MACH64_UPLOAD_Z_ALPHA_CNTL) ? "z_alpha_cntl, " : "",
- (state & MACH64_UPLOAD_SCALE_3D_CNTL) ? "scale_3d_cntl, " : "",
- (state & MACH64_UPLOAD_DP_FOG_CLR) ? "dp_fog_clr, " : "",
- (state & MACH64_UPLOAD_DP_WRITE_MASK) ? "dp_write_mask, " : "",
- (state & MACH64_UPLOAD_DP_PIX_WIDTH) ? "dp_pix_width, " : "",
- (state & MACH64_UPLOAD_SETUP_CNTL) ? "setup_cntl, " : "",
- (state & MACH64_UPLOAD_MISC) ? "misc, " : "",
- (state & MACH64_UPLOAD_TEXTURE) ? "texture, " : "",
- (state & MACH64_UPLOAD_TEX0IMAGE) ? "tex0 image, " : "",
- (state & MACH64_UPLOAD_TEX1IMAGE) ? "tex1 image, " : "",
- (state & MACH64_UPLOAD_CLIPRECTS) ? "cliprects, " : "" );
-}
-
-/*
- * 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 mach64EmitHwStateLocked( mach64ContextPtr mmesa )
-{
- drm_mach64_sarea_t *sarea = mmesa->sarea;
- drm_mach64_context_regs_t *regs = &(mmesa->setup);
- mach64TexObjPtr t0 = mmesa->CurrentTexObj[0];
- mach64TexObjPtr t1 = mmesa->CurrentTexObj[1];
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_MSG ) {
- mach64DDPrintDirty( __FUNCTION__, mmesa->dirty );
- }
-
- if ( t0 && t1 && mmesa->mach64Screen->numTexHeaps > 1 ) {
- if (t0->heap != t1->heap ||
- (mmesa->dirty & MACH64_UPLOAD_TEX0IMAGE) ||
- (mmesa->dirty & MACH64_UPLOAD_TEX1IMAGE))
- mach64UploadMultiTexImages( mmesa, t0, t1 );
- } else {
- if ( mmesa->dirty & MACH64_UPLOAD_TEX0IMAGE ) {
- if ( t0 ) mach64UploadTexImages( mmesa, t0 );
- }
- if ( mmesa->dirty & MACH64_UPLOAD_TEX1IMAGE ) {
- if ( t1 ) mach64UploadTexImages( mmesa, t1 );
- }
- }
-
- if ( mmesa->dirty & (MACH64_UPLOAD_CONTEXT | MACH64_UPLOAD_MISC) ) {
- memcpy( &sarea->context_state, regs,
- MACH64_NR_CONTEXT_REGS * sizeof(GLuint) );
- }
-
- if ( mmesa->dirty & MACH64_UPLOAD_TEXTURE ) {
- mach64EmitTexStateLocked( mmesa, t0, t1 );
- }
-
- sarea->vertsize = mmesa->vertex_size;
-
- /* Turn off the texture cache flushing.
- */
- mmesa->setup.tex_cntl &= ~MACH64_TEX_CACHE_FLUSH;
-
- sarea->dirty |= mmesa->dirty;
-
- mmesa->dirty &= MACH64_UPLOAD_CLIPRECTS;
-}
-
-static void mach64DDPrintState( const char *msg, GLuint flags )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n",
- msg,
- flags,
- (flags & MACH64_NEW_CONTEXT) ? "context, " : "",
- (flags & MACH64_NEW_ALPHA) ? "alpha, " : "",
- (flags & MACH64_NEW_DEPTH) ? "depth, " : "",
- (flags & MACH64_NEW_FOG) ? "fog, " : "",
- (flags & MACH64_NEW_CLIP) ? "clip, " : "",
- (flags & MACH64_NEW_TEXTURE) ? "texture, " : "",
- (flags & MACH64_NEW_CULL) ? "cull, " : "",
- (flags & MACH64_NEW_MASKS) ? "masks, " : "",
- (flags & MACH64_NEW_WINDOW) ? "window, " : "" );
-}
-
-/* Update the hardware state */
-void mach64DDUpdateHWState( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- int new_state = mmesa->new_state;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_MSG ) {
- fprintf( stderr, "%s:\n", __FUNCTION__ );
- }
-
- if ( new_state )
- {
- FLUSH_BATCH( mmesa );
-
- mmesa->new_state = 0;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_MSG )
- mach64DDPrintState( __FUNCTION__, new_state );
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & MACH64_NEW_ALPHA )
- mach64UpdateAlphaMode( ctx );
-
- if ( new_state & MACH64_NEW_DEPTH )
- mach64UpdateZMode( ctx );
-
- if ( new_state & MACH64_NEW_FOG )
- mach64UpdateFogAttrib( ctx );
-
- if ( new_state & MACH64_NEW_CLIP )
- mach64UpdateClipping( ctx );
-
- if ( new_state & MACH64_NEW_WINDOW )
- mach64CalcViewport( ctx );
-
- if ( new_state & MACH64_NEW_CULL )
- mach64UpdateCull( ctx );
-
- if ( new_state & MACH64_NEW_MASKS )
- mach64UpdateMasks( ctx );
-
- if ( new_state & MACH64_NEW_TEXTURE )
- mach64UpdateTextureState( ctx );
- }
-}
-
-
-static void mach64DDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- MACH64_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-
-/* Initialize the context's hardware state */
-void mach64DDInitState( mach64ContextPtr mmesa )
-{
- GLuint format;
-
- switch ( mmesa->mach64Screen->cpp ) {
- case 2:
- format = MACH64_DATATYPE_RGB565;
- break;
- case 4:
- format = MACH64_DATATYPE_ARGB8888;
- break;
- default:
- fprintf( stderr, "Error: Unsupported pixel depth... exiting\n" );
- exit( -1 );
- }
-
- /* Always have a 16-bit depth buffer
- * but Z coordinates are specified in 16.1 format to the setup engine.
- */
- mmesa->depth_scale = 2.0;
-
- mmesa->ClearColor = 0x00000000;
- mmesa->ClearDepth = 0x0000ffff;
-
- mmesa->Fallback = 0;
-
- if ( mmesa->glCtx->Visual.doubleBufferMode ) {
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->backOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->backPitch;
- } else {
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->frontOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->frontPitch;
- }
-
- /* Harware state:
- */
- mmesa->setup.dst_off_pitch = (((mmesa->drawPitch/8) << 22) |
- (mmesa->drawOffset >> 3));
-
- mmesa->setup.z_off_pitch = (((mmesa->mach64Screen->depthPitch/8) << 22) |
- (mmesa->mach64Screen->depthOffset >> 3));
-
- mmesa->setup.z_cntl = (MACH64_Z_TEST_LESS |
- MACH64_Z_MASK_EN);
-
- mmesa->setup.alpha_tst_cntl = (MACH64_ALPHA_TEST_ALWAYS |
- MACH64_ALPHA_DST_SRCALPHA |
- MACH64_ALPHA_TST_SRC_TEXEL |
- (0 << MACH64_REF_ALPHA_SHIFT));
-
- mmesa->setup.scale_3d_cntl = (MACH64_SCALE_PIX_EXPAND_DYNAMIC_RANGE |
- /* MACH64_SCALE_DITHER_ERROR_DIFFUSE | */
- MACH64_SCALE_DITHER_2D_TABLE |
- /* MACH64_DITHER_INIT_CURRENT | */
- MACH64_DITHER_INIT_RESET |
- MACH64_SCALE_3D_FCN_SHADE |
- MACH64_ALPHA_FOG_DIS |
- MACH64_ALPHA_BLEND_SRC_ONE |
- MACH64_ALPHA_BLEND_DST_ZERO |
- MACH64_TEX_LIGHT_FCN_MODULATE |
- MACH64_MIP_MAP_DISABLE |
- MACH64_BILINEAR_TEX_EN |
- MACH64_TEX_BLEND_FCN_LINEAR);
-
- /* GL spec says dithering initially enabled, but dithering causes
- * problems w/ 24bpp depth
- */
- if ( mmesa->mach64Screen->cpp == 4 )
- mmesa->setup.scale_3d_cntl |= MACH64_ROUND_EN;
- else
- mmesa->setup.scale_3d_cntl |= MACH64_DITHER_EN;
-
- mmesa->setup.sc_left_right = 0x1fff0000;
- mmesa->setup.sc_top_bottom = 0x3fff0000;
-
- mmesa->setup.dp_fog_clr = 0x00ffffff;
- mmesa->setup.dp_write_mask = 0xffffffff;
-
- mmesa->setup.dp_pix_width = ((format << 0) |
- (format << 4) |
- (format << 8) |
- (format << 16) |
- (format << 28));
-
- mmesa->setup.dp_mix = (MACH64_BKGD_MIX_S |
- MACH64_FRGD_MIX_S);
- mmesa->setup.dp_src = (MACH64_BKGD_SRC_3D |
- MACH64_FRGD_SRC_3D |
- MACH64_MONO_SRC_ONE);
-
- mmesa->setup.clr_cmp_cntl = 0x00000000;
- mmesa->setup.gui_traj_cntl = (MACH64_DST_X_LEFT_TO_RIGHT |
- MACH64_DST_Y_TOP_TO_BOTTOM);
-
- mmesa->setup.setup_cntl = (MACH64_FLAT_SHADE_OFF |
- MACH64_SOLID_MODE_OFF |
- MACH64_LOG_MAX_INC_ADJ);
- mmesa->setup.setup_cntl = 0;
-
- mmesa->setup.tex_size_pitch = 0x00000000;
-
- mmesa->setup.tex_cntl = ((0 << MACH64_LOD_BIAS_SHIFT) |
- (0 << MACH64_COMP_FACTOR_SHIFT) |
- MACH64_COMP_COMBINE_MODULATE |
- MACH64_COMP_BLEND_NEAREST |
- MACH64_COMP_FILTER_NEAREST |
- /* MACH64_TEXTURE_TILING | */
-#ifdef MACH64_PREMULT_TEXCOORDS
- MACH64_TEX_ST_DIRECT |
-#endif
- MACH64_TEX_SRC_LOCAL |
- MACH64_TEX_UNCOMPRESSED |
- MACH64_TEX_CACHE_FLUSH |
- MACH64_TEX_CACHE_SIZE_4K);
-
- mmesa->setup.secondary_tex_off = 0x00000000;
- mmesa->setup.tex_offset = 0x00000000;
-
- mmesa->new_state = MACH64_NEW_ALL;
-}
-
-/* Initialize the driver's state functions.
- */
-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;
- ctx->Driver.BlendFuncSeparate = mach64DDBlendFuncSeparate;
- ctx->Driver.ClearDepth = mach64DDClearDepth;
- ctx->Driver.CullFace = mach64DDCullFace;
- ctx->Driver.FrontFace = mach64DDFrontFace;
- ctx->Driver.DepthFunc = mach64DDDepthFunc;
- ctx->Driver.DepthMask = mach64DDDepthMask;
- ctx->Driver.Enable = mach64DDEnable;
- ctx->Driver.Fogfv = mach64DDFogfv;
- ctx->Driver.Hint = NULL;
- ctx->Driver.Lightfv = NULL;
- ctx->Driver.LightModelfv = mach64DDLightModelfv;
- ctx->Driver.LogicOpcode = mach64DDLogicOpCode;
- ctx->Driver.PolygonMode = NULL;
- ctx->Driver.PolygonStipple = NULL;
- ctx->Driver.RenderMode = mach64DDRenderMode;
- ctx->Driver.Scissor = mach64DDScissor;
- ctx->Driver.ShadeModel = mach64DDShadeModel;
- ctx->Driver.ClearStencil = NULL;
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
-
- ctx->Driver.DepthRange = mach64DepthRange;
- ctx->Driver.Viewport = mach64Viewport;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.h
deleted file mode 100644
index 95bcab365..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_state.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- */
-
-#ifndef __MACH64_STATE_H__
-#define __MACH64_STATE_H__
-
-#include "mach64_context.h"
-
-extern void mach64DDInitState( mach64ContextPtr mmesa );
-extern void mach64DDInitStateFuncs( GLcontext *ctx );
-
-extern void mach64SetCliprects( GLcontext *ctx, GLenum mode );
-extern void mach64CalcViewport( GLcontext *ctx );
-
-extern void mach64DDUpdateState( GLcontext *ctx );
-extern void mach64DDUpdateHWState( GLcontext *ctx );
-
-extern void mach64EmitHwStateLocked( mach64ContextPtr mmesa );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.c
deleted file mode 100644
index 6459deef7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "mach64_context.h"
-#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
-#include "mach64_tris.h"
-#include "mach64_tex.h"
-
-#include "context.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texobj.h"
-#include "imports.h"
-
-
-static void mach64SetTexWrap( mach64TexObjPtr t,
- GLenum swrap, GLenum twrap )
-{
- switch ( swrap ) {
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- case GL_CLAMP_TO_BORDER:
- t->ClampS = GL_TRUE;
- break;
- case GL_REPEAT:
- t->ClampS = GL_FALSE;
- break;
- }
-
- switch ( twrap ) {
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- case GL_CLAMP_TO_BORDER:
- t->ClampT = GL_TRUE;
- break;
- case GL_REPEAT:
- t->ClampT = GL_FALSE;
- break;
- }
-}
-
-static void mach64SetTexFilter( mach64TexObjPtr t,
- GLenum minf, GLenum magf )
-{
- switch ( minf ) {
- case GL_NEAREST:
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- t->BilinearMin = GL_FALSE;
- break;
- case GL_LINEAR:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_LINEAR:
- t->BilinearMin = GL_TRUE;
- break;
- }
-
- switch ( magf ) {
- case GL_NEAREST:
- t->BilinearMag = GL_FALSE;
- break;
- case GL_LINEAR:
- t->BilinearMag = GL_TRUE;
- break;
- }
-}
-
-static void mach64SetTexBorderColor( mach64TexObjPtr t, GLubyte c[4] )
-{
-#if 0
- GLuint border = mach64PackColor( 4, c[0], c[1], c[2], c[3] );
-#endif
-}
-
-
-static mach64TexObjPtr
-mach64AllocTexObj( struct gl_texture_object *texObj )
-{
- mach64TexObjPtr t;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API )
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, texObj );
-
- t = (mach64TexObjPtr) CALLOC_STRUCT( mach64_texture_object );
- if ( !t )
- return NULL;
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->tObj = texObj;
-
- t->offset = 0;
-
- t->dirty = 1;
-
- make_empty_list( t );
-
- mach64SetTexWrap( t, texObj->WrapS, texObj->WrapT );
- /*mach64SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/
- mach64SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- mach64SetTexBorderColor( t, texObj->_BorderChan );
-
- return t;
-}
-
-
-/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
-mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- (void) format;
- (void) type;
-
- switch ( internalFormat ) {
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- 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 4:
- case GL_RGBA:
- case GL_RGBA2:
- if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_argb1555;
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- case GL_RGBA4:
- if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
- else
- return &_mesa_texformat_rgb565;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888; /* inefficient but accurate */
- else
- return &_mesa_texformat_argb1555;
-
- case GL_INTENSITY4:
- case GL_INTENSITY:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888; /* inefficient but accurate */
- else
- return &_mesa_texformat_argb4444;
-
- 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_texformat_ci8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- _mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ );
- return NULL;
- }
-}
-
-static void mach64TexImage1D( 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 )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData;
-
- if ( t ) {
- mach64SwapOutTexObj( mmesa, t );
- }
- else {
- t = mach64AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- texObj->DriverData = t;
- }
-
- /* Note, this will call mach64ChooseTextureFormat */
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, packing, texObj, texImage );
-
- mmesa->new_state |= MACH64_NEW_TEXTURE;
-}
-
-static void mach64TexSubImage1D( 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 )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- mach64SwapOutTexObj( mmesa, t );
- }
- else {
- t = mach64AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- texObj->DriverData = t;
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- mmesa->new_state |= MACH64_NEW_TEXTURE;
-}
-
-static void mach64TexImage2D( 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 )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData;
-
- if ( t ) {
- mach64SwapOutTexObj( mmesa, t );
- }
- else {
- t = mach64AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- texObj->DriverData = t;
- }
-
- /* Note, this will call mach64ChooseTextureFormat */
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage );
-
- mmesa->new_state |= MACH64_NEW_TEXTURE;
-}
-
-static void mach64TexSubImage2D( 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 )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- mach64TexObjPtr t = (mach64TexObjPtr) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- mach64SwapOutTexObj( mmesa, t );
- }
- else {
- t = mach64AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- texObj->DriverData = t;
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- mmesa->new_state |= MACH64_NEW_TEXTURE;
-}
-
-/* Due to the way we must program texture state into the Rage Pro,
- * we must leave these calculations to the absolute last minute.
- */
-void mach64EmitTexStateLocked( mach64ContextPtr mmesa,
- mach64TexObjPtr t0,
- mach64TexObjPtr t1 )
-{
- drm_mach64_sarea_t *sarea = mmesa->sarea;
- drm_mach64_context_regs_t *regs = &(mmesa->setup);
-
- /* for multitex, both textures must be local or AGP */
- if ( t0 && t1 )
- assert(t0->heap == t1->heap);
-
- if ( t0 ) {
- if (t0->heap == MACH64_CARD_HEAP) {
-#if ENABLE_PERF_BOXES
- mmesa->c_texsrc_card++;
-#endif
- mmesa->setup.tex_cntl &= ~MACH64_TEX_SRC_AGP;
- } else {
-#if ENABLE_PERF_BOXES
- mmesa->c_texsrc_agp++;
-#endif
- mmesa->setup.tex_cntl |= MACH64_TEX_SRC_AGP;
- }
- mmesa->setup.tex_offset = t0->offset;
- }
-
- if ( t1 ) {
- mmesa->setup.secondary_tex_off = t1->offset;
- }
-
- memcpy( &sarea->context_state.tex_size_pitch, &regs->tex_size_pitch,
- MACH64_NR_TEXTURE_REGS * sizeof(GLuint) );
-}
-
-
-/* ================================================================
- * Device Driver API texture functions
- */
-
-static void mach64DDTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-#if 0
- struct gl_texture_unit *texUnit;
- GLubyte c[4];
-#endif
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- switch ( pname ) {
- case GL_TEXTURE_ENV_MODE:
- FLUSH_BATCH( mmesa );
- mmesa->new_state |= MACH64_NEW_TEXTURE | MACH64_NEW_ALPHA;
- break;
-
-#if 0
- case GL_TEXTURE_ENV_COLOR:
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- CLAMPED_FLOAT_TO_UBYTE( c[0], texUnit->EnvColor[0] );
- CLAMPED_FLOAT_TO_UBYTE( c[1], texUnit->EnvColor[1] );
- CLAMPED_FLOAT_TO_UBYTE( c[2], texUnit->EnvColor[2] );
- CLAMPED_FLOAT_TO_UBYTE( c[3], texUnit->EnvColor[3] );
- mmesa->env_color = mach64PackColor( 32, c[0], c[1], c[2], c[3] );
- if ( mmesa->setup.constant_color_c != mmesa->env_color ) {
- FLUSH_BATCH( mmesa );
- mmesa->setup.constant_color_c = mmesa->env_color;
-
- mmesa->new_state |= MACH64_NEW_TEXTURE;
-
- /* More complex multitexture/multipass fallbacks for GL_BLEND
- * can be done later, but this allows a single pass GL_BLEND
- * in some cases (ie. Performer town demo).
- */
- mmesa->blend_flags &= ~MACH64_BLEND_ENV_COLOR;
- if ( mmesa->env_color != 0x00000000 &&
- mmesa->env_color != 0xff000000 &&
- mmesa->env_color != 0x00ffffff &&
- mmesa->env_color != 0xffffffff )) {
- mmesa->blend_flags |= MACH64_BLEND_ENV_COLOR;
- }
- }
- break;
-#endif
-
- default:
- return;
- }
-}
-
-static void mach64DDTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- mach64TexObjPtr t = (mach64TexObjPtr)tObj->DriverData;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- if ( ( target != GL_TEXTURE_2D ) &&
- ( target != GL_TEXTURE_1D ) ) {
- return;
- }
-
- if (!t) {
- t = mach64AllocTexObj(tObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexParameter");
- return;
- }
- tObj->DriverData = t;
- }
-
- switch ( pname ) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- if ( t->bound ) FLUSH_BATCH( mmesa );
- mach64SetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- if ( t->bound ) FLUSH_BATCH( mmesa );
- mach64SetTexWrap( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- if ( t->bound ) FLUSH_BATCH( mmesa );
- mach64SetTexBorderColor( t, tObj->_BorderChan );
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- /* From Radeon/Rage128:
- * This isn't the most efficient solution but there doesn't appear to
- * be a nice alternative. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- *
- * For mach64 we're only concerned with the base level
- * since that's the only texture we upload.
- */
- if ( t->bound ) FLUSH_BATCH( mmesa );
- mach64SwapOutTexObj( mmesa, t );
- break;
-
- default:
- return;
- }
-
- mmesa->new_state |= MACH64_NEW_TEXTURE;
-}
-
-static void mach64DDBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLint unit = ctx->Texture.CurrentUnit;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p ) unit=%d\n",
- __FUNCTION__, tObj, unit );
- }
-
- FLUSH_BATCH( mmesa );
-
- if ( mmesa->CurrentTexObj[unit] ) {
- mmesa->CurrentTexObj[unit]->bound &= ~(unit+1);
- mmesa->CurrentTexObj[unit] = NULL;
- }
-
- mmesa->new_state |= MACH64_NEW_TEXTURE;
-}
-
-static void mach64DDDeleteTexture( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- mach64TexObjPtr t = (mach64TexObjPtr)tObj->DriverData;
-
- if ( t ) {
- if ( t->bound && mmesa ) {
- FLUSH_BATCH( mmesa );
-
- mmesa->CurrentTexObj[t->bound-1] = 0;
- mmesa->new_state |= MACH64_NEW_TEXTURE;
- }
-
- mach64DestroyTexObj( mmesa, t );
- tObj->DriverData = NULL;
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
-
- }
-}
-
-static GLboolean mach64DDIsTextureResident( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- mach64TexObjPtr t = (mach64TexObjPtr)tObj->DriverData;
-
- return ( t && t->memBlock );
-}
-
-
-void mach64InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->TexEnv = mach64DDTexEnv;
- functions->ChooseTextureFormat = mach64ChooseTextureFormat;
- functions->TexImage1D = mach64TexImage1D;
- functions->TexSubImage1D = mach64TexSubImage1D;
- functions->TexImage2D = mach64TexImage2D;
- functions->TexSubImage2D = mach64TexSubImage2D;
- functions->TexImage3D = _mesa_store_teximage3d;
- functions->TexSubImage3D = _mesa_store_texsubimage3d;
- functions->CopyTexImage1D = _swrast_copy_teximage1d;
- functions->CopyTexImage2D = _swrast_copy_teximage2d;
- functions->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- functions->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- functions->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- functions->TexParameter = mach64DDTexParameter;
- functions->BindTexture = mach64DDBindTexture;
- functions->DeleteTexture = mach64DDDeleteTexture;
- functions->UpdateTexturePalette = NULL;
- functions->ActiveTexture = NULL;
- functions->IsTextureResident = mach64DDIsTextureResident;
- functions->PrioritizeTexture = NULL;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.h
deleted file mode 100644
index d950dd12b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tex.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#ifndef __MACH64_TEX_H__
-#define __MACH64_TEX_H__
-
-extern void mach64UpdateTextureState( GLcontext *ctx );
-
-extern void mach64SwapOutTexObj( mach64ContextPtr mach64ctx,
- mach64TexObjPtr t );
-
-extern void mach64UploadTexImages( mach64ContextPtr mach64ctx,
- mach64TexObjPtr t );
-
-extern void mach64UploadMultiTexImages( mach64ContextPtr mach64ctx,
- mach64TexObjPtr t0, mach64TexObjPtr t1 );
-
-extern void mach64AgeTextures( mach64ContextPtr mach64ctx, int heap );
-extern void mach64DestroyTexObj( mach64ContextPtr mach64ctx,
- mach64TexObjPtr t );
-
-extern void mach64UpdateTexLRU( mach64ContextPtr mach64ctx,
- mach64TexObjPtr t );
-
-extern void mach64PrintLocalLRU( mach64ContextPtr mach64ctx, int heap );
-extern void mach64PrintGlobalLRU( mach64ContextPtr mach64ctx, int heap );
-
-extern void mach64EmitTexStateLocked( mach64ContextPtr mmesa,
- mach64TexObjPtr t0,
- mach64TexObjPtr t1 );
-
-extern void mach64InitTextureFuncs( struct dd_function_table *functions );
-
-/* ================================================================
- * Color conversion macros:
- */
-
-#define MACH64PACKCOLOR332(r, g, b) \
- (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))
-
-#define MACH64PACKCOLOR1555(r, g, b, a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define MACH64PACKCOLOR565(r, g, b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define MACH64PACKCOLOR888(r, g, b) \
- (((r) << 16) | ((g) << 8) | (b))
-
-#define MACH64PACKCOLOR8888(r, g, b, a) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define MACH64PACKCOLOR4444(r, g, b, a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-static __inline__ GLuint mach64PackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return MACH64PACKCOLOR565( r, g, b );
- case 4:
- return MACH64PACKCOLOR8888( r, g, b, a );
- default:
- return 0;
- }
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texmem.c
deleted file mode 100644
index f771818c8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texmem.c
+++ /dev/null
@@ -1,867 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 1999, 2000 ATI Technologies Inc. and 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
- * on 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
- * ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * Jose Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "mach64_context.h"
-#include "mach64_state.h"
-#include "mach64_ioctl.h"
-#include "mach64_vb.h"
-#include "mach64_tris.h"
-#include "mach64_tex.h"
-
-#include "context.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "imports.h"
-
-
-/* Destroy hardware state associated with texture `t'.
- */
-void mach64DestroyTexObj( mach64ContextPtr mmesa, mach64TexObjPtr t )
-{
-#if ENABLE_PERF_BOXES
- /* Bump the performace counter */
- if (mmesa)
- mmesa->c_textureSwaps++;
-#endif
- if ( !t ) return;
-
-#if 0
- if ( t->tObj && t->memBlock && mmesa ) {
- /* not a placeholder, so release from global LRU if necessary */
- int heap = t->heap;
- drmTextureRegion *list = mmesa->sarea->tex_list[heap];
- int log2sz = mmesa->mach64Screen->logTexGranularity[heap];
- int start = t->memBlock->ofs >> log2sz;
- int end = (t->memBlock->ofs + t->memBlock->size - 1) >> log2sz;
- int i;
-
- mmesa->lastTexAge[heap] = ++mmesa->sarea->tex_age[heap];
-
- /* Update the global LRU */
- for ( i = start ; i <= end ; i++ ) {
- /* do we own this block? */
- if (list[i].in_use == mmesa->hHWContext) {
- list[i].in_use = 0;
- list[i].age = mmesa->lastTexAge[heap];
-
- /* remove_from_list(i) */
- list[(GLuint)list[i].next].prev = list[i].prev;
- list[(GLuint)list[i].prev].next = list[i].next;
- }
- }
- }
-#endif
-
- if ( t->memBlock ) {
- mmFreeMem( t->memBlock );
- t->memBlock = NULL;
- }
-
- if ( t->tObj ) {
- t->tObj->DriverData = NULL;
- }
-
- if ( t->bound && mmesa )
- mmesa->CurrentTexObj[t->bound-1] = NULL;
-
- remove_from_list( t );
- FREE( t );
-}
-
-/* Keep track of swapped out texture objects.
- */
-void mach64SwapOutTexObj( mach64ContextPtr mmesa,
- mach64TexObjPtr t )
-{
-#if ENABLE_PERF_BOXES
- /* Bump the performace counter */
- if (mmesa)
- mmesa->c_textureSwaps++;
-#endif
-
-#if 0
- if ( t->tObj && t->memBlock && mmesa ) {
- /* not a placeholder, so release from global LRU if necessary */
- int heap = t->heap;
- drmTextureRegion *list = mmesa->sarea->tex_list[heap];
- int log2sz = mmesa->mach64Screen->logTexGranularity[heap];
- int start = t->memBlock->ofs >> log2sz;
- int end = (t->memBlock->ofs + t->memBlock->size - 1) >> log2sz;
- int i;
-
- mmesa->lastTexAge[heap] = ++mmesa->sarea->tex_age[heap];
-
- /* Update the global LRU */
- for ( i = start ; i <= end ; i++ ) {
- /* do we own this block? */
- if (list[i].in_use == mmesa->hHWContext) {
- list[i].in_use = 0;
- list[i].age = mmesa->lastTexAge[heap];
-
- /* remove_from_list(i) */
- list[(GLuint)list[i].next].prev = list[i].prev;
- list[(GLuint)list[i].prev].next = list[i].next;
- }
- }
- }
-#endif
-
- if ( t->memBlock ) {
- mmFreeMem( t->memBlock );
- t->memBlock = NULL;
- }
-
- t->dirty = ~0;
- move_to_tail( &mmesa->SwappedOut, t );
-}
-
-/* Print out debugging information about texture LRU.
- */
-void mach64PrintLocalLRU( mach64ContextPtr mmesa, int heap )
-{
- mach64TexObjPtr t;
- int sz = 1 << (mmesa->mach64Screen->logTexGranularity[heap]);
-
- fprintf( stderr, "\nLocal LRU, heap %d:\n", heap );
-
- foreach( t, &mmesa->TexObjList[heap] ) {
- if ( !t->tObj ) {
- fprintf( stderr, "Placeholder %d at 0x%x sz 0x%x\n",
- t->memBlock->ofs / sz,
- t->memBlock->ofs,
- t->memBlock->size );
- } else {
- fprintf( stderr, "Texture (bound %d) at 0x%x sz 0x%x\n",
- t->bound,
- t->memBlock->ofs,
- t->memBlock->size );
- }
- }
-
- fprintf( stderr, "\n" );
-}
-
-void mach64PrintGlobalLRU( mach64ContextPtr mmesa, int heap )
-{
- drm_tex_region_t *list = mmesa->sarea->tex_list[heap];
- int i, j;
-
- fprintf( stderr, "\nGlobal LRU, heap %d list %p:\n", heap, list );
-
- for ( i = 0, j = MACH64_NR_TEX_REGIONS ; i < MACH64_NR_TEX_REGIONS ; i++ ) {
- fprintf( stderr, "list[%d] age %d in_use %d next %d prev %d\n",
- j, list[j].age, list[j].in_use, list[j].next, list[j].prev );
- j = list[j].next;
- if ( j == MACH64_NR_TEX_REGIONS ) break;
- }
-
- if ( j != MACH64_NR_TEX_REGIONS ) {
- fprintf( stderr, "Loop detected in global LRU\n" );
- for ( i = 0 ; i < MACH64_NR_TEX_REGIONS ; i++ ) {
- fprintf( stderr, "list[%d] age %d in_use %d next %d prev %d\n",
- i, list[i].age, list[i].in_use, list[i].next, list[i].prev );
- }
- }
-
- fprintf( stderr, "\n" );
-}
-
-/* Reset the global texture LRU.
- */
-/* NOTE: This function is only called while holding the hardware lock */
-static void mach64ResetGlobalLRU( mach64ContextPtr mmesa, int heap )
-{
- drm_tex_region_t *list = mmesa->sarea->tex_list[heap];
- int sz = 1 << mmesa->mach64Screen->logTexGranularity[heap];
- int i;
-
- /* (Re)initialize the global circular LRU list. The last element in
- * the array (MACH64_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 <= mmesa->mach64Screen->texSize[heap] ; i++ ) {
- list[i].prev = i-1;
- list[i].next = i+1;
- list[i].age = 0;
- list[i].in_use = 0;
- }
-
- i--;
- list[0].prev = MACH64_NR_TEX_REGIONS;
- list[i].prev = i-1;
- list[i].next = MACH64_NR_TEX_REGIONS;
- list[MACH64_NR_TEX_REGIONS].prev = i;
- list[MACH64_NR_TEX_REGIONS].next = 0;
- mmesa->sarea->tex_age[heap] = 0;
-}
-
-/* Update the local and global texture LRUs.
- */
-/* NOTE: This function is only called while holding the hardware lock */
-void mach64UpdateTexLRU( mach64ContextPtr mmesa,
- mach64TexObjPtr t )
-{
- int heap = t->heap;
- drm_tex_region_t *list = mmesa->sarea->tex_list[heap];
- int log2sz = mmesa->mach64Screen->logTexGranularity[heap];
- int start = t->memBlock->ofs >> log2sz;
- int end = (t->memBlock->ofs + t->memBlock->size - 1) >> log2sz;
- int i;
-
- mmesa->lastTexAge[heap] = ++mmesa->sarea->tex_age[heap];
-
- if ( !t->memBlock ) {
- fprintf( stderr, "no memblock\n\n" );
- return;
- }
-
- /* Update our local LRU */
- move_to_head( &mmesa->TexObjList[heap], t );
-
- /* Update the global LRU */
- for ( i = start ; i <= end ; i++ ) {
- list[i].in_use = mmesa->hHWContext;
- list[i].age = mmesa->lastTexAge[heap];
-
-#if 0
- /* if this is the last region, it's not in the list */
- if ( !(i*(1<<log2sz) > mmesa->mach64Screen->texSize[heap] ) ) {
-#endif
- /* remove_from_list(i) */
- list[(GLuint)list[i].next].prev = list[i].prev;
- list[(GLuint)list[i].prev].next = list[i].next;
-#if 0
- }
-#endif
-
- /* insert_at_head(list, i) */
- list[i].prev = MACH64_NR_TEX_REGIONS;
- list[i].next = list[MACH64_NR_TEX_REGIONS].next;
- list[(GLuint)list[MACH64_NR_TEX_REGIONS].next].prev = i;
- list[MACH64_NR_TEX_REGIONS].next = i;
- }
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_LRU ) {
- mach64PrintGlobalLRU( mmesa, t->heap );
- mach64PrintLocalLRU( mmesa, t->heap );
- }
-}
-
-/* Update our notion of what textures have been changed since we last
- * held the lock. This pertains to both our local textures and the
- * textures belonging to other clients. Keep track of other client's
- * textures by pushing a placeholder texture onto the LRU list -- these
- * are denoted by (tObj == NULL).
- */
-/* NOTE: This function is only called while holding the hardware lock */
-static void mach64TexturesGone( mach64ContextPtr mmesa, int heap,
- int offset, int size, int in_use )
-{
- mach64TexObjPtr t, tmp;
-
- foreach_s ( t, tmp, &mmesa->TexObjList[heap] ) {
- if ( t->memBlock->ofs >= offset + size ||
- t->memBlock->ofs + t->memBlock->size <= offset )
- continue;
-
- /* It overlaps - kick it out. Need to hold onto the currently
- * bound objects, however.
- */
- if ( t->bound ) {
- mach64SwapOutTexObj( mmesa, t );
- } else {
- mach64DestroyTexObj( mmesa, t );
- }
- }
-
- if ( in_use > 0 && in_use != mmesa->hHWContext ) {
- t = (mach64TexObjPtr) CALLOC( sizeof(*t) );
- if (!t) return;
-
- t->memBlock = mmAllocMem( mmesa->texHeap[heap], size, 0, offset );
- if ( !t->memBlock ) {
- fprintf( stderr, "Couldn't alloc placeholder sz %x ofs %x\n",
- (int)size, (int)offset );
- mmDumpMemInfo( mmesa->texHeap[heap] );
- return;
- }
- insert_at_head( &mmesa->TexObjList[heap], t );
- }
-}
-
-/* Update our client's shared texture state. If another client has
- * modified a region in which we have textures, then we need to figure
- * out which of our textures has been removed, and update our global
- * LRU.
- */
-void mach64AgeTextures( mach64ContextPtr mmesa, int heap )
-{
- drm_mach64_sarea_t *sarea = mmesa->sarea;
-
- if ( sarea->tex_age[heap] != mmesa->lastTexAge[heap] ) {
- int sz = 1 << mmesa->mach64Screen->logTexGranularity[heap];
- int nr = 0;
- int idx;
-
- /* Have to go right round from the back to ensure stuff ends up
- * LRU in our local list... Fix with a cursor pointer.
- */
- for ( idx = sarea->tex_list[heap][MACH64_NR_TEX_REGIONS].prev ;
- idx != MACH64_NR_TEX_REGIONS && nr < MACH64_NR_TEX_REGIONS ;
- idx = sarea->tex_list[heap][idx].prev, nr++ )
- {
- /* If switching texturing schemes, then the SAREA might not
- * have been properly cleared, so we need to reset the
- * global texture LRU.
- */
- if ( idx * sz > mmesa->mach64Screen->texSize[heap] ) {
- nr = MACH64_NR_TEX_REGIONS;
- break;
- }
-
- if ( sarea->tex_list[heap][idx].age > mmesa->lastTexAge[heap] ) {
- mach64TexturesGone( mmesa, heap, idx * sz, sz,
- sarea->tex_list[heap][idx].in_use );
- }
- }
-
- /* If switching texturing schemes, then the SAREA might not
- * have been properly cleared, so we need to reset the
- * global texture LRU.
- */
- if ( nr == MACH64_NR_TEX_REGIONS ) {
- mach64TexturesGone( mmesa, heap, 0,
- mmesa->mach64Screen->texSize[heap], 0 );
- mach64ResetGlobalLRU( mmesa, heap );
- }
-
- if ( 0 ) {
- mach64PrintGlobalLRU( mmesa, heap );
- mach64PrintLocalLRU( mmesa, heap );
- }
-
- mmesa->dirty |= (MACH64_UPLOAD_CONTEXT |
- MACH64_UPLOAD_TEX0IMAGE |
- MACH64_UPLOAD_TEX1IMAGE);
- mmesa->lastTexAge[heap] = sarea->tex_age[heap];
- }
-}
-
-/* Upload the texture image associated with texture `t' at level `level'
- * at the address relative to `start'.
- */
-static void mach64UploadAGPSubImage( mach64ContextPtr mmesa,
- mach64TexObjPtr t, int level,
- int x, int y, int width, int height )
-{
- mach64ScreenRec *mach64Screen = mmesa->mach64Screen;
- struct gl_texture_image *image;
- int texelsPerDword = 0;
- int dwords;
-
- /* Ensure we have a valid texture to upload */
- if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) )
- return;
-
- image = t->tObj->Image[0][level];
- if ( !image )
- return;
-
- switch ( image->TexFormat->TexelBytes ) {
- case 1: texelsPerDword = 4; break;
- case 2: texelsPerDword = 2; break;
- case 4: texelsPerDword = 1; break;
- }
-
-#if 1
- /* FIXME: The subimage index calcs are wrong... */
- x = 0;
- y = 0;
- width = image->Width;
- height = image->Height;
-#endif
-
- dwords = width * height / texelsPerDword;
-
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- mmesa->c_agpTextureBytes += (dwords << 2);
-#endif
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "mach64UploadSubImage: %d,%d of %d,%d at %d,%d\n",
- width, height, image->Width, image->Height, x, y );
- fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d\n",
- (GLuint)t->offset, (GLint)width, dwords );
- mmDumpMemInfo( mmesa->texHeap[t->heap] );
- }
-
- assert(image->Data);
-
- {
- CARD32 *dst = (CARD32 *)((char *)mach64Screen->agpTextures.map + t->memBlock->ofs);
- const GLubyte *src = (const GLubyte *) image->Data +
- (y * image->Width + x) * image->TexFormat->TexelBytes;
- const GLuint bytes = width * height * image->TexFormat->TexelBytes;
- memcpy(dst, src, bytes);
- }
-
-}
-
-/* Upload the texture image associated with texture `t' at level `level'
- * at the address relative to `start'.
- */
-static void mach64UploadLocalSubImage( mach64ContextPtr mmesa,
- mach64TexObjPtr t, int level,
- int x, int y, int width, int height )
-{
- struct gl_texture_image *image;
- int texelsPerDword = 0;
- int imageWidth, imageHeight;
- int remaining, rows;
- int format, dwords;
- const int maxdwords = (MACH64_BUFFER_MAX_DWORDS - (MACH64_HOSTDATA_BLIT_OFFSET / 4));
- CARD32 pitch, offset;
- int i;
-
- /* Ensure we have a valid texture to upload */
- if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) )
- return;
-
- image = t->tObj->Image[0][level];
- if ( !image )
- return;
-
- switch ( image->TexFormat->TexelBytes ) {
- case 1: texelsPerDword = 4; break;
- case 2: texelsPerDword = 2; break;
- case 4: texelsPerDword = 1; break;
- }
-
-#if 1
- /* FIXME: The subimage index calcs are wrong... */
- x = 0;
- y = 0;
- width = image->Width;
- height = image->Height;
-#endif
-
- imageWidth = image->Width;
- imageHeight = image->Height;
-
- format = t->textureFormat;
-
- /* The texel upload routines have a minimum width, so force the size
- * if needed.
- */
- if ( imageWidth < texelsPerDword ) {
- int factor;
-
- factor = texelsPerDword / imageWidth;
- imageWidth = texelsPerDword;
- imageHeight /= factor;
- if ( imageHeight == 0 ) {
- /* In this case, the texel converter will actually walk a
- * texel or two off the end of the image, but normal malloc
- * alignment should prevent it from ever causing a fault.
- */
- imageHeight = 1;
- }
- }
-
- /* We can't upload to a pitch less than 64 texels so we will need to
- * linearly upload all modified rows for textures smaller than this.
- * This makes the x/y/width/height different for the blitter and the
- * texture walker.
- */
- if ( imageWidth >= 64 ) {
- /* The texture walker and the blitter look identical */
- pitch = imageWidth >> 3;
- } else {
- int factor;
- int y2;
- int start, end;
-
- start = (y * imageWidth) & ~63;
- end = (y + height) * imageWidth;
-
- if ( end - start < 64 ) {
- /* Handle the case where the total number of texels
- * uploaded is < 64.
- */
- x = 0;
- y = start / 64;
- width = end - start;
- height = 1;
- } else {
- /* Upload some number of full 64 texel blit rows */
- factor = 64 / imageWidth;
-
- y2 = y + height - 1;
- y /= factor;
- y2 /= factor;
-
- x = 0;
- width = 64;
- height = y2 - y + 1;
- }
-
- /* Fixed pitch of 64 */
- pitch = 8;
- }
-
- dwords = width * height / texelsPerDword;
- offset = t->offset;
-
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- mmesa->c_textureBytes += (dwords << 2);
-#endif
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "mach64UploadSubImage: %d,%d of %d,%d at %d,%d\n",
- width, height, image->Width, image->Height, x, y );
- fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d\n",
- (GLuint)offset, (GLint)width, dwords );
- mmDumpMemInfo( mmesa->texHeap[t->heap] );
- }
-
- /* Subdivide the texture if required (account for the registers added by the drm) */
- if ( dwords <= maxdwords ) {
- rows = height;
- } else {
- rows = (maxdwords * texelsPerDword) / (2 * width);
- }
-
- for ( i = 0, remaining = height ;
- remaining > 0 ;
- remaining -= rows, y += rows, i++ )
- {
- drmBufPtr buffer;
- CARD32 *dst;
-
- height = MIN2(remaining, rows);
-
- /* Grab the dma buffer for the texture blit */
- buffer = mach64GetBufferLocked( mmesa );
-
- dst = (CARD32 *)((char *)buffer->address + MACH64_HOSTDATA_BLIT_OFFSET);
-
- assert(image->Data);
-
- {
- const GLubyte *src = (const GLubyte *) image->Data +
- (y * image->Width + x) * image->TexFormat->TexelBytes;
- const GLuint bytes = width * height * image->TexFormat->TexelBytes;
- memcpy(dst, src, bytes);
- }
-
- mach64FireBlitLocked( mmesa, buffer, offset, pitch, format,
- x, y, width, height );
-
- }
-
- mmesa->new_state |= MACH64_NEW_CONTEXT;
- mmesa->dirty |= MACH64_UPLOAD_CONTEXT | MACH64_UPLOAD_MISC;
-}
-
-
-/* Upload the texture images associated with texture `t'. This might
- * require removing our own and/or other client's texture objects to
- * make room for these images.
- */
-void mach64UploadTexImages( mach64ContextPtr mmesa, mach64TexObjPtr t )
-{
- GLint heap;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %p )\n",
- __FUNCTION__, mmesa->glCtx, t );
- }
-
- assert(t);
- assert(t->tObj);
-
- /* Choose the heap appropriately */
- heap = MACH64_CARD_HEAP;
-
- if ( !mmesa->mach64Screen->IsPCI &&
- t->size > mmesa->mach64Screen->texSize[heap] ) {
- heap = MACH64_AGP_HEAP;
- }
-
- /* Do we need to eject LRU texture objects? */
- if ( !t->memBlock ) {
- t->heap = heap;
-
- /* Allocate a memory block on a 64-byte boundary */
- t->memBlock = mmAllocMem( mmesa->texHeap[heap], t->size, 6, 0 );
-
- /* Try AGP before kicking anything out of local mem */
- if ( !mmesa->mach64Screen->IsPCI && !t->memBlock && heap == MACH64_CARD_HEAP ) {
- t->memBlock = mmAllocMem( mmesa->texHeap[MACH64_AGP_HEAP],
- t->size, 6, 0 );
-
- if ( t->memBlock )
- heap = t->heap = MACH64_AGP_HEAP;
- }
-
- /* Kick out textures until the requested texture fits */
- while ( !t->memBlock ) {
- if ( mmesa->TexObjList[heap].prev->bound ) {
- fprintf( stderr,
- "mach64UploadTexImages: ran into bound texture\n" );
- return;
- }
- if ( mmesa->TexObjList[heap].prev == &mmesa->TexObjList[heap] ) {
- if ( mmesa->mach64Screen->IsPCI ) {
- fprintf( stderr, "%s: upload texture failure on "
- "local texture heaps, sz=%d\n", __FUNCTION__,
- t->size );
- return;
- } else if ( heap == MACH64_CARD_HEAP ) {
- heap = t->heap = MACH64_AGP_HEAP;
- continue;
- } else {
- int i;
- fprintf( stderr, "%s: upload texture failure on "
- "%sAGP texture heaps, sz=%d\n", __FUNCTION__,
- mmesa->firstTexHeap == MACH64_CARD_HEAP ? "both local and " : "",
- t->size );
- for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) {
- mach64PrintLocalLRU( mmesa, i );
- mmDumpMemInfo( mmesa->texHeap[i] );
- }
- exit(-1);
- return;
- }
- }
-
- mach64SwapOutTexObj( mmesa, mmesa->TexObjList[heap].prev );
-
- t->memBlock = mmAllocMem( mmesa->texHeap[heap], t->size, 6, 0 );
- }
-
- /* Set the base offset of the texture image */
- t->offset = mmesa->mach64Screen->texOffset[heap] + t->memBlock->ofs;
-
- /* Force loading the new state into the hardware */
- mmesa->dirty |= (MACH64_UPLOAD_SCALE_3D_CNTL |
- MACH64_UPLOAD_TEXTURE);
- }
-
- /* Let the world know we've used this memory recently */
- mach64UpdateTexLRU( mmesa, t );
-
- /* Upload any images that are new */
- if ( t->dirty ) {
- if (t->heap == MACH64_AGP_HEAP) {
- /* Need to make sure any vertex buffers in the queue complete */
- mach64WaitForIdleLocked( mmesa );
- mach64UploadAGPSubImage( mmesa, t, t->tObj->BaseLevel, 0, 0,
- t->tObj->Image[0][t->tObj->BaseLevel]->Width,
- t->tObj->Image[0][t->tObj->BaseLevel]->Height );
- } else {
- mach64UploadLocalSubImage( mmesa, t, t->tObj->BaseLevel, 0, 0,
- t->tObj->Image[0][t->tObj->BaseLevel]->Width,
- t->tObj->Image[0][t->tObj->BaseLevel]->Height );
- }
-
- mmesa->setup.tex_cntl |= MACH64_TEX_CACHE_FLUSH;
- }
-
- mmesa->dirty |= MACH64_UPLOAD_TEXTURE;
-
- t->dirty = 0;
-}
-
-/* The mach64 needs to have both primary and secondary textures in either
- * local or AGP memory, so we need a "buddy system" to make sure that allocation
- * succeeds or fails for both textures.
- * FIXME: This needs to be optimized better.
- */
-void mach64UploadMultiTexImages( mach64ContextPtr mmesa,
- mach64TexObjPtr t0,
- mach64TexObjPtr t1 )
-{
- GLint heap;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %p %p )\n",
- __FUNCTION__, mmesa->glCtx, t0, t1 );
- }
-
- assert(t0 && t1);
- assert(t0->tObj && t1->tObj);
-
- /* Choose the heap appropriately */
- heap = MACH64_CARD_HEAP;
-
- if ( !mmesa->mach64Screen->IsPCI &&
- ((t0->size + t1->size) > mmesa->mach64Screen->texSize[heap]) ) {
- heap = MACH64_AGP_HEAP;
- }
-
- /* Do we need to eject LRU texture objects? */
- if ( !t0->memBlock || !t1->memBlock || t0->heap != t1->heap ) {
- /* FIXME: starting from scratch for now to keep it simple */
- if ( t0->memBlock ) {
- mach64SwapOutTexObj( mmesa, t0 );
- }
- if ( t1->memBlock ) {
- mach64SwapOutTexObj( mmesa, t1 );
- }
- t0->heap = t1->heap = heap;
- /* Allocate a memory block on a 64-byte boundary */
- t0->memBlock = mmAllocMem( mmesa->texHeap[heap], t0->size, 6, 0 );
- if ( t0->memBlock ) {
- t1->memBlock = mmAllocMem( mmesa->texHeap[heap], t1->size, 6, 0 );
- if ( !t1->memBlock ) {
- mmFreeMem( t0->memBlock );
- t0->memBlock = NULL;
- }
- }
- /* Try AGP before kicking anything out of local mem */
- if ( (!t0->memBlock || !t1->memBlock) && heap == MACH64_CARD_HEAP ) {
- t0->memBlock = mmAllocMem( mmesa->texHeap[MACH64_AGP_HEAP], t0->size, 6, 0 );
- if ( t0->memBlock ) {
- t1->memBlock = mmAllocMem( mmesa->texHeap[MACH64_AGP_HEAP], t1->size, 6, 0 );
- if ( !t1->memBlock ) {
- mmFreeMem( t0->memBlock );
- t0->memBlock = NULL;
- }
- }
-
- if ( t0->memBlock && t1->memBlock )
- heap = t0->heap = t1->heap = MACH64_AGP_HEAP;
- }
-
- /* Kick out textures until the requested texture fits */
- while ( !t0->memBlock || !t1->memBlock ) {
- if ( mmesa->TexObjList[heap].prev->bound ) {
- fprintf( stderr,
- "%s: ran into bound texture\n", __FUNCTION__ );
- return;
- }
- if ( mmesa->TexObjList[heap].prev == &mmesa->TexObjList[heap] ) {
- if ( mmesa->mach64Screen->IsPCI ) {
- fprintf( stderr, "%s: upload texture failure on local "
- "texture heaps, tex0 sz=%d tex1 sz=%d\n", __FUNCTION__,
- t0->size, t1->size );
- return;
- } else if ( heap == MACH64_CARD_HEAP ) {
- /* If only one allocation succeeded, start over again in AGP */
- if (t0->memBlock) {
- mmFreeMem( t0->memBlock );
- t0->memBlock = NULL;
- }
- if (t1->memBlock) {
- mmFreeMem( t1->memBlock );
- t1->memBlock = NULL;
- }
- heap = t0->heap = t1->heap = MACH64_AGP_HEAP;
- continue;
- } else {
- int i;
- fprintf( stderr, "%s: upload texture failure on %s"
- "AGP texture heaps, tex0 sz=%d tex1 sz=%d\n", __FUNCTION__,
- mmesa->firstTexHeap == MACH64_CARD_HEAP ? "both local and " : "",
- t0->size, t1->size );
- for ( i = mmesa->firstTexHeap ; i < mmesa->lastTexHeap ; i++ ) {
- mach64PrintLocalLRU( mmesa, i );
- mmDumpMemInfo( mmesa->texHeap[i] );
- }
- exit(-1);
- return;
- }
- }
-
- mach64SwapOutTexObj( mmesa, mmesa->TexObjList[heap].prev );
-
- if (!t0->memBlock)
- t0->memBlock = mmAllocMem( mmesa->texHeap[heap], t0->size, 6, 0 );
- if (!t1->memBlock)
- t1->memBlock = mmAllocMem( mmesa->texHeap[heap], t1->size, 6, 0 );
- }
-
- /* Set the base offset of the texture image */
- t0->offset = mmesa->mach64Screen->texOffset[heap] + t0->memBlock->ofs;
- t1->offset = mmesa->mach64Screen->texOffset[heap] + t1->memBlock->ofs;
-
- /* Force loading the new state into the hardware */
- mmesa->dirty |= (MACH64_UPLOAD_SCALE_3D_CNTL |
- MACH64_UPLOAD_TEXTURE);
- }
-
- /* Let the world know we've used this memory recently */
- mach64UpdateTexLRU( mmesa, t0 );
- mach64UpdateTexLRU( mmesa, t1 );
-
- /* Upload any images that are new */
- if ( t0->dirty ) {
- if (t0->heap == MACH64_AGP_HEAP) {
- /* Need to make sure any vertex buffers in the queue complete */
- mach64WaitForIdleLocked( mmesa );
- mach64UploadAGPSubImage( mmesa, t0, t0->tObj->BaseLevel, 0, 0,
- t0->tObj->Image[0][t0->tObj->BaseLevel]->Width,
- t0->tObj->Image[0][t0->tObj->BaseLevel]->Height );
- } else {
- mach64UploadLocalSubImage( mmesa, t0, t0->tObj->BaseLevel, 0, 0,
- t0->tObj->Image[0][t0->tObj->BaseLevel]->Width,
- t0->tObj->Image[0][t0->tObj->BaseLevel]->Height );
- }
- mmesa->setup.tex_cntl |= MACH64_TEX_CACHE_FLUSH;
- }
- if ( t1->dirty ) {
- if (t1->heap == MACH64_AGP_HEAP) {
- /* Need to make sure any vertex buffers in the queue complete */
- mach64WaitForIdleLocked( mmesa );
- mach64UploadAGPSubImage( mmesa, t1, t1->tObj->BaseLevel, 0, 0,
- t1->tObj->Image[0][t1->tObj->BaseLevel]->Width,
- t1->tObj->Image[0][t1->tObj->BaseLevel]->Height );
- } else {
- mach64UploadLocalSubImage( mmesa, t1, t1->tObj->BaseLevel, 0, 0,
- t1->tObj->Image[0][t1->tObj->BaseLevel]->Width,
- t1->tObj->Image[0][t1->tObj->BaseLevel]->Height );
- }
-
- mmesa->setup.tex_cntl |= MACH64_TEX_CACHE_FLUSH;
- }
-
- mmesa->dirty |= MACH64_UPLOAD_TEXTURE;
-
- t0->dirty = 0;
- t1->dirty = 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texstate.c
deleted file mode 100644
index ada4b056f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_texstate.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-
-#include "mach64_context.h"
-#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
-#include "mach64_tris.h"
-#include "mach64_tex.h"
-
-static void mach64SetTexImages( mach64ContextPtr mmesa,
- const struct gl_texture_object *tObj )
-{
- mach64TexObjPtr t = (mach64TexObjPtr) tObj->DriverData;
- struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
-#if 0
- int log2Pitch, log2Height, log2Size, log2MinSize;
- int i;
- GLint firstLevel, lastLevel;
-#endif
- int totalSize;
-
- assert(t);
- assert(baseImage);
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API )
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj );
-
- switch (baseImage->TexFormat->MesaFormat) {
- case MESA_FORMAT_ARGB8888:
- t->textureFormat = MACH64_DATATYPE_ARGB8888;
- break;
- case MESA_FORMAT_ARGB4444:
- t->textureFormat = MACH64_DATATYPE_ARGB4444;
- break;
- case MESA_FORMAT_RGB565:
- t->textureFormat = MACH64_DATATYPE_RGB565;
- break;
- case MESA_FORMAT_ARGB1555:
- t->textureFormat = MACH64_DATATYPE_ARGB1555;
- break;
- case MESA_FORMAT_RGB332:
- t->textureFormat = MACH64_DATATYPE_RGB332;
- break;
- case MESA_FORMAT_RGB888:
- t->textureFormat = MACH64_DATATYPE_RGB8;
- break;
- case MESA_FORMAT_CI8:
- t->textureFormat = MACH64_DATATYPE_CI8;
- break;
- case MESA_FORMAT_YCBCR:
- t->textureFormat = MACH64_DATATYPE_YVYU422;
- break;
- case MESA_FORMAT_YCBCR_REV:
- t->textureFormat = MACH64_DATATYPE_VYUY422;
- break;
- default:
- _mesa_problem(mmesa->glCtx, "Bad texture format in %s", __FUNCTION__);
- };
-
-#if 0
- /* 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.
- */
- 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 */
-
- log2Pitch = tObj->Image[firstLevel]->WidthLog2;
- log2Height = tObj->Image[firstLevel]->HeightLog2;
- log2Size = MAX2(log2Pitch, log2Height);
- log2MinSize = log2Size;
-
- t->dirty = 0;
- totalSize = 0;
- for ( i = firstLevel; i <= lastLevel; i++ ) {
- const struct gl_texture_image *texImage;
-
- texImage = tObj->Image[i];
- if ( !texImage || !texImage->Data ) {
- lastLevel = i - 1;
- break;
- }
-
- log2MinSize = texImage->MaxLog2;
-
- t->image[i - firstLevel].offset = totalSize;
- t->image[i - firstLevel].width = tObj->Image[i]->Width;
- t->image[i - firstLevel].height = tObj->Image[i]->Height;
-
- t->dirty |= (1 << i);
-
- totalSize += (tObj->Image[i]->Height *
- tObj->Image[i]->Width *
- tObj->Image[i]->TexFormat->TexelBytes);
-
- /* Offsets must be 32-byte aligned for host data blits and tiling */
- totalSize = (totalSize + 31) & ~31;
- }
-
- t->totalSize = totalSize;
- t->firstLevel = firstLevel;
- t->lastLevel = lastLevel;
-
- /* Set the texture format */
- t->setup.tex_cntl &= ~(0xf << 16);
- t->setup.tex_cntl |= t->textureFormat;
-
- t->setup.tex_combine_cntl = 0x00000000; /* XXX is this right? */
-
- t->setup.tex_size_pitch = ((log2Pitch << R128_TEX_PITCH_SHIFT) |
- (log2Size << R128_TEX_SIZE_SHIFT) |
- (log2Height << R128_TEX_HEIGHT_SHIFT) |
- (log2MinSize << R128_TEX_MIN_SIZE_SHIFT));
-
- for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) {
- t->setup.tex_offset[i] = 0x00000000;
- }
-
- if (firstLevel == lastLevel)
- t->setup.tex_cntl |= R128_MIP_MAP_DISABLE;
- else
- t->setup.tex_cntl &= ~R128_MIP_MAP_DISABLE;
-
-#else
- if ( ( baseImage->Format == GL_RGBA ) ||
- ( baseImage->Format == GL_ALPHA ) ||
- ( baseImage->Format == GL_LUMINANCE_ALPHA ) ) {
- t->hasAlpha = 1;
- } else {
- t->hasAlpha = 0;
- }
-
- totalSize = ( baseImage->Width * baseImage->Height *
- baseImage->TexFormat->TexelBytes );
- totalSize = (totalSize + 31) & ~31;
- t->size = totalSize;
- t->widthLog2 = baseImage->WidthLog2;
- t->heightLog2 = baseImage->HeightLog2;
- t->maxLog2 = baseImage->MaxLog2;
-
-#endif
-}
-
-static void mach64UpdateTextureEnv( GLcontext *ctx, int unit )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLint source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
- GLuint s = mmesa->setup.scale_3d_cntl;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %d )\n",
- __FUNCTION__, ctx, unit );
- }
-
-/* REPLACE MODULATE DECAL GL_BLEND
- *
- * ALPHA C = Cf C = Cf undef C = Cf
- * A = At A = AfAt A = AfAt
- *
- * LUMINANCE C = Ct C = CfCt undef C = Cf(1-Ct)+CcCt
- * A = Af A = Af A = Af
- *
- * LUMINANCE_ALPHA C = Ct C = CfCt undef C = Cf(1-Ct)+CcCt
- * A = At A = AfAt A = AfAt
- *
- * INTENSITY C = Ct C = CfCt undef C = Cf(1-Ct)+CcCt
- * A = At A = AfAt A = Af(1-At)+AcAt
- *
- * RGB C = Ct C = CfCt C = Ct C = Cf(1-Ct)+CcCt
- * A = Af A = Af A = Af A = Af
- *
- * RGBA C = Ct C = CfCt C = Cf(1-At)+CtAt C = Cf(1-Ct)+CcCt
- * A = At A = AfAt A = Af A = AfAt
- */
-
-
- if ( unit == 0 ) {
- s &= ~MACH64_TEX_LIGHT_FCN_MASK;
-
- /* Set the texture environment state
- * Need to verify these are working correctly, but the
- * texenv Mesa demo seems to work.
- */
- switch ( texUnit->EnvMode ) {
- case GL_REPLACE:
- switch ( format ) {
- case GL_ALPHA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* Not compliant - can't get At */
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- default:
- s |= MACH64_TEX_LIGHT_FCN_REPLACE;
- }
- break;
- case GL_MODULATE:
- switch ( format ) {
- case GL_ALPHA:
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- /* These should be compliant */
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- case GL_RGBA:
- /* Should fallback when blending enabled for complete compliance */
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- default:
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- }
- break;
- case GL_DECAL:
- switch ( format ) {
- case GL_RGBA:
- s |= MACH64_TEX_LIGHT_FCN_ALPHA_DECAL;
- break;
- case GL_RGB:
- s |= MACH64_TEX_LIGHT_FCN_REPLACE;
- break;
- case GL_ALPHA:
- case GL_LUMINANCE_ALPHA:
- /* undefined - disable texturing, pass fragment unmodified */
- /* Also, pass fragment alpha instead of texture alpha */
- s &= ~MACH64_TEX_MAP_AEN;
- s |= MACH64_TEXTURE_DISABLE;
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- case GL_LUMINANCE:
- case GL_INTENSITY:
- /* undefined - disable texturing, pass fragment unmodified */
- s |= MACH64_TEXTURE_DISABLE;
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- default:
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- }
- break;
- case GL_BLEND:
- /* GL_BLEND not supported by RagePRO, use software */
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- case GL_ADD:
- case GL_COMBINE:
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- break;
- default:
- s |= MACH64_TEX_LIGHT_FCN_MODULATE;
- }
-
- if ( mmesa->setup.scale_3d_cntl != s ) {
- mmesa->setup.scale_3d_cntl = s;
- mmesa->dirty |= MACH64_UPLOAD_SCALE_3D_CNTL;
- }
-
- } else {
- /* blend = 0, modulate = 1 - initialize to blend */
- mmesa->setup.tex_cntl &= ~MACH64_COMP_COMBINE_MODULATE;
- /* Set the texture composite function for multitexturing*/
- switch ( texUnit->EnvMode ) {
- case GL_BLEND:
- /* GL_BLEND not supported by RagePRO, use software */
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- mmesa->setup.tex_cntl |= MACH64_COMP_COMBINE_MODULATE;
- break;
- case GL_MODULATE:
- /* Should fallback when blending enabled for complete compliance */
- mmesa->setup.tex_cntl |= MACH64_COMP_COMBINE_MODULATE;
- break;
- case GL_REPLACE:
- switch ( format ) {
- case GL_ALPHA:
- mmesa->setup.tex_cntl |= MACH64_COMP_COMBINE_MODULATE;
- break;
- default: /* not supported by RagePRO */
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- mmesa->setup.tex_cntl |= MACH64_COMP_COMBINE_MODULATE;
- }
- break;
- case GL_DECAL:
- switch ( format ) {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* undefined, disable compositing and pass fragment unmodified */
- mmesa->setup.tex_cntl &= ~MACH64_TEXTURE_COMPOSITE;
- break;
- default: /* not supported by RagePRO */
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- mmesa->setup.tex_cntl |= MACH64_COMP_COMBINE_MODULATE;
- }
- break;
- case GL_ADD:
- case GL_COMBINE:
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- mmesa->setup.tex_cntl |= MACH64_COMP_COMBINE_MODULATE;
- break;
- default:
- mmesa->setup.tex_cntl |= MACH64_COMP_COMBINE_MODULATE;
- }
- }
-}
-
-
-static void mach64UpdateTextureUnit( GLcontext *ctx, int unit )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = ctx->Texture.Unit[source]._Current;
- mach64TexObjPtr t = tObj->DriverData;
- GLuint d = mmesa->setup.dp_pix_width;
- GLuint s = mmesa->setup.scale_3d_cntl;
-
- assert(unit == 0 || unit == 1); /* only two tex units */
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %d ) enabled=0x%x 0x%x\n",
- __FUNCTION__, ctx, unit, ctx->Texture.Unit[0]._ReallyEnabled,
- ctx->Texture.Unit[1]._ReallyEnabled);
- }
-
- if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
-
- assert(t); /* should have driver tex data by now */
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) {
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- return;
- }
-
- /* Upload teximages */
- if (t->dirty) {
- mach64SetTexImages( mmesa, tObj );
- mmesa->dirty |= (MACH64_UPLOAD_TEX0IMAGE << unit);
- }
-
- /* Bind to the given texture unit */
- mmesa->CurrentTexObj[unit] = t;
- t->bound |= (1 << unit);
-
- if ( t->memBlock )
- mach64UpdateTexLRU( mmesa, t );
-
- /* register setup */
- if ( unit == 0 ) {
- d &= ~MACH64_SCALE_PIX_WIDTH_MASK;
- d |= (t->textureFormat << 28);
-
- s &= ~(MACH64_TEXTURE_DISABLE |
- MACH64_TEX_CACHE_SPLIT |
- MACH64_TEX_BLEND_FCN_MASK |
- MACH64_TEX_MAP_AEN);
-
- if ( mmesa->multitex ) {
- s |= MACH64_TEX_BLEND_FCN_TRILINEAR | MACH64_TEX_CACHE_SPLIT;
- } else if ( t->BilinearMin ) {
- s |= MACH64_TEX_BLEND_FCN_LINEAR;
- } else {
- s |= MACH64_TEX_BLEND_FCN_NEAREST;
- }
- if ( t->BilinearMag ) {
- s |= MACH64_BILINEAR_TEX_EN;
- } else {
- s &= ~MACH64_BILINEAR_TEX_EN;
- }
-
- if ( t->hasAlpha ) {
- s |= MACH64_TEX_MAP_AEN;
- }
-
- mmesa->setup.tex_cntl &= ~(MACH64_TEXTURE_CLAMP_S |
- MACH64_TEXTURE_CLAMP_T |
- MACH64_SECONDARY_STW);
-
- if ( t->ClampS ) {
- mmesa->setup.tex_cntl |= MACH64_TEXTURE_CLAMP_S;
- }
- if ( t->ClampT ) {
- mmesa->setup.tex_cntl |= MACH64_TEXTURE_CLAMP_T;
- }
-
- mmesa->setup.tex_size_pitch |= ((t->widthLog2 << 0) |
- (t->maxLog2 << 4) |
- (t->heightLog2 << 8));
- } else {
-
- /* Enable texture mapping mode */
- s &= ~MACH64_TEXTURE_DISABLE;
-
- d &= ~MACH64_COMPOSITE_PIX_WIDTH_MASK;
- d |= (t->textureFormat << 4);
-
- mmesa->setup.tex_cntl &= ~(MACH64_COMP_ALPHA |
- MACH64_SEC_TEX_CLAMP_S |
- MACH64_SEC_TEX_CLAMP_T);
- mmesa->setup.tex_cntl |= (MACH64_TEXTURE_COMPOSITE |
- MACH64_SECONDARY_STW);
-
- if ( t->BilinearMin ) {
- mmesa->setup.tex_cntl |= MACH64_COMP_BLEND_BILINEAR;
- } else {
- mmesa->setup.tex_cntl &= ~MACH64_COMP_BLEND_BILINEAR;
- }
- if ( t->BilinearMag ) {
- mmesa->setup.tex_cntl |= MACH64_COMP_FILTER_BILINEAR;
- } else {
- mmesa->setup.tex_cntl &= ~MACH64_COMP_FILTER_BILINEAR;
- }
-
- if ( t->hasAlpha ) {
- mmesa->setup.tex_cntl |= MACH64_COMP_ALPHA;
- }
- if ( t->ClampS ) {
- mmesa->setup.tex_cntl |= MACH64_SEC_TEX_CLAMP_S;
- }
- if ( t->ClampT ) {
- mmesa->setup.tex_cntl |= MACH64_SEC_TEX_CLAMP_T;
- }
-
- mmesa->setup.tex_size_pitch |= ((t->widthLog2 << 16) |
- (t->maxLog2 << 20) |
- (t->heightLog2 << 24));
- }
-
- if ( mmesa->setup.scale_3d_cntl != s ) {
- mmesa->setup.scale_3d_cntl = s;
- mmesa->dirty |= MACH64_UPLOAD_SCALE_3D_CNTL;
- }
-
- if ( mmesa->setup.dp_pix_width != d ) {
- mmesa->setup.dp_pix_width = d;
- mmesa->dirty |= MACH64_UPLOAD_DP_PIX_WIDTH;
- }
- }
- else if (texUnit->_ReallyEnabled) {
- /* 3D or cube map texture enabled - fallback */
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_TRUE );
- }
- else {
- /* texture unit disabled */
- }
-}
-
-
-/* Update the hardware texture state */
-void mach64UpdateTextureState( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p ) en=0x%x 0x%x\n",
- __FUNCTION__, ctx, ctx->Texture.Unit[0]._ReallyEnabled,
- ctx->Texture.Unit[1]._ReallyEnabled);
- }
-
- /* Clear any texturing fallbacks */
- FALLBACK( mmesa, MACH64_FALLBACK_TEXTURE, GL_FALSE );
-
- /* Unbind any currently bound textures */
- if ( mmesa->CurrentTexObj[0] ) mmesa->CurrentTexObj[0]->bound = 0;
- if ( mmesa->CurrentTexObj[1] ) mmesa->CurrentTexObj[1]->bound = 0;
- mmesa->CurrentTexObj[0] = NULL;
- mmesa->CurrentTexObj[1] = NULL;
-
- /* Disable all texturing until it is known to be good */
- mmesa->setup.scale_3d_cntl |= MACH64_TEXTURE_DISABLE;
- mmesa->setup.scale_3d_cntl &= ~MACH64_TEX_MAP_AEN;
- mmesa->setup.tex_cntl &= ~MACH64_TEXTURE_COMPOSITE;
-
- mmesa->setup.tex_size_pitch = 0x00000000;
-
- mmesa->tmu_source[0] = 0;
- mmesa->tmu_source[1] = 1;
- mmesa->multitex = 0;
-
- if (ctx->Texture._EnabledUnits & 0x2) {
- /* unit 1 enabled */
- if (ctx->Texture._EnabledUnits & 0x1) {
- /* units 0 and 1 enabled */
- mmesa->multitex = 1;
- mach64UpdateTextureUnit( ctx, 0 );
- mach64UpdateTextureEnv( ctx, 0 );
- mach64UpdateTextureUnit( ctx, 1 );
- mach64UpdateTextureEnv( ctx, 1 );
- } else {
- mmesa->tmu_source[0] = 1;
- mmesa->tmu_source[1] = 0;
- mach64UpdateTextureUnit( ctx, 0 );
- mach64UpdateTextureEnv( ctx, 0 );
- }
- } else if (ctx->Texture._EnabledUnits & 0x1) {
- /* only unit 0 enabled */
- mach64UpdateTextureUnit( ctx, 0 );
- mach64UpdateTextureEnv( ctx, 0 );
- }
-
- mmesa->dirty |= (MACH64_UPLOAD_SCALE_3D_CNTL |
- MACH64_UPLOAD_TEXTURE);
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.c
deleted file mode 100644
index 4a0044be8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.c
+++ /dev/null
@@ -1,1921 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "macros.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 "mach64_tris.h"
-#include "mach64_state.h"
-#include "mach64_context.h"
-#include "mach64_vb.h"
-#include "mach64_ioctl.h"
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- MACH64_PRIM_POINTS,
- MACH64_PRIM_LINES,
- MACH64_PRIM_LINE_LOOP,
- MACH64_PRIM_LINE_STRIP,
- MACH64_PRIM_TRIANGLES,
- MACH64_PRIM_TRIANGLE_STRIP,
- MACH64_PRIM_TRIANGLE_FAN,
- MACH64_PRIM_QUADS,
- MACH64_PRIM_QUAD_STRIP,
- MACH64_PRIM_POLYGON,
-};
-
-static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim );
-
-
-/* FIXME: Remove this when native template is finished. */
-#define MACH64_PRINT_BUFFER 0
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#if defined(USE_X86_ASM)
-#define DO_COPY_VERTEX( vb, vertsize, v, n, m ) \
-do { \
- register const CARD32 *__p __asm__( "esi" ) = (CARD32 *)v + 10 - vertsize; \
- register int __s __asm__( "ecx" ) = vertsize; \
- if ( vertsize > 7 ) { \
- *vb++ = (2 << 16) | ADRINDEX( MACH64_VERTEX_##n##_SECONDARY_S ); \
- __asm__ __volatile__( "movsl ; movsl ; movsl" \
- : "=D" (vb), "=S" (__p) \
- : "0" (vb), "1" (__p) ); \
- __s -= 3; \
- } \
- *vb++ = ((__s - 1 + m) << 16) | \
- (ADRINDEX( MACH64_VERTEX_##n##_X_Y ) - (__s - 1) ); \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__s), "=D" (vb), "=S" (__p) \
- : "0" (__s), "1" (vb), "2" (__p) ); \
-} while (0)
-#else
-#define DO_COPY_VERTEX( vb, vertsize, v, n, m ) \
-do { \
- CARD32 *__p = (CARD32 *)v + 10 - vertsize; \
- int __s = vertsize; \
- if ( vertsize > 7 ) { \
- LE32_OUT( vb++, (2 << 16) | \
- ADRINDEX( MACH64_VERTEX_##n##_SECONDARY_S ) ); \
- *vb++ = *__p++; \
- *vb++ = *__p++; \
- *vb++ = *__p++; \
- __s -= 3; \
- } \
- LE32_OUT( vb++, ((__s - 1 + m) << 16) | \
- (ADRINDEX( MACH64_VERTEX_##n##_X_Y ) - (__s - 1)) ); \
- while ( __s-- ) { \
- *vb++ = *__p++; \
- } \
-} while (0)
-#endif
-
-#define COPY_VERTEX( vb, vertsize, v, n ) DO_COPY_VERTEX( vb, vertsize, v, n, 0 )
-#define COPY_VERTEX_OOA( vb, vertsize, v, n ) DO_COPY_VERTEX( vb, vertsize, v, n, 1 )
-
-
-static __inline void mach64_draw_quad( mach64ContextPtr mmesa,
- mach64VertexPtr v0,
- mach64VertexPtr v1,
- mach64VertexPtr v2,
- mach64VertexPtr v3 )
-{
-#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
- const GLuint vertsize = mmesa->vertex_size;
- GLint a;
- GLfloat ooa;
- GLuint xy;
- const GLuint xyoffset = 9;
- GLint xx[3], yy[3]; /* 2 fractional bits for hardware */
- unsigned vbsiz = (vertsize + (vertsize > 7 ? 2 : 1)) * 4 + 2;
- CARD32 *vb, *vbchk;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1:\n");
- mach64_print_vertex( ctx, v0 );
- fprintf(stderr,"Vertex 2:\n");
- mach64_print_vertex( ctx, v1 );
- fprintf(stderr,"Vertex 3:\n");
- mach64_print_vertex( ctx, v2 );
- fprintf(stderr,"Vertex 4:\n");
- mach64_print_vertex( ctx, v3 );
- }
-
- xy = LE32_IN( &v0->ui[xyoffset] );
- xx[0] = (GLshort)( xy >> 16 );
- yy[0] = (GLshort)( xy & 0xffff );
-
- xy = LE32_IN( &v1->ui[xyoffset] );
- xx[1] = (GLshort)( xy >> 16 );
- yy[1] = (GLshort)( xy & 0xffff );
-
- xy = LE32_IN( &v3->ui[xyoffset] );
- xx[2] = (GLshort)( xy >> 16 );
- yy[2] = (GLshort)( xy & 0xffff );
-
- a = (xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]);
-
- if ( (mmesa->backface_sign &&
- ((a < 0 && !signbit( mmesa->backface_sign )) ||
- (a > 0 && signbit( mmesa->backface_sign )))) ) {
- /* cull quad */
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS )
- fprintf(stderr,"Quad culled\n");
- return;
- }
-
- ooa = 16.0 / a;
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * sizeof(CARD32) );
- vbchk = vb + vbsiz;
-
- COPY_VERTEX( vb, vertsize, v0, 1 );
- COPY_VERTEX( vb, vertsize, v1, 2 );
- COPY_VERTEX_OOA( vb, vertsize, v3, 3 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- xy = LE32_IN( &v2->ui[xyoffset] );
- xx[0] = (GLshort)( xy >> 16 );
- yy[0] = (GLshort)( xy & 0xffff );
-
- a = (xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]);
-
- ooa = 16.0 / a;
-
- COPY_VERTEX_OOA( vb, vertsize, v2, 1 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- assert( vb == vbchk );
-
-#if MACH64_PRINT_BUFFER
- {
- int i;
- fprintf(stderr, "quad:\n");
- for (i = 0; i < vbsiz; i++)
- fprintf(stderr, " %08lx\n", *(vb - vbsiz + i));
- fprintf(stderr, "\n");
- }
-#endif
-#else
- GLuint vertsize = mmesa->vertex_size;
- GLint coloridx;
- GLfloat ooa;
- GLint xx[3], yy[3]; /* 2 fractional bits for hardware */
- unsigned vbsiz =
- ((
- 1 +
- (vertsize > 6 ? 2 : 0) +
- (vertsize > 4 ? 2 : 0) +
- 3 +
- (mmesa->multitex ? 4 : 0)
- ) * 4 + 4);
- CARD32 *vb;
- unsigned vbidx = 0;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1: x: %.2f, y: %.2f, z: %.2f, w: %f\n\ts0: %f, t0: %f\n\ts1: %f, t1: %f\n",
- v0->v.x, v0->v.y, v0->v.z, v0->v.w, v0->v.u0, v0->v.v0, v0->v.u1, v0->v.v1);
- fprintf(stderr,"Vertex 2: x: %.2f, y: %.2f, z: %.2f, w: %f\n\ts0: %f, t0: %f\n\ts1: %f, t1: %f\n",
- v1->v.x, v1->v.y, v1->v.z, v1->v.w, v1->v.u0, v1->v.v0, v1->v.u1, v1->v.v1);
- fprintf(stderr,"Vertex 3: x: %.2f, y: %.2f, z: %.2f, w: %f\n\ts0: %f, t0: %f\n\ts1: %f, t1: %f\n",
- v2->v.x, v2->v.y, v2->v.z, v2->v.w, v2->v.u0, v2->v.v0, v2->v.u1, v2->v.v1);
- fprintf(stderr,"Vertex 4: x: %.2f, y: %.2f, z: %.2f, w: %f\n\ts0: %f, t0: %f\n\ts1: %f, t1: %f\n",
- v3->v.x, v3->v.y, v3->v.z, v3->v.w, v3->v.u0, v3->v.v0, v3->v.u1, v3->v.v1);
- }
-
-#if MACH64_CLIENT_STATE_EMITS
- /* Enable for interleaved client-side state emits */
- LOCK_HARDWARE( mmesa );
- if ( mmesa->dirty ) {
- mach64EmitHwStateLocked( mmesa );
- }
- if ( mmesa->sarea->dirty ) {
- mach64UploadHwStateLocked( mmesa );
- }
- UNLOCK_HARDWARE( mmesa );
-#endif
-
- xx[0] = (GLint)(v0->v.x * 4);
- yy[0] = (GLint)(v0->v.y * 4);
-
- xx[1] = (GLint)(v1->v.x * 4);
- yy[1] = (GLint)(v1->v.y * 4);
-
- xx[2] = (GLint)(v3->v.x * 4);
- yy[2] = (GLint)(v3->v.y * 4);
-
- ooa = 0.25 * 0.25 * ((xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]));
-
- if ( ooa * mmesa->backface_sign < 0 ) {
- /* cull quad */
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS )
- fprintf(stderr,"Quad culled\n");
- return;
- }
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * 4 );
-
- ooa = 1.0 / ooa;
-
- coloridx = (vertsize > 4) ? 4: 3;
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_1_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_1_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_1_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_1_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_1_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_1_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_1_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_1_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[0] << 16) | (yy[0] & 0xffff) ); /* MACH64_VERTEX_1_X_Y */
-
- if (mmesa->multitex) {
- /* setup for 3 sequential reg writes */
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_SECONDARY_S) );
- LE32_OUT( &vb[vbidx++], v0->ui[8] ); /* MACH64_VERTEX_1_SECONDARY_S */
- LE32_OUT( &vb[vbidx++], v0->ui[9] ); /* MACH64_VERTEX_1_SECONDARY_T */
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_1_SECONDARY_W */
- }
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_2_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_2_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_2_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v1->ui[6] ); /* MACH64_VERTEX_2_S */
- LE32_OUT( &vb[vbidx++], v1->ui[7] ); /* MACH64_VERTEX_2_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v1->ui[3] ); /* MACH64_VERTEX_2_W */
- LE32_OUT( &vb[vbidx++], v1->ui[5] ); /* MACH64_VERTEX_2_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v1->v.z) << 15) ); /* MACH64_VERTEX_2_Z */
- vb[vbidx++] = v1->ui[coloridx]; /* MACH64_VERTEX_2_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[1] << 16) | (yy[1] & 0xffff) ); /* MACH64_VERTEX_2_X_Y */
-
- if (mmesa->multitex) {
- /* setup for 3 sequential reg writes */
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_2_SECONDARY_S) );
- LE32_OUT( &vb[vbidx++], v1->ui[8] ); /* MACH64_VERTEX_2_SECONDARY_S */
- LE32_OUT( &vb[vbidx++], v1->ui[9] ); /* MACH64_VERTEX_2_SECONDARY_T */
- LE32_OUT( &vb[vbidx++], v1->ui[3] ); /* MACH64_VERTEX_2_SECONDARY_W */
- }
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_3_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_3_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_3_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v3->ui[6] ); /* MACH64_VERTEX_3_S */
- LE32_OUT( &vb[vbidx++], v3->ui[7] ); /* MACH64_VERTEX_3_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v3->ui[3] ); /* MACH64_VERTEX_3_W */
- LE32_OUT( &vb[vbidx++], v3->ui[5] ); /* MACH64_VERTEX_3_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v3->v.z) << 15) ); /* MACH64_VERTEX_3_Z */
- vb[vbidx++] = v3->ui[coloridx]; /* MACH64_VERTEX_3_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[2] << 16) | (yy[2] & 0xffff) ); /* MACH64_VERTEX_3_X_Y */
-
- if (mmesa->multitex) {
- /* setup for 3 sequential reg writes */
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_3_SECONDARY_S) );
- LE32_OUT( &vb[vbidx++], v3->ui[8] ); /* MACH64_VERTEX_3_SECONDARY_S */
- LE32_OUT( &vb[vbidx++], v3->ui[9] ); /* MACH64_VERTEX_3_SECONDARY_T */
- LE32_OUT( &vb[vbidx++], v3->ui[3] ); /* MACH64_VERTEX_3_SECONDARY_W */
- }
-
- LE32_OUT( &vb[vbidx++], ADRINDEX(MACH64_ONE_OVER_AREA_UC) );
- LE32_OUT( &vb[vbidx++], *(GLuint *)&ooa );
-
- xx[0] = (GLint)(v2->v.x * 4);
- yy[0] = (GLint)(v2->v.y * 4);
-
- ooa = 0.25 * 0.25 * ((xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]));
- ooa = 1.0 / ooa;
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_1_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_1_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v2->ui[6] ); /* MACH64_VERTEX_1_S */
- LE32_OUT( &vb[vbidx++], v2->ui[7] ); /* MACH64_VERTEX_1_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v2->ui[3] ); /* MACH64_VERTEX_1_W */
- LE32_OUT( &vb[vbidx++], v2->ui[5] ); /* MACH64_VERTEX_1_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v2->v.z) << 15) ); /* MACH64_VERTEX_1_Z */
- vb[vbidx++] = v2->ui[coloridx]; /* MACH64_VERTEX_1_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[0] << 16) | (yy[0] & 0xffff) ); /* MACH64_VERTEX_1_X_Y */
-
- if (mmesa->multitex) {
- /* setup for 3 sequential reg writes */
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_SECONDARY_S) );
- LE32_OUT( &vb[vbidx++], v2->ui[8] ); /* MACH64_VERTEX_1_SECONDARY_S */
- LE32_OUT( &vb[vbidx++], v2->ui[9] ); /* MACH64_VERTEX_1_SECONDARY_T */
- LE32_OUT( &vb[vbidx++], v2->ui[3] ); /* MACH64_VERTEX_1_SECONDARY_W */
- }
-
- LE32_OUT( &vb[vbidx++], ADRINDEX(MACH64_ONE_OVER_AREA_UC) );
- LE32_OUT( &vb[vbidx++], *(GLuint *)&ooa );
-
- assert(vbsiz == vbidx);
-
-#if MACH64_PRINT_BUFFER
- {
- int i;
- fprintf(stderr, "quad:\n");
- for (i = 0; i < vbsiz; i++)
- fprintf(stderr, " %08lx\n", *(vb + i));
- fprintf(stderr, "\n");
- }
-#endif
-#endif
-}
-
-static __inline void mach64_draw_triangle( mach64ContextPtr mmesa,
- mach64VertexPtr v0,
- mach64VertexPtr v1,
- mach64VertexPtr v2 )
-{
-#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
- GLuint vertsize = mmesa->vertex_size;
- GLint a;
- GLfloat ooa;
- GLuint xy;
- const GLuint xyoffset = 9;
- GLint xx[3], yy[3]; /* 2 fractional bits for hardware */
- unsigned vbsiz = (vertsize + (vertsize > 7 ? 2 : 1)) * 3 + 1;
- CARD32 *vb, *vbchk;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1:\n");
- mach64_print_vertex( ctx, v0 );
- fprintf(stderr,"Vertex 2:\n");
- mach64_print_vertex( ctx, v1 );
- fprintf(stderr,"Vertex 3:\n");
- mach64_print_vertex( ctx, v2 );
- }
-
- xy = LE32_IN( &v0->ui[xyoffset] );
- xx[0] = (GLshort)( xy >> 16 );
- yy[0] = (GLshort)( xy & 0xffff );
-
- xy = LE32_IN( &v1->ui[xyoffset] );
- xx[1] = (GLshort)( xy >> 16 );
- yy[1] = (GLshort)( xy & 0xffff );
-
- xy = LE32_IN( &v2->ui[xyoffset] );
- xx[2] = (GLshort)( xy >> 16 );
- yy[2] = (GLshort)( xy & 0xffff );
-
- a = (xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]);
-
- if ( mmesa->backface_sign &&
- ((a < 0 && !signbit( mmesa->backface_sign )) ||
- (a > 0 && signbit( mmesa->backface_sign ))) ) {
- /* cull triangle */
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS )
- fprintf(stderr,"Triangle culled\n");
- return;
- }
-
- ooa = 16.0 / a;
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * sizeof(CARD32) );
- vbchk = vb + vbsiz;
-
- COPY_VERTEX( vb, vertsize, v0, 1 );
- COPY_VERTEX( vb, vertsize, v1, 2 );
- COPY_VERTEX_OOA( vb, vertsize, v2, 3 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- assert( vb == vbchk );
-
-#if MACH64_PRINT_BUFFER
- {
- int i;
- fprintf(stderr, "tri:\n");
- for (i = 0; i < vbsiz; i++)
- fprintf(stderr, " %08lx\n", *(vb - vbsiz + i));
- fprintf(stderr, "\n");
- }
-#endif
-#else
- GLuint vertsize = mmesa->vertex_size;
- GLint coloridx;
- GLfloat ooa;
- GLint xx[3], yy[3]; /* 2 fractional bits for hardware */
- unsigned vbsiz =
- ((
- 1 +
- (vertsize > 6 ? 2 : 0) +
- (vertsize > 4 ? 2 : 0) +
- 3 +
- (mmesa->multitex ? 4 : 0)
- ) * 3 + 2);
- CARD32 *vb;
- unsigned vbidx = 0;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1: x: %.2f, y: %.2f, z: %.2f, w: %f\n\ts0: %f, t0: %f\n\ts1: %f, t1: %f\n",
- v0->v.x, v0->v.y, v0->v.z, v0->v.w, v0->v.u0, v0->v.v0, v0->v.u1, v0->v.v1);
- fprintf(stderr,"Vertex 2: x: %.2f, y: %.2f, z: %.2f, w: %f\n\ts0: %f, t0: %f\n\ts1: %f, t1: %f\n",
- v1->v.x, v1->v.y, v1->v.z, v1->v.w, v1->v.u0, v1->v.v0, v1->v.u1, v1->v.v1);
- fprintf(stderr,"Vertex 3: x: %.2f, y: %.2f, z: %.2f, w: %f\n\ts0: %f, t0: %f\n\ts1: %f, t1: %f\n",
- v2->v.x, v2->v.y, v2->v.z, v2->v.w, v2->v.u0, v2->v.v0, v2->v.u1, v2->v.v1);
- }
-
-#if MACH64_CLIENT_STATE_EMITS
- /* Enable for interleaved client-side state emits */
- LOCK_HARDWARE( mmesa );
- if ( mmesa->dirty ) {
- mach64EmitHwStateLocked( mmesa );
- }
- if ( mmesa->sarea->dirty ) {
- mach64UploadHwStateLocked( mmesa );
- }
- UNLOCK_HARDWARE( mmesa );
-#endif
-
- xx[0] = (GLint)(v0->v.x * 4);
- yy[0] = (GLint)(v0->v.y * 4);
-
- xx[1] = (GLint)(v1->v.x * 4);
- yy[1] = (GLint)(v1->v.y * 4);
-
- xx[2] = (GLint)(v2->v.x * 4);
- yy[2] = (GLint)(v2->v.y * 4);
-
- ooa = 0.25 * 0.25 * ((xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]));
-
- if ( ooa * mmesa->backface_sign < 0 ) {
- /* cull triangle */
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS )
- fprintf(stderr,"Triangle culled\n");
- return;
- }
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * 4 );
-
- ooa = 1.0 / ooa;
-
- coloridx = (vertsize > 4) ? 4: 3;
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_1_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_1_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_1_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_1_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_1_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_1_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_1_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_1_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[0] << 16) | (yy[0] & 0xffff) ); /* MACH64_VERTEX_1_X_Y */
-
- if (mmesa->multitex) {
- /* setup for 3 sequential reg writes */
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_SECONDARY_S) );
- LE32_OUT( &vb[vbidx++], v0->ui[8] ); /* MACH64_VERTEX_1_SECONDARY_S */
- LE32_OUT( &vb[vbidx++], v0->ui[9] ); /* MACH64_VERTEX_1_SECONDARY_T */
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_1_SECONDARY_W */
- }
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_2_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_2_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_2_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v1->ui[6] ); /* MACH64_VERTEX_2_S */
- LE32_OUT( &vb[vbidx++], v1->ui[7] ); /* MACH64_VERTEX_2_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v1->ui[3] ); /* MACH64_VERTEX_2_W */
- LE32_OUT( &vb[vbidx++], v1->ui[5] ); /* MACH64_VERTEX_2_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v1->v.z) << 15) ); /* MACH64_VERTEX_2_Z */
- vb[vbidx++] = v1->ui[coloridx]; /* MACH64_VERTEX_2_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[1] << 16) | (yy[1] & 0xffff) ); /* MACH64_VERTEX_2_X_Y */
-
- if (mmesa->multitex) {
- /* setup for 3 sequential reg writes */
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_2_SECONDARY_S) );
- LE32_OUT( &vb[vbidx++], v1->ui[8] ); /* MACH64_VERTEX_2_SECONDARY_S */
- LE32_OUT( &vb[vbidx++], v1->ui[9] ); /* MACH64_VERTEX_2_SECONDARY_T */
- LE32_OUT( &vb[vbidx++], v1->ui[3] ); /* MACH64_VERTEX_2_SECONDARY_W */
- }
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_3_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_3_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_3_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v2->ui[6] ); /* MACH64_VERTEX_3_S */
- LE32_OUT( &vb[vbidx++], v2->ui[7] ); /* MACH64_VERTEX_3_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v2->ui[3] ); /* MACH64_VERTEX_3_W */
- LE32_OUT( &vb[vbidx++], v2->ui[5] ); /* MACH64_VERTEX_3_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v2->v.z) << 15) ); /* MACH64_VERTEX_3_Z */
- vb[vbidx++] = v2->ui[coloridx]; /* MACH64_VERTEX_3_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[2] << 16) | (yy[2] & 0xffff) ); /* MACH64_VERTEX_3_X_Y */
-
- if (mmesa->multitex) {
- /* setup for 3 sequential reg writes */
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_3_SECONDARY_S) );
- LE32_OUT( &vb[vbidx++], v2->ui[8] ); /* MACH64_VERTEX_3_SECONDARY_S */
- LE32_OUT( &vb[vbidx++], v2->ui[9] ); /* MACH64_VERTEX_3_SECONDARY_T */
- LE32_OUT( &vb[vbidx++], v2->ui[3] ); /* MACH64_VERTEX_3_SECONDARY_W */
- }
-
- LE32_OUT( &vb[vbidx++], ADRINDEX(MACH64_ONE_OVER_AREA_UC) );
- LE32_OUT( &vb[vbidx++], *(GLuint *)&ooa );
-
- assert(vbsiz == vbidx);
-
-#if MACH64_PRINT_BUFFER
- {
- int i;
- fprintf(stderr, "tri:\n");
- for (i = 0; i < vbsiz; ++i)
- fprintf(stderr, " %08lx\n", *(vb + i));
- fprintf(stderr, "\n");
- }
-#endif
-#endif
-}
-
-static __inline void mach64_draw_line( mach64ContextPtr mmesa,
- mach64VertexPtr v0,
- mach64VertexPtr v1 )
-{
-#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
- const GLuint vertsize = mmesa->vertex_size;
- GLint width = (GLint)(mmesa->glCtx->Line._Width * 2.0); /* 2 fractional bits for hardware */
- GLfloat ooa;
- GLuint *pxy0, *pxy1;
- GLuint xy0old, xy0, xy1old, xy1;
- const GLuint xyoffset = 9;
- GLint x0, y0, x1, y1;
- GLint dx, dy, ix, iy;
- unsigned vbsiz = (vertsize + (vertsize > 7 ? 2 : 1)) * 4 + 2;
- CARD32 *vb, *vbchk;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1:\n");
- mach64_print_vertex( ctx, v0 );
- fprintf(stderr,"Vertex 2:\n");
- mach64_print_vertex( ctx, v1 );
- }
-
- if( !width )
- width = 1; /* round to the nearest supported width */
-
- pxy0 = &v0->ui[xyoffset];
- xy0old = *pxy0;
- xy0 = LE32_IN( &xy0old );
- x0 = (GLshort)( xy0 >> 16 );
- y0 = (GLshort)( xy0 & 0xffff );
-
- pxy1 = &v1->ui[xyoffset];
- xy1old = *pxy1;
- xy1 = LE32_IN( &xy1old );
- x1 = (GLshort)( xy1 >> 16 );
- y1 = (GLshort)( xy1 & 0xffff );
-
- if ( (dx = x1 - x0) < 0 ) {
- dx = -dx;
- }
- if ( (dy = y1 - y0) < 0 ) {
- dy = -dy;
- }
-
- /* adjust vertices depending on line direction */
- if ( dx > dy ) {
- ix = 0;
- iy = width;
- ooa = 8.0 / ((x1 - x0) * width);
- } else {
- ix = width;
- iy = 0;
- ooa = 8.0 / ((y0 - y1) * width);
- }
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * sizeof(CARD32) );
- vbchk = vb + vbsiz;
-
- LE32_OUT( pxy0, (( x0 - ix ) << 16) | (( y0 - iy ) & 0xffff) );
- COPY_VERTEX( vb, vertsize, v0, 1 );
- LE32_OUT( pxy1, (( x1 - ix ) << 16) | (( y1 - iy ) & 0xffff) );
- COPY_VERTEX( vb, vertsize, v1, 2 );
- LE32_OUT( pxy0, (( x0 + ix ) << 16) | (( y0 + iy ) & 0xffff) );
- COPY_VERTEX_OOA( vb, vertsize, v0, 3 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- ooa = -ooa;
-
- LE32_OUT( pxy1, (( x1 + ix ) << 16) | (( y1 + iy ) & 0xffff) );
- COPY_VERTEX_OOA( vb, vertsize, v1, 1 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- *pxy0 = xy0old;
- *pxy1 = xy1old;
-#else /* !MACH64_NATIVE_VTXFMT */
- GLuint vertsize = mmesa->vertex_size;
- GLint coloridx;
- float width = 1.0; /* Only support 1 pix lines now */
- GLfloat ooa;
- GLint xx[3], yy[3]; /* 2 fractional bits for hardware */
- unsigned vbsiz =
- ((
- 1 +
- (vertsize > 6 ? 2 : 0) +
- (vertsize > 4 ? 2 : 0) +
- 3 +
- (mmesa->multitex ? 4 : 0)
- ) * 4 + 4);
- CARD32 *vb;
- unsigned vbidx = 0;
-
- GLfloat hw, dx, dy, ix, iy;
- GLfloat x0 = v0->v.x;
- GLfloat y0 = v0->v.y;
- GLfloat x1 = v1->v.x;
- GLfloat y1 = v1->v.y;
-
-#if MACH64_CLIENT_STATE_EMITS
- /* Enable for interleaved client-side state emits */
- LOCK_HARDWARE( mmesa );
- if ( mmesa->dirty ) {
- mach64EmitHwStateLocked( mmesa );
- }
- if ( mmesa->sarea->dirty ) {
- mach64UploadHwStateLocked( mmesa );
- }
- UNLOCK_HARDWARE( mmesa );
-#endif
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1: x: %.2f, y: %.2f, z: %.2f, w: %f\n",
- v0->v.x, v0->v.y, v0->v.z, v0->v.w);
- fprintf(stderr,"Vertex 2: x: %.2f, y: %.2f, z: %.2f, w: %f\n",
- v1->v.x, v1->v.y, v1->v.z, v1->v.w);
- }
-
- hw = 0.5F * width;
- if (hw > 0.1F && hw < 0.5F) {
- hw = 0.5F;
- }
-
- /* adjust vertices depending on line direction */
- dx = v0->v.x - v1->v.x;
- dy = v0->v.y - v1->v.y;
- if (dx * dx > dy * dy) {
- /* X-major line */
- ix = 0.0F;
- iy = hw;
- if (x1 < x0) {
- x0 += 0.5F;
- x1 += 0.5F;
- }
- y0 -= 0.5F;
- y1 -= 0.5F;
- }
- else {
- /* Y-major line */
- ix = hw;
- iy = 0.0F;
- if (y1 > y0) {
- y0 -= 0.5F;
- y1 -= 0.5F;
- }
- x0 += 0.5F;
- x1 += 0.5F;
- }
-
- xx[0] = (GLint)((x0 - ix) * 4);
- yy[0] = (GLint)((y0 - iy) * 4);
-
- xx[1] = (GLint)((x1 - ix) * 4);
- yy[1] = (GLint)((y1 - iy) * 4);
-
- xx[2] = (GLint)((x0 + ix) * 4);
- yy[2] = (GLint)((y0 + iy) * 4);
-
- ooa = 0.25 * 0.25 * ((xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]));
-
- if ( ooa * mmesa->backface_sign < 0 ) {
- /* cull line */
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS )
- fprintf(stderr,"Line culled\n");
- return;
- }
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * 4 );
-
- ooa = 1.0 / ooa;
-
- coloridx = (vertsize > 4) ? 4: 3;
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_1_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_1_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_1_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_1_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_1_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_1_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_1_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_1_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[0] << 16) | (yy[0] & 0xffff) ); /* MACH64_VERTEX_1_X_Y */
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_2_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_2_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_2_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v1->ui[6] ); /* MACH64_VERTEX_2_S */
- LE32_OUT( &vb[vbidx++], v1->ui[7] ); /* MACH64_VERTEX_2_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v1->ui[3] ); /* MACH64_VERTEX_2_W */
- LE32_OUT( &vb[vbidx++], v1->ui[5] ); /* MACH64_VERTEX_2_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v1->v.z) << 15) ); /* MACH64_VERTEX_2_Z */
- vb[vbidx++] = v1->ui[coloridx]; /* MACH64_VERTEX_2_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[1] << 16) | (yy[1] & 0xffff) ); /* MACH64_VERTEX_2_X_Y */
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_3_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_3_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_3_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_3_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_3_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_3_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_3_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_3_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_3_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[2] << 16) | (yy[2] & 0xffff) ); /* MACH64_VERTEX_3_X_Y */
-
- LE32_OUT( &vb[vbidx++], ADRINDEX(MACH64_ONE_OVER_AREA_UC) );
- LE32_OUT( &vb[vbidx++], *(GLuint *)&ooa );
-
- xx[0] = (GLint)((x1 + ix) * 4);
- yy[0] = (GLint)((y1 + iy) * 4);
-
- ooa = 0.25 * 0.25 * ((xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]));
- ooa = 1.0 / ooa;
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_1_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_1_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v1->ui[6] ); /* MACH64_VERTEX_1_S */
- LE32_OUT( &vb[vbidx++], v1->ui[7] ); /* MACH64_VERTEX_1_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v1->ui[3] ); /* MACH64_VERTEX_1_W */
- LE32_OUT( &vb[vbidx++], v1->ui[5] ); /* MACH64_VERTEX_1_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v1->v.z) << 15) ); /* MACH64_VERTEX_1_Z */
- vb[vbidx++] = v1->ui[coloridx]; /* MACH64_VERTEX_1_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[0] << 16) | (yy[0] & 0xffff) ); /* MACH64_VERTEX_1_X_Y */
-
- LE32_OUT( &vb[vbidx++], ADRINDEX(MACH64_ONE_OVER_AREA_UC) );
- LE32_OUT( &vb[vbidx++], *(GLuint *)&ooa );
-
- assert(vbsiz == vbidx);
-#endif
-}
-
-static __inline void mach64_draw_point( mach64ContextPtr mmesa,
- mach64VertexPtr v0 )
-{
-#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
- const GLuint vertsize = mmesa->vertex_size;
- GLint sz = (GLint)(mmesa->glCtx->Point._Size * 2.0); /* 2 fractional bits for hardware */
- GLfloat ooa;
- GLuint *pxy;
- GLuint xyold, xy;
- const GLuint xyoffset = 9;
- GLint x, y;
- unsigned vbsiz = (vertsize + (vertsize > 7 ? 2 : 1)) * 4 + 2;
- CARD32 *vb, *vbchk;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1:\n");
- mach64_print_vertex( ctx, v0 );
- }
-
- if( !sz )
- sz = 1; /* round to the nearest supported size */
-
- pxy = &v0->ui[xyoffset];
- xyold = *pxy;
- xy = LE32_IN( &xyold );
- x = (GLshort)( xy >> 16 );
- y = (GLshort)( xy & 0xffff );
-
- ooa = 4.0 / (sz * sz);
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * sizeof(CARD32) );
- vbchk = vb + vbsiz;
-
- LE32_OUT( pxy, (( x - sz ) << 16) | (( y - sz ) & 0xffff) );
- COPY_VERTEX( vb, vertsize, v0, 1 );
- LE32_OUT( pxy, (( x + sz ) << 16) | (( y - sz ) & 0xffff) );
- COPY_VERTEX( vb, vertsize, v0, 2 );
- LE32_OUT( pxy, (( x - sz ) << 16) | (( y + sz ) & 0xffff) );
- COPY_VERTEX_OOA( vb, vertsize, v0, 3 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- ooa = -ooa;
-
- LE32_OUT( pxy, (( x + sz ) << 16) | (( y + sz ) & 0xffff) );
- COPY_VERTEX_OOA( vb, vertsize, v0, 1 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- *pxy = xyold;
-#else /* !MACH64_NATIVE_VTXFMT */
- GLuint vertsize = mmesa->vertex_size;
- GLint coloridx;
- float sz = 1.0; /* Only support 1 pix points now */
- GLfloat ooa;
- GLint xx[3], yy[3]; /* 2 fractional bits for hardware */
- unsigned vbsiz =
- ((
- 1 +
- (vertsize > 6 ? 2 : 0) +
- (vertsize > 4 ? 2 : 0) +
- 3 +
- (mmesa->multitex ? 4 : 0)
- ) * 4 + 4);
- CARD32 *vb;
- unsigned vbidx = 0;
-
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS ) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr,"Vertex 1: x: %.2f, y: %.2f, z: %.2f, w: %f\n",
- v0->v.x, v0->v.y, v0->v.z, v0->v.w);
- }
-
-#if MACH64_CLIENT_STATE_EMITS
- /* Enable for interleaved client-side state emits */
- LOCK_HARDWARE( mmesa );
- if ( mmesa->dirty ) {
- mach64EmitHwStateLocked( mmesa );
- }
- if ( mmesa->sarea->dirty ) {
- mach64UploadHwStateLocked( mmesa );
- }
- UNLOCK_HARDWARE( mmesa );
-#endif
-
- xx[0] = (GLint)((v0->v.x - sz) * 4);
- yy[0] = (GLint)((v0->v.y - sz) * 4);
-
- xx[1] = (GLint)((v0->v.x + sz) * 4);
- yy[1] = (GLint)((v0->v.y - sz) * 4);
-
- xx[2] = (GLint)((v0->v.x - sz) * 4);
- yy[2] = (GLint)((v0->v.y + sz) * 4);
-
- ooa = 0.25 * 0.25 * ((xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]));
-
- if ( ooa * mmesa->backface_sign < 0 ) {
- /* cull quad */
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS )
- fprintf(stderr,"Point culled\n");
- return;
- }
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * 4 );
-
- ooa = 1.0 / ooa;
-
- coloridx = (vertsize > 4) ? 4: 3;
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_1_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_1_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_1_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_1_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_1_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_1_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_1_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_1_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[0] << 16) | (yy[0] & 0xffff) ); /* MACH64_VERTEX_1_X_Y */
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_2_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_2_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_2_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_2_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_2_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_2_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_2_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_2_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_2_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[1] << 16) | (yy[1] & 0xffff) ); /* MACH64_VERTEX_2_X_Y */
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_3_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_3_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_3_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_3_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_3_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_3_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_3_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_3_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_3_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[2] << 16) | (yy[2] & 0xffff) ); /* MACH64_VERTEX_3_X_Y */
-
- LE32_OUT( &vb[vbidx++], ADRINDEX(MACH64_ONE_OVER_AREA_UC) );
- LE32_OUT( &vb[vbidx++], *(GLuint *)&ooa );
-
- xx[0] = (GLint)((v0->v.x + sz) * 4);
- yy[0] = (GLint)((v0->v.y + sz) * 4);
-
- ooa = 0.25 * 0.25 * ((xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]));
- ooa = 1.0 / ooa;
-
- /* setup for 3,5, or 7 sequential reg writes based on vertex format */
- switch (vertsize) {
- case 6:
- LE32_OUT( &vb[vbidx++], (4 << 16) | ADRINDEX(MACH64_VERTEX_1_W) );
- break;
- case 4:
- LE32_OUT( &vb[vbidx++], (2 << 16) | ADRINDEX(MACH64_VERTEX_1_Z) );
- break;
- default: /* vertsize >= 8 */
- LE32_OUT( &vb[vbidx++], (6 << 16) | ADRINDEX(MACH64_VERTEX_1_S) );
- break;
- }
- if (vertsize > 6) {
- LE32_OUT( &vb[vbidx++], v0->ui[6] ); /* MACH64_VERTEX_1_S */
- LE32_OUT( &vb[vbidx++], v0->ui[7] ); /* MACH64_VERTEX_1_T */
- }
- if (vertsize > 4) {
- LE32_OUT( &vb[vbidx++], v0->ui[3] ); /* MACH64_VERTEX_1_W */
- LE32_OUT( &vb[vbidx++], v0->ui[5] ); /* MACH64_VERTEX_1_SPEC_ARGB */
- }
- LE32_OUT( &vb[vbidx++], ((GLint)(v0->v.z) << 15) ); /* MACH64_VERTEX_1_Z */
- vb[vbidx++] = v0->ui[coloridx]; /* MACH64_VERTEX_1_ARGB */
- LE32_OUT( &vb[vbidx++], (xx[0] << 16) | (yy[0] & 0xffff) ); /* MACH64_VERTEX_1_X_Y */
-
- LE32_OUT( &vb[vbidx++], ADRINDEX(MACH64_ONE_OVER_AREA_UC) );
- LE32_OUT( &vb[vbidx++], *(GLuint *)&ooa );
-
- assert(vbsiz == vbidx);
-#endif
-}
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_tri( mmesa, a, b, c ); \
- else \
- mach64_draw_triangle( mmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- mmesa->draw_tri( mmesa, a, b, d ); \
- mmesa->draw_tri( mmesa, b, c, d ); \
- } else \
- mach64_draw_quad( mmesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_line( mmesa, v0, v1 ); \
- else \
- mach64_draw_line( mmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_point( mmesa, v0 ); \
- else \
- mach64_draw_point( mmesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define MACH64_OFFSET_BIT 0x01
-#define MACH64_TWOSIDE_BIT 0x02
-#define MACH64_UNFILLED_BIT 0x04
-#define MACH64_FALLBACK_BIT 0x08
-#define MACH64_MAX_TRIFUNC 0x10
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[MACH64_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & MACH64_FALLBACK_BIT)
-#define DO_OFFSET (IND & MACH64_OFFSET_BIT)
-#define DO_UNFILLED (IND & MACH64_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & MACH64_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX mach64Vertex
-#define TAB rast_tab
-
-#if MACH64_NATIVE_VTXFMT
-
-/* #define DEPTH_SCALE 65536.0 */
-#define DEPTH_SCALE 1
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) ((GLfloat)(GLshort)(LE32_IN( &(_v)->ui[xyoffset] ) & 0xffff) / 4.0)
-#define VERT_Y(_v) ((GLfloat)(GLshort)(LE32_IN( &(_v)->ui[xyoffset] ) >> 16) / 4.0)
-#define VERT_Z(_v) ((GLfloat) LE32_IN( &(_v)->ui[zoffset] ))
-#define INSANE_VERTICES
-#define VERT_SET_Z(_v,val) LE32_OUT( &(_v)->ui[zoffset], (GLuint)(val) )
-#define VERT_Z_ADD(_v,val) LE32_OUT( &(_v)->ui[zoffset], LE32_IN( &(_v)->ui[zoffset] ) + (GLuint)(val) )
-#define AREA_IS_CCW( a ) ((a) < 0)
-#define GET_VERTEX(e) (mmesa->verts + ((e) * mmesa->vertex_size * sizeof(int)))
-
-#define MACH64_COLOR( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[0], src[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[1], src[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[2], src[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[3], src[3]); \
-} while (0)
-
-#define MACH64_SPEC( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[0], src[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[1], src[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[2], src[0]); \
-} while (0)
-
-#define VERT_SET_RGBA( v, c ) MACH64_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (havespec) MACH64_SPEC( v->ub4[specoffset], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) COPY_3V( v0->ub4[specoffset], v1->ub4[specoffset] )
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[specoffset] = spec[idx]
-
-#define LOCAL_VARS(n) \
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint vertex_size = mmesa->vertex_size; \
- const GLuint xyoffset = 9; \
- const GLuint coloroffset = 8; \
- const GLuint zoffset = 7; \
- const GLuint specoffset = 6; \
- GLboolean havespec = vertex_size >= 4 ? 1 : 0; \
- (void) color; (void) spec; (void) vertex_size; \
- (void) xyoffset; (void) coloroffset; (void) zoffset; \
- (void) specoffset; (void) havespec;
-
-#else
-
-#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) (mmesa->verts + ((e) * mmesa->vertex_size * sizeof(int)))
-
-#define MACH64_COLOR( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[0], src[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[1], src[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[2], src[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[3], src[3]); \
-} while (0)
-
-#define MACH64_SPEC( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[0], src[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[1], src[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(dst[2], src[0]); \
-} while (0)
-
-#define VERT_SET_RGBA( v, c ) MACH64_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (havespec) MACH64_SPEC( v->ub4[5], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5])
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (mmesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (mmesa->vertex_size == 4 ? 0 : 1); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-#endif
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (mmesa->hw_primitive != hw_prim[x]) \
- mach64RasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE mmesa->render_primitive
-#define IND MACH64_FALLBACK_BIT
-#define TAG(x) x
-#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 (MACH64_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT|MACH64_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_OFFSET_BIT|MACH64_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT|MACH64_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT|MACH64_OFFSET_BIT|MACH64_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_OFFSET_BIT|MACH64_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT|MACH64_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT|MACH64_OFFSET_BIT|MACH64_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_UNFILLED_BIT|MACH64_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_OFFSET_BIT|MACH64_UNFILLED_BIT|MACH64_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT|MACH64_UNFILLED_BIT|MACH64_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MACH64_TWOSIDE_BIT|MACH64_OFFSET_BIT|MACH64_UNFILLED_BIT| \
- MACH64_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-/***********************************************************************
- * 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
-mach64_fallback_tri( mach64ContextPtr mmesa,
- mach64Vertex *v0,
- mach64Vertex *v1,
- mach64Vertex *v2 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[3];
- mach64_translate_vertex( ctx, v0, &v[0] );
- mach64_translate_vertex( ctx, v1, &v[1] );
- mach64_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-mach64_fallback_line( mach64ContextPtr mmesa,
- mach64Vertex *v0,
- mach64Vertex *v1 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[2];
- mach64_translate_vertex( ctx, v0, &v[0] );
- mach64_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-mach64_fallback_point( mach64ContextPtr mmesa,
- mach64Vertex *v0 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[1];
- mach64_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (mach64Vertex *)(mach64verts + ((x) * vertsize * sizeof(int)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- mach64_draw_point( mmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- mach64_draw_line( mmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- mach64_draw_triangle( mmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- mach64_draw_quad( mmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- mach64RenderPrimitive( ctx, x ); \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- const GLuint vertsize = mmesa->vertex_size; \
- const char *mach64verts = (char *)mmesa->verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) mach64_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) mach64_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void mach64RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = mmesa->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 mach64RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-#if MACH64_NATIVE_VTXFMT
-static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
- const GLuint vertsize = mmesa->vertex_size;
- GLint a;
- GLfloat ooa;
- GLuint xy;
- const GLuint xyoffset = 9;
- GLint xx[3], yy[3]; /* 2 fractional bits for hardware */
- unsigned vbsiz = (vertsize + (vertsize > 7 ? 2 : 1)) * n + (n-2);
- CARD32 *vb, *vbchk;
- GLubyte *mach64verts = (GLubyte *)mmesa->verts;
- mach64VertexPtr v0, v1, v2;
- int i;
-
- v0 = (mach64VertexPtr)VERT(elts[1]);
- v1 = (mach64VertexPtr)VERT(elts[2]);
- v2 = (mach64VertexPtr)VERT(elts[0]);
-
- xy = LE32_IN( &v0->ui[xyoffset] );
- xx[0] = (GLshort)( xy >> 16 );
- yy[0] = (GLshort)( xy & 0xffff );
-
- xy = LE32_IN( &v1->ui[xyoffset] );
- xx[1] = (GLshort)( xy >> 16 );
- yy[1] = (GLshort)( xy & 0xffff );
-
- xy = LE32_IN( &v2->ui[xyoffset] );
- xx[2] = (GLshort)( xy >> 16 );
- yy[2] = (GLshort)( xy & 0xffff );
-
- a = (xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]);
-
- if ( (mmesa->backface_sign &&
- ((a < 0 && !signbit( mmesa->backface_sign )) ||
- (a > 0 && signbit( mmesa->backface_sign )))) ) {
- /* cull polygon */
- if ( MACH64_DEBUG & DEBUG_VERBOSE_PRIMS )
- fprintf(stderr,"Polygon culled\n");
- return;
- }
-
- ooa = 16.0 / a;
-
- vb = (CARD32 *)mach64AllocDmaLow( mmesa, vbsiz * sizeof(CARD32) );
- vbchk = vb + vbsiz;
-
- COPY_VERTEX( vb, vertsize, v0, 1 );
- COPY_VERTEX( vb, vertsize, v1, 2 );
- COPY_VERTEX_OOA( vb, vertsize, v2, 3 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- i = 3;
- while (1) {
- if (i >= n)
- break;
- v0 = (mach64VertexPtr)VERT(elts[i]);
- i++;
-
- xy = LE32_IN( &v0->ui[xyoffset] );
- xx[0] = (GLshort)( xy >> 16 );
- yy[0] = (GLshort)( xy & 0xffff );
-
- a = (xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]);
- ooa = 16.0 / a;
-
- COPY_VERTEX_OOA( vb, vertsize, v0, 1 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
-
- if (i >= n)
- break;
- v1 = (mach64VertexPtr)VERT(elts[i]);
- i++;
-
- xy = LE32_IN( &v1->ui[xyoffset] );
- xx[1] = (GLshort)( xy >> 16 );
- yy[1] = (GLshort)( xy & 0xffff );
-
- a = (xx[0] - xx[2]) * (yy[1] - yy[2]) -
- (yy[0] - yy[2]) * (xx[1] - xx[2]);
- ooa = 16.0 / a;
-
- COPY_VERTEX_OOA( vb, vertsize, v1, 2 );
- LE32_OUT( vb++, *(CARD32 *)&ooa );
- }
-
- assert( vb == vbchk );
-}
-#else
-static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
- const GLuint vertsize = mmesa->vertex_size;
- GLubyte *mach64verts = (GLubyte *)mmesa->verts;
- const GLuint *start = (const GLuint *)VERT(elts[0]);
- int i;
-
- for (i = 2 ; i < n ; i++) {
- mach64_draw_triangle( mmesa,
- VERT(elts[i-1]),
- VERT(elts[i]),
- (mach64VertexPtr) start
- );
- }
-}
-#endif /* MACH64_NATIVE_VTXFMT */
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define _MACH64_NEW_RENDER_STATE (_DD_NEW_POINT_SMOOTH | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET) \
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_SMOOTH|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_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-
-static void mach64ChooseRenderState(GLcontext *ctx)
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
- mmesa->draw_point = mach64_draw_point;
- mmesa->draw_line = mach64_draw_line;
- mmesa->draw_tri = mach64_draw_triangle;
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= MACH64_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= MACH64_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= MACH64_UNFILLED_BIT;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)) {
- if (flags & POINT_FALLBACK) mmesa->draw_point = mach64_fallback_point;
- if (flags & LINE_FALLBACK) mmesa->draw_line = mach64_fallback_line;
- if (flags & TRI_FALLBACK) mmesa->draw_tri = mach64_fallback_tri;
- index |= MACH64_FALLBACK_BIT;
- }
- }
-
- if (index != mmesa->RenderIndex) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- 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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = mach64_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = mach64_render_tab_elts;
- tnl->Driver.Render.ClippedLine = rast_tab[index].line;
- tnl->Driver.Render.ClippedPolygon = mach64FastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = mach64RenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = mach64RenderClippedPoly;
- }
-
- mmesa->RenderIndex = index;
- }
-}
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-static void mach64RunPipeline( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- if (mmesa->new_state)
- mach64DDUpdateHWState( ctx );
-
- if (!mmesa->Fallback && mmesa->NewGLState) {
- if (mmesa->NewGLState & _MACH64_NEW_VERTEX_STATE)
- mach64ChooseVertexState( ctx );
-
- if (mmesa->NewGLState & _MACH64_NEW_RENDER_STATE)
- mach64ChooseRenderState( ctx );
-
- mmesa->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-/* This is called when Mesa switches between rendering triangle
- * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc),
- * and lines, points and bitmaps.
- */
-
-static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- mmesa->new_state |= MACH64_NEW_CONTEXT;
- mmesa->dirty |= MACH64_UPLOAD_CONTEXT;
-
- if (mmesa->hw_primitive != hwprim) {
- FLUSH_BATCH( mmesa );
- mmesa->hw_primitive = hwprim;
- }
-}
-
-static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint hw = hw_prim[prim];
-
- mmesa->render_primitive = prim;
-
- if (prim >= GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- mach64RasterPrimitive( ctx, hw );
-}
-
-
-static void mach64RenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- mach64CheckTexSizes( ctx );
-}
-
-static void mach64RenderFinish( GLcontext *ctx )
-{
- if (MACH64_CONTEXT(ctx)->RenderIndex & MACH64_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "glReadBuffer",
- "glEnable(GL_STENCIL) without hw stencil buffer",
- "glRenderMode(selection or feedback)",
- "glLogicOp (mode != GL_COPY)",
- "GL_SEPARATE_SPECULAR_COLOR",
- "glBlendEquation (mode != ADD)",
- "glBlendFunc",
- "Rasterization disable",
-};
-
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint oldfallback = mmesa->Fallback;
-
- if (mode) {
- mmesa->Fallback |= bit;
- if (oldfallback == 0) {
- FLUSH_BATCH( mmesa );
- _swsetup_Wakeup( ctx );
- mmesa->RenderIndex = ~0;
- if (MACH64_DEBUG & DEBUG_VERBOSE_FALLBACK) {
- fprintf(stderr, "Mach64 begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- mmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = mach64RenderStart;
- tnl->Driver.Render.PrimitiveNotify = mach64RenderPrimitive;
- tnl->Driver.Render.Finish = mach64RenderFinish;
- tnl->Driver.Render.BuildVertices = mach64BuildVertices;
- mmesa->NewGLState |= (_MACH64_NEW_RENDER_STATE|
- _MACH64_NEW_VERTEX_STATE);
- if (MACH64_DEBUG & DEBUG_VERBOSE_FALLBACK) {
- fprintf(stderr, "Mach64 end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void mach64InitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = mach64RunPipeline;
- tnl->Driver.Render.Start = mach64RenderStart;
- tnl->Driver.Render.Finish = mach64RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = mach64RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = mach64BuildVertices;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.h
deleted file mode 100644
index 208703289..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_tris.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#ifndef __MACH64_TRIS_H__
-#define __MACH64_TRIS_H__
-
-#include "mtypes.h"
-
-extern void mach64InitTriFuncs( GLcontext *ctx );
-
-
-extern void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( mmesa, bit, mode ) mach64Fallback( mmesa->glCtx, bit, mode )
-
-
-#endif /* __MACH64_TRIS_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.c
deleted file mode 100644
index 83a5f73e6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.c
+++ /dev/null
@@ -1,642 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-
-#include "mach64_context.h"
-#include "mach64_vb.h"
-#include "mach64_ioctl.h"
-#include "mach64_tris.h"
-#include "mach64_state.h"
-
-
-#define MACH64_TEX1_BIT 0x1
-#define MACH64_TEX0_BIT 0x2
-#define MACH64_RGBA_BIT 0x4
-#define MACH64_SPEC_BIT 0x8
-#define MACH64_FOG_BIT 0x10
-#define MACH64_XYZW_BIT 0x20
-#define MACH64_PTEX_BIT 0x40
-#define MACH64_MAX_SETUP 0x80
-
-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[MACH64_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 2
-#define TEX0_VERTEX_FORMAT 3
-#define TEX1_VERTEX_FORMAT 4
-#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 & MACH64_XYZW_BIT)
-#define DO_RGBA (IND & MACH64_RGBA_BIT)
-#define DO_SPEC (IND & MACH64_SPEC_BIT)
-#define DO_FOG (IND & MACH64_FOG_BIT)
-#define DO_TEX0 (IND & MACH64_TEX0_BIT)
-#define DO_TEX1 (IND & MACH64_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & MACH64_PTEX_BIT)
-
-#define VERTEX mach64Vertex
-#define LOCALVARS mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-#define GET_VIEWPORT_MAT() mmesa->hw_viewport
-#define GET_TEXSOURCE(n) mmesa->tmu_source[n]
-#define GET_VERTEX_FORMAT() mmesa->vertex_format
-#define GET_VERTEX_STORE() mmesa->verts
-#define GET_VERTEX_SIZE() mmesa->vertex_size * sizeof(GLuint)
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS \
- const GLfloat dx = - (GLfloat)mmesa->drawX - SUBPIXEL_X; \
- const GLfloat dy = (mmesa->driDrawable->h + \
- (GLfloat)mmesa->drawY + SUBPIXEL_Y); \
- const GLfloat sz = 1.0 / mmesa->depth_scale
-
-#if MACH64_NATIVE_VTXFMT
-
-#define UNVIEWPORT_X(x) ((GLfloat)(x) / 4.0) + dx
-#define UNVIEWPORT_Y(y) - ((GLfloat)(y) / 4.0) + dy
-#define UNVIEWPORT_Z(z) (GLfloat)((z) >> 15) * sz
-
-#else
-
-#define UNVIEWPORT_X(x) x + dx;
-#define UNVIEWPORT_Y(y) - y + dy;
-#define UNVIEWPORT_Z(z) z * sz;
-
-#endif
-
-#define PTEX_FALLBACK() FALLBACK(MACH64_CONTEXT(ctx), MACH64_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS mach64_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS mach64_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[mmesa->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[mmesa->SetupIndex].copy_pv
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#if MACH64_NATIVE_VTXFMT
-
-#define TAG(x) mach64_##x
-#include "mach64_native_vb.c"
-
-#else
-
-#define TAG(x) mach64_##x
-#include "tnl_dd/t_dd_vb.c"
-
-#endif
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#if MACH64_NATIVE_VTXFMT
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_TEX0_BIT|MACH64_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|\
- MACH64_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|\
- MACH64_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT|\
- MACH64_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT|\
- MACH64_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|\
- MACH64_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|\
- MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|\
- MACH64_TEX0_BIT|MACH64_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_FOG_BIT)
-#define TAG(x) x##_f
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_FOG_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_FOG_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT)
-#define TAG(x) x##_g
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT)
-#define TAG(x) x##_gf
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "mach64_native_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|\
- MACH64_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "mach64_native_vbtmp.h"
-
-#else
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_TEX0_BIT|MACH64_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|\
- MACH64_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|\
- MACH64_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT|\
- MACH64_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT|\
- MACH64_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|\
- MACH64_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|\
- MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_XYZW_BIT|MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|\
- MACH64_TEX0_BIT|MACH64_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_FOG_BIT)
-#define TAG(x) x##_f
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_FOG_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_FOG_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT)
-#define TAG(x) x##_g
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT)
-#define TAG(x) x##_gf
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_TEX0_BIT|MACH64_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "mach64_vbtmp.h"
-
-#define IND (MACH64_RGBA_BIT|MACH64_FOG_BIT|MACH64_SPEC_BIT|MACH64_TEX0_BIT|\
- MACH64_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "mach64_vbtmp.h"
-
-#endif
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-
-
-void mach64PrintSetupFlags( char *msg, GLuint flags )
-{
- fprintf( stderr, "%s: %d %s%s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & MACH64_XYZW_BIT) ? " xyzw," : "",
- (flags & MACH64_RGBA_BIT) ? " rgba," : "",
- (flags & MACH64_SPEC_BIT) ? " spec," : "",
- (flags & MACH64_FOG_BIT) ? " fog," : "",
- (flags & MACH64_TEX0_BIT) ? " tex-0," : "",
- (flags & MACH64_TEX1_BIT) ? " tex-1," : "",
- (flags & MACH64_PTEX_BIT) ? " ptex," : "");
-}
-
-
-
-
-void mach64CheckTexSizes( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
-
- if (!setup_tab[mmesa->SetupIndex].check_tex_sizes(ctx)) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /* Invalidate stored verts
- */
- mmesa->SetupNewInputs = ~0;
- mmesa->SetupIndex |= MACH64_PTEX_BIT;
-
- if (!mmesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[mmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[mmesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void mach64BuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
- GLuint stride = mmesa->vertex_size * sizeof(int);
- GLubyte *v = ((GLubyte *)mmesa->verts + (start * stride));
-
- newinputs |= mmesa->SetupNewInputs;
- mmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[mmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= MACH64_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= MACH64_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= MACH64_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= MACH64_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= MACH64_FOG_BIT;
-
- if (mmesa->SetupIndex & MACH64_PTEX_BIT)
- ind = ~0;
-
- ind &= mmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void mach64ChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
- GLuint ind = MACH64_XYZW_BIT|MACH64_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= MACH64_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= MACH64_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits) {
- ind |= MACH64_TEX0_BIT;
- if (ctx->Texture.Unit[0]._ReallyEnabled &&
- ctx->Texture.Unit[1]._ReallyEnabled) {
- ind |= MACH64_TEX1_BIT;
- }
- }
-
- mmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = mach64_interp_extras;
- tnl->Driver.Render.CopyPV = mach64_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-
-#if 0
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG) {
- mach64PrintSetupFlags( __FUNCTION__, ind );
- }
-#endif
-
- if (setup_tab[ind].vertex_format != mmesa->vertex_format) {
- FLUSH_BATCH(mmesa);
- mmesa->vertex_format = setup_tab[ind].vertex_format;
- mmesa->vertex_size = setup_tab[ind].vertex_size;
- }
-}
-
-
-#if 0
-void mach64_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- GLuint vertex_size = mmesa->vertex_size * 4;
- GLuint *dest = mach64AllocDmaLow( mmesa, (count-start) * vertex_size);
- setup_tab[mmesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
-}
-#endif
-
-
-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);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-
-void mach64FreeVB( GLcontext *ctx )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- if (mmesa->verts) {
- ALIGN_FREE(mmesa->verts);
- mmesa->verts = 0;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.h
deleted file mode 100644
index bcc4759af..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vb.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-#ifndef __MACH64_VB_H__
-#define __MACH64_VB_H__
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "mach64_context.h"
-
-/* premultiply texture coordinates by homogenous coordinate */
-#define MACH64_PREMULT_TEXCOORDS
-
-#define _MACH64_NEW_VERTEX_STATE (_DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_UNFILLED | \
- _NEW_TEXTURE | \
- _NEW_FOG)
-
-
-extern void mach64CheckTexSizes( GLcontext *ctx );
-extern void mach64ChooseVertexState( GLcontext *ctx );
-
-extern void mach64BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void mach64PrintSetupFlags(char *msg, GLuint flags );
-
-extern void mach64InitVB( GLcontext *ctx );
-extern void mach64FreeVB( GLcontext *ctx );
-
-#if 0
-extern void mach64_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void mach64_emit_indexed_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-#endif
-
-extern void mach64_translate_vertex( GLcontext *ctx,
- const mach64Vertex *src,
- SWvertex *dst );
-
-extern void mach64_print_vertex( GLcontext *ctx, const mach64Vertex *v );
-
-
-#endif /* __MACH64_VB_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
deleted file mode 100644
index c1207cacd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/mach64_vbtmp.h
+++ /dev/null
@@ -1,770 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * 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 <keithw@valinux.com>
- *
- * Modified for mach64 by:
- * Leif Delgass <ldelgass@retinalburn.net>
- * José Fonseca <j_r_fonseca@yahoo.co.uk>
- */
-
-
-/* Unlike the other templates here, this assumes quite a bit about the
- * underlying hardware. Specifically it assumes a d3d-like vertex
- * format, with a layout more or less constrained to look like the
- * following:
- *
- * union {
- * struct {
- * float x, y, z, w;
- * struct { char r, g, b, a; } color;
- * struct { char r, g, b, fog; } spec;
- * float u0, v0;
- * float u1, v1;
- * float u2, v2;
- * float u3, v3;
- * } v;
- * struct {
- * float x, y, z, w;
- * struct { char r, g, b, a; } color;
- * struct { char r, g, b, fog; } spec;
- * float u0, v0, q0;
- * float u1, v1, q1;
- * float u2, v2, q2;
- * float u3, v3, q3;
- * } pv;
- * struct {
- * float x, y, z;
- * struct { char r, g, b, a; } color;
- * } tv;
- * float f[16];
- * unsigned int ui[16];
- * unsigned char ub4[4][16];
- * }
- *
-
- * DO_XYZW: Emit xyz and maybe w coordinates.
- * DO_RGBA: Emit color.
- * DO_SPEC: Emit specular color.
- * DO_FOG: Emit fog coordinate in specular alpha.
- * DO_TEX0: Emit tex0 u,v coordinates.
- * DO_TEX1: Emit tex1 u,v coordinates.
- * DO_TEX2: Emit tex2 u,v coordinates.
- * DO_TEX3: Emit tex3 u,v coordinates.
- * DO_PTEX: Emit tex0,1,2,3 q coordinates where possible.
- *
- * HAVE_RGBA_COLOR: Hardware takes color in rgba order (else bgra).
- *
- * HAVE_HW_VIEWPORT: Hardware performs viewport transform.
- * HAVE_HW_DIVIDE: Hardware performs perspective divide.
- *
- * HAVE_TINY_VERTICES: Hardware understands v.tv format.
- * HAVE_PTEX_VERTICES: Hardware understands v.pv format.
- * HAVE_NOTEX_VERTICES: Hardware understands v.v format with texcount 0.
- *
- * Additionally, this template assumes it is emitting *transformed*
- * vertices; the modifications to emit untransformed vertices (ie. to
- * t&l hardware) are probably too great to cooexist with the code
- * already in this file.
- *
- * NOTE: The PTEX vertex format always includes TEX0 and TEX1, even if
- * only TEX0 is enabled, in order to maintain a vertex size which is
- * an exact number of quadwords.
- */
-
-#if (HAVE_HW_VIEWPORT)
-#define VIEWPORT_X(dst,x) dst = x
-#define VIEWPORT_Y(dst,y) dst = y
-#define VIEWPORT_Z(dst,z) dst = z
-#else
-#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]
-#endif
-
-#if (HAVE_HW_DIVIDE && !HAVE_PTEX_VERTICES)
-#error "can't cope with this combination"
-#endif
-
-#ifndef LOCALVARS
-#define LOCALVARS
-#endif
-
-#ifndef CHECK_HW_DIVIDE
-#define CHECK_HW_DIVIDE 1
-#endif
-
-#if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES)
-
-static void TAG(emit)( GLcontext *ctx,
- GLuint start, GLuint end,
- void *dest,
- GLuint stride )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*tc0)[4], (*tc1)[4], (*fog)[4];
- GLfloat (*tc2)[4], (*tc3)[4];
- GLfloat (*spec)[4];
- GLfloat (*col)[4];
- GLuint col_stride;
- GLuint tc0_stride, tc1_stride, spec_stride, fog_stride;
- GLuint tc2_stride, tc3_stride;
- GLuint tc0_size, tc1_size;
- GLuint tc2_size, tc3_size;
- GLfloat (*coord)[4];
- GLuint coord_stride;
- VERTEX *v = (VERTEX *)dest;
- const GLfloat *s = GET_VIEWPORT_MAT();
- const GLubyte *mask = VB->ClipMask;
- int i;
-
-/* fprintf(stderr, "%s(big) importable %d %d..%d\n", */
-/* __FUNCTION__, VB->importable_data, start, end); */
-
- if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
- (void) s;
- coord = VB->ClipPtr->data;
- coord_stride = VB->ClipPtr->stride;
- }
- else {
- coord = VB->NdcPtr->data;
- coord_stride = VB->NdcPtr->stride;
- }
-
- if (DO_TEX3) {
- const GLuint t3 = GET_TEXSOURCE(3);
- tc3 = VB->TexCoordPtr[t3]->data;
- tc3_stride = VB->TexCoordPtr[t3]->stride;
- if (DO_PTEX)
- tc3_size = VB->TexCoordPtr[t3]->size;
- }
-
- if (DO_TEX2) {
- const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
- if (DO_PTEX)
- tc2_size = VB->TexCoordPtr[t2]->size;
- }
-
- if (DO_TEX1) {
- const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
- if (DO_PTEX)
- tc1_size = VB->TexCoordPtr[t1]->size;
- }
-
- if (DO_TEX0) {
- const GLuint t0 = GET_TEXSOURCE(0);
- tc0_stride = VB->TexCoordPtr[t0]->stride;
- tc0 = VB->TexCoordPtr[t0]->data;
- if (DO_PTEX)
- tc0_size = VB->TexCoordPtr[t0]->size;
- }
-
- if (DO_RGBA) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
- }
-
- if (DO_SPEC) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
- } else {
- spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
- spec_stride = 0;
- }
-
- if (DO_FOG) {
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
- } else {
- static GLfloat tmp[4] = {0, 0, 0, 0};
- fog = &tmp;
- fog_stride = 0;
- }
- }
-
- /* May have nonstandard strides:
- */
- if (start) {
- coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride);
- if (DO_TEX0)
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (DO_TEX1)
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (DO_TEX2)
- tc2 = (GLfloat (*)[4])((GLubyte *)tc2 + start * tc2_stride);
- if (DO_TEX3)
- tc3 = (GLfloat (*)[4])((GLubyte *)tc3 + start * tc3_stride);
- if (DO_RGBA)
- STRIDE_4F(col, start * col_stride);
- if (DO_SPEC)
- STRIDE_4F(spec, start * spec_stride);
- if (DO_FOG)
- STRIDE_4F(fog, start * fog_stride);
- // fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride);
- /* STRIDE_F(fog, start * fog_stride); */
- }
-
- for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) {
- if (DO_XYZW) {
- if (HAVE_HW_VIEWPORT || mask[i] == 0) {
- /* unclipped */
- VIEWPORT_X(v->v.x, coord[0][0]);
- VIEWPORT_Y(v->v.y, coord[0][1]);
- VIEWPORT_Z(v->v.z, coord[0][2]);
- v->v.w = coord[0][3];
- } else {
- /* clipped */
- v->v.w = 1.0;
- }
- if (MACH64_DEBUG & DEBUG_VERBOSE_PRIMS) {
- fprintf(stderr, "%s: vert (importable) %d: %.2f %.2f %.2f %f\n",
- __FUNCTION__, i, v->v.x, v->v.y, v->v.z, v->v.w);
- }
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- }
- if (DO_RGBA) {
- if (HAVE_RGBA_COLOR) {
- *(GLuint *)&v->v.color = *(GLuint *)&col[0];
- STRIDE_4F(col, col_stride);
- } else {
- v->v.color.blue = col[0][2];
- v->v.color.green = col[0][1];
- v->v.color.red = col[0][0];
- v->v.color.alpha = col[0][3];
- STRIDE_4F(col, col_stride);
- }
- }
- if (DO_SPEC) {
- v->v.specular.red = spec[0][0];
- v->v.specular.green = spec[0][1];
- v->v.specular.blue = spec[0][2];
- STRIDE_4F(spec, spec_stride);
- }
- if (DO_FOG) {
- v->v.specular.alpha = fog[0][0] * 255.0;
- /* STRIDE_F(fog, fog_stride); */
- fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
- }
- if (DO_TEX0) {
- v->v.u0 = tc0[0][0];
- v->v.v0 = tc0[0][1];
- if (MACH64_DEBUG & DEBUG_VERBOSE_PRIMS) {
- fprintf(stderr, "%s: vert (importable) %d: u0: %.2f, v0: %.2f, w: %f\n",
- __FUNCTION__, i, v->v.u0, v->v.v0, v->v.w);
- }
-#ifdef MACH64_PREMULT_TEXCOORDS
- v->v.u0 *= v->v.w;
- v->v.v0 *= v->v.w;
-#endif
- if (DO_PTEX) {
- if (HAVE_PTEX_VERTICES) {
- if (tc0_size == 4)
- v->pv.q0 = tc0[0][3];
- else
- v->pv.q0 = 1.0;
- }
- else if (tc0_size == 4) {
-#ifdef MACH64_PREMULT_TEXCOORDS
- v->v.w *= tc0[0][3];
-#else
- float rhw = 1.0 / tc0[0][3];
- v->v.w *= tc0[0][3];
- v->v.u0 *= rhw;
- v->v.v0 *= rhw;
-#endif
- }
- }
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- }
- if (DO_TEX1) {
- if (DO_PTEX) {
- v->pv.u1 = tc1[0][0];
- v->pv.v1 = tc1[0][1];
- if (tc1_size == 4)
- v->pv.q1 = tc1[0][3];
- else
- v->pv.q1 = 1.0;
- }
- else {
- v->v.u1 = tc1[0][0];
- v->v.v1 = tc1[0][1];
- }
-#ifdef MACH64_PREMULT_TEXCOORDS
- v->v.u1 *= v->v.w;
- v->v.v1 *= v->v.w;
-#endif
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + tc1_stride);
- }
- else if (DO_PTEX) {
- *(GLuint *)&v->pv.q1 = 0; /* avoid culling on radeon */
- }
- if (DO_TEX2) {
- if (DO_PTEX) {
- v->pv.u2 = tc2[0][0];
- v->pv.v2 = tc2[0][1];
- if (tc2_size == 4)
- v->pv.q2 = tc2[0][3];
- else
- v->pv.q2 = 1.0;
- }
- else {
- v->v.u2 = tc2[0][0];
- v->v.v2 = tc2[0][1];
- }
- tc2 = (GLfloat (*)[4])((GLubyte *)tc2 + tc2_stride);
- }
- if (DO_TEX3) {
- if (DO_PTEX) {
- v->pv.u3 = tc3[0][0];
- v->pv.v3 = tc3[0][1];
- if (tc3_size == 4)
- v->pv.q3 = tc3[0][3];
- else
- v->pv.q3 = 1.0;
- }
- else {
- v->v.u3 = tc3[0][0];
- v->v.v3 = tc3[0][1];
- }
- tc3 = (GLfloat (*)[4])((GLubyte *)tc3 + tc3_stride);
- }
- }
-}
-
-#else
-#if DO_XYZW
-
-#if HAVE_HW_DIVIDE
-#error "cannot use tiny vertices with hw perspective divide"
-#endif
-
-static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
- void *dest, GLuint stride )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*col)[4];
- GLuint col_stride;
- GLfloat (*coord)[4] = VB->NdcPtr->data;
- GLuint coord_stride = VB->NdcPtr->stride;
- GLfloat *v = (GLfloat *)dest;
- const GLubyte *mask = VB->ClipMask;
- const GLfloat *s = GET_VIEWPORT_MAT();
- int i;
-
- (void) s;
-
- ASSERT(stride == 4);
-
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
-
- /* Pack what's left into a 4-dword vertex. Color is in a different
- * place, and there is no 'w' coordinate.
- */
- if (start) {
- coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride);
- STRIDE_4F(col, start * col_stride);
- }
-
- for (i=start; i < end; i++, v+=4) {
- if (HAVE_HW_VIEWPORT || mask[i] == 0) {
- VIEWPORT_X(v[0], coord[0][0]);
- VIEWPORT_Y(v[1], coord[0][1]);
- VIEWPORT_Z(v[2], coord[0][2]);
- }
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- if (DO_RGBA) {
- if (HAVE_RGBA_COLOR) {
- *(GLuint *)&v[3] = *(GLuint *)col;
- }
- else {
- GLubyte *b = (GLubyte *)&v[3];
- UNCLAMPED_FLOAT_TO_UBYTE(b[0], col[0][2]);
- UNCLAMPED_FLOAT_TO_UBYTE(b[1], col[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(b[2], col[0][0]);
- UNCLAMPED_FLOAT_TO_UBYTE(b[3], col[0][3]);
- }
- STRIDE_4F( col, col_stride );
- }
- if (MACH64_DEBUG & DEBUG_VERBOSE_PRIMS) {
- fprintf(stderr, "vert (importable) %d: %.2f %.2f %.2f %x\n",
- i, v[0], v[1], v[2], *(int *)&v[3]);
- }
- }
-}
-#else
-static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
- void *dest, GLuint stride )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*col)[4];
- GLuint col_stride;
- GLfloat *v = (GLfloat *)dest;
- int i;
-
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
-
- if (start)
- STRIDE_4F(col, col_stride * start);
-
- /* Need to figure out where color is:
- */
- if (GET_VERTEX_FORMAT() == TINY_VERTEX_FORMAT)
- v += 3;
- else
- v += 4;
-
- for (i=start; i < end; i++, STRIDE_F(v, stride)) {
- if (HAVE_RGBA_COLOR) {
- *(GLuint *)v = *(GLuint *)col[0];
- }
- else {
- GLubyte *b = (GLubyte *)v;
- UNCLAMPED_FLOAT_TO_UBYTE(b[0], col[0][2]);
- UNCLAMPED_FLOAT_TO_UBYTE(b[1], col[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(b[2], col[0][0]);
- UNCLAMPED_FLOAT_TO_UBYTE(b[3], col[0][3]);
- }
- STRIDE_4F( col, col_stride );
- }
-}
-#endif /* emit */
-#endif /* emit */
-
-#if (DO_XYZW) && (DO_RGBA)
-
-
-#if (HAVE_PTEX_VERTICES)
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- /* Force 'missing' texcoords to something valid.
- */
- if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
- VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
-
- if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
- VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
-
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
-
- if (DO_PTEX)
- return GL_TRUE;
-
- if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
- (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
- (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) ||
- (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4))
- return GL_FALSE;
-
- return GL_TRUE;
-}
-#else
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- /* Force 'missing' texcoords to something valid.
- */
- if (DO_TEX3 && VB->TexCoordPtr[2] == 0)
- VB->TexCoordPtr[2] = VB->TexCoordPtr[3];
-
- if (DO_TEX2 && VB->TexCoordPtr[1] == 0)
- VB->TexCoordPtr[1] = VB->TexCoordPtr[2];
-
- if (DO_TEX1 && VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
-
- if (DO_PTEX)
- return GL_TRUE;
-
- /* No hardware support for projective texture. Can fake it for
- * TEX0 only.
- */
- if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) ||
- (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) ||
- (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) {
- PTEX_FALLBACK();
- return GL_FALSE;
- }
-
- if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) {
- if (DO_TEX1 || DO_TEX2 || DO_TEX3) {
- PTEX_FALLBACK();
- }
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-#endif /* ptex */
-
-
-static void TAG(interp)( GLcontext *ctx,
- GLfloat t,
- GLuint edst, GLuint eout, GLuint ein,
- GLboolean force_boundary )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte *ddverts = GET_VERTEX_STORE();
- GLuint size = GET_VERTEX_SIZE();
- const GLfloat *dstclip = VB->ClipPtr->data[edst];
- GLfloat w;
- const GLfloat *s = GET_VIEWPORT_MAT();
-
- VERTEX *dst = (VERTEX *)(ddverts + (edst * size));
- VERTEX *in = (VERTEX *)(ddverts + (ein * size));
- VERTEX *out = (VERTEX *)(ddverts + (eout * size));
-
- (void)s;
-
- if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
- VIEWPORT_X( dst->v.x, dstclip[0] );
- VIEWPORT_Y( dst->v.y, dstclip[1] );
- VIEWPORT_Z( dst->v.z, dstclip[2] );
- w = dstclip[3];
- }
- else {
- w = (dstclip[3] == 0.0F) ? 1.0 : (1.0 / dstclip[3]);
- VIEWPORT_X( dst->v.x, dstclip[0] * w );
- VIEWPORT_Y( dst->v.y, dstclip[1] * w );
- VIEWPORT_Z( dst->v.z, dstclip[2] * w );
- }
-
- if (MACH64_DEBUG & DEBUG_VERBOSE_PRIMS) {
- fprintf( stderr, "%s: dst vert: %.2f %.2f %.2f %f\n",
- __FUNCTION__,
- dst->v.x,
- dst->v.y,
- dst->v.z,
- w );
- }
-
- if ((HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) ||
- DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 ||
- DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES) {
-
- dst->v.w = w;
-
- INTERP_UB( t, dst->ub4[4][0], out->ub4[4][0], in->ub4[4][0] );
- INTERP_UB( t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1] );
- INTERP_UB( t, dst->ub4[4][2], out->ub4[4][2], in->ub4[4][2] );
- INTERP_UB( t, dst->ub4[4][3], out->ub4[4][3], in->ub4[4][3] );
-
- if (DO_SPEC) {
- INTERP_UB( t, dst->ub4[5][0], out->ub4[5][0], in->ub4[5][0] );
- INTERP_UB( t, dst->ub4[5][1], out->ub4[5][1], in->ub4[5][1] );
- INTERP_UB( t, dst->ub4[5][2], out->ub4[5][2], in->ub4[5][2] );
- }
- if (DO_FOG) {
- INTERP_UB( t, dst->ub4[5][3], out->ub4[5][3], in->ub4[5][3] );
- }
- if (DO_TEX0) {
- if (DO_PTEX) {
- if (HAVE_PTEX_VERTICES) {
- INTERP_F( t, dst->pv.u0, out->pv.u0, in->pv.u0 );
- INTERP_F( t, dst->pv.v0, out->pv.v0, in->pv.v0 );
- INTERP_F( t, dst->pv.q0, out->pv.q0, in->pv.q0 );
- } else {
- GLfloat wout = VB->NdcPtr->data[eout][3];
- GLfloat win = VB->NdcPtr->data[ein][3];
- GLfloat qout = out->pv.w / wout;
- GLfloat qin = in->pv.w / win;
- GLfloat qdst, rqdst;
-
- ASSERT( !HAVE_HW_DIVIDE );
-
- INTERP_F( t, dst->v.u0, out->v.u0 * qout, in->v.u0 * qin );
- INTERP_F( t, dst->v.v0, out->v.v0 * qout, in->v.v0 * qin );
- INTERP_F( t, qdst, qout, qin );
-
- rqdst = 1.0 / qdst;
- dst->v.u0 *= rqdst;
- dst->v.v0 *= rqdst;
- dst->v.w *= rqdst;
- }
- }
- else {
-#ifdef MACH64_PREMULT_TEXCOORDS
- GLfloat qout = 1 / out->v.w;
- GLfloat qin = 1 / in->v.w;
-
- INTERP_F( t, dst->v.u0, out->v.u0 * qout, in->v.u0 * qin);
- INTERP_F( t, dst->v.v0, out->v.v0 * qout, in->v.v0 * qin);
-
- dst->v.u0 *= w;
- dst->v.v0 *= w;
-#else
- INTERP_F( t, dst->v.u0, out->v.u0, in->v.u0 );
- INTERP_F( t, dst->v.v0, out->v.v0, in->v.v0 );
-#endif
- }
- }
- if (DO_TEX1) {
- if (DO_PTEX) {
- INTERP_F( t, dst->pv.u1, out->pv.u1, in->pv.u1 );
- INTERP_F( t, dst->pv.v1, out->pv.v1, in->pv.v1 );
- INTERP_F( t, dst->pv.q1, out->pv.q1, in->pv.q1 );
- } else {
-#ifdef MACH64_PREMULT_TEXCOORDS
- GLfloat qout = 1 / out->v.w;
- GLfloat qin = 1 / in->v.w;
-
- INTERP_F( t, dst->v.u1, out->v.u1 * qout, in->v.u1 * qin );
- INTERP_F( t, dst->v.v1, out->v.v1 * qout, in->v.v1 * qin );
-
- dst->v.u1 *= w;
- dst->v.v1 *= w;
-#else
- INTERP_F( t, dst->v.u1, out->v.u1, in->v.u1 );
- INTERP_F( t, dst->v.v1, out->v.v1, in->v.v1 );
-#endif
- }
- }
- else if (DO_PTEX) {
- dst->pv.q0 = 0.0; /* must be a valid float on radeon */
- }
- if (DO_TEX2) {
- if (DO_PTEX) {
- INTERP_F( t, dst->pv.u2, out->pv.u2, in->pv.u2 );
- INTERP_F( t, dst->pv.v2, out->pv.v2, in->pv.v2 );
- INTERP_F( t, dst->pv.q2, out->pv.q2, in->pv.q2 );
- } else {
- INTERP_F( t, dst->v.u2, out->v.u2, in->v.u2 );
- INTERP_F( t, dst->v.v2, out->v.v2, in->v.v2 );
- }
- }
- if (DO_TEX3) {
- if (DO_PTEX) {
- INTERP_F( t, dst->pv.u3, out->pv.u3, in->pv.u3 );
- INTERP_F( t, dst->pv.v3, out->pv.v3, in->pv.v3 );
- INTERP_F( t, dst->pv.q3, out->pv.q3, in->pv.q3 );
- } else {
- INTERP_F( t, dst->v.u3, out->v.u3, in->v.u3 );
- INTERP_F( t, dst->v.v3, out->v.v3, in->v.v3 );
- }
- }
- } else {
- /* 4-dword vertex. Color is in v[3] and there is no oow coordinate.
- */
- INTERP_UB( t, dst->ub4[3][0], out->ub4[3][0], in->ub4[3][0] );
- INTERP_UB( t, dst->ub4[3][1], out->ub4[3][1], in->ub4[3][1] );
- INTERP_UB( t, dst->ub4[3][2], out->ub4[3][2], in->ub4[3][2] );
- INTERP_UB( t, dst->ub4[3][3], out->ub4[3][3], in->ub4[3][3] );
- }
-}
-
-#endif /* rgba && xyzw */
-
-
-static void TAG(init)( void )
-{
- setup_tab[IND].emit = TAG(emit);
-
-#if (DO_XYZW && DO_RGBA)
- setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes);
- setup_tab[IND].interp = TAG(interp);
-#endif
-
- if (DO_SPEC)
- setup_tab[IND].copy_pv = copy_pv_rgba4_spec5;
- else if (HAVE_HW_DIVIDE || DO_SPEC || DO_FOG || DO_TEX0 || DO_TEX1 ||
- DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES)
- setup_tab[IND].copy_pv = copy_pv_rgba4;
- else
- setup_tab[IND].copy_pv = copy_pv_rgba3;
-
- if (DO_TEX3) {
- if (DO_PTEX) {
- ASSERT(HAVE_PTEX_VERTICES);
- setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 18;
- }
- else {
- setup_tab[IND].vertex_format = TEX3_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 14;
- }
- }
- else if (DO_TEX2) {
- if (DO_PTEX) {
- ASSERT(HAVE_PTEX_VERTICES);
- setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 18;
- }
- else {
- setup_tab[IND].vertex_format = TEX2_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 12;
- }
- }
- else if (DO_TEX1) {
- if (DO_PTEX) {
- ASSERT(HAVE_PTEX_VERTICES);
- setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 12;
- }
- else {
- setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 10;
- }
- }
- else if (DO_TEX0) {
- if (DO_PTEX && HAVE_PTEX_VERTICES) {
- setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 12;
- } else {
- setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 8;
- }
- }
- else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) {
- setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 4;
- } else if (HAVE_NOTEX_VERTICES) {
- setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 6;
- } else {
- setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 8;
- }
-
-}
-
-
-#undef IND
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/server/mach64_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/server/mach64_dri.h
deleted file mode 100644
index 139668e3f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mach64/server/mach64_dri.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $XFree86$ */ /* -*- mode: c; c-basic-offset: 3 -*- */
-/*
- * Copyright 2000 Gareth Hughes
- * 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
- * GARETH HUGHES 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:
- * Gareth Hughes <gareth@valinux.com>
- * Leif Delgass <ldelgass@retinalburn.net>
- */
-
-#ifndef __MACH64_DRI_H__
-#define __MACH64_DRI_H__ 1
-
-#include "xf86drm.h"
-
-typedef struct {
- drm_handle_t fbHandle;
-
- drm_handle_t regsHandle;
- drmSize regsSize;
-
- int IsPCI;
-
- drm_handle_t agpHandle; /* Handle from drmAgpAlloc */
- unsigned long agpOffset;
- drmSize agpSize;
- int agpMode;
-
- /* DMA descriptor ring */
- unsigned long ringStart; /* Offset into AGP space */
- drm_handle_t ringHandle; /* Handle from drmAddMap */
- drmSize ringMapSize; /* Size of map */
- int ringSize; /* Size of ring (in kB) */
- drmAddress ringMap; /* Map */
-
- /* vertex buffer data */
- unsigned long bufferStart; /* Offset into AGP space */
- drm_handle_t bufferHandle; /* Handle from drmAddMap */
- drmSize bufferMapSize; /* Size of map */
- int bufferSize; /* Size of buffers (in MB) */
- drmAddress bufferMap; /* Map */
-
- drmBufMapPtr drmBuffers; /* Buffer map */
- int numBuffers; /* Number of buffers */
-
- /* AGP Texture data */
- unsigned long agpTexStart; /* Offset into AGP space */
- drm_handle_t agpTexHandle; /* Handle from drmAddMap */
- drmSize agpTexMapSize; /* Size of map */
- int agpTexSize; /* Size of AGP tex space (in MB) */
- drmAddress agpTexMap; /* Map */
- int log2AGPTexGran;
-
- int fbX;
- int fbY;
- int backX;
- int backY;
- int depthX;
- int depthY;
-
- int frontOffset;
- int frontPitch;
- int backOffset;
- int backPitch;
- int depthOffset;
- int depthPitch;
-
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-} ATIDRIServerInfoRec, *ATIDRIServerInfoPtr;
-
-typedef struct {
- int chipset;
- int width;
- int height;
- int mem;
- int cpp;
-
- int IsPCI;
- int AGPMode;
-
- unsigned int frontOffset;
- unsigned int frontPitch;
-
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- unsigned int textureOffset;
- unsigned int textureSize;
- int logTextureGranularity;
-
- drm_handle_t regs;
- drmSize regsSize;
-
- drm_handle_t agp;
- drmSize agpSize;
- unsigned int agpTextureOffset;
- unsigned int agpTextureSize;
- int logAgpTextureGranularity;
-} ATIDRIRec, *ATIDRIPtr;
-
-#endif /* __MACH64_DRI_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Doxyfile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Doxyfile
deleted file mode 100644
index 0d0c134a7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Doxyfile
+++ /dev/null
@@ -1,234 +0,0 @@
-# Doxyfile 1.3.3-Gideon
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = mga
-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
-SUBGROUPING = 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/newtree/temp/src/mesa/drivers/dri/mga
-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 \
- *.dox
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Makefile
deleted file mode 100644
index a871064c6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-# src/mesa/drivers/dri/mga/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = mga_dri.so
-
-MINIGLX_SOURCES = server/mga_dri.c
-
-DRIVER_SOURCES = \
- mgadd.c \
- mgaioctl.c \
- mgarender.c \
- mgastate.c \
- mgatris.c \
- mgapixel.c \
- mgaspan.c \
- mgatex.c \
- mgatexmem.c \
- mga_texstate.c \
- mga_texcombine.c \
- mgavb.c \
- mga_xmesa.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/README b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/README
deleted file mode 100644
index a7133fa66..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/README
+++ /dev/null
@@ -1,26 +0,0 @@
-MGA DRI driver ported from XF86DRI to FBDRI
-by Denis Oliver Kropp <dok@directfb.org>
-
-
-INFO
-
-This driver has been ported from the head branch of XFree86 to
-the embedded-1-branch of Mesa.
-
-
-STATUS
-
-Already working very well as far as I've tested it (16/32 bit).
-glxgears runs at 935 fps (G550 32MB AGP 4x, Athlon 1.33) vs 744 fps with XFree.
-Other demos (terrain, fire, etc.) have been successfully tested as well.
-
-
-TODO
-
-- mgaEngineShutdown
-- mgaEngineRestore
-- SGRAM detection
-- remove some unused bits from server/*
-- subset driver support
-- mgaWaitForVBlank
-- deinitialization (from MGADRICloseScreen) a la radeonDestroyScreen
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texcombine.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texcombine.c
deleted file mode 100644
index bbfa29be5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texcombine.c
+++ /dev/null
@@ -1,672 +0,0 @@
-/*
- * Copyright (c) 2003 Ville Syrjala
- *
- * 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 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:
- * Ville Syrjala <syrjala@sci.fi>
- */
-
-#include "glheader.h"
-
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-
-/*
- * GL_ARB_texture_env_combine
- * GL_EXT_texture_env_combine
- * GL_ARB_texture_env_crossbar
- * GL_ATI_texture_env_combine3
- */
-
-#define ARG_DISABLE 0xffffffff
-#define MGA_ARG1 0
-#define MGA_ARG2 1
-#define MGA_ALPHA 2
-
-GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
- GLuint numColorArgs = 0, numAlphaArgs = 0;
- GLuint arg1[3], arg2[3], alpha[3];
- int args[3];
- int i;
-
- switch (texUnit->Combine.ModeRGB) {
- case GL_REPLACE:
- numColorArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- numColorArgs = 2;
- break;
- case GL_INTERPOLATE:
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- case GL_MODULATE_SUBTRACT_ATI:
- numColorArgs = 3;
- break;
- default:
- return GL_FALSE;
- }
-
- switch (texUnit->Combine.ModeA) {
- case GL_REPLACE:
- numAlphaArgs = 1;
- break;
- case GL_MODULATE:
- case GL_ADD:
- case GL_ADD_SIGNED:
- case GL_SUBTRACT:
- numAlphaArgs = 2;
- break;
- default:
- return GL_FALSE;
- }
-
- /* Start fresh :) */
- *reg = 0;
-
- /* COLOR */
- for (i = 0; i < 3; i++) {
- arg1[i] = 0;
- arg2[i] = 0;
- alpha[i] = 0;
- }
-
- for (i = 0;i < numColorArgs; i++) {
- switch (texUnit->Combine.SourceRGB[i]) {
- case GL_TEXTURE:
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_currtex;
- break;
- case GL_TEXTURE0:
- if (source == 0) {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_currtex;
- } else {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_prevtex;
- }
- break;
- case GL_TEXTURE1:
- if (source == 0) {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE0) */
- arg2[i] |= TD0_color_arg2_prevstage;
- alpha[i] |= TD0_color_alpha_prevstage;
- } else {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= TD0_color_alpha_currtex;
- }
- break;
- case GL_CONSTANT:
- if (mmesa->fcol_used &&
- mmesa->envcolor[source] != mmesa->envcolor[!source])
- return GL_FALSE;
-
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= TD0_color_arg2_fcol;
- alpha[i] |= TD0_color_alpha_fcol;
-
- mmesa->setup.fcol = mmesa->envcolor[source];
- mmesa->fcol_used = GL_TRUE;
- break;
- case GL_PRIMARY_COLOR:
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE1) */
- if (unit == 0 || (mmesa->setup.tdualstage0 &
- ((TD0_color_sel_mul & TD0_color_sel_add) |
- (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) {
- arg2[i] |= TD0_color_arg2_diffuse;
- alpha[i] |= TD0_color_alpha_diffuse;
- } else {
- arg2[i] |= ARG_DISABLE;
- alpha[i] |= ARG_DISABLE;
- }
- break;
- case GL_PREVIOUS:
- arg1[i] |= ARG_DISABLE;
- if (unit == 0) {
- arg2[i] |= TD0_color_arg2_diffuse;
- alpha[i] |= TD0_color_alpha_diffuse;
- } else {
- arg2[i] |= TD0_color_arg2_prevstage;
- alpha[i] |= TD0_color_alpha_prevstage;
- }
- break;
- default:
- return GL_FALSE;
- }
-
- switch (texUnit->Combine.OperandRGB[i]) {
- case GL_SRC_COLOR:
- arg1[i] |= 0;
- arg2[i] |= 0;
- if (texUnit->Combine.SourceRGB[i] == GL_CONSTANT &&
- RGBA_EQUAL( mmesa->envcolor[source] )) {
- alpha[i] |= 0;
- } else {
- alpha[i] |= ARG_DISABLE;
- }
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- arg1[i] |= TD0_color_arg1_inv_enable;
- arg2[i] |= TD0_color_arg2_inv_enable;
- if (texUnit->Combine.SourceRGB[i] == GL_CONSTANT &&
- RGBA_EQUAL( mmesa->envcolor[source] )) {
- alpha[i] |= (TD0_color_alpha1inv_enable |
- TD0_color_alpha2inv_enable);
- } else {
- alpha[i] |= ARG_DISABLE;
- }
- break;
- case GL_SRC_ALPHA:
- arg1[i] |= TD0_color_arg1_replicatealpha_enable;
- arg2[i] |= TD0_color_arg2_replicatealpha_enable;
- alpha[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- arg1[i] |= (TD0_color_arg1_replicatealpha_enable |
- TD0_color_arg1_inv_enable);
- arg2[i] |= (TD0_color_arg2_replicatealpha_enable |
- TD0_color_arg2_inv_enable);
- alpha[i] |= (TD0_color_alpha1inv_enable |
- TD0_color_alpha2inv_enable);
- break;
- }
- }
-
- switch (texUnit->Combine.ModeRGB) {
- case GL_MODULATE_ADD_ATI:
- case GL_MODULATE_SIGNED_ADD_ATI:
- /* Special handling for ATI_texture_env_combine3.
- * If Arg1 == Arg0 or Arg1 == Arg2 we can use arg1 or arg2 as input for
- * both multiplier and adder.
- */
- /* Arg1 == arg1 */
- if (arg1[1] == arg1[0]) {
- if ((arg1[1] | arg2[2]) != ARG_DISABLE) {
- *reg |= arg1[1] | arg2[2];
- args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ARG2;
- break;
- } else
- if ((arg1[1] | alpha[2]) != ARG_DISABLE) {
- *reg |= arg1[1] | alpha[2];
- args[0] = MGA_ARG1; args[1] = MGA_ARG1; args[2] = MGA_ALPHA;
- break;
- }
- }
- if (arg1[1] == arg1[2]) {
- if ((arg1[1] | arg2[0]) != ARG_DISABLE) {
- *reg |= arg1[1] | arg2[0];
- args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ARG1;
- break;
- } else
- if ((arg1[1] | alpha[0]) != ARG_DISABLE) {
- *reg |= arg1[1] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG1;
- break;
- }
- }
- /* fallthrough */
- case GL_MODULATE_SUBTRACT_ATI:
- /* Arg1 == arg2 */
- if (arg2[1] == arg2[0]) {
- if ((arg2[1] | arg1[2]) != ARG_DISABLE) {
- *reg |= arg2[1] | arg1[2];
- args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ARG1;
- break;
- } else
- if ((arg2[1] | alpha[2]) != ARG_DISABLE) {
- *reg |= arg2[1] | alpha[2];
- args[0] = MGA_ARG2; args[1] = MGA_ARG2; args[2] = MGA_ALPHA;
- break;
- }
- }
- if (arg2[1] == arg2[2]) {
- if ((arg2[1] | arg1[0]) != ARG_DISABLE) {
- *reg |= arg2[1] | arg1[0];
- args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ARG2;
- break;
- } else
- if ((arg2[1] | alpha[0]) != ARG_DISABLE) {
- *reg |= arg2[1] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG2;
- break;
- }
- }
- /* fallthrough */
- default:
- /* Find working combo of arg1, arg2 and alpha.
- *
- * Keep the Arg0 != alpha cases first since there's
- * no way to get alpha out by itself (GL_REPLACE).
- *
- * Keep the Arg2 == alpha cases first because only alpha has the
- * capabilities to function as Arg2 (GL_INTERPOLATE). Also good for
- * GL_ADD, GL_ADD_SIGNED, GL_SUBTRACT since we can't get alpha to the
- * adder.
- *
- * Keep the Arg1 == alpha cases last for GL_MODULATE_ADD_ATI,
- * GL_MODULATE_SIGNED_ADD_ATI. Again because we can't get alpha to the
- * adder.
- *
- * GL_MODULATE_SUBTRACT_ATI needs special treatment since it requires
- * that Arg1 == arg2. This requirement clashes with those of other modes.
- */
- if ((arg1[0] | arg2[1] | alpha[2]) != ARG_DISABLE) {
- *reg |= arg1[0] | arg2[1] | alpha[2];
- args[0] = MGA_ARG1; args[1] = MGA_ARG2; args[2] = MGA_ALPHA;
- } else
- if ((arg1[1] | arg2[0] | alpha[2]) != ARG_DISABLE &&
- texUnit->Combine.ModeRGB != GL_MODULATE_SUBTRACT_ATI) {
- *reg |= arg1[1] | arg2[0] | alpha[2];
- args[0] = MGA_ARG2; args[1] = MGA_ARG1; args[2] = MGA_ALPHA;
- } else
- if ((arg1[1] | arg2[2] | alpha[0]) != ARG_DISABLE &&
- texUnit->Combine.ModeRGB != GL_MODULATE_SUBTRACT_ATI) {
- *reg |= arg1[1] | arg2[2] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG1; args[2] = MGA_ARG2;
- } else
- if ((arg1[2] | arg2[1] | alpha[0]) != ARG_DISABLE) {
- *reg |= arg1[2] | arg2[1] | alpha[0];
- args[0] = MGA_ALPHA; args[1] = MGA_ARG2; args[2] = MGA_ARG1;
- } else
- if ((arg1[0] | arg2[2] | alpha[1]) != ARG_DISABLE) {
- *reg |= arg1[0] | arg2[2] | alpha[1];
- args[0] = MGA_ARG1; args[1] = MGA_ALPHA; args[2] = MGA_ARG2;
- } else
- if ((arg1[2] | arg2[0] | alpha[1]) != ARG_DISABLE) {
- *reg |= arg1[2] | arg2[0] | alpha[1];
- args[0] = MGA_ARG2; args[1] = MGA_ALPHA; args[2] = MGA_ARG1;
- } else {
- /* nothing suitable */
- return GL_FALSE;
- }
- }
-
- switch (texUnit->Combine.ModeRGB) {
- case GL_REPLACE:
- if (texUnit->Combine.ScaleShiftRGB) {
- return GL_FALSE;
- }
-
- if (args[0] == MGA_ARG1) {
- *reg |= TD0_color_sel_arg1;
- } else if (args[0] == MGA_ARG2) {
- *reg |= TD0_color_sel_arg2;
- } else if (args[0] == MGA_ALPHA) {
- /* Can't get alpha out by itself */
- return GL_FALSE;
- }
- break;
- case GL_MODULATE:
- if (texUnit->Combine.ScaleShiftRGB == 1) {
- *reg |= TD0_color_modbright_2x;
- } else if (texUnit->Combine.ScaleShiftRGB == 2) {
- *reg |= TD0_color_modbright_4x;
- }
-
- *reg |= TD0_color_sel_mul;
-
- if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
- if (args[0] == MGA_ARG1 || args[1] == MGA_ARG1) {
- *reg |= TD0_color_arg2mul_alpha2;
- } else if (args[0] == MGA_ARG2 || args[1] == MGA_ARG2) {
- *reg |= TD0_color_arg1mul_alpha1;
- }
- }
- break;
- case GL_ADD_SIGNED:
- *reg |= TD0_color_addbias_enable;
- /* fallthrough */
- case GL_ADD:
- if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
- /* Can't get alpha to the adder */
- return GL_FALSE;
- }
- if (texUnit->Combine.ScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->Combine.ScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_add |
- TD0_color_sel_add);
- break;
- case GL_INTERPOLATE:
- if (args[2] != MGA_ALPHA) {
- /* Only alpha can function as Arg2 */
- return GL_FALSE;
- }
- if (texUnit->Combine.ScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->Combine.ScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_arg1mul_alpha1 |
- TD0_color_blend_enable |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add);
-
- /* Have to do this with xor since GL_ONE_MINUS_SRC_ALPHA may have
- * already touched this bit.
- */
- *reg ^= TD0_color_alpha1inv_enable;
-
- if (args[0] == MGA_ARG2) {
- /* Swap arguments */
- *reg ^= (TD0_color_arg1mul_alpha1 |
- TD0_color_arg2mul_alpha2 |
- TD0_color_alpha1inv_enable |
- TD0_color_alpha2inv_enable);
- }
-
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* Linear blending mode needs dualtex enabled */
- *(reg+1) = (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2);
- mmesa->force_dualtex = GL_TRUE;
- }
- break;
- case GL_SUBTRACT:
- if (args[0] == MGA_ALPHA || args[1] == MGA_ALPHA) {
- /* Can't get alpha to the adder */
- return GL_FALSE;
- }
- if (texUnit->Combine.ScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->Combine.ScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_sub |
- TD0_color_sel_add);
-
- if (args[0] == MGA_ARG2) {
- /* Swap arguments */
- *reg ^= (TD0_color_arg1_inv_enable |
- TD0_color_arg2_inv_enable);
- }
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- *reg |= TD0_color_addbias_enable;
- /* fallthrough */
- case GL_MODULATE_ADD_ATI:
- if (args[1] == MGA_ALPHA) {
- /* Can't get alpha to the adder */
- return GL_FALSE;
- }
- if (texUnit->Combine.ScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->Combine.ScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_add |
- TD0_color_sel_add);
-
- if (args[1] == args[0] || args[1] == args[2]) {
- *reg |= TD0_color_arg1add_mulout;
- if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA)
- *reg |= TD0_color_arg1mul_alpha1;
-
- if (args[1] == MGA_ARG1) {
- /* Swap adder arguments */
- *reg ^= (TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout);
- if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA) {
- /* Swap multiplier arguments */
- *reg ^= (TD0_color_arg1mul_alpha1 |
- TD0_color_arg2mul_alpha2);
- }
- }
- } else {
- *reg |= (TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout);
-
- if (args[1] == MGA_ARG1) {
- /* Swap arguments */
- *reg ^= (TD0_color_arg1mul_alpha1 |
- TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout);
- }
- }
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- if (args[1] != MGA_ARG2) {
- /* Can't swap arguments */
- return GL_FALSE;
- }
- if (texUnit->Combine.ScaleShiftRGB == 1) {
- *reg |= TD0_color_add2x_enable;
- } else if (texUnit->Combine.ScaleShiftRGB == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_color_add_sub |
- TD0_color_sel_add);
-
- if (args[1] == args[0] || args[1] == args[2]) {
- *reg |= TD0_color_arg1add_mulout;
- if (args[0] == MGA_ALPHA || args[2] == MGA_ALPHA)
- *reg |= TD0_color_arg1mul_alpha1;
- } else {
- *reg |= (TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout);
- }
- break;
- }
-
-
- /* ALPHA */
- for (i = 0; i < 2; i++) {
- arg1[i] = 0;
- arg2[i] = 0;
- }
-
- for (i = 0; i < numAlphaArgs; i++) {
- switch (texUnit->Combine.SourceA[i]) {
- case GL_TEXTURE:
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- break;
- case GL_TEXTURE0:
- if (source == 0) {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- } else {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= TD0_alpha_arg2_prevtex;
- }
- break;
- case GL_TEXTURE1:
- if (source == 0) {
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* disable texturing */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- /* return GL_TRUE since we don't need a fallback */
- return GL_TRUE;
- }
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE0) */
- arg2[i] |= TD0_alpha_arg2_prevstage;
- } else {
- arg1[i] |= 0;
- arg2[i] |= ARG_DISABLE;
- }
- break;
- case GL_CONSTANT:
- if (mmesa->fcol_used &&
- mmesa->envcolor[source] != mmesa->envcolor[!source])
- return GL_FALSE;
-
- arg1[i] |= ARG_DISABLE;
- arg2[i] |= TD0_alpha_arg2_fcol;
-
- mmesa->setup.fcol = mmesa->envcolor[source];
- mmesa->fcol_used = GL_TRUE;
- break;
- case GL_PRIMARY_COLOR:
- arg1[i] |= ARG_DISABLE;
- /* G400 specs (TDUALSTAGE1) */
- if (unit == 0 || (mmesa->setup.tdualstage0 &
- ((TD0_color_sel_mul & TD0_color_sel_add) |
- (TD0_alpha_sel_mul & TD0_alpha_sel_add)))) {
- arg2[i] |= TD0_alpha_arg2_diffuse;
- } else {
- arg2[i] |= ARG_DISABLE;
- }
- break;
- case GL_PREVIOUS:
- arg1[i] |= ARG_DISABLE;
- if (unit == 0) {
- arg2[i] |= TD0_alpha_arg2_diffuse;
- } else {
- arg2[i] |= TD0_alpha_arg2_prevstage;
- }
- break;
- default:
- return GL_FALSE;
- }
-
- switch (texUnit->Combine.OperandA[i]) {
- case GL_SRC_ALPHA:
- arg1[i] |= 0;
- arg2[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- arg1[i] |= TD0_alpha_arg1_inv_enable;
- arg2[i] |= TD0_alpha_arg2_inv_enable;
- break;
- }
- }
-
- /* Find a working combo of arg1 and arg2 */
- if ((arg1[0] | arg2[1]) != ARG_DISABLE) {
- *reg |= arg1[0] | arg2[1];
- args[0] = MGA_ARG1; args[1] = MGA_ARG2;
- } else
- if ((arg1[1] | arg2[0]) != ARG_DISABLE) {
- *reg |= arg1[1] | arg2[0];
- args[0] = MGA_ARG2; args[1] = MGA_ARG1;
- } else {
- /* nothing suitable */
- return GL_FALSE;
- }
-
- switch (texUnit->Combine.ModeA) {
- case GL_REPLACE:
- if (texUnit->Combine.ScaleShiftA) {
- return GL_FALSE;
- }
-
- if (args[0] == MGA_ARG1) {
- *reg |= TD0_alpha_sel_arg1;
- } else if (args[0] == MGA_ARG2) {
- *reg |= TD0_alpha_sel_arg2;
- }
- break;
- case GL_MODULATE:
- if (texUnit->Combine.ScaleShiftA == 1) {
- *reg |= TD0_alpha_modbright_2x;
- } else if (texUnit->Combine.ScaleShiftA == 2) {
- *reg |= TD0_alpha_modbright_4x;
- }
-
- *reg |= TD0_alpha_sel_mul;
- break;
- case GL_ADD_SIGNED:
- *reg |= TD0_alpha_addbias_enable;
- /* fallthrough */
- case GL_ADD:
- if (texUnit->Combine.ScaleShiftA == 1) {
- *reg |= TD0_alpha_add2x_enable;
- } else if (texUnit->Combine.ScaleShiftA == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- break;
- case GL_SUBTRACT:
- if (texUnit->Combine.ScaleShiftA == 1) {
- *reg |= TD0_alpha_add2x_enable;
- } else if (texUnit->Combine.ScaleShiftA == 2) {
- return GL_FALSE;
- }
-
- *reg |= (TD0_alpha_add_disable |
- TD0_alpha_sel_add);
-
- if (args[0] == MGA_ARG2) {
- /* Swap arguments */
- *reg ^= (TD0_alpha_arg1_inv_enable |
- TD0_alpha_arg2_inv_enable);
- }
- break;
- }
-
- return GL_TRUE;
-}
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texstate.c
deleted file mode 100644
index 8c28254cb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_texstate.c
+++ /dev/null
@@ -1,902 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, Inc.
- * (c) Copyright IBM Corporation 2002
- * 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, 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
- * VA LINUX SYSTEMS, IBM 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:
- * Ian Romanick <idr@us.ibm.com>
- * Keith Whitwell <keithw@tungstengraphics.com>
- */
-/* $XFree86:$ */
-
-#include <stdlib.h>
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-
-#include "context.h"
-#include "enums.h"
-#include "macros.h"
-#include "imports.h"
-
-#include "simple_list.h"
-#include "texformat.h"
-
-#define MGA_USE_TABLE_FOR_FORMAT
-#ifdef MGA_USE_TABLE_FOR_FORMAT
-#define TMC_nr_tformat (MESA_FORMAT_YCBCR_REV + 1)
-static const unsigned TMC_tformat[ TMC_nr_tformat ] =
-{
- [MESA_FORMAT_ARGB8888] = TMC_tformat_tw32,
- [MESA_FORMAT_RGB565] = TMC_tformat_tw16,
- [MESA_FORMAT_ARGB4444] = TMC_tformat_tw12,
- [MESA_FORMAT_ARGB1555] = TMC_tformat_tw15,
- [MESA_FORMAT_AL88] = TMC_tformat_tw8al,
- [MESA_FORMAT_I8] = TMC_tformat_tw8a,
- [MESA_FORMAT_CI8] = TMC_tformat_tw8 ,
- [MESA_FORMAT_YCBCR] = TMC_tformat_tw422uyvy,
- [MESA_FORMAT_YCBCR_REV] = TMC_tformat_tw422,
-};
-#endif
-
-static void
-mgaSetTexImages( mgaContextPtr mmesa,
- const struct gl_texture_object * tObj )
-{
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
- struct gl_texture_image *baseImage = tObj->Image[0][ tObj->BaseLevel ];
- GLint totalSize;
- GLint width, height;
- GLint i;
- GLint numLevels;
- GLint log2Width, log2Height;
- GLuint txformat = 0;
- GLint ofs;
-
- /* Set the hardware texture format
- */
-#ifndef MGA_USE_TABLE_FOR_FORMAT
- switch (baseImage->TexFormat->MesaFormat) {
-
- case MESA_FORMAT_ARGB8888: txformat = TMC_tformat_tw32; break;
- case MESA_FORMAT_RGB565: txformat = TMC_tformat_tw16; break;
- case MESA_FORMAT_ARGB4444: txformat = TMC_tformat_tw12; break;
- case MESA_FORMAT_ARGB1555: txformat = TMC_tformat_tw15; break;
- case MESA_FORMAT_AL88: txformat = TMC_tformat_tw8al; break;
- case MESA_FORMAT_I8: txformat = TMC_tformat_tw8a; break;
- case MESA_FORMAT_CI8: txformat = TMC_tformat_tw8; break;
- case MESA_FORMAT_YCBCR: txformat = TMC_tformat_tw422uyvy; break;
- case MESA_FORMAT_YCBCR_REV: txformat = TMC_tformat_tw422; break;
-
- default:
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-#else
- if ( (baseImage->TexFormat->MesaFormat >= TMC_nr_tformat)
- || (TMC_tformat[ baseImage->TexFormat->MesaFormat ] == 0) )
- {
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-
- txformat = TMC_tformat[ baseImage->TexFormat->MesaFormat ];
-
-#endif /* MGA_USE_TABLE_FOR_FORMAT */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- log2Width = 0;
- log2Height = 0;
- } else {
- log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2;
- }
-
- width = tObj->Image[0][t->base.firstLevel]->Width;
- height = tObj->Image[0][t->base.firstLevel]->Height;
-
- numLevels = MIN2( t->base.lastLevel - t->base.firstLevel + 1,
- MGA_IS_G200(mmesa) ? G200_TEX_MAXLEVELS : G400_TEX_MAXLEVELS);
-
-
- totalSize = 0;
- for ( i = 0 ; i < numLevels ; i++ ) {
- const struct gl_texture_image * const texImage =
- tObj->Image[0][ i + t->base.firstLevel ];
- int size;
-
- if (texImage == NULL)
- break;
-
- size = texImage->Width * texImage->Height *
- baseImage->TexFormat->TexelBytes;
-
- t->offsets[i] = totalSize;
- t->base.dirty_images[0] |= (1<<i);
-
- /* All mipmaps must be 32-byte aligned */
- totalSize += (size + 31) & ~31;
-
- /* Since G400 calculates the offsets in hardware
- * it can't handle more than one < 32 byte mipmap.
- *
- * Further testing has indicated that it can't
- * handle any < 32 byte mipmaps.
- */
- if (MGA_IS_G400( mmesa ) && size <= 32) {
- i++;
- break;
- }
- }
-
- /* save these values */
- numLevels = i;
- t->base.lastLevel = t->base.firstLevel + numLevels - 1;
- t->base.totalSize = totalSize;
-
- /* setup hardware register values */
- t->setup.texctl &= (TMC_tformat_MASK & TMC_tpitch_MASK
- & TMC_tpitchext_MASK);
- t->setup.texctl |= txformat;
-
-
- /* Set the texture width. In order to support non-power of 2 textures and
- * textures larger than 1024 texels wide, "linear" pitch must be used. For
- * the linear pitch, if the width is 2048, a value of zero is used.
- */
-
- t->setup.texctl |= TMC_tpitchlin_enable;
- t->setup.texctl |= MGA_FIELD( TMC_tpitchext, width & (2048 - 1) );
-
-
- /* G400 specifies the number of mip levels in a strange way. Since there
- * are up to 11 levels, it requires 4 bits. Three of the bits are at the
- * high end of TEXFILTER. The other bit is in the middle. Weird.
- */
- numLevels--;
- t->setup.texfilter &= TF_mapnb_MASK & TF_mapnbhigh_MASK & TF_reserved_MASK;
- t->setup.texfilter |= MGA_FIELD( TF_mapnb, numLevels & 0x7 );
- t->setup.texfilter |= MGA_FIELD( TF_mapnbhigh, (numLevels >> 3) & 0x1 );
-
- /* warp texture registers */
- ofs = MGA_IS_G200(mmesa) ? 28 : 11;
-
- t->setup.texwidth = (MGA_FIELD(TW_twmask, width - 1) |
- MGA_FIELD(TW_rfw, (10 - log2Width - 8) & 63 ) |
- MGA_FIELD(TW_tw, (log2Width + ofs ) | 0x40 ));
-
- t->setup.texheight = (MGA_FIELD(TH_thmask, height - 1) |
- MGA_FIELD(TH_rfh, (10 - log2Height - 8) & 63 ) |
- MGA_FIELD(TH_th, (log2Height + ofs ) | 0x40 ));
-
- mgaUploadTexImages( mmesa, t );
-}
-
-
-/* ================================================================
- * Texture unit state management
- */
-
-static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current;
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
- GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
-
- if (tObj != ctx->Texture.Unit[0].Current2D &&
- tObj != ctx->Texture.Unit[0].CurrentRect)
- return;
-
-
- t->setup.texctl &= ~TMC_tmodulate_enable;
- t->setup.texctl2 &= ~(TMC_decalblend_enable |
- TMC_idecal_enable |
- TMC_decaldis_enable);
-
- switch (ctx->Texture.Unit[0].EnvMode) {
- case GL_REPLACE:
- if (format == GL_ALPHA)
- t->setup.texctl2 |= TMC_idecal_enable;
-
- if (format == GL_RGB || format == GL_LUMINANCE)
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- else
- mmesa->hw.alpha_sel = AC_alphasel_fromtex;
- break;
-
- case GL_MODULATE:
- t->setup.texctl |= TMC_tmodulate_enable;
-
- if (format == GL_ALPHA)
- t->setup.texctl2 |= (TMC_idecal_enable |
- TMC_decaldis_enable);
-
- if (format == GL_RGB || format == GL_LUMINANCE)
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- else
- mmesa->hw.alpha_sel = AC_alphasel_modulated;
- break;
-
- case GL_DECAL:
- if (format == GL_RGB || format == GL_RGBA)
- t->setup.texctl2 |= TMC_decalblend_enable;
- else
- t->setup.texctl2 |= TMC_idecal_enable;
-
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- break;
-
- case GL_BLEND:
- if (format == GL_ALPHA) {
- t->setup.texctl2 |= TMC_idecal_enable;
- mmesa->hw.alpha_sel = AC_alphasel_modulated;
- } else {
- t->texenv_fallback = GL_TRUE;
- }
- break;
-
- default:
- break;
- }
-}
-
-
-#define MGA_REPLACE 0
-#define MGA_MODULATE 1
-#define MGA_DECAL 2
-#define MGA_ADD 3
-#define MGA_MAX_COMBFUNC 4
-
-static const GLuint g400_color_combine[][MGA_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = Af
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_MODULATE
- * Cv = Cf Cs
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_mul |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_DECAL
- * Cv = Cs
- * Av = Af
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cf + Cs
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
- },
-
- /* Unit 1:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = Ap
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_MODULATE
- * Cv = Cp Cs
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_mul |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_DECAL
- * Cv = Cs
- * Av = Ap
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cp + Cs
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
- },
-};
-
-static const GLuint g400_color_alpha_combine[][MGA_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = As
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cf Cs
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_mul |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL
- * tmp = Cf ( 1 - As )
- * Cv = tmp + Cs As
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_alpha_currtex |
- TD0_color_alpha1inv_enable |
- TD0_color_arg1mul_alpha1 |
- TD0_color_blend_enable |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cf + Cs
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
- },
-
- /* Unit 1:
- */
- {
- /* GL_REPLACE
- * Cv = Cs
- * Av = As
- */
- (TD0_color_sel_arg1 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cp Cs
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_mul |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL
- * tmp = Cp ( 1 - As )
- * Cv = tmp + Cs As
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_alpha_currtex |
- TD0_color_alpha1inv_enable |
- TD0_color_arg1mul_alpha1 |
- TD0_color_blend_enable |
- TD0_color_arg1add_mulout |
- TD0_color_arg2add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cp + Cs
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
- },
-};
-
-static const GLuint g400_alpha_combine[][MGA_MAX_COMBFUNC] =
-{
- /* Unit 0:
- */
- {
- /* GL_REPLACE
- * Cv = Cf
- * Av = As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cf
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL (undefined)
- * Cv = Cf
- * Av = Af
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cf
- * Av = Af As
- */
- (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul),
- },
-
- /* Unit 1:
- */
- {
- /* GL_REPLACE
- * Cv = Cp
- * Av = As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_sel_arg1),
-
- /* GL_MODULATE
- * Cv = Cp
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
-
- /* GL_DECAL (undefined)
- * Cv = Cp
- * Av = Ap
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2),
-
- /* GL_ADD
- * Cv = Cp
- * Av = Ap As
- */
- (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_mul),
- },
-};
-
-static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
- GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
-
- *reg = 0;
-
- if (format == GL_ALPHA) {
- /* Cv = Cf */
- *reg |= (TD0_color_arg2_diffuse |
- TD0_color_sel_arg2);
- /* Av = Af As */
- *reg |= (TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul);
- return GL_TRUE;
- }
-
- /* C1 = Cf ( 1 - Cs ) */
- *reg |= (TD0_color_arg1_inv_enable |
- TD0_color_arg2_diffuse |
- TD0_color_sel_mul);
-
- if (format == GL_RGB || format == GL_LUMINANCE) {
- /* A1 = Af */
- *reg |= (TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_arg2);
- } else
- if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) {
- /* A1 = Af As */
- *reg |= (TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul);
- } else
- if (format == GL_INTENSITY) {
- /* A1 = Af ( 1 - As ) */
- *reg |= (TD0_alpha_arg1_inv_enable |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_sel_mul);
- }
-
- if (RGB_ZERO(mmesa->envcolor[source]) &&
- (format != GL_INTENSITY || ALPHA_ZERO(mmesa->envcolor[source])))
- return GL_TRUE; /* all done */
-
- if (ctx->Texture._EnabledUnits == 0x03)
- return GL_FALSE; /* need both units */
-
- mmesa->force_dualtex = GL_TRUE;
- reg = &mmesa->setup.tdualstage1;
- *reg = 0;
-
- if (RGB_ZERO(mmesa->envcolor[source])) {
- /* Cv = C1 */
- *reg |= (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2);
- } else
- if (RGB_ONE(mmesa->envcolor[source])) {
- /* Cv = C1 + Cs */
- *reg |= (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add);
- } else
- if (RGBA_EQUAL(mmesa->envcolor[source])) {
- /* Cv = C1 + Cc Cs */
- *reg |= (TD0_color_arg2_prevstage |
- TD0_color_alpha_fcol |
- TD0_color_arg2mul_alpha2 |
- TD0_color_arg1add_mulout |
- TD0_color_add_add |
- TD0_color_sel_add);
-
- mmesa->setup.fcol = mmesa->envcolor[source];
- } else {
- return GL_FALSE;
- }
-
- if (format != GL_INTENSITY || ALPHA_ZERO(mmesa->envcolor[source])) {
- /* Av = A1 */
- *reg |= (TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2);
- } else
- if (ALPHA_ONE(mmesa->envcolor[source])) {
- /* Av = A1 + As */
- *reg |= (TD0_alpha_arg2_prevstage |
- TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- } else {
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit);
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
- GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
-
- if (tObj != ctx->Texture.Unit[source].Current2D &&
- tObj != ctx->Texture.Unit[source].CurrentRect)
- return;
-
- switch (ctx->Texture.Unit[source].EnvMode) {
- case GL_REPLACE:
- if (format == GL_ALPHA) {
- *reg = g400_alpha_combine[unit][MGA_REPLACE];
- } else if (format == GL_RGB || format == GL_LUMINANCE) {
- *reg = g400_color_combine[unit][MGA_REPLACE];
- } else {
- *reg = g400_color_alpha_combine[unit][MGA_REPLACE];
- }
- break;
-
- case GL_MODULATE:
- if (format == GL_ALPHA) {
- *reg = g400_alpha_combine[unit][MGA_MODULATE];
- } else if (format == GL_RGB || format == GL_LUMINANCE) {
- *reg = g400_color_combine[unit][MGA_MODULATE];
- } else {
- *reg = g400_color_alpha_combine[unit][MGA_MODULATE];
- }
- break;
-
- case GL_DECAL:
- if (format == GL_RGB) {
- *reg = g400_color_combine[unit][MGA_DECAL];
- } else if (format == GL_RGBA) {
- *reg = g400_color_alpha_combine[unit][MGA_DECAL];
- if (ctx->Texture._EnabledUnits != 0x03) {
- /* Linear blending mode needs dual texturing enabled */
- *(reg+1) = (TD0_color_arg2_prevstage |
- TD0_color_sel_arg2 |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_sel_arg2);
- mmesa->force_dualtex = GL_TRUE;
- }
- } else {
- /* Undefined */
- *reg = g400_alpha_combine[unit][MGA_DECAL];
- }
- break;
-
- case GL_ADD:
- if (format == GL_ALPHA) {
- *reg = g400_alpha_combine[unit][MGA_ADD];
- } else if (format == GL_RGB || format == GL_LUMINANCE) {
- *reg = g400_color_combine[unit][MGA_ADD];
- } else if (format == GL_RGBA || format == GL_LUMINANCE_ALPHA) {
- *reg = g400_color_alpha_combine[unit][MGA_ADD];
- } else if (format == GL_INTENSITY) {
- /* Cv = Cf + Cs
- * Av = Af + As
- */
- if (unit == 0) {
- *reg = (TD0_color_arg2_diffuse |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_diffuse |
- TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- } else {
- *reg = (TD0_color_arg2_prevstage |
- TD0_color_add_add |
- TD0_color_sel_add |
- TD0_alpha_arg2_prevstage |
- TD0_alpha_add_enable |
- TD0_alpha_sel_add);
- }
- }
- break;
-
- case GL_BLEND:
- if (!mgaUpdateTextureEnvBlend(ctx, unit))
- t->texenv_fallback = GL_TRUE;
- break;
-
- case GL_COMBINE:
- if (!mgaUpdateTextureEnvCombine(ctx, unit))
- t->texenv_fallback = GL_TRUE;
- break;
- default:
- break;
- }
-}
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- /* Texture unit disabled */
-
- if ( mmesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- mmesa->CurrentTexObj[unit]->base.bound &= ~(1UL << unit);
- mmesa->CurrentTexObj[unit] = NULL;
- }
-
- if ( unit != 0 && !mmesa->force_dualtex ) {
- mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0;
- }
-
- if ( ctx->Texture._EnabledUnits == 0 ) {
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_trap;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit);
-}
-
-static GLboolean enable_tex( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->base.dirty_images[0]) {
- FLUSH_BATCH( mmesa );
- mgaSetTexImages( mmesa, tObj );
- if ( t->base.memBlock == NULL ) {
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- struct gl_texture_object *tObj = texUnit->_Current;
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) {
- return GL_FALSE;
- }
-
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( mmesa->CurrentTexObj[unit] != t ) {
- if ( mmesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- mmesa->CurrentTexObj[unit]->base.bound &= ~(1UL << unit);
- }
-
- mmesa->CurrentTexObj[unit] = t;
- t->base.bound |= (1UL << unit);
-
- driUpdateTextureLRU( (driTextureObject *) t ); /* done too often */
- }
-
- /* register setup */
- if ( unit == 1 ) {
- mmesa->setup.tdualstage1 = mmesa->setup.tdualstage0;
- }
-
- t->texenv_fallback = GL_FALSE;
-
- /* Set this before mgaUpdateTextureEnvG400() since
- * GL_ARB_texture_env_crossbar may have to disable texturing.
- */
- mmesa->setup.dwgctl &= DC_opcod_MASK;
- mmesa->setup.dwgctl |= DC_opcod_texture_trap;
-
- /* FIXME: The Radeon has some cached state so that it can avoid calling
- * FIXME: UpdateTextureEnv in some cases. Is that possible here?
- */
- if (MGA_IS_G400(mmesa)) {
- /* G400: Regardless of texture env mode, we use the alpha from the
- * texture unit (AC_alphasel_fromtex) since it will have already
- * been modulated by the incoming fragment color, if needed.
- * We don't want (AC_alphasel_modulate) since that'll effectively
- * do the modulation twice.
- */
- mmesa->hw.alpha_sel = AC_alphasel_fromtex;
-
- mgaUpdateTextureEnvG400( ctx, unit );
- } else {
- mgaUpdateTextureEnvG200( ctx, unit );
- }
-
- t->setup.texctl2 &= TMC_dualtex_MASK;
- if (ctx->Texture._EnabledUnits == 0x03 || mmesa->force_dualtex) {
- t->setup.texctl2 |= TMC_dualtex_enable;
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit);
-
- FALLBACK( ctx, MGA_FALLBACK_BORDER_MODE, t->border_fallback );
- return !t->border_fallback && !t->texenv_fallback;
-}
-
-
-static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- const int source = mmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
-
-
- if ( texUnit->_ReallyEnabled == TEXTURE_2D_BIT ||
- texUnit->_ReallyEnabled == TEXTURE_RECT_BIT ) {
- return(enable_tex( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-/* The G400 is now programmed quite differently wrt texture environment.
- */
-void mgaUpdateTextureState( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- GLboolean ok;
- unsigned i;
-
- mmesa->force_dualtex = GL_FALSE;
- mmesa->fcol_used = GL_FALSE;
-
- /* This works around a quirk with the MGA hardware. If only OpenGL
- * TEXTURE1 is enabled, then the hardware TEXTURE0 must be used. The
- * hardware TEXTURE1 can ONLY be used when hardware TEXTURE0 is also used.
- */
-
- mmesa->tmu_source[0] = 0;
- mmesa->tmu_source[1] = 1;
-
- if ((ctx->Texture._EnabledUnits & 0x03) == 0x02) {
- /* only texture 1 enabled */
- mmesa->tmu_source[0] = 1;
- mmesa->tmu_source[1] = 0;
- }
-
- for ( i = 0, ok = GL_TRUE
- ; (i < ctx->Const.MaxTextureUnits) && ok
- ; i++ ) {
- ok = updateTextureUnit( ctx, i );
- }
-
- FALLBACK( ctx, MGA_FALLBACK_TEXTURE, !ok );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c
deleted file mode 100644
index d1d7799f9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ /dev/null
@@ -1,1020 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.19 2003/03/26 20:43:49 tsi Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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.
- */
-
-/**
- * \file mga_xmesa.c
- * MGA screen and context initialization / creation code.
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include "drm.h"
-#include "mga_drm.h"
-#include "mga_xmesa.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgatex.h"
-#include "mgaspan.h"
-#include "mgaioctl.h"
-#include "mgatris.h"
-#include "mgavb.h"
-#include "mgapixel.h"
-#include "mga_xmesa.h"
-#include "mga_dri.h"
-
-#include "utils.h"
-#include "vblank.h"
-
-#include "extensions.h"
-
-#include "GL/internal/dri_interface.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_program
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_secondary_color
-#if 0
-#define need_GL_EXT_paletted_texture
-#endif
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-/* MGA configuration
- */
-#include "xmlpool.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_SOFTWARE
- DRI_CONF_ARB_VERTEX_PROGRAM(true)
- DRI_CONF_NV_VERTEX_PROGRAM(true)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 6;
-
-#ifndef MGA_DEBUG
-int MGA_DEBUG = 0;
-#endif
-
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-static __GLcontextModes *
-mgaFillInModes( 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;
-
- /* GLX_SWAP_COPY_OML is only supported because the MGA driver doesn't
- * support pageflipping at all.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
- };
-
- u_int8_t depth_bits_array[3];
- u_int8_t stencil_bits_array[3];
-
-
- 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;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 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_BGR;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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;
-}
-
-
-static GLboolean
-mgaInitDriver(__DRIscreenPrivate *sPriv)
-{
- mgaScreenPrivate *mgaScreen;
- MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(MGADRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- mgaScreen = (mgaScreenPrivate *)MALLOC(sizeof(mgaScreenPrivate));
- if (!mgaScreen) {
- __driUtilMessage("Couldn't malloc screen struct");
- return GL_FALSE;
- }
-
- mgaScreen->sPriv = sPriv;
- sPriv->private = (void *)mgaScreen;
-
- if (sPriv->drmMinor >= 1) {
- int ret;
- drm_mga_getparam_t gp;
-
- gp.param = MGA_PARAM_IRQ_NR;
- gp.value = &mgaScreen->irq;
- mgaScreen->irq = 0;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_MGA_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmMgaGetParam (MGA_PARAM_IRQ_NR): %d\n", ret);
- FREE(mgaScreen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
- }
-
- if ( glx_enable_extension != NULL ) {
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- }
-
- if (serverInfo->chipset != MGA_CARD_TYPE_G200 &&
- serverInfo->chipset != MGA_CARD_TYPE_G400) {
- FREE(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Unrecognized chipset");
- return GL_FALSE;
- }
-
-
- mgaScreen->chipset = serverInfo->chipset;
- mgaScreen->cpp = serverInfo->cpp;
-
- mgaScreen->agpMode = serverInfo->agpMode;
-
- mgaScreen->frontPitch = serverInfo->frontPitch;
- mgaScreen->frontOffset = serverInfo->frontOffset;
- mgaScreen->backOffset = serverInfo->backOffset;
- mgaScreen->backPitch = serverInfo->backPitch;
- mgaScreen->depthOffset = serverInfo->depthOffset;
- mgaScreen->depthPitch = serverInfo->depthPitch;
-
-
- /* The only reason that the MMIO region needs to be accessable and the
- * primary DMA region base address needs to be known is so that the driver
- * can busy wait for certain DMA operations to complete (see
- * mgaWaitForFrameCompletion in mgaioctl.c).
- *
- * Starting with MGA DRM version 3.2, these are completely unneeded as
- * there is a new, in-kernel mechanism for handling the wait.
- */
-
- if (mgaScreen->sPriv->drmMinor < 2) {
- mgaScreen->mmio.handle = serverInfo->registers.handle;
- mgaScreen->mmio.size = serverInfo->registers.size;
- if ( drmMap( sPriv->fd,
- mgaScreen->mmio.handle, mgaScreen->mmio.size,
- &mgaScreen->mmio.map ) < 0 ) {
- FREE( mgaScreen );
- sPriv->private = NULL;
- __driUtilMessage( "Couldn't map MMIO registers" );
- return GL_FALSE;
- }
-
- mgaScreen->primary.handle = serverInfo->primary.handle;
- mgaScreen->primary.size = serverInfo->primary.size;
- }
- else {
- (void) memset( & mgaScreen->primary, 0, sizeof( mgaScreen->primary ) );
- (void) memset( & mgaScreen->mmio, 0, sizeof( mgaScreen->mmio ) );
- }
-
- mgaScreen->textureOffset[MGA_CARD_HEAP] = serverInfo->textureOffset;
- mgaScreen->textureOffset[MGA_AGP_HEAP] = (serverInfo->agpTextureOffset |
- PDEA_pagpxfer_enable | 1);
-
- mgaScreen->textureSize[MGA_CARD_HEAP] = serverInfo->textureSize;
- mgaScreen->textureSize[MGA_AGP_HEAP] = serverInfo->agpTextureSize;
-
-
- /* The texVirtual array stores the base addresses in the CPU's address
- * space of the texture memory pools. The base address of the on-card
- * memory pool is calculated as an offset of the base of video memory. The
- * AGP texture pool has to be mapped into the processes address space by
- * the DRM.
- */
-
- mgaScreen->texVirtual[MGA_CARD_HEAP] = (char *)(mgaScreen->sPriv->pFB +
- serverInfo->textureOffset);
-
- if ( serverInfo->agpTextureSize > 0 ) {
- if (drmMap(sPriv->fd, serverInfo->agpTextureOffset,
- serverInfo->agpTextureSize,
- (drmAddress *)&mgaScreen->texVirtual[MGA_AGP_HEAP]) != 0) {
- FREE(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Couldn't map agptexture region");
- return GL_FALSE;
- }
- }
-
-
- /* For calculating setupdma addresses.
- */
-
- mgaScreen->bufs = drmMapBufs(sPriv->fd);
- if (!mgaScreen->bufs) {
- FREE(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Couldn't map dma buffers");
- return GL_FALSE;
- }
- mgaScreen->sarea_priv_offset = serverInfo->sarea_priv_offset;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&mgaScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- return GL_TRUE;
-}
-
-
-static void
-mgaDestroyScreen(__DRIscreenPrivate *sPriv)
-{
- mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *) sPriv->private;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf(stderr, "mgaDestroyScreen\n");
-
- drmUnmapBufs(mgaScreen->bufs);
-
-
- /* free all option information */
- driDestroyOptionInfo (&mgaScreen->optionCache);
-
- FREE(mgaScreen);
- sPriv->private = NULL;
-}
-
-
-extern const struct tnl_pipeline_stage _mga_render_stage;
-
-static const struct tnl_pipeline_stage *mga_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_arb_vertex_program_stage,
- &_tnl_vertex_program_stage,
-
- /* REMOVE: point attenuation stage */
-#if 0
- &_mga_render_stage, /* ADD: unclipped rastersetup-to-dma */
- /* Need new ioctl for wacceptseq */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-static const struct dri_extension g400_extensions[] =
-{
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_env_combine", NULL },
- { "GL_ARB_texture_env_crossbar", NULL },
- { "GL_EXT_texture_env_combine", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_ATI_texture_env_combine3", NULL },
- { NULL, NULL }
-};
-
-static const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_rectangle", NULL },
- { "GL_EXT_blend_logic_op", NULL },
- { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
- { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
- /* paletted_textures currently doesn't work, but we could fix them later */
-#if defined( need_GL_EXT_paletted_texture )
- { "GL_EXT_shared_texture_palette", NULL },
- { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions },
-#endif
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-static const struct dri_extension ARB_vp_extension[] = {
- { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
- { NULL, NULL }
-};
-
-static const struct dri_extension NV_vp_extensions[] = {
- { "GL_NV_vertex_program", GL_NV_vertex_program_functions },
- { "GL_NV_vertex_program1_1", NULL },
- { NULL, NULL }
-};
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_VERBOSE_FALLBACK },
- { "tex", DEBUG_VERBOSE_TEXTURE },
- { "ioctl", DEBUG_VERBOSE_IOCTL },
- { "verb", DEBUG_VERBOSE_MSG },
- { "dri", DEBUG_VERBOSE_DRI },
- { NULL, 0 }
-};
-
-
-static GLboolean
-mgaCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- int i;
- unsigned maxlevels;
- GLcontext *ctx, *shareCtx;
- mgaContextPtr mmesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
- drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+
- mgaScreen->sarea_priv_offset);
- struct dd_function_table functions;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf(stderr, "mgaCreateContext\n");
-
- /* allocate mga context */
- mmesa = (mgaContextPtr) CALLOC(sizeof(mgaContext));
- if (!mmesa) {
- return GL_FALSE;
- }
-
- /* Init default driver functions then plug in our Radeon-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions( &functions );
- mgaInitDriverFuncs( &functions );
- mgaInitTextureFuncs( &functions );
- mgaInitIoctlFuncs( &functions );
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((mgaContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
- &functions, (void *) mmesa);
- if (!mmesa->glCtx) {
- FREE(mmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = mmesa;
-
- /* Init mga state */
- mmesa->hHWContext = driContextPriv->hHWContext;
- mmesa->driFd = sPriv->fd;
- mmesa->driHwLock = &sPriv->pSAREA->lock;
-
- mmesa->mgaScreen = mgaScreen;
- mmesa->driScreen = sPriv;
- mmesa->sarea = (void *)saPriv;
-
- /* Parse configuration files */
- driParseConfigFiles (&mmesa->optionCache, &mgaScreen->optionCache,
- sPriv->myNum, "mga");
-
- (void) memset( mmesa->texture_heaps, 0, sizeof( mmesa->texture_heaps ) );
- make_empty_list( & mmesa->swapped );
-
- mmesa->nr_heaps = mgaScreen->texVirtual[MGA_AGP_HEAP] ? 2 : 1;
- for ( i = 0 ; i < mmesa->nr_heaps ; i++ ) {
- mmesa->texture_heaps[i] = driCreateTextureHeap( i, mmesa,
- mgaScreen->textureSize[i],
- 6,
- MGA_NR_TEX_REGIONS,
- (drmTextureRegionPtr)mmesa->sarea->texList[i],
- &mmesa->sarea->texAge[i],
- &mmesa->swapped,
- sizeof( mgaTextureObject_t ),
- (destroy_texture_object_t *) mgaDestroyTexObj );
- }
-
- /* Set the maximum texture size small enough that we can guarentee
- * that both texture units can bind a maximal texture and have them
- * on the card at once.
- */
- ctx = mmesa->glCtx;
- if ( mgaScreen->chipset == MGA_CARD_TYPE_G200 ) {
- ctx->Const.MaxTextureUnits = 1;
- ctx->Const.MaxTextureImageUnits = 1;
- ctx->Const.MaxTextureCoordUnits = 1;
- maxlevels = G200_TEX_MAXLEVELS;
-
- }
- else {
- ctx->Const.MaxTextureUnits = 2;
- ctx->Const.MaxTextureImageUnits = 2;
- ctx->Const.MaxTextureCoordUnits = 2;
- maxlevels = G400_TEX_MAXLEVELS;
- }
-
- driCalculateMaxTextureLevels( mmesa->texture_heaps,
- mmesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported. */
- 0, /* cube textures unsupported. */
- 11, /* max texture rect size is 2048x2048 */
- maxlevels,
- GL_FALSE );
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 10.0;
- ctx->Const.MaxLineWidthAA = 10.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- mmesa->texture_depth = driQueryOptioni (&mmesa->optionCache,
- "texture_depth");
- if (mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- mmesa->texture_depth = ( mesaVis->rgbBits >= 24 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
- mmesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
-
- switch (mesaVis->depthBits) {
- case 16:
- mmesa->depth_scale = 1.0/(GLdouble)0xffff;
- mmesa->depth_clear_mask = ~0;
- mmesa->ClearDepth = 0xffff;
- break;
- case 24:
- mmesa->depth_scale = 1.0/(GLdouble)0xffffff;
- if (mmesa->hw_stencil) {
- mmesa->depth_clear_mask = 0xffffff00;
- mmesa->stencil_clear_mask = 0x000000ff;
- } else
- mmesa->depth_clear_mask = ~0;
- mmesa->ClearDepth = 0xffffff00;
- break;
- case 32:
- mmesa->depth_scale = 1.0/(GLdouble)0xffffffff;
- mmesa->depth_clear_mask = ~0;
- mmesa->ClearDepth = 0xffffffff;
- break;
- };
-
- mmesa->haveHwStipple = GL_FALSE;
- mmesa->RenderIndex = -1; /* impossible value */
- mmesa->dirty = ~0;
- mmesa->vertex_format = 0;
- mmesa->CurrentTexObj[0] = 0;
- mmesa->CurrentTexObj[1] = 0;
- mmesa->tmu_source[0] = 0;
- mmesa->tmu_source[1] = 1;
-
- mmesa->texAge[0] = 0;
- mmesa->texAge[1] = 0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
-
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, mga_pipeline );
-
- /* Configure swrast and T&L 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 );
-
- mmesa->primary_offset = mmesa->mgaScreen->primary.handle;
-
- ctx->DriverCtx = (void *) mmesa;
- mmesa->glCtx = ctx;
-
- driInitExtensions( ctx, card_extensions, GL_FALSE );
-
- if (MGA_IS_G400(MGA_CONTEXT(ctx))) {
- driInitExtensions( ctx, g400_extensions, GL_FALSE );
- }
-
- if ( driQueryOptionb( &mmesa->optionCache, "arb_vertex_program" ) ) {
- driInitSingleExtension( ctx, ARB_vp_extension );
- }
-
- if ( driQueryOptionb( &mmesa->optionCache, "nv_vertex_program" ) ) {
- driInitExtensions( ctx, NV_vp_extensions, GL_FALSE );
- }
-
-
- /* XXX these should really go right after _mesa_init_driver_functions() */
- mgaDDInitStateFuncs( ctx );
- mgaDDInitSpanFuncs( ctx );
- mgaDDInitPixelFuncs( ctx );
- mgaDDInitTriFuncs( ctx );
-
- mgaInitVB( ctx );
- mgaInitState( mmesa );
-
- driContextPriv->driverPrivate = (void *) mmesa;
-
-#if DO_DEBUG
- MGA_DEBUG = driParseDebugString( getenv( "MGA_DEBUG" ),
- debug_control );
-#endif
-
- mmesa->vblank_flags = (mmesa->mgaScreen->irq == 0)
- ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache);
-
- (*dri_interface->getUST)( & mmesa->swap_ust );
-
- if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(mmesa->glCtx, MGA_FALLBACK_DISABLE, 1);
- }
-
- return GL_TRUE;
-}
-
-static void
-mgaDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf( stderr, "[%s:%d] mgaDestroyContext start\n",
- __FILE__, __LINE__ );
-
- assert(mmesa); /* should never be null */
- if (mmesa) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (mmesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( mmesa->glCtx );
- _tnl_DestroyContext( mmesa->glCtx );
- _ac_DestroyContext( mmesa->glCtx );
- _swrast_DestroyContext( mmesa->glCtx );
-
- mgaFreeVB( mmesa->glCtx );
-
- /* free the Mesa context */
- mmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(mmesa->glCtx);
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- for ( i = 0 ; i < mmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( mmesa->texture_heaps[ i ] );
- mmesa->texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & mmesa->swapped ) );
- }
-
- /* free the option cache */
- driDestroyOptionCache (&mmesa->optionCache);
-
- FREE(mmesa);
- }
-
- if (MGA_DEBUG&DEBUG_VERBOSE_DRI)
- fprintf( stderr, "[%s:%d] mgaDestroyContext done\n",
- __FILE__, __LINE__ );
-}
-
-
-static GLboolean
-mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- mgaScreenPrivate *screen = (mgaScreenPrivate *) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
-
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- mgaSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- mgaSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- mgaSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- /* XXX is this right? */
- if (mesaVis->stencilBits) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- mgaSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- mgaSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- }
- else if (mesaVis->depthBits == 32) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- mgaSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- mgaSetSpanFunctions(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;
-#endif
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static void
-mgaSwapBuffers(__DRIdrawablePrivate *dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- mgaContextPtr mmesa;
- GLcontext *ctx;
- mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = mmesa->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx );
- mgaCopyBuffer( dPriv );
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!\n", __FUNCTION__);
- }
-}
-
-static GLboolean
-mgaUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
- if (mmesa)
- mmesa->dirty = ~0;
-
- return GL_TRUE;
-}
-
-/* This looks buggy to me - the 'b' variable isn't used anywhere...
- * Hmm - It seems that the drawable is already hooked in to
- * driDrawablePriv.
- *
- * But why are we doing context initialization here???
- */
-static GLboolean
-mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
-
- if (mmesa->driDrawable != driDrawPriv) {
- driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags );
- mmesa->driDrawable = driDrawPriv;
- mmesa->dirty = ~0;
- mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
- mmesa->mesa_drawable = driDrawPriv;
- }
-
- mmesa->driReadable = driReadPriv;
-
- _mesa_make_current(mmesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
- }
- else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-
-void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- drm_mga_sarea_t *sarea = mmesa->sarea;
- int me = mmesa->hHWContext;
- int i;
-
- drmGetLock(mmesa->driFd, mmesa->hHWContext, flags);
-
- if (*(dPriv->pStamp) != mmesa->lastStamp) {
- mmesa->lastStamp = *(dPriv->pStamp);
- mmesa->SetupNewInputs |= VERT_BIT_POS;
- mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
- mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) );
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
-
- mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT;
-
- if (sarea->ctxOwner != me) {
- mmesa->dirty |= (MGA_UPLOAD_CONTEXT | MGA_UPLOAD_TEX0 |
- MGA_UPLOAD_TEX1 | MGA_UPLOAD_PIPE);
- sarea->ctxOwner=me;
- }
-
- for ( i = 0 ; i < mmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( mmesa->texture_heaps[ i ] );
- }
-}
-
-
-static const struct __DriverAPIRec mgaAPI = {
- .InitDriver = mgaInitDriver,
- .DestroyScreen = mgaDestroyScreen,
- .CreateContext = mgaCreateContext,
- .DestroyContext = mgaDestroyContext,
- .CreateBuffer = mgaCreateBuffer,
- .DestroyBuffer = mgaDestroyBuffer,
- .SwapBuffers = mgaSwapBuffers,
- .MakeCurrent = mgaMakeCurrent,
- .UnbindContext = mgaUnbindContext,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/**
- * 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 2, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 3, 0, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "MGA",
- 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, &mgaAPI);
- if ( psp != NULL ) {
- MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv;
- *driver_modes = mgaFillInModes( dri_priv->cpp * 8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- driInitExtensions( NULL, g400_extensions, GL_FALSE );
- driInitSingleExtension( NULL, ARB_vp_extension );
- driInitExtensions( NULL, NV_vp_extensions, GL_FALSE );
-
- }
-
- return (void *) psp;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- mgaContextPtr mmesa;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = mmesa->swap_count;
- sInfo->swap_ust = mmesa->swap_ust;
- sInfo->swap_missed_count = mmesa->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, mmesa->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.h
deleted file mode 100644
index 0ab0c63f7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mga_xmesa.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h,v 1.12 2002/12/16 16:18:52 dawes Exp $ */
-
-#ifndef _MGA_INIT_H_
-#define _MGA_INIT_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "mga_drm.h"
-#include "mtypes.h"
-#include "mgaregs.h"
-#include "xmlconfig.h"
-
-typedef struct mga_screen_private_s {
- /**
- * Chipset "family" of this card. Currently only \c MGA_CARD_TYPE_G200 and
- * \c MGA_CARD_TYPE_G400 are possible.
- */
- int chipset;
-
-
- /**
- * Characters (bytes) per-pixel for both the front and back buffers.
- *
- * \note
- * This is also implicitly the bytes per-pixel for the depth-buffer.
- */
- int cpp;
-
- GLint agpMode;
- unsigned int irq; /**< IRQ number (0 means none) */
-
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- unsigned int textureOffset[MGA_NR_TEX_HEAPS];
- unsigned int textureSize[MGA_NR_TEX_HEAPS];
- char *texVirtual[MGA_NR_TEX_HEAPS];
-
-
- __DRIscreenPrivate *sPriv;
- drmBufMapPtr bufs;
-
- drmRegion mmio;
- drmRegion primary;
- unsigned int sarea_priv_offset;
-
- /** Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} mgaScreenPrivate;
-
-
-/**
- * mgaRenderbuffer, derived from Mesa's gl_renderbuffer
- */
-typedef struct {
- struct gl_renderbuffer Base;
- /* XXX per-window info should go here */
- int foo, bar;
-} mgaRenderbuffer;
-
-
-
-#include "mgacontext.h"
-
-extern void mgaGetLock( mgaContextPtr mmesa, GLuint flags );
-extern void mgaEmitHwStateLocked( mgaContextPtr mmesa );
-extern void mgaEmitScissorValues( mgaContextPtr mmesa, int box_nr, int emit );
-
-#define GET_DISPATCH_AGE( mmesa ) mmesa->sarea->last_dispatch
-
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( mmesa ) \
- do { \
- char __ret=0; \
- DRM_CAS(mmesa->driHwLock, mmesa->hHWContext, \
- (DRM_LOCK_HELD|mmesa->hHWContext), __ret); \
- if (__ret) \
- mgaGetLock( mmesa, 0 ); \
- } while (0)
-
-
-/*
- */
-#define LOCK_HARDWARE_QUIESCENT( mmesa ) do { \
- LOCK_HARDWARE( mmesa ); \
- UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); \
-} while (0)
-
-
-/* Unlock the hardware using the global current context
- */
-#define UNLOCK_HARDWARE(mmesa) \
- DRM_UNLOCK(mmesa->driFd, mmesa->driHwLock, mmesa->hHWContext);
-
-
-/* Freshen our snapshot of the drawables
- */
-#define REFRESH_DRAWABLE_INFO( mmesa ) \
-do { \
- LOCK_HARDWARE( mmesa ); \
- mmesa->lastX = mmesa->drawX; \
- mmesa->lastY = mmesa->drawY; \
- UNLOCK_HARDWARE( mmesa ); \
-} while (0)
-
-
-#define GET_DRAWABLE_LOCK( mmesa ) while(0)
-#define RELEASE_DRAWABLE_LOCK( mmesa ) while(0)
-
-
-/* The 2D driver macros are busted -- we can't use them here as they
- * rely on the 2D driver data structures rather than taking an explicit
- * base address.
- */
-#define MGA_BASE( reg ) ((unsigned long)(mmesa->mgaScreen->mmio.map))
-#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg)
-
-#define MGA_DEREF( reg ) *(volatile u_int32_t *)MGA_ADDR( reg )
-#define MGA_READ( reg ) MGA_DEREF( reg )
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgacontext.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgacontext.h
deleted file mode 100644
index 81348b6c7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgacontext.h
+++ /dev/null
@@ -1,372 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgacontext.h,v 1.7 2002/12/16 16:18:52 dawes Exp $*/
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-
-#ifndef MGALIB_INC
-#define MGALIB_INC
-
-#include <stdint.h>
-#include "drm.h"
-#include "mga_drm.h"
-#include "dri_util.h"
-#include "mtypes.h"
-#include "xf86drm.h"
-#include "mm.h"
-#include "colormac.h"
-#include "texmem.h"
-#include "macros.h"
-#include "xmlconfig.h"
-
-#define MGA_SET_FIELD(reg,mask,val) reg = ((reg) & (mask)) | ((val) & ~(mask))
-#define MGA_FIELD(field,val) (((val) << (field ## _SHIFT)) & ~(field ## _MASK))
-#define MGA_GET_FIELD(field, val) ((val & ~(field ## _MASK)) >> (field ## _SHIFT))
-
-#define MGA_IS_G200(mmesa) (mmesa->mgaScreen->chipset == MGA_CARD_TYPE_G200)
-#define MGA_IS_G400(mmesa) (mmesa->mgaScreen->chipset == MGA_CARD_TYPE_G400)
-
-
-/* SoftwareFallback
- * - texture env GL_BLEND -- can be fixed
- * - 1D and 3D textures
- * - incomplete textures
- * - GL_DEPTH_FUNC == GL_NEVER not in h/w
- */
-#define MGA_FALLBACK_TEXTURE 0x1
-#define MGA_FALLBACK_DRAW_BUFFER 0x2
-#define MGA_FALLBACK_READ_BUFFER 0x4
-#define MGA_FALLBACK_BLEND 0x8
-#define MGA_FALLBACK_RENDERMODE 0x10
-#define MGA_FALLBACK_STENCIL 0x20
-#define MGA_FALLBACK_DEPTH 0x40
-#define MGA_FALLBACK_BORDER_MODE 0x80
-#define MGA_FALLBACK_DISABLE 0x100
-
-
-/* Use the templated vertex formats:
- */
-#define TAG(x) mga##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef struct mga_context_t mgaContext;
-typedef struct mga_context_t *mgaContextPtr;
-
-typedef void (*mga_tri_func)( mgaContextPtr, mgaVertex *, mgaVertex *,
- mgaVertex * );
-typedef void (*mga_line_func)( mgaContextPtr, mgaVertex *, mgaVertex * );
-typedef void (*mga_point_func)( mgaContextPtr, mgaVertex * );
-
-
-
-/* Texture environment color
- */
-#define RGB_ZERO(c) (((c) & 0xffffff) == 0x000000)
-#define RGB_ONE(c) (((c) & 0xffffff) == 0xffffff)
-#define ALPHA_ZERO(c) (((c) >> 24) == 0x00)
-#define ALPHA_ONE(c) (((c) >> 24) == 0xff)
-#define RGBA_EQUAL(c) ((c) == PACK_COLOR_8888( (c) & 0xff, (c) & 0xff, \
- (c) & 0xff, (c) & 0xff ))
-
-struct mga_texture_object_s;
-struct mga_screen_private_s;
-
-#define G200_TEX_MAXLEVELS 5
-#define G400_TEX_MAXLEVELS 11
-
-typedef struct mga_texture_object_s
-{
- driTextureObject base;
-
- /* The G200 only has the ability to use 5 mipmap levels (including the
- * base level). The G400 does not have this restriction, but it still
- * only has 5 offset pointers in the hardware. The trick on the G400 is
- * upto the first 4 offset pointers point to mipmap levels. The last
- * offset pointer tells how large the preceeding mipmap is. This value is
- * then used to determine where the remaining mipmaps are.
- *
- * For example, if the first offsets[0] through offsets[2] are used as
- * pointers, then offset[3] will be the size of the mipmap pointed to by
- * offsets[2]. So mipmap level 3 will be at (offsets[2]+offsets[3]). For
- * each successive mipmap level, offsets[3] is divided by 4 and added to
- * the previous address. So mipmap level 4 will be at
- * (offsets[2]+offsets[3]+(offsets[3] / 4)).
- *
- * The last pointer is selected by setting TO_texorgoffsetsel in its
- * pointer. In the previous example, offset[2] would have
- * TO_texorgoffsetsel or'ed in before writing it to the hardware.
- *
- * In the current driver all of the mipmaps are packed together linearly
- * with mipmap level 0. Therefore offsets[0] points to the base of the
- * texture (and has TO_texorgoffsetsel or'ed in), and offsets[1] is the
- * size of the base texture.
- *
- * There is a possible optimization available here. At times the driver
- * may not be able to allocate a single block of memory for the complete
- * texture without ejecting some other textures from memory. It may be
- * possible to put some of the lower mipmap levels (i.e., the larger
- * mipmaps) in memory separate from the higher levels.
- *
- * The implementation should be fairly obvious, but getting "right" would
- * likely be non-trivial. A first allocation for the entire texture would
- * be attempted with a flag that says "don't eject other textures." If
- * that failed, an additional allocation would be attmpted for just the
- * base map. The process would repeat with the block of lower maps. The
- * tricky parts would be in detecting when some of the levels had been
- * ejected from texture memory by other textures and preventing the
- * 4th allocation (for all the smallest mipmap levels) from kicking out
- * any of the first three.
- *
- * This array holds G400_TEX_MAXLEVELS pointers to remove an if-statement
- * in a loop in mgaSetTexImages. Values past G200_TEX_MAXLEVELS are not
- * used.
- */
- GLuint offsets[G400_TEX_MAXLEVELS];
-
- int texelBytes;
- GLuint age;
-
- drm_mga_texture_regs_t setup;
-
- /* If one texture dimension wraps with GL_CLAMP and the other with
- * GL_CLAMP_TO_EDGE, we have to fallback to software. We would also have
- * to fallback for GL_CLAMP_TO_BORDER.
- */
- GLboolean border_fallback;
- /* Depending on multitxturing and environment color
- * GL_BLEND may have to be a software fallback.
- */
- GLboolean texenv_fallback;
-} mgaTextureObject_t;
-
-struct mga_hw_state {
- GLuint specen;
- GLuint cull;
- GLuint cull_dualtex;
- GLuint stencil;
- GLuint stencilctl;
- GLuint stencil_enable;
- GLuint zmode;
- GLuint rop;
- GLuint alpha_func;
- GLuint alpha_func_enable;
- GLuint blend_func;
- GLuint blend_func_enable;
- GLuint alpha_sel;
-};
-
-struct mga_context_t {
-
- GLcontext *glCtx;
- unsigned int lastStamp; /* fullscreen breaks dpriv->laststamp,
- * need to shadow it here. */
-
- /* Hardware state management
- */
- struct mga_hw_state hw;
-
- /* Bookkeeping for texturing
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ MGA_NR_TEX_HEAPS ];
- driTextureObject swapped;
-
- struct mga_texture_object_s *CurrentTexObj[2];
-
-
- /* Map GL texture units onto hardware.
- */
- GLuint tmu_source[2];
-
- int texture_depth;
-
- /* Manage fallbacks
- */
- GLuint Fallback;
-
- /* Texture environment color.
- */
- unsigned int envcolor[2];
- GLboolean fcol_used;
- GLboolean force_dualtex;
-
- /* Rasterization state
- */
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLuint RenderIndex;
-
- GLuint hw_primitive;
- GLenum raster_primitive;
- GLenum render_primitive;
-
- GLubyte *verts;
- GLint vertex_stride_shift;
- GLuint vertex_format;
- GLuint vertex_size;
-
- /* Fallback rasterization functions
- */
- mga_point_func draw_point;
- mga_line_func draw_line;
- mga_tri_func draw_tri;
-
-
- /* Manage driver and hardware state
- */
- GLuint NewGLState;
- GLuint dirty;
-
- drm_mga_context_regs_t setup;
-
- GLuint ClearColor;
- GLuint ClearDepth;
- GLuint poly_stipple;
- GLfloat depth_scale;
-
- GLuint depth_clear_mask;
- GLuint stencil_clear_mask;
- GLuint hw_stencil;
- GLuint haveHwStipple;
- GLfloat hw_viewport[16];
-
- /* Dma buffers
- */
- drmBufPtr vertex_dma_buffer;
- drmBufPtr iload_buffer;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- int64_t swap_ust;
- int64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
- uint32_t last_frame_fence;
-
- /* Drawable, cliprect and scissor information
- */
- int dirty_cliprects; /* which sets of cliprects are uptodate? */
- int draw_buffer; /* which buffer are we rendering to */
- unsigned int drawOffset; /* draw buffer address in space */
- int readOffset;
- int drawX, drawY; /* origin of drawable in draw buffer */
- int lastX, lastY; /* detect DSTORG bug */
- GLuint numClipRects; /* cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
- drm_clip_rect_t draw_rect;
- drm_clip_rect_t scissor_rect;
- int scissor;
-
- drm_clip_rect_t tmp_boxes[2][MGA_NR_SAREA_CLIPRECTS];
-
-
- /* Texture aging and DMA based aging.
- */
- unsigned int texAge[MGA_NR_TEX_HEAPS];/* texture LRU age */
- unsigned int dirtyAge; /* buffer age for synchronization */
-
- GLuint primary_offset;
-
- /* Mirrors of some DRI state.
- */
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
- __DRIdrawablePrivate *driDrawable;
- __DRIdrawablePrivate *driReadable;
-
- /**
- * Drawable used by Mesa for software fallbacks for reading and
- * writing. It is set by Mesa's \c SetBuffer callback, and will always be
- * either \c mga_context_t::driDrawable or \c mga_context_t::driReadable.
- */
- __DRIdrawablePrivate *mesa_drawable;
-
- __DRIscreenPrivate *driScreen;
- struct mga_screen_private_s *mgaScreen;
- drm_mga_sarea_t *sarea;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define MGA_CONTEXT(ctx) ((mgaContextPtr)(ctx->DriverCtx))
-
-
-
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int MGA_DEBUG;
-#else
-#define MGA_DEBUG 0
-#endif
-
-#define DEBUG_VERBOSE_MSG 0x01
-#define DEBUG_VERBOSE_DRI 0x02
-#define DEBUG_VERBOSE_IOCTL 0x04
-#define DEBUG_VERBOSE_TEXTURE 0x08
-#define DEBUG_VERBOSE_FALLBACK 0x10
-
-static __inline__ GLuint mgaPackColor(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;
- }
-}
-
-
-/*
- * Subpixel offsets for window coordinates:
- */
-#define SUBPIXEL_X (-0.5F)
-#define SUBPIXEL_Y (-0.5F + 0.125)
-
-
-#define MGA_WA_TRIANGLES 0x18000000
-#define MGA_WA_TRISTRIP_T0 0x02010200
-#define MGA_WA_TRIFAN_T0 0x01000408
-#define MGA_WA_TRISTRIP_T0T1 0x02010400
-#define MGA_WA_TRIFAN_T0T1 0x01000810
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.c
deleted file mode 100644
index 8532ea95f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.14 2002/10/30 12:51:35 alanh Exp $ */
-
-
-#include "mtypes.h"
-#include "framebuffer.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgaspan.h"
-#include "mgatex.h"
-#include "mgatris.h"
-#include "mgavb.h"
-#include "mga_xmesa.h"
-#include "utils.h"
-
-#define DRIVER_DATE "20050609"
-
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-
-static const GLubyte *mgaGetString( GLcontext *ctx, GLenum name )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- static char buffer[128];
- unsigned offset;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *) "VA Linux Systems Inc.";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer,
- MGA_IS_G400(mmesa) ? "G400" :
- MGA_IS_G200(mmesa) ? "G200" : "MGA",
- DRIVER_DATE,
- mmesa->mgaScreen->agpMode );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-
-static void mgaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE( mmesa );
- *width = mmesa->driDrawable->w;
- *height = mmesa->driDrawable->h;
- UNLOCK_HARDWARE( mmesa );
-}
-
-
-void mgaInitDriverFuncs( struct dd_function_table *functions )
-{
- functions->GetBufferSize = mgaBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = mgaGetString;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.h
deleted file mode 100644
index f98bfdc87..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgadd.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.h,v 1.3 2002/10/30 12:51:35 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-
-#ifndef MGADD_INC
-#define MGADD_INC
-
-#include "context.h"
-
-extern void mgaInitDriverFuncs( struct dd_function_table *functions );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.c
deleted file mode 100644
index df253d159..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.c
+++ /dev/null
@@ -1,743 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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.
- */
-
-/**
- * \file mgaioctl.c
- * MGA IOCTL related wrapper functions.
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-#include <errno.h>
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-#include "drm.h"
-#include "mga_drm.h"
-#include "mgacontext.h"
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgatex.h"
-#include "mgavb.h"
-#include "mgaioctl.h"
-#include "mgatris.h"
-
-#include "vblank.h"
-
-
-int
-mgaSetFence( mgaContextPtr mmesa, uint32_t * fence )
-{
- int ret = ENOSYS;
-
- if ( mmesa->driScreen->drmMinor >= 2 ) {
- ret = drmCommandWriteRead( mmesa->driScreen->fd, DRM_MGA_SET_FENCE,
- fence, sizeof( uint32_t ));
- if (ret) {
- fprintf(stderr, "drmMgaSetFence: %d\n", ret);
- exit(1);
- }
- }
-
- return ret;
-}
-
-
-int
-mgaWaitFence( mgaContextPtr mmesa, uint32_t fence, uint32_t * curr_fence )
-{
- int ret = ENOSYS;
-
- if ( mmesa->driScreen->drmMinor >= 2 ) {
- uint32_t temp = fence;
-
- ret = drmCommandWriteRead( mmesa->driScreen->fd,
- DRM_MGA_WAIT_FENCE,
- & temp, sizeof( uint32_t ));
- if (ret) {
- fprintf(stderr, "drmMgaSetFence: %d\n", ret);
- exit(1);
- }
-
- if ( curr_fence ) {
- *curr_fence = temp;
- }
- }
-
- return ret;
-}
-
-
-static void mga_iload_dma_ioctl(mgaContextPtr mmesa,
- unsigned long dest,
- int length)
-{
- drmBufPtr buf = mmesa->iload_buffer;
- drm_mga_iload_t iload;
- int ret, i;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "DRM_IOCTL_MGA_ILOAD idx %d dst %x length %d\n",
- buf->idx, (int) dest, length);
-
- if ( (length & MGA_ILOAD_MASK) != 0 ) {
- UNLOCK_HARDWARE( mmesa );
- fprintf( stderr, "%s: Invalid ILOAD datasize (%d), must be "
- "multiple of %u.\n", __FUNCTION__, length, MGA_ILOAD_ALIGN );
- exit( 1 );
- }
-
- iload.idx = buf->idx;
- iload.dstorg = dest;
- iload.length = length;
-
- i = 0;
- do {
- ret = drmCommandWrite( mmesa->driFd, DRM_MGA_ILOAD,
- &iload, sizeof(iload) );
- } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );
-
- if ( ret < 0 ) {
- printf("send iload retcode = %d\n", ret);
- exit(1);
- }
-
- mmesa->iload_buffer = 0;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "finished iload dma put\n");
-
-}
-
-drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa )
-{
- int idx = 0;
- int size = 0;
- drmDMAReq dma;
- int retcode;
- drmBufPtr buf;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "Getting dma buffer\n");
-
- dma.context = mmesa->hHWContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = MGA_BUFFER_SIZE;
- dma.request_list = &idx;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "drmDMA (get) ctx %d count %d size 0x%x\n",
- dma.context, dma.request_count,
- dma.request_size);
-
- while (1) {
- retcode = drmDMA(mmesa->driFd, &dma);
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "retcode %d sz %d idx %d count %d\n",
- retcode,
- dma.request_sizes[0],
- dma.request_list[0],
- dma.granted_count);
-
- if (retcode == 0 &&
- dma.request_sizes[0] &&
- dma.granted_count)
- break;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "\n\nflush");
-
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
- }
-
- buf = &(mmesa->mgaScreen->bufs->list[idx]);
- buf->used = 0;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr,
- "drmDMA (get) returns size[0] 0x%x idx[0] %d\n"
- "dma_buffer now: buf idx: %d size: %d used: %d addr %p\n",
- dma.request_sizes[0], dma.request_list[0],
- buf->idx, buf->total,
- buf->used, buf->address);
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "finished getbuffer\n");
-
- return buf;
-}
-
-
-
-
-static void
-mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- GLuint flags = 0;
- GLuint clear_color = mmesa->ClearColor;
- GLuint clear_depth = 0;
- GLuint color_mask = 0;
- GLuint depth_mask = 0;
- int ret;
- int i;
- static int nrclears;
- drm_mga_clear_t clear;
-
- FLUSH_BATCH( mmesa );
-
- if ( mask & BUFFER_BIT_FRONT_LEFT ) {
- flags |= MGA_FRONT;
- color_mask = mmesa->setup.plnwt;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ( mask & BUFFER_BIT_BACK_LEFT ) {
- flags |= MGA_BACK;
- color_mask = mmesa->setup.plnwt;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ( (mask & BUFFER_BIT_DEPTH) && ctx->Depth.Mask ) {
- flags |= MGA_DEPTH;
- clear_depth = (mmesa->ClearDepth & mmesa->depth_clear_mask);
- depth_mask |= mmesa->depth_clear_mask;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if ( (mask & BUFFER_BIT_STENCIL) && mmesa->hw_stencil ) {
- flags |= MGA_DEPTH;
- clear_depth |= (ctx->Stencil.Clear & mmesa->stencil_clear_mask);
- depth_mask |= mmesa->stencil_clear_mask;
- mask &= ~BUFFER_BIT_STENCIL;
- }
-
- if ( flags ) {
- LOCK_HARDWARE( mmesa );
-
- if ( mmesa->dirty_cliprects )
- mgaUpdateRects( mmesa, (MGA_FRONT | MGA_BACK) );
-
- /* flip top to bottom */
- cy = dPriv->h-cy-ch;
- cx += mmesa->drawX;
- cy += mmesa->drawY;
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL )
- fprintf( stderr, "Clear, bufs %x nbox %d\n",
- (int)flags, (int)mmesa->numClipRects );
-
- for (i = 0 ; i < mmesa->numClipRects ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, mmesa->numClipRects);
- drm_clip_rect_t *box = mmesa->pClipRects;
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- int n = 0;
-
- if (!all) {
- for ( ; i < nr ; i++) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++) {
- *b++ = box[i];
- n++;
- }
- }
-
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL )
- fprintf( stderr,
- "DRM_IOCTL_MGA_CLEAR flag 0x%x color %x depth %x nbox %d\n",
- flags, clear_color, clear_depth, mmesa->sarea->nbox );
-
- mmesa->sarea->nbox = n;
-
- clear.flags = flags;
- clear.clear_color = clear_color;
- clear.clear_depth = clear_depth;
- clear.color_mask = color_mask;
- clear.depth_mask = depth_mask;
- ret = drmCommandWrite( mmesa->driFd, DRM_MGA_CLEAR,
- &clear, sizeof(clear));
- if ( ret ) {
- fprintf( stderr, "send clear retcode = %d\n", ret );
- exit( 1 );
- }
- if ( MGA_DEBUG & DEBUG_VERBOSE_IOCTL )
- fprintf( stderr, "finished clear %d\n", ++nrclears );
- }
-
- UNLOCK_HARDWARE( mmesa );
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS|MGA_UPLOAD_CONTEXT;
- }
-
- if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-
-/**
- * Wait for the previous frame of rendering has completed.
- *
- * \param mmesa Hardware context pointer.
- *
- * \bug
- * The loop in this function should have some sort of a timeout mechanism.
- *
- * \warning
- * This routine used to assume that the hardware lock was held on entry. It
- * now assumes that the lock is \b not held on entry.
- */
-
-static void mgaWaitForFrameCompletion( mgaContextPtr mmesa )
-{
- if ( mgaWaitFence( mmesa, mmesa->last_frame_fence, NULL ) == ENOSYS ) {
- unsigned wait = 0;
- GLuint last_frame;
- GLuint last_wrap;
-
-
- LOCK_HARDWARE( mmesa );
- last_frame = mmesa->sarea->last_frame.head;
- last_wrap = mmesa->sarea->last_frame.wrap;
-
- /* The DMA routines in the kernel track a couple values in the SAREA
- * that we use here. The number of times that the primary DMA buffer
- * has "wrapped" around is tracked in last_wrap. In addition, the
- * wrap count and the buffer position at the end of the last frame are
- * stored in last_frame.wrap and last_frame.head.
- *
- * By comparing the wrap counts and the current DMA pointer value
- * (read directly from the hardware) to last_frame.head, we can
- * determine when the graphics processor has processed all of the
- * commands for the last frame.
- *
- * In this case "last frame" means the frame of the *previous* swap-
- * buffers call. This is done to prevent queuing a second buffer swap
- * before the previous swap is executed.
- */
- while ( 1 ) {
- if ( last_wrap < mmesa->sarea->last_wrap ||
- ( last_wrap == mmesa->sarea->last_wrap &&
- last_frame <= (MGA_READ( MGAREG_PRIMADDRESS ) -
- mmesa->primary_offset) ) ) {
- break;
- }
- if ( 0 ) {
- wait++;
- fprintf( stderr, " last: head=0x%06x wrap=%d\n",
- last_frame, last_wrap );
- fprintf( stderr, " head: head=0x%06lx wrap=%d\n",
- (long)(MGA_READ( MGAREG_PRIMADDRESS ) - mmesa->primary_offset),
- mmesa->sarea->last_wrap );
- }
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH );
-
- UNLOCK_HARDWARE( mmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( mmesa );
- }
- if ( wait )
- fprintf( stderr, "\n" );
-
- UNLOCK_HARDWARE( mmesa );
- }
-}
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- mgaContextPtr mmesa;
- drm_clip_rect_t *pbox;
- GLint nbox;
- GLint ret;
- GLint i;
- GLboolean missed_target;
-
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
-
- FLUSH_BATCH( mmesa );
-
- mgaWaitForFrameCompletion( mmesa );
- driWaitForVBlank( dPriv, & mmesa->vbl_seq, mmesa->vblank_flags,
- & missed_target );
- if ( missed_target ) {
- mmesa->swap_missed_count++;
- (void) (*dri_interface->getUST)( & mmesa->swap_missed_ust );
- }
- LOCK_HARDWARE( mmesa );
-
- /* Use the frontbuffer cliprects
- */
- if (mmesa->dirty_cliprects & MGA_FRONT)
- mgaUpdateRects( mmesa, MGA_FRONT );
-
-
- pbox = dPriv->pClipRects;
- nbox = dPriv->numClipRects;
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- drm_clip_rect_t *b = mmesa->sarea->boxes;
-
- mmesa->sarea->nbox = nr - i;
-
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
-
- if (0)
- fprintf(stderr, "DRM_IOCTL_MGA_SWAP\n");
-
- ret = drmCommandNone( mmesa->driFd, DRM_MGA_SWAP );
- if ( ret ) {
- printf("send swap retcode = %d\n", ret);
- exit(1);
- }
- }
-
- (void) mgaSetFence( mmesa, & mmesa->last_frame_fence );
- UNLOCK_HARDWARE( mmesa );
-
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
- mmesa->swap_count++;
- (void) (*dri_interface->getUST)( & mmesa->swap_ust );
-}
-
-
-/**
- * Implement the hardware-specific portion of \c glFinish.
- *
- * Flushes all pending commands to the hardware and wait for them to finish.
- *
- * \param ctx Context where the \c glFinish command was issued.
- *
- * \sa glFinish, mgaFlush, mgaFlushDMA
- */
-static void mgaFinish( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- uint32_t fence;
-
-
- LOCK_HARDWARE( mmesa );
- if ( mmesa->vertex_dma_buffer != NULL ) {
- mgaFlushVerticesLocked( mmesa );
- }
-
- if ( mgaSetFence( mmesa, & fence ) == 0 ) {
- UNLOCK_HARDWARE( mmesa );
- (void) mgaWaitFence( mmesa, fence, NULL );
- }
- else {
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) {
- fprintf(stderr, "mgaRegetLockQuiescent\n");
- }
-
- UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH );
- UNLOCK_HARDWARE( mmesa );
- }
-}
-
-
-/**
- * Flush all commands upto at least a certain point to the hardware.
- *
- * \note
- * The term "wait" in the name of this function is misleading. It doesn't
- * actually wait for anything. It just makes sure that the commands have
- * been flushed to the hardware.
- *
- * \warning
- * As the name implies, this function assumes that the hardware lock is
- * held on entry.
- */
-void mgaWaitAgeLocked( mgaContextPtr mmesa, int age )
-{
- if (GET_DISPATCH_AGE(mmesa) < age) {
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH );
- }
-}
-
-
-static GLboolean intersect_rect( drm_clip_rect_t *out,
- const drm_clip_rect_t *a,
- const drm_clip_rect_t *b )
-{
- *out = *a;
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (b->y2 < out->y2) out->y2 = b->y2;
-
- return ((out->x1 < out->x2) && (out->y1 < out->y2));
-}
-
-
-
-
-static void age_mmesa( mgaContextPtr mmesa, int age )
-{
- if (mmesa->CurrentTexObj[0]) mmesa->CurrentTexObj[0]->age = age;
- if (mmesa->CurrentTexObj[1]) mmesa->CurrentTexObj[1]->age = age;
-}
-
-
-void mgaFlushVerticesLocked( mgaContextPtr mmesa )
-{
- drm_clip_rect_t *pbox = mmesa->pClipRects;
- int nbox = mmesa->numClipRects;
- drmBufPtr buffer = mmesa->vertex_dma_buffer;
- drm_mga_vertex_t vertex;
- int i;
-
- mmesa->vertex_dma_buffer = 0;
-
- if (!buffer)
- return;
-
- if (mmesa->dirty_cliprects & mmesa->draw_buffer)
- mgaUpdateRects( mmesa, mmesa->draw_buffer );
-
- if (mmesa->dirty & ~MGA_UPLOAD_CLIPRECTS)
- mgaEmitHwStateLocked( mmesa );
-
- /* FIXME: Workaround bug in kernel module.
- */
- mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT;
-
- if (!nbox)
- buffer->used = 0;
-
- if (nbox >= MGA_NR_SAREA_CLIPRECTS)
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
-
-#if 0
- if (!buffer->used || !(mmesa->dirty & MGA_UPLOAD_CLIPRECTS))
- {
- if (nbox == 1)
- mmesa->sarea->nbox = 0;
- else
- mmesa->sarea->nbox = nbox;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "Firing vertex -- case a nbox %d\n", nbox);
-
- vertex.idx = buffer->idx;
- vertex.used = buffer->used;
- vertex.discard = 1;
- drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX,
- &vertex, sizeof(drmMGAVertex) );
-
- age_mmesa(mmesa, mmesa->sarea->last_enqueue);
- }
- else
-#endif
- {
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, nbox);
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- int discard = 0;
-
- if (mmesa->scissor) {
- mmesa->sarea->nbox = 0;
-
- for ( ; i < nr ; i++) {
- *b = pbox[i];
- if (intersect_rect(b, b, &mmesa->scissor_rect)) {
- mmesa->sarea->nbox++;
- b++;
- }
- }
-
- /* Culled?
- */
- if (!mmesa->sarea->nbox) {
- if (nr < nbox) continue;
- buffer->used = 0;
- }
- } else {
- mmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
- }
-
- /* Finished with the buffer?
- */
- if (nr == nbox)
- discard = 1;
-
- mmesa->sarea->dirty |= MGA_UPLOAD_CLIPRECTS;
-
- vertex.idx = buffer->idx;
- vertex.used = buffer->used;
- vertex.discard = discard;
- drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX,
- &vertex, sizeof(vertex) );
-
- age_mmesa(mmesa, mmesa->sarea->last_enqueue);
- }
- }
-
- mmesa->dirty &= ~MGA_UPLOAD_CLIPRECTS;
-}
-
-void mgaFlushVertices( mgaContextPtr mmesa )
-{
- LOCK_HARDWARE( mmesa );
- mgaFlushVerticesLocked( mmesa );
- UNLOCK_HARDWARE( mmesa );
-}
-
-
-void mgaFireILoadLocked( mgaContextPtr mmesa,
- GLuint offset, GLuint length )
-{
- if (!mmesa->iload_buffer) {
- fprintf(stderr, "mgaFireILoad: no buffer\n");
- return;
- }
-
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "mgaFireILoad idx %d ofs 0x%x length %d\n",
- mmesa->iload_buffer->idx, (int)offset, (int)length );
-
- mga_iload_dma_ioctl( mmesa, offset, length );
-}
-
-void mgaGetILoadBufferLocked( mgaContextPtr mmesa )
-{
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)
- fprintf(stderr, "mgaGetIloadBuffer (buffer now %p)\n",
- (void *) mmesa->iload_buffer);
-
- mmesa->iload_buffer = mga_get_buffer_ioctl( mmesa );
-}
-
-
-/**
- * Implement the hardware-specific portion of \c glFlush.
- *
- * \param ctx Context to be flushed.
- *
- * \sa glFlush, mgaFinish, mgaFlushDMA
- */
-static void mgaFlush( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
-
- LOCK_HARDWARE( mmesa );
- if ( mmesa->vertex_dma_buffer != NULL ) {
- mgaFlushVerticesLocked( mmesa );
- }
-
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH );
- UNLOCK_HARDWARE( mmesa );
-}
-
-
-int mgaFlushDMA( int fd, drmLockFlags flags )
-{
- drm_lock_t lock;
- int ret, i = 0;
-
- memset( &lock, 0, sizeof(lock) );
-
- lock.flags = flags & (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH
- | DRM_LOCK_FLUSH_ALL);
-
- do {
- ret = drmCommandWrite( fd, DRM_MGA_FLUSH, &lock, sizeof(lock) );
- } while ( ret && errno == EBUSY && i++ < DRM_MGA_IDLE_RETRY );
-
- if ( ret == 0 )
- return 0;
- if ( errno != EBUSY )
- return -errno;
-
- if ( lock.flags & DRM_LOCK_QUIESCENT ) {
- /* Only keep trying if we need quiescence.
- */
- lock.flags &= ~(DRM_LOCK_FLUSH | DRM_LOCK_FLUSH_ALL);
-
- do {
- ret = drmCommandWrite( fd, DRM_MGA_FLUSH, &lock, sizeof(lock) );
- } while ( ret && errno == EBUSY && i++ < DRM_MGA_IDLE_RETRY );
- }
-
- if ( ret == 0 ) {
- return 0;
- } else {
- return -errno;
- }
-}
-
-void mgaInitIoctlFuncs( struct dd_function_table *functions )
-{
- functions->Clear = mgaClear;
- functions->Flush = mgaFlush;
- functions->Finish = mgaFinish;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.h
deleted file mode 100644
index f3ae749ca..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaioctl.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.h,v 1.11 2002/10/30 12:51:36 alanh Exp $ */
-
-#ifndef MGA_IOCTL_H
-#define MGA_IOCTL_H
-
-#include "mgacontext.h"
-#include "mga_xmesa.h"
-
-void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv );
-void mgaWaitForVBlank( mgaContextPtr mmesa );
-
-void mgaGetILoadBufferLocked( mgaContextPtr mmesa );
-void mgaFireILoadLocked( mgaContextPtr mmesa,
- GLuint offset, GLuint length );
-
-void mgaWaitAgeLocked( mgaContextPtr mmesa, int age );
-
-void mgaFlushVertices( mgaContextPtr mmesa );
-void mgaFlushVerticesLocked( mgaContextPtr mmesa );
-int mgaFlushDMA( int fd, drmLockFlags flags );
-
-void mgaInitIoctlFuncs( struct dd_function_table *functions );
-
-#define FLUSH_BATCH(mmesa) do { \
- if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) \
- fprintf(stderr, "FLUSH_BATCH in %s\n", __FUNCTION__); \
- if (mmesa->vertex_dma_buffer) mgaFlushVertices(mmesa); \
-} while (0)
-
-#define MGA_STATECHANGE(mmesa, flag) do { \
- FLUSH_BATCH(mmesa); \
- mmesa->dirty |= flag; \
-} while (0)
-
-
-extern drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa );
-
-static __inline
-GLuint *mgaAllocDmaLow( mgaContextPtr mmesa, int bytes )
-{
- GLuint *head;
-
- /* If there is no DMA buffer currently allocated or the currently
- * allocated DMA buffer doesn't have enough room left for this request,
- * a new buffer will need to be allocated.
- */
- if ( (mmesa->vertex_dma_buffer == NULL)
- || ((mmesa->vertex_dma_buffer->used + bytes)
- > mmesa->vertex_dma_buffer->total) ) {
- LOCK_HARDWARE( mmesa );
-
- /* In the case where the existing buffer does not have enough room,
- * we need to flush it out to the hardware.
- */
- if ( mmesa->vertex_dma_buffer != NULL ) {
- mgaFlushVerticesLocked( mmesa );
- }
-
- mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa );
- UNLOCK_HARDWARE( mmesa );
- }
-
- head = (GLuint *)((char *)mmesa->vertex_dma_buffer->address +
- mmesa->vertex_dma_buffer->used);
-
- mmesa->vertex_dma_buffer->used += bytes;
- return head;
-}
-
-
-#define UPDATE_LOCK( mmesa, flags ) \
-do { \
- GLint ret = mgaFlushDMA( mmesa->driFd, flags ); \
- if ( ret < 0 ) { \
- drmCommandNone( mmesa->driFd, DRM_MGA_RESET ); \
- UNLOCK_HARDWARE( mmesa ); \
- fprintf( stderr, "%s: flush return = %s (%d), flags = 0x%08x\n", \
- __FUNCTION__, strerror( -ret ), -ret, \
- (unsigned)(flags) ); \
- exit( 1 ); \
- } \
-} while (0)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.c
deleted file mode 100644
index 952b8d563..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
- * Copyright 2000 Compaq Computer Inc. and VA Linux Systems, 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
- * on 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
- * 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.
- */
-
-/**
- * \file mgapixel.c
- * Implement framebuffer pixel operations for MGA.
- *
- * \todo
- * Someday the accelerated \c glReadPixels and \c glDrawPixels paths need to
- * be resurrected. They are currently ifdef'ed out because they don't seem
- * to work and they only get activated some very rare circumstances.
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.9 2002/11/05 17:46:08 tsi Exp $ */
-
-#include "mtypes.h"
-#include "macros.h"
-#include "mgadd.h"
-#include "mgacontext.h"
-#include "mgaioctl.h"
-#include "mgapixel.h"
-#include "mgastate.h"
-
-#include "swrast/swrast.h"
-#include "imports.h"
-
-#if 0
-#define IS_AGP_MEM( mmesa, p ) \
- ((unsigned long)mmesa->mgaScreen->buffers.map <= ((unsigned long)p) && \
- (unsigned long)mmesa->mgaScreen->buffers.map + \
- (unsigned long)mmesa->mgaScreen->buffers.size > ((unsigned long)p))
-#define AGP_OFFSET( mmesa, p ) \
- (((unsigned long)p) - (unsigned long)mmesa->mgaScreen->buffers.map)
-
-
-#if defined(MESA_packed_depth_stencil)
-static GLboolean
-check_depth_stencil_24_8( const GLcontext *ctx, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz,
- GLint pitch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- return ( type == GL_UNSIGNED_INT_24_8_MESA &&
- ctx->Visual->DepthBits == 24 &&
- ctx->Visual->StencilBits == 8 &&
- mmesa->mgaScreen->cpp == 4 &&
- mmesa->hw_stencil &&
- !ctx->Pixel.IndexShift &&
- !ctx->Pixel.IndexOffset &&
- !ctx->Pixel.MapStencilFlag &&
- ctx->Pixel.DepthBias == 0.0 &&
- ctx->Pixel.DepthScale == 1.0 &&
- !packing->SwapBytes &&
- pitch % 32 == 0 &&
- pitch < 4096 );
-}
-#endif
-
-
-static GLboolean
-check_depth( const GLcontext *ctx, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if ( IS_AGP_MEM( mmesa, pixels ) &&
- !( ( type == GL_UNSIGNED_INT && mmesa->mgaScreen->cpp == 4 ) ||
- ( type == GL_UNSIGNED_SHORT && mmesa->mgaScreen->cpp == 2 ) ) )
- return GL_FALSE;
-
- return ( ctx->Pixel.DepthBias == 0.0 &&
- ctx->Pixel.DepthScale == 1.0 &&
- !packing->SwapBytes &&
- pitch % 32 == 0 &&
- pitch < 4096 );
-}
-
-
-static GLboolean
-check_color( const GLcontext *ctx, GLenum type, GLenum format,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint cpp = mmesa->mgaScreen->cpp;
-
- /* Can't do conversions on agp reads/draws.
- */
- if ( IS_AGP_MEM( mmesa, pixels ) &&
- !( pitch % 32 == 0 && pitch < 4096 &&
- ( ( type == GL_UNSIGNED_BYTE &&
- cpp == 4 && format == GL_BGRA ) ||
- ( type == GL_UNSIGNED_INT_8_8_8_8 &&
- cpp == 4 && format == GL_BGRA ) ||
- ( type == GL_UNSIGNED_SHORT_5_6_5_REV &&
- cpp == 2 && format == GL_RGB ) ) ) )
- return GL_FALSE;
-
- return (!ctx->_ImageTransferState &&
- !packing->SwapBytes &&
- !packing->LsbFirst);
-}
-
-static GLboolean
-check_color_per_fragment_ops( const GLcontext *ctx )
-{
- return (!( ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest
- ) &&
- ctx->Current.RasterPosValid &&
- ctx->Pixel.ZoomX == 1.0F &&
- (ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F));
-}
-
-static GLboolean
-check_depth_per_fragment_ops( const GLcontext *ctx )
-{
- return ( ctx->Current.RasterPosValid &&
- ctx->Color.ColorMask[RCOMP] == 0 &&
- ctx->Color.ColorMask[BCOMP] == 0 &&
- ctx->Color.ColorMask[GCOMP] == 0 &&
- ctx->Color.ColorMask[ACOMP] == 0 &&
- ctx->Pixel.ZoomX == 1.0F &&
- ( ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F ) );
-}
-
-/* In addition to the requirements for depth:
- */
-#if defined(MESA_packed_depth_stencil)
-static GLboolean
-check_stencil_per_fragment_ops( const GLcontext *ctx )
-{
- return ( !ctx->Pixel.IndexShift &&
- !ctx->Pixel.IndexOffset );
-}
-#endif
-
-
-static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height,
- GLint *skipPixels, GLint *skipRows,
- GLint *size )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- *width = MIN2(*width, MAX_WIDTH); /* redundant? */
-
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *skipPixels += (buffer->_Xmin - *x);
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *skipRows += (buffer->_Ymin - *y);
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- *size = ((*y + *height - 1) * mmesa->mgaScreen->frontPitch +
- (*x + *width - 1) * mmesa->mgaScreen->cpp);
-
- return GL_TRUE;
-}
-
-static GLboolean
-mgaTryReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLint size, skipPixels, skipRows;
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- GLboolean ok;
-
- GLuint planemask;
- GLuint source;
-#if 0
- drmMGABlit blit;
- GLuint dest;
- GLint source_pitch, dest_pitch;
- GLint delta_sx, delta_sy;
- GLint delta_dx, delta_dy;
- GLint blit_height, ydir;
-#endif
-
- if (!clip_pixelrect(ctx, ctx->ReadBuffer,
- &x, &y, &width, &height,
- &skipPixels, &skipRows, &size)) {
- return GL_TRUE;
- }
-
- /* Only accelerate reading to agp buffers.
- */
- if ( !IS_AGP_MEM(mmesa, (char *)pixels) ||
- !IS_AGP_MEM(mmesa, (char *)pixels + size) )
- return GL_FALSE;
-
- switch (format) {
-#if defined(MESA_packed_depth_stencil)
- case GL_DEPTH_STENCIL_MESA:
- ok = check_depth_stencil_24_8(ctx, type, pack, pixels, size, pitch);
- planemask = ~0;
- source = mmesa->mgaScreen->depthOffset;
- break;
-#endif
-
- case GL_DEPTH_COMPONENT:
- ok = check_depth(ctx, type, pack, pixels, size, pitch);
-
- /* Can't accelerate at this depth -- planemask does the wrong
- * thing; it doesn't clear the low order bits in the
- * destination, instead it leaves them untouched.
- *
- * Could get the acclerator to solid fill the destination with
- * zeros first... Or get the cpu to do it...
- */
- if (ctx->Visual.depthBits == 24)
- return GL_FALSE;
-
- planemask = ~0;
- source = mmesa->mgaScreen->depthOffset;
- break;
-
- case GL_RGB:
- case GL_BGRA:
- ok = check_color(ctx, type, format, pack, pixels, size, pitch);
- planemask = ~0;
- source = (mmesa->draw_buffer == MGA_FRONT ?
- mmesa->mgaScreen->frontOffset :
- mmesa->mgaScreen->backOffset);
- break;
-
- default:
- return GL_FALSE;
- }
-
- if (!ok) {
- return GL_FALSE;
- }
-
-
- LOCK_HARDWARE( mmesa );
-
-#if 0
- {
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- int nbox, retcode, i;
-
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
-
- if (mmesa->dirty_cliprects & MGA_FRONT)
- mgaUpdateRects( mmesa, MGA_FRONT );
-
- nbox = dPriv->numClipRects;
-
- y = dPriv->h - y - height;
- x += mmesa->drawX;
- y += mmesa->drawY;
-
- dest = ((mmesa->mgaScreen->agp.handle + AGP_OFFSET(mmesa, pixels)) |
- DO_dstmap_sys | DO_dstacc_agp);
- source_pitch = mmesa->mgaScreen->frontPitch / mmesa->mgaScreen->cpp;
- dest_pitch = pitch;
- delta_sx = 0;
- delta_sy = 0;
- delta_dx = -x;
- delta_dy = -y;
- blit_height = 2*y + height;
- ydir = -1;
-
- if (0) fprintf(stderr, "XX doing readpixel blit src_pitch %d dst_pitch %d\n",
- source_pitch, dest_pitch);
-
-
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- int n = 0;
-
- for ( ; i < nr ; i++) {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- b->x1 = bx;
- b->y1 = by;
- b->x2 = bx + bw;
- b->y2 = by + bh;
- b++;
- n++;
- }
-
- mmesa->sarea->nbox = n;
-
- if (n && (retcode = drmCommandWrite( mmesa->driFd, DRM_MGA_BLIT,
- &blit, sizeof(drmMGABlit)))) {
- fprintf(stderr, "blit ioctl failed, retcode = %d\n", retcode);
- UNLOCK_HARDWARE( mmesa );
- exit(1);
- }
- }
-
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
- }
-#endif
-
- UNLOCK_HARDWARE( mmesa );
-
- return GL_TRUE;
-}
-
-static void
-mgaDDReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (!mgaTryReadPixels( ctx, x, y, width, height, format, type, pack, pixels))
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack, pixels);
-}
-
-
-
-
-static void do_draw_pix( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint pitch,
- const void *pixels,
- GLuint dest, GLuint planemask)
-{
-#if 0
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- drmMGABlit blit;
- __DRIdrawablePrivate *dPriv = mmesa->driDrawable;
- drm_clip_rect_t pbox = dPriv->pClipRects;
- int nbox = dPriv->numClipRects;
- int retcode, i;
-
- y = dPriv->h - y - height;
- x += mmesa->drawX;
- y += mmesa->drawY;
-
- blit.dest = dest;
- blit.planemask = planemask;
- blit.source = ((mmesa->mgaScreen->agp.handle + AGP_OFFSET(mmesa, pixels))
- | SO_srcmap_sys | SO_srcacc_agp);
- blit.dest_pitch = mmesa->mgaScreen->frontPitch / mmesa->mgaScreen->cpp;
- blit.source_pitch = pitch;
- blit.delta_sx = -x;
- blit.delta_sy = -y;
- blit.delta_dx = 0;
- blit.delta_dy = 0;
- if (ctx->Pixel.ZoomY == -1) {
- blit.height = height;
- blit.ydir = 1;
- } else {
- blit.height = height;
- blit.ydir = -1;
- }
-
- if (0) fprintf(stderr,
- "doing drawpixel blit src_pitch %d dst_pitch %d\n",
- blit.source_pitch, blit.dest_pitch);
-
- for (i = 0 ; i < nbox ; )
- {
- int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, dPriv->numClipRects);
- drm_clip_rect_t *box = mmesa->pClipRects;
- drm_clip_rect_t *b = mmesa->sarea->boxes;
- int n = 0;
-
- for ( ; i < nr ; i++) {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- b->x1 = bx;
- b->y1 = by;
- b->x2 = bx + bw;
- b->y2 = by + bh;
- b++;
- n++;
- }
-
- mmesa->sarea->nbox = n;
-
- if (n && (retcode = drmCommandWrite( mmesa->driFd, DRM_MGA_BLIT,
- &blit, sizeof(drmMGABlit)))) {
- fprintf(stderr, "blit ioctl failed, retcode = %d\n", retcode);
- UNLOCK_HARDWARE( mmesa );
- exit(1);
- }
- }
-#endif
-}
-
-
-
-
-static GLboolean
-mgaTryDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLint size, skipPixels, skipRows;
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint dest, planemask;
- GLuint cpp = mmesa->mgaScreen->cpp;
-
- if (!clip_pixelrect(ctx, ctx->DrawBuffer,
- &x, &y, &width, &height,
- &skipPixels, &skipRows, &size)) {
- return GL_TRUE;
- }
-
-
- switch (format) {
-#if defined(MESA_packed_depth_stencil)
- case GL_DEPTH_STENCIL_MESA:
- dest = mmesa->mgaScreen->depthOffset;
- planemask = ~0;
- if (!check_depth_stencil_24_8(ctx, type, unpack, pixels, size, pitch) ||
- !check_depth_per_fragment_ops(ctx) ||
- !check_stencil_per_fragment_ops(ctx))
- return GL_FALSE;
- break;
-#endif
-
- case GL_DEPTH_COMPONENT:
- dest = mmesa->mgaScreen->depthOffset;
-
- if (ctx->Visual.depthBits == 24)
- planemask = ~0xff;
- else
- planemask = ~0;
-
- if (!check_depth(ctx, type, unpack, pixels, size, pitch) ||
- !check_depth_per_fragment_ops(ctx))
- return GL_FALSE;
- break;
-
- case GL_RGB:
- case GL_BGRA:
- dest = (mmesa->draw_buffer == MGA_FRONT ?
- mmesa->mgaScreen->frontOffset :
- mmesa->mgaScreen->backOffset);
-
- planemask = mgaPackColor(cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- if (cpp == 2)
- planemask |= planemask << 16;
-
- if (!check_color(ctx, type, format, unpack, pixels, size, pitch)) {
- return GL_FALSE;
- }
- if (!check_color_per_fragment_ops(ctx)) {
- return GL_FALSE;
- }
- break;
-
- default:
- return GL_FALSE;
- }
-
- LOCK_HARDWARE_QUIESCENT( mmesa );
-
- if (mmesa->dirty_cliprects & MGA_FRONT)
- mgaUpdateRects( mmesa, MGA_FRONT );
-
- if ( IS_AGP_MEM(mmesa, (char *)pixels) &&
- IS_AGP_MEM(mmesa, (char *)pixels + size) )
- {
- do_draw_pix( ctx, x, y, width, height, pitch, pixels,
- dest, planemask );
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
- }
- else
- {
- /* Pixels is in regular memory -- get dma buffers and perform
- * upload through them.
- */
-/* drmBufPtr buf = mgaGetBufferLocked(mmesa); */
- GLuint bufferpitch = (width*cpp+31)&~31;
-
- char *address = 0; /* mmesa->mgaScreen->agp.map; */
-
- do {
-/* GLuint rows = MIN2( height, MGA_DMA_BUF_SZ / bufferpitch ); */
- GLuint rows = height;
-
-
- if (0) fprintf(stderr, "trying to upload %d rows (pitch %d)\n",
- rows, bufferpitch);
-
- /* The texture conversion code is so slow that there is only
- * negligble speedup when the buffers/images don't exactly
- * match:
- */
-#if 0
- if (cpp == 2) {
- if (!_mesa_convert_texsubimage2d( MESA_FORMAT_RGB565,
- 0, 0, width, rows,
- bufferpitch, format, type,
- unpack, pixels, address )) {
-/* mgaReleaseBufLocked( mmesa, buf ); */
- UNLOCK_HARDWARE(mmesa);
- return GL_FALSE;
- }
- } else {
- if (!_mesa_convert_texsubimage2d( MESA_FORMAT_ARGB8888,
- 0, 0, width, rows,
- bufferpitch, format, type,
- unpack, pixels, address )) {
-/* mgaReleaseBufLocked( mmesa, buf ); */
- UNLOCK_HARDWARE(mmesa);
- return GL_FALSE;
- }
- }
-#else
- MEMCPY( address, pixels, rows*bufferpitch );
-#endif
-
- do_draw_pix( ctx, x, y, width, rows,
- bufferpitch/cpp, address, dest, planemask );
-
- /* Fix me -- use multiple buffers to avoid flush.
- */
- UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT );
-
- pixels = (void *)((char *) pixels + rows * pitch);
- height -= rows;
- y += rows;
- } while (height);
-
-/* mgaReleaseBufLocked( mmesa, buf ); */
- }
-
- UNLOCK_HARDWARE( mmesa );
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
-
- return GL_TRUE;
-}
-
-static void
-mgaDDDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (!mgaTryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-#endif
-
-
-/* Stub functions - not a real allocator, always returns pointer to
- * the same block of agp space which isn't used for anything else at
- * present.
- */
-void mgaDDInitPixelFuncs( GLcontext *ctx )
-{
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
-#if 0
- if (getenv("MGA_BLIT_PIXELS")) {
- ctx->Driver.ReadPixels = mgaDDReadPixels; /* requires agp dest */
- ctx->Driver.DrawPixels = mgaDDDrawPixels; /* works with agp/normal mem */
- }
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.h
deleted file mode 100644
index c44fd769a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgapixel.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2001 Compaq Computer Inc. VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.h,v 1.5 2002/10/30 12:51:36 alanh Exp $ */
-
-#ifndef MGA_PIXELS_H
-#define MGA_PIXELS_H
-
-#include "mtypes.h"
-
-extern void mgaDDInitPixelFuncs( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaregs.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaregs.h
deleted file mode 100644
index e1291ca01..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaregs.h
+++ /dev/null
@@ -1,1395 +0,0 @@
-/* author: stephen crowley, crow@debian.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
- * STEPHEN CROWLEY, 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaregs.h,v 1.6 2003/01/12 03:55:46 tsi Exp $ */
-
-#ifndef _MGAREGS_H_
-#define _MGAREGS_H_
-
-/*************** (START) AUTOMATICLY GENERATED REGISTER FILE *****************/
-/*
- * Generated on Wed Jan 26 13:44:46 MST 2000
- */
-
-
-
-/*
- * Power Graphic Mode Memory Space Registers
- */
-
-#define MGAREG_MGA_EXEC 0x0100
-#define MGAREG_AGP_PLL 0x1e4c
-
-# define AGP_PLL_agp2xpllen_MASK 0xfffffffe /* bit 0 */
-# define AGP_PLL_agp2xpllen_disable 0x0
-# define AGP_PLL_agp2xpllen_enable 0x1
-
-#define MGAREG_CFG_OR 0x1e4c
-
-# define CFG_OR_comp_or_MASK 0xfffffff7 /* bit 3 */
-# define CFG_OR_comp_or_disable 0x0
-# define CFG_OR_comp_or_enable 0x8
-# define CFG_OR_compfreq_MASK 0xffffff0f /* bits 4-7 */
-# define CFG_OR_compfreq_SHIFT 4
-# define CFG_OR_comporup_MASK 0xfffff0ff /* bits 8-11 */
-# define CFG_OR_comporup_SHIFT 8
-# define CFG_OR_compordn_MASK 0xffff0fff /* bits 12-15 */
-# define CFG_OR_compordn_SHIFT 12
-# define CFG_OR_e2pq_MASK 0xfffeffff /* bit 16 */
-# define CFG_OR_e2pq_disable 0x0
-# define CFG_OR_e2pq_enable 0x10000
-# define CFG_OR_e2pqbypcsn_MASK 0xfffdffff /* bit 17 */
-# define CFG_OR_e2pqbypcsn_disable 0x0
-# define CFG_OR_e2pqbypcsn_enable 0x20000
-# define CFG_OR_e2pqbypd_MASK 0xfffbffff /* bit 18 */
-# define CFG_OR_e2pqbypd_disable 0x0
-# define CFG_OR_e2pqbypd_enable 0x40000
-# define CFG_OR_e2pbypclk_MASK 0xfff7ffff /* bit 19 */
-# define CFG_OR_e2pbypclk_disable 0x0
-# define CFG_OR_e2pbypclk_enable 0x80000
-# define CFG_OR_e2pbyp_MASK 0xffefffff /* bit 20 */
-# define CFG_OR_e2pbyp_disable 0x0
-# define CFG_OR_e2pbyp_enable 0x100000
-# define CFG_OR_rate_cap_or_MASK 0xff1fffff /* bits 21-23 */
-# define CFG_OR_rate_cap_or_SHIFT 21
-# define CFG_OR_rq_or_MASK 0xe0ffffff /* bits 24-28 */
-# define CFG_OR_rq_or_SHIFT 24
-
-#define MGAREG_ALPHACTRL 0x2c7c
-
-# define AC_src_MASK 0xfffffff0 /* bits 0-3 */
-# define AC_src_zero 0x0 /* val 0, shift 0 */
-# define AC_src_one 0x1 /* val 1, shift 0 */
-# define AC_src_dst_color 0x2 /* val 2, shift 0 */
-# define AC_src_om_dst_color 0x3 /* val 3, shift 0 */
-# define AC_src_src_alpha 0x4 /* val 4, shift 0 */
-# define AC_src_om_src_alpha 0x5 /* val 5, shift 0 */
-# define AC_src_dst_alpha 0x6 /* val 6, shift 0 */
-# define AC_src_om_dst_alpha 0x7 /* val 7, shift 0 */
-# define AC_src_src_alpha_sat 0x8 /* val 8, shift 0 */
-# define AC_dst_MASK 0xffffff0f /* bits 4-7 */
-# define AC_dst_zero 0x0 /* val 0, shift 4 */
-# define AC_dst_one 0x10 /* val 1, shift 4 */
-# define AC_dst_src_color 0x20 /* val 2, shift 4 */
-# define AC_dst_om_src_color 0x30 /* val 3, shift 4 */
-# define AC_dst_src_alpha 0x40 /* val 4, shift 4 */
-# define AC_dst_om_src_alpha 0x50 /* val 5, shift 4 */
-# define AC_dst_dst_alpha 0x60 /* val 6, shift 4 */
-# define AC_dst_om_dst_alpha 0x70 /* val 7, shift 4 */
-# define AC_amode_MASK 0xfffffcff /* bits 8-9 */
-# define AC_amode_FCOL 0x0 /* val 0, shift 8 */
-# define AC_amode_alpha_channel 0x100 /* val 1, shift 8 */
-# define AC_amode_video_alpha 0x200 /* val 2, shift 8 */
-# define AC_amode_RSVD 0x300 /* val 3, shift 8 */
-# define AC_astipple_MASK 0xfffff7ff /* bit 11 */
-# define AC_astipple_disable 0x0
-# define AC_astipple_enable 0x800
-# define AC_aten_MASK 0xffffefff /* bit 12 */
-# define AC_aten_disable 0x0
-# define AC_aten_enable 0x1000
-# define AC_atmode_MASK 0xffff1fff /* bits 13-15 */
-# define AC_atmode_noacmp 0x0 /* val 0, shift 13 */
-# define AC_atmode_ae 0x4000 /* val 2, shift 13 */
-# define AC_atmode_ane 0x6000 /* val 3, shift 13 */
-# define AC_atmode_alt 0x8000 /* val 4, shift 13 */
-# define AC_atmode_alte 0xa000 /* val 5, shift 13 */
-# define AC_atmode_agt 0xc000 /* val 6, shift 13 */
-# define AC_atmode_agte 0xe000 /* val 7, shift 13 */
-# define AC_atref_MASK 0xff00ffff /* bits 16-23 */
-# define AC_atref_SHIFT 16
-# define AC_alphasel_MASK 0xfcffffff /* bits 24-25 */
-# define AC_alphasel_fromtex 0x0 /* val 0, shift 24 */
-# define AC_alphasel_diffused 0x1000000 /* val 1, shift 24 */
-# define AC_alphasel_modulated 0x2000000 /* val 2, shift 24 */
-# define AC_alphasel_trans 0x3000000 /* val 3, shift 24 */
-
-#define MGAREG_ALPHASTART 0x2c70
-#define MGAREG_ALPHAXINC 0x2c74
-#define MGAREG_ALPHAYINC 0x2c78
-#define MGAREG_AR0 0x1c60
-
-# define AR0_ar0_MASK 0xfffc0000 /* bits 0-17 */
-# define AR0_ar0_SHIFT 0
-
-#define MGAREG_AR1 0x1c64
-
-# define AR1_ar1_MASK 0xff000000 /* bits 0-23 */
-# define AR1_ar1_SHIFT 0
-
-#define MGAREG_AR2 0x1c68
-
-# define AR2_ar2_MASK 0xfffc0000 /* bits 0-17 */
-# define AR2_ar2_SHIFT 0
-
-#define MGAREG_AR3 0x1c6c
-
-# define AR3_ar3_MASK 0xff000000 /* bits 0-23 */
-# define AR3_ar3_SHIFT 0
-# define AR3_spage_MASK 0xf8ffffff /* bits 24-26 */
-# define AR3_spage_SHIFT 24
-
-#define MGAREG_AR4 0x1c70
-
-# define AR4_ar4_MASK 0xfffc0000 /* bits 0-17 */
-# define AR4_ar4_SHIFT 0
-
-#define MGAREG_AR5 0x1c74
-
-# define AR5_ar5_MASK 0xfffc0000 /* bits 0-17 */
-# define AR5_ar5_SHIFT 0
-
-#define MGAREG_AR6 0x1c78
-
-# define AR6_ar6_MASK 0xfffc0000 /* bits 0-17 */
-# define AR6_ar6_SHIFT 0
-
-#define MGAREG_BCOL 0x1c20
-#define MGAREG_BESA1CORG 0x3d10
-#define MGAREG_BESA1ORG 0x3d00
-#define MGAREG_BESA2CORG 0x3d14
-#define MGAREG_BESA2ORG 0x3d04
-#define MGAREG_BESB1CORG 0x3d18
-#define MGAREG_BESB1ORG 0x3d08
-#define MGAREG_BESB2CORG 0x3d1c
-#define MGAREG_BESB2ORG 0x3d0c
-#define MGAREG_BESCTL 0x3d20
-
-# define BC_besen_MASK 0xfffffffe /* bit 0 */
-# define BC_besen_disable 0x0
-# define BC_besen_enable 0x1
-# define BC_besv1srcstp_MASK 0xffffffbf /* bit 6 */
-# define BC_besv1srcstp_even 0x0
-# define BC_besv1srcstp_odd 0x40
-# define BC_besv2srcstp_MASK 0xfffffeff /* bit 8 */
-# define BC_besv2srcstp_disable 0x0
-# define BC_besv2srcstp_enable 0x100
-# define BC_beshfen_MASK 0xfffffbff /* bit 10 */
-# define BC_beshfen_disable 0x0
-# define BC_beshfen_enable 0x400
-# define BC_besvfen_MASK 0xfffff7ff /* bit 11 */
-# define BC_besvfen_disable 0x0
-# define BC_besvfen_enable 0x800
-# define BC_beshfixc_MASK 0xffffefff /* bit 12 */
-# define BC_beshfixc_weight 0x0
-# define BC_beshfixc_coeff 0x1000
-# define BC_bescups_MASK 0xfffeffff /* bit 16 */
-# define BC_bescups_disable 0x0
-# define BC_bescups_enable 0x10000
-# define BC_bes420pl_MASK 0xfffdffff /* bit 17 */
-# define BC_bes420pl_422 0x0
-# define BC_bes420pl_420 0x20000
-# define BC_besdith_MASK 0xfffbffff /* bit 18 */
-# define BC_besdith_disable 0x0
-# define BC_besdith_enable 0x40000
-# define BC_beshmir_MASK 0xfff7ffff /* bit 19 */
-# define BC_beshmir_disable 0x0
-# define BC_beshmir_enable 0x80000
-# define BC_besbwen_MASK 0xffefffff /* bit 20 */
-# define BC_besbwen_color 0x0
-# define BC_besbwen_bw 0x100000
-# define BC_besblank_MASK 0xffdfffff /* bit 21 */
-# define BC_besblank_disable 0x0
-# define BC_besblank_enable 0x200000
-# define BC_besfselm_MASK 0xfeffffff /* bit 24 */
-# define BC_besfselm_soft 0x0
-# define BC_besfselm_hard 0x1000000
-# define BC_besfsel_MASK 0xf9ffffff /* bits 25-26 */
-# define BC_besfsel_a1 0x0 /* val 0, shift 25 */
-# define BC_besfsel_a2 0x2000000 /* val 1, shift 25 */
-# define BC_besfsel_b1 0x4000000 /* val 2, shift 25 */
-# define BC_besfsel_b2 0x6000000 /* val 3, shift 25 */
-
-#define MGAREG_BESGLOBCTL 0x3dc0
-
-# define BGC_beshzoom_MASK 0xfffffffe /* bit 0 */
-# define BGC_beshzoom_disable 0x0
-# define BGC_beshzoom_enable 0x1
-# define BGC_beshzoomf_MASK 0xfffffffd /* bit 1 */
-# define BGC_beshzoomf_disable 0x0
-# define BGC_beshzoomf_enable 0x2
-# define BGC_bescorder_MASK 0xfffffff7 /* bit 3 */
-# define BGC_bescorder_even 0x0
-# define BGC_bescorder_odd 0x8
-# define BGC_besreghup_MASK 0xffffffef /* bit 4 */
-# define BGC_besreghup_disable 0x0
-# define BGC_besreghup_enable 0x10
-# define BGC_besvcnt_MASK 0xf000ffff /* bits 16-27 */
-# define BGC_besvcnt_SHIFT 16
-
-#define MGAREG_BESHCOORD 0x3d28
-
-# define BHC_besright_MASK 0xfffff800 /* bits 0-10 */
-# define BHC_besright_SHIFT 0
-# define BHC_besleft_MASK 0xf800ffff /* bits 16-26 */
-# define BHC_besleft_SHIFT 16
-
-#define MGAREG_BESHISCAL 0x3d30
-
-# define BHISF_beshiscal_MASK 0xffe00003 /* bits 2-20 */
-# define BHISF_beshiscal_SHIFT 2
-
-#define MGAREG_BESHSRCEND 0x3d3c
-
-# define BHSE_beshsrcend_MASK 0xfc000003 /* bits 2-25 */
-# define BHSE_beshsrcend_SHIFT 2
-
-#define MGAREG_BESHSRCLST 0x3d50
-
-# define BHSL_beshsrclst_MASK 0xfc00ffff /* bits 16-25 */
-# define BHSL_beshsrclst_SHIFT 16
-
-#define MGAREG_BESHSRCST 0x3d38
-
-# define BHSS_beshsrcst_MASK 0xfc000003 /* bits 2-25 */
-# define BHSS_beshsrcst_SHIFT 2
-
-#define MGAREG_BESPITCH 0x3d24
-
-# define BP_bespitch_MASK 0xfffff000 /* bits 0-11 */
-# define BP_bespitch_SHIFT 0
-
-#define MGAREG_BESSTATUS 0x3dc4
-
-# define BS_besstat_MASK 0xfffffffc /* bits 0-1 */
-# define BS_besstat_a1 0x0 /* val 0, shift 0 */
-# define BS_besstat_a2 0x1 /* val 1, shift 0 */
-# define BS_besstat_b1 0x2 /* val 2, shift 0 */
-# define BS_besstat_b2 0x3 /* val 3, shift 0 */
-
-#define MGAREG_BESV1SRCLST 0x3d54
-
-# define BSF_besv1srclast_MASK 0xfffffc00 /* bits 0-9 */
-# define BSF_besv1srclast_SHIFT 0
-
-#define MGAREG_BESV2SRCLST 0x3d58
-
-# define BSF_besv2srclst_MASK 0xfffffc00 /* bits 0-9 */
-# define BSF_besv2srclst_SHIFT 0
-
-#define MGAREG_BESV1WGHT 0x3d48
-
-# define BSF_besv1wght_MASK 0xffff0003 /* bits 2-15 */
-# define BSF_besv1wght_SHIFT 2
-# define BSF_besv1wghts_MASK 0xfffeffff /* bit 16 */
-# define BSF_besv1wghts_disable 0x0
-# define BSF_besv1wghts_enable 0x10000
-
-#define MGAREG_BESV2WGHT 0x3d4c
-
-# define BSF_besv2wght_MASK 0xffff0003 /* bits 2-15 */
-# define BSF_besv2wght_SHIFT 2
-# define BSF_besv2wghts_MASK 0xfffeffff /* bit 16 */
-# define BSF_besv2wghts_disable 0x0
-# define BSF_besv2wghts_enable 0x10000
-
-#define MGAREG_BESVCOORD 0x3d2c
-
-# define BVC_besbot_MASK 0xfffff800 /* bits 0-10 */
-# define BVC_besbot_SHIFT 0
-# define BVC_bestop_MASK 0xf800ffff /* bits 16-26 */
-# define BVC_bestop_SHIFT 16
-
-#define MGAREG_BESVISCAL 0x3d34
-
-# define BVISF_besviscal_MASK 0xffe00003 /* bits 2-20 */
-# define BVISF_besviscal_SHIFT 2
-
-#define MGAREG_CODECADDR 0x3e44
-#define MGAREG_CODECCTL 0x3e40
-#define MGAREG_CODECHARDPTR 0x3e4c
-#define MGAREG_CODECHOSTPTR 0x3e48
-#define MGAREG_CODECLCODE 0x3e50
-#define MGAREG_CXBNDRY 0x1c80
-
-# define CXB_cxleft_MASK 0xfffff000 /* bits 0-11 */
-# define CXB_cxleft_SHIFT 0
-# define CXB_cxright_MASK 0xf000ffff /* bits 16-27 */
-# define CXB_cxright_SHIFT 16
-
-#define MGAREG_CXLEFT 0x1ca0
-#define MGAREG_CXRIGHT 0x1ca4
-#define MGAREG_DMAMAP30 0x1e30
-#define MGAREG_DMAMAP74 0x1e34
-#define MGAREG_DMAMAPB8 0x1e38
-#define MGAREG_DMAMAPFC 0x1e3c
-#define MGAREG_DMAPAD 0x1c54
-#define MGAREG_DR0_Z32LSB 0x2c50
-#define MGAREG_DR0_Z32MSB 0x2c54
-#define MGAREG_DR2_Z32LSB 0x2c60
-#define MGAREG_DR2_Z32MSB 0x2c64
-#define MGAREG_DR3_Z32LSB 0x2c68
-#define MGAREG_DR3_Z32MSB 0x2c6c
-#define MGAREG_DR0 0x1cc0
-#define MGAREG_DR2 0x1cc8
-#define MGAREG_DR3 0x1ccc
-#define MGAREG_DR4 0x1cd0
-#define MGAREG_DR6 0x1cd8
-#define MGAREG_DR7 0x1cdc
-#define MGAREG_DR8 0x1ce0
-#define MGAREG_DR10 0x1ce8
-#define MGAREG_DR11 0x1cec
-#define MGAREG_DR12 0x1cf0
-#define MGAREG_DR14 0x1cf8
-#define MGAREG_DR15 0x1cfc
-#define MGAREG_DSTORG 0x2cb8
-
-# define DO_dstmap_MASK 0xfffffffe /* bit 0 */
-# define DO_dstmap_fb 0x0
-# define DO_dstmap_sys 0x1
-# define DO_dstacc_MASK 0xfffffffd /* bit 1 */
-# define DO_dstacc_pci 0x0
-# define DO_dstacc_agp 0x2
-# define DO_dstorg_MASK 0x7 /* bits 3-31 */
-# define DO_dstorg_SHIFT 3
-
-#define MGAREG_DWG_INDIR_WT 0x1e80
-#define MGAREG_DWGCTL 0x1c00
-
-# define DC_opcod_MASK 0xfffffff0 /* bits 0-3 */
-# define DC_opcod_line_open 0x0 /* val 0, shift 0 */
-# define DC_opcod_autoline_open 0x1 /* val 1, shift 0 */
-# define DC_opcod_line_close 0x2 /* val 2, shift 0 */
-# define DC_opcod_autoline_close 0x3 /* val 3, shift 0 */
-# define DC_opcod_trap 0x4 /* val 4, shift 0 */
-# define DC_opcod_texture_trap 0x6 /* val 6, shift 0 */
-# define DC_opcod_bitblt 0x8 /* val 8, shift 0 */
-# define DC_opcod_iload 0x9 /* val 9, shift 0 */
-# define DC_atype_MASK 0xffffff8f /* bits 4-6 */
-# define DC_atype_rpl 0x0 /* val 0, shift 4 */
-# define DC_atype_rstr 0x10 /* val 1, shift 4 */
-# define DC_atype_zi 0x30 /* val 3, shift 4 */
-# define DC_atype_blk 0x40 /* val 4, shift 4 */
-# define DC_atype_i 0x70 /* val 7, shift 4 */
-# define DC_linear_MASK 0xffffff7f /* bit 7 */
-# define DC_linear_xy 0x0
-# define DC_linear_linear 0x80
-# define DC_zmode_MASK 0xfffff8ff /* bits 8-10 */
-# define DC_zmode_nozcmp 0x0 /* val 0, shift 8 */
-# define DC_zmode_ze 0x200 /* val 2, shift 8 */
-# define DC_zmode_zne 0x300 /* val 3, shift 8 */
-# define DC_zmode_zlt 0x400 /* val 4, shift 8 */
-# define DC_zmode_zlte 0x500 /* val 5, shift 8 */
-# define DC_zmode_zgt 0x600 /* val 6, shift 8 */
-# define DC_zmode_zgte 0x700 /* val 7, shift 8 */
-# define DC_solid_MASK 0xfffff7ff /* bit 11 */
-# define DC_solid_disable 0x0
-# define DC_solid_enable 0x800
-# define DC_arzero_MASK 0xffffefff /* bit 12 */
-# define DC_arzero_disable 0x0
-# define DC_arzero_enable 0x1000
-# define DC_sgnzero_MASK 0xffffdfff /* bit 13 */
-# define DC_sgnzero_disable 0x0
-# define DC_sgnzero_enable 0x2000
-# define DC_shftzero_MASK 0xffffbfff /* bit 14 */
-# define DC_shftzero_disable 0x0
-# define DC_shftzero_enable 0x4000
-# define DC_bop_MASK 0xfff0ffff /* bits 16-19 */
-# define DC_bop_SHIFT 16
-# define DC_trans_MASK 0xff0fffff /* bits 20-23 */
-# define DC_trans_SHIFT 20
-# define DC_bltmod_MASK 0xe1ffffff /* bits 25-28 */
-# define DC_bltmod_bmonolef 0x0 /* val 0, shift 25 */
-# define DC_bltmod_bmonowf 0x8000000 /* val 4, shift 25 */
-# define DC_bltmod_bplan 0x2000000 /* val 1, shift 25 */
-# define DC_bltmod_bfcol 0x4000000 /* val 2, shift 25 */
-# define DC_bltmod_bu32bgr 0x6000000 /* val 3, shift 25 */
-# define DC_bltmod_bu32rgb 0xe000000 /* val 7, shift 25 */
-# define DC_bltmod_bu24bgr 0x16000000 /* val 11, shift 25 */
-# define DC_bltmod_bu24rgb 0x1e000000 /* val 15, shift 25 */
-# define DC_pattern_MASK 0xdfffffff /* bit 29 */
-# define DC_pattern_disable 0x0
-# define DC_pattern_enable 0x20000000
-# define DC_transc_MASK 0xbfffffff /* bit 30 */
-# define DC_transc_disable 0x0
-# define DC_transc_enable 0x40000000
-# define DC_clipdis_MASK 0x7fffffff /* bit 31 */
-# define DC_clipdis_disable 0x0
-# define DC_clipdis_enable 0x80000000
-
-#define MGAREG_DWGSYNC 0x2c4c
-
-# define DS_dwgsyncaddr_MASK 0x3 /* bits 2-31 */
-# define DS_dwgsyncaddr_SHIFT 2
-
-#define MGAREG_FCOL 0x1c24
-#define MGAREG_FIFOSTATUS 0x1e10
-
-# define FS_fifocount_MASK 0xffffff80 /* bits 0-6 */
-# define FS_fifocount_SHIFT 0
-# define FS_bfull_MASK 0xfffffeff /* bit 8 */
-# define FS_bfull_disable 0x0
-# define FS_bfull_enable 0x100
-# define FS_bempty_MASK 0xfffffdff /* bit 9 */
-# define FS_bempty_disable 0x0
-# define FS_bempty_enable 0x200
-
-#define MGAREG_FOGCOL 0x1cf4
-#define MGAREG_FOGSTART 0x1cc4
-#define MGAREG_FOGXINC 0x1cd4
-#define MGAREG_FOGYINC 0x1ce4
-#define MGAREG_FXBNDRY 0x1c84
-
-# define XA_fxleft_MASK 0xffff0000 /* bits 0-15 */
-# define XA_fxleft_SHIFT 0
-# define XA_fxright_MASK 0xffff /* bits 16-31 */
-# define XA_fxright_SHIFT 16
-
-#define MGAREG_FXLEFT 0x1ca8
-#define MGAREG_FXRIGHT 0x1cac
-#define MGAREG_ICLEAR 0x1e18
-
-# define IC_softrapiclr_MASK 0xfffffffe /* bit 0 */
-# define IC_softrapiclr_disable 0x0
-# define IC_softrapiclr_enable 0x1
-# define IC_pickiclr_MASK 0xfffffffb /* bit 2 */
-# define IC_pickiclr_disable 0x0
-# define IC_pickiclr_enable 0x4
-# define IC_vlineiclr_MASK 0xffffffdf /* bit 5 */
-# define IC_vlineiclr_disable 0x0
-# define IC_vlineiclr_enable 0x20
-# define IC_wiclr_MASK 0xffffff7f /* bit 7 */
-# define IC_wiclr_disable 0x0
-# define IC_wiclr_enable 0x80
-# define IC_wciclr_MASK 0xfffffeff /* bit 8 */
-# define IC_wciclr_disable 0x0
-# define IC_wciclr_enable 0x100
-
-#define MGAREG_IEN 0x1e1c
-
-# define IE_softrapien_MASK 0xfffffffe /* bit 0 */
-# define IE_softrapien_disable 0x0
-# define IE_softrapien_enable 0x1
-# define IE_pickien_MASK 0xfffffffb /* bit 2 */
-# define IE_pickien_disable 0x0
-# define IE_pickien_enable 0x4
-# define IE_vlineien_MASK 0xffffffdf /* bit 5 */
-# define IE_vlineien_disable 0x0
-# define IE_vlineien_enable 0x20
-# define IE_extien_MASK 0xffffffbf /* bit 6 */
-# define IE_extien_disable 0x0
-# define IE_extien_enable 0x40
-# define IE_wien_MASK 0xffffff7f /* bit 7 */
-# define IE_wien_disable 0x0
-# define IE_wien_enable 0x80
-# define IE_wcien_MASK 0xfffffeff /* bit 8 */
-# define IE_wcien_disable 0x0
-# define IE_wcien_enable 0x100
-
-#define MGAREG_LEN 0x1c5c
-#define MGAREG_MACCESS 0x1c04
-
-# define MA_pwidth_MASK 0xfffffffc /* bits 0-1 */
-# define MA_pwidth_8 0x0 /* val 0, shift 0 */
-# define MA_pwidth_16 0x1 /* val 1, shift 0 */
-# define MA_pwidth_32 0x2 /* val 2, shift 0 */
-# define MA_pwidth_24 0x3 /* val 3, shift 0 */
-# define MA_zwidth_MASK 0xffffffe7 /* bits 3-4 */
-# define MA_zwidth_16 0x0 /* val 0, shift 3 */
-# define MA_zwidth_32 0x8 /* val 1, shift 3 */
-# define MA_zwidth_15 0x10 /* val 2, shift 3 */
-# define MA_zwidth_24 0x18 /* val 3, shift 3 */
-# define MA_memreset_MASK 0xffff7fff /* bit 15 */
-# define MA_memreset_disable 0x0
-# define MA_memreset_enable 0x8000
-# define MA_fogen_MASK 0xfbffffff /* bit 26 */
-# define MA_fogen_disable 0x0
-# define MA_fogen_enable 0x4000000
-# define MA_tlutload_MASK 0xdfffffff /* bit 29 */
-# define MA_tlutload_disable 0x0
-# define MA_tlutload_enable 0x20000000
-# define MA_nodither_MASK 0xbfffffff /* bit 30 */
-# define MA_nodither_disable 0x0
-# define MA_nodither_enable 0x40000000
-# define MA_dit555_MASK 0x7fffffff /* bit 31 */
-# define MA_dit555_disable 0x0
-# define MA_dit555_enable 0x80000000
-
-#define MGAREG_MCTLWTST 0x1c08
-
-# define MCWS_casltncy_MASK 0xfffffff8 /* bits 0-2 */
-# define MCWS_casltncy_SHIFT 0
-# define MCWS_rrddelay_MASK 0xffffffcf /* bits 4-5 */
-# define MCWS_rcddelay_MASK 0xfffffe7f /* bits 7-8 */
-# define MCWS_rasmin_MASK 0xffffe3ff /* bits 10-12 */
-# define MCWS_rasmin_SHIFT 10
-# define MCWS_rpdelay_MASK 0xffff3fff /* bits 14-15 */
-# define MCWS_wrdelay_MASK 0xfff3ffff /* bits 18-19 */
-# define MCWS_rddelay_MASK 0xffdfffff /* bit 21 */
-# define MCWS_rddelay_disable 0x0
-# define MCWS_rddelay_enable 0x200000
-# define MCWS_smrdelay_MASK 0xfe7fffff /* bits 23-24 */
-# define MCWS_bwcdelay_MASK 0xf3ffffff /* bits 26-27 */
-# define MCWS_bpldelay_MASK 0x1fffffff /* bits 29-31 */
-# define MCWS_bpldelay_SHIFT 29
-
-#define MGAREG_MEMRDBK 0x1e44
-
-# define MRB_mclkbrd0_MASK 0xfffffff0 /* bits 0-3 */
-# define MRB_mclkbrd0_SHIFT 0
-# define MRB_mclkbrd1_MASK 0xfffffe1f /* bits 5-8 */
-# define MRB_mclkbrd1_SHIFT 5
-# define MRB_strmfctl_MASK 0xff3fffff /* bits 22-23 */
-# define MRB_mrsopcod_MASK 0xe1ffffff /* bits 25-28 */
-# define MRB_mrsopcod_SHIFT 25
-
-#define MGAREG_OPMODE 0x1e54
-
-# define OM_dmamod_MASK 0xfffffff3 /* bits 2-3 */
-# define OM_dmamod_general 0x0 /* val 0, shift 2 */
-# define OM_dmamod_blit 0x4 /* val 1, shift 2 */
-# define OM_dmamod_vector 0x8 /* val 2, shift 2 */
-# define OM_dmamod_vertex 0xc /* val 3, shift 2 */
-# define OM_dmadatasiz_MASK 0xfffffcff /* bits 8-9 */
-# define OM_dmadatasiz_8 0x0 /* val 0, shift 8 */
-# define OM_dmadatasiz_16 0x100 /* val 1, shift 8 */
-# define OM_dmadatasiz_32 0x200 /* val 2, shift 8 */
-# define OM_dirdatasiz_MASK 0xfffcffff /* bits 16-17 */
-# define OM_dirdatasiz_8 0x0 /* val 0, shift 16 */
-# define OM_dirdatasiz_16 0x10000 /* val 1, shift 16 */
-# define OM_dirdatasiz_32 0x20000 /* val 2, shift 16 */
-
-#define MGAREG_PAT0 0x1c10
-#define MGAREG_PAT1 0x1c14
-#define MGAREG_PITCH 0x1c8c
-
-# define P_iy_MASK 0xffffe000 /* bits 0-12 */
-# define P_iy_SHIFT 0
-# define P_ylin_MASK 0xffff7fff /* bit 15 */
-# define P_ylin_disable 0x0
-# define P_ylin_enable 0x8000
-
-#define MGAREG_PLNWT 0x1c1c
-#define MGAREG_PRIMADDRESS 0x1e58
-
-# define PDCA_primod_MASK 0xfffffffc /* bits 0-1 */
-# define PDCA_primod_general 0x0 /* val 0, shift 0 */
-# define PDCA_primod_blit 0x1 /* val 1, shift 0 */
-# define PDCA_primod_vector 0x2 /* val 2, shift 0 */
-# define PDCA_primod_vertex 0x3 /* val 3, shift 0 */
-# define PDCA_primaddress_MASK 0x3 /* bits 2-31 */
-# define PDCA_primaddress_SHIFT 2
-
-#define MGAREG_PRIMEND 0x1e5c
-
-# define PDEA_primnostart_MASK 0xfffffffe /* bit 0 */
-# define PDEA_primnostart_disable 0x0
-# define PDEA_primnostart_enable 0x1
-# define PDEA_pagpxfer_MASK 0xfffffffd /* bit 1 */
-# define PDEA_pagpxfer_disable 0x0
-# define PDEA_pagpxfer_enable 0x2
-# define PDEA_primend_MASK 0x3 /* bits 2-31 */
-# define PDEA_primend_SHIFT 2
-
-#define MGAREG_PRIMPTR 0x1e50
-
-# define PLS_primptren0_MASK 0xfffffffe /* bit 0 */
-# define PLS_primptren0_disable 0x0
-# define PLS_primptren0_enable 0x1
-# define PLS_primptren1_MASK 0xfffffffd /* bit 1 */
-# define PLS_primptren1_disable 0x0
-# define PLS_primptren1_enable 0x2
-# define PLS_primptr_MASK 0x7 /* bits 3-31 */
-# define PLS_primptr_SHIFT 3
-
-#define MGAREG_RST 0x1e40
-
-# define R_softreset_MASK 0xfffffffe /* bit 0 */
-# define R_softreset_disable 0x0
-# define R_softreset_enable 0x1
-# define R_softextrst_MASK 0xfffffffd /* bit 1 */
-# define R_softextrst_disable 0x0
-# define R_softextrst_enable 0x2
-
-#define MGAREG_SECADDRESS 0x2c40
-
-# define SDCA_secmod_MASK 0xfffffffc /* bits 0-1 */
-# define SDCA_secmod_general 0x0 /* val 0, shift 0 */
-# define SDCA_secmod_blit 0x1 /* val 1, shift 0 */
-# define SDCA_secmod_vector 0x2 /* val 2, shift 0 */
-# define SDCA_secmod_vertex 0x3 /* val 3, shift 0 */
-# define SDCA_secaddress_MASK 0x3 /* bits 2-31 */
-# define SDCA_secaddress_SHIFT 2
-
-#define MGAREG_SECEND 0x2c44
-
-# define SDEA_sagpxfer_MASK 0xfffffffd /* bit 1 */
-# define SDEA_sagpxfer_disable 0x0
-# define SDEA_sagpxfer_enable 0x2
-# define SDEA_secend_MASK 0x3 /* bits 2-31 */
-# define SDEA_secend_SHIFT 2
-
-#define MGAREG_SETUPADDRESS 0x2cd0
-
-# define SETADD_mode_MASK 0xfffffffc /* bits 0-1 */
-# define SETADD_mode_vertlist 0x0 /* val 0, shift 0 */
-# define SETADD_address_MASK 0x3 /* bits 2-31 */
-# define SETADD_address_SHIFT 2
-
-#define MGAREG_SETUPEND 0x2cd4
-
-# define SETEND_agpxfer_MASK 0xfffffffd /* bit 1 */
-# define SETEND_agpxfer_disable 0x0
-# define SETEND_agpxfer_enable 0x2
-# define SETEND_address_MASK 0x3 /* bits 2-31 */
-# define SETEND_address_SHIFT 2
-
-#define MGAREG_SGN 0x1c58
-
-# define S_sdydxl_MASK 0xfffffffe /* bit 0 */
-# define S_sdydxl_y 0x0
-# define S_sdydxl_x 0x1
-# define S_scanleft_MASK 0xfffffffe /* bit 0 */
-# define S_scanleft_disable 0x0
-# define S_scanleft_enable 0x1
-# define S_sdxl_MASK 0xfffffffd /* bit 1 */
-# define S_sdxl_pos 0x0
-# define S_sdxl_neg 0x2
-# define S_sdy_MASK 0xfffffffb /* bit 2 */
-# define S_sdy_pos 0x0
-# define S_sdy_neg 0x4
-# define S_sdxr_MASK 0xffffffdf /* bit 5 */
-# define S_sdxr_pos 0x0
-# define S_sdxr_neg 0x20
-# define S_brkleft_MASK 0xfffffeff /* bit 8 */
-# define S_brkleft_disable 0x0
-# define S_brkleft_enable 0x100
-# define S_errorinit_MASK 0x7fffffff /* bit 31 */
-# define S_errorinit_disable 0x0
-# define S_errorinit_enable 0x80000000
-
-#define MGAREG_SHIFT 0x1c50
-
-# define FSC_x_off_MASK 0xfffffff0 /* bits 0-3 */
-# define FSC_x_off_SHIFT 0
-# define FSC_funcnt_MASK 0xffffff80 /* bits 0-6 */
-# define FSC_funcnt_SHIFT 0
-# define FSC_y_off_MASK 0xffffff8f /* bits 4-6 */
-# define FSC_y_off_SHIFT 4
-# define FSC_funoff_MASK 0xffc0ffff /* bits 16-21 */
-# define FSC_funoff_SHIFT 16
-# define FSC_stylelen_MASK 0xffc0ffff /* bits 16-21 */
-# define FSC_stylelen_SHIFT 16
-
-#define MGAREG_SOFTRAP 0x2c48
-
-# define STH_softraphand_MASK 0x3 /* bits 2-31 */
-# define STH_softraphand_SHIFT 2
-
-#define MGAREG_SPECBSTART 0x2c98
-#define MGAREG_SPECBXINC 0x2c9c
-#define MGAREG_SPECBYINC 0x2ca0
-#define MGAREG_SPECGSTART 0x2c8c
-#define MGAREG_SPECGXINC 0x2c90
-#define MGAREG_SPECGYINC 0x2c94
-#define MGAREG_SPECRSTART 0x2c80
-#define MGAREG_SPECRXINC 0x2c84
-#define MGAREG_SPECRYINC 0x2c88
-#define MGAREG_SRC0 0x1c30
-#define MGAREG_SRC1 0x1c34
-#define MGAREG_SRC2 0x1c38
-#define MGAREG_SRC3 0x1c3c
-#define MGAREG_SRCORG 0x2cb4
-
-# define SO_srcmap_MASK 0xfffffffe /* bit 0 */
-# define SO_srcmap_fb 0x0
-# define SO_srcmap_sys 0x1
-# define SO_srcacc_MASK 0xfffffffd /* bit 1 */
-# define SO_srcacc_pci 0x0
-# define SO_srcacc_agp 0x2
-# define SO_srcorg_MASK 0x7 /* bits 3-31 */
-# define SO_srcorg_SHIFT 3
-
-#define MGAREG_STATUS 0x1e14
-
-# define STAT_softrapen_MASK 0xfffffffe /* bit 0 */
-# define STAT_softrapen_disable 0x0
-# define STAT_softrapen_enable 0x1
-# define STAT_pickpen_MASK 0xfffffffb /* bit 2 */
-# define STAT_pickpen_disable 0x0
-# define STAT_pickpen_enable 0x4
-# define STAT_vsyncsts_MASK 0xfffffff7 /* bit 3 */
-# define STAT_vsyncsts_disable 0x0
-# define STAT_vsyncsts_enable 0x8
-# define STAT_vsyncpen_MASK 0xffffffef /* bit 4 */
-# define STAT_vsyncpen_disable 0x0
-# define STAT_vsyncpen_enable 0x10
-# define STAT_vlinepen_MASK 0xffffffdf /* bit 5 */
-# define STAT_vlinepen_disable 0x0
-# define STAT_vlinepen_enable 0x20
-# define STAT_extpen_MASK 0xffffffbf /* bit 6 */
-# define STAT_extpen_disable 0x0
-# define STAT_extpen_enable 0x40
-# define STAT_wpen_MASK 0xffffff7f /* bit 7 */
-# define STAT_wpen_disable 0x0
-# define STAT_wpen_enable 0x80
-# define STAT_wcpen_MASK 0xfffffeff /* bit 8 */
-# define STAT_wcpen_disable 0x0
-# define STAT_wcpen_enable 0x100
-# define STAT_dwgengsts_MASK 0xfffeffff /* bit 16 */
-# define STAT_dwgengsts_disable 0x0
-# define STAT_dwgengsts_enable 0x10000
-# define STAT_endprdmasts_MASK 0xfffdffff /* bit 17 */
-# define STAT_endprdmasts_disable 0x0
-# define STAT_endprdmasts_enable 0x20000
-# define STAT_wbusy_MASK 0xfffbffff /* bit 18 */
-# define STAT_wbusy_disable 0x0
-# define STAT_wbusy_enable 0x40000
-# define STAT_swflag_MASK 0xfffffff /* bits 28-31 */
-# define STAT_swflag_SHIFT 28
-
-#define MGAREG_STENCIL 0x2cc8
-
-# define S_sref_MASK 0xffffff00 /* bits 0-7 */
-# define S_sref_SHIFT 0
-# define S_smsk_MASK 0xffff00ff /* bits 8-15 */
-# define S_smsk_SHIFT 8
-# define S_swtmsk_MASK 0xff00ffff /* bits 16-23 */
-# define S_swtmsk_SHIFT 16
-
-#define MGAREG_STENCILCTL 0x2ccc
-
-# define SC_smode_MASK 0xfffffff8 /* bits 0-2 */
-# define SC_smode_salways 0x0 /* val 0, shift 0 */
-# define SC_smode_snever 0x1 /* val 1, shift 0 */
-# define SC_smode_se 0x2 /* val 2, shift 0 */
-# define SC_smode_sne 0x3 /* val 3, shift 0 */
-# define SC_smode_slt 0x4 /* val 4, shift 0 */
-# define SC_smode_slte 0x5 /* val 5, shift 0 */
-# define SC_smode_sgt 0x6 /* val 6, shift 0 */
-# define SC_smode_sgte 0x7 /* val 7, shift 0 */
-# define SC_sfailop_MASK 0xffffffc7 /* bits 3-5 */
-# define SC_sfailop_keep 0x0 /* val 0, shift 3 */
-# define SC_sfailop_zero 0x8 /* val 1, shift 3 */
-# define SC_sfailop_replace 0x10 /* val 2, shift 3 */
-# define SC_sfailop_incrsat 0x18 /* val 3, shift 3 */
-# define SC_sfailop_decrsat 0x20 /* val 4, shift 3 */
-# define SC_sfailop_invert 0x28 /* val 5, shift 3 */
-# define SC_sfailop_incr 0x30 /* val 6, shift 3 */
-# define SC_sfailop_decr 0x38 /* val 7, shift 3 */
-# define SC_szfailop_MASK 0xfffffe3f /* bits 6-8 */
-# define SC_szfailop_keep 0x0 /* val 0, shift 6 */
-# define SC_szfailop_zero 0x40 /* val 1, shift 6 */
-# define SC_szfailop_replace 0x80 /* val 2, shift 6 */
-# define SC_szfailop_incrsat 0xc0 /* val 3, shift 6 */
-# define SC_szfailop_decrsat 0x100 /* val 4, shift 6 */
-# define SC_szfailop_invert 0x140 /* val 5, shift 6 */
-# define SC_szfailop_incr 0x180 /* val 6, shift 6 */
-# define SC_szfailop_decr 0x1c0 /* val 7, shift 6 */
-# define SC_szpassop_MASK 0xfffff1ff /* bits 9-11 */
-# define SC_szpassop_keep 0x0 /* val 0, shift 9 */
-# define SC_szpassop_zero 0x200 /* val 1, shift 9 */
-# define SC_szpassop_replace 0x400 /* val 2, shift 9 */
-# define SC_szpassop_incrsat 0x600 /* val 3, shift 9 */
-# define SC_szpassop_decrsat 0x800 /* val 4, shift 9 */
-# define SC_szpassop_invert 0xa00 /* val 5, shift 9 */
-# define SC_szpassop_incr 0xc00 /* val 6, shift 9 */
-# define SC_szpassop_decr 0xe00 /* val 7, shift 9 */
-
-#define MGAREG_TDUALSTAGE0 0x2cf8
-
-# define TD0_color_arg2_MASK 0xfffffffc /* bits 0-1 */
-# define TD0_color_arg2_diffuse 0x0 /* val 0, shift 0 */
-# define TD0_color_arg2_specular 0x1 /* val 1, shift 0 */
-# define TD0_color_arg2_fcol 0x2 /* val 2, shift 0 */
-# define TD0_color_arg2_prevstage 0x3 /* val 3, shift 0 */
-# define TD0_color_alpha_MASK 0xffffffe3 /* bits 2-4 */
-# define TD0_color_alpha_diffuse 0x0 /* val 0, shift 2 */
-# define TD0_color_alpha_fcol 0x4 /* val 1, shift 2 */
-# define TD0_color_alpha_currtex 0x8 /* val 2, shift 2 */
-# define TD0_color_alpha_prevtex 0xc /* val 3, shift 2 */
-# define TD0_color_alpha_prevstage 0x10 /* val 4, shift 2 */
-# define TD0_color_arg1_replicatealpha_MASK 0xffffffdf /* bit 5 */
-# define TD0_color_arg1_replicatealpha_disable 0x0
-# define TD0_color_arg1_replicatealpha_enable 0x20
-# define TD0_color_arg1_inv_MASK 0xffffffbf /* bit 6 */
-# define TD0_color_arg1_inv_disable 0x0
-# define TD0_color_arg1_inv_enable 0x40
-# define TD0_color_arg2_replicatealpha_MASK 0xffffff7f /* bit 7 */
-# define TD0_color_arg2_replicatealpha_disable 0x0
-# define TD0_color_arg2_replicatealpha_enable 0x80
-# define TD0_color_arg2_inv_MASK 0xfffffeff /* bit 8 */
-# define TD0_color_arg2_inv_disable 0x0
-# define TD0_color_arg2_inv_enable 0x100
-# define TD0_color_alpha1inv_MASK 0xfffffdff /* bit 9 */
-# define TD0_color_alpha1inv_disable 0x0
-# define TD0_color_alpha1inv_enable 0x200
-# define TD0_color_alpha2inv_MASK 0xfffffbff /* bit 10 */
-# define TD0_color_alpha2inv_disable 0x0
-# define TD0_color_alpha2inv_enable 0x400
-# define TD0_color_arg1mul_MASK 0xfffff7ff /* bit 11 */
-# define TD0_color_arg1mul_disable 0x0 /* val 0, shift 11 */
-# define TD0_color_arg1mul_alpha1 0x800 /* val 1, shift 11 */
-# define TD0_color_arg2mul_MASK 0xffffefff /* bit 12 */
-# define TD0_color_arg2mul_disable 0x0 /* val 0, shift 12 */
-# define TD0_color_arg2mul_alpha2 0x1000 /* val 1, shift 12 */
-# define TD0_color_arg1add_MASK 0xffffdfff /* bit 13 */
-# define TD0_color_arg1add_disable 0x0 /* val 0, shift 13 */
-# define TD0_color_arg1add_mulout 0x2000 /* val 1, shift 13 */
-# define TD0_color_arg2add_MASK 0xffffbfff /* bit 14 */
-# define TD0_color_arg2add_disable 0x0 /* val 0, shift 14 */
-# define TD0_color_arg2add_mulout 0x4000 /* val 1, shift 14 */
-# define TD0_color_modbright_MASK 0xfffe7fff /* bits 15-16 */
-# define TD0_color_modbright_disable 0x0 /* val 0, shift 15 */
-# define TD0_color_modbright_2x 0x8000 /* val 1, shift 15 */
-# define TD0_color_modbright_4x 0x10000 /* val 2, shift 15 */
-# define TD0_color_add_MASK 0xfffdffff /* bit 17 */
-# define TD0_color_add_sub 0x0 /* val 0, shift 17 */
-# define TD0_color_add_add 0x20000 /* val 1, shift 17 */
-# define TD0_color_add2x_MASK 0xfffbffff /* bit 18 */
-# define TD0_color_add2x_disable 0x0
-# define TD0_color_add2x_enable 0x40000
-# define TD0_color_addbias_MASK 0xfff7ffff /* bit 19 */
-# define TD0_color_addbias_disable 0x0
-# define TD0_color_addbias_enable 0x80000
-# define TD0_color_blend_MASK 0xffefffff /* bit 20 */
-# define TD0_color_blend_disable 0x0
-# define TD0_color_blend_enable 0x100000
-# define TD0_color_sel_MASK 0xff9fffff /* bits 21-22 */
-# define TD0_color_sel_arg1 0x0 /* val 0, shift 21 */
-# define TD0_color_sel_arg2 0x200000 /* val 1, shift 21 */
-# define TD0_color_sel_add 0x400000 /* val 2, shift 21 */
-# define TD0_color_sel_mul 0x600000 /* val 3, shift 21 */
-# define TD0_alpha_arg1_inv_MASK 0xff7fffff /* bit 23 */
-# define TD0_alpha_arg1_inv_disable 0x0
-# define TD0_alpha_arg1_inv_enable 0x800000
-# define TD0_alpha_arg2_MASK 0xfcffffff /* bits 24-25 */
-# define TD0_alpha_arg2_diffuse 0x0 /* val 0, shift 24 */
-# define TD0_alpha_arg2_fcol 0x1000000 /* val 1, shift 24 */
-# define TD0_alpha_arg2_prevtex 0x2000000 /* val 2, shift 24 */
-# define TD0_alpha_arg2_prevstage 0x3000000 /* val 3, shift 24 */
-# define TD0_alpha_arg2_inv_MASK 0xfbffffff /* bit 26 */
-# define TD0_alpha_arg2_inv_disable 0x0
-# define TD0_alpha_arg2_inv_enable 0x4000000
-# define TD0_alpha_add_MASK 0xf7ffffff /* bit 27 */
-# define TD0_alpha_add_disable 0x0
-# define TD0_alpha_add_enable 0x8000000
-# define TD0_alpha_addbias_MASK 0xefffffff /* bit 28 */
-# define TD0_alpha_addbias_disable 0x0
-# define TD0_alpha_addbias_enable 0x10000000
-# define TD0_alpha_add2x_MASK 0xdfffffff /* bit 29 */
-# define TD0_alpha_add2x_disable 0x0
-# define TD0_alpha_add2x_enable 0x20000000
-# define TD0_alpha_modbright_MASK 0xcfffffff /* bits 28-29 */
-# define TD0_alpha_modbright_disable 0x0 /* val 0, shift 28 */
-# define TD0_alpha_modbright_2x 0x10000000 /* val 1, shift 28 */
-# define TD0_alpha_modbright_4x 0x20000000 /* val 2, shift 28 */
-# define TD0_alpha_sel_MASK 0x3fffffff /* bits 30-31 */
-# define TD0_alpha_sel_arg1 0x0 /* val 0, shift 30 */
-# define TD0_alpha_sel_arg2 0x40000000 /* val 1, shift 30 */
-# define TD0_alpha_sel_add 0x80000000 /* val 2, shift 30 */
-# define TD0_alpha_sel_mul 0xc0000000 /* val 3, shift 30 */
-
-#define MGAREG_TDUALSTAGE1 0x2cfc
-
-# define TD1_color_arg2_MASK 0xfffffffc /* bits 0-1 */
-# define TD1_color_arg2_diffuse 0x0 /* val 0, shift 0 */
-# define TD1_color_arg2_specular 0x1 /* val 1, shift 0 */
-# define TD1_color_arg2_fcol 0x2 /* val 2, shift 0 */
-# define TD1_color_arg2_prevstage 0x3 /* val 3, shift 0 */
-# define TD1_color_alpha_MASK 0xffffffe3 /* bits 2-4 */
-# define TD1_color_alpha_diffuse 0x0 /* val 0, shift 2 */
-# define TD1_color_alpha_fcol 0x4 /* val 1, shift 2 */
-# define TD1_color_alpha_tex0 0x8 /* val 2, shift 2 */
-# define TD1_color_alpha_prevtex 0xc /* val 3, shift 2 */
-# define TD1_color_alpha_prevstage 0x10 /* val 4, shift 2 */
-# define TD1_color_arg1_replicatealpha_MASK 0xffffffdf /* bit 5 */
-# define TD1_color_arg1_replicatealpha_disable 0x0
-# define TD1_color_arg1_replicatealpha_enable 0x20
-# define TD1_color_arg1_inv_MASK 0xffffffbf /* bit 6 */
-# define TD1_color_arg1_inv_disable 0x0
-# define TD1_color_arg1_inv_enable 0x40
-# define TD1_color_arg2_replicatealpha_MASK 0xffffff7f /* bit 7 */
-# define TD1_color_arg2_replicatealpha_disable 0x0
-# define TD1_color_arg2_replicatealpha_enable 0x80
-# define TD1_color_arg2_inv_MASK 0xfffffeff /* bit 8 */
-# define TD1_color_arg2_inv_disable 0x0
-# define TD1_color_arg2_inv_enable 0x100
-# define TD1_color_alpha1inv_MASK 0xfffffdff /* bit 9 */
-# define TD1_color_alpha1inv_disable 0x0
-# define TD1_color_alpha1inv_enable 0x200
-# define TD1_color_alpha2inv_MASK 0xfffffbff /* bit 10 */
-# define TD1_color_alpha2inv_disable 0x0
-# define TD1_color_alpha2inv_enable 0x400
-# define TD1_color_arg1mul_MASK 0xfffff7ff /* bit 11 */
-# define TD1_color_arg1mul_disable 0x0 /* val 0, shift 11 */
-# define TD1_color_arg1mul_alpha1 0x800 /* val 1, shift 11 */
-# define TD1_color_arg2mul_MASK 0xffffefff /* bit 12 */
-# define TD1_color_arg2mul_disable 0x0 /* val 0, shift 12 */
-# define TD1_color_arg2mul_alpha2 0x1000 /* val 1, shift 12 */
-# define TD1_color_arg1add_MASK 0xffffdfff /* bit 13 */
-# define TD1_color_arg1add_disable 0x0 /* val 0, shift 13 */
-# define TD1_color_arg1add_mulout 0x2000 /* val 1, shift 13 */
-# define TD1_color_arg2add_MASK 0xffffbfff /* bit 14 */
-# define TD1_color_arg2add_disable 0x0 /* val 0, shift 14 */
-# define TD1_color_arg2add_mulout 0x4000 /* val 1, shift 14 */
-# define TD1_color_modbright_MASK 0xfffe7fff /* bits 15-16 */
-# define TD1_color_modbright_disable 0x0 /* val 0, shift 15 */
-# define TD1_color_modbright_2x 0x8000 /* val 1, shift 15 */
-# define TD1_color_modbright_4x 0x10000 /* val 2, shift 15 */
-# define TD1_color_add_MASK 0xfffdffff /* bit 17 */
-# define TD1_color_add_sub 0x0 /* val 0, shift 17 */
-# define TD1_color_add_add 0x20000 /* val 1, shift 17 */
-# define TD1_color_add2x_MASK 0xfffbffff /* bit 18 */
-# define TD1_color_add2x_disable 0x0
-# define TD1_color_add2x_enable 0x40000
-# define TD1_color_addbias_MASK 0xfff7ffff /* bit 19 */
-# define TD1_color_addbias_disable 0x0
-# define TD1_color_addbias_enable 0x80000
-# define TD1_color_blend_MASK 0xffefffff /* bit 20 */
-# define TD1_color_blend_disable 0x0
-# define TD1_color_blend_enable 0x100000
-# define TD1_color_sel_MASK 0xff9fffff /* bits 21-22 */
-# define TD1_color_sel_arg1 0x0 /* val 0, shift 21 */
-# define TD1_color_sel_arg2 0x200000 /* val 1, shift 21 */
-# define TD1_color_sel_add 0x400000 /* val 2, shift 21 */
-# define TD1_color_sel_mul 0x600000 /* val 3, shift 21 */
-# define TD1_alpha_arg1_inv_MASK 0xff7fffff /* bit 23 */
-# define TD1_alpha_arg1_inv_disable 0x0
-# define TD1_alpha_arg1_inv_enable 0x800000
-# define TD1_alpha_arg2_MASK 0xfcffffff /* bits 24-25 */
-# define TD1_alpha_arg2_diffuse 0x0 /* val 0, shift 24 */
-# define TD1_alpha_arg2_fcol 0x1000000 /* val 1, shift 24 */
-# define TD1_alpha_arg2_prevtex 0x2000000 /* val 2, shift 24 */
-# define TD1_alpha_arg2_prevstage 0x3000000 /* val 3, shift 24 */
-# define TD1_alpha_arg2_inv_MASK 0xfbffffff /* bit 26 */
-# define TD1_alpha_arg2_inv_disable 0x0
-# define TD1_alpha_arg2_inv_enable 0x4000000
-# define TD1_alpha_add_MASK 0xf7ffffff /* bit 27 */
-# define TD1_alpha_add_disable 0x0
-# define TD1_alpha_add_enable 0x8000000
-# define TD1_alpha_addbias_MASK 0xefffffff /* bit 28 */
-# define TD1_alpha_addbias_disable 0x0
-# define TD1_alpha_addbias_enable 0x10000000
-# define TD1_alpha_add2x_MASK 0xdfffffff /* bit 29 */
-# define TD1_alpha_add2x_disable 0x0
-# define TD1_alpha_add2x_enable 0x20000000
-# define TD1_alpha_modbright_MASK 0xcfffffff /* bits 28-29 */
-# define TD1_alpha_modbright_disable 0x0 /* val 0, shift 28 */
-# define TD1_alpha_modbright_2x 0x10000000 /* val 1, shift 28 */
-# define TD1_alpha_modbright_4x 0x20000000 /* val 2, shift 28 */
-# define TD1_alpha_sel_MASK 0x3fffffff /* bits 30-31 */
-# define TD1_alpha_sel_arg1 0x0 /* val 0, shift 30 */
-# define TD1_alpha_sel_arg2 0x40000000 /* val 1, shift 30 */
-# define TD1_alpha_sel_add 0x80000000 /* val 2, shift 30 */
-# define TD1_alpha_sel_mul 0xc0000000 /* val 3, shift 30 */
-
-#define MGAREG_TEST0 0x1e48
-
-# define TST_ramtsten_MASK 0xfffffffe /* bit 0 */
-# define TST_ramtsten_disable 0x0
-# define TST_ramtsten_enable 0x1
-# define TST_ramtstdone_MASK 0xfffffffd /* bit 1 */
-# define TST_ramtstdone_disable 0x0
-# define TST_ramtstdone_enable 0x2
-# define TST_wramtstpass_MASK 0xfffffffb /* bit 2 */
-# define TST_wramtstpass_disable 0x0
-# define TST_wramtstpass_enable 0x4
-# define TST_tcachetstpass_MASK 0xfffffff7 /* bit 3 */
-# define TST_tcachetstpass_disable 0x0
-# define TST_tcachetstpass_enable 0x8
-# define TST_tluttstpass_MASK 0xffffffef /* bit 4 */
-# define TST_tluttstpass_disable 0x0
-# define TST_tluttstpass_enable 0x10
-# define TST_luttstpass_MASK 0xffffffdf /* bit 5 */
-# define TST_luttstpass_disable 0x0
-# define TST_luttstpass_enable 0x20
-# define TST_besramtstpass_MASK 0xffffffbf /* bit 6 */
-# define TST_besramtstpass_disable 0x0
-# define TST_besramtstpass_enable 0x40
-# define TST_ringen_MASK 0xfffffeff /* bit 8 */
-# define TST_ringen_disable 0x0
-# define TST_ringen_enable 0x100
-# define TST_apllbyp_MASK 0xfffffdff /* bit 9 */
-# define TST_apllbyp_disable 0x0
-# define TST_apllbyp_enable 0x200
-# define TST_hiten_MASK 0xfffffbff /* bit 10 */
-# define TST_hiten_disable 0x0
-# define TST_hiten_enable 0x400
-# define TST_tmode_MASK 0xffffc7ff /* bits 11-13 */
-# define TST_tmode_SHIFT 11
-# define TST_tclksel_MASK 0xfffe3fff /* bits 14-16 */
-# define TST_tclksel_SHIFT 14
-# define TST_ringcnten_MASK 0xfffdffff /* bit 17 */
-# define TST_ringcnten_disable 0x0
-# define TST_ringcnten_enable 0x20000
-# define TST_ringcnt_MASK 0xc003ffff /* bits 18-29 */
-# define TST_ringcnt_SHIFT 18
-# define TST_ringcntclksl_MASK 0xbfffffff /* bit 30 */
-# define TST_ringcntclksl_disable 0x0
-# define TST_ringcntclksl_enable 0x40000000
-# define TST_biosboot_MASK 0x7fffffff /* bit 31 */
-# define TST_biosboot_disable 0x0
-# define TST_biosboot_enable 0x80000000
-
-#define MGAREG_TEXBORDERCOL 0x2c5c
-#define MGAREG_TEXCTL 0x2c30
-
-# define TMC_tformat_MASK 0xfffffff0 /* bits 0-3 */
-# define TMC_tformat_tw4 0x0 /* val 0, shift 0 */
-# define TMC_tformat_tw8 0x1 /* val 1, shift 0 */
-# define TMC_tformat_tw15 0x2 /* val 2, shift 0 */
-# define TMC_tformat_tw16 0x3 /* val 3, shift 0 */
-# define TMC_tformat_tw12 0x4 /* val 4, shift 0 */
-# define TMC_tformat_tw32 0x6 /* val 6, shift 0 */
-# define TMC_tformat_tw8a 0x7 /* val 7, shift 0 */
-# define TMC_tformat_tw8al 0x8 /* val 8, shift 0 */
-# define TMC_tformat_tw422 0xa /* val 10, shift 0 */
-# define TMC_tformat_tw422uyvy 0xb /* val 11, shift 0 */
-# define TMC_tpitchlin_MASK 0xfffffeff /* bit 8 */
-# define TMC_tpitchlin_disable 0x0
-# define TMC_tpitchlin_enable 0x100
-# define TMC_tpitchext_MASK 0xfff001ff /* bits 9-19 */
-# define TMC_tpitchext_SHIFT 9
-# define TMC_tpitch_MASK 0xfff8ffff /* bits 16-18 */
-# define TMC_tpitch_SHIFT 16
-# define TMC_owalpha_MASK 0xffbfffff /* bit 22 */
-# define TMC_owalpha_disable 0x0
-# define TMC_owalpha_enable 0x400000
-# define TMC_azeroextend_MASK 0xff7fffff /* bit 23 */
-# define TMC_azeroextend_disable 0x0
-# define TMC_azeroextend_enable 0x800000
-# define TMC_decalckey_MASK 0xfeffffff /* bit 24 */
-# define TMC_decalckey_disable 0x0
-# define TMC_decalckey_enable 0x1000000
-# define TMC_takey_MASK 0xfdffffff /* bit 25 */
-# define TMC_takey_0 0x0
-# define TMC_takey_1 0x2000000
-# define TMC_tamask_MASK 0xfbffffff /* bit 26 */
-# define TMC_tamask_0 0x0
-# define TMC_tamask_1 0x4000000
-# define TMC_clampv_MASK 0xf7ffffff /* bit 27 */
-# define TMC_clampv_disable 0x0
-# define TMC_clampv_enable 0x8000000
-# define TMC_clampu_MASK 0xefffffff /* bit 28 */
-# define TMC_clampu_disable 0x0
-# define TMC_clampu_enable 0x10000000
-# define TMC_tmodulate_MASK 0xdfffffff /* bit 29 */
-# define TMC_tmodulate_disable 0x0
-# define TMC_tmodulate_enable 0x20000000
-# define TMC_strans_MASK 0xbfffffff /* bit 30 */
-# define TMC_strans_disable 0x0
-# define TMC_strans_enable 0x40000000
-# define TMC_itrans_MASK 0x7fffffff /* bit 31 */
-# define TMC_itrans_disable 0x0
-# define TMC_itrans_enable 0x80000000
-
-#define MGAREG_TEXCTL2 0x2c3c
-
-# define TMC_decalblend_MASK 0xfffffffe /* bit 0 */
-# define TMC_decalblend_disable 0x0
-# define TMC_decalblend_enable 0x1
-# define TMC_idecal_MASK 0xfffffffd /* bit 1 */
-# define TMC_idecal_disable 0x0
-# define TMC_idecal_enable 0x2
-# define TMC_decaldis_MASK 0xfffffffb /* bit 2 */
-# define TMC_decaldis_disable 0x0
-# define TMC_decaldis_enable 0x4
-# define TMC_ckstransdis_MASK 0xffffffef /* bit 4 */
-# define TMC_ckstransdis_disable 0x0
-# define TMC_ckstransdis_enable 0x10
-# define TMC_borderen_MASK 0xffffffdf /* bit 5 */
-# define TMC_borderen_disable 0x0
-# define TMC_borderen_enable 0x20
-# define TMC_specen_MASK 0xffffffbf /* bit 6 */
-# define TMC_specen_disable 0x0
-# define TMC_specen_enable 0x40
-# define TMC_dualtex_MASK 0xffffff7f /* bit 7 */
-# define TMC_dualtex_disable 0x0
-# define TMC_dualtex_enable 0x80
-# define TMC_tablefog_MASK 0xfffffeff /* bit 8 */
-# define TMC_tablefog_disable 0x0
-# define TMC_tablefog_enable 0x100
-# define TMC_bumpmap_MASK 0xfffffdff /* bit 9 */
-# define TMC_bumpmap_disable 0x0
-# define TMC_bumpmap_enable 0x200
-# define TMC_map1_MASK 0x7fffffff /* bit 31 */
-# define TMC_map1_disable 0x0
-# define TMC_map1_enable 0x80000000
-
-#define MGAREG_TEXFILTER 0x2c58
-
-# define TF_minfilter_MASK 0xfffffff0 /* bits 0-3 */
-# define TF_minfilter_nrst 0x0 /* val 0, shift 0 */
-# define TF_minfilter_bilin 0x2 /* val 2, shift 0 */
-# define TF_minfilter_cnst 0x3 /* val 3, shift 0 */
-# define TF_minfilter_mm1s 0x8 /* val 8, shift 0 */
-# define TF_minfilter_mm2s 0x9 /* val 9, shift 0 */
-# define TF_minfilter_mm4s 0xa /* val 10, shift 0 */
-# define TF_minfilter_mm8s 0xc /* val 12, shift 0 */
-# define TF_magfilter_MASK 0xffffff0f /* bits 4-7 */
-# define TF_magfilter_nrst 0x0 /* val 0, shift 4 */
-# define TF_magfilter_bilin 0x20 /* val 2, shift 4 */
-# define TF_magfilter_cnst 0x30 /* val 3, shift 4 */
-# define TF_uvoffset_SHIFT 17
-# define TF_uvoffset_OGL (0U << TF_uvoffset_SHIFT)
-# define TF_uvoffset_D3D (1U << TF_uvoffset_SHIFT)
-# define TF_uvoffset_MASK (~(1U << TF_uvoffset_SHIFT))
-# define TF_reserved_MASK (~0x1ff00) /* bits 8-16 */
-# define TF_mapnbhigh_SHIFT 18
-# define TF_mapnbhigh_MASK (~(1U << TF_mapnbhigh_SHIFT))
-# define TF_avgstride_MASK 0xfff7ffff /* bit 19 */
-# define TF_avgstride_disable 0x0
-# define TF_avgstride_enable 0x80000
-# define TF_filteralpha_MASK 0xffefffff /* bit 20 */
-# define TF_filteralpha_disable 0x0
-# define TF_filteralpha_enable 0x100000
-# define TF_fthres_MASK 0xe01fffff /* bits 21-28 */
-# define TF_fthres_SHIFT 21
-# define TF_mapnb_MASK 0x1fffffff /* bits 29-31 */
-# define TF_mapnb_SHIFT 29
-
-#define MGAREG_TEXHEIGHT 0x2c2c
-
-# define TH_th_MASK 0xffffffc0 /* bits 0-5 */
-# define TH_th_SHIFT 0
-# define TH_rfh_MASK 0xffff81ff /* bits 9-14 */
-# define TH_rfh_SHIFT 9
-# define TH_thmask_MASK 0xe003ffff /* bits 18-28 */
-# define TH_thmask_SHIFT 18
-
-#define MGAREG_TEXORG 0x2c24
-
-# define TO_texorgmap_MASK 0xfffffffe /* bit 0 */
-# define TO_texorgmap_fb 0x0
-# define TO_texorgmap_sys 0x1
-# define TO_texorgacc_MASK 0xfffffffd /* bit 1 */
-# define TO_texorgacc_pci 0x0
-# define TO_texorgacc_agp 0x2
-# define TO_texorgoffsetsel 0x4
-# define TO_texorg_MASK 0x1f /* bits 5-31 */
-# define TO_texorg_SHIFT 5
-
-#define MGAREG_TEXORG1 0x2ca4
-#define MGAREG_TEXORG2 0x2ca8
-#define MGAREG_TEXORG3 0x2cac
-#define MGAREG_TEXORG4 0x2cb0
-#define MGAREG_TEXTRANS 0x2c34
-
-# define TT_tckey_MASK 0xffff0000 /* bits 0-15 */
-# define TT_tckey_SHIFT 0
-# define TT_tkmask_MASK 0xffff /* bits 16-31 */
-# define TT_tkmask_SHIFT 16
-
-#define MGAREG_TEXTRANSHIGH 0x2c38
-
-# define TT_tckeyh_MASK 0xffff0000 /* bits 0-15 */
-# define TT_tckeyh_SHIFT 0
-# define TT_tkmaskh_MASK 0xffff /* bits 16-31 */
-# define TT_tkmaskh_SHIFT 16
-
-#define MGAREG_TEXWIDTH 0x2c28
-
-# define TW_tw_MASK 0xffffffc0 /* bits 0-5 */
-# define TW_tw_SHIFT 0
-# define TW_rfw_MASK 0xffff81ff /* bits 9-14 */
-# define TW_rfw_SHIFT 9
-# define TW_twmask_MASK 0xe003ffff /* bits 18-28 */
-# define TW_twmask_SHIFT 18
-
-#define MGAREG_TMR0 0x2c00
-#define MGAREG_TMR1 0x2c04
-#define MGAREG_TMR2 0x2c08
-#define MGAREG_TMR3 0x2c0c
-#define MGAREG_TMR4 0x2c10
-#define MGAREG_TMR5 0x2c14
-#define MGAREG_TMR6 0x2c18
-#define MGAREG_TMR7 0x2c1c
-#define MGAREG_TMR8 0x2c20
-#define MGAREG_VBIADDR0 0x3e08
-#define MGAREG_VBIADDR1 0x3e0c
-#define MGAREG_VCOUNT 0x1e20
-#define MGAREG_WACCEPTSEQ 0x1dd4
-
-# define WAS_seqdst0_MASK 0xffffffc0 /* bits 0-5 */
-# define WAS_seqdst0_SHIFT 0
-# define WAS_seqdst1_MASK 0xfffff03f /* bits 6-11 */
-# define WAS_seqdst1_SHIFT 6
-# define WAS_seqdst2_MASK 0xfffc0fff /* bits 12-17 */
-# define WAS_seqdst2_SHIFT 12
-# define WAS_seqdst3_MASK 0xff03ffff /* bits 18-23 */
-# define WAS_seqdst3_SHIFT 18
-# define WAS_seqlen_MASK 0xfcffffff /* bits 24-25 */
-# define WAS_wfirsttag_MASK 0xfbffffff /* bit 26 */
-# define WAS_wfirsttag_disable 0x0
-# define WAS_wfirsttag_enable 0x4000000
-# define WAS_wsametag_MASK 0xf7ffffff /* bit 27 */
-# define WAS_wsametag_disable 0x0
-# define WAS_wsametag_enable 0x8000000
-# define WAS_seqoff_MASK 0xefffffff /* bit 28 */
-# define WAS_seqoff_disable 0x0
-# define WAS_seqoff_enable 0x10000000
-
-#define MGAREG_WCODEADDR 0x1e6c
-
-# define WMA_wcodeaddr_MASK 0xff /* bits 8-31 */
-# define WMA_wcodeaddr_SHIFT 8
-
-#define MGAREG_WFLAG 0x1dc4
-
-# define WF_walustsflag_MASK 0xffffff00 /* bits 0-7 */
-# define WF_walustsflag_SHIFT 0
-# define WF_walucfgflag_MASK 0xffff00ff /* bits 8-15 */
-# define WF_walucfgflag_SHIFT 8
-# define WF_wprgflag_MASK 0xffff /* bits 16-31 */
-# define WF_wprgflag_SHIFT 16
-
-#define MGAREG_WFLAG1 0x1de0
-
-# define WF1_walustsflag1_MASK 0xffffff00 /* bits 0-7 */
-# define WF1_walustsflag1_SHIFT 0
-# define WF1_walucfgflag1_MASK 0xffff00ff /* bits 8-15 */
-# define WF1_walucfgflag1_SHIFT 8
-# define WF1_wprgflag1_MASK 0xffff /* bits 16-31 */
-# define WF1_wprgflag1_SHIFT 16
-
-#define MGAREG_WFLAGNB 0x1e64
-#define MGAREG_WFLAGNB1 0x1e08
-#define MGAREG_WGETMSB 0x1dc8
-
-# define WGV_wgetmsbmin_MASK 0xffffffe0 /* bits 0-4 */
-# define WGV_wgetmsbmin_SHIFT 0
-# define WGV_wgetmsbmax_MASK 0xffffe0ff /* bits 8-12 */
-# define WGV_wgetmsbmax_SHIFT 8
-# define WGV_wbrklefttop_MASK 0xfffeffff /* bit 16 */
-# define WGV_wbrklefttop_disable 0x0
-# define WGV_wbrklefttop_enable 0x10000
-# define WGV_wfastcrop_MASK 0xfffdffff /* bit 17 */
-# define WGV_wfastcrop_disable 0x0
-# define WGV_wfastcrop_enable 0x20000
-# define WGV_wcentersnap_MASK 0xfffbffff /* bit 18 */
-# define WGV_wcentersnap_disable 0x0
-# define WGV_wcentersnap_enable 0x40000
-# define WGV_wbrkrighttop_MASK 0xfff7ffff /* bit 19 */
-# define WGV_wbrkrighttop_disable 0x0
-# define WGV_wbrkrighttop_enable 0x80000
-
-#define MGAREG_WIADDR 0x1dc0
-
-# define WIA_wmode_MASK 0xfffffffc /* bits 0-1 */
-# define WIA_wmode_suspend 0x0 /* val 0, shift 0 */
-# define WIA_wmode_resume 0x1 /* val 1, shift 0 */
-# define WIA_wmode_jump 0x2 /* val 2, shift 0 */
-# define WIA_wmode_start 0x3 /* val 3, shift 0 */
-# define WIA_wagp_MASK 0xfffffffb /* bit 2 */
-# define WIA_wagp_pci 0x0
-# define WIA_wagp_agp 0x4
-# define WIA_wiaddr_MASK 0x7 /* bits 3-31 */
-# define WIA_wiaddr_SHIFT 3
-
-#define MGAREG_WIADDR2 0x1dd8
-
-# define WIA2_wmode_MASK 0xfffffffc /* bits 0-1 */
-# define WIA2_wmode_suspend 0x0 /* val 0, shift 0 */
-# define WIA2_wmode_resume 0x1 /* val 1, shift 0 */
-# define WIA2_wmode_jump 0x2 /* val 2, shift 0 */
-# define WIA2_wmode_start 0x3 /* val 3, shift 0 */
-# define WIA2_wagp_MASK 0xfffffffb /* bit 2 */
-# define WIA2_wagp_pci 0x0
-# define WIA2_wagp_agp 0x4
-# define WIA2_wiaddr_MASK 0x7 /* bits 3-31 */
-# define WIA2_wiaddr_SHIFT 3
-
-#define MGAREG_WIADDRNB 0x1e60
-#define MGAREG_WIADDRNB1 0x1e04
-#define MGAREG_WIADDRNB2 0x1e00
-#define MGAREG_WIMEMADDR 0x1e68
-
-# define WIMA_wimemaddr_MASK 0xffffff00 /* bits 0-7 */
-# define WIMA_wimemaddr_SHIFT 0
-
-#define MGAREG_WIMEMDATA 0x2000
-#define MGAREG_WIMEMDATA1 0x2100
-#define MGAREG_WMISC 0x1e70
-
-# define WM_wucodecache_MASK 0xfffffffe /* bit 0 */
-# define WM_wucodecache_disable 0x0
-# define WM_wucodecache_enable 0x1
-# define WM_wmaster_MASK 0xfffffffd /* bit 1 */
-# define WM_wmaster_disable 0x0
-# define WM_wmaster_enable 0x2
-# define WM_wcacheflush_MASK 0xfffffff7 /* bit 3 */
-# define WM_wcacheflush_disable 0x0
-# define WM_wcacheflush_enable 0x8
-
-#define MGAREG_WR 0x2d00
-#define MGAREG_WVRTXSZ 0x1dcc
-
-# define WVS_wvrtxsz_MASK 0xffffffc0 /* bits 0-5 */
-# define WVS_wvrtxsz_SHIFT 0
-# define WVS_primsz_MASK 0xffffc0ff /* bits 8-13 */
-# define WVS_primsz_SHIFT 8
-
-#define MGAREG_XDST 0x1cb0
-#define MGAREG_XYEND 0x1c44
-
-# define XYEA_x_end_MASK 0xffff0000 /* bits 0-15 */
-# define XYEA_x_end_SHIFT 0
-# define XYEA_y_end_MASK 0xffff /* bits 16-31 */
-# define XYEA_y_end_SHIFT 16
-
-#define MGAREG_XYSTRT 0x1c40
-
-# define XYSA_x_start_MASK 0xffff0000 /* bits 0-15 */
-# define XYSA_x_start_SHIFT 0
-# define XYSA_y_start_MASK 0xffff /* bits 16-31 */
-# define XYSA_y_start_SHIFT 16
-
-#define MGAREG_YBOT 0x1c9c
-#define MGAREG_YDST 0x1c90
-
-# define YA_ydst_MASK 0xff800000 /* bits 0-22 */
-# define YA_ydst_SHIFT 0
-# define YA_sellin_MASK 0x1fffffff /* bits 29-31 */
-# define YA_sellin_SHIFT 29
-
-#define MGAREG_YDSTLEN 0x1c88
-
-# define YDL_length_MASK 0xffff0000 /* bits 0-15 */
-# define YDL_length_SHIFT 0
-# define YDL_yval_MASK 0xffff /* bits 16-31 */
-# define YDL_yval_SHIFT 16
-
-#define MGAREG_YDSTORG 0x1c94
-#define MGAREG_YTOP 0x1c98
-#define MGAREG_ZORG 0x1c0c
-
-# define ZO_zorgmap_MASK 0xfffffffe /* bit 0 */
-# define ZO_zorgmap_fb 0x0
-# define ZO_zorgmap_sys 0x1
-# define ZO_zorgacc_MASK 0xfffffffd /* bit 1 */
-# define ZO_zorgacc_pci 0x0
-# define ZO_zorgacc_agp 0x2
-# define ZO_zorg_MASK 0x3 /* bits 2-31 */
-# define ZO_zorg_SHIFT 2
-
-
-
-
-/**************** (END) AUTOMATICLY GENERATED REGISTER FILE ******************/
-
-/* Copied from mga_drv.h kernel file.
- */
-
-#define MGA_ILOAD_ALIGN 64
-#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1)
-
-#endif /* _MGAREGS_H_ */
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgarender.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgarender.c
deleted file mode 100644
index 3080cea79..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgarender.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgarender.c,v 1.4 2002/10/30 12:51:36 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
-ATI, 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Simulate missing primitives with indexed vertices.
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "mgacontext.h"
-#include "mgatris.h"
-#include "mgastate.h"
-#include "mgaioctl.h"
-#include "mgavb.h"
-
-#define HAVE_POINTS 0
-#define HAVE_LINES 0
-#define HAVE_LINE_STRIPS 0
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 0
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0 /* for now */
-
-static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint hwprim;
-
- switch (prim) {
- case GL_TRIANGLES:
- hwprim = MGA_WA_TRIANGLES;
- break;
- case GL_TRIANGLE_STRIP:
- if (mmesa->vertex_size == 8)
- hwprim = MGA_WA_TRISTRIP_T0;
- else
- hwprim = MGA_WA_TRISTRIP_T0T1;
- break;
- case GL_TRIANGLE_FAN:
- if (mmesa->vertex_size == 8)
- hwprim = MGA_WA_TRIFAN_T0;
- else
- hwprim = MGA_WA_TRIFAN_T0T1;
- break;
- default:
- return;
- }
-
- mgaRasterPrimitive( ctx, GL_TRIANGLES, hwprim );
-}
-
-
-#define LOCAL_VARS mgaContextPtr mmesa = MGA_CONTEXT(ctx)
-#define INIT( prim ) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- FLUSH_BATCH(mmesa); \
- mgaDmaPrimitive( ctx, prim ); \
-} while (0)
-#define FLUSH() FLUSH_BATCH( mmesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- 0 /* fix me */
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- MGA_BUFFER_SIZE / (mmesa->vertex_size * 4)
-
-
-#define ALLOC_VERTS( nr ) \
- mgaAllocDmaLow( mmesa, (nr) * mmesa->vertex_size * 4)
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- mga_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
-
-
-#define TAG(x) mga_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean mga_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- /* Don't handle clipping or indexed vertices or vertex manipulations.
- */
- if (mmesa->RenderIndex != 0 ||
- !mga_validate_render( ctx, VB )) {
- return GL_TRUE;
- }
-
- tnl->Driver.Render.Start( ctx );
- mmesa->SetupNewInputs = ~0;
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- mga_render_tab_verts[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 _mga_render_stage =
-{
- "mga render",
- NULL,
- NULL,
- NULL,
- NULL,
- mga_run_render /* run */
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.c
deleted file mode 100644
index c62b1c875..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.c,v 1.11 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "mtypes.h"
-#include "mgadd.h"
-#include "mgacontext.h"
-#include "mgaspan.h"
-#include "mgaioctl.h"
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
- __DRIscreenPrivate *sPriv = mmesa->driScreen; \
- GLuint pitch = mgaScreen->frontPitch; \
- GLuint height = dPriv->h; \
- char *read_buf = (char *)(sPriv->pFB + \
- mmesa->readOffset + \
- dPriv->x * mgaScreen->cpp + \
- dPriv->y * pitch); \
- char *buf = (char *)(sPriv->pFB + \
- mmesa->drawOffset + \
- dPriv->x * mgaScreen->cpp + \
- dPriv->y * pitch); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-
-
-#define LOCAL_DEPTH_VARS \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
- __DRIscreenPrivate *sPriv = mmesa->driScreen; \
- GLuint pitch = mgaScreen->frontPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- mgaScreen->depthOffset + \
- dPriv->x * mgaScreen->cpp + \
- dPriv->y * pitch)
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define HW_LOCK()
-
-/* FIXME could/should we use dPriv->numClipRects like the other drivers? */
-#define HW_CLIPLOOP() \
- do { \
- int _nc = mmesa->numClipRects; \
- while (_nc--) { \
- int minx = mmesa->pClipRects[_nc].x1 - mmesa->drawX; \
- int miny = mmesa->pClipRects[_nc].y1 - mmesa->drawY; \
- int maxx = mmesa->pClipRects[_nc].x2 - mmesa->drawX; \
- int maxy = mmesa->pClipRects[_nc].y2 - mmesa->drawY;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK()
-
-
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) mga##x##_565
-#define TAG2(x,y) mga##x##_565##y
-#include "spantmp2.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) mga##x##_8888
-#define TAG2(x,y) mga##x##_8888##y
-#include "spantmp2.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#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) mga##x##_16
-#include "depthtmp.h"
-
-
-
-
-/* 32 bit depthbuffer functions.
- */
-#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) mga##x##_32
-#include "depthtmp.h"
-
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
- tmp &= 0xff; \
- tmp |= (d) << 8; \
- *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) { \
- d = (*(GLuint *)(buf + (_x)*4 + (_y)*pitch) & ~0xff) >> 8; \
-}
-
-#define TAG(x) mga##x##_24_8
-#include "depthtmp.h"
-
-#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) mga##x##_24_8
-#include "stenciltmp.h"
-
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- unsigned int offset;
-
- assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT));
-
- offset = (bufferBit == BUFFER_BIT_FRONT_LEFT)
- ? mmesa->mgaScreen->frontOffset
- : mmesa->mgaScreen->backOffset;
-
- mmesa->drawOffset = offset;
- mmesa->readOffset = offset;
-
- assert( (buffer == mmesa->driDrawable->driverPrivate)
- || (buffer == mmesa->driReadable->driverPrivate) );
-
- mmesa->mesa_drawable = (buffer == mmesa->driDrawable->driverPrivate)
- ? mmesa->driDrawable : mmesa->driReadable;
-}
-
-void mgaSpanRenderStart( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- FLUSH_BATCH( mmesa );
- LOCK_HARDWARE_QUIESCENT( mmesa );
-}
-
-void mgaSpanRenderFinish( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( mmesa );
-}
-
-/**
- * Initialize the driver callbacks for the read / write span functions.
- *
- * \bug
- * To really support RGB888 and RGBA8888 visuals, we need separate read and
- * write routines for 888 and 8888. We also need to determine whether or not
- * the visual has destination alpha.
- */
-void mgaDDInitSpanFuncs( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = mgaDDSetBuffer;
-
- switch (mmesa->mgaScreen->cpp) {
- case 2:
-#if 0
- mgaInitPointers_565( swdd );
- swdd->ReadDepthSpan = mgaReadDepthSpan_16;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_16;
- swdd->ReadDepthPixels = mgaReadDepthPixels_16;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_16;
-#endif
- break;
-
- case 4:
-#if 0
- mgaInitPointers_8888( swdd );
-
- if (!mmesa->hw_stencil) {
- swdd->ReadDepthSpan = mgaReadDepthSpan_32;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_32;
- swdd->ReadDepthPixels = mgaReadDepthPixels_32;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_32;
- } else {
- swdd->ReadDepthSpan = mgaReadDepthSpan_24_8;
- swdd->WriteDepthSpan = mgaWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = mgaReadDepthPixels_24_8;
- swdd->WriteDepthPixels = mgaWriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = mgaReadStencilSpan_24_8;
- swdd->WriteStencilSpan = mgaWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = mgaReadStencilPixels_24_8;
- swdd->WriteStencilPixels = mgaWriteStencilPixels_24_8;
- }
-#endif
- break;
- }
- swdd->SpanRenderStart = mgaSpanRenderStart;
- swdd->SpanRenderFinish = mgaSpanRenderFinish;
-}
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- mgaInitPointers_565(&drb->Base);
- }
- else {
- mgaInitPointers_8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = mgaReadDepthSpan_16;
- drb->Base.GetValues = mgaReadDepthPixels_16;
- drb->Base.PutRow = mgaWriteDepthSpan_16;
- drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_16;
- drb->Base.PutValues = mgaWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = mgaReadDepthSpan_24_8;
- drb->Base.GetValues = mgaReadDepthPixels_24_8;
- drb->Base.PutRow = mgaWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = mgaWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
- drb->Base.GetRow = mgaReadDepthSpan_32;
- drb->Base.GetValues = mgaReadDepthPixels_32;
- drb->Base.PutRow = mgaWriteDepthSpan_32;
- drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_32;
- drb->Base.PutValues = mgaWriteDepthPixels_32;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = mgaReadStencilSpan_24_8;
- drb->Base.GetValues = mgaReadStencilPixels_24_8;
- drb->Base.PutRow = mgaWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = mgaWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = mgaWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.h
deleted file mode 100644
index f133a51c0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgaspan.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.h,v 1.3 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-
-#ifndef _MGA_SPAN_H
-#define _MGA_SPAN_H
-
-#include "drirenderbuffer.h"
-
-extern void mgaDDInitSpanFuncs( GLcontext *ctx );
-
-extern void
-mgaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.c
deleted file mode 100644
index 72d5c9fb0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.c
+++ /dev/null
@@ -1,1237 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.13 2002/10/30 12:51:36 alanh Exp $ */
-
-
-#include "mtypes.h"
-#include "buffers.h"
-#include "colormac.h"
-#include "dd.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgadd.h"
-#include "mgastate.h"
-#include "mgatex.h"
-#include "mgavb.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-#include "mgaregs.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "xmlpool.h"
-
-static void updateSpecularLighting( GLcontext *ctx );
-
-static const GLuint mgarop_NoBLK[16] = {
- DC_atype_rpl | 0x00000000, DC_atype_rstr | 0x00080000,
- DC_atype_rstr | 0x00040000, DC_atype_rpl | 0x000c0000,
- DC_atype_rstr | 0x00020000, DC_atype_rstr | 0x000a0000,
- DC_atype_rstr | 0x00060000, DC_atype_rstr | 0x000e0000,
- DC_atype_rstr | 0x00010000, DC_atype_rstr | 0x00090000,
- DC_atype_rstr | 0x00050000, DC_atype_rstr | 0x000d0000,
- DC_atype_rpl | 0x00030000, DC_atype_rstr | 0x000b0000,
- DC_atype_rstr | 0x00070000, DC_atype_rpl | 0x000f0000
-};
-
-/* =============================================================
- * Alpha blending
- */
-
-static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLubyte refByte;
- GLuint a;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- switch ( func ) {
- case GL_NEVER:
- a = AC_atmode_alt;
- refByte = 0;
- break;
- case GL_LESS:
- a = AC_atmode_alt;
- break;
- case GL_GEQUAL:
- a = AC_atmode_agte;
- break;
- case GL_LEQUAL:
- a = AC_atmode_alte;
- break;
- case GL_GREATER:
- a = AC_atmode_agt;
- break;
- case GL_NOTEQUAL:
- a = AC_atmode_ane;
- break;
- case GL_EQUAL:
- a = AC_atmode_ae;
- break;
- case GL_ALWAYS:
- a = AC_atmode_noacmp;
- break;
- default:
- a = 0;
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.alpha_func = a | MGA_FIELD( AC_atref, refByte );
-}
-
-static void updateBlendLogicOp(GLcontext *ctx)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
-
- mmesa->hw.blend_func_enable =
- (ctx->Color.BlendEnabled && !ctx->Color._LogicOpEnabled) ? ~0 : 0;
-
- FALLBACK( ctx, MGA_FALLBACK_BLEND,
- ctx->Color.BlendEnabled && !ctx->Color._LogicOpEnabled &&
- mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
-}
-
-static void mgaDDBlendEquationSeparate(GLcontext *ctx,
- GLenum modeRGB, GLenum modeA)
-{
- assert( modeRGB == modeA );
- updateBlendLogicOp( ctx );
-}
-
-static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint src;
- GLuint dst;
-
- switch (ctx->Color.BlendSrcRGB) {
- case GL_ZERO:
- src = AC_src_zero; break;
- case GL_SRC_ALPHA:
- src = AC_src_src_alpha; break;
- case GL_ONE:
- default: /* never happens */
- src = AC_src_one; break;
- case GL_DST_COLOR:
- src = AC_src_dst_color; break;
- case GL_ONE_MINUS_DST_COLOR:
- src = AC_src_om_dst_color; break;
- case GL_ONE_MINUS_SRC_ALPHA:
- src = AC_src_om_src_alpha; break;
- case GL_DST_ALPHA:
- src = (ctx->Visual.alphaBits > 0)
- ? AC_src_dst_alpha : AC_src_one;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- src = (ctx->Visual.alphaBits > 0)
- ? AC_src_om_dst_alpha : AC_src_zero;
- break;
- case GL_SRC_ALPHA_SATURATE:
- src = (ctx->Visual.alphaBits > 0)
- ? AC_src_src_alpha_sat : AC_src_zero;
- break;
- }
-
- switch (ctx->Color.BlendDstRGB) {
- case GL_SRC_ALPHA:
- dst = AC_dst_src_alpha; break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dst = AC_dst_om_src_alpha; break;
- default: /* never happens */
- case GL_ZERO:
- dst = AC_dst_zero; break;
- case GL_ONE:
- dst = AC_dst_one; break;
- case GL_SRC_COLOR:
- dst = AC_dst_src_color; break;
- case GL_ONE_MINUS_SRC_COLOR:
- dst = AC_dst_om_src_color; break;
- case GL_DST_ALPHA:
- dst = (ctx->Visual.alphaBits > 0)
- ? AC_dst_dst_alpha : AC_dst_one;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dst = (ctx->Visual.alphaBits > 0)
- ? AC_dst_om_dst_alpha : AC_dst_zero;
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.blend_func = (src | dst);
-
- FALLBACK( ctx, MGA_FALLBACK_BLEND,
- ctx->Color.BlendEnabled && !ctx->Color._LogicOpEnabled &&
- mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void mgaDDDepthFunc(GLcontext *ctx, GLenum func)
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- int zmode;
-
- switch (func) {
- case GL_NEVER:
- /* can't do this in h/w, we'll use a s/w fallback */
- FALLBACK (ctx, MGA_FALLBACK_DEPTH, ctx->Depth.Test);
-
- /* FALLTHROUGH */
- case GL_ALWAYS:
- zmode = DC_zmode_nozcmp; break;
- case GL_LESS:
- zmode = DC_zmode_zlt; break;
- case GL_LEQUAL:
- zmode = DC_zmode_zlte; break;
- case GL_EQUAL:
- zmode = DC_zmode_ze; break;
- case GL_GREATER:
- zmode = DC_zmode_zgt; break;
- case GL_GEQUAL:
- zmode = DC_zmode_zgte; break;
- case GL_NOTEQUAL:
- zmode = DC_zmode_zne; break;
- default:
- zmode = 0; break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.zmode &= DC_zmode_MASK;
- mmesa->hw.zmode |= zmode;
-}
-
-static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag)
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.zmode &= DC_atype_MASK;
- mmesa->hw.zmode |= (flag) ? DC_atype_zi : DC_atype_i;
-}
-
-
-static void mgaDDClearDepth(GLcontext *ctx, GLclampd d)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- /* Select the Z depth. The ~ is used because the _MASK values in the
- * MGA driver are used to mask OFF the selected bits. In this case,
- * we want to mask off everything except the MA_zwidth bits.
- */
- switch (mmesa->setup.maccess & ~MA_zwidth_MASK) {
- case MA_zwidth_16: mmesa->ClearDepth = d * 0x0000ffff; break;
- case MA_zwidth_24: mmesa->ClearDepth = d * 0xffffff00; break;
- case MA_zwidth_32: mmesa->ClearDepth = d * 0xffffffff; break;
- default: return;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = PACK_COLOR_888((GLubyte)(ctx->Fog.Color[0]*255.0F),
- (GLubyte)(ctx->Fog.Color[1]*255.0F),
- (GLubyte)(ctx->Fog.Color[2]*255.0F));
-
- MGA_STATECHANGE(mmesa, MGA_UPLOAD_CONTEXT);
- mmesa->setup.fogcolor = color;
- }
-}
-
-
-/* =============================================================
- * Scissoring
- */
-
-
-void mgaUpdateClipping(const GLcontext *ctx)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if (mmesa->driDrawable)
- {
- int x1 = mmesa->driDrawable->x + ctx->Scissor.X;
- int y1 = mmesa->driDrawable->y + mmesa->driDrawable->h
- - (ctx->Scissor.Y + ctx->Scissor.Height);
- int x2 = x1 + ctx->Scissor.Width;
- int y2 = y1 + ctx->Scissor.Height;
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 < 0) x2 = 0;
- if (y2 < 0) y2 = 0;
-
- mmesa->scissor_rect.x1 = x1;
- mmesa->scissor_rect.y1 = y1;
- mmesa->scissor_rect.x2 = x2;
- mmesa->scissor_rect.y2 = y2;
-
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
- }
-}
-
-
-static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h )
-{
- if ( ctx->Scissor.Enabled ) {
- FLUSH_BATCH( MGA_CONTEXT(ctx) ); /* don't pipeline cliprect changes */
- mgaUpdateClipping( ctx );
- }
-}
-
-
-/* =============================================================
- * Culling
- */
-
-
-#define _CULL_DISABLE 0
-#define _CULL_NEGATIVE ((1<<11)|(1<<5)|(1<<16))
-#define _CULL_POSITIVE (1<<11)
-
-static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (ctx->Polygon.CullFlag &&
- ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK)
- {
- mmesa->hw.cull = _CULL_NEGATIVE;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mmesa->hw.cull ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
-
- if (ctx->Polygon.FrontFace != GL_CCW)
- mmesa->hw.cull ^= (_CULL_POSITIVE ^ _CULL_NEGATIVE);
-
- mmesa->hw.cull_dualtex = mmesa->hw.cull ^
- (_CULL_POSITIVE ^ _CULL_NEGATIVE); /* warp bug? */
- }
- else {
- mmesa->hw.cull = _CULL_DISABLE;
- mmesa->hw.cull_dualtex = _CULL_DISABLE;
- }
-}
-
-
-/* =============================================================
- * Masks
- */
-
-static void mgaDDColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen;
-
-
- GLuint mask = mgaPackColor(mgaScreen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- if (mgaScreen->cpp == 2)
- mask = mask | (mask << 16);
-
- if (mmesa->setup.plnwt != mask) {
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->setup.plnwt = mask;
- }
-}
-
-
-/* =============================================================
- * Polygon state
- */
-
-static int mgaStipples[16] = {
- 0xffff,
- 0xa5a5,
- 0x5a5a,
- 0xa0a0,
- 0x5050,
- 0x0a0a,
- 0x0505,
- 0x8020,
- 0x0401,
- 0x1040,
- 0x0208,
- 0x0802,
- 0x4010,
- 0x0104,
- 0x2080,
- 0x0000
-};
-
-/**
- * The MGA supports a subset of possible 4x4 stipples natively, GL
- * wants 32x32. Fortunately stipple is usually a repeating pattern.
- *
- * \param ctx GL rendering context to be affected
- * \param mask Pointer to the 32x32 stipple mask
- */
-
-static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- mmesa->raster_primitive == GL_TRIANGLES);
- GLuint stipple;
-
- FLUSH_BATCH(mmesa);
- mmesa->haveHwStipple = 0;
-
- if (active) {
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mmesa->setup.dwgctl &= ~(0xf<<20);
- }
-
- p[0] = mask[0] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[4] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[8] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[12] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 0 ; j < 4; j++)
- for (i = 0 ; i < 4 ; i++)
- if (*m++ != p[j]) {
- return;
- }
-
- stipple = ( ((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12) );
-
- for (i = 0 ; i < 16 ; i++)
- if (mgaStipples[i] == stipple) {
- mmesa->poly_stipple = i<<20;
- mmesa->haveHwStipple = 1;
- break;
- }
-
- if (active) {
- mmesa->setup.dwgctl &= ~(0xf<<20);
- mmesa->setup.dwgctl |= mmesa->poly_stipple;
- }
-}
-
-
-/* =============================================================
- * 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.
- */
-
-static void updateSpecularLighting( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- unsigned int specen;
-
- specen = NEED_SECONDARY_COLOR(ctx) ? TMC_specen_enable : 0;
-
- if ( specen != mmesa->hw.specen ) {
- mmesa->hw.specen = specen;
- mmesa->dirty |= MGA_UPLOAD_TEX0 | MGA_UPLOAD_TEX1;
- }
-}
-
-
-/* =============================================================
- * Materials
- */
-
-
-static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- FLUSH_BATCH( MGA_CONTEXT(ctx) );
- updateSpecularLighting( ctx );
- }
-}
-
-
-/* =============================================================
- * Stencil
- */
-
-
-static void mgaDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref,
- GLuint mask)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint stencil;
- GLuint stencilctl;
-
- stencil = MGA_FIELD( S_sref, ref ) | MGA_FIELD( S_smsk, mask );
- switch (func)
- {
- case GL_NEVER:
- stencilctl = SC_smode_snever;
- break;
- case GL_LESS:
- stencilctl = SC_smode_slt;
- break;
- case GL_LEQUAL:
- stencilctl = SC_smode_slte;
- break;
- case GL_GREATER:
- stencilctl = SC_smode_sgt;
- break;
- case GL_GEQUAL:
- stencilctl = SC_smode_sgte;
- break;
- case GL_NOTEQUAL:
- stencilctl = SC_smode_sne;
- break;
- case GL_EQUAL:
- stencilctl = SC_smode_se;
- break;
- case GL_ALWAYS:
- default:
- stencilctl = SC_smode_salways;
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.stencil &= (S_sref_MASK & S_smsk_MASK);
- mmesa->hw.stencil |= stencil;
- mmesa->hw.stencilctl &= SC_smode_MASK;
- mmesa->hw.stencilctl |= stencilctl;
-}
-
-static void mgaDDStencilMask(GLcontext *ctx, GLuint mask)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.stencil &= S_swtmsk_MASK;
- mmesa->hw.stencil |= MGA_FIELD( S_swtmsk, mask );
-}
-
-static void mgaDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint stencilctl;
-
- stencilctl = 0;
- switch (ctx->Stencil.FailFunc[0])
- {
- case GL_KEEP:
- stencilctl |= SC_sfailop_keep;
- break;
- case GL_ZERO:
- stencilctl |= SC_sfailop_zero;
- break;
- case GL_REPLACE:
- stencilctl |= SC_sfailop_replace;
- break;
- case GL_INCR:
- stencilctl |= SC_sfailop_incrsat;
- break;
- case GL_DECR:
- stencilctl |= SC_sfailop_decrsat;
- break;
- case GL_INCR_WRAP:
- stencilctl |= SC_sfailop_incr;
- break;
- case GL_DECR_WRAP:
- stencilctl |= SC_sfailop_decr;
- break;
- case GL_INVERT:
- stencilctl |= SC_sfailop_invert;
- break;
- default:
- break;
- }
-
- switch (ctx->Stencil.ZFailFunc[0])
- {
- case GL_KEEP:
- stencilctl |= SC_szfailop_keep;
- break;
- case GL_ZERO:
- stencilctl |= SC_szfailop_zero;
- break;
- case GL_REPLACE:
- stencilctl |= SC_szfailop_replace;
- break;
- case GL_INCR:
- stencilctl |= SC_szfailop_incrsat;
- break;
- case GL_DECR:
- stencilctl |= SC_szfailop_decrsat;
- break;
- case GL_INCR_WRAP:
- stencilctl |= SC_szfailop_incr;
- break;
- case GL_DECR_WRAP:
- stencilctl |= SC_szfailop_decr;
- break;
- case GL_INVERT:
- stencilctl |= SC_szfailop_invert;
- break;
- default:
- break;
- }
-
- switch (ctx->Stencil.ZPassFunc[0])
- {
- case GL_KEEP:
- stencilctl |= SC_szpassop_keep;
- break;
- case GL_ZERO:
- stencilctl |= SC_szpassop_zero;
- break;
- case GL_REPLACE:
- stencilctl |= SC_szpassop_replace;
- break;
- case GL_INCR:
- stencilctl |= SC_szpassop_incrsat;
- break;
- case GL_DECR:
- stencilctl |= SC_szpassop_decrsat;
- break;
- case GL_INCR_WRAP:
- stencilctl |= SC_szpassop_incr;
- break;
- case GL_DECR_WRAP:
- stencilctl |= SC_szpassop_decr;
- break;
- case GL_INVERT:
- stencilctl |= SC_szpassop_invert;
- break;
- default:
- break;
- }
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.stencilctl &= (SC_sfailop_MASK & SC_szfailop_MASK
- & SC_szpassop_MASK);
- mmesa->hw.stencilctl |= stencilctl;
-}
-
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-void mgaCalcViewport( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = mmesa->hw_viewport;
-
- /* See also mga_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + mmesa->drawX + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + mmesa->driDrawable->h + mmesa->drawY + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * mmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * mmesa->depth_scale;
-
- mmesa->SetupNewInputs = ~0;
-}
-
-static void mgaViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- mgaCalcViewport( ctx );
-}
-
-static void mgaDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- mgaCalcViewport( ctx );
-}
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void mgaDDClearColor(GLcontext *ctx,
- const GLfloat color[4] )
-{
- mgaContextPtr mmesa = MGA_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]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- mmesa->ClearColor = mgaPackColor( mmesa->mgaScreen->cpp,
- c[0], c[1], c[2], c[3]);
-}
-
-
-/* Fallback to swrast for select and feedback.
- */
-static void mgaRenderMode( GLcontext *ctx, GLenum mode )
-{
- FALLBACK( ctx, MGA_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-
-static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.rop = mgarop_NoBLK[ opcode & 0x0f ];
-}
-
-
-static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa )
-{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
-
- if (driDrawable->numClipRects == 0) {
- static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
- mmesa->numClipRects = 1;
- mmesa->pClipRects = &zeroareacliprect;
- } else {
- mmesa->numClipRects = driDrawable->numClipRects;
- mmesa->pClipRects = driDrawable->pClipRects;
- }
- mmesa->drawX = driDrawable->x;
- mmesa->drawY = driDrawable->y;
-
- mmesa->setup.dstorg = mmesa->drawOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
-}
-
-
-static void mgaXMesaSetBackClipRects( mgaContextPtr mmesa )
-{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
-
- if (driDrawable->numBackClipRects == 0)
- {
- if (driDrawable->numClipRects == 0) {
- static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
- mmesa->numClipRects = 1;
- mmesa->pClipRects = &zeroareacliprect;
- } else {
- mmesa->numClipRects = driDrawable->numClipRects;
- mmesa->pClipRects = driDrawable->pClipRects;
- }
- mmesa->drawX = driDrawable->x;
- mmesa->drawY = driDrawable->y;
- } else {
- mmesa->numClipRects = driDrawable->numBackClipRects;
- mmesa->pClipRects = driDrawable->pBackClipRects;
- mmesa->drawX = driDrawable->backX;
- mmesa->drawY = driDrawable->backY;
- }
-
- mmesa->setup.dstorg = mmesa->drawOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT | MGA_UPLOAD_CLIPRECTS;
-}
-
-
-void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
-{
- __DRIdrawablePrivate *driDrawable = mmesa->driDrawable;
- drm_mga_sarea_t *sarea = mmesa->sarea;
-
-
- DRI_VALIDATE_DRAWABLE_INFO(mmesa->driScreen, driDrawable);
- mmesa->dirty_cliprects = 0;
-
- if (mmesa->draw_buffer == MGA_FRONT)
- mgaXMesaSetFrontClipRects( mmesa );
- else
- mgaXMesaSetBackClipRects( mmesa );
-
- sarea->req_drawable = driDrawable->draw;
- sarea->req_draw_buffer = mmesa->draw_buffer;
-
- mgaUpdateClipping( mmesa->glCtx );
- mgaCalcViewport( mmesa->glCtx );
-
- mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
-}
-
-
-static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- FLUSH_BATCH( mmesa );
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mmesa->draw_buffer = MGA_FRONT;
- mgaXMesaSetFrontClipRects( mmesa );
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BUFFER_BIT_BACK_LEFT:
- mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
- mmesa->draw_buffer = MGA_BACK;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mgaXMesaSetBackClipRects( mmesa );
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-
-static void mgaDDReadBuffer(GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-
-/* =============================================================
- * State enable/disable
- */
-
-
-static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- switch(cap) {
- case GL_DITHER:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (!ctx->Color.DitherFlag)
- mmesa->setup.maccess |= MA_nodither_enable;
- else
- mmesa->setup.maccess &= ~MA_nodither_enable;
- break;
- case GL_LIGHTING:
- case GL_COLOR_SUM_EXT:
- FLUSH_BATCH( mmesa );
- updateSpecularLighting( ctx );
- break;
- case GL_ALPHA_TEST:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->hw.alpha_func_enable = (state) ? ~0 : 0;
- break;
- case GL_DEPTH_TEST:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- FALLBACK (ctx, MGA_FALLBACK_DEPTH,
- ctx->Depth.Func == GL_NEVER && ctx->Depth.Test);
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( mmesa );
- mmesa->scissor = state;
- mgaUpdateClipping( ctx );
- break;
-
- case GL_FOG:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (ctx->Fog.Enabled)
- mmesa->setup.maccess |= MA_fogen_enable;
- else
- mmesa->setup.maccess &= ~MA_fogen_enable;
- break;
- case GL_CULL_FACE:
- mgaDDCullFaceFrontFace( ctx, 0 );
- break;
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- break;
- case GL_POLYGON_STIPPLE:
- if (mmesa->haveHwStipple && mmesa->raster_primitive == GL_TRIANGLES) {
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- mmesa->setup.dwgctl &= ~(0xf<<20);
- if (state)
- mmesa->setup.dwgctl |= mmesa->poly_stipple;
- }
- break;
-
- case GL_BLEND:
- case GL_COLOR_LOGIC_OP:
- updateBlendLogicOp( ctx );
- break;
-
- case GL_STENCIL_TEST:
- MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
- if (mmesa->hw_stencil) {
- mmesa->hw.stencil_enable = ( state ) ? ~0 : 0;
- }
- else {
- FALLBACK( ctx, MGA_FALLBACK_STENCIL, state );
- }
- default:
- break;
- }
-}
-
-
-/* =============================================================
- */
-
-static void mgaDDPrintDirty( const char *msg, GLuint state )
-{
- fprintf(stderr, "%s (0x%03x): %s%s%s%s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & MGA_WAIT_AGE) ? "wait-age " : "",
- (state & MGA_UPLOAD_TEX0IMAGE) ? "upload-tex0-img " : "",
- (state & MGA_UPLOAD_TEX1IMAGE) ? "upload-tex1-img " : "",
- (state & MGA_UPLOAD_CONTEXT) ? "upload-ctx " : "",
- (state & MGA_UPLOAD_TEX0) ? "upload-tex0 " : "",
- (state & MGA_UPLOAD_TEX1) ? "upload-tex1 " : "",
- (state & MGA_UPLOAD_PIPE) ? "upload-pipe " : ""
- );
-}
-
-/* Push the state into the sarea and/or texture memory.
- */
-void mgaEmitHwStateLocked( mgaContextPtr mmesa )
-{
- drm_mga_sarea_t *sarea = mmesa->sarea;
- GLcontext * ctx = mmesa->glCtx;
-
- if (MGA_DEBUG & DEBUG_VERBOSE_MSG)
- mgaDDPrintDirty( __FUNCTION__, mmesa->dirty );
-
- if (mmesa->dirty & MGA_UPLOAD_CONTEXT) {
- mmesa->setup.wflag = _CULL_DISABLE;
- if (mmesa->raster_primitive == GL_TRIANGLES) {
- if ((ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT &&
- ctx->Texture.Unit[1]._ReallyEnabled == TEXTURE_2D_BIT)) {
- mmesa->setup.wflag = mmesa->hw.cull_dualtex;
- }
- else {
- mmesa->setup.wflag = mmesa->hw.cull;
- }
- }
-
- mmesa->setup.stencil = mmesa->hw.stencil
- & mmesa->hw.stencil_enable;
- mmesa->setup.stencilctl = mmesa->hw.stencilctl
- & mmesa->hw.stencil_enable;
-
- /* If depth testing is not enabled, then use the no Z-compare / no
- * Z-write mode. Otherwise, use whatever is set in hw.zmode.
- */
- mmesa->setup.dwgctl &= (DC_zmode_MASK & DC_atype_MASK);
- mmesa->setup.dwgctl |= (ctx->Depth.Test)
- ? mmesa->hw.zmode : (DC_zmode_nozcmp | DC_atype_i);
-
- mmesa->setup.dwgctl &= DC_bop_MASK;
- mmesa->setup.dwgctl |= (ctx->Color._LogicOpEnabled)
- ? mmesa->hw.rop : mgarop_NoBLK[ GL_COPY & 0x0f ];
-
- mmesa->setup.alphactrl &= AC_src_MASK & AC_dst_MASK & AC_atmode_MASK
- & AC_atref_MASK & AC_alphasel_MASK;
- mmesa->setup.alphactrl |=
- (mmesa->hw.alpha_func & mmesa->hw.alpha_func_enable) |
- (mmesa->hw.blend_func & mmesa->hw.blend_func_enable) |
- ((AC_src_one | AC_dst_zero) & ~mmesa->hw.blend_func_enable) |
- mmesa->hw.alpha_sel;
-
- memcpy( &sarea->context_state, &mmesa->setup, sizeof(mmesa->setup));
- }
-
- if ((mmesa->dirty & MGA_UPLOAD_TEX0) && mmesa->CurrentTexObj[0]) {
- memcpy(&sarea->tex_state[0],
- &mmesa->CurrentTexObj[0]->setup,
- sizeof(sarea->tex_state[0]));
- }
-
- if ((mmesa->dirty & MGA_UPLOAD_TEX1) && mmesa->CurrentTexObj[1]) {
- memcpy(&sarea->tex_state[1],
- &mmesa->CurrentTexObj[1]->setup,
- sizeof(sarea->tex_state[1]));
- }
-
- if (mmesa->dirty & (MGA_UPLOAD_TEX0 | MGA_UPLOAD_TEX1)) {
- sarea->tex_state[0].texctl2 &= ~TMC_specen_enable;
- sarea->tex_state[1].texctl2 &= ~TMC_specen_enable;
- sarea->tex_state[0].texctl2 |= mmesa->hw.specen;
- sarea->tex_state[1].texctl2 |= mmesa->hw.specen;
- }
-
- if (mmesa->dirty & MGA_UPLOAD_PIPE) {
-/* mmesa->sarea->wacceptseq = mmesa->hw_primitive; */
- mmesa->sarea->warp_pipe = mmesa->vertex_format;
- mmesa->sarea->vertsize = mmesa->vertex_size;
- }
-
- mmesa->sarea->dirty |= mmesa->dirty;
- mmesa->dirty &= MGA_UPLOAD_CLIPRECTS;
-}
-
-/* =============================================================
- */
-
-
-static void mgaDDValidateState( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- FLUSH_BATCH( mmesa );
-
- if (mmesa->NewGLState & _NEW_TEXTURE) {
- mgaUpdateTextureState(ctx);
- }
-
- if (!mmesa->Fallback) {
- if (mmesa->NewGLState & _MGA_NEW_RASTERSETUP) {
- mgaChooseVertexState( ctx );
- }
-
- if (mmesa->NewGLState & _MGA_NEW_RENDERSTATE) {
- mgaChooseRenderState( ctx );
- }
- }
-
- mmesa->NewGLState = 0;
-}
-
-
-static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- MGA_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-
-static void mgaRunPipeline( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- if (mmesa->NewGLState) {
- mgaDDValidateState( ctx );
- }
-
- if (mmesa->dirty) {
- mgaEmitHwStateLocked( mmesa );
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-
-void mgaInitState( mgaContextPtr mmesa )
-{
- mgaScreenPrivate *mgaScreen = mmesa->mgaScreen;
- GLcontext *ctx = mmesa->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- /* use back buffer by default */
- mmesa->draw_buffer = MGA_BACK;
- mmesa->drawOffset = mmesa->mgaScreen->backOffset;
- mmesa->readOffset = mmesa->mgaScreen->backOffset;
- mmesa->setup.dstorg = mgaScreen->backOffset;
- } else {
- /* use front buffer by default */
- mmesa->draw_buffer = MGA_FRONT;
- mmesa->drawOffset = mmesa->mgaScreen->frontOffset;
- mmesa->readOffset = mmesa->mgaScreen->frontOffset;
- mmesa->setup.dstorg = mgaScreen->frontOffset;
- }
-
- mmesa->setup.maccess = (MA_memreset_disable |
- MA_fogen_disable |
- MA_tlutload_disable |
- MA_nodither_disable |
- MA_dit555_disable);
- if (driQueryOptioni (&mmesa->optionCache, "color_reduction") !=
- DRI_CONF_COLOR_REDUCTION_DITHER)
- mmesa->setup.maccess |= MA_nodither_enable;
-
- switch (mmesa->mgaScreen->cpp) {
- case 2:
- mmesa->setup.maccess |= MA_pwidth_16;
- break;
- case 4:
- mmesa->setup.maccess |= MA_pwidth_32;
- break;
- default:
- fprintf( stderr, "Error: unknown cpp %d, exiting...\n",
- mmesa->mgaScreen->cpp );
- exit( 1 );
- }
-
- switch (mmesa->glCtx->Visual.depthBits) {
- case 16:
- mmesa->setup.maccess |= MA_zwidth_16;
- break;
- case 24:
- mmesa->setup.maccess |= MA_zwidth_24;
- break;
- case 32:
- mmesa->setup.maccess |= MA_zwidth_32;
- break;
- }
-
- mmesa->hw.blend_func = AC_src_one | AC_dst_zero;
- mmesa->hw.blend_func_enable = 0;
- mmesa->hw.alpha_func = AC_atmode_noacmp | MGA_FIELD( AC_atref, 0x00 );
- mmesa->hw.alpha_func_enable = 0;
- mmesa->hw.rop = mgarop_NoBLK[ GL_COPY & 0x0f ];
- mmesa->hw.zmode = DC_zmode_zlt | DC_atype_zi;
- mmesa->hw.stencil = MGA_FIELD( S_sref, 0x00) | MGA_FIELD( S_smsk, 0xff ) |
- MGA_FIELD( S_swtmsk, 0xff );
- mmesa->hw.stencilctl = SC_smode_salways | SC_sfailop_keep
- | SC_szfailop_keep | SC_szpassop_keep;
- mmesa->hw.stencil_enable = 0;
- mmesa->hw.cull = _CULL_DISABLE;
- mmesa->hw.cull_dualtex = _CULL_DISABLE;
- mmesa->hw.specen = 0;
- mmesa->hw.alpha_sel = AC_alphasel_diffused;
-
- mmesa->setup.dwgctl = (DC_opcod_trap |
- DC_linear_xy |
- DC_solid_disable |
- DC_arzero_disable |
- DC_sgnzero_disable |
- DC_shftzero_enable |
- MGA_FIELD( DC_bop, 0xC ) |
- MGA_FIELD( DC_trans, 0x0 ) |
- DC_bltmod_bmonolef |
- DC_pattern_disable |
- DC_transc_disable |
- DC_clipdis_disable);
-
- mmesa->setup.plnwt = ~0;
- mmesa->setup.alphactrl = (AC_amode_alpha_channel |
- AC_astipple_disable |
- AC_aten_disable);
-
- mmesa->setup.fogcolor = PACK_COLOR_888((GLubyte)(ctx->Fog.Color[0]*255.0F),
- (GLubyte)(ctx->Fog.Color[1]*255.0F),
- (GLubyte)(ctx->Fog.Color[2]*255.0F));
-
- mmesa->setup.wflag = 0;
- mmesa->setup.tdualstage0 = 0;
- mmesa->setup.tdualstage1 = 0;
- mmesa->setup.fcol = 0;
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
-
- mmesa->envcolor[0] = 0;
- mmesa->envcolor[1] = 0;
-}
-
-
-void mgaDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = mgaDDInvalidateState;
- ctx->Driver.Enable = mgaDDEnable;
- ctx->Driver.LightModelfv = mgaDDLightModelfv;
- ctx->Driver.AlphaFunc = mgaDDAlphaFunc;
- ctx->Driver.BlendEquationSeparate = mgaDDBlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = mgaDDBlendFuncSeparate;
- ctx->Driver.DepthFunc = mgaDDDepthFunc;
- ctx->Driver.DepthMask = mgaDDDepthMask;
- ctx->Driver.Fogfv = mgaDDFogfv;
- ctx->Driver.Scissor = mgaDDScissor;
- ctx->Driver.CullFace = mgaDDCullFaceFrontFace;
- ctx->Driver.FrontFace = mgaDDCullFaceFrontFace;
- ctx->Driver.ColorMask = mgaDDColorMask;
-
- ctx->Driver.DrawBuffer = mgaDDDrawBuffer;
- ctx->Driver.ReadBuffer = mgaDDReadBuffer;
- ctx->Driver.ClearColor = mgaDDClearColor;
- ctx->Driver.ClearDepth = mgaDDClearDepth;
- ctx->Driver.LogicOpcode = mgaDDLogicOp;
-
- ctx->Driver.PolygonStipple = mgaDDPolygonStipple;
-
- ctx->Driver.StencilFunc = mgaDDStencilFunc;
- ctx->Driver.StencilMask = mgaDDStencilMask;
- ctx->Driver.StencilOp = mgaDDStencilOp;
-
- ctx->Driver.DepthRange = mgaDepthRange;
- ctx->Driver.Viewport = mgaViewport;
- ctx->Driver.RenderMode = mgaRenderMode;
-
- ctx->Driver.ClearIndex = 0;
- ctx->Driver.IndexMask = 0;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- TNL_CONTEXT(ctx)->Driver.RunPipeline = mgaRunPipeline;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.h
deleted file mode 100644
index afbe0aaf9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgastate.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.h,v 1.5 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-
-#ifndef _MGA_STATE_H
-#define _MGA_STATE_H
-
-extern void mgaInitState( mgaContextPtr mmesa );
-extern void mgaDDInitStateFuncs(GLcontext *ctx);
-extern void mgaUpdateClipping(const GLcontext *ctx);
-extern void mgaUpdateCull( GLcontext *ctx );
-extern void mgaCalcViewport( GLcontext *ctx );
-extern void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.c
deleted file mode 100644
index 8caa1f858..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.14 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "glheader.h"
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "macros.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "texobj.h"
-
-#include "swrast/swrast.h"
-
-#include "xmlpool.h"
-
-/**
- * Set the texture wrap modes.
- * Currently \c GL_REPEAT, \c GL_CLAMP and \c GL_CLAMP_TO_EDGE are supported.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void
-mgaSetTexWrapping( mgaTextureObjectPtr t, GLenum swrap, GLenum twrap )
-{
- GLboolean is_clamp = GL_FALSE;
- GLboolean is_clamp_to_edge = GL_FALSE;
-
- t->setup.texctl &= (TMC_clampu_MASK & TMC_clampv_MASK);
- t->setup.texctl2 &= (TMC_borderen_MASK);
-
- switch( swrap ) {
- case GL_REPEAT:
- break;
- case GL_CLAMP:
- t->setup.texctl |= TMC_clampu_enable;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.texctl |= TMC_clampu_enable;
- is_clamp_to_edge = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch( twrap ) {
- case GL_REPEAT:
- break;
- case GL_CLAMP:
- t->setup.texctl |= TMC_clampv_enable;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.texctl |= TMC_clampv_enable;
- is_clamp_to_edge = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-
- if ( is_clamp ) {
- t->setup.texctl2 |= TMC_borderen_enable;
- }
-
- t->border_fallback = (is_clamp && is_clamp_to_edge);
-}
-
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- */
-
-static void
-mgaSetTexFilter( mgaTextureObjectPtr t, GLenum minf, GLenum magf )
-{
- GLuint val = 0;
-
- switch (minf) {
- case GL_NEAREST: val = TF_minfilter_nrst; break;
- case GL_LINEAR: val = TF_minfilter_bilin; break;
- case GL_NEAREST_MIPMAP_NEAREST: val = TF_minfilter_mm1s; break;
- case GL_LINEAR_MIPMAP_NEAREST: val = TF_minfilter_mm4s; break;
- case GL_NEAREST_MIPMAP_LINEAR: val = TF_minfilter_mm2s; break;
- case GL_LINEAR_MIPMAP_LINEAR: val = TF_minfilter_mm8s; break;
- default: val = TF_minfilter_nrst; break;
- }
-
- switch (magf) {
- case GL_NEAREST: val |= TF_magfilter_nrst; break;
- case GL_LINEAR: val |= TF_magfilter_bilin; break;
- default: val |= TF_magfilter_nrst; break;
- }
-
- /* See OpenGL 1.2 specification */
- if (magf == GL_LINEAR && (minf == GL_NEAREST_MIPMAP_NEAREST ||
- minf == GL_NEAREST_MIPMAP_LINEAR)) {
- val |= MGA_FIELD( TF_fthres, 0x20 ); /* c = 0.5 */
- } else {
- val |= MGA_FIELD( TF_fthres, 0x10 ); /* c = 0 */
- }
-
-
- /* Mask off the bits for the fields we are setting. Remember, the MGA mask
- * defines have 0s for the bits in the named fields. This is the opposite
- * of most of the other drivers.
- */
-
- t->setup.texfilter &= (TF_minfilter_MASK &
- TF_magfilter_MASK &
- TF_fthres_MASK);
- t->setup.texfilter |= val;
-}
-
-static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4])
-{
- t->setup.texbordercol = PACK_COLOR_8888(color[3], color[0],
- color[1], color[2] );
-}
-
-
-static const struct gl_texture_format *
-mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch ( type ) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch ( type ) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
- default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_rgb565;
-
- 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:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- /* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444;
-
- case GL_YCBCR_MESA:
- if (MGA_IS_G400(mmesa) &&
- (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE))
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- 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_texformat_ci8;
-
- default:
- _mesa_problem( ctx, "unexpected texture format in %s", __FUNCTION__ );
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static mgaTextureObjectPtr
-mgaAllocTexObj( struct gl_texture_object *tObj )
-{
- mgaTextureObjectPtr t;
-
-
- t = CALLOC( sizeof( *t ) );
- tObj->DriverData = t;
- if ( t != NULL ) {
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = tObj;
-
- t->setup.texctl = TMC_takey_1 | TMC_tamask_0;
- t->setup.texctl2 = TMC_ckstransdis_enable;
- t->setup.texfilter = TF_filteralpha_enable | TF_uvoffset_OGL;
-
- t->border_fallback = GL_FALSE;
- t->texenv_fallback = GL_FALSE;
-
- make_empty_list( & t->base );
-
- mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
- mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- mgaSetTexBorderColor( t, tObj->_BorderChan );
- }
-
- return( t );
-}
-
-
-static void mgaTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-
- switch( pname ) {
- case GL_TEXTURE_ENV_COLOR: {
- GLubyte c[4];
-
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
- mmesa->envcolor[unit] = PACK_COLOR_8888( c[3], c[0], c[1], c[2] );
- break;
- }
- }
-}
-
-
-static void mgaTexImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) mgaAllocTexObj( texObj );
- if ( t == NULL ) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glTexImage2D" );
- return;
- }
- }
-
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
- level -= t->firstLevel;
- if (level >= 0)
- t->dirty_images[0] |= (1UL << level);
-}
-
-static void mgaTexSubImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) mgaAllocTexObj( texObj );
- if ( t == NULL ) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glTexImage2D" );
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
- level -= t->firstLevel;
- if (level >= 0)
- t->dirty_images[0] |= (1UL << level);
-}
-
-
-/**
- * Changes variables and flags for a state update, which will happen at the
- * next UpdateTextureState
- */
-
-static void
-mgaTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData;
-
- /* If we don't have a hardware texture, it will be automatically
- * created with current state before it is used, so we don't have
- * to do anything now
- */
- if ( (t == NULL) ||
- (target != GL_TEXTURE_2D &&
- target != GL_TEXTURE_RECTANGLE_NV) ) {
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- driSwapOutTextureObject( (driTextureObject *) t );
- /* FALLTHROUGH */
- case GL_TEXTURE_MAG_FILTER:
- FLUSH_BATCH(mmesa);
- mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- FLUSH_BATCH(mmesa);
- mgaSetTexWrapping(t,tObj->WrapS,tObj->WrapT);
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- FLUSH_BATCH(mmesa);
- mgaSetTexBorderColor(t, tObj->_BorderChan);
- 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. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-}
-
-
-static void
-mgaBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) ||
- (tObj->DriverData != NULL) );
-}
-
-
-static void
-mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
-
- if ( t ) {
- if ( mmesa ) {
- FLUSH_BATCH( mmesa );
- }
-
- driDestroyTextureObject( t );
- }
-}
-
-
-/**
- * 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 *
-mgaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- mgaAllocTexObj( obj );
- return obj;
-}
-
-
-void
-mgaInitTextureFuncs( struct dd_function_table *functions )
-{
- functions->ChooseTextureFormat = mgaChooseTextureFormat;
- functions->TexImage2D = mgaTexImage2D;
- functions->TexSubImage2D = mgaTexSubImage2D;
- functions->BindTexture = mgaBindTexture;
- functions->NewTextureObject = mgaNewTextureObject;
- functions->DeleteTexture = mgaDeleteTexture;
- functions->IsTextureResident = driIsTextureResident;
- functions->TexEnv = mgaTexEnv;
- functions->TexParameter = mgaTexParameter;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.h
deleted file mode 100644
index fb7ffcff1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatex.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.h,v 1.7 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-
-#ifndef MGATEX_INC
-#define MGATEX_INC
-
-#include "mgacontext.h"
-
-typedef struct mga_texture_object_s *mgaTextureObjectPtr;
-
-
-/* Called before a primitive is rendered to make sure the texture
- * state is properly setup. Texture residence is checked later
- * when we grab the lock.
- */
-void mgaUpdateTextureState( GLcontext *ctx );
-
-int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t );
-
-void mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t );
-
-void mgaInitTextureFuncs( struct dd_function_table *functions );
-
-GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatexmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatexmem.c
deleted file mode 100644
index 18743331c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatexmem.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v 1.7 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "glheader.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-#include "mgaioctl.h"
-#include "mga_xmesa.h"
-
-#include "imports.h"
-#include "simple_list.h"
-
-/**
- * Destroy any device-dependent state associated with the texture. This may
- * include NULLing out hardware state that points to the texture.
- */
-void
-mgaDestroyTexObj( mgaContextPtr mmesa, mgaTextureObjectPtr t )
-{
- unsigned i;
-
-
- /* See if it was the driver's current object.
- */
-
- if ( mmesa != NULL )
- {
- if ( t->age > mmesa->dirtyAge )
- mmesa->dirtyAge = t->age;
-
- for ( i = 0 ; i < mmesa->glCtx->Const.MaxTextureUnits ; i++ )
- {
- if ( t == mmesa->CurrentTexObj[ i ] ) {
- mmesa->CurrentTexObj[ i ] = NULL;
- }
- }
- }
-}
-
-
-/**
- * Upload a texture image from system memory to either on-card or AGP
- * memory. Uploads to on-card memory are performed using an ILOAD operation.
- * This is used for both initial loading of the entire image, and texSubImage
- * updates.
- *
- * Performed with the hardware lock held.
- *
- * Even though this function is named "upload subimage," the entire image
- * is uploaded.
- *
- * \param mmesa Driver context.
- * \param t Texture to be uploaded.
- * \param hwlevel Mipmap level of the texture to be uploaded.
- *
- * \bug As mentioned above, this fuction actually copies the entier mipmap
- * level. There should be a version of this function that performs
- * sub-rectangle uploads. This will perform quite a bit better if only
- * a small portion of a larger texture has been updated. Care would
- * need to be take with such an implementation once glCopyTexImage has
- * been hardware accelerated.
- */
-static void mgaUploadSubImage( mgaContextPtr mmesa,
- mgaTextureObjectPtr t, GLint hwlevel )
-{
- struct gl_texture_image * texImage;
- unsigned offset;
- unsigned texelBytes;
- unsigned length;
- const int level = hwlevel + t->base.firstLevel;
-
-
- if ( (hwlevel < 0)
- || (hwlevel >= (MGA_IS_G200(mmesa)
- ? G200_TEX_MAXLEVELS : G400_TEX_MAXLEVELS)) ) {
- fprintf( stderr, "[%s:%d] level = %d\n", __FILE__, __LINE__, level );
- return;
- }
-
- texImage = t->base.tObj->Image[0][level];
- if ( texImage == NULL ) {
- fprintf( stderr, "[%s:%d] Image[%d] = NULL\n", __FILE__, __LINE__,
- level );
- return;
- }
-
-
- if (texImage->Data == NULL) {
- fprintf(stderr, "null texture image data tObj %p level %d\n",
- (void *) t->base.tObj, level);
- return;
- }
-
-
- /* find the proper destination offset for this level */
- if ( MGA_IS_G200(mmesa) ) {
- offset = (t->base.memBlock->ofs + t->offsets[hwlevel]);
- }
- else {
- unsigned i;
-
- offset = t->base.memBlock->ofs;
- for ( i = 0 ; i < hwlevel ; i++ ) {
- offset += (t->offsets[1] >> (i * 2));
- }
- }
-
-
- /* Copy the texture from system memory to a memory space that can be
- * directly used by the hardware for texturing.
- */
-
- texelBytes = texImage->TexFormat->TexelBytes;
- length = texImage->Width * texImage->Height * texelBytes;
- if ( t->base.heap->heapId == MGA_CARD_HEAP ) {
- unsigned tex_offset = 0;
- unsigned to_copy;
-
-
- /* We may not be able to upload the entire texture in one batch due to
- * register limits or dma buffer limits. Split the copy up into maximum
- * sized chunks.
- */
-
- offset += mmesa->mgaScreen->textureOffset[ t->base.heap->heapId ];
- while ( length != 0 ) {
- mgaGetILoadBufferLocked( mmesa );
-
- /* The kernel ILOAD ioctl requires that the lenght be an even multiple
- * of MGA_ILOAD_ALIGN.
- */
- length = ((length) + MGA_ILOAD_MASK) & ~MGA_ILOAD_MASK;
-
- to_copy = MIN2( length, MGA_BUFFER_SIZE );
- (void) memcpy( mmesa->iload_buffer->address,
- (GLubyte *) texImage->Data + tex_offset, to_copy );
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_TEXTURE )
- fprintf(stderr, "[%s:%d] address/size = 0x%08lx/%d\n",
- __FILE__, __LINE__,
- (long) (offset + tex_offset),
- to_copy );
-
- mgaFireILoadLocked( mmesa, offset + tex_offset, to_copy );
- tex_offset += to_copy;
- length -= to_copy;
- }
- } else {
- /* FIXME: the sync for direct copy reduces speed.. */
- /* This works, is slower for uploads to card space and needs
- * additional synchronization with the dma stream.
- */
-
- UPDATE_LOCK(mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT);
-
- memcpy( mmesa->mgaScreen->texVirtual[t->base.heap->heapId] + offset,
- texImage->Data, length );
-
- if ( MGA_DEBUG & DEBUG_VERBOSE_TEXTURE )
- fprintf(stderr, "[%s:%d] address/size = 0x%08lx/%d\n",
- __FILE__, __LINE__,
- (long) (mmesa->mgaScreen->texVirtual[t->base.heap->heapId]
- + offset),
- length);
- }
-}
-
-
-/**
- * Upload the texture images associated with texture \a t. This might
- * require the allocation of texture memory.
- *
- * \param mmesa Context pointer
- * \param t Texture to be uploaded
- */
-
-int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t )
-{
- int i;
- int ofs;
-
-
- if ( (t == NULL) || (t->base.totalSize == 0) )
- return 0;
-
- LOCK_HARDWARE( mmesa );
-
- if (t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( mmesa->texture_heaps, mmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( mmesa );
- return -1;
- }
-
- ofs = mmesa->mgaScreen->textureOffset[ heap ]
- + t->base.memBlock->ofs;
-
- if ( MGA_IS_G200(mmesa) ) {
- t->setup.texorg = ofs;
- t->setup.texorg1 = ofs + t->offsets[1];
- t->setup.texorg2 = ofs + t->offsets[2];
- t->setup.texorg3 = ofs + t->offsets[3];
- t->setup.texorg4 = ofs + t->offsets[4];
- }
- else {
- t->setup.texorg = ofs | TO_texorgoffsetsel;
- t->setup.texorg1 = t->offsets[1];
- t->setup.texorg2 = 0;
- t->setup.texorg3 = 0;
- t->setup.texorg4 = 0;
- }
-
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
-
- if (MGA_DEBUG&DEBUG_VERBOSE_TEXTURE)
- fprintf(stderr, "[%s:%d] dispatch age: %d age freed memory: %d\n",
- __FILE__, __LINE__,
- GET_DISPATCH_AGE(mmesa), mmesa->dirtyAge);
-
- if (mmesa->dirtyAge >= GET_DISPATCH_AGE(mmesa))
- mgaWaitAgeLocked( mmesa, mmesa->dirtyAge );
-
- if (t->base.dirty_images[0]) {
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- if (MGA_DEBUG&DEBUG_VERBOSE_TEXTURE)
- fprintf(stderr, "[%s:%d] dirty_images[0] = 0x%04x\n",
- __FILE__, __LINE__, t->base.dirty_images[0] );
-
- for (i = 0 ; i < numLevels ; i++) {
- if ( (t->base.dirty_images[0] & (1U << i)) != 0 ) {
- mgaUploadSubImage( mmesa, t, i );
- }
- }
- t->base.dirty_images[0] = 0;
- }
-
-
- UNLOCK_HARDWARE( mmesa );
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.c
deleted file mode 100644
index 2b7ea05b1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.c
+++ /dev/null
@@ -1,912 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.c,v 1.10 2002/10/30 12:51:36 alanh Exp $ */
-
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "mm.h"
-#include "mgacontext.h"
-#include "mgaioctl.h"
-#include "mgatris.h"
-#include "mgavb.h"
-#include "mgastate.h"
-
-
-static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Functions to draw basic primitives *
- ***********************************************************************/
-
-
-#if defined (USE_X86_ASM)
-#define EMIT_VERT( j, vb, vertex_size, v ) \
-do { int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertex_size), \
- "D" ((long)vb), \
- "S" ((long)v)); \
-} while (0)
-#else
-#define EMIT_VERT( j, vb, vertex_size, v ) \
-do { \
- for ( j = 0 ; j < vertex_size ; j++ ) \
- vb[j] = (v)->ui[j]; \
- vb += vertex_size; \
-} while (0)
-#endif
-
-static void __inline__ mga_draw_triangle( mgaContextPtr mmesa,
- mgaVertexPtr v0,
- mgaVertexPtr v1,
- mgaVertexPtr v2 )
-{
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 3 * 4 * vertex_size );
- int j;
-
- EMIT_VERT( j, vb, vertex_size, v0 );
- EMIT_VERT( j, vb, vertex_size, v1 );
- EMIT_VERT( j, vb, vertex_size, v2 );
-}
-
-
-static void __inline__ mga_draw_quad( mgaContextPtr mmesa,
- mgaVertexPtr v0,
- mgaVertexPtr v1,
- mgaVertexPtr v2,
- mgaVertexPtr v3 )
-{
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
- int j;
-
- EMIT_VERT( j, vb, vertex_size, v0 );
- EMIT_VERT( j, vb, vertex_size, v1 );
- EMIT_VERT( j, vb, vertex_size, v3 );
- EMIT_VERT( j, vb, vertex_size, v1 );
- EMIT_VERT( j, vb, vertex_size, v2 );
- EMIT_VERT( j, vb, vertex_size, v3 );
-}
-
-
-static __inline__ void mga_draw_point( mgaContextPtr mmesa,
- mgaVertexPtr tmp )
-{
- GLfloat sz = mmesa->glCtx->Point._Size * .5;
- int vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
- int j;
-
-#if 0
- v0->v.x += PNT_X_OFFSET - TRI_X_OFFSET;
- v0->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-
- /* Draw a point as two triangles.
- */
- *(float *)&vb[0] = tmp->v.x - sz;
- *(float *)&vb[1] = tmp->v.y - sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x + sz;
- *(float *)&vb[1] = tmp->v.y - sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x + sz;
- *(float *)&vb[1] = tmp->v.y + sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x + sz;
- *(float *)&vb[1] = tmp->v.y + sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x - sz;
- *(float *)&vb[1] = tmp->v.y + sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = tmp->v.x - sz;
- *(float *)&vb[1] = tmp->v.y - sz;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = tmp->ui[j];
-
-#if 0
- v0->v.x -= PNT_X_OFFSET - TRI_X_OFFSET;
- v0->v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-}
-
-
-static __inline__ void mga_draw_line( mgaContextPtr mmesa,
- mgaVertexPtr v0,
- mgaVertexPtr v1 )
-{
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
- GLfloat dx, dy, ix, iy;
- GLfloat width = mmesa->glCtx->Line._Width;
- GLint j;
-
-#if 0
- v0->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
- v0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
- v1->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
- v1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-
- dx = v0->v.x - v1->v.x;
- dy = v0->v.y - v1->v.y;
-
- ix = width * .5; iy = 0;
- if (dx * dx > dy * dy) {
- iy = ix; ix = 0;
- }
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v0->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v1->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v0->v.x + ix;
- *(float *)&vb[1] = v0->v.y + iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v0->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v0->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v1->v.x - ix;
- *(float *)&vb[1] = v1->v.y - iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v1->ui[j];
- vb += vertex_size;
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- for (j = 2 ; j < vertex_size ; j++)
- vb[j] = v1->ui[j];
- vb += vertex_size;
-
-#if 0
- v0->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
- v0->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
- v1->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
- v1->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
-#endif
-}
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_tri( mmesa, a, b, c ); \
- else \
- mga_draw_triangle( mmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- mmesa->draw_tri( mmesa, a, b, d ); \
- mmesa->draw_tri( mmesa, b, c, d ); \
- } else { \
- mga_draw_quad( mmesa, a, b, c, d ); \
- } \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_line( mmesa, v0, v1 ); \
- else { \
- mga_draw_line( mmesa, v0, v1 ); \
- } \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- mmesa->draw_point( mmesa, v0 ); \
- else { \
- mga_draw_point( mmesa, v0 ); \
- } \
-} while (0)
-
-
-/***********************************************************************
- * Fallback to swrast for basic primitives *
- ***********************************************************************/
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-
-static void
-mga_fallback_tri( mgaContextPtr mmesa,
- mgaVertex *v0,
- mgaVertex *v1,
- mgaVertex *v2 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[3];
- mga_translate_vertex( ctx, v0, &v[0] );
- mga_translate_vertex( ctx, v1, &v[1] );
- mga_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-mga_fallback_line( mgaContextPtr mmesa,
- mgaVertex *v0,
- mgaVertex *v1 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[2];
- mga_translate_vertex( ctx, v0, &v[0] );
- mga_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-mga_fallback_point( mgaContextPtr mmesa,
- mgaVertex *v0 )
-{
- GLcontext *ctx = mmesa->glCtx;
- SWvertex v[1];
- mga_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-
-#define MGA_UNFILLED_BIT 0x1
-#define MGA_OFFSET_BIT 0x2
-#define MGA_TWOSIDE_BIT 0x4
-#define MGA_FLAT_BIT 0x8 /* mga can't flatshade? */
-#define MGA_FALLBACK_BIT 0x10
-#define MGA_MAX_TRIFUNC 0x20
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[MGA_MAX_TRIFUNC];
-
-#define DO_FALLBACK (IND & MGA_FALLBACK_BIT)
-#define DO_OFFSET (IND & MGA_OFFSET_BIT)
-#define DO_UNFILLED (IND & MGA_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & MGA_TWOSIDE_BIT)
-#define DO_FLAT (IND & MGA_FLAT_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_BACK_COLORS 0
-#define HAVE_SPEC 1
-#define HAVE_HW_FLATSHADE 0
-#define VERTEX mgaVertex
-#define TAB rast_tab
-
-
-#define DEPTH_SCALE mmesa->depth_scale
-#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) (mmesa->verts + (e * mmesa->vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- mga_color_t *color = (mga_color_t *)&((v)->ui[4]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-
-#define VERT_SET_SPEC( v0, c ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.blue, (c)[2]); \
-} while (0)
-
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- v0->v.specular.red = v1->v.specular.red; \
- v0->v.specular.green = v1->v.specular.green; \
- v0->v.specular.blue = v1->v.specular.blue; \
-} while (0)
-
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx]
-#define VERT_SAVE_SPEC( idx ) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- (void) color; (void) spec;
-
-
-
-/***********************************************************************
- * Functions to draw basic unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (mmesa->raster_primitive != x) \
- mgaRasterPrimitive( ctx, x, MGA_WA_TRIANGLES )
-#define RENDER_PRIMITIVE mmesa->render_primitive
-#define IND MGA_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 (MGA_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT| \
- MGA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* Mga doesn't support provoking-vertex flat-shading?
- */
-#define IND (MGA_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_UNFILLED_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_OFFSET_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_UNFILLED_BIT|MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT|MGA_UNFILLED_BIT| \
- MGA_FALLBACK_BIT|MGA_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback_flat
-#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();
- 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();
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-
-#define VERT(x) (mgaVertex *)(vertptr + ((x)*vertex_size*sizeof(int)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- mga_draw_point( mmesa, VERT(ELT(start)) );
-#define RENDER_LINE( v0, v1 ) \
- mga_draw_line( mmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- mga_draw_triangle( mmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- mga_draw_quad( mmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) mgaRenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)mmesa->verts; \
- const GLuint vertex_size = mmesa->vertex_size; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) mga_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) mga_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void mgaRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint prim = mmesa->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 mgaRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- GLuint vertex_size = mmesa->vertex_size;
- GLuint *vb = mgaAllocDmaLow( mmesa, (n-2) * 3 * 4 * vertex_size );
- GLubyte *vertptr = (GLubyte *)mmesa->verts;
- const GLuint *start = (const GLuint *)VERT(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) VERT(elts[i-1]) );
- EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) VERT(elts[i]) );
- EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_SMOOTH | DD_LINE_STIPPLE)
-#define TRI_FALLBACK (DD_TRI_SMOOTH | DD_TRI_UNFILLED)
-#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)
-
-void mgaChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS|DD_TRI_STIPPLE)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= MGA_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= MGA_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= MGA_UNFILLED_BIT;
- if (flags & DD_FLATSHADE) index |= MGA_FLAT_BIT;
- }
-
- mmesa->draw_point = mga_draw_point;
- mmesa->draw_line = mga_draw_line;
- mmesa->draw_tri = mga_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & POINT_FALLBACK)
- mmesa->draw_point = mga_fallback_point;
-
- if (flags & LINE_FALLBACK)
- mmesa->draw_line = mga_fallback_line;
-
- if (flags & TRI_FALLBACK)
- mmesa->draw_tri = mga_fallback_tri;
-
- index |= MGA_FALLBACK_BIT;
- }
-
- if ((flags & DD_TRI_STIPPLE) && !mmesa->haveHwStipple) {
- mmesa->draw_tri = mga_fallback_tri;
- index |= MGA_FALLBACK_BIT;
- }
- }
-
- if (mmesa->RenderIndex != index) {
- mmesa->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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = mga_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = mga_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = mgaFastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = mgaRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = mgaRenderClippedPoly;
- }
- }
-}
-
-/**********************************************************************/
-/* Runtime render state and callbacks */
-/**********************************************************************/
-
-
-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
-};
-
-
-
-/* Always called between RenderStart and RenderFinish --> We already
- * hold the lock.
- */
-void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
-
- FLUSH_BATCH( mmesa );
-
- /* Update culling */
- if (mmesa->raster_primitive != prim)
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
-
- mmesa->raster_primitive = prim;
-/* mmesa->hw_primitive = hwprim; */
- mmesa->hw_primitive = MGA_WA_TRIANGLES; /* disable mgarender.c for now */
-
- if (ctx->Polygon.StippleFlag && mmesa->haveHwStipple)
- {
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mmesa->setup.dwgctl &= ~(0xf<<20);
- if (mmesa->raster_primitive == GL_TRIANGLES)
- mmesa->setup.dwgctl |= mmesa->poly_stipple;
- }
-}
-
-
-
-/* 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 mgarender.c.
- */
-static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- mmesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (mmesa->raster_primitive != rprim) {
- mgaRasterPrimitive( ctx, rprim, MGA_WA_TRIANGLES );
- }
-}
-
-static void mgaRenderFinish( GLcontext *ctx )
-{
- if (MGA_CONTEXT(ctx)->RenderIndex & MGA_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-
-/**********************************************************************/
-/* Manage total rasterization fallbacks */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "read buffer",
- "glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ZERO)",
- "glRenderMode(selection or feedback)",
- "No hardware stencil",
- "glDepthFunc( GL_NEVER )",
- "Mixing GL_CLAMP_TO_EDGE and GL_CLAMP",
- "rasterization fallback option"
-};
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint oldfallback = mmesa->Fallback;
-
- if (mode) {
- mmesa->Fallback |= bit;
- if (oldfallback == 0) {
- FLUSH_BATCH(mmesa);
- _swsetup_Wakeup( ctx );
- mmesa->RenderIndex = ~0;
- if (MGA_DEBUG & DEBUG_VERBOSE_FALLBACK) {
- fprintf(stderr, "MGA begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- mmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = mgaCheckTexSizes;
- tnl->Driver.Render.PrimitiveNotify = mgaRenderPrimitive;
- tnl->Driver.Render.Finish = mgaRenderFinish;
- tnl->Driver.Render.BuildVertices = mgaBuildVertices;
- mmesa->NewGLState |= (_MGA_NEW_RENDERSTATE |
- _MGA_NEW_RASTERSETUP);
- if (MGA_DEBUG & DEBUG_VERBOSE_FALLBACK) {
- fprintf(stderr, "MGA end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-void mgaDDInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- static int firsttime = 1;
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- mmesa->RenderIndex = ~0;
-
- tnl->Driver.Render.Start = mgaCheckTexSizes;
- tnl->Driver.Render.Finish = mgaRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = mgaRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = mgaBuildVertices;
- tnl->Driver.Render.Multipass = NULL;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.h
deleted file mode 100644
index f3ece3a05..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgatris.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.h,v 1.10 2002/10/30 12:51:36 alanh Exp $ */
-
-#ifndef MGATRIS_INC
-#define MGATRIS_INC
-
-#include "mtypes.h"
-
-extern void mgaDDInitTriFuncs( GLcontext *ctx );
-extern void mgaChooseRenderState( GLcontext *ctx );
-extern void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim );
-
-extern void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( ctx, bit, mode ) mgaFallback( ctx, bit, mode )
-
-#define _MGA_NEW_RENDERSTATE (_DD_NEW_POINT_SMOOTH | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_FLATSHADE | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.c
deleted file mode 100644
index 902d8bd1c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.15 2003/03/26 20:43:49 tsi Exp $ */
-
-#include <stdlib.h>
-#include "mgacontext.h"
-#include "mgavb.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-#include "mga_xmesa.h"
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "tnl/t_context.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/swrast.h"
-
-
-#define MGA_TEX1_BIT 0x1
-#define MGA_TEX0_BIT 0x2
-#define MGA_RGBA_BIT 0x4
-#define MGA_SPEC_BIT 0x8
-#define MGA_FOG_BIT 0x10
-#define MGA_XYZW_BIT 0x20
-#define MGA_PTEX_BIT 0x40
-#define MGA_MAX_SETUP 0x80
-
-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[MGA_MAX_SETUP];
-
-
-#define TINY_VERTEX_FORMAT 0
-#define NOTEX_VERTEX_FORMAT 0
-#define TEX0_VERTEX_FORMAT (MGA_A|MGA_S|MGA_F)
-#define TEX1_VERTEX_FORMAT (MGA_A|MGA_S|MGA_F|MGA_T2)
-#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 & MGA_XYZW_BIT)
-#define DO_RGBA (IND & MGA_RGBA_BIT)
-#define DO_SPEC (IND & MGA_SPEC_BIT)
-#define DO_FOG (IND & MGA_FOG_BIT)
-#define DO_TEX0 (IND & MGA_TEX0_BIT)
-#define DO_TEX1 (IND & MGA_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & MGA_PTEX_BIT)
-
-
-#define VERTEX mgaVertex
-#define VERTEX_COLOR mga_color_t
-#define LOCALVARS mgaContextPtr mmesa = MGA_CONTEXT(ctx);
-#define GET_VIEWPORT_MAT() mmesa->hw_viewport
-#define GET_TEXSOURCE(n) mmesa->tmu_source[n]
-#define GET_VERTEX_FORMAT() mmesa->vertex_format
-#define GET_VERTEX_STORE() mmesa->verts
-#define GET_VERTEX_SIZE() mmesa->vertex_size * sizeof(GLuint)
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 0
-#define HAVE_NOTEX_VERTICES 0
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS \
- const GLfloat dx = - mmesa->drawX - SUBPIXEL_X; \
- const GLfloat dy = (mmesa->driDrawable->h + \
- mmesa->drawY + SUBPIXEL_Y); \
- const GLfloat sz = 1.0 / mmesa->depth_scale
-
-#define UNVIEWPORT_X(x) x + dx;
-#define UNVIEWPORT_Y(y) - y + dy;
-#define UNVIEWPORT_Z(z) z * sz;
-
-#define PTEX_FALLBACK() FALLBACK(ctx, MGA_FALLBACK_TEXTURE, 1)
-
-#define INTERP_VERTEX setup_tab[mmesa->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[mmesa->SetupIndex].copy_pv
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) mga_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_XYZW_BIT|MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_FOG_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (MGA_RGBA_BIT|MGA_FOG_BIT|MGA_SPEC_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-
-
-
-void mgaPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s: %d %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & MGA_XYZW_BIT) ? " xyzw," : "",
- (flags & MGA_RGBA_BIT) ? " rgba," : "",
- (flags & MGA_SPEC_BIT) ? " spec," : "",
- (flags & MGA_FOG_BIT) ? " fog," : "",
- (flags & MGA_TEX0_BIT) ? " tex-0," : "",
- (flags & MGA_TEX1_BIT) ? " tex-1," : "");
-}
-
-
-void mgaCheckTexSizes( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /*fprintf(stderr, "%s\n", __FUNCTION__);*/
-
- if (!setup_tab[mmesa->SetupIndex].check_tex_sizes(ctx)) {
- mmesa->SetupIndex |= MGA_PTEX_BIT;
- mmesa->SetupNewInputs = ~0;
-
- if (!mmesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[mmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[mmesa->SetupIndex].copy_pv;
- }
- if (mmesa->Fallback) {
- tnl->Driver.Render.Start(ctx);
- }
- }
-}
-
-
-void mgaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- GLuint stride = mmesa->vertex_size * sizeof(int);
- GLubyte *v = ((GLubyte *)mmesa->verts + (start * stride));
-
- newinputs |= mmesa->SetupNewInputs;
- mmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[mmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= MGA_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= MGA_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= MGA_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= MGA_TEX0_BIT|MGA_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= MGA_FOG_BIT;
-
- if (mmesa->SetupIndex & MGA_PTEX_BIT)
- ind = ~0;
-
- ind &= mmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-
-void mgaChooseVertexState( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint ind = MGA_XYZW_BIT|MGA_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= MGA_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= MGA_FOG_BIT;
-
- if (ctx->Texture._EnabledUnits & 0x2) {
- /* unit 1 enabled */
- if (ctx->Texture._EnabledUnits & 0x1) {
- /* unit 0 enabled */
- ind |= MGA_TEX1_BIT|MGA_TEX0_BIT;
- }
- else {
- ind |= MGA_TEX0_BIT;
- }
- }
- else if (ctx->Texture._EnabledUnits & 0x1) {
- /* unit 0 enabled */
- ind |= MGA_TEX0_BIT;
- }
-
- mmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = mga_interp_extras;
- tnl->Driver.Render.CopyPV = mga_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 != mmesa->vertex_format) {
- FLUSH_BATCH(mmesa);
- mmesa->dirty |= MGA_UPLOAD_PIPE;
- mmesa->vertex_format = setup_tab[ind].vertex_format;
- mmesa->vertex_size = setup_tab[ind].vertex_size;
- }
-}
-
-
-
-void *mga_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- void *dest)
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- GLuint stride = mmesa->vertex_size * 4;
- setup_tab[mmesa->SetupIndex].emit( ctx, start, count, dest, stride );
- return (void *)((char *)dest + stride * (count - start));
-}
-
-
-
-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);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-
- mmesa->dirty |= MGA_UPLOAD_PIPE;
- mmesa->vertex_format = setup_tab[0].vertex_format;
- mmesa->vertex_size = setup_tab[0].vertex_size;
-}
-
-
-void mgaFreeVB( GLcontext *ctx )
-{
- mgaContextPtr mmesa = MGA_CONTEXT(ctx);
- if (mmesa->verts) {
- ALIGN_FREE(mmesa->verts);
- mmesa->verts = 0;
- }
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.h
deleted file mode 100644
index 5f6454aca..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/mgavb.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.h,v 1.8 2002/10/30 12:51:36 alanh Exp $ */
-/*
- * Copyright 2000-2001 VA Linux Systems, 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
- * on 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
- * 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>
- */
-
-#ifndef MGAVB_INC
-#define MGAVB_INC
-
-#include "mtypes.h"
-#include "mgacontext.h"
-#include "swrast/swrast.h"
-
-#define _MGA_NEW_RASTERSETUP (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void mgaChooseVertexState( GLcontext *ctx );
-extern void mgaCheckTexSizes( GLcontext *ctx );
-extern void mgaBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-extern void mgaPrintSetupFlags(char *msg, GLuint flags );
-
-extern void mgaInitVB( GLcontext *ctx );
-extern void mgaFreeVB( GLcontext *ctx );
-
-extern void *mga_emit_contiguous_verts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- void *dest );
-
-extern void mga_translate_vertex(GLcontext *ctx,
- const mgaVertex *src,
- SWvertex *dst);
-
-extern void mga_print_vertex( GLcontext *ctx, const mgaVertex *v );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga.h
deleted file mode 100644
index 830d48d85..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.85 2002/12/16 16:19:17 dawes Exp $ */
-/*
- * MGA Millennium (MGA2064W) functions
- *
- * Copyright 1996 The XFree86 Project, Inc.
- *
- * Authors
- * Dirk Hohndel
- * hohndel@XFree86.Org
- * David Dawes
- * dawes@XFree86.Org
- */
-
-#ifndef MGA_H
-#define MGA_H
-
-
-#include "xf86drm.h"
-#include "linux/types.h"
-
-
-#define PCI_CHIP_MGA2085 0x0518
-#define PCI_CHIP_MGA2064 0x0519
-#define PCI_CHIP_MGA1064 0x051A
-#define PCI_CHIP_MGA2164 0x051B
-#define PCI_CHIP_MGA2164_AGP 0x051F
-#define PCI_CHIP_MGAG200_PCI 0x0520
-#define PCI_CHIP_MGAG200 0x0521
-#define PCI_CHIP_MGAG400 0x0525
-#define PCI_CHIP_MGAG550 0x2527
-#define PCI_CHIP_MGAG100_PCI 0x1000
-#define PCI_CHIP_MGAG100 0x1001
-
-
-# define MMIO_IN8(base, offset) \
- *(volatile unsigned char *)(((unsigned char*)(base)) + (offset))
-# define MMIO_IN16(base, offset) \
- *(volatile unsigned short *)(void *)(((unsigned char*)(base)) + (offset))
-# define MMIO_IN32(base, offset) \
- *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset))
-# define MMIO_OUT8(base, offset, val) \
- *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) = (val)
-# define MMIO_OUT16(base, offset, val) \
- *(volatile unsigned short *)(void *)(((unsigned char*)(base)) + (offset)) = (val)
-# define MMIO_OUT32(base, offset, val) \
- *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) = (val)
-
-#define INREG8(addr) MMIO_IN8(pMga->IOBase, addr)
-#define INREG16(addr) MMIO_IN16(pMga->IOBase, addr)
-#define INREG(addr) MMIO_IN32(pMga->IOBase, addr)
-#define OUTREG8(addr, val) MMIO_OUT8(pMga->IOBase, addr, val)
-#define OUTREG16(addr, val) MMIO_OUT16(pMga->IOBase, addr, val)
-#define OUTREG(addr, val) MMIO_OUT32(pMga->IOBase, addr, val)
-
-#define MGAIOMAPSIZE 0x00004000
-
-
-typedef struct {
- int Chipset; /**< \brief Chipset number */
-
- int irq; /**< \brief IRQ number */
-
-
- int frontOffset; /**< \brief Front color buffer offset */
- int frontPitch; /**< \brief Front color buffer pitch */
- int backOffset; /**< \brief Back color buffer offset */
- int backPitch; /**< \brief Back color buffer pitch */
- int depthOffset; /**< \brief Depth buffer offset */
- int depthPitch; /**< \brief Depth buffer pitch */
- int textureOffset; /**< \brief Texture area offset */
- int textureSize; /**< \brief Texture area size */
- int logTextureGranularity;
-
- /**
- * \name AGP
- */
- /*@{*/
- drmSize agpSize; /**< \brief AGP map size */
- int agpMode; /**< \brief AGP mode */
- /*@}*/
-
- drmRegion agp;
-
- /* PCI mappings */
- drmRegion registers;
- drmRegion status;
-
- /* AGP mappings */
- drmRegion warp;
- drmRegion primary;
- drmRegion buffers;
- drmRegion agpTextures;
-
- drmBufMapPtr drmBuffers;
-
- unsigned long IOAddress;
- unsigned char *IOBase;
- int HasSDRAM;
-
- __u32 reg_ien;
-} MGARec, *MGAPtr;
-
-
-
-#define MGA_FRONT 0x1
-#define MGA_BACK 0x2
-#define MGA_DEPTH 0x4
-
-#define MGA_AGP_1X_MODE 0x01
-#define MGA_AGP_2X_MODE 0x02
-#define MGA_AGP_4X_MODE 0x04
-#define MGA_AGP_MODE_MASK 0x07
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_bios.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_bios.h
deleted file mode 100644
index 8fbf619e3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_bios.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* $XConsortium: mga_bios.h /main/2 1996/10/28 04:48:23 kaleb $ */
-#ifndef MGA_BIOS_H
-#define MGA_BIOS_H
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_bios.h,v 1.3 1998/07/25 16:55:51 dawes Exp $ */
-
-/*
- * MGABiosInfo - This struct describes the video BIOS info block.
- *
- * DESCRIPTION
- * Do not mess with this, unless you know what you are doing.
- * The data lengths and types are critical.
- *
- * HISTORY
- * October 7, 1996 - [aem] Andrew E. Mileski
- * This struct was shamelessly stolen from the MGA DDK.
- * It has been reformatted, and the data types changed.
- */
-typedef struct {
- /* Length of this structure in bytes */
- __u16 StructLen;
-
- /*
- * Unique number identifying the product type
- * 0 : MGA-S1P20 (2MB base with 175MHz Ramdac)
- * 1 : MGA-S1P21 (2MB base with 220MHz Ramdac)
- * 2 : Reserved
- * 3 : Reserved
- * 4 : MGA-S1P40 (4MB base with 175MHz Ramdac)
- * 5 : MGA-S1P41 (4MB base with 220MHz Ramdac)
- */
- __u16 ProductID;
-
- /* Serial number of the board */
- __u8 SerNo[ 10 ];
-
- /*
- * Manufacturing date of the board (at product test)
- * Format: yyyy yyym mmmd dddd
- */
- __u16 ManufDate;
-
- /* Identification of manufacturing site */
- __u16 ManufId;
-
- /*
- * Number and revision level of the PCB
- * Format: nnnn nnnn nnnr rrrr
- * n = PCB number ex:576 (from 0->2047)
- * r = PCB revision (from 0->31)
- */
- __u16 PCBInfo;
-
- /* Identification of any PMBs */
- __u16 PMBInfo;
-
- /*
- * Bit 0-7 : Ramdac speed (0=175MHz, 1=220MHz)
- * Bit 8-15 : Ramdac type (0=TVP3026, 1=TVP3027)
- */
- __u16 RamdacType;
-
- /* Maximum PCLK of the ramdac */
- __u16 PclkMax;
-
- /* Maximum LDCLK supported by the WRAM memory */
- __u16 LclkMax;
-
- /* Maximum MCLK of base board */
- __u16 ClkBase;
-
- /* Maximum MCLK of 4Mb board */
- __u16 Clk4MB;
-
- /* Maximum MCLK of 8Mb board */
- __u16 Clk8MB;
-
- /* Maximum MCLK of board with multimedia module */
- __u16 ClkMod;
-
- /* Diagnostic test pass frequency */
- __u16 TestClk;
-
- /* Default VGA mode1 pixel frequency */
- __u16 VGAFreq1;
-
- /* Default VGA mode2 pixel frequency */
- __u16 VGAFreq2;
-
- /* Date of last BIOS programming/update */
- __u16 ProgramDate;
-
- /* Number of times BIOS has been programmed */
- __u16 ProgramCnt;
-
- /* Support for up to 32 hardware/software options */
- __u32 Options;
-
- /* Support for up to 32 hardware/software features */
- __u32 FeatFlag;
-
- /* Definition of VGA mode MCLK */
- __u16 VGAClk;
-
- /* Indicate the revision level of this header struct */
- __u16 StructRev;
-
- __u16 Reserved[ 3 ];
-} MGABiosInfo;
-
-/* from the PINS structure, refer pins info from MGA */
-typedef struct tagParamMGA {
- __u16 PinID; /* 0 */
- __u8 StructLen; /* 2 */
- __u8 Rsvd1; /* 3 */
- __u16 StructRev; /* 4 */
- __u16 ProgramDate; /* 6 */
- __u16 ProgramCnt; /* 8 */
- __u16 ProductID; /* 10 */
- __u8 SerNo[16]; /* 12 */
- __u8 PLInfo[6]; /* 28 */
- __u16 PCBInfo; /* 34 */
- __u32 FeatFlag; /* 36 */
- __u8 RamdacType; /* 40 */
- __u8 RamdacSpeed; /* 41 */
- __u8 PclkMax; /* 42 */
- __u8 ClkGE; /* 43 */
- __u8 ClkMem; /* 44 */
- __u8 Clk4MB; /* 45 */
- __u8 Clk8MB; /* 46 */
- __u8 ClkMod; /* 47 */
- __u8 TestClk; /* 48 */
- __u8 VGAFreq1; /* 49 */
- __u8 VGAFreq2; /* 50 */
- __u8 MCTLWTST; /* 51 */
- __u8 VidCtrl; /* 52 */
- __u8 Clk12MB; /* 53 */
- __u8 Clk16MB; /* 54 */
- __u8 Reserved[8]; /* 55-62 */
- __u8 PinCheck; /* 63 */
-} MGABios2Info;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.c
deleted file mode 100644
index 258ace83a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.c
+++ /dev/null
@@ -1,1089 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.28 2003/02/08 21:26:58 dawes Exp $ */
-
-/*
- * 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.h
deleted file mode 100644
index 03b841460..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_dri.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.8 2002/11/29 11:06:42 eich Exp $ */
-
-/*
- * 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>
- */
-
-#ifndef __MGA_DRI_H__
-#define __MGA_DRI_H__
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "mga_drm.h"
-
-#define MGA_DEFAULT_AGP_SIZE 64
-#define MGA_DEFAULT_AGP_MODE 4
-#define MGA_MAX_AGP_MODE 4
-
-/* Buffer are aligned on 4096 byte boundaries.
- */
-#define MGA_BUFFER_ALIGN 0x00000fff
-
-#ifdef __GNUC__
-# define DEPRECATED __attribute__ ((deprecated))
-#else
-# define DEPRECATED
-#endif
-
-#if 1
-typedef struct _mgaDrmRegion {
- drm_handle_t handle;
- unsigned int offset;
- drmSize size;
-} mgaDrmRegion, *mgaDrmRegionPtr;
-#else
-#define mgaDrmRegion drmRegion
-#endif
-
-typedef struct {
- int chipset;
- int width DEPRECATED;
- int height DEPRECATED;
- int mem DEPRECATED;
- int cpp;
-
- int agpMode;
-
- unsigned int frontOffset;
- unsigned int frontPitch;
-
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- unsigned int textureOffset;
- unsigned int textureSize;
- int logTextureGranularity DEPRECATED;
-
- /* Allow calculation of setup dma addresses.
- */
- unsigned int agpBufferOffset DEPRECATED;
-
- unsigned int agpTextureOffset;
- unsigned int agpTextureSize;
- int logAgpTextureGranularity DEPRECATED;
-
- unsigned int mAccess DEPRECATED;
-
- /**
- * \name DRM memory regions.
- *
- * \todo
- * Several of these fields are no longer used (and will never be used
- * again) on the client-side. None of them, except \c registers, are used
- * on the server-side. At some point when it is safe to do so (probably
- * for the X.org 6.9 / 7.0 release), these fields should be removed.
- */
- /*@{*/
- mgaDrmRegion registers; /**< MMIO registers. */
- mgaDrmRegion status DEPRECATED; /**< No longer used on the client-side. */
- mgaDrmRegion primary; /**< Primary DMA region. */
- mgaDrmRegion buffers DEPRECATED; /**< No longer used on the client-side. */
- /*@}*/
-
- unsigned int sarea_priv_offset;
-} MGADRIRec, *MGADRIPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_macros.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_macros.h
deleted file mode 100644
index d985081ab..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_macros.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.22 2002/02/20 17:17:50 dawes Exp $ */
-
-#ifndef _MGA_MACROS_H_
-#define _MGA_MACROS_H_
-
-#ifndef PSZ
-#define PSZ 8
-#endif
-
-#if PSZ == 8
-#define REPLICATE(r) r &= 0xFF; r |= r << 8; r |= r << 16
-#elif PSZ == 16
-#define REPLICATE(r) r &= 0xFFFF; r |= r << 16
-#elif PSZ == 24
-#define REPLICATE(r) r &= 0xFFFFFF; r |= r << 24
-#else
-#define REPLICATE(r) /* */
-#endif
-
-#define RGBEQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
-
-#ifdef XF86DRI
-#define MGA_SYNC_XTAG 0x275f4200
-
-#define MGABUSYWAIT() do { \
-OUTREG(MGAREG_DWGSYNC, MGA_SYNC_XTAG); \
-while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \
-}while(0);
-
-#endif
-
-#define MGAISBUSY() (INREG8(MGAREG_Status + 2) & 0x01)
-
-#define WAITFIFO(cnt) \
- if(!pMga->UsePCIRetry) {\
- register int n = cnt; \
- if(n > pMga->FifoSize) n = pMga->FifoSize; \
- while(pMga->fifoCount < (n))\
- pMga->fifoCount = INREG8(MGAREG_FIFOSTATUS);\
- pMga->fifoCount -= n;\
- }
-
-#define XYADDRESS(x,y) \
- ((y) * pMga->CurrentLayout.displayWidth + (x) + pMga->YDstOrg)
-
-#define MAKEDMAINDEX(index) ((((index) >> 2) & 0x7f) | (((index) >> 6) & 0x80))
-
-#define DMAINDICES(one,two,three,four) \
- ( MAKEDMAINDEX(one) | \
- (MAKEDMAINDEX(two) << 8) | \
- (MAKEDMAINDEX(three) << 16) | \
- (MAKEDMAINDEX(four) << 24) )
-
-#if PSZ == 24
-#define SET_PLANEMASK(p) /**/
-#else
-#define SET_PLANEMASK(p) \
- if(!(pMga->AccelFlags & MGA_NO_PLANEMASK) && ((p) != pMga->PlaneMask)) { \
- pMga->PlaneMask = (p); \
- REPLICATE((p)); \
- OUTREG(MGAREG_PLNWT,(p)); \
- }
-#endif
-
-#define SET_FOREGROUND(c) \
- if((c) != pMga->FgColor) { \
- pMga->FgColor = (c); \
- REPLICATE((c)); \
- OUTREG(MGAREG_FCOL,(c)); \
- }
-
-#define SET_BACKGROUND(c) \
- if((c) != pMga->BgColor) { \
- pMga->BgColor = (c); \
- REPLICATE((c)); \
- OUTREG(MGAREG_BCOL,(c)); \
- }
-
-#define DISABLE_CLIP() { \
- pMga->AccelFlags &= ~CLIPPER_ON; \
- WAITFIFO(1); \
- OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); }
-
-#ifdef XF86DRI
-#define CHECK_DMA_QUIESCENT(pMGA, pScrn) { \
- if (!pMGA->haveQuiescense) { \
- pMGA->GetQuiescence( pScrn ); \
- } \
-}
-#else
-#define CHECK_DMA_QUIESCENT(pMGA, pScrn)
-#endif
-
-#ifdef USEMGAHAL
-#define HAL_CHIPSETS ((pMga->Chipset == PCI_CHIP_MGAG200_PCI) || \
- (pMga->Chipset == PCI_CHIP_MGAG200) || \
- (pMga->Chipset == PCI_CHIP_MGAG400) || \
- (pMga->Chipset == PCI_CHIP_MGAG550))
-
-#define MGA_HAL(x) { \
- MGAPtr pMga = MGAPTR(pScrn); \
- if (pMga->HALLoaded && HAL_CHIPSETS) { x; } \
-}
-#define MGA_NOT_HAL(x) { \
- MGAPtr pMga = MGAPTR(pScrn); \
- if (!pMga->HALLoaded || !HAL_CHIPSETS) { x; } \
-}
-#else
-#define MGA_NOT_HAL(x) { x; }
-#endif
-
-#define MGAISGx50(x) ( (((x)->Chipset == PCI_CHIP_MGAG400) && ((x)->ChipRev >= 0x80)) || \
- ((x)->Chipset == PCI_CHIP_MGAG550) )
-
-#define MGA_DH_NEEDS_HAL(x) (((x)->Chipset == PCI_CHIP_MGAG400) && \
- ((x)->ChipRev < 0x80))
-
-#endif /* _MGA_MACROS_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_reg.h
deleted file mode 100644
index b8e349923..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/mga/server/mga_reg.h
+++ /dev/null
@@ -1,484 +0,0 @@
-/* $XConsortium: mgareg.h /main/2 1996/10/25 10:33:21 kaleb $ */
-
-
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.18 2001/09/26 12:59:18 alanh Exp $ */
-
-
-
-/*
- * MGA Millennium (MGA2064W) functions
- * MGA Mystique (MGA1064SG) functions
- *
- * Copyright 1996 The XFree86 Project, Inc.
- *
- * Authors
- * Dirk Hohndel
- * hohndel@XFree86.Org
- * David Dawes
- * dawes@XFree86.Org
- * Contributors:
- * Guy DESBIEF, Aix-en-provence, France
- * g.desbief@aix.pacwan.net
- * MGA1064SG Mystique register file
- */
-
-
-#ifndef _MGA_REG_H_
-#define _MGA_REG_H_
-
-#define MGAREG_DWGCTL 0x1c00
-#define MGAREG_MACCESS 0x1c04
-#define MGA_MACCESS_PW16 0x00000001
-#define MGA_MACCESS_PW32 0x00000002
-/* the following is a mystique only register */
-#define MGAREG_MCTLWTST 0x1c08
-#define MGAREG_ZORG 0x1c0c
-
-#define MGAREG_PAT0 0x1c10
-#define MGAREG_PAT1 0x1c14
-#define MGAREG_PLNWT 0x1c1c
-
-#define MGAREG_BCOL 0x1c20
-#define MGAREG_FCOL 0x1c24
-
-#define MGAREG_SRC0 0x1c30
-#define MGAREG_SRC1 0x1c34
-#define MGAREG_SRC2 0x1c38
-#define MGAREG_SRC3 0x1c3c
-
-#define MGAREG_XYSTRT 0x1c40
-#define MGAREG_XYEND 0x1c44
-
-#define MGAREG_SHIFT 0x1c50
-/* the following is a mystique only register */
-#define MGAREG_DMAPAD 0x1c54
-#define MGAREG_SGN 0x1c58
-#define MGAREG_LEN 0x1c5c
-
-#define MGAREG_AR0 0x1c60
-#define MGAREG_AR1 0x1c64
-#define MGAREG_AR2 0x1c68
-#define MGAREG_AR3 0x1c6c
-#define MGAREG_AR4 0x1c70
-#define MGAREG_AR5 0x1c74
-#define MGAREG_AR6 0x1c78
-
-#define MGAREG_CXBNDRY 0x1c80
-#define MGAREG_FXBNDRY 0x1c84
-#define MGAREG_YDSTLEN 0x1c88
-#define MGAREG_PITCH 0x1c8c
-
-#define MGAREG_YDST 0x1c90
-#define MGAREG_YDSTORG 0x1c94
-#define MGAREG_YTOP 0x1c98
-#define MGAREG_YBOT 0x1c9c
-
-#define MGAREG_CXLEFT 0x1ca0
-#define MGAREG_CXRIGHT 0x1ca4
-#define MGAREG_FXLEFT 0x1ca8
-#define MGAREG_FXRIGHT 0x1cac
-
-#define MGAREG_XDST 0x1cb0
-
-#define MGAREG_DR0 0x1cc0
-#define MGAREG_DR1 0x1cc4
-#define MGAREG_DR2 0x1cc8
-#define MGAREG_DR3 0x1ccc
-
-#define MGAREG_DR4 0x1cd0
-#define MGAREG_DR5 0x1cd4
-#define MGAREG_DR6 0x1cd8
-#define MGAREG_DR7 0x1cdc
-
-#define MGAREG_DR8 0x1ce0
-#define MGAREG_DR9 0x1ce4
-#define MGAREG_DR10 0x1ce8
-#define MGAREG_DR11 0x1cec
-
-#define MGAREG_DR12 0x1cf0
-#define MGAREG_DR13 0x1cf4
-#define MGAREG_DR14 0x1cf8
-#define MGAREG_DR15 0x1cfc
-
-#define MGAREG_SRCORG 0x2cb4
-#define MGAREG_DSTORG 0x2cb8
-
-/* add or or this to one of the previous "power registers" to start
- the drawing engine */
-
-#define MGAREG_EXEC 0x0100
-
-#define MGAREG_FIFOSTATUS 0x1e10
-#define MGAREG_Status 0x1e14
-#define MGAREG_ICLEAR 0x1e18
-#define MGAREG_IEN 0x1e1c
-
-#define MGAREG_VCOUNT 0x1e20
-
-#define MGAREG_Reset 0x1e40
-
-#define MGAREG_OPMODE 0x1e54
-
-/* Warp Registers */
-#define MGAREG_WIADDR 0x1dc0
-#define MGAREG_WIADDR2 0x1dd8
-#define MGAREG_WGETMSB 0x1dc8
-#define MGAREG_WVRTXSZ 0x1dcc
-#define MGAREG_WACCEPTSEQ 0x1dd4
-#define MGAREG_WMISC 0x1e70
-
-/* OPMODE register additives */
-
-#define MGAOPM_DMA_GENERAL (0x00 << 2)
-#define MGAOPM_DMA_BLIT (0x01 << 2)
-#define MGAOPM_DMA_VECTOR (0x10 << 2)
-
-/* DWGCTL register additives */
-
-/* Lines */
-
-#define MGADWG_LINE_OPEN 0x00
-#define MGADWG_AUTOLINE_OPEN 0x01
-#define MGADWG_LINE_CLOSE 0x02
-#define MGADWG_AUTOLINE_CLOSE 0x03
-
-/* Trapezoids */
-#define MGADWG_TRAP 0x04
-#define MGADWG_TEXTURE_TRAP 0x05
-
-/* BitBlts */
-
-#define MGADWG_BITBLT 0x08
-#define MGADWG_FBITBLT 0x0c
-#define MGADWG_ILOAD 0x09
-#define MGADWG_ILOAD_SCALE 0x0d
-#define MGADWG_ILOAD_FILTER 0x0f
-#define MGADWG_ILOAD_HIQH 0x07
-#define MGADWG_ILOAD_HIQHV 0x0e
-#define MGADWG_IDUMP 0x0a
-
-/* atype access to WRAM */
-
-#define MGADWG_RPL ( 0x00 << 4 )
-#define MGADWG_RSTR ( 0x01 << 4 )
-#define MGADWG_ZI ( 0x03 << 4 )
-#define MGADWG_BLK ( 0x04 << 4 )
-#define MGADWG_I ( 0x07 << 4 )
-
-/* specifies whether bit blits are linear or xy */
-#define MGADWG_LINEAR ( 0x01 << 7 )
-
-/* z drawing mode. use MGADWG_NOZCMP for always */
-
-#define MGADWG_NOZCMP ( 0x00 << 8 )
-#define MGADWG_ZE ( 0x02 << 8 )
-#define MGADWG_ZNE ( 0x03 << 8 )
-#define MGADWG_ZLT ( 0x04 << 8 )
-#define MGADWG_ZLTE ( 0x05 << 8 )
-#define MGADWG_GT ( 0x06 << 8 )
-#define MGADWG_GTE ( 0x07 << 8 )
-
-/* use this to force colour expansion circuitry to do its stuff */
-
-#define MGADWG_SOLID ( 0x01 << 11 )
-
-/* ar register at zero */
-
-#define MGADWG_ARZERO ( 0x01 << 12 )
-
-#define MGADWG_SGNZERO ( 0x01 << 13 )
-
-#define MGADWG_SHIFTZERO ( 0x01 << 14 )
-
-/* See table on 4-43 for bop ALU operations */
-
-/* See table on 4-44 for translucidity masks */
-
-#define MGADWG_BMONOLEF ( 0x00 << 25 )
-#define MGADWG_BMONOWF ( 0x04 << 25 )
-#define MGADWG_BPLAN ( 0x01 << 25 )
-
-/* note that if bfcol is specified and you're doing a bitblt, it causes
- a fbitblt to be performed, so check that you obey the fbitblt rules */
-
-#define MGADWG_BFCOL ( 0x02 << 25 )
-#define MGADWG_BUYUV ( 0x0e << 25 )
-#define MGADWG_BU32BGR ( 0x03 << 25 )
-#define MGADWG_BU32RGB ( 0x07 << 25 )
-#define MGADWG_BU24BGR ( 0x0b << 25 )
-#define MGADWG_BU24RGB ( 0x0f << 25 )
-
-#define MGADWG_PATTERN ( 0x01 << 29 )
-#define MGADWG_TRANSC ( 0x01 << 30 )
-#define MGAREG_MISC_WRITE 0x3c2
-#define MGAREG_MISC_READ 0x3cc
-#define MGAREG_MISC_IOADSEL (0x1 << 0)
-#define MGAREG_MISC_RAMMAPEN (0x1 << 1)
-#define MGAREG_MISC_CLK_SEL_VGA25 (0x0 << 2)
-#define MGAREG_MISC_CLK_SEL_VGA28 (0x1 << 2)
-#define MGAREG_MISC_CLK_SEL_MGA_PIX (0x2 << 2)
-#define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2)
-#define MGAREG_MISC_VIDEO_DIS (0x1 << 4)
-#define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5)
-
-/* MMIO VGA registers */
-#define MGAREG_SEQ_INDEX 0x1fc4
-#define MGAREG_SEQ_DATA 0x1fc5
-#define MGAREG_CRTC_INDEX 0x1fd4
-#define MGAREG_CRTC_DATA 0x1fd5
-#define MGAREG_CRTCEXT_INDEX 0x1fde
-#define MGAREG_CRTCEXT_DATA 0x1fdf
-
-
-
-/* MGA bits for registers PCI_OPTION_REG */
-#define MGA1064_OPT_SYS_CLK_PCI ( 0x00 << 0 )
-#define MGA1064_OPT_SYS_CLK_PLL ( 0x01 << 0 )
-#define MGA1064_OPT_SYS_CLK_EXT ( 0x02 << 0 )
-#define MGA1064_OPT_SYS_CLK_MSK ( 0x03 << 0 )
-
-#define MGA1064_OPT_SYS_CLK_DIS ( 0x01 << 2 )
-#define MGA1064_OPT_G_CLK_DIV_1 ( 0x01 << 3 )
-#define MGA1064_OPT_M_CLK_DIV_1 ( 0x01 << 4 )
-
-#define MGA1064_OPT_SYS_PLL_PDN ( 0x01 << 5 )
-#define MGA1064_OPT_VGA_ION ( 0x01 << 8 )
-
-/* MGA registers in PCI config space */
-#define PCI_MGA_INDEX 0x44
-#define PCI_MGA_DATA 0x48
-#define PCI_MGA_OPTION2 0x50
-#define PCI_MGA_OPTION3 0x54
-
-#define RAMDAC_OFFSET 0x3c00
-
-/* TVP3026 direct registers */
-
-#define TVP3026_INDEX 0x00
-#define TVP3026_WADR_PAL 0x00
-#define TVP3026_COL_PAL 0x01
-#define TVP3026_PIX_RD_MSK 0x02
-#define TVP3026_RADR_PAL 0x03
-#define TVP3026_CUR_COL_ADDR 0x04
-#define TVP3026_CUR_COL_DATA 0x05
-#define TVP3026_DATA 0x0a
-#define TVP3026_CUR_RAM 0x0b
-#define TVP3026_CUR_XLOW 0x0c
-#define TVP3026_CUR_XHI 0x0d
-#define TVP3026_CUR_YLOW 0x0e
-#define TVP3026_CUR_YHI 0x0f
-
-/* TVP3026 indirect registers */
-
-#define TVP3026_SILICON_REV 0x01
-#define TVP3026_CURSOR_CTL 0x06
-#define TVP3026_LATCH_CTL 0x0f
-#define TVP3026_TRUE_COLOR_CTL 0x18
-#define TVP3026_MUX_CTL 0x19
-#define TVP3026_CLK_SEL 0x1a
-#define TVP3026_PAL_PAGE 0x1c
-#define TVP3026_GEN_CTL 0x1d
-#define TVP3026_MISC_CTL 0x1e
-#define TVP3026_GEN_IO_CTL 0x2a
-#define TVP3026_GEN_IO_DATA 0x2b
-#define TVP3026_PLL_ADDR 0x2c
-#define TVP3026_PIX_CLK_DATA 0x2d
-#define TVP3026_MEM_CLK_DATA 0x2e
-#define TVP3026_LOAD_CLK_DATA 0x2f
-#define TVP3026_KEY_RED_LOW 0x32
-#define TVP3026_KEY_RED_HI 0x33
-#define TVP3026_KEY_GREEN_LOW 0x34
-#define TVP3026_KEY_GREEN_HI 0x35
-#define TVP3026_KEY_BLUE_LOW 0x36
-#define TVP3026_KEY_BLUE_HI 0x37
-#define TVP3026_KEY_CTL 0x38
-#define TVP3026_MCLK_CTL 0x39
-#define TVP3026_SENSE_TEST 0x3a
-#define TVP3026_TEST_DATA 0x3b
-#define TVP3026_CRC_LSB 0x3c
-#define TVP3026_CRC_MSB 0x3d
-#define TVP3026_CRC_CTL 0x3e
-#define TVP3026_ID 0x3f
-#define TVP3026_RESET 0xff
-
-
-/* MGA1064 DAC Register file */
-/* MGA1064 direct registers */
-
-#define MGA1064_INDEX 0x00
-#define MGA1064_WADR_PAL 0x00
-#define MGA1064_COL_PAL 0x01
-#define MGA1064_PIX_RD_MSK 0x02
-#define MGA1064_RADR_PAL 0x03
-#define MGA1064_DATA 0x0a
-
-#define MGA1064_CUR_XLOW 0x0c
-#define MGA1064_CUR_XHI 0x0d
-#define MGA1064_CUR_YLOW 0x0e
-#define MGA1064_CUR_YHI 0x0f
-
-/* MGA1064 indirect registers */
-#define MGA1064_DVI_PIPE_CTL 0x03
-#define MGA1064_CURSOR_BASE_ADR_LOW 0x04
-#define MGA1064_CURSOR_BASE_ADR_HI 0x05
-#define MGA1064_CURSOR_CTL 0x06
-#define MGA1064_CURSOR_COL0_RED 0x08
-#define MGA1064_CURSOR_COL0_GREEN 0x09
-#define MGA1064_CURSOR_COL0_BLUE 0x0a
-
-#define MGA1064_CURSOR_COL1_RED 0x0c
-#define MGA1064_CURSOR_COL1_GREEN 0x0d
-#define MGA1064_CURSOR_COL1_BLUE 0x0e
-
-#define MGA1064_CURSOR_COL2_RED 0x010
-#define MGA1064_CURSOR_COL2_GREEN 0x011
-#define MGA1064_CURSOR_COL2_BLUE 0x012
-
-#define MGA1064_VREF_CTL 0x018
-
-#define MGA1064_MUL_CTL 0x19
-#define MGA1064_MUL_CTL_8bits 0x0
-#define MGA1064_MUL_CTL_15bits 0x01
-#define MGA1064_MUL_CTL_16bits 0x02
-#define MGA1064_MUL_CTL_24bits 0x03
-#define MGA1064_MUL_CTL_32bits 0x04
-#define MGA1064_MUL_CTL_2G8V16bits 0x05
-#define MGA1064_MUL_CTL_G16V16bits 0x06
-#define MGA1064_MUL_CTL_32_24bits 0x07
-
-#define MGAGDAC_XVREFCTRL 0x18
-#define MGA1064_PIX_CLK_CTL 0x1a
-#define MGA1064_PIX_CLK_CTL_CLK_DIS ( 0x01 << 2 )
-#define MGA1064_PIX_CLK_CTL_CLK_POW_DOWN ( 0x01 << 3 )
-#define MGA1064_PIX_CLK_CTL_SEL_PCI ( 0x00 << 0 )
-#define MGA1064_PIX_CLK_CTL_SEL_PLL ( 0x01 << 0 )
-#define MGA1064_PIX_CLK_CTL_SEL_EXT ( 0x02 << 0 )
-#define MGA1064_PIX_CLK_CTL_SEL_MSK ( 0x03 << 0 )
-
-#define MGA1064_GEN_CTL 0x1d
-#define MGA1064_MISC_CTL 0x1e
-#define MGA1064_MISC_CTL_DAC_POW_DN ( 0x01 << 0 )
-#define MGA1064_MISC_CTL_VGA ( 0x01 << 1 )
-#define MGA1064_MISC_CTL_DIS_CON ( 0x03 << 1 )
-#define MGA1064_MISC_CTL_MAFC ( 0x02 << 1 )
-#define MGA1064_MISC_CTL_VGA8 ( 0x01 << 3 )
-#define MGA1064_MISC_CTL_DAC_RAM_CS ( 0x01 << 4 )
-
-#define MGA1064_GEN_IO_CTL 0x2a
-#define MGA1064_GEN_IO_DATA 0x2b
-#define MGA1064_SYS_PLL_M 0x2c
-#define MGA1064_SYS_PLL_N 0x2d
-#define MGA1064_SYS_PLL_P 0x2e
-#define MGA1064_SYS_PLL_STAT 0x2f
-#define MGA1064_ZOOM_CTL 0x38
-#define MGA1064_SENSE_TST 0x3a
-
-#define MGA1064_CRC_LSB 0x3c
-#define MGA1064_CRC_MSB 0x3d
-#define MGA1064_CRC_CTL 0x3e
-#define MGA1064_COL_KEY_MSK_LSB 0x40
-#define MGA1064_COL_KEY_MSK_MSB 0x41
-#define MGA1064_COL_KEY_LSB 0x42
-#define MGA1064_COL_KEY_MSB 0x43
-#define MGA1064_PIX_PLLA_M 0x44
-#define MGA1064_PIX_PLLA_N 0x45
-#define MGA1064_PIX_PLLA_P 0x46
-#define MGA1064_PIX_PLLB_M 0x48
-#define MGA1064_PIX_PLLB_N 0x49
-#define MGA1064_PIX_PLLB_P 0x4a
-#define MGA1064_PIX_PLLC_M 0x4c
-#define MGA1064_PIX_PLLC_N 0x4d
-#define MGA1064_PIX_PLLC_P 0x4e
-
-#define MGA1064_PIX_PLL_STAT 0x4f
-
-/*Added for G450 dual head*/
-/* Supported PLL*/
-#define __PIXEL_PLL 1
-#define __SYSTEM_PLL 2
-#define __VIDEO_PLL 3
-
-#define MGA1064_VID_PLL_P 0x8D
-#define MGA1064_VID_PLL_M 0x8E
-#define MGA1064_VID_PLL_N 0x8F
-
-#define MGA1064_DISP_CTL 0x8a
-#define MGA1064_SYNC_CTL 0x8b
-#define MGA1064_PWR_CTL 0xa0
-#define MGA1064_PAN_CTL 0xa2
-
-/* Using crtc2 */
-#define MGAREG2_C2CTL 0x10
-#define MGAREG2_C2HPARAM 0x14
-#define MGAREG2_C2HSYNC 0x18
-#define MGAREG2_C2VPARAM 0x1c
-#define MGAREG2_C2VSYNC 0x20
-#define MGAREG2_C2STARTADD0 0x28
-
-#define MGAREG2_C2OFFSET 0x40
-#define MGAREG2_C2DATACTL 0x4c
-
-#define MGAREG_C2CTL 0x3c10
-#define MGAREG_C2HPARAM 0x3c14
-#define MGAREG_C2HSYNC 0x3c18
-#define MGAREG_C2VPARAM 0x3c1c
-#define MGAREG_C2VSYNC 0x3c20
-#define MGAREG_C2STARTADD0 0x3c28
-
-#define MGAREG_C2OFFSET 0x3c40
-#define MGAREG_C2DATACTL 0x3c4c
-
-#define MGA1064_DISP_CTL 0x8a
-#define MGA1064_SYNC_CTL 0x8b
-#define MGA1064_PWR_CTL 0xa0
-
-/* video register */
-
-#define MGAREG_BESA1C3ORG 0x3d60
-#define MGAREG_BESA1CORG 0x3d10
-#define MGAREG_BESA1ORG 0x3d00
-#define MGAREG_BESCTL 0x3d20
-#define MGAREG_BESGLOBCTL 0x3dc0
-#define MGAREG_BESHCOORD 0x3d28
-#define MGAREG_BESHISCAL 0x3d30
-#define MGAREG_BESHSRCEND 0x3d3c
-#define MGAREG_BESHSRCLST 0x3d50
-#define MGAREG_BESHSRCST 0x3d38
-#define MGAREG_BESLUMACTL 0x3d40
-#define MGAREG_BESPITCH 0x3d24
-#define MGAREG_BESV1SRCLST 0x3d54
-#define MGAREG_BESV1WGHT 0x3d48
-#define MGAREG_BESVCOORD 0x3d2c
-#define MGAREG_BESVISCAL 0x3d34
-
-/* texture engine registers */
-
-#define MGAREG_TMR0 0x2c00
-#define MGAREG_TMR1 0x2c04
-#define MGAREG_TMR2 0x2c08
-#define MGAREG_TMR3 0x2c0c
-#define MGAREG_TMR4 0x2c10
-#define MGAREG_TMR5 0x2c14
-#define MGAREG_TMR6 0x2c18
-#define MGAREG_TMR7 0x2c1c
-#define MGAREG_TMR8 0x2c20
-#define MGAREG_TEXORG 0x2c24
-#define MGAREG_TEXWIDTH 0x2c28
-#define MGAREG_TEXHEIGHT 0x2c2c
-#define MGAREG_TEXCTL 0x2c30
-#define MGAREG_TEXCTL2 0x2c3c
-#define MGAREG_TEXTRANS 0x2c34
-#define MGAREG_TEXTRANSHIGH 0x2c38
-#define MGAREG_TEXFILTER 0x2c58
-#define MGAREG_ALPHASTART 0x2c70
-#define MGAREG_ALPHAXINC 0x2c74
-#define MGAREG_ALPHAYINC 0x2c78
-#define MGAREG_ALPHACTRL 0x2c7c
-#define MGAREG_DWGSYNC 0x2c4c
-
-#define MGAREG_AGP_PLL 0x1e4c
-#define MGA_AGP2XPLL_ENABLE 0x1
-#define MGA_AGP2XPLL_DISABLE 0x0
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/Makefile
deleted file mode 100644
index 796dfbc51..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# src/mesa/drivers/dri/r128/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = r128_dri.so
-
-MINIGLX_SOURCES = server/r128_dri.c
-
-DRIVER_SOURCES = \
- r128_context.c \
- r128_lock.c \
- r128_state.c \
- r128_texstate.c \
- r128_dd.c \
- r128_screen.c \
- r128_tex.c \
- r128_tris.c \
- r128_ioctl.c \
- r128_span.c \
- r128_texmem.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.c
deleted file mode 100644
index f071bbecb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.8 2002/10/30 12:51:38 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_dd.h"
-#include "r128_state.h"
-#include "r128_span.h"
-#include "r128_tex.h"
-#include "r128_tris.h"
-
-#include "vblank.h"
-#include "utils.h"
-#include "texmem.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-
-#ifndef R128_DEBUG
-int R128_DEBUG = 0;
-#endif
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_EXT_blend_minmax
-#include "extension_helper.h"
-
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_EXT_blend_subtract", GL_EXT_blend_minmax_functions },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-static const struct dri_debug_control debug_control[] =
-{
- { "ioctl", DEBUG_VERBOSE_IOCTL },
- { "verb", DEBUG_VERBOSE_MSG },
- { "dri", DEBUG_VERBOSE_DRI },
- { "2d", DEBUG_VERBOSE_2D },
- { "sync", DEBUG_ALWAYS_SYNC },
- { "api", DEBUG_VERBOSE_API },
- { "fall", DEBUG_VERBOSE_FALL },
- { NULL, 0 }
-};
-
-/* Create the device specific context.
- */
-GLboolean r128CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- struct dd_function_table functions;
- r128ContextPtr rmesa;
- r128ScreenPtr r128scrn;
- int i;
-
- /* Allocate the r128 context */
- rmesa = (r128ContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
- return GL_FALSE;
-
- /* Init default driver functions then plug in our Radeon-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions( &functions );
- r128InitDriverFuncs( &functions );
- r128InitIoctlFuncs( &functions );
- r128InitTextureFuncs( &functions );
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((r128ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
- &functions, (void *) rmesa);
- if (!rmesa->glCtx) {
- FREE(rmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = rmesa;
- ctx = rmesa->glCtx;
-
- rmesa->driContext = driContextPriv;
- rmesa->driScreen = sPriv;
- rmesa->driDrawable = NULL;
- rmesa->hHWContext = driContextPriv->hHWContext;
- rmesa->driHwLock = &sPriv->pSAREA->lock;
- rmesa->driFd = sPriv->fd;
-
- r128scrn = rmesa->r128Screen = (r128ScreenPtr)(sPriv->private);
-
- /* Parse configuration files */
- driParseConfigFiles (&rmesa->optionCache, &r128scrn->optionCache,
- r128scrn->driScreen->myNum, "r128");
-
- rmesa->sarea = (drm_r128_sarea_t *)((char *)sPriv->pSAREA +
- r128scrn->sarea_priv_offset);
-
- rmesa->CurrentTexObj[0] = NULL;
- rmesa->CurrentTexObj[1] = NULL;
-
- (void) memset( rmesa->texture_heaps, 0, sizeof( rmesa->texture_heaps ) );
- make_empty_list( & rmesa->swapped );
-
- rmesa->nr_heaps = r128scrn->numTexHeaps;
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- rmesa->texture_heaps[i] = driCreateTextureHeap( i, rmesa,
- r128scrn->texSize[i],
- 12,
- R128_NR_TEX_REGIONS,
- (drmTextureRegionPtr)rmesa->sarea->tex_list[i],
- &rmesa->sarea->tex_age[i],
- &rmesa->swapped,
- sizeof( r128TexObj ),
- (destroy_texture_object_t *) r128DestroyTexObj );
-
- driSetTextureSwapCounterLocation( rmesa->texture_heaps[i],
- & rmesa->c_textureSwaps );
- }
- rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache,
- "texture_depth");
- if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- rmesa->texture_depth = ( r128scrn->cpp == 4 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
-
- rmesa->RenderIndex = -1; /* Impossible value */
- rmesa->vert_buf = NULL;
- rmesa->num_verts = 0;
- rmesa->tnl_state = ~0;
-
- /* Set the maximum texture size small enough that we can guarentee that
- * all texture units can bind a maximal texture and have them both in
- * texturable memory at once.
- */
-
- ctx->Const.MaxTextureUnits = 2;
- ctx->Const.MaxTextureImageUnits = 2;
- ctx->Const.MaxTextureCoordUnits = 2;
-
- driCalculateMaxTextureLevels( rmesa->texture_heaps,
- rmesa->nr_heaps,
- & ctx->Const,
- 4,
- 10, /* max 2D texture size is 1024x1024 */
- 0, /* 3D textures unsupported. */
- 0, /* cube textures unsupported. */
- 0, /* texture rectangles unsupported. */
- 11,
- GL_FALSE );
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- /* No wide lines.
- */
- 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;
-
-#if ENABLE_PERF_BOXES
- rmesa->boxes = driQueryOptionb(&rmesa->optionCache, "performance_boxes");
-#endif
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
-/* _tnl_destroy_pipeline( ctx ); */
-/* _tnl_install_pipeline( ctx, r128_pipeline ); */
-
- /* Configure swrast and T&L 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 );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- if (sPriv->drmMinor >= 4)
- _mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" );
-
- r128InitTriFuncs( ctx );
- r128DDInitStateFuncs( ctx );
- r128DDInitSpanFuncs( ctx );
- r128DDInitState( rmesa );
-
- rmesa->vblank_flags = (rmesa->r128Screen->irq != 0)
- ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- driContextPriv->driverPrivate = (void *)rmesa;
-
-#if DO_DEBUG
- R128_DEBUG = driParseDebugString( getenv( "R128_DEBUG" ),
- debug_control );
-#endif
-
- if (driQueryOptionb(&rmesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(rmesa, R128_FALLBACK_DISABLE, 1);
- }
-
- return GL_TRUE;
-}
-
-/* Destroy the device specific context.
- */
-void r128DestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- r128ContextPtr rmesa = (r128ContextPtr) driContextPriv->driverPrivate;
-
- assert(rmesa); /* should never be null */
- if ( rmesa ) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
-
- _swsetup_DestroyContext( rmesa->glCtx );
- _tnl_DestroyContext( rmesa->glCtx );
- _ac_DestroyContext( rmesa->glCtx );
- _swrast_DestroyContext( rmesa->glCtx );
-
- /* free the Mesa context */
- rmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(rmesa->glCtx);
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( rmesa->texture_heaps[ i ] );
- rmesa->texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & rmesa->swapped ) );
- }
-
- /* free the option cache */
- driDestroyOptionCache (&rmesa->optionCache);
-
- FREE( rmesa );
- }
-
-#if 0
- /* Use this to force shared object profiling. */
- glx_fini_prof();
-#endif
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean
-r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- GET_CURRENT_CONTEXT(ctx);
- r128ContextPtr oldR128Ctx = ctx ? R128_CONTEXT(ctx) : NULL;
- r128ContextPtr newR128Ctx = (r128ContextPtr) driContextPriv->driverPrivate;
-
- if ( newR128Ctx != oldR128Ctx ) {
- newR128Ctx->new_state |= R128_NEW_CONTEXT;
- newR128Ctx->dirty = R128_UPLOAD_ALL;
- }
-
- driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags );
- newR128Ctx->driDrawable = driDrawPriv;
-
- _mesa_make_current( newR128Ctx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- newR128Ctx->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP;
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return GL_TRUE;
-}
-
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-r128UnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.h
deleted file mode 100644
index e91257f7f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_context.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.12 2002/12/16 16:18:52 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __R128_CONTEXT_H__
-#define __R128_CONTEXT_H__
-
-#include "dri_util.h"
-#include "drm.h"
-#include "r128_drm.h"
-
-#include "mtypes.h"
-#include "tnl/t_vertex.h"
-
-#include "r128_reg.h"
-
-#include "texmem.h"
-
-struct r128_context;
-typedef struct r128_context r128ContextRec;
-typedef struct r128_context *r128ContextPtr;
-
-#include "r128_lock.h"
-#include "r128_texobj.h"
-#include "r128_screen.h"
-
-/* Flags for what context state needs to be updated:
- */
-#define R128_NEW_ALPHA 0x0001
-#define R128_NEW_DEPTH 0x0002
-#define R128_NEW_FOG 0x0004
-#define R128_NEW_CLIP 0x0008
-#define R128_NEW_CULL 0x0010
-#define R128_NEW_MASKS 0x0020
-#define R128_NEW_RENDER_NOT 0x0040
-#define R128_NEW_WINDOW 0x0080
-#define R128_NEW_CONTEXT 0x0100
-#define R128_NEW_ALL 0x01ff
-
-/* Flags for software fallback cases:
- */
-#define R128_FALLBACK_TEXTURE 0x0001
-#define R128_FALLBACK_DRAW_BUFFER 0x0002
-#define R128_FALLBACK_READ_BUFFER 0x0004
-#define R128_FALLBACK_STENCIL 0x0008
-#define R128_FALLBACK_RENDER_MODE 0x0010
-#define R128_FALLBACK_LOGICOP 0x0020
-#define R128_FALLBACK_SEP_SPECULAR 0x0040
-#define R128_FALLBACK_BLEND_EQ 0x0080
-#define R128_FALLBACK_BLEND_FUNC 0x0100
-#define R128_FALLBACK_PROJTEX 0x0200
-#define R128_FALLBACK_DISABLE 0x0400
-
-
-/* Use the templated vertex format:
- */
-#define TAG(x) r128##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-/* Reasons why the GL_BLEND fallback mightn't work:
- */
-#define R128_BLEND_ENV_COLOR 0x1
-#define R128_BLEND_MULTITEX 0x2
-
-/* Subpixel offsets for window coordinates (triangles):
- */
-#define SUBPIXEL_X (0.0F)
-#define SUBPIXEL_Y (0.125F)
-
-
-typedef void (*r128_tri_func)( r128ContextPtr,
- r128Vertex *,
- r128Vertex *,
- r128Vertex * );
-
-typedef void (*r128_line_func)( r128ContextPtr,
- r128Vertex *,
- r128Vertex * );
-
-typedef void (*r128_point_func)( r128ContextPtr,
- r128Vertex * );
-
-
-struct r128_context {
- GLcontext *glCtx; /* Mesa context */
-
- /* Driver and hardware state management
- */
- GLuint new_state;
- GLuint dirty; /* Hardware state to be updated */
- drm_r128_context_regs_t setup;
-
- /* Vertex state */
- GLuint vertex_size;
- GLuint vertex_format;
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
- char *verts; /* points to tnl->clipspace.vertex_buf */
- GLuint num_verts;
- int coloroffset, specoffset;
- int tnl_state; /* tnl->render_inputs for this _tnl_install_attrs */
-
- GLuint NewGLState;
- GLuint Fallback;
- GLuint RenderIndex;
- GLfloat hw_viewport[16];
- GLfloat depth_scale;
-
- u_int32_t ClearColor; /* Color used to clear color buffer */
- u_int32_t ClearDepth; /* Value used to clear depth buffer */
- u_int32_t ClearStencil; /* Value used to clear stencil */
-
- /* Map GL texture units onto hardware
- */
- GLint multitex;
- GLint tmu_source[2];
- GLuint tex_combine[2];
- GLuint blend_flags;
- GLuint env_color;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ R128_NR_TEX_HEAPS ];
- driTextureObject swapped;
-
- r128TexObjPtr CurrentTexObj[2];
-
- int texture_depth;
-
- /* Fallback rasterization functions
- */
- r128_point_func draw_point;
- r128_line_func draw_line;
- r128_tri_func draw_tri;
-
- /* Vertex buffers
- */
- drmBufPtr vert_buf;
-
- GLuint hw_primitive;
- GLenum render_primitive;
-
- /* Page flipping
- */
- GLuint doPageFlip;
-
- /* Drawable, cliprect and scissor information
- */
- GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
-
- GLuint scissor;
- drm_clip_rect_t ScissorRect; /* Current software scissor */
-
- /* Mirrors of some DRI state
- */
- __DRIcontextPrivate *driContext; /* DRI context */
- __DRIscreenPrivate *driScreen; /* DRI screen */
- __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
-
- unsigned int lastStamp; /* mirror driDrawable->lastStamp */
-
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
-
- r128ScreenPtr r128Screen; /* Screen private DRI data */
- drm_r128_sarea_t *sarea; /* Private SAREA data */
-
- /* Performance counters
- */
- GLuint boxes; /* Draw performance boxes */
- GLuint hardwareWentIdle;
- GLuint c_clears;
- GLuint c_drawWaits;
- GLuint c_textureSwaps;
- GLuint c_textureBytes;
- GLuint c_vertexBuffers;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define R128_CONTEXT(ctx) ((r128ContextPtr)(ctx->DriverCtx))
-
-#define R128_IS_PLAIN( rmesa ) \
- (rmesa->r128Screen->chipset == R128_CARD_TYPE_R128)
-#define R128_IS_PRO( rmesa ) \
- (rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_PRO)
-#define R128_IS_MOBILITY( rmesa ) \
- (rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_MOBILITY)
-
-
-extern GLboolean r128CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void r128DestroyContext( __DRIcontextPrivate * );
-
-extern GLboolean r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-
-extern GLboolean r128UnbindContext( __DRIcontextPrivate *driContextPriv );
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-#define ENABLE_PERF_BOXES 0
-
-#if DO_DEBUG
-extern int R128_DEBUG;
-#else
-#define R128_DEBUG 0
-#endif
-
-#define DEBUG_ALWAYS_SYNC 0x01
-#define DEBUG_VERBOSE_API 0x02
-#define DEBUG_VERBOSE_MSG 0x04
-#define DEBUG_VERBOSE_LRU 0x08
-#define DEBUG_VERBOSE_DRI 0x10
-#define DEBUG_VERBOSE_IOCTL 0x20
-#define DEBUG_VERBOSE_2D 0x40
-#define DEBUG_VERBOSE_FALL 0x80
-
-#endif /* __R128_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.c
deleted file mode 100644
index 59480b25d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.15 2002/10/30 12:51:38 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_state.h"
-#include "r128_dd.h"
-#include "swrast/swrast.h"
-
-#include "context.h"
-#include "framebuffer.h"
-
-#include "utils.h"
-
-#define DRIVER_DATE "20041026"
-
-
-/* Return the width and height of the current color buffer.
- */
-static void r128GetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- LOCK_HARDWARE( rmesa );
- *width = rmesa->driDrawable->w;
- *height = rmesa->driDrawable->h;
- UNLOCK_HARDWARE( rmesa );
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *r128GetString( GLcontext *ctx, GLenum name )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- const char * card_name = "Rage 128";
- GLuint agp_mode = rmesa->r128Screen->IsPCI ? 0 :
- rmesa->r128Screen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"VA Linux Systems, Inc.";
-
- case GL_RENDERER:
- /* Select the spefic chipset.
- */
- if ( R128_IS_PRO( rmesa ) ) {
- card_name = "Rage 128 Pro";
- }
- else if ( R128_IS_MOBILITY( rmesa ) ) {
- card_name = "Rage 128 Mobility";
- }
-
- offset = driGetRendererString( buffer, card_name, DRIVER_DATE,
- agp_mode );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Send all commands to the hardware. If vertex buffers or indirect
- * buffers are in use, then we need to make sure they are sent to the
- * hardware. All commands that are normally sent to the ring are
- * already considered `flushed'.
- */
-static void r128Flush( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
-
-#if ENABLE_PERF_BOXES
- if ( rmesa->boxes ) {
- LOCK_HARDWARE( rmesa );
- r128PerformanceBoxesLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- }
-
- /* Log the performance counters if necessary */
- r128PerformanceCounters( rmesa );
-#endif
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-static void r128Finish( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- rmesa->c_drawWaits++;
-#endif
-
- r128Flush( ctx );
- r128WaitForIdle( rmesa );
-}
-
-
-/* Initialize the driver's misc functions.
- */
-void r128InitDriverFuncs( struct dd_function_table *functions )
-{
- functions->GetBufferSize = r128GetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = r128GetString;
- functions->Finish = r128Finish;
- functions->Flush = r128Flush;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.h
deleted file mode 100644
index 7a0abb73f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_dd.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.h,v 1.3 2001/01/08 01:07:20 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_DD_H__
-#define __R128_DD_H__
-
-extern void r128InitDriverFuncs( struct dd_function_table *functions );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.c
deleted file mode 100644
index fc017329c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.10 2002/12/16 16:18:53 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-#include <errno.h>
-
-#define STANDALONE_MMIO
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast/swrast.h"
-
-#include "vblank.h"
-#include "mmio.h"
-
-#define R128_TIMEOUT 2048
-#define R128_IDLE_RETRY 32
-
-
-/* =============================================================
- * Hardware vertex buffer handling
- */
-
-/* Get a new VB from the pool of vertex buffers in AGP space.
- */
-drmBufPtr r128GetBufferLocked( r128ContextPtr rmesa )
-{
- int fd = rmesa->r128Screen->driScreen->fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- drmBufPtr buf = NULL;
- int to = 0;
- int ret;
-
- dma.context = rmesa->hHWContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = R128_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- while ( !buf && ( to++ < R128_TIMEOUT ) ) {
- ret = drmDMA( fd, &dma );
-
- if ( ret == 0 ) {
- buf = &rmesa->r128Screen->buffers->list[index];
- buf->used = 0;
-#if ENABLE_PERF_BOXES
- /* Bump the performance counter */
- rmesa->c_vertexBuffers++;
-#endif
- return buf;
- }
- }
-
- if ( !buf ) {
- drmCommandNone( fd, DRM_R128_CCE_RESET);
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Could not get new VB... exiting\n" );
- exit( -1 );
- }
-
- return buf;
-}
-
-void r128FlushVerticesLocked( r128ContextPtr rmesa )
-{
- drm_clip_rect_t *pbox = rmesa->pClipRects;
- int nbox = rmesa->numClipRects;
- drmBufPtr buffer = rmesa->vert_buf;
- int count = rmesa->num_verts;
- int prim = rmesa->hw_primitive;
- int fd = rmesa->driScreen->fd;
- drm_r128_vertex_t vertex;
- int i;
-
- rmesa->num_verts = 0;
- rmesa->vert_buf = NULL;
-
- if ( !buffer )
- return;
-
- if ( rmesa->dirty & ~R128_UPLOAD_CLIPRECTS )
- r128EmitHwStateLocked( rmesa );
-
- if ( !nbox )
- count = 0;
-
- if ( nbox >= R128_NR_SAREA_CLIPRECTS )
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
-
- if ( !count || !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- vertex.prim = prim;
- vertex.idx = buffer->idx;
- vertex.count = count;
- vertex.discard = 1;
- drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(vertex) );
- }
- else
- {
- for ( i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- int discard = 0;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++ ) {
- *b++ = pbox[i];
- }
-
- /* Finished with the buffer?
- */
- if ( nr == nbox ) {
- discard = 1;
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- vertex.prim = prim;
- vertex.idx = buffer->idx;
- vertex.count = count;
- vertex.discard = discard;
- drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(vertex) );
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-
-
-
-
-/* ================================================================
- * Texture uploads
- */
-
-void r128FireBlitLocked( r128ContextPtr rmesa, drmBufPtr buffer,
- GLint offset, GLint pitch, GLint format,
- GLint x, GLint y, GLint width, GLint height )
-{
- drm_r128_blit_t blit;
- GLint ret;
-
- blit.idx = buffer->idx;
- blit.offset = offset;
- blit.pitch = pitch;
- blit.format = format;
- blit.x = x;
- blit.y = y;
- blit.width = width;
- blit.height = height;
-
- ret = drmCommandWrite( rmesa->driFd, DRM_R128_BLIT,
- &blit, sizeof(blit) );
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_R128_BLIT: return = %d\n", ret );
- exit( 1 );
- }
-}
-
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-
-static void delay( void ) {
-/* Prevent an optimizing compiler from removing a spin loop */
-}
-
-#define R128_MAX_OUTSTANDING 2
-
-
-/* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- * GH: We probably don't want a timeout here, as we can wait as
- * long as we want for a frame to complete. If it never does, then
- * the card has locked.
- */
-static int r128WaitForFrameCompletion( r128ContextPtr rmesa )
-{
- unsigned char *R128MMIO = rmesa->r128Screen->mmio.map;
- int i;
- int wait = 0;
-
- while ( 1 ) {
- u_int32_t frame = read_MMIO_LE32( R128MMIO, R128_LAST_FRAME_REG );
-
- if ( rmesa->sarea->last_frame - frame <= R128_MAX_OUTSTANDING ) {
- break;
- }
-
- /* Spin in place a bit so we aren't hammering the register */
- wait++;
- for ( i = 0 ; i < 1024 ; i++ ) {
- delay();
- }
- }
-
- return wait;
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void r128CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- r128ContextPtr rmesa;
- GLint nbox, i, ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "\n********************************\n" );
- fprintf( stderr, "\n%s( %p )\n\n",
- __FUNCTION__, (void *)rmesa->glCtx );
- fflush( stderr );
- }
-
- FLUSH_BATCH( rmesa );
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- if ( !r128WaitForFrameCompletion( rmesa ) ) {
- rmesa->hardwareWentIdle = 1;
- } else {
- rmesa->hardwareWentIdle = 0;
- }
-
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target );
- LOCK_HARDWARE( rmesa );
-
- nbox = dPriv->numClipRects; /* must be in locked region */
-
- for ( i = 0 ; i < nbox ; ) {
- GLint nr = MIN2( i + R128_NR_SAREA_CLIPRECTS , nbox );
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- rmesa->sarea->nbox = n;
-
- ret = drmCommandNone( rmesa->driFd, DRM_R128_SWAP );
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_R128_SWAP: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- if ( R128_DEBUG & DEBUG_ALWAYS_SYNC ) {
- i = 0;
- do {
- ret = drmCommandNone(rmesa->driFd, DRM_R128_CCE_IDLE);
- } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
- }
-
- UNLOCK_HARDWARE( rmesa );
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= (R128_UPLOAD_CONTEXT |
- R128_UPLOAD_MASKS |
- R128_UPLOAD_CLIPRECTS);
-
-#if ENABLE_PERF_BOXES
- /* Log the performance counters if necessary */
- r128PerformanceCounters( rmesa );
-#endif
-}
-
-void r128PageFlip( const __DRIdrawablePrivate *dPriv )
-{
- r128ContextPtr rmesa;
- GLint ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "\n%s( %p ): page=%d\n\n",
- __FUNCTION__, (void *)rmesa->glCtx, rmesa->sarea->pfCurrentPage );
- }
-
- FLUSH_BATCH( rmesa );
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- if ( !r128WaitForFrameCompletion( rmesa ) ) {
- rmesa->hardwareWentIdle = 1;
- } else {
- rmesa->hardwareWentIdle = 0;
- }
-
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target );
- LOCK_HARDWARE( rmesa );
-
- /* The kernel will have been initialized to perform page flipping
- * on a swapbuffers ioctl.
- */
- ret = drmCommandNone( rmesa->driFd, DRM_R128_FLIP );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_R128_FLIP: return = %d\n", ret );
- exit( 1 );
- }
-
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->r128Screen->frontPitch;
- } else {
- rmesa->drawOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->r128Screen->backPitch;
- }
-
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
- rmesa->new_state |= R128_NEW_WINDOW;
-
- /* FIXME: Do we need this anymore? */
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= (R128_UPLOAD_CONTEXT |
- R128_UPLOAD_MASKS |
- R128_UPLOAD_CLIPRECTS);
-
-#if ENABLE_PERF_BOXES
- /* Log the performance counters if necessary */
- r128PerformanceCounters( rmesa );
-#endif
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-
-static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable;
- drm_r128_clear_t clear;
- GLuint flags = 0;
- GLint i;
- GLint ret;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s:\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( rmesa );
-
- /* The only state change we care about here is the RGBA colormask
- * We'll just update that state, if needed. If we do more then
- * there's some strange side-effects that the conformance tests find.
- */
- if ( rmesa->new_state & R128_NEW_MASKS) {
- const GLuint save_state = rmesa->new_state;
- rmesa->new_state = R128_NEW_MASKS;
- r128DDUpdateHWState( ctx );
- rmesa->new_state = save_state & ~R128_NEW_MASKS;
- }
-
- if ( mask & BUFFER_BIT_FRONT_LEFT ) {
- flags |= R128_FRONT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ( mask & BUFFER_BIT_BACK_LEFT ) {
- flags |= R128_BACK;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) {
- flags |= R128_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-#if 0
- /* FIXME: Add stencil support */
- if ( mask & BUFFER_BIT_STENCIL ) {
- flags |= DRM_R128_DEPTH_BUFFER;
- mask &= ~BUFFER_BIT_STENCIL;
- }
-#endif
-
- if ( flags ) {
-
- /* Flip top to bottom */
- cx += dPriv->x;
- cy = dPriv->y + dPriv->h - cy - ch;
-
- LOCK_HARDWARE( rmesa );
-
- /* FIXME: Do we actually need this?
- */
- if ( rmesa->dirty & ~R128_UPLOAD_CLIPRECTS ) {
- r128EmitHwStateLocked( rmesa );
- }
-
- for ( i = 0 ; i < rmesa->numClipRects ; ) {
- GLint nr = MIN2( i + R128_NR_SAREA_CLIPRECTS , rmesa->numClipRects );
- drm_clip_rect_t *box = rmesa->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- rmesa->sarea->nbox = n;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_IOCTL ) {
- fprintf( stderr,
- "DRM_R128_CLEAR: flag 0x%x color %x depth %x nbox %d\n",
- flags,
- (GLuint)rmesa->ClearColor,
- (GLuint)rmesa->ClearDepth,
- rmesa->sarea->nbox );
- }
-
- clear.flags = flags;
- clear.clear_color = rmesa->ClearColor;
- clear.clear_depth = rmesa->ClearDepth;
- clear.color_mask = rmesa->setup.plane_3d_mask_c;
- clear.depth_mask = ~0;
-
- ret = drmCommandWrite( rmesa->driFd, DRM_R128_CLEAR,
- &clear, sizeof(clear) );
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_R128_CLEAR: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
-
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-
-/* ================================================================
- * Depth spans, pixels
- */
-
-void r128WriteDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y,
- const GLdepth depth[],
- const GLubyte mask[] )
-{
- drm_clip_rect_t *pbox = rmesa->pClipRects;
- drm_r128_depth_t d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = R128_WRITE_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
-
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- drm_clip_rect_t *b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = R128_WRITE_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-void r128WriteDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth depth[],
- const GLubyte mask[] )
-{
- drm_clip_rect_t *pbox = rmesa->pClipRects;
- drm_r128_depth_t d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = R128_WRITE_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- drm_clip_rect_t *b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = R128_WRITE_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = (unsigned int *)depth;
- d.mask = (unsigned char *)mask;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y )
-{
- drm_clip_rect_t *pbox = rmesa->pClipRects;
- drm_r128_depth_t d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = R128_READ_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- drm_clip_rect_t *b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = R128_READ_SPAN;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[] )
-{
- drm_clip_rect_t *pbox = rmesa->pClipRects;
- drm_r128_depth_t d;
- int nbox = rmesa->numClipRects;
- int fd = rmesa->driScreen->fd;
- int i;
-
- if ( !nbox || !n ) {
- return;
- }
- if ( nbox >= R128_NR_SAREA_CLIPRECTS ) {
- rmesa->dirty |= R128_UPLOAD_CLIPRECTS;
- }
-
- if ( !(rmesa->dirty & R128_UPLOAD_CLIPRECTS) )
- {
- if ( nbox < 3 ) {
- rmesa->sarea->nbox = 0;
- } else {
- rmesa->sarea->nbox = nbox;
- }
-
- d.func = R128_READ_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
- }
- else
- {
- for (i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + R128_NR_SAREA_CLIPRECTS, nbox );
- drm_clip_rect_t *b = rmesa->sarea->boxes;
-
- rmesa->sarea->nbox = nr - i;
- for ( ; i < nr ; i++) {
- *b++ = pbox[i];
- }
-
- rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
-
- d.func = R128_READ_PIXELS;
- d.n = n;
- d.x = (int*)&x;
- d.y = (int*)&y;
- d.buffer = NULL;
- d.mask = NULL;
-
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
- }
- }
-
- rmesa->dirty &= ~R128_UPLOAD_CLIPRECTS;
-}
-
-
-void r128WaitForIdleLocked( r128ContextPtr rmesa )
-{
- int fd = rmesa->r128Screen->driScreen->fd;
- int to = 0;
- int ret, i;
-
- do {
- i = 0;
- do {
- ret = drmCommandNone( fd, DRM_R128_CCE_IDLE);
- } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
- } while ( ( ret == -EBUSY ) && ( to++ < R128_TIMEOUT ) );
-
- if ( ret < 0 ) {
- drmCommandNone( fd, DRM_R128_CCE_RESET);
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Rage 128 timed out... exiting\n" );
- exit( -1 );
- }
-}
-
-void r128InitIoctlFuncs( struct dd_function_table *functions )
-{
- functions->Clear = r128Clear;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.h
deleted file mode 100644
index d2f2dded8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_ioctl.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.h,v 1.6 2002/12/16 16:18:53 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __R128_IOCTL_H__
-#define __R128_IOCTL_H__
-
-#include "r128_dri.h"
-#include "r128_reg.h"
-#include "r128_lock.h"
-
-#define R128_BUFFER_MAX_DWORDS (R128_BUFFER_SIZE / sizeof(u_int32_t))
-
-
-extern drmBufPtr r128GetBufferLocked( r128ContextPtr rmesa );
-extern void r128FlushVerticesLocked( r128ContextPtr rmesa );
-
-static __inline void *r128AllocDmaLow( r128ContextPtr rmesa, int count,
- int vert_size )
-{
- u_int32_t *head;
- int bytes = count * vert_size;
-
- if ( !rmesa->vert_buf ) {
- LOCK_HARDWARE( rmesa );
- rmesa->vert_buf = r128GetBufferLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- } else if ( rmesa->vert_buf->used + bytes > rmesa->vert_buf->total ) {
- LOCK_HARDWARE( rmesa );
- r128FlushVerticesLocked( rmesa );
- rmesa->vert_buf = r128GetBufferLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- }
-
- head = (u_int32_t *)((char *)rmesa->vert_buf->address + rmesa->vert_buf->used);
- rmesa->vert_buf->used += bytes;
- rmesa->num_verts += count;
-
- return head;
-}
-
-extern void r128FireBlitLocked( r128ContextPtr rmesa, drmBufPtr buffer,
- GLint offset, GLint pitch, GLint format,
- GLint x, GLint y, GLint width, GLint height );
-
-extern void r128WriteDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y,
- const GLdepth depth[],
- const GLubyte mask[] );
-extern void r128WriteDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth depth[],
- const GLubyte mask[] );
-extern void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
- GLuint n, GLint x, GLint y );
-extern void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
- const GLint x[], const GLint y[] );
-
-extern void r128CopyBuffer( const __DRIdrawablePrivate *dPriv );
-extern void r128PageFlip( const __DRIdrawablePrivate *dPriv );
-void r128WaitForVBlank( r128ContextPtr rmesa );
-
-extern void r128WaitForIdleLocked( r128ContextPtr rmesa );
-
-
-extern void r128InitIoctlFuncs( struct dd_function_table *functions );
-
-
-/* ================================================================
- * Helper macros:
- */
-
-#define FLUSH_BATCH( rmesa ) \
-do { \
- if ( R128_DEBUG & DEBUG_VERBOSE_IOCTL ) \
- fprintf( stderr, "FLUSH_BATCH in %s\n", __FUNCTION__ ); \
- if ( rmesa->vert_buf ) { \
- r128FlushVertices( rmesa ); \
- } \
-} while (0)
-
-/* 64-bit align the next element address, and then make room for the
- * next indexed prim packet header.
- */
-#define ALIGN_NEXT_ELT( rmesa ) \
-do { \
- rmesa->next_elt = (GLushort *) \
- (((GLuint)rmesa->next_elt + 7) & ~0x7); \
- rmesa->next_elt = (GLushort *) \
- ((GLubyte *)rmesa->next_elt + R128_INDEX_PRIM_OFFSET); \
-} while (0)
-
-#define r128FlushVertices( rmesa ) \
-do { \
- LOCK_HARDWARE( rmesa ); \
- r128FlushVerticesLocked( rmesa ); \
- UNLOCK_HARDWARE( rmesa ); \
-} while (0)
-
-#define r128FlushElts( rmesa ) \
-do { \
- LOCK_HARDWARE( rmesa ); \
- r128FlushEltsLocked( rmesa ); \
- UNLOCK_HARDWARE( rmesa ); \
-} while (0)
-
-#define r128WaitForIdle( rmesa ) \
- do { \
- LOCK_HARDWARE( rmesa ); \
- r128WaitForIdleLocked( rmesa ); \
- UNLOCK_HARDWARE( rmesa ); \
- } while (0)
-
-#endif /* __R128_IOCTL_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.c
deleted file mode 100644
index ea4ccfb2e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.c,v 1.5 2002/10/30 12:51:38 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_lock.h"
-#include "r128_tex.h"
-#include "r128_state.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-
-/* Turn on/off page flipping according to the flags in the sarea:
- */
-static void
-r128UpdatePageFlipping( r128ContextPtr rmesa )
-{
- int use_back;
-
- rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
-
- use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
- use_back ^= (rmesa->sarea->pfCurrentPage == 1);
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API )
- fprintf(stderr, "%s allow %d current %d\n", __FUNCTION__,
- rmesa->doPageFlip,
- rmesa->sarea->pfCurrentPage );
-
- if ( use_back ) {
- rmesa->drawOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->r128Screen->frontPitch;
- }
-
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
- rmesa->new_state |= R128_NEW_WINDOW;
-}
-
-/* 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 r128GetLock( r128ContextPtr rmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable;
- __DRIscreenPrivate *sPriv = rmesa->driScreen;
- drm_r128_sarea_t *sarea = rmesa->sarea;
- int i;
-
- drmGetLock( rmesa->driFd, rmesa->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 ( rmesa->lastStamp != dPriv->lastStamp ) {
- r128UpdatePageFlipping( rmesa );
- rmesa->lastStamp = dPriv->lastStamp;
- rmesa->new_state |= R128_NEW_CLIP;
- rmesa->tnl_state = ~0;
- }
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_CLIPRECTS;
-
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = dPriv->pClipRects;
-
- if ( sarea->ctx_owner != rmesa->hHWContext ) {
- sarea->ctx_owner = rmesa->hHWContext;
- rmesa->dirty = R128_UPLOAD_ALL;
- }
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( rmesa->texture_heaps[i] );
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.h
deleted file mode 100644
index 39bdde982..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_lock.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.h,v 1.4 2001/01/08 01:07:21 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __R128_LOCK_H__
-#define __R128_LOCK_H__
-
-extern void r128GetLock( r128ContextPtr rmesa, 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( rmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( rmesa->driHwLock, rmesa->hHWContext, \
- (DRM_LOCK_HELD | rmesa->hHWContext), __ret ); \
- if ( __ret ) \
- r128GetLock( rmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( rmesa ) \
- do { \
- DRM_UNLOCK( rmesa->driFd, \
- rmesa->driHwLock, \
- rmesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif /* __R128_LOCK_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.c
deleted file mode 100644
index 17cdd60b1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.c
+++ /dev/null
@@ -1,547 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.9 2003/03/26 20:43:49 tsi Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#include "r128_dri.h"
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_span.h"
-#include "r128_tris.h"
-
-#include "context.h"
-#include "imports.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#include "utils.h"
-#include "vblank.h"
-
-#include "GL/internal/dri_interface.h"
-
-/* R128 configuration
- */
-#include "xmlpool.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
-#if ENABLE_PERF_BOXES
- DRI_CONF_PERFORMANCE_BOXES(false)
-#endif
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-#if ENABLE_PERF_BOXES
-static const GLuint __driNConfigOptions = 4;
-#else
-static const GLuint __driNConfigOptions = 3;
-#endif
-
-extern const struct dri_extension card_extensions[];
-
-#if 1
-/* Including xf86PciInfo.h introduces a bunch of errors...
- */
-#define PCI_CHIP_RAGE128LE 0x4C45
-#define PCI_CHIP_RAGE128LF 0x4C46
-#define PCI_CHIP_RAGE128PF 0x5046
-#define PCI_CHIP_RAGE128PR 0x5052
-#define PCI_CHIP_RAGE128RE 0x5245
-#define PCI_CHIP_RAGE128RF 0x5246
-#define PCI_CHIP_RAGE128RK 0x524B
-#define PCI_CHIP_RAGE128RL 0x524C
-#endif
-
-
-/* Create the device specific screen private data struct.
- */
-static r128ScreenPtr
-r128CreateScreen( __DRIscreenPrivate *sPriv )
-{
- r128ScreenPtr r128Screen;
- R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(R128DRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- r128Screen = (r128ScreenPtr) CALLOC( sizeof(*r128Screen) );
- if ( !r128Screen ) return NULL;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&r128Screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- /* This is first since which regions we map depends on whether or
- * not we are using a PCI card.
- */
- r128Screen->IsPCI = r128DRIPriv->IsPCI;
- r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset;
-
- if (sPriv->drmMinor >= 3) {
- drm_r128_getparam_t gp;
- int ret;
-
- gp.param = R128_PARAM_IRQ_NR;
- gp.value = &r128Screen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_R128_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmR128GetParam (R128_PARAM_IRQ_NR): %d\n", ret);
- FREE( r128Screen );
- return NULL;
- }
- }
-
- r128Screen->mmio.handle = r128DRIPriv->registerHandle;
- r128Screen->mmio.size = r128DRIPriv->registerSize;
- if ( drmMap( sPriv->fd,
- r128Screen->mmio.handle,
- r128Screen->mmio.size,
- (drmAddressPtr)&r128Screen->mmio.map ) ) {
- FREE( r128Screen );
- return NULL;
- }
-
- r128Screen->buffers = drmMapBufs( sPriv->fd );
- if ( !r128Screen->buffers ) {
- drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size );
- FREE( r128Screen );
- return NULL;
- }
-
- if ( !r128Screen->IsPCI ) {
- r128Screen->agpTextures.handle = r128DRIPriv->agpTexHandle;
- r128Screen->agpTextures.size = r128DRIPriv->agpTexMapSize;
- if ( drmMap( sPriv->fd,
- r128Screen->agpTextures.handle,
- r128Screen->agpTextures.size,
- (drmAddressPtr)&r128Screen->agpTextures.map ) ) {
- drmUnmapBufs( r128Screen->buffers );
- drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size );
- FREE( r128Screen );
- return NULL;
- }
- }
-
- switch ( r128DRIPriv->deviceID ) {
- case PCI_CHIP_RAGE128RE:
- case PCI_CHIP_RAGE128RF:
- case PCI_CHIP_RAGE128RK:
- case PCI_CHIP_RAGE128RL:
- r128Screen->chipset = R128_CARD_TYPE_R128;
- break;
- case PCI_CHIP_RAGE128PF:
- r128Screen->chipset = R128_CARD_TYPE_R128_PRO;
- break;
- case PCI_CHIP_RAGE128LE:
- case PCI_CHIP_RAGE128LF:
- r128Screen->chipset = R128_CARD_TYPE_R128_MOBILITY;
- break;
- default:
- r128Screen->chipset = R128_CARD_TYPE_R128;
- break;
- }
-
- r128Screen->cpp = r128DRIPriv->bpp / 8;
- r128Screen->AGPMode = r128DRIPriv->AGPMode;
-
- r128Screen->frontOffset = r128DRIPriv->frontOffset;
- r128Screen->frontPitch = r128DRIPriv->frontPitch;
- r128Screen->backOffset = r128DRIPriv->backOffset;
- r128Screen->backPitch = r128DRIPriv->backPitch;
- r128Screen->depthOffset = r128DRIPriv->depthOffset;
- r128Screen->depthPitch = r128DRIPriv->depthPitch;
- r128Screen->spanOffset = r128DRIPriv->spanOffset;
-
- if ( r128DRIPriv->textureSize == 0 ) {
- r128Screen->texOffset[R128_LOCAL_TEX_HEAP] =
- r128DRIPriv->agpTexOffset + R128_AGP_TEX_OFFSET;
- r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->agpTexMapSize;
- r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] =
- r128DRIPriv->log2AGPTexGran;
- } else {
- r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset;
- r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize;
- r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran;
- }
-
- if ( !r128Screen->agpTextures.map || r128DRIPriv->textureSize == 0 ) {
- r128Screen->numTexHeaps = R128_NR_TEX_HEAPS - 1;
- r128Screen->texOffset[R128_AGP_TEX_HEAP] = 0;
- r128Screen->texSize[R128_AGP_TEX_HEAP] = 0;
- r128Screen->logTexGranularity[R128_AGP_TEX_HEAP] = 0;
- } else {
- r128Screen->numTexHeaps = R128_NR_TEX_HEAPS;
- r128Screen->texOffset[R128_AGP_TEX_HEAP] =
- r128DRIPriv->agpTexOffset + R128_AGP_TEX_OFFSET;
- r128Screen->texSize[R128_AGP_TEX_HEAP] = r128DRIPriv->agpTexMapSize;
- r128Screen->logTexGranularity[R128_AGP_TEX_HEAP] =
- r128DRIPriv->log2AGPTexGran;
- }
-
- r128Screen->driScreen = sPriv;
-
- if ( glx_enable_extension != NULL ) {
- if ( r128Screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- }
-
- return r128Screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-r128DestroyScreen( __DRIscreenPrivate *sPriv )
-{
- r128ScreenPtr r128Screen = (r128ScreenPtr)sPriv->private;
-
- if ( !r128Screen )
- return;
-
- if ( !r128Screen->IsPCI ) {
- drmUnmap( (drmAddress)r128Screen->agpTextures.map,
- r128Screen->agpTextures.size );
- }
- drmUnmapBufs( r128Screen->buffers );
- drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size );
-
- /* free all option information */
- driDestroyOptionInfo (&r128Screen->optionCache);
-
- FREE( r128Screen );
- sPriv->private = NULL;
-}
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- r128ScreenPtr screen = (r128ScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- r128SetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- r128SetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- r128SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- r128SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-r128DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-/* Copy the back color buffer to the front color buffer */
-static void
-r128SwapBuffers(__DRIdrawablePrivate *dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- r128ContextPtr rmesa;
- GLcontext *ctx;
- rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = rmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( rmesa->doPageFlip ) {
- r128PageFlip( dPriv );
- }
- else {
- r128CopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-r128InitDriver( __DRIscreenPrivate *sPriv )
-{
- sPriv->private = (void *) r128CreateScreen( sPriv );
-
- if ( !sPriv->private ) {
- r128DestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static struct __DriverAPIRec r128API = {
- .InitDriver = r128InitDriver,
- .DestroyScreen = r128DestroyScreen,
- .CreateContext = r128CreateContext,
- .DestroyContext = r128DestroyContext,
- .CreateBuffer = r128CreateBuffer,
- .DestroyBuffer = r128DestroyBuffer,
- .SwapBuffers = r128SwapBuffers,
- .MakeCurrent = r128MakeCurrent,
- .UnbindContext = r128UnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-
-};
-
-
-static __GLcontextModes *
-r128FillInModes( 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 */
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_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_BGR;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 4, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 2, 2, 0 };
-
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "Rage128",
- 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, &r128API);
- if ( psp != NULL ) {
- R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv;
- *driver_modes = r128FillInModes( dri_priv->bpp,
- (dri_priv->bpp == 16) ? 16 : 24,
- (dri_priv->bpp == 16) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.h
deleted file mode 100644
index 8db8eea35..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_screen.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.h,v 1.7 2002/12/16 16:18:53 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_SCREEN_H__
-#define __R128_SCREEN_H__
-
-#include "xmlconfig.h"
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- unsigned char *map; /* Mapping of the DRM region */
-} r128RegionRec, *r128RegionPtr;
-
-typedef struct {
-
- GLint chipset;
- GLint cpp;
- GLint IsPCI; /* Current card is a PCI card */
- GLint AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- GLuint frontOffset;
- GLuint frontPitch;
- GLuint backOffset;
- GLuint backPitch;
-
- GLuint depthOffset;
- GLuint depthPitch;
- GLuint spanOffset;
-
- /* Shared texture data */
- GLint numTexHeaps;
- GLint texOffset[R128_NR_TEX_HEAPS];
- GLint texSize[R128_NR_TEX_HEAPS];
- GLint logTexGranularity[R128_NR_TEX_HEAPS];
-
- r128RegionRec mmio;
- r128RegionRec agpTextures;
-
- drmBufMapPtr buffers;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-
-} r128ScreenRec, *r128ScreenPtr;
-
-
-#endif /* __R128_SCREEN_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.c
deleted file mode 100644
index fd4722b3b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.8 2002/10/30 12:51:39 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_ioctl.h"
-#include "r128_state.h"
-#include "r128_span.h"
-#include "r128_tex.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define HAVE_HW_DEPTH_SPANS 1
-#define HAVE_HW_DEPTH_PIXELS 1
-
-#define LOCAL_VARS \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- r128ScreenPtr r128scrn = rmesa->r128Screen; \
- __DRIscreenPrivate *sPriv = rmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable; \
- GLuint pitch = r128scrn->frontPitch * r128scrn->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- rmesa->drawOffset + \
- (dPriv->x * r128scrn->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- rmesa->readOffset + \
- (dPriv->x * r128scrn->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- r128ScreenPtr r128scrn = rmesa->r128Screen; \
- __DRIscreenPrivate *sPriv = rmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = rmesa->driDrawable; \
- GLuint height = dPriv->h; \
- (void) r128scrn; (void) sPriv; (void) height
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) r128##x##_RGB565
-#define TAG2(x,y) r128##x##_RGB565##y
-#include "spantmp2.h"
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) r128##x##_ARGB8888
-#define TAG2(x,y) r128##x##_ARGB8888##y
-#include "spantmp2.h"
-
-
-/* ================================================================
- * Depth buffer
- */
-
-/* 16-bit depth buffer functions
- */
-
-#define WRITE_DEPTH_SPAN() \
- r128WriteDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y, \
- depth, mask );
-
-#define WRITE_DEPTH_PIXELS() \
-do { \
- GLint ox[MAX_WIDTH]; \
- GLint oy[MAX_WIDTH]; \
- for ( i = 0 ; i < n ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- r128WriteDepthPixelsLocked( rmesa, n, ox, oy, depth, mask ); \
-} while (0)
-
-#define READ_DEPTH_SPAN() \
-do { \
- GLushort *buf = (GLushort *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i; \
- \
- r128ReadDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < n ; i++ ) { \
- depth[i] = buf[i]; \
- } \
-} while (0)
-
-#define READ_DEPTH_PIXELS() \
-do { \
- GLushort *buf = (GLushort *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i, remaining = n; \
- \
- while ( remaining > 0 ) { \
- GLint ox[128]; \
- GLint oy[128]; \
- GLint count; \
- \
- if ( remaining <= 128 ) { \
- count = remaining; \
- } else { \
- count = 128; \
- } \
- for ( i = 0 ; i < count ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- \
- r128ReadDepthPixelsLocked( rmesa, count, ox, oy ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < count ; i++ ) { \
- depth[i] = buf[i]; \
- } \
- depth += count; \
- x += count; \
- y += count; \
- remaining -= count; \
- } \
-} while (0)
-
-#define TAG(x) r128##x##_16
-#include "depthtmp.h"
-
-
-/* 24-bit depth, 8-bit stencil buffer functions
- */
-#define WRITE_DEPTH_SPAN() \
- r128WriteDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y, \
- depth, mask );
-
-#define WRITE_DEPTH_PIXELS() \
-do { \
- GLint ox[MAX_WIDTH]; \
- GLint oy[MAX_WIDTH]; \
- for ( i = 0 ; i < n ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- r128WriteDepthPixelsLocked( rmesa, n, ox, oy, depth, mask ); \
-} while (0)
-
-#define READ_DEPTH_SPAN() \
-do { \
- GLuint *buf = (GLuint *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i; \
- \
- r128ReadDepthSpanLocked( rmesa, n, \
- x + dPriv->x, \
- y + dPriv->y ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < n ; i++ ) { \
- depth[i] = buf[i] & 0x00ffffff; \
- } \
-} while (0)
-
-#define READ_DEPTH_PIXELS() \
-do { \
- GLuint *buf = (GLuint *)((GLubyte *)sPriv->pFB + \
- r128scrn->spanOffset); \
- GLint i, remaining = n; \
- \
- while ( remaining > 0 ) { \
- GLint ox[128]; \
- GLint oy[128]; \
- GLint count; \
- \
- if ( remaining <= 128 ) { \
- count = remaining; \
- } else { \
- count = 128; \
- } \
- for ( i = 0 ; i < count ; i++ ) { \
- ox[i] = x[i] + dPriv->x; \
- oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
- } \
- \
- r128ReadDepthPixelsLocked( rmesa, count, ox, oy ); \
- r128WaitForIdleLocked( rmesa ); \
- \
- for ( i = 0 ; i < count ; i++ ) { \
- depth[i] = buf[i] & 0x00ffffff; \
- } \
- depth += count; \
- x += count; \
- y += count; \
- remaining -= count; \
- } \
-} while (0)
-
-#define TAG(x) r128##x##_24_8
-#include "depthtmp.h"
-
-
-
-/* ================================================================
- * Stencil buffer
- */
-
-/* FIXME: Add support for hardware stencil buffers.
- */
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void r128DDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- }
- break;
- case BUFFER_BIT_BACK_LEFT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- }
- break;
- default:
- break;
- }
-}
-
-void r128SpanRenderStart( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- FLUSH_BATCH(rmesa);
- LOCK_HARDWARE(rmesa);
- r128WaitForIdleLocked( rmesa );
-}
-
-void r128SpanRenderFinish( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( rmesa );
-}
-
-void r128DDInitSpanFuncs( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = r128DDSetBuffer;
- swdd->SpanRenderStart = r128SpanRenderStart;
- swdd->SpanRenderFinish = r128SpanRenderFinish;
-}
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- r128InitPointers_RGB565(&drb->Base);
- }
- else {
- r128InitPointers_ARGB8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = r128ReadDepthSpan_16;
- drb->Base.GetValues = r128ReadDepthPixels_16;
- drb->Base.PutRow = r128WriteDepthSpan_16;
- drb->Base.PutMonoRow = r128WriteMonoDepthSpan_16;
- drb->Base.PutValues = r128WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = r128ReadDepthSpan_24_8;
- drb->Base.GetValues = r128ReadDepthPixels_24_8;
- drb->Base.PutRow = r128WriteDepthSpan_24_8;
- drb->Base.PutMonoRow = r128WriteMonoDepthSpan_24_8;
- drb->Base.PutValues = r128WriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.h
deleted file mode 100644
index fd7c2d139..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_span.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.h,v 1.3 2001/01/08 01:07:21 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_SPAN_H__
-#define __R128_SPAN_H__
-
-#include "drirenderbuffer.h"
-
-extern void r128DDInitSpanFuncs( GLcontext *ctx );
-
-extern void
-r128SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.c
deleted file mode 100644
index 29f490da8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.c
+++ /dev/null
@@ -1,1261 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.11 2002/10/30 12:51:39 alanh Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_tris.h"
-#include "r128_tex.h"
-
-#include "context.h"
-#include "buffers.h"
-#include "enums.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-
-/* =============================================================
- * Alpha blending
- */
-
-
-/**
- * Calculate the hardware blend factor setting. This same function is used
- * for source and destination of both alpha and RGB.
- *
- * \returns
- * The hardware register value for the specified blend factor. This value
- * will need to be shifted into the correct position for either source or
- * destination factor.
- *
- * \todo
- * Since the two cases where source and destination are handled differently
- * are essentially error cases, they should never happen. Determine if these
- * cases can be removed.
- */
-static int blend_factor( r128ContextPtr rmesa, GLenum factor, GLboolean is_src )
-{
- int func;
-
- switch ( factor ) {
- case GL_ZERO:
- func = R128_ALPHA_BLEND_ZERO;
- break;
- case GL_ONE:
- func = R128_ALPHA_BLEND_ONE;
- break;
-
- case GL_SRC_COLOR:
- func = R128_ALPHA_BLEND_SRCCOLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- func = R128_ALPHA_BLEND_INVSRCCOLOR;
- break;
- case GL_SRC_ALPHA:
- func = R128_ALPHA_BLEND_SRCALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func = R128_ALPHA_BLEND_INVSRCALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- func = (is_src) ? R128_ALPHA_BLEND_SAT : R128_ALPHA_BLEND_ZERO;
- break;
-
- case GL_DST_COLOR:
- func = R128_ALPHA_BLEND_DSTCOLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- func = R128_ALPHA_BLEND_INVDSTCOLOR;
- break;
- case GL_DST_ALPHA:
- func = R128_ALPHA_BLEND_DSTALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func = R128_ALPHA_BLEND_INVDSTALPHA;
- break;
-
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- default:
- FALLBACK( rmesa, R128_FALLBACK_BLEND_FUNC, GL_TRUE );
- func = (is_src) ? R128_ALPHA_BLEND_ONE : R128_ALPHA_BLEND_ZERO;
- break;
- }
-
- return func;
-}
-
-
-static void r128UpdateAlphaMode( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint a = rmesa->setup.misc_3d_state_cntl_reg;
- GLuint t = rmesa->setup.tex_cntl_c;
-
- if ( ctx->Color.AlphaEnabled ) {
- GLubyte ref;
-
- CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
-
- a &= ~(R128_ALPHA_TEST_MASK | R128_REF_ALPHA_MASK);
-
- switch ( ctx->Color.AlphaFunc ) {
- case GL_NEVER:
- a |= R128_ALPHA_TEST_NEVER;
- break;
- case GL_LESS:
- a |= R128_ALPHA_TEST_LESS;
- break;
- case GL_LEQUAL:
- a |= R128_ALPHA_TEST_LESSEQUAL;
- break;
- case GL_EQUAL:
- a |= R128_ALPHA_TEST_EQUAL;
- break;
- case GL_GEQUAL:
- a |= R128_ALPHA_TEST_GREATEREQUAL;
- break;
- case GL_GREATER:
- a |= R128_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- a |= R128_ALPHA_TEST_NEQUAL;
- break;
- case GL_ALWAYS:
- a |= R128_ALPHA_TEST_ALWAYS;
- break;
- }
-
- a |= ref & R128_REF_ALPHA_MASK;
- t |= R128_ALPHA_TEST_ENABLE;
- } else {
- t &= ~R128_ALPHA_TEST_ENABLE;
- }
-
- FALLBACK( rmesa, R128_FALLBACK_BLEND_FUNC, GL_FALSE );
-
- if ( ctx->Color.BlendEnabled ) {
- a &= ~((R128_ALPHA_BLEND_MASK << R128_ALPHA_BLEND_SRC_SHIFT) |
- (R128_ALPHA_BLEND_MASK << R128_ALPHA_BLEND_DST_SHIFT)
- | R128_ALPHA_COMB_FCN_MASK);
-
- a |= blend_factor( rmesa, ctx->Color.BlendSrcRGB, GL_TRUE )
- << R128_ALPHA_BLEND_SRC_SHIFT;
- a |= blend_factor( rmesa, ctx->Color.BlendDstRGB, GL_FALSE )
- << R128_ALPHA_BLEND_DST_SHIFT;
-
- switch (ctx->Color.BlendEquationRGB) {
- case GL_FUNC_ADD:
- a |= R128_ALPHA_COMB_ADD_CLAMP;
- break;
- case GL_FUNC_SUBTRACT:
- a |= R128_ALPHA_COMB_SUB_SRC_DST_CLAMP;
- break;
- default:
- FALLBACK( rmesa, R128_FALLBACK_BLEND_EQ, GL_TRUE );
- }
-
- t |= R128_ALPHA_ENABLE;
- } else {
- t &= ~R128_ALPHA_ENABLE;
- }
-
- if ( rmesa->setup.misc_3d_state_cntl_reg != a ) {
- rmesa->setup.misc_3d_state_cntl_reg = a;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
- }
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
- }
-}
-
-static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
-static void r128DDBlendEquationSeparate( GLcontext *ctx,
- GLenum modeRGB, GLenum modeA )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- assert( modeRGB == modeA );
- FLUSH_BATCH( rmesa );
-
- /* BlendEquation sets ColorLogicOpEnabled in an unexpected
- * manner.
- */
- FALLBACK( R128_CONTEXT(ctx), R128_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
-
- /* Can only do blend addition, not min, max, subtract, etc. */
- FALLBACK( R128_CONTEXT(ctx), R128_FALLBACK_BLEND_EQ,
- (modeRGB != GL_FUNC_ADD) && (modeRGB != GL_FUNC_SUBTRACT));
-
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
-static void r128DDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void r128UpdateZMode( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint z = rmesa->setup.z_sten_cntl_c;
- GLuint t = rmesa->setup.tex_cntl_c;
-
- if ( ctx->Depth.Test ) {
- z &= ~R128_Z_TEST_MASK;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- z |= R128_Z_TEST_NEVER;
- break;
- case GL_ALWAYS:
- z |= R128_Z_TEST_ALWAYS;
- break;
- case GL_LESS:
- z |= R128_Z_TEST_LESS;
- break;
- case GL_LEQUAL:
- z |= R128_Z_TEST_LESSEQUAL;
- break;
- case GL_EQUAL:
- z |= R128_Z_TEST_EQUAL;
- break;
- case GL_GEQUAL:
- z |= R128_Z_TEST_GREATEREQUAL;
- break;
- case GL_GREATER:
- z |= R128_Z_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- z |= R128_Z_TEST_NEQUAL;
- break;
- }
-
- t |= R128_Z_ENABLE;
- } else {
- t &= ~R128_Z_ENABLE;
- }
-
- if ( ctx->Depth.Mask ) {
- t |= R128_Z_WRITE_ENABLE;
- } else {
- t &= ~R128_Z_WRITE_ENABLE;
- }
-
- if ( rmesa->setup.z_sten_cntl_c != z ) {
- rmesa->setup.z_sten_cntl_c = z;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
-}
-
-static void r128DDDepthFunc( GLcontext *ctx, GLenum func )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_DEPTH;
-}
-
-static void r128DDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_DEPTH;
-}
-
-static void r128DDClearDepth( GLcontext *ctx, GLclampd d )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- switch ( rmesa->setup.z_sten_cntl_c & R128_Z_PIX_WIDTH_MASK ) {
- case R128_Z_PIX_WIDTH_16:
- rmesa->ClearDepth = d * 0x0000ffff;
- break;
- case R128_Z_PIX_WIDTH_24:
- rmesa->ClearDepth = d * 0x00ffffff;
- break;
- case R128_Z_PIX_WIDTH_32:
- rmesa->ClearDepth = d * 0xffffffff;
- break;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-static void r128UpdateFogAttrib( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint t = rmesa->setup.tex_cntl_c;
- GLubyte c[4];
- GLuint col;
-
- if ( ctx->Fog.Enabled ) {
- t |= R128_FOG_ENABLE;
- } else {
- t &= ~R128_FOG_ENABLE;
- }
-
- c[0] = FLOAT_TO_UBYTE( ctx->Fog.Color[0] );
- c[1] = FLOAT_TO_UBYTE( ctx->Fog.Color[1] );
- c[2] = FLOAT_TO_UBYTE( ctx->Fog.Color[2] );
-
- col = r128PackColor( 4, c[0], c[1], c[2], 0 );
-
- if ( rmesa->setup.fog_color_c != col ) {
- rmesa->setup.fog_color_c = col;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
-}
-
-static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_FOG;
-}
-
-
-/* =============================================================
- * Clipping
- */
-
-static void r128UpdateClipping( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( rmesa->driDrawable ) {
- __DRIdrawablePrivate *drawable = rmesa->driDrawable;
- int x1 = 0;
- int y1 = 0;
- int x2 = drawable->w - 1;
- int y2 = drawable->h - 1;
-
- if ( ctx->Scissor.Enabled ) {
- if ( ctx->Scissor.X > x1 ) {
- x1 = ctx->Scissor.X;
- }
- if ( drawable->h - ctx->Scissor.Y - ctx->Scissor.Height > y1 ) {
- y1 = drawable->h - ctx->Scissor.Y - ctx->Scissor.Height;
- }
- if ( ctx->Scissor.X + ctx->Scissor.Width - 1 < x2 ) {
- x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
- }
- if ( drawable->h - ctx->Scissor.Y - 1 < y2 ) {
- y2 = drawable->h - ctx->Scissor.Y - 1;
- }
- }
-
- x1 += drawable->x;
- y1 += drawable->y;
- x2 += drawable->x;
- y2 += drawable->y;
-
- rmesa->setup.sc_top_left_c = ((y1 << 16) | x1);
- rmesa->setup.sc_bottom_right_c = ((y2 << 16) | x2);
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
-}
-
-static void r128DDScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CLIP;
-}
-
-
-/* =============================================================
- * Culling
- */
-
-static void r128UpdateCull( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint f = rmesa->setup.pm4_vc_fpu_setup;
-
- f &= ~R128_FRONT_DIR_MASK;
-
- switch ( ctx->Polygon.FrontFace ) {
- case GL_CW:
- f |= R128_FRONT_DIR_CW;
- break;
- case GL_CCW:
- f |= R128_FRONT_DIR_CCW;
- break;
- }
-
- f |= R128_BACKFACE_SOLID | R128_FRONTFACE_SOLID;
-
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- f &= ~R128_FRONTFACE_SOLID;
- break;
- case GL_BACK:
- f &= ~R128_BACKFACE_SOLID;
- break;
- case GL_FRONT_AND_BACK:
- f &= ~(R128_BACKFACE_SOLID |
- R128_FRONTFACE_SOLID);
- break;
- }
- }
-
- if ( 1 || rmesa->setup.pm4_vc_fpu_setup != f ) {
- rmesa->setup.pm4_vc_fpu_setup = f;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_SETUP;
- }
-}
-
-static void r128DDCullFace( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CULL;
-}
-
-static void r128DDFrontFace( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CULL;
-}
-
-
-/* =============================================================
- * Masks
- */
-
-static void r128UpdateMasks( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- GLuint mask = r128PackColor( rmesa->r128Screen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- if ( rmesa->setup.plane_3d_mask_c != mask ) {
- rmesa->setup.plane_3d_mask_c = mask;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
- }
-}
-
-static void r128DDColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_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.
- */
-
-static void updateSpecularLighting( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint t = rmesa->setup.tex_cntl_c;
-
- if ( ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
- ctx->Light.Enabled) {
- /* XXX separate specular color just doesn't seem to work as it should.
- * For now, we fall back to s/w rendering whenever separate specular
- * is enabled.
- */
-#if 0
- if (ctx->Light.ShadeModel == GL_FLAT) {
- /* R128 can't do flat-shaded separate specular */
- t &= ~R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_TRUE );
- /*printf("%s fallback sep spec\n", __FUNCTION__);*/
- }
- else {
- t |= R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_FALSE );
- /*printf("%s enable sep spec\n", __FUNCTION__);*/
- }
-#else
- t &= ~R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_TRUE );
- /*printf("%s fallback sep spec\n", __FUNCTION__);*/
-#endif
- }
- else {
- t &= ~R128_SPEC_LIGHT_ENABLE;
- FALLBACK( rmesa, R128_FALLBACK_SEP_SPECULAR, GL_FALSE );
- /*printf("%s disable sep spec\n", __FUNCTION__);*/
- }
-
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_SETUP;
- rmesa->new_state |= R128_NEW_CONTEXT;
- }
-}
-
-
-static void r128DDLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) {
- FLUSH_BATCH( rmesa );
- updateSpecularLighting(ctx);
- }
-}
-
-static void r128DDShadeModel( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint s = rmesa->setup.pm4_vc_fpu_setup;
-
- s &= ~R128_FPU_COLOR_MASK;
-
- switch ( mode ) {
- case GL_FLAT:
- s |= R128_FPU_COLOR_FLAT;
- break;
- case GL_SMOOTH:
- s |= R128_FPU_COLOR_GOURAUD;
- break;
- default:
- return;
- }
-
- updateSpecularLighting(ctx);
-
- if ( rmesa->setup.pm4_vc_fpu_setup != s ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.pm4_vc_fpu_setup = s;
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_SETUP;
- }
-}
-
-
-/* =============================================================
- * Window position
- */
-
-void r128UpdateWindow( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- int x = rmesa->driDrawable->x;
- int y = rmesa->driDrawable->y;
-
- rmesa->setup.window_xy_offset = ((y << R128_WINDOW_Y_SHIFT) |
- (x << R128_WINDOW_X_SHIFT));
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_WINDOW;
-}
-
-/* =============================================================
- * Viewport
- */
-
-
-static void r128CalcViewport( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = rmesa->hw_viewport;
-
- /* See also r128_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + rmesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * rmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * rmesa->depth_scale;
-}
-
-static void r128Viewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- r128CalcViewport( ctx );
-}
-
-static void r128DepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- r128CalcViewport( ctx );
-}
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void r128DDClearColor( GLcontext *ctx,
- const GLfloat color[4] )
-{
- r128ContextPtr rmesa = R128_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]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- rmesa->ClearColor = r128PackColor( rmesa->r128Screen->cpp,
- c[0], c[1], c[2], c[3] );
-}
-
-static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( ctx->Color.ColorLogicOpEnabled ) {
- FLUSH_BATCH( rmesa );
-
- FALLBACK( rmesa, R128_FALLBACK_LOGICOP, opcode != GL_COPY );
- }
-}
-
-static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
-
- /*
- * _ColorDrawBufferMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BUFFER_BIT_BACK_LEFT:
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_TRUE );
- break;
- }
-
- /* We want to update the s/w rast state too so that r128DDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
- rmesa->new_state |= R128_NEW_WINDOW;
-}
-
-static void r128DDReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-
-/* =============================================================
- * Polygon stipple
- */
-
-static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint stipple[32], i;
- drm_r128_stipple_t stippleRec;
-
- for (i = 0; i < 32; i++) {
- stipple[31 - i] = ((mask[i*4+0] << 24) |
- (mask[i*4+1] << 16) |
- (mask[i*4+2] << 8) |
- (mask[i*4+3]));
- }
-
- FLUSH_BATCH( rmesa );
- LOCK_HARDWARE( rmesa );
-
- stippleRec.mask = stipple;
- drmCommandWrite( rmesa->driFd, DRM_R128_STIPPLE,
- &stippleRec, sizeof(stippleRec) );
-
- UNLOCK_HARDWARE( rmesa );
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-}
-
-
-/* =============================================================
- * Render mode
- */
-
-static void r128DDRenderMode( GLcontext *ctx, GLenum mode )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- FALLBACK( rmesa, R128_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-
-/* =============================================================
- * State enable/disable
- */
-
-static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s = %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( cap ),
- state ? "GL_TRUE" : "GL_FALSE" );
- }
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
- break;
-
- case GL_BLEND:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
-
- /* For some reason enable(GL_BLEND) affects ColorLogicOpEnabled.
- */
- FALLBACK( rmesa, R128_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
-
- case GL_CULL_FACE:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_CULL;
- break;
-
- case GL_DEPTH_TEST:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_DEPTH;
- break;
-
- case GL_DITHER:
- do {
- GLuint t = rmesa->setup.tex_cntl_c;
- FLUSH_BATCH( rmesa );
-
- if ( ctx->Color.DitherFlag ) {
- t |= R128_DITHER_ENABLE;
- } else {
- t &= ~R128_DITHER_ENABLE;
- }
-
- if ( rmesa->setup.tex_cntl_c != t ) {
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- } while (0);
- break;
-
- case GL_FOG:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_FOG;
- break;
-
- case GL_COLOR_LOGIC_OP:
- FLUSH_BATCH( rmesa );
- FALLBACK( rmesa, R128_FALLBACK_LOGICOP,
- state && ctx->Color.LogicOp != GL_COPY );
- break;
-
- case GL_LIGHTING:
- updateSpecularLighting(ctx);
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( rmesa );
- rmesa->scissor = state;
- rmesa->new_state |= R128_NEW_CLIP;
- break;
-
- case GL_STENCIL_TEST:
- FLUSH_BATCH( rmesa );
- FALLBACK( rmesa, R128_FALLBACK_STENCIL, state );
- break;
-
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- FLUSH_BATCH( rmesa );
- break;
-
- case GL_POLYGON_STIPPLE:
- if ( rmesa->render_primitive == GL_TRIANGLES ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.dp_gui_master_cntl_c &= ~R128_GMC_BRUSH_NONE;
- if ( state ) {
- rmesa->setup.dp_gui_master_cntl_c |=
- R128_GMC_BRUSH_32x32_MONO_FG_LA;
- } else {
- rmesa->setup.dp_gui_master_cntl_c |=
- R128_GMC_BRUSH_SOLID_COLOR;
- }
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- break;
-
- default:
- return;
- }
-}
-
-
-/* =============================================================
- * State initialization, management
- */
-
-static void r128DDPrintDirty( const char *msg, GLuint state )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n",
- msg,
- state,
- (state & R128_UPLOAD_CORE) ? "core, " : "",
- (state & R128_UPLOAD_CONTEXT) ? "context, " : "",
- (state & R128_UPLOAD_SETUP) ? "setup, " : "",
- (state & R128_UPLOAD_TEX0) ? "tex0, " : "",
- (state & R128_UPLOAD_TEX1) ? "tex1, " : "",
- (state & R128_UPLOAD_MASKS) ? "masks, " : "",
- (state & R128_UPLOAD_WINDOW) ? "window, " : "",
- (state & R128_UPLOAD_CLIPRECTS) ? "cliprects, " : "",
- (state & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "" );
-}
-
-/*
- * 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 r128EmitHwStateLocked( r128ContextPtr rmesa )
-{
- drm_r128_sarea_t *sarea = rmesa->sarea;
- drm_r128_context_regs_t *regs = &(rmesa->setup);
- const r128TexObjPtr t0 = rmesa->CurrentTexObj[0];
- const r128TexObjPtr t1 = rmesa->CurrentTexObj[1];
-
- if ( R128_DEBUG & DEBUG_VERBOSE_MSG ) {
- r128DDPrintDirty( "r128EmitHwStateLocked", rmesa->dirty );
- }
-
- if ( rmesa->dirty & (R128_UPLOAD_CONTEXT |
- R128_UPLOAD_SETUP |
- R128_UPLOAD_MASKS |
- R128_UPLOAD_WINDOW |
- R128_UPLOAD_CORE) ) {
- memcpy( &sarea->context_state, regs, sizeof(sarea->context_state) );
- }
-
- if ( (rmesa->dirty & R128_UPLOAD_TEX0) && t0 ) {
- drm_r128_texture_regs_t *tex = &sarea->tex_state[0];
-
- tex->tex_cntl = t0->setup.tex_cntl;
- tex->tex_combine_cntl = rmesa->tex_combine[0];
- tex->tex_size_pitch = t0->setup.tex_size_pitch;
- memcpy( &tex->tex_offset[0], &t0->setup.tex_offset[0],
- sizeof(tex->tex_offset ) );
- tex->tex_border_color = t0->setup.tex_border_color;
- }
-
- if ( (rmesa->dirty & R128_UPLOAD_TEX1) && t1 ) {
- drm_r128_texture_regs_t *tex = &sarea->tex_state[1];
-
- tex->tex_cntl = t1->setup.tex_cntl;
- tex->tex_combine_cntl = rmesa->tex_combine[1];
- tex->tex_size_pitch = t1->setup.tex_size_pitch;
- memcpy( &tex->tex_offset[0], &t1->setup.tex_offset[0],
- sizeof(tex->tex_offset ) );
- tex->tex_border_color = t1->setup.tex_border_color;
- }
-
- sarea->vertsize = rmesa->vertex_size;
- sarea->vc_format = rmesa->vertex_format;
-
- /* Turn off the texture cache flushing */
- rmesa->setup.tex_cntl_c &= ~R128_TEX_CACHE_FLUSH;
-
- sarea->dirty |= rmesa->dirty;
- rmesa->dirty &= R128_UPLOAD_CLIPRECTS;
-}
-
-static void r128DDPrintState( const char *msg, GLuint flags )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s\n",
- msg,
- flags,
- (flags & R128_NEW_CONTEXT) ? "context, " : "",
- (flags & R128_NEW_ALPHA) ? "alpha, " : "",
- (flags & R128_NEW_DEPTH) ? "depth, " : "",
- (flags & R128_NEW_FOG) ? "fog, " : "",
- (flags & R128_NEW_CLIP) ? "clip, " : "",
- (flags & R128_NEW_CULL) ? "cull, " : "",
- (flags & R128_NEW_MASKS) ? "masks, " : "",
- (flags & R128_NEW_WINDOW) ? "window, " : "" );
-}
-
-void r128DDUpdateHWState( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- int new_state = rmesa->new_state;
-
- if ( new_state || rmesa->NewGLState & _NEW_TEXTURE )
- {
- FLUSH_BATCH( rmesa );
-
- rmesa->new_state = 0;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_MSG )
- r128DDPrintState( "r128UpdateHwState", new_state );
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & R128_NEW_ALPHA )
- r128UpdateAlphaMode( ctx );
-
- if ( new_state & R128_NEW_DEPTH )
- r128UpdateZMode( ctx );
-
- if ( new_state & R128_NEW_FOG )
- r128UpdateFogAttrib( ctx );
-
- if ( new_state & R128_NEW_CLIP )
- r128UpdateClipping( ctx );
-
- if ( new_state & R128_NEW_CULL )
- r128UpdateCull( ctx );
-
- if ( new_state & R128_NEW_MASKS )
- r128UpdateMasks( ctx );
-
- if ( new_state & R128_NEW_WINDOW )
- r128UpdateWindow( ctx );
-
- if ( rmesa->NewGLState & _NEW_TEXTURE ) {
- r128UpdateTextureState( ctx );
- }
- }
-}
-
-
-static void r128DDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- R128_CONTEXT(ctx)->NewGLState |= new_state;
-}
-
-
-
-/* Initialize the context's hardware state.
- */
-void r128DDInitState( r128ContextPtr rmesa )
-{
- int dst_bpp, depth_bpp;
-
- switch ( rmesa->r128Screen->cpp ) {
- case 2:
- dst_bpp = R128_GMC_DST_16BPP;
- break;
- case 4:
- dst_bpp = R128_GMC_DST_32BPP;
- break;
- default:
- fprintf( stderr, "Error: Unsupported pixel depth... exiting\n" );
- exit( -1 );
- }
-
- rmesa->ClearColor = 0x00000000;
-
- switch ( rmesa->glCtx->Visual.depthBits ) {
- case 16:
- rmesa->ClearDepth = 0x0000ffff;
- depth_bpp = R128_Z_PIX_WIDTH_16;
- rmesa->depth_scale = 1.0 / (GLfloat)0xffff;
- break;
- case 24:
- rmesa->ClearDepth = 0x00ffffff;
- depth_bpp = R128_Z_PIX_WIDTH_24;
- rmesa->depth_scale = 1.0 / (GLfloat)0xffffff;
- break;
- default:
- fprintf( stderr, "Error: Unsupported depth %d... exiting\n",
- rmesa->glCtx->Visual.depthBits );
- exit( -1 );
- }
-
- rmesa->Fallback = 0;
-
- if ( rmesa->glCtx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
- } else {
- rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
- rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
- }
-
- /* Harware state:
- */
- rmesa->setup.dst_pitch_offset_c = (((rmesa->drawPitch/8) << 21) |
- (rmesa->drawOffset >> 5));
-
- rmesa->setup.dp_gui_master_cntl_c = (R128_GMC_DST_PITCH_OFFSET_CNTL |
- R128_GMC_DST_CLIPPING |
- R128_GMC_BRUSH_SOLID_COLOR |
- dst_bpp |
- R128_GMC_SRC_DATATYPE_COLOR |
- R128_GMC_BYTE_MSB_TO_LSB |
- R128_GMC_CONVERSION_TEMP_6500 |
- R128_ROP3_S |
- R128_DP_SRC_SOURCE_MEMORY |
- R128_GMC_3D_FCN_EN |
- R128_GMC_CLR_CMP_CNTL_DIS |
- R128_GMC_AUX_CLIP_DIS |
- R128_GMC_WR_MSK_DIS);
-
- rmesa->setup.sc_top_left_c = 0x00000000;
- rmesa->setup.sc_bottom_right_c = 0x1fff1fff;
-
- rmesa->setup.z_offset_c = rmesa->r128Screen->depthOffset;
- rmesa->setup.z_pitch_c = ((rmesa->r128Screen->depthPitch >> 3) |
- R128_Z_TILE);
-
- rmesa->setup.z_sten_cntl_c = (depth_bpp |
- R128_Z_TEST_LESS |
- R128_STENCIL_TEST_ALWAYS |
- R128_STENCIL_S_FAIL_KEEP |
- R128_STENCIL_ZPASS_KEEP |
- R128_STENCIL_ZFAIL_KEEP);
-
- rmesa->setup.tex_cntl_c = (R128_Z_WRITE_ENABLE |
- R128_SHADE_ENABLE |
- R128_DITHER_ENABLE |
- R128_ALPHA_IN_TEX_COMPLETE_A |
- R128_LIGHT_DIS |
- R128_ALPHA_LIGHT_DIS |
- R128_TEX_CACHE_FLUSH |
- (0x3f << R128_LOD_BIAS_SHIFT));
-
- rmesa->setup.misc_3d_state_cntl_reg = (R128_MISC_SCALE_3D_TEXMAP_SHADE |
- R128_MISC_SCALE_PIX_REPLICATE |
- R128_ALPHA_COMB_ADD_CLAMP |
- R128_FOG_VERTEX |
- (R128_ALPHA_BLEND_ONE << R128_ALPHA_BLEND_SRC_SHIFT) |
- (R128_ALPHA_BLEND_ZERO << R128_ALPHA_BLEND_DST_SHIFT) |
- R128_ALPHA_TEST_ALWAYS);
-
- rmesa->setup.texture_clr_cmp_clr_c = 0x00000000;
- rmesa->setup.texture_clr_cmp_msk_c = 0xffffffff;
-
- rmesa->setup.fog_color_c = 0x00000000;
-
- rmesa->setup.pm4_vc_fpu_setup = (R128_FRONT_DIR_CCW |
- R128_BACKFACE_SOLID |
- R128_FRONTFACE_SOLID |
- R128_FPU_COLOR_GOURAUD |
- R128_FPU_SUB_PIX_4BITS |
- R128_FPU_MODE_3D |
- R128_TRAP_BITS_DISABLE |
- R128_XFACTOR_2 |
- R128_YFACTOR_2 |
- R128_FLAT_SHADE_VERTEX_OGL |
- R128_FPU_ROUND_TRUNCATE |
- R128_WM_SEL_8DW);
-
- rmesa->setup.setup_cntl = (R128_COLOR_GOURAUD |
- R128_PRIM_TYPE_TRI |
- R128_TEXTURE_ST_MULT_W |
- R128_STARTING_VERTEX_1 |
- R128_ENDING_VERTEX_3 |
- R128_SU_POLY_LINE_NOT_LAST |
- R128_SUB_PIX_4BITS);
-
- rmesa->setup.tex_size_pitch_c = 0x00000000;
- rmesa->setup.constant_color_c = 0x00ffffff;
-
- rmesa->setup.dp_write_mask = 0xffffffff;
- rmesa->setup.sten_ref_mask_c = 0xffff0000;
- rmesa->setup.plane_3d_mask_c = 0xffffffff;
-
- rmesa->setup.window_xy_offset = 0x00000000;
-
- rmesa->setup.scale_3d_cntl = (R128_SCALE_DITHER_TABLE |
- R128_TEX_CACHE_SIZE_FULL |
- R128_DITHER_INIT_RESET |
- R128_SCALE_3D_TEXMAP_SHADE |
- R128_SCALE_PIX_REPLICATE |
- R128_ALPHA_COMB_ADD_CLAMP |
- R128_FOG_VERTEX |
- (R128_ALPHA_BLEND_ONE << R128_ALPHA_BLEND_SRC_SHIFT) |
- (R128_ALPHA_BLEND_ZERO << R128_ALPHA_BLEND_DST_SHIFT) |
- R128_ALPHA_TEST_ALWAYS |
- R128_COMPOSITE_SHADOW_CMP_EQUAL |
- R128_TEX_MAP_ALPHA_IN_TEXTURE |
- R128_TEX_CACHE_LINE_SIZE_4QW);
-
- rmesa->new_state = R128_NEW_ALL;
-}
-
-/* Initialize the driver's state functions.
- */
-void r128DDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = r128DDInvalidateState;
-
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = r128DDClearColor;
- ctx->Driver.DrawBuffer = r128DDDrawBuffer;
- ctx->Driver.ReadBuffer = r128DDReadBuffer;
-
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.ColorMask = r128DDColorMask;
- ctx->Driver.AlphaFunc = r128DDAlphaFunc;
- ctx->Driver.BlendEquationSeparate = r128DDBlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = r128DDBlendFuncSeparate;
- ctx->Driver.ClearDepth = r128DDClearDepth;
- ctx->Driver.CullFace = r128DDCullFace;
- ctx->Driver.FrontFace = r128DDFrontFace;
- ctx->Driver.DepthFunc = r128DDDepthFunc;
- ctx->Driver.DepthMask = r128DDDepthMask;
- ctx->Driver.Enable = r128DDEnable;
- ctx->Driver.Fogfv = r128DDFogfv;
- ctx->Driver.Hint = NULL;
- ctx->Driver.Lightfv = NULL;
- ctx->Driver.LightModelfv = r128DDLightModelfv;
- ctx->Driver.LogicOpcode = r128DDLogicOpCode;
- ctx->Driver.PolygonMode = NULL;
- ctx->Driver.PolygonStipple = r128DDPolygonStipple;
- ctx->Driver.RenderMode = r128DDRenderMode;
- ctx->Driver.Scissor = r128DDScissor;
- ctx->Driver.ShadeModel = r128DDShadeModel;
- ctx->Driver.ClearStencil = NULL;
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
-
- ctx->Driver.DepthRange = r128DepthRange;
- ctx->Driver.Viewport = r128Viewport;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.h
deleted file mode 100644
index ac33853b1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_state.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.h,v 1.3 2001/01/08 01:07:21 martin Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_STATE_H__
-#define __R128_STATE_H__
-
-#include "r128_context.h"
-
-extern void r128DDInitState( r128ContextPtr rmesa );
-extern void r128DDInitStateFuncs( GLcontext *ctx );
-
-extern void r128DDUpdateState( GLcontext *ctx );
-extern void r128DDUpdateHWState( GLcontext *ctx );
-
-extern void r128UpdateWindow( GLcontext *ctx );
-
-extern void r128EmitHwStateLocked( r128ContextPtr rmesa );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.c
deleted file mode 100644
index 3b2d017c1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.c
+++ /dev/null
@@ -1,617 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.14 2002/11/05 17:46:08 tsi Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_tris.h"
-#include "r128_tex.h"
-#include "r128_texobj.h"
-
-#include "context.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texobj.h"
-#include "imports.h"
-#include "colormac.h"
-#include "texobj.h"
-
-#include "xmlpool.h"
-
-#define TEX_0 1
-#define TEX_1 2
-
-
-/**
- * Set the texture wrap modes. Currently \c GL_REPEAT, \c GL_CLAMP,
- * \c GL_CLAMP_TO_EDGE, and \c GL_MIRRORED_REPEAT are supported.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-static void r128SetTexWrap( r128TexObjPtr t, GLenum swrap, GLenum twrap )
-{
- t->setup.tex_cntl &= ~(R128_TEX_CLAMP_S_MASK | R128_TEX_CLAMP_T_MASK);
-
- switch ( swrap ) {
- case GL_CLAMP:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_BORDER_COLOR;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_CLAMP;
- break;
- case GL_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_WRAP;
- break;
- case GL_MIRRORED_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_S_MIRROR;
- break;
- }
-
- switch ( twrap ) {
- case GL_CLAMP:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_BORDER_COLOR;
- break;
- case GL_CLAMP_TO_EDGE:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_CLAMP;
- break;
- case GL_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_WRAP;
- break;
- case GL_MIRRORED_REPEAT:
- t->setup.tex_cntl |= R128_TEX_CLAMP_T_MIRROR;
- break;
- }
-}
-
-static void r128SetTexFilter( r128TexObjPtr t, GLenum minf, GLenum magf )
-{
- t->setup.tex_cntl &= ~(R128_MIN_BLEND_MASK | R128_MAG_BLEND_MASK);
-
- switch ( minf ) {
- case GL_NEAREST:
- t->setup.tex_cntl |= R128_MIN_BLEND_NEAREST;
- break;
- case GL_LINEAR:
- t->setup.tex_cntl |= R128_MIN_BLEND_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->setup.tex_cntl |= R128_MIN_BLEND_MIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->setup.tex_cntl |= R128_MIN_BLEND_MIPLINEAR;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t->setup.tex_cntl |= R128_MIN_BLEND_LINEARMIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t->setup.tex_cntl |= R128_MIN_BLEND_LINEARMIPLINEAR;
- break;
- }
-
- switch ( magf ) {
- case GL_NEAREST:
- t->setup.tex_cntl |= R128_MAG_BLEND_NEAREST;
- break;
- case GL_LINEAR:
- t->setup.tex_cntl |= R128_MAG_BLEND_LINEAR;
- break;
- }
-}
-
-static void r128SetTexBorderColor( r128TexObjPtr t, GLubyte c[4] )
-{
- t->setup.tex_border_color = r128PackColor( 4, c[0], c[1], c[2], c[3] );
-}
-
-
-static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj )
-{
- r128TexObjPtr t;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *) texObj );
- }
-
- t = (r128TexObjPtr) CALLOC_STRUCT( r128_tex_obj );
- texObj->DriverData = t;
- if ( t != NULL ) {
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
-
- /* FIXME Something here to set initial values for other parts of
- * FIXME t->setup?
- */
-
- make_empty_list( (driTextureObject *) t );
-
- r128SetTexWrap( t, texObj->WrapS, texObj->WrapT );
- r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r128SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
-r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
- (void) type;
-
- switch ( internalFormat ) {
- /* non-sized formats with alpha */
- case GL_INTENSITY:
- case GL_COMPRESSED_INTENSITY:
- case GL_ALPHA:
- case GL_COMPRESSED_ALPHA:
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if (do32bpt)
- return _dri_texformat_argb8888;
- else
- return _dri_texformat_argb4444;
-
- /* 16-bit formats with alpha */
- case GL_INTENSITY4:
- case GL_ALPHA4:
- case GL_LUMINANCE4_ALPHA4:
- case GL_RGBA2:
- case GL_RGBA4:
- return _dri_texformat_argb4444;
-
- /* 32-bit formats with alpha */
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_RGB5_A1:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- if (!force16bpt)
- return _dri_texformat_argb8888;
- else
- return _dri_texformat_argb4444;
-
- /* non-sized formats without alpha */
- case 1:
- case GL_LUMINANCE:
- case GL_COMPRESSED_LUMINANCE:
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if (do32bpt)
- return _dri_texformat_argb8888;
- else
- return _dri_texformat_rgb565;
-
- /* 16-bit formats without alpha */
- case GL_LUMINANCE4:
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- return _dri_texformat_rgb565;
-
- /* 32-bit formats without alpha */
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- if (!force16bpt)
- return _dri_texformat_argb8888;
- else
- return _dri_texformat_rgb565;
-
- /* color-indexed formats */
- 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 _dri_texformat_ci8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- _mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ );
- return NULL;
- }
-}
-
-
-static void r128TexImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
-
- /* Note, this will call r128ChooseTextureFormat */
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, packing, texObj, texImage );
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128TexSubImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128TexImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( (driTextureObject *) t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- /* Note, this will call r128ChooseTextureFormat */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128TexSubImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r128AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r128TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- struct gl_texture_unit *texUnit;
- GLubyte c[4];
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- switch ( pname ) {
- case GL_TEXTURE_ENV_MODE:
- FLUSH_BATCH( rmesa );
- rmesa->new_state |= R128_NEW_ALPHA;
- break;
-
- case GL_TEXTURE_ENV_COLOR:
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- CLAMPED_FLOAT_TO_UBYTE( c[0], texUnit->EnvColor[0] );
- CLAMPED_FLOAT_TO_UBYTE( c[1], texUnit->EnvColor[1] );
- CLAMPED_FLOAT_TO_UBYTE( c[2], texUnit->EnvColor[2] );
- CLAMPED_FLOAT_TO_UBYTE( c[3], texUnit->EnvColor[3] );
- rmesa->env_color = r128PackColor( 4, c[0], c[1], c[2], c[3] );
- if ( rmesa->setup.constant_color_c != rmesa->env_color ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.constant_color_c = rmesa->env_color;
-
- /* More complex multitexture/multipass fallbacks for GL_BLEND
- * can be done later, but this allows a single pass GL_BLEND
- * in some cases (ie. Performer town demo). This is only
- * applicable to the regular Rage 128, as the Pro and M3 can
- * handle true single-pass GL_BLEND texturing.
- */
- rmesa->blend_flags &= ~R128_BLEND_ENV_COLOR;
- if ( R128_IS_PLAIN( rmesa ) &&
- rmesa->env_color != 0x00000000 &&
- rmesa->env_color != 0xff000000 &&
- rmesa->env_color != 0x00ffffff &&
- rmesa->env_color != 0xffffffff ) {
- rmesa->blend_flags |= R128_BLEND_ENV_COLOR;
- }
- }
- break;
-
- case GL_TEXTURE_LOD_BIAS:
- {
- u_int32_t t = rmesa->setup.tex_cntl_c;
- GLint bias;
- u_int32_t b;
-
- /* GTH: This isn't exactly correct, but gives good results up to a
- * certain point. It is better than completely ignoring the LOD
- * bias. Unfortunately there isn't much range in the bias, the
- * spec mentions strides that vary between 0.5 and 2.0 but these
- * numbers don't seem to relate the the GL LOD bias value at all.
- */
- if ( param[0] >= 1.0 ) {
- bias = -128;
- } else if ( param[0] >= 0.5 ) {
- bias = -64;
- } else if ( param[0] >= 0.25 ) {
- bias = 0;
- } else if ( param[0] >= 0.0 ) {
- bias = 63;
- } else {
- bias = 127;
- }
-
- b = (u_int32_t)bias & 0xff;
- t &= ~R128_LOD_BIAS_MASK;
- t |= (b << R128_LOD_BIAS_SHIFT);
-
- if ( rmesa->setup.tex_cntl_c != t ) {
- FLUSH_BATCH( rmesa );
- rmesa->setup.tex_cntl_c = t;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- }
- }
- break;
-
- default:
- return;
- }
-}
-
-
-static void r128TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- r128TexObjPtr t = (r128TexObjPtr)tObj->DriverData;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- if ( ( target != GL_TEXTURE_2D ) && ( target != GL_TEXTURE_1D ) )
- return;
-
- switch ( pname ) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- r128SetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- r128SetTexWrap( t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- r128SetTexBorderColor( t, tObj->_BorderChan );
- 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 R128. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- if ( t->base.bound ) FLUSH_BATCH( rmesa );
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-}
-
-static void r128BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, (void *) tObj,
- ctx->Texture.CurrentUnit );
- }
-
- assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_1D) ||
- (tObj->DriverData != NULL) );
-}
-
-
-static void r128DeleteTexture( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- driTextureObject * t = (driTextureObject *) tObj->DriverData;
-
- if ( t ) {
- if ( t->bound && rmesa ) {
- FLUSH_BATCH( rmesa );
- }
-
- driDestroyTextureObject( t );
- }
- /* 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: 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 *
-r128NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- r128AllocTexObj( obj );
- return obj;
-}
-
-void r128InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->TexEnv = r128TexEnv;
- functions->ChooseTextureFormat = r128ChooseTextureFormat;
- functions->TexImage1D = r128TexImage1D;
- functions->TexSubImage1D = r128TexSubImage1D;
- functions->TexImage2D = r128TexImage2D;
- functions->TexSubImage2D = r128TexSubImage2D;
- functions->TexParameter = r128TexParameter;
- functions->BindTexture = r128BindTexture;
- functions->NewTextureObject = r128NewTextureObject;
- functions->DeleteTexture = r128DeleteTexture;
- functions->IsTextureResident = driIsTextureResident;
-
- driInitTextureFormats();
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.h
deleted file mode 100644
index 54053b8b3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tex.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.7 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef __R128_TEX_H__
-#define __R128_TEX_H__
-
-extern void r128UpdateTextureState( GLcontext *ctx );
-
-extern void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t );
-
-extern void r128DestroyTexObj( r128ContextPtr rmesa, r128TexObjPtr t );
-
-extern void r128InitTextureFuncs( struct dd_function_table *functions );
-
-
-/* ================================================================
- * Color conversion macros:
- */
-
-#define R128PACKCOLOR332( r, g, b ) \
- (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))
-
-#define R128PACKCOLOR1555( r, g, b, a ) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define R128PACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define R128PACKCOLOR888( r, g, b ) \
- (((r) << 16) | ((g) << 8) | (b))
-
-#define R128PACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define R128PACKCOLOR4444( r, g, b, a ) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-static __inline__ u_int32_t r128PackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return R128PACKCOLOR565( r, g, b );
- case 4:
- return R128PACKCOLOR8888( r, g, b, a );
- default:
- return 0;
- }
-}
-
-#endif /* __R128_TEX_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texmem.c
deleted file mode 100644
index d011a7567..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texmem.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texmem.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_tris.h"
-#include "r128_tex.h"
-
-#include "context.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "imports.h"
-
-#define TEX_0 1
-#define TEX_1 2
-
-
-/* Destroy hardware state associated with texture `t'.
- */
-void r128DestroyTexObj( r128ContextPtr rmesa, r128TexObjPtr t )
-{
- unsigned i;
-
-
- /* See if it was the driver's current object.
- */
-
- if ( rmesa != NULL )
- {
- for ( i = 0 ; i < rmesa->glCtx->Const.MaxTextureUnits ; i++ )
- {
- if ( t == rmesa->CurrentTexObj[ i ] ) {
- assert( t->base.bound & (1 << i) );
- rmesa->CurrentTexObj[ i ] = NULL;
- }
- }
- }
-}
-
-
-/**
- * Upload the texture image associated with texture \a t at the specified
- * level at the address relative to \a start.
- */
-static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t,
- GLint level,
- GLint x, GLint y, GLint width, GLint height )
-{
- struct gl_texture_image *image;
- int texelsPerDword = 0;
- int imageWidth, imageHeight;
- int remaining, rows;
- int format, dwords;
- u_int32_t pitch, offset;
- int i;
-
- /* Ensure we have a valid texture to upload */
- if ( ( level < 0 ) || ( level > R128_MAX_TEXTURE_LEVELS ) )
- return;
-
- image = t->base.tObj->Image[0][level];
- if ( !image )
- return;
-
- switch ( image->TexFormat->TexelBytes ) {
- case 1: texelsPerDword = 4; break;
- case 2: texelsPerDword = 2; break;
- case 4: texelsPerDword = 1; break;
- }
-
-#if 1
- /* FIXME: The subimage index calcs are wrong... */
- x = 0;
- y = 0;
- width = image->Width;
- height = image->Height;
-#endif
-
- imageWidth = image->Width;
- imageHeight = image->Height;
-
- format = t->textureFormat >> 16;
-
- /* The texel upload routines have a minimum width, so force the size
- * if needed.
- */
- if ( imageWidth < texelsPerDword ) {
- int factor;
-
- factor = texelsPerDword / imageWidth;
- imageWidth = texelsPerDword;
- imageHeight /= factor;
- if ( imageHeight == 0 ) {
- /* In this case, the texel converter will actually walk a
- * texel or two off the end of the image, but normal malloc
- * alignment should prevent it from ever causing a fault.
- */
- imageHeight = 1;
- }
- }
-
- /* We can't upload to a pitch less than 8 texels so we will need to
- * linearly upload all modified rows for textures smaller than this.
- * This makes the x/y/width/height different for the blitter and the
- * texture walker.
- */
- if ( imageWidth >= 8 ) {
- /* The texture walker and the blitter look identical */
- pitch = imageWidth >> 3;
- } else {
- int factor;
- int y2;
- int start, end;
-
- start = (y * imageWidth) & ~7;
- end = (y + height) * imageWidth;
-
- if ( end - start < 8 ) {
- /* Handle the case where the total number of texels
- * uploaded is < 8.
- */
- x = 0;
- y = start / 8;
- width = end - start;
- height = 1;
- } else {
- /* Upload some number of full 8 texel blit rows */
- factor = 8 / imageWidth;
-
- y2 = y + height - 1;
- y /= factor;
- y2 /= factor;
-
- x = 0;
- width = 8;
- height = y2 - y + 1;
- }
-
- /* Fixed pitch of 8 */
- pitch = 1;
- }
-
- dwords = width * height / texelsPerDword;
- offset = t->bufAddr + t->image[level - t->base.firstLevel].offset;
-
-#if ENABLE_PERF_BOXES
- /* Bump the performace counter */
- rmesa->c_textureBytes += (dwords << 2);
-#endif
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "r128UploadSubImage: %d,%d of %d,%d at %d,%d\n",
- width, height, image->Width, image->Height, x, y );
- fprintf( stderr, " blit ofs: 0x%07x pitch: 0x%x dwords: %d "
- "level: %d format: %x\n",
- (GLuint)offset, (GLuint)pitch, dwords, level, format );
- }
-
- /* Subdivide the texture if required */
- if ( dwords <= R128_BUFFER_MAX_DWORDS / 2 ) {
- rows = height;
- } else {
- rows = (R128_BUFFER_MAX_DWORDS * texelsPerDword) / (2 * width);
- }
-
- for ( i = 0, remaining = height ;
- remaining > 0 ;
- remaining -= rows, y += rows, i++ )
- {
- u_int32_t *dst;
- drmBufPtr buffer;
-
- assert(image->Data);
-
- height = MIN2(remaining, rows);
-
- /* Grab the indirect buffer for the texture blit */
- LOCK_HARDWARE( rmesa );
- buffer = r128GetBufferLocked( rmesa );
-
- dst = (u_int32_t *)((char *)buffer->address + R128_HOSTDATA_BLIT_OFFSET);
-
- /* Copy the next chunck of the texture image into the blit buffer */
- {
- const GLubyte *src = (const GLubyte *) image->Data +
- (y * image->Width + x) * image->TexFormat->TexelBytes;
- const GLuint bytes = width * height * image->TexFormat->TexelBytes;
- memcpy(dst, src, bytes);
- }
-
- r128FireBlitLocked( rmesa, buffer,
- offset, pitch, format,
- x, y, width, height );
- UNLOCK_HARDWARE( rmesa );
- }
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS;
-}
-
-
-/* Upload the texture images associated with texture `t'. This might
- * require removing our own and/or other client's texture objects to
- * make room for these images.
- */
-void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t )
-{
- const GLint numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- GLint i;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %p )\n",
- __FUNCTION__, (void *) rmesa->glCtx, (void *) t );
- }
-
- assert(t);
-
- LOCK_HARDWARE( rmesa );
-
- if ( !t->base.memBlock ) {
- int heap;
-
-
- heap = driAllocateTexture( rmesa->texture_heaps, rmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( rmesa );
- return;
- }
-
- /* Set the base offset of the texture image */
- t->bufAddr = rmesa->r128Screen->texOffset[heap]
- + t->base.memBlock->ofs;
-
- /* Set texture offsets for each mipmap level */
- if ( t->setup.tex_cntl & R128_MIP_MAP_DISABLE ) {
- for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) {
- t->setup.tex_offset[i] = t->bufAddr;
- }
- } else {
- for ( i = 0; i < numLevels; i++ ) {
- const int j = numLevels - i - 1;
- t->setup.tex_offset[j] = t->bufAddr + t->image[i].offset;
- }
- }
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
- UNLOCK_HARDWARE( rmesa );
-
- /* Upload any images that are new */
- if ( t->base.dirty_images[0] ) {
- for ( i = 0 ; i < numLevels; i++ ) {
- const GLint j = t->base.firstLevel + i; /* the texObj's level */
- if ( t->base.dirty_images[0] & (1 << j) ) {
- uploadSubImage( rmesa, t, j, 0, 0,
- t->image[i].width, t->image[i].height );
- }
- }
-
- rmesa->setup.tex_cntl_c |= R128_TEX_CACHE_FLUSH;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
- t->base.dirty_images[0] = 0;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texobj.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texobj.h
deleted file mode 100644
index 282e88714..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texobj.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texobj.h,v 1.5 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef _R128_TEXOBJ_H_
-#define _R128_TEXOBJ_H_
-
-#include "mm.h"
-
-/* Individual texture image information.
- */
-typedef struct {
- GLuint offset; /* Relative to local texture space */
- GLuint width;
- GLuint height;
-} r128TexImage;
-
-typedef struct r128_tex_obj r128TexObj, *r128TexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct r128_tex_obj {
- driTextureObject base;
-
- u_int32_t bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint age;
- r128TexImage image[R128_MAX_TEXTURE_LEVELS]; /* Image data for all
- mipmap levels */
-
- u_int32_t textureFormat; /* Actual hardware format */
-
- drm_r128_texture_regs_t setup; /* Setup regs for texture */
-};
-
-#endif /* _R128_TEXOBJ_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texstate.c
deleted file mode 100644
index c22323b68..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_texstate.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texstate.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and 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
-on 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
-ATI, PRECISION INSIGHT 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:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-
-#include "r128_context.h"
-#include "r128_state.h"
-#include "r128_ioctl.h"
-#include "r128_tris.h"
-#include "r128_tex.h"
-
-
-static void r128SetTexImages( r128ContextPtr rmesa,
- const struct gl_texture_object *tObj )
-{
- r128TexObjPtr t = (r128TexObjPtr) tObj->DriverData;
- struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- int log2Pitch, log2Height, log2Size, log2MinSize;
- int totalSize;
- int i;
- GLint firstLevel, lastLevel;
-
- assert(t);
- assert(baseImage);
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API )
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *) tObj );
-
- switch (baseImage->TexFormat->MesaFormat) {
- case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_ARGB8888_REV:
- t->textureFormat = R128_DATATYPE_ARGB8888;
- break;
- case MESA_FORMAT_ARGB4444:
- case MESA_FORMAT_ARGB4444_REV:
- t->textureFormat = R128_DATATYPE_ARGB4444;
- break;
- case MESA_FORMAT_RGB565:
- case MESA_FORMAT_RGB565_REV:
- t->textureFormat = R128_DATATYPE_RGB565;
- break;
- case MESA_FORMAT_RGB332:
- t->textureFormat = R128_DATATYPE_RGB8;
- break;
- case MESA_FORMAT_CI8:
- t->textureFormat = R128_DATATYPE_CI8;
- break;
- case MESA_FORMAT_YCBCR:
- t->textureFormat = R128_DATATYPE_YVYU422;
- break;
- case MESA_FORMAT_YCBCR_REV:
- t->textureFormat = R128_DATATYPE_VYUY422;
- break;
- default:
- _mesa_problem(rmesa->glCtx, "Bad texture format in %s", __FUNCTION__);
- };
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- firstLevel = t->base.firstLevel;
- lastLevel = t->base.lastLevel;
-
- log2Pitch = tObj->Image[0][firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][firstLevel]->HeightLog2;
- log2Size = MAX2(log2Pitch, log2Height);
- log2MinSize = log2Size;
-
- t->base.dirty_images[0] = 0;
- totalSize = 0;
- for ( i = firstLevel; i <= lastLevel; i++ ) {
- const struct gl_texture_image *texImage;
-
- texImage = tObj->Image[0][i];
- if ( !texImage || !texImage->Data ) {
- lastLevel = i - 1;
- break;
- }
-
- log2MinSize = texImage->MaxLog2;
-
- t->image[i - firstLevel].offset = totalSize;
- t->image[i - firstLevel].width = tObj->Image[0][i]->Width;
- t->image[i - firstLevel].height = tObj->Image[0][i]->Height;
-
- t->base.dirty_images[0] |= (1 << i);
-
- totalSize += (tObj->Image[0][i]->Height *
- tObj->Image[0][i]->Width *
- tObj->Image[0][i]->TexFormat->TexelBytes);
-
- /* Offsets must be 32-byte aligned for host data blits and tiling */
- totalSize = (totalSize + 31) & ~31;
- }
-
- t->base.totalSize = totalSize;
- t->base.firstLevel = firstLevel;
- t->base.lastLevel = lastLevel;
-
- /* Set the texture format */
- t->setup.tex_cntl &= ~(0xf << 16);
- t->setup.tex_cntl |= t->textureFormat;
-
- t->setup.tex_combine_cntl = 0x00000000; /* XXX is this right? */
-
- t->setup.tex_size_pitch = ((log2Pitch << R128_TEX_PITCH_SHIFT) |
- (log2Size << R128_TEX_SIZE_SHIFT) |
- (log2Height << R128_TEX_HEIGHT_SHIFT) |
- (log2MinSize << R128_TEX_MIN_SIZE_SHIFT));
-
- for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) {
- t->setup.tex_offset[i] = 0x00000000;
- }
-
- if (firstLevel == lastLevel)
- t->setup.tex_cntl |= R128_MIP_MAP_DISABLE;
- else
- t->setup.tex_cntl &= ~R128_MIP_MAP_DISABLE;
-
- /* FYI: r128UploadTexImages( rmesa, t ); used to be called here */
-}
-
-
-/* ================================================================
- * Texture combine functions
- */
-
-#define COLOR_COMB_DISABLE (R128_COMB_DIS | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_COPY_INPUT (R128_COMB_COPY_INP | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_MODULATE (R128_COMB_MODULATE | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_MODULATE_NTEX (R128_COMB_MODULATE | \
- R128_COLOR_FACTOR_NTEX)
-#define COLOR_COMB_ADD (R128_COMB_ADD | \
- R128_COLOR_FACTOR_TEX)
-#define COLOR_COMB_BLEND_TEX (R128_COMB_BLEND_TEXTURE | \
- R128_COLOR_FACTOR_TEX)
-/* Rage 128 Pro/M3 only! */
-#define COLOR_COMB_BLEND_COLOR (R128_COMB_MODULATE2X | \
- R128_COMB_FCN_MSB | \
- R128_COLOR_FACTOR_CONST_COLOR)
-
-#define ALPHA_COMB_DISABLE (R128_COMB_ALPHA_DIS | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-#define ALPHA_COMB_COPY_INPUT (R128_COMB_ALPHA_COPY_INP | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-#define ALPHA_COMB_MODULATE (R128_COMB_ALPHA_MODULATE | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-#define ALPHA_COMB_MODULATE_NTEX (R128_COMB_ALPHA_MODULATE | \
- R128_ALPHA_FACTOR_NTEX_ALPHA)
-#define ALPHA_COMB_ADD (R128_COMB_ALPHA_ADD | \
- R128_ALPHA_FACTOR_TEX_ALPHA)
-
-#define INPUT_INTERP (R128_INPUT_FACTOR_INT_COLOR | \
- R128_INP_FACTOR_A_INT_ALPHA)
-#define INPUT_PREVIOUS (R128_INPUT_FACTOR_PREV_COLOR | \
- R128_INP_FACTOR_A_PREV_ALPHA)
-
-static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLint source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format;
- GLuint combine;
-
- if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %p, %d )\n",
- __FUNCTION__, (void *) ctx, unit );
- }
-
- if ( unit == 0 ) {
- combine = INPUT_INTERP;
- } else {
- combine = INPUT_PREVIOUS;
- }
-
- /* Set the texture environment state */
- switch ( texUnit->EnvMode ) {
- case GL_REPLACE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- combine |= (COLOR_COMB_DISABLE | /* C = Ct */
- ALPHA_COMB_DISABLE); /* A = At */
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_DISABLE | /* C = Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_DISABLE); /* A = At */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_MODULATE:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- combine |= (COLOR_COMB_MODULATE | /* C = CfCt */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_MODULATE | /* C = CfCt */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_DECAL:
- switch ( format ) {
- case GL_RGBA:
- combine |= (COLOR_COMB_BLEND_TEX | /* C = Cf(1-At)+CtAt */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_RGB:
- combine |= (COLOR_COMB_DISABLE | /* C = Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- /* Undefined behaviour - just copy the incoming fragment */
- combine |= (COLOR_COMB_COPY_INPUT | /* C = undefined */
- ALPHA_COMB_COPY_INPUT); /* A = undefined */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_BLEND:
- /* Rage 128 Pro and M3 can handle GL_BLEND texturing.
- */
- if ( !R128_IS_PLAIN( rmesa ) ) {
- /* XXX this hasn't been fully tested, I don't have a Pro card. -BP */
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- combine |= (COLOR_COMB_BLEND_COLOR | /* C = Cf(1-Ct)+CcCt */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
-
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_BLEND_COLOR | /* C = Cf(1-Ct)+CcCt */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
-
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
-
- case GL_INTENSITY:
- /* GH: We could be smarter about this... */
- switch ( rmesa->env_color & 0xff000000 ) {
- case 0x00000000:
- combine |= (COLOR_COMB_BLEND_COLOR | /* C = Cf(1-It)+CcIt */
- ALPHA_COMB_MODULATE_NTEX); /* A = Af(1-It) */
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- break;
-
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
- }
-
- /* Rage 128 has to fake some cases of GL_BLEND, otherwise fallback
- * to software rendering.
- */
- if ( rmesa->blend_flags ) {
- return GL_FALSE;
- }
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- switch ( rmesa->env_color & 0x00ffffff ) {
- case 0x00000000:
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
-#if 0
- /* This isn't right - BP */
- case 0x00ffffff:
- if ( unit == 0 ) {
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- } else {
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- switch ( rmesa->env_color & 0x00ffffff ) {
- case 0x00000000:
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
-#if 0
- /* This isn't right - BP */
- case 0x00ffffff:
- if ( unit == 0 ) {
- combine |= (COLOR_COMB_MODULATE_NTEX | /* C = Cf(1-Ct) */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- } else {
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_COPY_INPUT); /* A = fallback */
- return GL_FALSE;
- }
- break;
- case GL_ALPHA:
- if ( unit == 0 ) {
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- } else {
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- }
- break;
- case GL_INTENSITY:
- switch ( rmesa->env_color & 0x00ffffff ) {
- case 0x00000000:
- combine |= COLOR_COMB_MODULATE_NTEX; /* C = Cf(1-It) */
- break;
-#if 0
- /* This isn't right - BP */
- case 0x00ffffff:
- if ( unit == 0 ) {
- combine |= COLOR_COMB_MODULATE_NTEX; /* C = Cf(1-It) */
- } else {
- combine |= COLOR_COMB_ADD; /* C = Cf+It */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- switch ( rmesa->env_color & 0xff000000 ) {
- case 0x00000000:
- combine |= ALPHA_COMB_MODULATE_NTEX; /* A = Af(1-It) */
- break;
-#if 0
- /* This isn't right - BP */
- case 0xff000000:
- if ( unit == 0 ) {
- combine |= ALPHA_COMB_MODULATE_NTEX; /* A = Af(1-It) */
- } else {
- combine |= ALPHA_COMB_ADD; /* A = Af+It */
- }
- break;
-#endif
- default:
- combine |= (COLOR_COMB_MODULATE | /* C = fallback */
- ALPHA_COMB_MODULATE); /* A = fallback */
- return GL_FALSE;
- }
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- case GL_ADD:
- switch ( format ) {
- case GL_RGBA:
- case GL_LUMINANCE_ALPHA:
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_COPY_INPUT); /* A = Af */
- break;
- case GL_ALPHA:
- combine |= (COLOR_COMB_COPY_INPUT | /* C = Cf */
- ALPHA_COMB_MODULATE); /* A = AfAt */
- break;
- case GL_INTENSITY:
- combine |= (COLOR_COMB_ADD | /* C = Cf+Ct */
- ALPHA_COMB_ADD); /* A = Af+At */
- break;
- case GL_COLOR_INDEX:
- default:
- return GL_FALSE;
- }
- break;
-
- default:
- return GL_FALSE;
- }
-
- if ( rmesa->tex_combine[unit] != combine ) {
- rmesa->tex_combine[unit] = combine;
- rmesa->dirty |= R128_UPLOAD_TEX0 << unit;
- }
- return GL_TRUE;
-}
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- FLUSH_BATCH( rmesa );
-
- if ( rmesa->CurrentTexObj[unit] ) {
- rmesa->CurrentTexObj[unit]->base.bound &= ~(1 << unit);
- rmesa->CurrentTexObj[unit] = NULL;
- }
-
- rmesa->setup.tex_cntl_c &= ~(R128_TEXMAP_ENABLE << unit);
- rmesa->setup.tex_size_pitch_c &= ~(R128_TEX_SIZE_PITCH_MASK <<
- (R128_SEC_TEX_SIZE_PITCH_SHIFT * unit));
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-
- /* If either texture unit is disabled, then multitexturing is not
- * happening.
- */
-
- rmesa->blend_flags &= ~R128_BLEND_MULTITEX;
-}
-
-static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const int source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- r128TexObjPtr t = (r128TexObjPtr) tObj->DriverData;
-
- /* Need to load the 2d images associated with this unit.
- */
- if ( t->base.dirty_images[0] ) {
- /* FIXME: For Radeon, RADEON_FIREVERTICES is called here. Should
- * FIXME: something similar be done for R128?
- */
- /* FLUSH_BATCH( rmesa ); */
-
- r128SetTexImages( rmesa, tObj );
- r128UploadTexImages( rmesa, t );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const int source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
- const struct gl_texture_object *tObj = texUnit->_Current;
- r128TexObjPtr t = (r128TexObjPtr) tObj->DriverData;
-
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) {
- return GL_FALSE;
- }
-
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( rmesa->CurrentTexObj[unit] != t ) {
- if ( rmesa->CurrentTexObj[unit] != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->CurrentTexObj[unit]->base.bound &=
- ~(1UL << unit);
- }
-
- rmesa->CurrentTexObj[unit] = t;
- t->base.bound |= (1UL << unit);
- rmesa->dirty |= R128_UPLOAD_TEX0 << unit;
-
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked! */
- }
-
- /* FIXME: We need to update the texture unit if any texture parameters have
- * changed, but this texture was already bound. This could be changed to
- * work like the Radeon driver where the texture object has it's own
- * dirty state flags
- */
- rmesa->dirty |= R128_UPLOAD_TEX0 << unit;
-
- /* register setup */
- rmesa->setup.tex_size_pitch_c &= ~(R128_TEX_SIZE_PITCH_MASK <<
- (R128_SEC_TEX_SIZE_PITCH_SHIFT * unit));
-
- if ( unit == 0 ) {
- rmesa->setup.tex_cntl_c |= R128_TEXMAP_ENABLE;
- rmesa->setup.tex_size_pitch_c |= t->setup.tex_size_pitch << 0;
- rmesa->setup.scale_3d_cntl &= ~R128_TEX_CACHE_SPLIT;
- t->setup.tex_cntl &= ~R128_SEC_SELECT_SEC_ST;
- }
- else {
- rmesa->setup.tex_cntl_c |= R128_SEC_TEXMAP_ENABLE;
- rmesa->setup.tex_size_pitch_c |= t->setup.tex_size_pitch << 16;
- rmesa->setup.scale_3d_cntl |= R128_TEX_CACHE_SPLIT;
- t->setup.tex_cntl |= R128_SEC_SELECT_SEC_ST;
-
- /* If the second TMU is enabled, then multitexturing is happening.
- */
- if ( R128_IS_PLAIN( rmesa ) )
- rmesa->blend_flags |= R128_BLEND_MULTITEX;
- }
-
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-
-
- /* FIXME: The Radeon has some cached state so that it can avoid calling
- * FIXME: UpdateTextureEnv in some cases. Is that possible here?
- */
- return r128UpdateTextureEnv( ctx, unit );
-}
-
-static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- const int source = rmesa->tmu_source[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];
-
-
- if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
- return (enable_tex_2d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-
-void r128UpdateTextureState( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLboolean ok;
-
-
- /* This works around a quirk with the R128 hardware. If only OpenGL
- * TEXTURE1 is enabled, then the hardware TEXTURE0 must be used. The
- * hardware TEXTURE1 can ONLY be used when hardware TEXTURE0 is also used.
- */
-
- rmesa->tmu_source[0] = 0;
- rmesa->tmu_source[1] = 1;
-
- if ((ctx->Texture._EnabledUnits & 0x03) == 0x02) {
- /* only texture 1 enabled */
- rmesa->tmu_source[0] = 1;
- rmesa->tmu_source[1] = 0;
- }
-
- ok = (updateTextureUnit( ctx, 0 ) &&
- updateTextureUnit( ctx, 1 ));
-
- FALLBACK( rmesa, R128_FALLBACK_TEXTURE, !ok );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.c
deleted file mode 100644
index c12ad0ccb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.c
+++ /dev/null
@@ -1,769 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.c,v 1.8 2002/10/30 12:51:43 alanh Exp $ */ /* -*- c-basic-offset: 3 -*- */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
-ATI, 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "macros.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 "r128_tris.h"
-#include "r128_state.h"
-#include "r128_tex.h"
-#include "r128_ioctl.h"
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- R128_CCE_VC_CNTL_PRIM_TYPE_POINT,
- R128_CCE_VC_CNTL_PRIM_TYPE_LINE,
- R128_CCE_VC_CNTL_PRIM_TYPE_LINE,
- R128_CCE_VC_CNTL_PRIM_TYPE_LINE,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
- R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
-};
-
-static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void r128RenderPrimitive( GLcontext *ctx, GLenum prim );
-
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#define HAVE_QUADS 0
-#define HAVE_LINES 1
-#define HAVE_POINTS 1
-#define HAVE_LE32_VERTS 1
-#define CTX_ARG r128ContextPtr rmesa
-#define GET_VERTEX_DWORDS() rmesa->vertex_size
-#define ALLOC_VERTS( n, size ) r128AllocDmaLow( rmesa, (n), (size) * 4 )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- const char *vertptr = rmesa->verts;
-#define VERT(x) (r128Vertex *)(vertptr + ((x) * vertsize * 4))
-#define VERTEX r128Vertex
-#undef TAG
-#define TAG(x) r128_##x
-#include "tnl_dd/t_dd_triemit.h"
-#undef TAG
-#undef LOCAL_VARS
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- rmesa->draw_tri( rmesa, a, b, c ); \
- else \
- r128_triangle( rmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- rmesa->draw_tri( rmesa, a, b, d ); \
- rmesa->draw_tri( rmesa, b, c, d ); \
- } else \
- r128_quad( rmesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- rmesa->draw_line( rmesa, v0, v1 ); \
- else \
- r128_line( rmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- rmesa->draw_point( rmesa, v0 ); \
- else \
- r128_point( rmesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define R128_OFFSET_BIT 0x01
-#define R128_TWOSIDE_BIT 0x02
-#define R128_UNFILLED_BIT 0x04
-#define R128_FALLBACK_BIT 0x08
-#define R128_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[R128_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & R128_FALLBACK_BIT)
-#define DO_OFFSET (IND & R128_OFFSET_BIT)
-#define DO_UNFILLED (IND & R128_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & R128_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX r128Vertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE rmesa->depth_scale
-#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) (rmesa->verts + (e * rmesa->vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- r128_color_t *color = (r128_color_t *)&((v)->ui[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-
-#define VERT_SET_SPEC( v0, c ) \
-do { \
- if (havespec) { \
- r128_color_t *spec = (r128_color_t *)&((v0)->ui[specoffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- if (havespec) { \
- r128_color_t *spec0 = (r128_color_t *)&((v0)->ui[specoffset]); \
- r128_color_t *spec1 = (r128_color_t *)&((v1)->ui[specoffset]); \
- spec0->red = spec1->red; \
- spec0->green = spec1->green; \
- spec0->blue = spec1->blue; \
- } \
-} while (0)
-
-/* These don't need LE32_TO_CPU() as they are used to save and restore
- * colors which are already in the correct format.
- */
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[specoffset] = spec[idx]
-
-
-#define LOCAL_VARS(n) \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = rmesa->coloroffset; \
- GLuint specoffset = rmesa->specoffset; \
- GLboolean havespec = (rmesa->specoffset != 0); \
- (void) color; (void) spec; (void) specoffset; \
- (void) coloroffset; (void) havespec;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (rmesa->hw_primitive != hw_prim[x]) \
- r128RasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE rmesa->render_primitive
-#define IND R128_FALLBACK_BIT
-#define TAG(x) x
-#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 (R128_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_OFFSET_BIT|R128_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT|R128_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_OFFSET_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_UNFILLED_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_OFFSET_BIT|R128_UNFILLED_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_UNFILLED_BIT|R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R128_TWOSIDE_BIT|R128_OFFSET_BIT|R128_UNFILLED_BIT| \
- R128_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-
-/***********************************************************************
- * 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
-r128_fallback_tri( r128ContextPtr rmesa,
- r128Vertex *v0,
- r128Vertex *v1,
- r128Vertex *v2 )
-{
- GLcontext *ctx = rmesa->glCtx;
- SWvertex v[3];
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swsetup_Translate( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-r128_fallback_line( r128ContextPtr rmesa,
- r128Vertex *v0,
- r128Vertex *v1 )
-{
- GLcontext *ctx = rmesa->glCtx;
- SWvertex v[2];
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-r128_fallback_point( r128ContextPtr rmesa,
- r128Vertex *v0 )
-{
- GLcontext *ctx = rmesa->glCtx;
- SWvertex v[1];
- _swsetup_Translate( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- r128_point( rmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- r128_line( rmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- r128_triangle( rmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- r128_quad( rmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- r128RenderPrimitive( ctx, x ); \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- r128ContextPtr rmesa = R128_CONTEXT(ctx); \
- const GLuint vertsize = rmesa->vertex_size; \
- const char *vertptr = (char *)rmesa->verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) r128_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) r128_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH)
-#define TRI_FALLBACK (DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-#define _R128_NEW_RENDER_STATE (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS)
-
-static void r128ChooseRenderState(GLcontext *ctx)
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
- rmesa->draw_point = r128_point;
- rmesa->draw_line = r128_line;
- rmesa->draw_tri = r128_triangle;
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R128_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= R128_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= R128_UNFILLED_BIT;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)) {
- if (flags & POINT_FALLBACK) rmesa->draw_point = r128_fallback_point;
- if (flags & LINE_FALLBACK) rmesa->draw_line = r128_fallback_line;
- if (flags & TRI_FALLBACK) rmesa->draw_tri = r128_fallback_tri;
- index |= R128_FALLBACK_BIT;
- }
- }
-
- if (index != rmesa->RenderIndex) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- 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 = r128_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = r128_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = r128_fast_clipped_poly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- }
-
- rmesa->RenderIndex = index;
- }
-}
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-static void r128RunPipeline( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- if (rmesa->new_state || rmesa->NewGLState & _NEW_TEXTURE)
- r128DDUpdateHWState( ctx );
-
- if (!rmesa->Fallback && rmesa->NewGLState) {
- if (rmesa->NewGLState & _R128_NEW_RENDER_STATE)
- r128ChooseRenderState( ctx );
-
- rmesa->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-/* This is called when Mesa switches between rendering triangle
- * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc),
- * and lines, points and bitmaps.
- *
- * As the r128 uses triangles to render lines and points, it is
- * necessary to turn off hardware culling when rendering these
- * primitives.
- */
-
-static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
-
- rmesa->setup.dp_gui_master_cntl_c &= ~R128_GMC_BRUSH_NONE;
-
- if ( ctx->Polygon.StippleFlag && hwprim == GL_TRIANGLES ) {
- rmesa->setup.dp_gui_master_cntl_c |= R128_GMC_BRUSH_32x32_MONO_FG_LA;
- }
- else {
- rmesa->setup.dp_gui_master_cntl_c |= R128_GMC_BRUSH_SOLID_COLOR;
- }
-
- rmesa->new_state |= R128_NEW_CONTEXT;
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-
- if (rmesa->hw_primitive != hwprim) {
- FLUSH_BATCH( rmesa );
- rmesa->hw_primitive = hwprim;
- }
-}
-
-static void r128RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint hw = hw_prim[prim];
- rmesa->render_primitive = prim;
- if (prim >= GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
- r128RasterPrimitive( ctx, hw );
-}
-
-#define EMIT_ATTR( ATTR, STYLE, VF, SIZE ) \
-do { \
- rmesa->vertex_attrs[rmesa->vertex_attr_count].attrib = (ATTR); \
- rmesa->vertex_attrs[rmesa->vertex_attr_count].format = (STYLE); \
- rmesa->vertex_attr_count++; \
- vc_frmt |= (VF); \
- offset += (SIZE); \
-} while (0)
-
-#define EMIT_PAD( SIZE ) \
-do { \
- rmesa->vertex_attrs[rmesa->vertex_attr_count].attrib = 0; \
- rmesa->vertex_attrs[rmesa->vertex_attr_count].format = EMIT_PAD; \
- rmesa->vertex_attrs[rmesa->vertex_attr_count].offset = (SIZE); \
- rmesa->vertex_attr_count++; \
- offset += (SIZE); \
-} while (0)
-
-static void r128RenderStart( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLuint vc_frmt = 0;
- GLboolean fallback_projtex = GL_FALSE;
- GLuint offset = 0;
-
- /* Important: */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- rmesa->vertex_attr_count = 0;
- rmesa->specoffset = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if ( index & _TNL_BITS_TEX_ANY )
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, R128_CCE_VC_FRMT_RHW, 16 );
- else
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, 0, 12 );
-
- rmesa->coloroffset = offset;
-#if MESA_LITTLE_ENDIAN
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA,
- R128_CCE_VC_FRMT_DIFFUSE_ARGB, 4 );
-#else
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_ARGB,
- R128_CCE_VC_FRMT_DIFFUSE_ARGB, 4 );
-#endif
-
- if ( index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG) ) {
-#if MESA_LITTLE_ENDIAN
- if ( index & _TNL_BIT_COLOR1) {
- rmesa->specoffset = offset;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB,
- R128_CCE_VC_FRMT_SPEC_FRGB, 3 );
- } else
- EMIT_PAD( 3 );
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, R128_CCE_VC_FRMT_SPEC_FRGB,
- 1 );
- else
- EMIT_PAD( 1 );
-#else
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, R128_CCE_VC_FRMT_SPEC_FRGB,
- 1 );
- else
- EMIT_PAD( 1 );
-
- if ( index & _TNL_BIT_COLOR1) {
- rmesa->specoffset = offset;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB,
- R128_CCE_VC_FRMT_SPEC_FRGB, 3 );
- } else
- EMIT_PAD( 3 );
-#endif
- }
-
- if ( index & _TNL_BIT_TEX(rmesa->tmu_source[0]) ) {
- if ( VB->TexCoordPtr[rmesa->tmu_source[0]]->size > 2 )
- fallback_projtex = GL_TRUE;
- EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, R128_CCE_VC_FRMT_S_T, 8 );
- }
- if ( index & _TNL_BIT_TEX(rmesa->tmu_source[1]) ) {
- if ( VB->TexCoordPtr[rmesa->tmu_source[1]]->size > 2 )
- fallback_projtex = GL_TRUE;
- EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, R128_CCE_VC_FRMT_S2_T2, 8 );
- }
-
- /* projective textures are not supported by the hardware */
- FALLBACK( rmesa, R128_FALLBACK_PROJTEX, fallback_projtex );
-
- /* Only need to change the vertex emit code if there has been a
- * statechange to a TNL index.
- */
- if ( index != rmesa->tnl_state ) {
- FLUSH_BATCH( rmesa );
- rmesa->dirty |= R128_UPLOAD_CONTEXT;
-
- rmesa->vertex_size =
- _tnl_install_attrs( ctx,
- rmesa->vertex_attrs,
- rmesa->vertex_attr_count,
- rmesa->hw_viewport, 0 );
- rmesa->vertex_size >>= 2;
-
- rmesa->vertex_format = vc_frmt;
- }
-}
-
-static void r128RenderFinish( GLcontext *ctx )
-{
- if (R128_CONTEXT(ctx)->RenderIndex & R128_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "glReadBuffer",
- "glEnable(GL_STENCIL) without hw stencil buffer",
- "glRenderMode(selection or feedback)",
- "glLogicOp (mode != GL_COPY)",
- "GL_SEPARATE_SPECULAR_COLOR",
- "glBlendEquation(mode != ADD)",
- "glBlendFunc",
- "Projective texture",
- "Rasterization disable",
-};
-
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- GLuint oldfallback = rmesa->Fallback;
-
- if (mode) {
- rmesa->Fallback |= bit;
- if (oldfallback == 0) {
- FLUSH_BATCH( rmesa );
- _swsetup_Wakeup( ctx );
- rmesa->RenderIndex = ~0;
- if ( R128_DEBUG & DEBUG_VERBOSE_FALL ) {
- fprintf(stderr, "R128 begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- rmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = r128RenderStart;
- tnl->Driver.Render.PrimitiveNotify = r128RenderPrimitive;
- tnl->Driver.Render.Finish = r128RenderFinish;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_invalidate_vertex_state( ctx, ~0 );
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_install_attrs( ctx,
- rmesa->vertex_attrs,
- rmesa->vertex_attr_count,
- rmesa->hw_viewport, 0 );
-
- rmesa->NewGLState |= _R128_NEW_RENDER_STATE;
- if ( R128_DEBUG & DEBUG_VERBOSE_FALL ) {
- fprintf(stderr, "R128 end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void r128InitTriFuncs( GLcontext *ctx )
-{
- r128ContextPtr rmesa = R128_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = r128RunPipeline;
- tnl->Driver.Render.Start = r128RenderStart;
- tnl->Driver.Render.Finish = r128RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = r128RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- (6 + 2 * ctx->Const.MaxTextureUnits) * sizeof(GLfloat) );
- rmesa->verts = (char *)tnl->clipspace.vertex_buf;
- rmesa->tnl_state = -1;
-
- rmesa->NewGLState |= _R128_NEW_RENDER_STATE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.h
deleted file mode 100644
index 755d3320b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/r128_tris.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.8 2002/10/30 12:51:43 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
-ATI, 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef __R128_TRIS_H__
-#define __R128_TRIS_H__
-
-#include "mtypes.h"
-
-extern void r128InitTriFuncs( GLcontext *ctx );
-
-
-extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode )
-
-
-#endif /* __R128_TRIS_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/pci_ids.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/pci_ids.h
deleted file mode 100644
index fe8b08787..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/pci_ids.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Rage128 M3 */
-#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45
-#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46
-/* Rage128 M4 */
-#define PCI_DEVICE_ID_ATI_RAGE128_MF 0x4d46
-#define PCI_DEVICE_ID_ATI_RAGE128_ML 0x4d4c
-/* Rage128 Pro GL */
-#define PCI_DEVICE_ID_ATI_RAGE128_PA 0x5041
-#define PCI_DEVICE_ID_ATI_RAGE128_PB 0x5042
-#define PCI_DEVICE_ID_ATI_RAGE128_PC 0x5043
-#define PCI_DEVICE_ID_ATI_RAGE128_PD 0x5044
-#define PCI_DEVICE_ID_ATI_RAGE128_PE 0x5045
-#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046
-/* Rage128 Pro VR */
-#define PCI_DEVICE_ID_ATI_RAGE128_PG 0x5047
-#define PCI_DEVICE_ID_ATI_RAGE128_PH 0x5048
-#define PCI_DEVICE_ID_ATI_RAGE128_PI 0x5049
-#define PCI_DEVICE_ID_ATI_RAGE128_PJ 0x504A
-#define PCI_DEVICE_ID_ATI_RAGE128_PK 0x504B
-#define PCI_DEVICE_ID_ATI_RAGE128_PL 0x504C
-#define PCI_DEVICE_ID_ATI_RAGE128_PM 0x504D
-#define PCI_DEVICE_ID_ATI_RAGE128_PN 0x504E
-#define PCI_DEVICE_ID_ATI_RAGE128_PO 0x504F
-#define PCI_DEVICE_ID_ATI_RAGE128_PP 0x5050
-#define PCI_DEVICE_ID_ATI_RAGE128_PQ 0x5051
-#define PCI_DEVICE_ID_ATI_RAGE128_PR 0x5052
-#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452
-#define PCI_DEVICE_ID_ATI_RAGE128_PS 0x5053
-#define PCI_DEVICE_ID_ATI_RAGE128_PT 0x5054
-#define PCI_DEVICE_ID_ATI_RAGE128_PU 0x5055
-#define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056
-#define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057
-#define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058
-/* Rage128 GL */
-#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245
-#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246
-/* Rage128 VR */
-#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245
-#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246
-#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x5247
-#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b
-#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c
-#define PCI_DEVICE_ID_ATI_RAGE128_SE 0x5345
-#define PCI_DEVICE_ID_ATI_RAGE128_SF 0x5346
-#define PCI_DEVICE_ID_ATI_RAGE128_SG 0x5347
-#define PCI_DEVICE_ID_ATI_RAGE128_SH 0x5348
-#define PCI_DEVICE_ID_ATI_RAGE128_SK 0x534b
-#define PCI_DEVICE_ID_ATI_RAGE128_SL 0x534c
-#define PCI_DEVICE_ID_ATI_RAGE128_SM 0x534d
-#define PCI_DEVICE_ID_ATI_RAGE128_SN 0x534e
-/* Rage128 Pro Ultra */
-#define PCI_DEVICE_ID_ATI_RAGE128_TF 0x5446
-#define PCI_DEVICE_ID_ATI_RAGE128_TL 0x544C
-#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452
-#define PCI_DEVICE_ID_ATI_RAGE128_TS 0x5453
-#define PCI_DEVICE_ID_ATI_RAGE128_TT 0x5454
-#define PCI_DEVICE_ID_ATI_RAGE128_TU 0x5455
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128.h
deleted file mode 100644
index ce98b1b91..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128.h
+++ /dev/null
@@ -1,465 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.24 2002/12/16 16:19:10 dawes Exp $ */
-/*
- * 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:
- * Rickard E. Faith <faith@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- */
-
-#ifndef _R128_H_
-#define _R128_H_
-
-#include "dri_util.h"
-
-#define R128_DEBUG 0 /* Turn off debugging output */
-#define R128_IDLE_RETRY 32 /* Fall out of idle loops after this count */
-#define R128_TIMEOUT 2000000 /* Fall out of wait loops after this count */
-#define R128_MMIOSIZE 0x4000
-
-#define R128_VBIOS_SIZE 0x00010000
-
-#if R128_DEBUG
-#define R128TRACE(x) \
- do { \
- ErrorF("(**) %s(%d): ", R128_NAME, pScrn->scrnIndex); \
- ErrorF x; \
- } while (0);
-#else
-#define R128TRACE(x)
-#endif
-
-
-/* Other macros */
-#define R128_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
-#define R128_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1))
-#define R128PTR(pScrn) ((R128InfoPtr)(pScrn)->driverPrivate)
-
-/**
- * \brief Chip families.
- */
-typedef enum {
- CHIP_FAMILY_UNKNOWN,
- CHIP_FAMILY_R128_PCI,
- CHIP_FAMILY_R128_AGP,
-} R128ChipFamily;
-
-typedef struct { /* All values in XCLKS */
- int ML; /* Memory Read Latency */
- int MB; /* Memory Burst Length */
- int Trcd; /* RAS to CAS delay */
- int Trp; /* RAS percentage */
- int Twr; /* Write Recovery */
- int CL; /* CAS Latency */
- int Tr2w; /* Read to Write Delay */
- int Rloop; /* Loop Latency */
- int Rloop_fudge; /* Add to ML to get Rloop */
- char *name;
-} R128RAMRec, *R128RAMPtr;
-
-typedef struct {
- /* Common registers */
- u_int32_t ovr_clr;
- u_int32_t ovr_wid_left_right;
- u_int32_t ovr_wid_top_bottom;
- u_int32_t ov0_scale_cntl;
- u_int32_t mpp_tb_config;
- u_int32_t mpp_gp_config;
- u_int32_t subpic_cntl;
- u_int32_t viph_control;
- u_int32_t i2c_cntl_1;
- u_int32_t gen_int_cntl;
- u_int32_t cap0_trig_cntl;
- u_int32_t cap1_trig_cntl;
- u_int32_t bus_cntl;
- u_int32_t config_cntl;
-
- /* Other registers to save for VT switches */
- u_int32_t dp_datatype;
- u_int32_t gen_reset_cntl;
- u_int32_t clock_cntl_index;
- u_int32_t amcgpio_en_reg;
- u_int32_t amcgpio_mask;
-
- /* CRTC registers */
- u_int32_t crtc_gen_cntl;
- u_int32_t crtc_ext_cntl;
- u_int32_t dac_cntl;
- u_int32_t crtc_h_total_disp;
- u_int32_t crtc_h_sync_strt_wid;
- u_int32_t crtc_v_total_disp;
- u_int32_t crtc_v_sync_strt_wid;
- u_int32_t crtc_offset;
- u_int32_t crtc_offset_cntl;
- u_int32_t crtc_pitch;
-
- /* CRTC2 registers */
- u_int32_t crtc2_gen_cntl;
-
- /* Flat panel registers */
- u_int32_t fp_crtc_h_total_disp;
- u_int32_t fp_crtc_v_total_disp;
- u_int32_t fp_gen_cntl;
- u_int32_t fp_h_sync_strt_wid;
- u_int32_t fp_horz_stretch;
- u_int32_t fp_panel_cntl;
- u_int32_t fp_v_sync_strt_wid;
- u_int32_t fp_vert_stretch;
- u_int32_t lvds_gen_cntl;
- u_int32_t tmds_crc;
- u_int32_t tmds_transmitter_cntl;
-
- /* Computed values for PLL */
- u_int32_t dot_clock_freq;
- u_int32_t pll_output_freq;
- int feedback_div;
- int post_div;
-
- /* PLL registers */
- u_int32_t ppll_ref_div;
- u_int32_t ppll_div_3;
- u_int32_t htotal_cntl;
-
- /* DDA register */
- u_int32_t dda_config;
- u_int32_t dda_on_off;
-
- /* Pallet */
- GLboolean palette_valid;
- u_int32_t palette[256];
-} R128SaveRec, *R128SavePtr;
-
-typedef struct {
- int Chipset;
- GLboolean Primary;
-
- GLboolean FBDev;
-
- unsigned long LinearAddr; /* Frame buffer physical address */
- unsigned long BIOSAddr; /* BIOS physical address */
-
- unsigned char *MMIO; /* Map of MMIO region */
- unsigned char *FB; /* Map of frame buffer */
-
- u_int32_t MemCntl;
- u_int32_t BusCntl;
- unsigned long FbMapSize; /* Size of frame buffer, in bytes */
- int Flags; /* Saved copy of mode flags */
-
- /* Computed values for FPs */
- int PanelXRes;
- int PanelYRes;
- int HOverPlus;
- int HSyncWidth;
- int HBlank;
- int VOverPlus;
- int VSyncWidth;
- int VBlank;
- int PanelPwrDly;
-
- unsigned long cursor_start;
- unsigned long cursor_end;
-
- /*
- * XAAForceTransBlit is used to change the behavior of the XAA
- * SetupForScreenToScreenCopy function, to make it DGA-friendly.
- */
- GLboolean XAAForceTransBlit;
-
- int fifo_slots; /* Free slots in the FIFO (64 max) */
- int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */
- GLboolean dac6bits; /* Use 6 bit DAC? */
-
- /* Computed values for Rage 128 */
- int pitch;
- int datatype;
- u_int32_t dp_gui_master_cntl;
-
- /* Saved values for ScreenToScreenCopy */
- int xdir;
- int ydir;
-
- /* ScanlineScreenToScreenColorExpand support */
- unsigned char *scratch_buffer[1];
- unsigned char *scratch_save;
- int scanline_x;
- int scanline_y;
- int scanline_w;
- int scanline_h;
-
- int scanline_hpass;
- int scanline_x1clip;
- int scanline_x2clip;
- int scanline_rop;
- int scanline_fg;
- int scanline_bg;
-
- int scanline_words;
- int scanline_direct;
- int scanline_bpp; /* Only used for ImageWrite */
-
- drm_context_t drmCtx;
-
- drmSize registerSize;
- drm_handle_t registerHandle;
-
- GLboolean IsPCI; /* Current card is a PCI card */
- drmSize pciSize;
- drm_handle_t pciMemHandle;
- unsigned char *PCI; /* Map */
-
- GLboolean allowPageFlip; /* Enable 3d page flipping */
- GLboolean have3DWindows; /* Are there any 3d clients? */
- int drmMinor;
-
- drmSize agpSize;
- drm_handle_t agpMemHandle; /* Handle from drmAgpAlloc */
- unsigned long agpOffset;
- unsigned char *AGP; /* Map */
- int agpMode;
-
- GLboolean CCEInUse; /* CCE is currently active */
- int CCEMode; /* CCE mode that server/clients use */
- int CCEFifoSize; /* Size of the CCE command FIFO */
- GLboolean CCESecure; /* CCE security enabled */
- int CCEusecTimeout; /* CCE timeout in usecs */
-
- /* CCE ring buffer data */
- unsigned long ringStart; /* Offset into AGP space */
- drm_handle_t ringHandle; /* Handle from drmAddMap */
- drmSize ringMapSize; /* Size of map */
- int ringSize; /* Size of ring (in MB) */
- unsigned char *ring; /* Map */
- int ringSizeLog2QW;
-
- unsigned long ringReadOffset; /* Offset into AGP space */
- drm_handle_t ringReadPtrHandle; /* Handle from drmAddMap */
- drmSize ringReadMapSize; /* Size of map */
- unsigned char *ringReadPtr; /* Map */
-
- /* CCE vertex/indirect buffer data */
- unsigned long bufStart; /* Offset into AGP space */
- drm_handle_t bufHandle; /* Handle from drmAddMap */
- drmSize bufMapSize; /* Size of map */
- int bufSize; /* Size of buffers (in MB) */
- unsigned char *buf; /* Map */
- int bufNumBufs; /* Number of buffers */
- drmBufMapPtr buffers; /* Buffer map */
-
- /* CCE AGP Texture data */
- unsigned long agpTexStart; /* Offset into AGP space */
- drm_handle_t agpTexHandle; /* Handle from drmAddMap */
- drmSize agpTexMapSize; /* Size of map */
- int agpTexSize; /* Size of AGP tex space (in MB) */
- unsigned char *agpTex; /* Map */
- int log2AGPTexGran;
-
- /* CCE 2D accleration */
- drmBufPtr indirectBuffer;
- int indirectStart;
-
- /* DRI screen private data */
- int fbX;
- int fbY;
- int backX;
- int backY;
- int depthX;
- int depthY;
-
- int frontOffset;
- int frontPitch;
- int backOffset;
- int backPitch;
- int depthOffset;
- int depthPitch;
- int spanOffset;
- int textureOffset;
- int textureSize;
- int log2TexGran;
-
- /* Saved scissor values */
- u_int32_t sc_left;
- u_int32_t sc_right;
- u_int32_t sc_top;
- u_int32_t sc_bottom;
-
- u_int32_t re_top_left;
- u_int32_t re_width_height;
-
- u_int32_t aux_sc_cntl;
-
- int irq;
- u_int32_t gen_int_cntl;
-
- GLboolean DMAForXv;
-
-} R128InfoRec, *R128InfoPtr;
-
-#define R128WaitForFifo(pScrn, entries) \
-do { \
- if (info->fifo_slots < entries) R128WaitForFifoFunction(pScrn, entries); \
- info->fifo_slots -= entries; \
-} while (0)
-
-extern void r128WaitForFifoFunction(const DRIDriverContext *ctx, int entries);
-extern void r128WaitForIdle(const DRIDriverContext *ctx);
-
-extern void r128WaitForVerticalSync(const DRIDriverContext *ctx);
-
-extern GLboolean r128AccelInit(const DRIDriverContext *ctx);
-extern void r128EngineInit(const DRIDriverContext *ctx);
-extern GLboolean r128CursorInit(const DRIDriverContext *ctx);
-extern GLboolean r128DGAInit(const DRIDriverContext *ctx);
-
-extern void r128InitVideo(const DRIDriverContext *ctx);
-
-extern GLboolean r128DRIScreenInit(const DRIDriverContext *ctx);
-extern void r128DRICloseScreen(const DRIDriverContext *ctx);
-extern GLboolean r128DRIFinishScreenInit(const DRIDriverContext *ctx);
-
-#define R128CCE_START(ctx, info) \
-do { \
- int _ret = drmCommandNone(ctx->drmFD, DRM_R128_CCE_START); \
- if (_ret) { \
- fprintf(stderr, \
- "%s: CCE start %d\n", __FUNCTION__, _ret); \
- } \
-} while (0)
-
-#define R128CCE_STOP(ctx, info) \
-do { \
- int _ret = R128CCEStop(ctx); \
- if (_ret) { \
- fprintf(stderr, \
- "%s: CCE stop %d\n", __FUNCTION__, _ret); \
- } \
-} while (0)
-
-#define R128CCE_RESET(ctx, info) \
-do { \
- if (info->directRenderingEnabled \
- && R128CCE_USE_RING_BUFFER(info->CCEMode)) { \
- int _ret = drmCommandNone(info->drmFD, DRM_R128_CCE_RESET); \
- if (_ret) { \
- fprintf(stderr, \
- "%s: CCE reset %d\n", __FUNCTION__, _ret); \
- } \
- } \
-} while (0)
-
-
-#define CCE_PACKET0( reg, n ) \
- (R128_CCE_PACKET0 | ((n) << 16) | ((reg) >> 2))
-#define CCE_PACKET1( reg0, reg1 ) \
- (R128_CCE_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2))
-#define CCE_PACKET2() \
- (R128_CCE_PACKET2)
-#define CCE_PACKET3( pkt, n ) \
- (R128_CCE_PACKET3 | (pkt) | ((n) << 16))
-
-
-#define R128_VERBOSE 0
-
-#define RING_LOCALS u_int32_t *__head; int __count;
-
-#define R128CCE_REFRESH(pScrn, info) \
-do { \
- if ( R128_VERBOSE ) { \
- fprintf(stderr, "REFRESH( %d ) in %s\n", \
- !info->CCEInUse , __FUNCTION__ ); \
- } \
- if ( !info->CCEInUse ) { \
- R128CCEWaitForIdle(pScrn); \
- BEGIN_RING( 6 ); \
- OUT_RING_REG( R128_RE_TOP_LEFT, info->re_top_left ); \
- OUT_RING_REG( R128_RE_WIDTH_HEIGHT, info->re_width_height ); \
- OUT_RING_REG( R128_AUX_SC_CNTL, info->aux_sc_cntl ); \
- ADVANCE_RING(); \
- info->CCEInUse = TRUE; \
- } \
-} while (0)
-
-#define BEGIN_RING( n ) do { \
- if ( R128_VERBOSE ) { \
- fprintf(stderr, \
- "BEGIN_RING( %d ) in %s\n", n, __FUNCTION__ ); \
- } \
- if ( !info->indirectBuffer ) { \
- info->indirectBuffer = R128CCEGetBuffer( pScrn ); \
- info->indirectStart = 0; \
- } else if ( (info->indirectBuffer->used + 4*(n)) > \
- info->indirectBuffer->total ) { \
- R128CCEFlushIndirect( pScrn, 1 ); \
- } \
- __head = (pointer)((char *)info->indirectBuffer->address + \
- info->indirectBuffer->used); \
- __count = 0; \
-} while (0)
-
-#define ADVANCE_RING() do { \
- if ( R128_VERBOSE ) { \
- fprintf(stderr, \
- "ADVANCE_RING() used: %d+%d=%d/%d\n", \
- info->indirectBuffer->used - info->indirectStart, \
- __count * sizeof(u_int32_t), \
- info->indirectBuffer->used - info->indirectStart + \
- __count * sizeof(u_int32_t), \
- info->indirectBuffer->total - info->indirectStart ); \
- } \
- info->indirectBuffer->used += __count * (int)sizeof(u_int32_t); \
-} while (0)
-
-#define OUT_RING( x ) do { \
- if ( R128_VERBOSE ) { \
- fprintf(stderr, \
- " OUT_RING( 0x%08x )\n", (unsigned int)(x) ); \
- } \
- MMIO_OUT32(&__head[__count++], 0, (x)); \
-} while (0)
-
-#define OUT_RING_REG( reg, val ) \
-do { \
- OUT_RING( CCE_PACKET0( reg, 0 ) ); \
- OUT_RING( val ); \
-} while (0)
-
-#define FLUSH_RING() \
-do { \
- if ( R128_VERBOSE ) \
- fprintf(stderr, \
- "FLUSH_RING in %s\n", __FUNCTION__ ); \
- if ( info->indirectBuffer ) { \
- R128CCEFlushIndirect( pScrn, 0 ); \
- } \
-} while (0)
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.c
deleted file mode 100644
index 5edf1e100..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.c
+++ /dev/null
@@ -1,1113 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.28 2003/02/07 20:41:14 martin Exp $ */
-/*
- * 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;
- u_int32_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/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.h
deleted file mode 100644
index 67ade70de..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_dri.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.7 2002/10/30 12:52:12 alanh Exp $ */
-/*
- * 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef _R128_DRI_
-#define _R128_DRI_
-
-#include "xf86drm.h"
-#include "drm.h"
-
-/* DRI Driver defaults */
-#define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM
-#define R128_DEFAULT_CCE_BM_MODE R128_PM4_64BM_64VCBM_64INDBM
-#define R128_DEFAULT_AGP_MODE 1
-#define R128_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */
-#define R128_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */
-#define R128_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */
-#define R128_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */
-
-#define R128_DEFAULT_CCE_TIMEOUT 10000 /* usecs */
-
-#define R128_AGP_MAX_MODE 4
-#define R128_BUFFER_ALIGN 0x00000fff
-
-#define R128_CARD_TYPE_R128 1
-#define R128_CARD_TYPE_R128_PRO 2
-#define R128_CARD_TYPE_R128_MOBILITY 3
-
-#define R128CCE_USE_RING_BUFFER(m) \
-(((m) == R128_PM4_192BM) || \
- ((m) == R128_PM4_128BM_64INDBM) || \
- ((m) == R128_PM4_64BM_128INDBM) || \
- ((m) == R128_PM4_64BM_64VCBM_64INDBM))
-
-typedef struct {
- /* DRI screen private data */
- int deviceID; /* PCI device ID */
- int width; /* Width in pixels of display */
- int height; /* Height in scanlines of display */
- int depth; /* Depth of display (8, 15, 16, 24) */
- int bpp; /* Bit depth of display (8, 16, 24, 32) */
-
- int IsPCI; /* Current card is a PCI card */
- int AGPMode;
-
- int frontOffset; /* Start of front buffer */
- int frontPitch;
- int backOffset; /* Start of shared back buffer */
- int backPitch;
- int depthOffset; /* Start of shared depth buffer */
- int depthPitch;
- int spanOffset; /* Start of scratch spanline */
- int textureOffset;/* Start of texture data in frame buffer */
- int textureSize;
- int log2TexGran;
-
- /* MMIO register data */
- drm_handle_t registerHandle;
- drmSize registerSize;
-
- /* CCE AGP Texture data */
- drm_handle_t agpTexHandle;
- drmSize agpTexMapSize;
- int log2AGPTexGran;
- int agpTexOffset;
- unsigned int sarea_priv_offset;
-} R128DRIRec, *R128DRIPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_macros.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_macros.h
deleted file mode 100644
index 93b7feb02..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_macros.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * \file server/R128_macros.h
- * \brief Macros for R128 MMIO operation.
- *
- * \authors Kevin E. Martin <martin@xfree86.org>
- * \authors Rickard E. Faith <faith@valinux.com>
- * \authors Alan Hourihane <alanh@fairlite.demon.co.uk>
- */
-
-/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario, 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, 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.
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/R128_reg.h,v 1.20 2002/10/12 01:38:07 martin Exp $ */
-
-#ifndef _R128_MACROS_H_
-#define _R128_MACROS_H_
-
-
-
-# define MMIO_IN8(base, offset) \
- *(volatile unsigned char *)(((unsigned char*)(base)) + (offset))
-# define MMIO_IN16(base, offset) \
- *(volatile unsigned short *)(void *)(((unsigned char*)(base)) + (offset))
-# define MMIO_IN32(base, offset) \
- *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset))
-# define MMIO_OUT8(base, offset, val) \
- *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) = (val)
-# define MMIO_OUT16(base, offset, val) \
- *(volatile unsigned short *)(void *)(((unsigned char*)(base)) + (offset)) = (val)
-# define MMIO_OUT32(base, offset, val) \
- *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) = (val)
-
-
- /* Memory mapped register access macros */
-#define INREG8(addr) MMIO_IN8(R128MMIO, addr)
-#define INREG16(addr) MMIO_IN16(R128MMIO, addr)
-#define INREG(addr) MMIO_IN32(R128MMIO, addr)
-#define OUTREG8(addr, val) MMIO_OUT8(R128MMIO, addr, val)
-#define OUTREG16(addr, val) MMIO_OUT16(R128MMIO, addr, val)
-#define OUTREG(addr, val) MMIO_OUT32(R128MMIO, addr, val)
-
-#define ADDRREG(addr) ((volatile GLuint *)(pointer)(R128MMIO + (addr)))
-
-
-#define OUTREGP(addr, val, mask) \
-do { \
- GLuint tmp = INREG(addr); \
- tmp &= (mask); \
- tmp |= (val); \
- OUTREG(addr, tmp); \
-} while (0)
-
-#define INPLL(dpy, addr) r128INPLL(dpy, addr)
-
-#define OUTPLL(addr, val) \
-do { \
- OUTREG8(R128_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \
- R128_PLL_WR_EN)); \
- OUTREG(R128_CLOCK_CNTL_DATA, val); \
-} while (0)
-
-#define OUTPLLP(dpy, addr, val, mask) \
-do { \
- GLuint tmp = INPLL(dpy, addr); \
- tmp &= (mask); \
- tmp |= (val); \
- OUTPLL(addr, tmp); \
-} while (0)
-
-#define OUTPAL_START(idx) \
-do { \
- OUTREG8(R128_PALETTE_INDEX, (idx)); \
-} while (0)
-
-#define OUTPAL_NEXT(r, g, b) \
-do { \
- OUTREG(R128_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b)); \
-} while (0)
-
-#define OUTPAL_NEXT_CARD32(v) \
-do { \
- OUTREG(R128_PALETTE_DATA, (v & 0x00ffffff)); \
-} while (0)
-
-#define OUTPAL(idx, r, g, b) \
-do { \
- OUTPAL_START((idx)); \
- OUTPAL_NEXT((r), (g), (b)); \
-} while (0)
-
-#define INPAL_START(idx) \
-do { \
- OUTREG(R128_PALETTE_INDEX, (idx) << 16); \
-} while (0)
-
-#define INPAL_NEXT() INREG(R128_PALETTE_DATA)
-
-#define PAL_SELECT(idx) \
-do { \
- if (!idx) { \
- OUTREG(R128_DAC_CNTL2, INREG(R128_DAC_CNTL2) & \
- (GLuint)~R128_DAC2_PALETTE_ACC_CTL); \
- } else { \
- OUTREG(R128_DAC_CNTL2, INREG(R128_DAC_CNTL2) | \
- R128_DAC2_PALETTE_ACC_CTL); \
- } \
-} while (0)
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_reg.h
deleted file mode 100644
index 00f5041c1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_reg.h
+++ /dev/null
@@ -1,1394 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.15 2002/12/16 16:19:11 dawes Exp $ */
-/*
- * 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:
- * Rickard E. Faith <faith@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- * References:
- *
- * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
- * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
- * 1999.
- *
- * RAGE 128 Software Development Manual (Technical Reference Manual P/N
- * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
- *
- */
-
-#ifndef _R128_REG_H_
-#define _R128_REG_H_
-
-#define R128_ADAPTER_ID 0x0f2c /* PCI */
-#define R128_AGP_APER_OFFSET 0x0178
-#define R128_AGP_BASE 0x0170
-#define R128_AGP_CNTL 0x0174
-# define R128_AGP_APER_SIZE_256MB (0x00 << 0)
-# define R128_AGP_APER_SIZE_128MB (0x20 << 0)
-# define R128_AGP_APER_SIZE_64MB (0x30 << 0)
-# define R128_AGP_APER_SIZE_32MB (0x38 << 0)
-# define R128_AGP_APER_SIZE_16MB (0x3c << 0)
-# define R128_AGP_APER_SIZE_8MB (0x3e << 0)
-# define R128_AGP_APER_SIZE_4MB (0x3f << 0)
-# define R128_AGP_APER_SIZE_MASK (0x3f << 0)
-#define R128_AGP_CNTL_B 0x0b44
-#define R128_AGP_COMMAND 0x0f58 /* PCI */
-#define R128_AGP_PLL_CNTL 0x0010 /* PLL */
-#define R128_AGP_STATUS 0x0f54 /* PCI */
-# define R128_AGP_1X_MODE 0x01
-# define R128_AGP_2X_MODE 0x02
-# define R128_AGP_4X_MODE 0x04
-# define R128_AGP_MODE_MASK 0x07
-#define R128_AMCGPIO_A_REG 0x01a0
-#define R128_AMCGPIO_EN_REG 0x01a8
-#define R128_AMCGPIO_MASK 0x0194
-#define R128_AMCGPIO_Y_REG 0x01a4
-#define R128_ATTRDR 0x03c1 /* VGA */
-#define R128_ATTRDW 0x03c0 /* VGA */
-#define R128_ATTRX 0x03c0 /* VGA */
-#define R128_AUX_SC_CNTL 0x1660
-# define R128_AUX1_SC_EN (1 << 0)
-# define R128_AUX1_SC_MODE_OR (0 << 1)
-# define R128_AUX1_SC_MODE_NAND (1 << 1)
-# define R128_AUX2_SC_EN (1 << 2)
-# define R128_AUX2_SC_MODE_OR (0 << 3)
-# define R128_AUX2_SC_MODE_NAND (1 << 3)
-# define R128_AUX3_SC_EN (1 << 4)
-# define R128_AUX3_SC_MODE_OR (0 << 5)
-# define R128_AUX3_SC_MODE_NAND (1 << 5)
-#define R128_AUX1_SC_BOTTOM 0x1670
-#define R128_AUX1_SC_LEFT 0x1664
-#define R128_AUX1_SC_RIGHT 0x1668
-#define R128_AUX1_SC_TOP 0x166c
-#define R128_AUX2_SC_BOTTOM 0x1680
-#define R128_AUX2_SC_LEFT 0x1674
-#define R128_AUX2_SC_RIGHT 0x1678
-#define R128_AUX2_SC_TOP 0x167c
-#define R128_AUX3_SC_BOTTOM 0x1690
-#define R128_AUX3_SC_LEFT 0x1684
-#define R128_AUX3_SC_RIGHT 0x1688
-#define R128_AUX3_SC_TOP 0x168c
-#define R128_AUX_WINDOW_HORZ_CNTL 0x02d8
-#define R128_AUX_WINDOW_VERT_CNTL 0x02dc
-
-#define R128_BASE_CODE 0x0f0b
-#define R128_BIOS_0_SCRATCH 0x0010
-#define R128_BIOS_1_SCRATCH 0x0014
-#define R128_BIOS_2_SCRATCH 0x0018
-#define R128_BIOS_3_SCRATCH 0x001c
-#define R128_BIOS_4_SCRATCH 0x0020
-#define R128_BIOS_5_SCRATCH 0x0024
-# define R128_BIOS_DISPLAY_FP (1 << 0)
-# define R128_BIOS_DISPLAY_CRT (2 << 0)
-# define R128_BIOS_DISPLAY_FP_CRT (3 << 0)
-#define R128_BIOS_6_SCRATCH 0x0028
-#define R128_BIOS_7_SCRATCH 0x002c
-#define R128_BIOS_ROM 0x0f30 /* PCI */
-#define R128_BIST 0x0f0f /* PCI */
-#define R128_BM_CHUNK_0_VAL 0x0a18
-# define R128_BM_PTR_FORCE_TO_PCI (1 << 21)
-# define R128_BM_PM4_RD_FORCE_TO_PCI (1 << 22)
-# define R128_BM_GLOBAL_FORCE_TO_PCI (1 << 23)
-#define R128_BRUSH_DATA0 0x1480
-#define R128_BRUSH_DATA1 0x1484
-#define R128_BRUSH_DATA10 0x14a8
-#define R128_BRUSH_DATA11 0x14ac
-#define R128_BRUSH_DATA12 0x14b0
-#define R128_BRUSH_DATA13 0x14b4
-#define R128_BRUSH_DATA14 0x14b8
-#define R128_BRUSH_DATA15 0x14bc
-#define R128_BRUSH_DATA16 0x14c0
-#define R128_BRUSH_DATA17 0x14c4
-#define R128_BRUSH_DATA18 0x14c8
-#define R128_BRUSH_DATA19 0x14cc
-#define R128_BRUSH_DATA2 0x1488
-#define R128_BRUSH_DATA20 0x14d0
-#define R128_BRUSH_DATA21 0x14d4
-#define R128_BRUSH_DATA22 0x14d8
-#define R128_BRUSH_DATA23 0x14dc
-#define R128_BRUSH_DATA24 0x14e0
-#define R128_BRUSH_DATA25 0x14e4
-#define R128_BRUSH_DATA26 0x14e8
-#define R128_BRUSH_DATA27 0x14ec
-#define R128_BRUSH_DATA28 0x14f0
-#define R128_BRUSH_DATA29 0x14f4
-#define R128_BRUSH_DATA3 0x148c
-#define R128_BRUSH_DATA30 0x14f8
-#define R128_BRUSH_DATA31 0x14fc
-#define R128_BRUSH_DATA32 0x1500
-#define R128_BRUSH_DATA33 0x1504
-#define R128_BRUSH_DATA34 0x1508
-#define R128_BRUSH_DATA35 0x150c
-#define R128_BRUSH_DATA36 0x1510
-#define R128_BRUSH_DATA37 0x1514
-#define R128_BRUSH_DATA38 0x1518
-#define R128_BRUSH_DATA39 0x151c
-#define R128_BRUSH_DATA4 0x1490
-#define R128_BRUSH_DATA40 0x1520
-#define R128_BRUSH_DATA41 0x1524
-#define R128_BRUSH_DATA42 0x1528
-#define R128_BRUSH_DATA43 0x152c
-#define R128_BRUSH_DATA44 0x1530
-#define R128_BRUSH_DATA45 0x1534
-#define R128_BRUSH_DATA46 0x1538
-#define R128_BRUSH_DATA47 0x153c
-#define R128_BRUSH_DATA48 0x1540
-#define R128_BRUSH_DATA49 0x1544
-#define R128_BRUSH_DATA5 0x1494
-#define R128_BRUSH_DATA50 0x1548
-#define R128_BRUSH_DATA51 0x154c
-#define R128_BRUSH_DATA52 0x1550
-#define R128_BRUSH_DATA53 0x1554
-#define R128_BRUSH_DATA54 0x1558
-#define R128_BRUSH_DATA55 0x155c
-#define R128_BRUSH_DATA56 0x1560
-#define R128_BRUSH_DATA57 0x1564
-#define R128_BRUSH_DATA58 0x1568
-#define R128_BRUSH_DATA59 0x156c
-#define R128_BRUSH_DATA6 0x1498
-#define R128_BRUSH_DATA60 0x1570
-#define R128_BRUSH_DATA61 0x1574
-#define R128_BRUSH_DATA62 0x1578
-#define R128_BRUSH_DATA63 0x157c
-#define R128_BRUSH_DATA7 0x149c
-#define R128_BRUSH_DATA8 0x14a0
-#define R128_BRUSH_DATA9 0x14a4
-#define R128_BRUSH_SCALE 0x1470
-#define R128_BRUSH_Y_X 0x1474
-#define R128_BUS_CNTL 0x0030
-# define R128_BUS_MASTER_DIS (1 << 6)
-# define R128_BUS_RD_DISCARD_EN (1 << 24)
-# define R128_BUS_RD_ABORT_EN (1 << 25)
-# define R128_BUS_MSTR_DISCONNECT_EN (1 << 28)
-# define R128_BUS_WRT_BURST (1 << 29)
-# define R128_BUS_READ_BURST (1 << 30)
-#define R128_BUS_CNTL1 0x0034
-# define R128_BUS_WAIT_ON_LOCK_EN (1 << 4)
-
-#define R128_CACHE_CNTL 0x1724
-#define R128_CACHE_LINE 0x0f0c /* PCI */
-#define R128_CAP0_TRIG_CNTL 0x0950 /* ? */
-#define R128_CAP1_TRIG_CNTL 0x09c0 /* ? */
-#define R128_CAPABILITIES_ID 0x0f50 /* PCI */
-#define R128_CAPABILITIES_PTR 0x0f34 /* PCI */
-#define R128_CLK_PIN_CNTL 0x0001 /* PLL */
-#define R128_CLOCK_CNTL_DATA 0x000c
-#define R128_CLOCK_CNTL_INDEX 0x0008
-# define R128_PLL_WR_EN (1 << 7)
-# define R128_PLL_DIV_SEL (3 << 8)
-#define R128_CLR_CMP_CLR_3D 0x1a24
-#define R128_CLR_CMP_CLR_DST 0x15c8
-#define R128_CLR_CMP_CLR_SRC 0x15c4
-#define R128_CLR_CMP_CNTL 0x15c0
-# define R128_SRC_CMP_EQ_COLOR (4 << 0)
-# define R128_SRC_CMP_NEQ_COLOR (5 << 0)
-# define R128_CLR_CMP_SRC_SOURCE (1 << 24)
-#define R128_CLR_CMP_MASK 0x15cc
-# define R128_CLR_CMP_MSK 0xffffffff
-#define R128_CLR_CMP_MASK_3D 0x1A28
-#define R128_COMMAND 0x0f04 /* PCI */
-#define R128_COMPOSITE_SHADOW_ID 0x1a0c
-#define R128_CONFIG_APER_0_BASE 0x0100
-#define R128_CONFIG_APER_1_BASE 0x0104
-#define R128_CONFIG_APER_SIZE 0x0108
-#define R128_CONFIG_BONDS 0x00e8
-#define R128_CONFIG_CNTL 0x00e0
-# define APER_0_BIG_ENDIAN_16BPP_SWAP (1 << 0)
-# define APER_0_BIG_ENDIAN_32BPP_SWAP (2 << 0)
-#define R128_CONFIG_MEMSIZE 0x00f8
-#define R128_CONFIG_MEMSIZE_EMBEDDED 0x0114
-#define R128_CONFIG_REG_1_BASE 0x010c
-#define R128_CONFIG_REG_APER_SIZE 0x0110
-#define R128_CONFIG_XSTRAP 0x00e4
-#define R128_CONSTANT_COLOR_C 0x1d34
-# define R128_CONSTANT_COLOR_MASK 0x00ffffff
-# define R128_CONSTANT_COLOR_ONE 0x00ffffff
-# define R128_CONSTANT_COLOR_ZERO 0x00000000
-#define R128_CRC_CMDFIFO_ADDR 0x0740
-#define R128_CRC_CMDFIFO_DOUT 0x0744
-#define R128_CRTC_CRNT_FRAME 0x0214
-#define R128_CRTC_DEBUG 0x021c
-#define R128_CRTC_EXT_CNTL 0x0054
-# define R128_CRTC_VGA_XOVERSCAN (1 << 0)
-# define R128_VGA_ATI_LINEAR (1 << 3)
-# define R128_XCRT_CNT_EN (1 << 6)
-# define R128_CRTC_HSYNC_DIS (1 << 8)
-# define R128_CRTC_VSYNC_DIS (1 << 9)
-# define R128_CRTC_DISPLAY_DIS (1 << 10)
-# define R128_CRTC_CRT_ON (1 << 15)
-# define R128_FP_OUT_EN (1 << 22)
-# define R128_FP_ACTIVE (1 << 23)
-#define R128_CRTC_EXT_CNTL_DPMS_BYTE 0x0055
-# define R128_CRTC_HSYNC_DIS_BYTE (1 << 0)
-# define R128_CRTC_VSYNC_DIS_BYTE (1 << 1)
-# define R128_CRTC_DISPLAY_DIS_BYTE (1 << 2)
-#define R128_CRTC_GEN_CNTL 0x0050
-# define R128_CRTC_DBL_SCAN_EN (1 << 0)
-# define R128_CRTC_INTERLACE_EN (1 << 1)
-# define R128_CRTC_CSYNC_EN (1 << 4)
-# define R128_CRTC_CUR_EN (1 << 16)
-# define R128_CRTC_CUR_MODE_MASK (7 << 17)
-# define R128_CRTC_ICON_EN (1 << 20)
-# define R128_CRTC_EXT_DISP_EN (1 << 24)
-# define R128_CRTC_EN (1 << 25)
-# define R128_CRTC_DISP_REQ_EN_B (1 << 26)
-#define R128_CRTC_GUI_TRIG_VLINE 0x0218
-#define R128_CRTC_H_SYNC_STRT_WID 0x0204
-# define R128_CRTC_H_SYNC_STRT_PIX (0x07 << 0)
-# define R128_CRTC_H_SYNC_STRT_CHAR (0x1ff << 3)
-# define R128_CRTC_H_SYNC_STRT_CHAR_SHIFT 3
-# define R128_CRTC_H_SYNC_WID (0x3f << 16)
-# define R128_CRTC_H_SYNC_WID_SHIFT 16
-# define R128_CRTC_H_SYNC_POL (1 << 23)
-#define R128_CRTC_H_TOTAL_DISP 0x0200
-# define R128_CRTC_H_TOTAL (0x01ff << 0)
-# define R128_CRTC_H_TOTAL_SHIFT 0
-# define R128_CRTC_H_DISP (0x00ff << 16)
-# define R128_CRTC_H_DISP_SHIFT 16
-#define R128_CRTC_OFFSET 0x0224
-#define R128_CRTC_OFFSET_CNTL 0x0228
-#define R128_CRTC_PITCH 0x022c
-#define R128_CRTC_STATUS 0x005c
-# define R128_CRTC_VBLANK_SAVE (1 << 1)
-#define R128_CRTC_V_SYNC_STRT_WID 0x020c
-# define R128_CRTC_V_SYNC_STRT (0x7ff << 0)
-# define R128_CRTC_V_SYNC_STRT_SHIFT 0
-# define R128_CRTC_V_SYNC_WID (0x1f << 16)
-# define R128_CRTC_V_SYNC_WID_SHIFT 16
-# define R128_CRTC_V_SYNC_POL (1 << 23)
-#define R128_CRTC_V_TOTAL_DISP 0x0208
-# define R128_CRTC_V_TOTAL (0x07ff << 0)
-# define R128_CRTC_V_TOTAL_SHIFT 0
-# define R128_CRTC_V_DISP (0x07ff << 16)
-# define R128_CRTC_V_DISP_SHIFT 16
-#define R128_CRTC_VLINE_CRNT_VLINE 0x0210
-# define R128_CRTC_CRNT_VLINE_MASK (0x7ff << 16)
-#define R128_CRTC2_CRNT_FRAME 0x0314
-#define R128_CRTC2_DEBUG 0x031c
-#define R128_CRTC2_GEN_CNTL 0x03f8
-#define R128_CRTC2_GUI_TRIG_VLINE 0x0318
-#define R128_CRTC2_H_SYNC_STRT_WID 0x0304
-#define R128_CRTC2_H_TOTAL_DISP 0x0300
-#define R128_CRTC2_OFFSET 0x0324
-#define R128_CRTC2_OFFSET_CNTL 0x0328
-#define R128_CRTC2_PITCH 0x032c
-#define R128_CRTC2_STATUS 0x03fc
-#define R128_CRTC2_V_SYNC_STRT_WID 0x030c
-#define R128_CRTC2_V_TOTAL_DISP 0x0308
-#define R128_CRTC2_VLINE_CRNT_VLINE 0x0310
-#define R128_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */
-#define R128_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */
-#define R128_CUR_CLR0 0x026c
-#define R128_CUR_CLR1 0x0270
-#define R128_CUR_HORZ_VERT_OFF 0x0268
-#define R128_CUR_HORZ_VERT_POSN 0x0264
-#define R128_CUR_OFFSET 0x0260
-# define R128_CUR_LOCK (1 << 31)
-
-#define R128_DAC_CNTL 0x0058
-# define R128_DAC_RANGE_CNTL (3 << 0)
-# define R128_DAC_BLANKING (1 << 2)
-# define R128_DAC_CRT_SEL_CRTC2 (1 << 4)
-# define R128_DAC_PALETTE_ACC_CTL (1 << 5)
-# define R128_DAC_8BIT_EN (1 << 8)
-# define R128_DAC_VGA_ADR_EN (1 << 13)
-# define R128_DAC_MASK_ALL (0xff << 24)
-#define R128_DAC_CRC_SIG 0x02cc
-#define R128_DAC_DATA 0x03c9 /* VGA */
-#define R128_DAC_MASK 0x03c6 /* VGA */
-#define R128_DAC_R_INDEX 0x03c7 /* VGA */
-#define R128_DAC_W_INDEX 0x03c8 /* VGA */
-#define R128_DDA_CONFIG 0x02e0
-#define R128_DDA_ON_OFF 0x02e4
-#define R128_DEFAULT_OFFSET 0x16e0
-#define R128_DEFAULT_PITCH 0x16e4
-#define R128_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
-# define R128_DEFAULT_SC_RIGHT_MAX (0x1fff << 0)
-# define R128_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
-#define R128_DESTINATION_3D_CLR_CMP_VAL 0x1820
-#define R128_DESTINATION_3D_CLR_CMP_MSK 0x1824
-#define R128_DEVICE_ID 0x0f02 /* PCI */
-#define R128_DP_BRUSH_BKGD_CLR 0x1478
-#define R128_DP_BRUSH_FRGD_CLR 0x147c
-#define R128_DP_CNTL 0x16c0
-# define R128_DST_X_LEFT_TO_RIGHT (1 << 0)
-# define R128_DST_Y_TOP_TO_BOTTOM (1 << 1)
-#define R128_DP_CNTL_XDIR_YDIR_YMAJOR 0x16d0
-# define R128_DST_Y_MAJOR (1 << 2)
-# define R128_DST_Y_DIR_TOP_TO_BOTTOM (1 << 15)
-# define R128_DST_X_DIR_LEFT_TO_RIGHT (1 << 31)
-#define R128_DP_DATATYPE 0x16c4
-# define R128_HOST_BIG_ENDIAN_EN (1 << 29)
-#define R128_DP_GUI_MASTER_CNTL 0x146c
-# define R128_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
-# define R128_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
-# define R128_GMC_SRC_CLIPPING (1 << 2)
-# define R128_GMC_DST_CLIPPING (1 << 3)
-# define R128_GMC_BRUSH_DATATYPE_MASK (0x0f << 4)
-# define R128_GMC_BRUSH_8X8_MONO_FG_BG (0 << 4)
-# define R128_GMC_BRUSH_8X8_MONO_FG_LA (1 << 4)
-# define R128_GMC_BRUSH_1X8_MONO_FG_BG (4 << 4)
-# define R128_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4)
-# define R128_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4)
-# define R128_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4)
-# define R128_GMC_BRUSH_32x32_MONO_FG_BG (8 << 4)
-# define R128_GMC_BRUSH_32x32_MONO_FG_LA (9 << 4)
-# define R128_GMC_BRUSH_8x8_COLOR (10 << 4)
-# define R128_GMC_BRUSH_1X8_COLOR (12 << 4)
-# define R128_GMC_BRUSH_SOLID_COLOR (13 << 4)
-# define R128_GMC_BRUSH_NONE (15 << 4)
-# define R128_GMC_DST_8BPP_CI (2 << 8)
-# define R128_GMC_DST_15BPP (3 << 8)
-# define R128_GMC_DST_16BPP (4 << 8)
-# define R128_GMC_DST_24BPP (5 << 8)
-# define R128_GMC_DST_32BPP (6 << 8)
-# define R128_GMC_DST_8BPP_RGB (7 << 8)
-# define R128_GMC_DST_Y8 (8 << 8)
-# define R128_GMC_DST_RGB8 (9 << 8)
-# define R128_GMC_DST_VYUY (11 << 8)
-# define R128_GMC_DST_YVYU (12 << 8)
-# define R128_GMC_DST_AYUV444 (14 << 8)
-# define R128_GMC_DST_ARGB4444 (15 << 8)
-# define R128_GMC_DST_DATATYPE_MASK (0x0f << 8)
-# define R128_GMC_DST_DATATYPE_SHIFT 8
-# define R128_GMC_SRC_DATATYPE_MASK (3 << 12)
-# define R128_GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12)
-# define R128_GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12)
-# define R128_GMC_SRC_DATATYPE_COLOR (3 << 12)
-# define R128_GMC_BYTE_PIX_ORDER (1 << 14)
-# define R128_GMC_BYTE_MSB_TO_LSB (0 << 14)
-# define R128_GMC_BYTE_LSB_TO_MSB (1 << 14)
-# define R128_GMC_CONVERSION_TEMP (1 << 15)
-# define R128_GMC_CONVERSION_TEMP_6500 (0 << 15)
-# define R128_GMC_CONVERSION_TEMP_9300 (1 << 15)
-# define R128_GMC_ROP3_MASK (0xff << 16)
-# define R128_DP_SRC_SOURCE_MASK (7 << 24)
-# define R128_DP_SRC_SOURCE_MEMORY (2 << 24)
-# define R128_DP_SRC_SOURCE_HOST_DATA (3 << 24)
-# define R128_GMC_3D_FCN_EN (1 << 27)
-# define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28)
-# define R128_GMC_AUX_CLIP_DIS (1 << 29)
-# define R128_GMC_WR_MSK_DIS (1 << 30)
-# define R128_GMC_LD_BRUSH_Y_X (1 << 31)
-# define R128_ROP3_ZERO 0x00000000
-# define R128_ROP3_DSa 0x00880000
-# define R128_ROP3_SDna 0x00440000
-# define R128_ROP3_S 0x00cc0000
-# define R128_ROP3_DSna 0x00220000
-# define R128_ROP3_D 0x00aa0000
-# define R128_ROP3_DSx 0x00660000
-# define R128_ROP3_DSo 0x00ee0000
-# define R128_ROP3_DSon 0x00110000
-# define R128_ROP3_DSxn 0x00990000
-# define R128_ROP3_Dn 0x00550000
-# define R128_ROP3_SDno 0x00dd0000
-# define R128_ROP3_Sn 0x00330000
-# define R128_ROP3_DSno 0x00bb0000
-# define R128_ROP3_DSan 0x00770000
-# define R128_ROP3_ONE 0x00ff0000
-# define R128_ROP3_DPa 0x00a00000
-# define R128_ROP3_PDna 0x00500000
-# define R128_ROP3_P 0x00f00000
-# define R128_ROP3_DPna 0x000a0000
-# define R128_ROP3_D 0x00aa0000
-# define R128_ROP3_DPx 0x005a0000
-# define R128_ROP3_DPo 0x00fa0000
-# define R128_ROP3_DPon 0x00050000
-# define R128_ROP3_PDxn 0x00a50000
-# define R128_ROP3_PDno 0x00f50000
-# define R128_ROP3_Pn 0x000f0000
-# define R128_ROP3_DPno 0x00af0000
-# define R128_ROP3_DPan 0x005f0000
-
-
-#define R128_DP_GUI_MASTER_CNTL_C 0x1c84
-#define R128_DP_MIX 0x16c8
-#define R128_DP_SRC_BKGD_CLR 0x15dc
-#define R128_DP_SRC_FRGD_CLR 0x15d8
-#define R128_DP_WRITE_MASK 0x16cc
-#define R128_DST_BRES_DEC 0x1630
-#define R128_DST_BRES_ERR 0x1628
-#define R128_DST_BRES_INC 0x162c
-#define R128_DST_BRES_LNTH 0x1634
-#define R128_DST_BRES_LNTH_SUB 0x1638
-#define R128_DST_HEIGHT 0x1410
-#define R128_DST_HEIGHT_WIDTH 0x143c
-#define R128_DST_HEIGHT_WIDTH_8 0x158c
-#define R128_DST_HEIGHT_WIDTH_BW 0x15b4
-#define R128_DST_HEIGHT_Y 0x15a0
-#define R128_DST_OFFSET 0x1404
-#define R128_DST_PITCH 0x1408
-#define R128_DST_PITCH_OFFSET 0x142c
-#define R128_DST_PITCH_OFFSET_C 0x1c80
-# define R128_PITCH_SHIFT 21
-# define R128_DST_TILE (1 << 31)
-#define R128_DST_WIDTH 0x140c
-#define R128_DST_WIDTH_HEIGHT 0x1598
-#define R128_DST_WIDTH_X 0x1588
-#define R128_DST_WIDTH_X_INCY 0x159c
-#define R128_DST_X 0x141c
-#define R128_DST_X_SUB 0x15a4
-#define R128_DST_X_Y 0x1594
-#define R128_DST_Y 0x1420
-#define R128_DST_Y_SUB 0x15a8
-#define R128_DST_Y_X 0x1438
-
-#define R128_EXT_MEM_CNTL 0x0144
-
-#define R128_FCP_CNTL 0x0012 /* PLL */
-#define R128_FLUSH_1 0x1704
-#define R128_FLUSH_2 0x1708
-#define R128_FLUSH_3 0x170c
-#define R128_FLUSH_4 0x1710
-#define R128_FLUSH_5 0x1714
-#define R128_FLUSH_6 0x1718
-#define R128_FLUSH_7 0x171c
-#define R128_FOG_3D_TABLE_START 0x1810
-#define R128_FOG_3D_TABLE_END 0x1814
-#define R128_FOG_3D_TABLE_DENSITY 0x181c
-#define R128_FOG_TABLE_INDEX 0x1a14
-#define R128_FOG_TABLE_DATA 0x1a18
-#define R128_FP_CRTC_H_TOTAL_DISP 0x0250
-#define R128_FP_CRTC_V_TOTAL_DISP 0x0254
-#define R128_FP_GEN_CNTL 0x0284
-# define R128_FP_FPON (1 << 0)
-# define R128_FP_BLANK_DIS (1 << 1)
-# define R128_FP_TDMS_EN (1 << 2)
-# define R128_FP_DETECT_SENSE (1 << 8)
-# define R128_FP_SEL_CRTC2 (1 << 13)
-# define R128_FP_CRTC_DONT_SHADOW_VPAR (1 << 16)
-# define R128_FP_CRTC_DONT_SHADOW_HEND (1 << 17)
-# define R128_FP_CRTC_USE_SHADOW_VEND (1 << 18)
-# define R128_FP_CRTC_USE_SHADOW_ROWCUR (1 << 19)
-# define R128_FP_CRTC_HORZ_DIV2_EN (1 << 20)
-# define R128_FP_CRTC_HOR_CRT_DIV2_DIS (1 << 21)
-# define R128_FP_CRT_SYNC_SEL (1 << 23)
-# define R128_FP_USE_SHADOW_EN (1 << 24)
-#define R128_FP_H_SYNC_STRT_WID 0x02c4
-#define R128_FP_HORZ_STRETCH 0x028c
-# define R128_HORZ_STRETCH_RATIO_MASK 0xffff
-# define R128_HORZ_STRETCH_RATIO_SHIFT 0
-# define R128_HORZ_STRETCH_RATIO_MAX 4096
-# define R128_HORZ_PANEL_SIZE (0xff << 16)
-# define R128_HORZ_PANEL_SHIFT 16
-# define R128_AUTO_HORZ_RATIO (0 << 24)
-# define R128_HORZ_STRETCH_PIXREP (0 << 25)
-# define R128_HORZ_STRETCH_BLEND (1 << 25)
-# define R128_HORZ_STRETCH_ENABLE (1 << 26)
-# define R128_HORZ_FP_LOOP_STRETCH (0x7 << 27)
-# define R128_HORZ_STRETCH_RESERVED (1 << 30)
-# define R128_HORZ_AUTO_RATIO_FIX_EN (1 << 31)
-
-#define R128_FP_PANEL_CNTL 0x0288
-# define R128_FP_DIGON (1 << 0)
-# define R128_FP_BLON (1 << 1)
-#define R128_FP_V_SYNC_STRT_WID 0x02c8
-#define R128_FP_VERT_STRETCH 0x0290
-# define R128_VERT_PANEL_SIZE (0x7ff << 0)
-# define R128_VERT_PANEL_SHIFT 0
-# define R128_VERT_STRETCH_RATIO_MASK 0x3ff
-# define R128_VERT_STRETCH_RATIO_SHIFT 11
-# define R128_VERT_STRETCH_RATIO_MAX 1024
-# define R128_VERT_STRETCH_ENABLE (1 << 24)
-# define R128_VERT_STRETCH_LINEREP (0 << 25)
-# define R128_VERT_STRETCH_BLEND (1 << 25)
-# define R128_VERT_AUTO_RATIO_EN (1 << 26)
-# define R128_VERT_STRETCH_RESERVED 0xf8e00000
-
-#define R128_GEN_INT_CNTL 0x0040
-#define R128_GEN_INT_STATUS 0x0044
-# define R128_VSYNC_INT_AK (1 << 2)
-# define R128_VSYNC_INT (1 << 2)
-#define R128_GEN_RESET_CNTL 0x00f0
-# define R128_SOFT_RESET_GUI (1 << 0)
-# define R128_SOFT_RESET_VCLK (1 << 8)
-# define R128_SOFT_RESET_PCLK (1 << 9)
-# define R128_SOFT_RESET_DISPENG_XCLK (1 << 11)
-# define R128_SOFT_RESET_MEMCTLR_XCLK (1 << 12)
-#define R128_GENENB 0x03c3 /* VGA */
-#define R128_GENFC_RD 0x03ca /* VGA */
-#define R128_GENFC_WT 0x03da /* VGA, 0x03ba */
-#define R128_GENMO_RD 0x03cc /* VGA */
-#define R128_GENMO_WT 0x03c2 /* VGA */
-#define R128_GENS0 0x03c2 /* VGA */
-#define R128_GENS1 0x03da /* VGA, 0x03ba */
-#define R128_GPIO_MONID 0x0068
-# define R128_GPIO_MONID_A_0 (1 << 0)
-# define R128_GPIO_MONID_A_1 (1 << 1)
-# define R128_GPIO_MONID_A_2 (1 << 2)
-# define R128_GPIO_MONID_A_3 (1 << 3)
-# define R128_GPIO_MONID_Y_0 (1 << 8)
-# define R128_GPIO_MONID_Y_1 (1 << 9)
-# define R128_GPIO_MONID_Y_2 (1 << 10)
-# define R128_GPIO_MONID_Y_3 (1 << 11)
-# define R128_GPIO_MONID_EN_0 (1 << 16)
-# define R128_GPIO_MONID_EN_1 (1 << 17)
-# define R128_GPIO_MONID_EN_2 (1 << 18)
-# define R128_GPIO_MONID_EN_3 (1 << 19)
-# define R128_GPIO_MONID_MASK_0 (1 << 24)
-# define R128_GPIO_MONID_MASK_1 (1 << 25)
-# define R128_GPIO_MONID_MASK_2 (1 << 26)
-# define R128_GPIO_MONID_MASK_3 (1 << 27)
-#define R128_GPIO_MONIDB 0x006c
-#define R128_GRPH8_DATA 0x03cf /* VGA */
-#define R128_GRPH8_IDX 0x03ce /* VGA */
-#define R128_GUI_DEBUG0 0x16a0
-#define R128_GUI_DEBUG1 0x16a4
-#define R128_GUI_DEBUG2 0x16a8
-#define R128_GUI_DEBUG3 0x16ac
-#define R128_GUI_DEBUG4 0x16b0
-#define R128_GUI_DEBUG5 0x16b4
-#define R128_GUI_DEBUG6 0x16b8
-#define R128_GUI_PROBE 0x16bc
-#define R128_GUI_SCRATCH_REG0 0x15e0
-#define R128_GUI_SCRATCH_REG1 0x15e4
-#define R128_GUI_SCRATCH_REG2 0x15e8
-#define R128_GUI_SCRATCH_REG3 0x15ec
-#define R128_GUI_SCRATCH_REG4 0x15f0
-#define R128_GUI_SCRATCH_REG5 0x15f4
-#define R128_GUI_STAT 0x1740
-# define R128_GUI_FIFOCNT_MASK 0x0fff
-# define R128_GUI_ACTIVE (1 << 31)
-
-#define R128_HEADER 0x0f0e /* PCI */
-#define R128_HOST_DATA0 0x17c0
-#define R128_HOST_DATA1 0x17c4
-#define R128_HOST_DATA2 0x17c8
-#define R128_HOST_DATA3 0x17cc
-#define R128_HOST_DATA4 0x17d0
-#define R128_HOST_DATA5 0x17d4
-#define R128_HOST_DATA6 0x17d8
-#define R128_HOST_DATA7 0x17dc
-#define R128_HOST_DATA_LAST 0x17e0
-#define R128_HOST_PATH_CNTL 0x0130
-#define R128_HTOTAL_CNTL 0x0009 /* PLL */
-#define R128_HW_DEBUG 0x0128
-#define R128_HW_DEBUG2 0x011c
-
-#define R128_I2C_CNTL_1 0x0094 /* ? */
-#define R128_INTERRUPT_LINE 0x0f3c /* PCI */
-#define R128_INTERRUPT_PIN 0x0f3d /* PCI */
-#define R128_IO_BASE 0x0f14 /* PCI */
-
-#define R128_LATENCY 0x0f0d /* PCI */
-#define R128_LEAD_BRES_DEC 0x1608
-#define R128_LEAD_BRES_ERR 0x1600
-#define R128_LEAD_BRES_INC 0x1604
-#define R128_LEAD_BRES_LNTH 0x161c
-#define R128_LEAD_BRES_LNTH_SUB 0x1624
-#define R128_LVDS_GEN_CNTL 0x02d0
-# define R128_LVDS_ON (1 << 0)
-# define R128_LVDS_DISPLAY_DIS (1 << 1)
-# define R128_LVDS_EN (1 << 7)
-# define R128_LVDS_DIGON (1 << 18)
-# define R128_LVDS_BLON (1 << 19)
-# define R128_LVDS_SEL_CRTC2 (1 << 23)
-# define R128_HSYNC_DELAY_SHIFT 28
-# define R128_HSYNC_DELAY_MASK (0xf << 28)
-
-#define R128_MAX_LATENCY 0x0f3f /* PCI */
-#define R128_MCLK_CNTL 0x000f /* PLL */
-# define R128_FORCE_GCP (1 << 16)
-# define R128_FORCE_PIPE3D_CP (1 << 17)
-# define R128_FORCE_RCP (1 << 18)
-#define R128_MDGPIO_A_REG 0x01ac
-#define R128_MDGPIO_EN_REG 0x01b0
-#define R128_MDGPIO_MASK 0x0198
-#define R128_MDGPIO_Y_REG 0x01b4
-#define R128_MEM_ADDR_CONFIG 0x0148
-#define R128_MEM_BASE 0x0f10 /* PCI */
-#define R128_MEM_CNTL 0x0140
-#define R128_MEM_INIT_LAT_TIMER 0x0154
-#define R128_MEM_INTF_CNTL 0x014c
-#define R128_MEM_SDRAM_MODE_REG 0x0158
-#define R128_MEM_STR_CNTL 0x0150
-#define R128_MEM_VGA_RP_SEL 0x003c
-#define R128_MEM_VGA_WP_SEL 0x0038
-#define R128_MIN_GRANT 0x0f3e /* PCI */
-#define R128_MM_DATA 0x0004
-#define R128_MM_INDEX 0x0000
-#define R128_MPLL_CNTL 0x000e /* PLL */
-#define R128_MPP_TB_CONFIG 0x01c0 /* ? */
-#define R128_MPP_GP_CONFIG 0x01c8 /* ? */
-
-#define R128_N_VIF_COUNT 0x0248
-
-#define R128_OVR_CLR 0x0230
-#define R128_OVR_WID_LEFT_RIGHT 0x0234
-#define R128_OVR_WID_TOP_BOTTOM 0x0238
-
-/* first overlay unit (there is only one) */
-
-#define R128_OV0_Y_X_START 0x0400
-#define R128_OV0_Y_X_END 0x0404
-#define R128_OV0_EXCLUSIVE_HORZ 0x0408
-# define R128_EXCL_HORZ_START_MASK 0x000000ff
-# define R128_EXCL_HORZ_END_MASK 0x0000ff00
-# define R128_EXCL_HORZ_BACK_PORCH_MASK 0x00ff0000
-# define R128_EXCL_HORZ_EXCLUSIVE_EN 0x80000000
-#define R128_OV0_EXCLUSIVE_VERT 0x040C
-# define R128_EXCL_VERT_START_MASK 0x000003ff
-# define R128_EXCL_VERT_END_MASK 0x03ff0000
-#define R128_OV0_REG_LOAD_CNTL 0x0410
-# define R128_REG_LD_CTL_LOCK 0x00000001L
-# define R128_REG_LD_CTL_VBLANK_DURING_LOCK 0x00000002L
-# define R128_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L
-# define R128_REG_LD_CTL_LOCK_READBACK 0x00000008L
-#define R128_OV0_SCALE_CNTL 0x0420
-# define R128_SCALER_PIX_EXPAND 0x00000001L
-# define R128_SCALER_Y2R_TEMP 0x00000002L
-# define R128_SCALER_HORZ_PICK_NEAREST 0x00000003L
-# define R128_SCALER_VERT_PICK_NEAREST 0x00000004L
-# define R128_SCALER_SIGNED_UV 0x00000010L
-# define R128_SCALER_GAMMA_SEL_MASK 0x00000060L
-# define R128_SCALER_GAMMA_SEL_BRIGHT 0x00000000L
-# define R128_SCALER_GAMMA_SEL_G22 0x00000020L
-# define R128_SCALER_GAMMA_SEL_G18 0x00000040L
-# define R128_SCALER_GAMMA_SEL_G14 0x00000060L
-# define R128_SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L
-# define R128_SCALER_SURFAC_FORMAT 0x00000f00L
-# define R128_SCALER_SOURCE_15BPP 0x00000300L
-# define R128_SCALER_SOURCE_16BPP 0x00000400L
-# define R128_SCALER_SOURCE_32BPP 0x00000600L
-# define R128_SCALER_SOURCE_YUV9 0x00000900L
-# define R128_SCALER_SOURCE_YUV12 0x00000A00L
-# define R128_SCALER_SOURCE_VYUY422 0x00000B00L
-# define R128_SCALER_SOURCE_YVYU422 0x00000C00L
-# define R128_SCALER_SMART_SWITCH 0x00008000L
-# define R128_SCALER_BURST_PER_PLANE 0x00ff0000L
-# define R128_SCALER_DOUBLE_BUFFER 0x01000000L
-# define R128_SCALER_DIS_LIMIT 0x08000000L
-# define R128_SCALER_PRG_LOAD_START 0x10000000L
-# define R128_SCALER_INT_EMU 0x20000000L
-# define R128_SCALER_ENABLE 0x40000000L
-# define R128_SCALER_SOFT_RESET 0x80000000L
-#define R128_OV0_V_INC 0x0424
-#define R128_OV0_P1_V_ACCUM_INIT 0x0428
-# define R128_OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L
-# define R128_OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L
-#define R128_OV0_P23_V_ACCUM_INIT 0x042C
-#define R128_OV0_P1_BLANK_LINES_AT_TOP 0x0430
-# define R128_P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL
-# define R128_P1_ACTIVE_LINES_M1 0x0fff0000L
-#define R128_OV0_P23_BLANK_LINES_AT_TOP 0x0434
-# define R128_P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL
-# define R128_P23_ACTIVE_LINES_M1 0x07ff0000L
-#define R128_OV0_VID_BUF0_BASE_ADRS 0x0440
-# define R128_VIF_BUF0_PITCH_SEL 0x00000001L
-# define R128_VIF_BUF0_TILE_ADRS 0x00000002L
-# define R128_VIF_BUF0_BASE_ADRS_MASK 0x03fffff0L
-# define R128_VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L
-#define R128_OV0_VID_BUF1_BASE_ADRS 0x0444
-# define R128_VIF_BUF1_PITCH_SEL 0x00000001L
-# define R128_VIF_BUF1_TILE_ADRS 0x00000002L
-# define R128_VIF_BUF1_BASE_ADRS_MASK 0x03fffff0L
-# define R128_VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L
-#define R128_OV0_VID_BUF2_BASE_ADRS 0x0448
-# define R128_VIF_BUF2_PITCH_SEL 0x00000001L
-# define R128_VIF_BUF2_TILE_ADRS 0x00000002L
-# define R128_VIF_BUF2_BASE_ADRS_MASK 0x03fffff0L
-# define R128_VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L
-#define R128_OV0_VID_BUF3_BASE_ADRS 0x044C
-#define R128_OV0_VID_BUF4_BASE_ADRS 0x0450
-#define R128_OV0_VID_BUF5_BASE_ADRS 0x0454
-#define R128_OV0_VID_BUF_PITCH0_VALUE 0x0460
-#define R128_OV0_VID_BUF_PITCH1_VALUE 0x0464
-#define R128_OV0_AUTO_FLIP_CNTL 0x0470
-#define R128_OV0_DEINTERLACE_PATTERN 0x0474
-#define R128_OV0_H_INC 0x0480
-#define R128_OV0_STEP_BY 0x0484
-#define R128_OV0_P1_H_ACCUM_INIT 0x0488
-#define R128_OV0_P23_H_ACCUM_INIT 0x048C
-#define R128_OV0_P1_X_START_END 0x0494
-#define R128_OV0_P2_X_START_END 0x0498
-#define R128_OV0_P3_X_START_END 0x049C
-#define R128_OV0_FILTER_CNTL 0x04A0
-#define R128_OV0_FOUR_TAP_COEF_0 0x04B0
-#define R128_OV0_FOUR_TAP_COEF_1 0x04B4
-#define R128_OV0_FOUR_TAP_COEF_2 0x04B8
-#define R128_OV0_FOUR_TAP_COEF_3 0x04BC
-#define R128_OV0_FOUR_TAP_COEF_4 0x04C0
-#define R128_OV0_COLOUR_CNTL 0x04E0
-#define R128_OV0_VIDEO_KEY_CLR 0x04E4
-#define R128_OV0_VIDEO_KEY_MSK 0x04E8
-#define R128_OV0_GRAPHICS_KEY_CLR 0x04EC
-#define R128_OV0_GRAPHICS_KEY_MSK 0x04F0
-#define R128_OV0_KEY_CNTL 0x04F4
-# define R128_VIDEO_KEY_FN_MASK 0x00000007L
-# define R128_VIDEO_KEY_FN_FALSE 0x00000000L
-# define R128_VIDEO_KEY_FN_TRUE 0x00000001L
-# define R128_VIDEO_KEY_FN_EQ 0x00000004L
-# define R128_VIDEO_KEY_FN_NE 0x00000005L
-# define R128_GRAPHIC_KEY_FN_MASK 0x00000070L
-# define R128_GRAPHIC_KEY_FN_FALSE 0x00000000L
-# define R128_GRAPHIC_KEY_FN_TRUE 0x00000010L
-# define R128_GRAPHIC_KEY_FN_EQ 0x00000040L
-# define R128_GRAPHIC_KEY_FN_NE 0x00000050L
-# define R128_CMP_MIX_MASK 0x00000100L
-# define R128_CMP_MIX_OR 0x00000000L
-# define R128_CMP_MIX_AND 0x00000100L
-#define R128_OV0_TEST 0x04F8
-
-
-#define R128_PALETTE_DATA 0x00b4
-#define R128_PALETTE_INDEX 0x00b0
-#define R128_PC_DEBUG_MODE 0x1760
-#define R128_PC_GUI_CTLSTAT 0x1748
-#define R128_PC_GUI_MODE 0x1744
-# define R128_PC_IGNORE_UNIFY (1 << 5)
-#define R128_PC_MISC_CNTL 0x0188
-#define R128_PC_NGUI_CTLSTAT 0x0184
-# define R128_PC_FLUSH_GUI (3 << 0)
-# define R128_PC_RI_GUI (1 << 2)
-# define R128_PC_FLUSH_ALL 0x00ff
-# define R128_PC_BUSY (1 << 31)
-#define R128_PC_NGUI_MODE 0x0180
-#define R128_PCI_GART_PAGE 0x017c
-#define R128_PLANE_3D_MASK_C 0x1d44
-#define R128_PLL_TEST_CNTL 0x0013 /* PLL */
-#define R128_PMI_CAP_ID 0x0f5c /* PCI */
-#define R128_PMI_DATA 0x0f63 /* PCI */
-#define R128_PMI_NXT_CAP_PTR 0x0f5d /* PCI */
-#define R128_PMI_PMC_REG 0x0f5e /* PCI */
-#define R128_PMI_PMCSR_REG 0x0f60 /* PCI */
-#define R128_PMI_REGISTER 0x0f5c /* PCI */
-#define R128_PPLL_CNTL 0x0002 /* PLL */
-# define R128_PPLL_RESET (1 << 0)
-# define R128_PPLL_SLEEP (1 << 1)
-# define R128_PPLL_ATOMIC_UPDATE_EN (1 << 16)
-# define R128_PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
-#define R128_PPLL_DIV_0 0x0004 /* PLL */
-#define R128_PPLL_DIV_1 0x0005 /* PLL */
-#define R128_PPLL_DIV_2 0x0006 /* PLL */
-#define R128_PPLL_DIV_3 0x0007 /* PLL */
-# define R128_PPLL_FB3_DIV_MASK 0x07ff
-# define R128_PPLL_POST3_DIV_MASK 0x00070000
-#define R128_PPLL_REF_DIV 0x0003 /* PLL */
-# define R128_PPLL_REF_DIV_MASK 0x03ff
-# define R128_PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */
-# define R128_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */
-#define R128_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */
-#define R128_REG_BASE 0x0f18 /* PCI */
-#define R128_REGPROG_INF 0x0f09 /* PCI */
-#define R128_REVISION_ID 0x0f08 /* PCI */
-
-#define R128_SC_BOTTOM 0x164c
-#define R128_SC_BOTTOM_RIGHT 0x16f0
-#define R128_SC_BOTTOM_RIGHT_C 0x1c8c
-#define R128_SC_LEFT 0x1640
-#define R128_SC_RIGHT 0x1644
-#define R128_SC_TOP 0x1648
-#define R128_SC_TOP_LEFT 0x16ec
-#define R128_SC_TOP_LEFT_C 0x1c88
-#define R128_SEQ8_DATA 0x03c5 /* VGA */
-#define R128_SEQ8_IDX 0x03c4 /* VGA */
-#define R128_SNAPSHOT_F_COUNT 0x0244
-#define R128_SNAPSHOT_VH_COUNTS 0x0240
-#define R128_SNAPSHOT_VIF_COUNT 0x024c
-#define R128_SRC_OFFSET 0x15ac
-#define R128_SRC_PITCH 0x15b0
-#define R128_SRC_PITCH_OFFSET 0x1428
-#define R128_SRC_SC_BOTTOM 0x165c
-#define R128_SRC_SC_BOTTOM_RIGHT 0x16f4
-#define R128_SRC_SC_RIGHT 0x1654
-#define R128_SRC_X 0x1414
-#define R128_SRC_X_Y 0x1590
-#define R128_SRC_Y 0x1418
-#define R128_SRC_Y_X 0x1434
-#define R128_STATUS 0x0f06 /* PCI */
-#define R128_SUBPIC_CNTL 0x0540 /* ? */
-#define R128_SUB_CLASS 0x0f0a /* PCI */
-#define R128_SURFACE_DELAY 0x0b00
-#define R128_SURFACE0_INFO 0x0b0c
-#define R128_SURFACE0_LOWER_BOUND 0x0b04
-#define R128_SURFACE0_UPPER_BOUND 0x0b08
-#define R128_SURFACE1_INFO 0x0b1c
-#define R128_SURFACE1_LOWER_BOUND 0x0b14
-#define R128_SURFACE1_UPPER_BOUND 0x0b18
-#define R128_SURFACE2_INFO 0x0b2c
-#define R128_SURFACE2_LOWER_BOUND 0x0b24
-#define R128_SURFACE2_UPPER_BOUND 0x0b28
-#define R128_SURFACE3_INFO 0x0b3c
-#define R128_SURFACE3_LOWER_BOUND 0x0b34
-#define R128_SURFACE3_UPPER_BOUND 0x0b38
-#define R128_SW_SEMAPHORE 0x013c
-
-#define R128_TEST_DEBUG_CNTL 0x0120
-#define R128_TEST_DEBUG_MUX 0x0124
-#define R128_TEST_DEBUG_OUT 0x012c
-#define R128_TMDS_CRC 0x02a0
-#define R128_TMDS_TRANSMITTER_CNTL 0x02a4
-# define R128_TMDS_PLLEN (1 << 0)
-# define R128_TMDS_PLLRST (1 << 1)
-#define R128_TRAIL_BRES_DEC 0x1614
-#define R128_TRAIL_BRES_ERR 0x160c
-#define R128_TRAIL_BRES_INC 0x1610
-#define R128_TRAIL_X 0x1618
-#define R128_TRAIL_X_SUB 0x1620
-
-#define R128_VCLK_ECP_CNTL 0x0008 /* PLL */
-#define R128_VENDOR_ID 0x0f00 /* PCI */
-#define R128_VGA_DDA_CONFIG 0x02e8
-#define R128_VGA_DDA_ON_OFF 0x02ec
-#define R128_VID_BUFFER_CONTROL 0x0900
-#define R128_VIDEOMUX_CNTL 0x0190
-#define R128_VIPH_CONTROL 0x01D0 /* ? */
-
-#define R128_WAIT_UNTIL 0x1720
-
-#define R128_X_MPLL_REF_FB_DIV 0x000a /* PLL */
-#define R128_XCLK_CNTL 0x000d /* PLL */
-#define R128_XDLL_CNTL 0x000c /* PLL */
-#define R128_XPLL_CNTL 0x000b /* PLL */
-
- /* Registers for CCE and Microcode Engine */
-#define R128_PM4_MICROCODE_ADDR 0x07d4
-#define R128_PM4_MICROCODE_RADDR 0x07d8
-#define R128_PM4_MICROCODE_DATAH 0x07dc
-#define R128_PM4_MICROCODE_DATAL 0x07e0
-
-#define R128_PM4_BUFFER_OFFSET 0x0700
-#define R128_PM4_BUFFER_CNTL 0x0704
-# define R128_PM4_NONPM4 (0 << 28)
-# define R128_PM4_192PIO (1 << 28)
-# define R128_PM4_192BM (2 << 28)
-# define R128_PM4_128PIO_64INDBM (3 << 28)
-# define R128_PM4_128BM_64INDBM (4 << 28)
-# define R128_PM4_64PIO_128INDBM (5 << 28)
-# define R128_PM4_64BM_128INDBM (6 << 28)
-# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28)
-# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28)
-# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28)
-#define R128_PM4_BUFFER_WM_CNTL 0x0708
-# define R128_WMA_SHIFT 0
-# define R128_WMB_SHIFT 8
-# define R128_WMC_SHIFT 16
-# define R128_WB_WM_SHIFT 24
-#define R128_PM4_BUFFER_DL_RPTR_ADDR 0x070c
-#define R128_PM4_BUFFER_DL_RPTR 0x0710
-#define R128_PM4_BUFFER_DL_WPTR 0x0714
-# define R128_PM4_BUFFER_DL_DONE (1 << 31)
-#define R128_PM4_BUFFER_DL_WPTR_DELAY 0x0718
-# define R128_PRE_WRITE_TIMER_SHIFT 0
-# define R128_PRE_WRITE_LIMIT_SHIFT 23
-#define R128_PM4_VC_FPU_SETUP 0x071c
-# define R128_FRONT_DIR_CW (0 << 0)
-# define R128_FRONT_DIR_CCW (1 << 0)
-# define R128_FRONT_DIR_MASK (1 << 0)
-# define R128_BACKFACE_CULL (0 << 1)
-# define R128_BACKFACE_POINTS (1 << 1)
-# define R128_BACKFACE_LINES (2 << 1)
-# define R128_BACKFACE_SOLID (3 << 1)
-# define R128_BACKFACE_MASK (3 << 1)
-# define R128_FRONTFACE_CULL (0 << 3)
-# define R128_FRONTFACE_POINTS (1 << 3)
-# define R128_FRONTFACE_LINES (2 << 3)
-# define R128_FRONTFACE_SOLID (3 << 3)
-# define R128_FRONTFACE_MASK (3 << 3)
-# define R128_FPU_COLOR_SOLID (0 << 5)
-# define R128_FPU_COLOR_FLAT (1 << 5)
-# define R128_FPU_COLOR_GOURAUD (2 << 5)
-# define R128_FPU_COLOR_GOURAUD2 (3 << 5)
-# define R128_FPU_COLOR_MASK (3 << 5)
-# define R128_FPU_SUB_PIX_2BITS (0 << 7)
-# define R128_FPU_SUB_PIX_4BITS (1 << 7)
-# define R128_FPU_MODE_2D (0 << 8)
-# define R128_FPU_MODE_3D (1 << 8)
-# define R128_TRAP_BITS_DISABLE (1 << 9)
-# define R128_EDGE_ANTIALIAS (1 << 10)
-# define R128_SUPERSAMPLE (1 << 11)
-# define R128_XFACTOR_2 (0 << 12)
-# define R128_XFACTOR_4 (1 << 12)
-# define R128_YFACTOR_2 (0 << 13)
-# define R128_YFACTOR_4 (1 << 13)
-# define R128_FLAT_SHADE_VERTEX_D3D (0 << 14)
-# define R128_FLAT_SHADE_VERTEX_OGL (1 << 14)
-# define R128_FPU_ROUND_TRUNCATE (0 << 15)
-# define R128_FPU_ROUND_NEAREST (1 << 15)
-# define R128_WM_SEL_8DW (0 << 16)
-# define R128_WM_SEL_16DW (1 << 16)
-# define R128_WM_SEL_32DW (2 << 16)
-#define R128_PM4_VC_DEBUG_CONFIG 0x07a4
-#define R128_PM4_VC_STAT 0x07a8
-#define R128_PM4_VC_TIMESTAMP0 0x07b0
-#define R128_PM4_VC_TIMESTAMP1 0x07b4
-#define R128_PM4_STAT 0x07b8
-# define R128_PM4_FIFOCNT_MASK 0x0fff
-# define R128_PM4_BUSY (1 << 16)
-# define R128_PM4_GUI_ACTIVE (1 << 31)
-#define R128_PM4_BUFFER_ADDR 0x07f0
-#define R128_PM4_MICRO_CNTL 0x07fc
-# define R128_PM4_MICRO_FREERUN (1 << 30)
-#define R128_PM4_FIFO_DATA_EVEN 0x1000
-#define R128_PM4_FIFO_DATA_ODD 0x1004
-
-#define R128_SCALE_3D_CNTL 0x1a00
-# define R128_SCALE_DITHER_ERR_DIFF (0 << 1)
-# define R128_SCALE_DITHER_TABLE (1 << 1)
-# define R128_TEX_CACHE_SIZE_FULL (0 << 2)
-# define R128_TEX_CACHE_SIZE_HALF (1 << 2)
-# define R128_DITHER_INIT_CURR (0 << 3)
-# define R128_DITHER_INIT_RESET (1 << 3)
-# define R128_ROUND_24BIT (1 << 4)
-# define R128_TEX_CACHE_DISABLE (1 << 5)
-# define R128_SCALE_3D_NOOP (0 << 6)
-# define R128_SCALE_3D_SCALE (1 << 6)
-# define R128_SCALE_3D_TEXMAP_SHADE (2 << 6)
-# define R128_SCALE_PIX_BLEND (0 << 8)
-# define R128_SCALE_PIX_REPLICATE (1 << 8)
-# define R128_TEX_CACHE_SPLIT (1 << 9)
-# define R128_APPLE_YUV_MODE (1 << 10)
-# define R128_TEX_CACHE_PALLETE_MODE (1 << 11)
-# define R128_ALPHA_COMB_ADD_CLAMP (0 << 12)
-# define R128_ALPHA_COMB_ADD_NCLAMP (1 << 12)
-# define R128_ALPHA_COMB_SUB_SRC_DST_CLAMP (2 << 12)
-# define R128_ALPHA_COMB_SUB_SRC_DST_NCLAMP (3 << 12)
-# define R128_ALPHA_COMB_FCN_MASK (3 << 12)
-# define R128_FOG_VERTEX (0 << 14)
-# define R128_FOG_TABLE (1 << 14)
-# define R128_SIGNED_DST_CLAMP (1 << 15)
-
-# define R128_ALPHA_BLEND_ZERO (0 )
-# define R128_ALPHA_BLEND_ONE (1 )
-# define R128_ALPHA_BLEND_SRCCOLOR (2 )
-# define R128_ALPHA_BLEND_INVSRCCOLOR (3 )
-# define R128_ALPHA_BLEND_SRCALPHA (4 )
-# define R128_ALPHA_BLEND_INVSRCALPHA (5 )
-# define R128_ALPHA_BLEND_DSTALPHA (6 )
-# define R128_ALPHA_BLEND_INVDSTALPHA (7 )
-# define R128_ALPHA_BLEND_DSTCOLOR (8 )
-# define R128_ALPHA_BLEND_INVDSTCOLOR (9 )
-# define R128_ALPHA_BLEND_SAT (10) /* aka SRCALPHASAT */
-# define R128_ALPHA_BLEND_BLEND (11) /* aka BOTHSRCALPHA */
-# define R128_ALPHA_BLEND_INVBLEND (12) /* aka BOTHINVSRCALPHA */
-# define R128_ALPHA_BLEND_MASK (15)
-
-# define R128_ALPHA_BLEND_SRC_SHIFT (16)
-# define R128_ALPHA_BLEND_DST_SHIFT (20)
-
-# define R128_ALPHA_TEST_NEVER (0 << 24)
-# define R128_ALPHA_TEST_LESS (1 << 24)
-# define R128_ALPHA_TEST_LESSEQUAL (2 << 24)
-# define R128_ALPHA_TEST_EQUAL (3 << 24)
-# define R128_ALPHA_TEST_GREATEREQUAL (4 << 24)
-# define R128_ALPHA_TEST_GREATER (5 << 24)
-# define R128_ALPHA_TEST_NEQUAL (6 << 24)
-# define R128_ALPHA_TEST_ALWAYS (7 << 24)
-# define R128_ALPHA_TEST_MASK (7 << 24)
-# define R128_COMPOSITE_SHADOW_CMP_EQUAL (0 << 28)
-# define R128_COMPOSITE_SHADOW_CMP_NEQUAL (1 << 28)
-# define R128_COMPOSITE_SHADOW (1 << 29)
-# define R128_TEX_MAP_ALPHA_IN_TEXTURE (1 << 30)
-# define R128_TEX_CACHE_LINE_SIZE_8QW (0 << 31)
-# define R128_TEX_CACHE_LINE_SIZE_4QW (1 << 31)
-#define R128_SCALE_3D_DATATYPE 0x1a20
-
-#define R128_SETUP_CNTL 0x1bc4
-# define R128_DONT_START_TRIANGLE (1 << 0)
-# define R128_Z_BIAS (0 << 1)
-# define R128_DONT_START_ANY_ON (1 << 2)
-# define R128_COLOR_SOLID_COLOR (0 << 3)
-# define R128_COLOR_FLAT_VERT_1 (1 << 3)
-# define R128_COLOR_FLAT_VERT_2 (2 << 3)
-# define R128_COLOR_FLAT_VERT_3 (3 << 3)
-# define R128_COLOR_GOURAUD (4 << 3)
-# define R128_PRIM_TYPE_TRI (0 << 7)
-# define R128_PRIM_TYPE_LINE (1 << 7)
-# define R128_PRIM_TYPE_POINT (2 << 7)
-# define R128_PRIM_TYPE_POLY_EDGE (3 << 7)
-# define R128_TEXTURE_ST_MULT_W (0 << 9)
-# define R128_TEXTURE_ST_DIRECT (1 << 9)
-# define R128_STARTING_VERTEX_1 (1 << 14)
-# define R128_STARTING_VERTEX_2 (2 << 14)
-# define R128_STARTING_VERTEX_3 (3 << 14)
-# define R128_ENDING_VERTEX_1 (1 << 16)
-# define R128_ENDING_VERTEX_2 (2 << 16)
-# define R128_ENDING_VERTEX_3 (3 << 16)
-# define R128_SU_POLY_LINE_LAST (0 << 18)
-# define R128_SU_POLY_LINE_NOT_LAST (1 << 18)
-# define R128_SUB_PIX_2BITS (0 << 19)
-# define R128_SUB_PIX_4BITS (1 << 19)
-# define R128_SET_UP_CONTINUE (1 << 31)
-
-#define R128_WINDOW_XY_OFFSET 0x1bcc
-# define R128_WINDOW_Y_SHIFT 4
-# define R128_WINDOW_X_SHIFT 20
-
-#define R128_Z_OFFSET_C 0x1c90
-#define R128_Z_PITCH_C 0x1c94
-# define R128_Z_TILE (1 << 16)
-#define R128_Z_STEN_CNTL_C 0x1c98
-# define R128_Z_PIX_WIDTH_16 (0 << 1)
-# define R128_Z_PIX_WIDTH_24 (1 << 1)
-# define R128_Z_PIX_WIDTH_32 (2 << 1)
-# define R128_Z_PIX_WIDTH_MASK (3 << 1)
-# define R128_Z_TEST_NEVER (0 << 4)
-# define R128_Z_TEST_LESS (1 << 4)
-# define R128_Z_TEST_LESSEQUAL (2 << 4)
-# define R128_Z_TEST_EQUAL (3 << 4)
-# define R128_Z_TEST_GREATEREQUAL (4 << 4)
-# define R128_Z_TEST_GREATER (5 << 4)
-# define R128_Z_TEST_NEQUAL (6 << 4)
-# define R128_Z_TEST_ALWAYS (7 << 4)
-# define R128_Z_TEST_MASK (7 << 4)
-# define R128_STENCIL_TEST_NEVER (0 << 12)
-# define R128_STENCIL_TEST_LESS (1 << 12)
-# define R128_STENCIL_TEST_LESSEQUAL (2 << 12)
-# define R128_STENCIL_TEST_EQUAL (3 << 12)
-# define R128_STENCIL_TEST_GREATEREQUAL (4 << 12)
-# define R128_STENCIL_TEST_GREATER (5 << 12)
-# define R128_STENCIL_TEST_NEQUAL (6 << 12)
-# define R128_STENCIL_TEST_ALWAYS (7 << 12)
-# define R128_STENCIL_S_FAIL_KEEP (0 << 16)
-# define R128_STENCIL_S_FAIL_ZERO (1 << 16)
-# define R128_STENCIL_S_FAIL_REPLACE (2 << 16)
-# define R128_STENCIL_S_FAIL_INC (3 << 16)
-# define R128_STENCIL_S_FAIL_DEC (4 << 16)
-# define R128_STENCIL_S_FAIL_INV (5 << 16)
-# define R128_STENCIL_ZPASS_KEEP (0 << 20)
-# define R128_STENCIL_ZPASS_ZERO (1 << 20)
-# define R128_STENCIL_ZPASS_REPLACE (2 << 20)
-# define R128_STENCIL_ZPASS_INC (3 << 20)
-# define R128_STENCIL_ZPASS_DEC (4 << 20)
-# define R128_STENCIL_ZPASS_INV (5 << 20)
-# define R128_STENCIL_ZFAIL_KEEP (0 << 24)
-# define R128_STENCIL_ZFAIL_ZERO (1 << 24)
-# define R128_STENCIL_ZFAIL_REPLACE (2 << 24)
-# define R128_STENCIL_ZFAIL_INC (3 << 24)
-# define R128_STENCIL_ZFAIL_DEC (4 << 24)
-# define R128_STENCIL_ZFAIL_INV (5 << 24)
-#define R128_TEX_CNTL_C 0x1c9c
-# define R128_Z_ENABLE (1 << 0)
-# define R128_Z_WRITE_ENABLE (1 << 1)
-# define R128_STENCIL_ENABLE (1 << 3)
-# define R128_SHADE_ENABLE (0 << 4)
-# define R128_TEXMAP_ENABLE (1 << 4)
-# define R128_SEC_TEXMAP_ENABLE (1 << 5)
-# define R128_FOG_ENABLE (1 << 7)
-# define R128_DITHER_ENABLE (1 << 8)
-# define R128_ALPHA_ENABLE (1 << 9)
-# define R128_ALPHA_TEST_ENABLE (1 << 10)
-# define R128_SPEC_LIGHT_ENABLE (1 << 11)
-# define R128_TEX_CHROMA_KEY_ENABLE (1 << 12)
-# define R128_ALPHA_IN_TEX_COMPLETE_A (0 << 13)
-# define R128_ALPHA_IN_TEX_LSB_A (1 << 13)
-# define R128_LIGHT_DIS (0 << 14)
-# define R128_LIGHT_COPY (1 << 14)
-# define R128_LIGHT_MODULATE (2 << 14)
-# define R128_LIGHT_ADD (3 << 14)
-# define R128_LIGHT_BLEND_CONSTANT (4 << 14)
-# define R128_LIGHT_BLEND_TEXTURE (5 << 14)
-# define R128_LIGHT_BLEND_VERTEX (6 << 14)
-# define R128_LIGHT_BLEND_CONST_COLOR (7 << 14)
-# define R128_ALPHA_LIGHT_DIS (0 << 18)
-# define R128_ALPHA_LIGHT_COPY (1 << 18)
-# define R128_ALPHA_LIGHT_MODULATE (2 << 18)
-# define R128_ALPHA_LIGHT_ADD (3 << 18)
-# define R128_ANTI_ALIAS (1 << 21)
-# define R128_TEX_CACHE_FLUSH (1 << 23)
-# define R128_LOD_BIAS_SHIFT 24
-# define R128_LOD_BIAS_MASK (0xff << 24)
-#define R128_MISC_3D_STATE_CNTL_REG 0x1ca0
-# define R128_REF_ALPHA_MASK 0xff
-# define R128_MISC_SCALE_3D_NOOP (0 << 8)
-# define R128_MISC_SCALE_3D_SCALE (1 << 8)
-# define R128_MISC_SCALE_3D_TEXMAP_SHADE (2 << 8)
-# define R128_MISC_SCALE_PIX_BLEND (0 << 10)
-# define R128_MISC_SCALE_PIX_REPLICATE (1 << 10)
-/* Bits [14:12] are the same as R128_SCALE_3D_CNTL */
-/* Bit [15] is unknown */
-/* Bits [26:16] are the same as R128_SCALE_3D_CNTL */
-/* Bits [31:27] are unknown */
-
-#define R128_TEXTURE_CLR_CMP_CLR_C 0x1ca4
-#define R128_TEXTURE_CLR_CMP_MSK_C 0x1ca8
-#define R128_FOG_COLOR_C 0x1cac
-# define R128_FOG_BLUE_SHIFT 0
-# define R128_FOG_GREEN_SHIFT 8
-# define R128_FOG_RED_SHIFT 16
-#define R128_PRIM_TEX_CNTL_C 0x1cb0
-# define R128_MIN_BLEND_NEAREST (0 << 1)
-# define R128_MIN_BLEND_LINEAR (1 << 1)
-# define R128_MIN_BLEND_MIPNEAREST (2 << 1)
-# define R128_MIN_BLEND_MIPLINEAR (3 << 1)
-# define R128_MIN_BLEND_LINEARMIPNEAREST (4 << 1)
-# define R128_MIN_BLEND_LINEARMIPLINEAR (5 << 1)
-# define R128_MIN_BLEND_MASK (7 << 1)
-# define R128_MAG_BLEND_NEAREST (0 << 4)
-# define R128_MAG_BLEND_LINEAR (1 << 4)
-# define R128_MAG_BLEND_MASK (7 << 4)
-# define R128_MIP_MAP_DISABLE (1 << 7)
-# define R128_TEX_CLAMP_S_WRAP (0 << 8)
-# define R128_TEX_CLAMP_S_MIRROR (1 << 8)
-# define R128_TEX_CLAMP_S_CLAMP (2 << 8)
-# define R128_TEX_CLAMP_S_BORDER_COLOR (3 << 8)
-# define R128_TEX_CLAMP_S_MASK (3 << 8)
-# define R128_TEX_WRAP_S (1 << 10)
-# define R128_TEX_CLAMP_T_WRAP (0 << 11)
-# define R128_TEX_CLAMP_T_MIRROR (1 << 11)
-# define R128_TEX_CLAMP_T_CLAMP (2 << 11)
-# define R128_TEX_CLAMP_T_BORDER_COLOR (3 << 11)
-# define R128_TEX_CLAMP_T_MASK (3 << 11)
-# define R128_TEX_WRAP_T (1 << 13)
-# define R128_TEX_PERSPECTIVE_DISABLE (1 << 14)
-# define R128_DATATYPE_VQ (0 << 16)
-# define R128_DATATYPE_CI4 (1 << 16)
-# define R128_DATATYPE_CI8 (2 << 16)
-# define R128_DATATYPE_ARGB1555 (3 << 16)
-# define R128_DATATYPE_RGB565 (4 << 16)
-# define R128_DATATYPE_RGB888 (5 << 16)
-# define R128_DATATYPE_ARGB8888 (6 << 16)
-# define R128_DATATYPE_RGB332 (7 << 16)
-# define R128_DATATYPE_Y8 (8 << 16)
-# define R128_DATATYPE_RGB8 (9 << 16)
-# define R128_DATATYPE_CI16 (10 << 16)
-# define R128_DATATYPE_YVYU422 (11 << 16)
-# define R128_DATATYPE_VYUY422 (12 << 16)
-# define R128_DATATYPE_AYUV444 (14 << 16)
-# define R128_DATATYPE_ARGB4444 (15 << 16)
-# define R128_PALLETE_EITHER (0 << 20)
-# define R128_PALLETE_1 (1 << 20)
-# define R128_PALLETE_2 (2 << 20)
-# define R128_PSEUDOCOLOR_DT_RGB565 (0 << 24)
-# define R128_PSEUDOCOLOR_DT_ARGB1555 (1 << 24)
-# define R128_PSEUDOCOLOR_DT_ARGB4444 (2 << 24)
-#define R128_PRIM_TEXTURE_COMBINE_CNTL_C 0x1cb4
-# define R128_COMB_DIS (0 << 0)
-# define R128_COMB_COPY (1 << 0)
-# define R128_COMB_COPY_INP (2 << 0)
-# define R128_COMB_MODULATE (3 << 0)
-# define R128_COMB_MODULATE2X (4 << 0)
-# define R128_COMB_MODULATE4X (5 << 0)
-# define R128_COMB_ADD (6 << 0)
-# define R128_COMB_ADD_SIGNED (7 << 0)
-# define R128_COMB_BLEND_VERTEX (8 << 0)
-# define R128_COMB_BLEND_TEXTURE (9 << 0)
-# define R128_COMB_BLEND_CONST (10 << 0)
-# define R128_COMB_BLEND_PREMULT (11 << 0)
-# define R128_COMB_BLEND_PREV (12 << 0)
-# define R128_COMB_BLEND_PREMULT_INV (13 << 0)
-# define R128_COMB_ADD_SIGNED2X (14 << 0)
-# define R128_COMB_BLEND_CONST_COLOR (15 << 0)
-# define R128_COMB_MASK (15 << 0)
-# define R128_COLOR_FACTOR_CONST_COLOR (0 << 4)
-# define R128_COLOR_FACTOR_NCONST_COLOR (1 << 4)
-# define R128_COLOR_FACTOR_TEX (4 << 4)
-# define R128_COLOR_FACTOR_NTEX (5 << 4)
-# define R128_COLOR_FACTOR_ALPHA (6 << 4)
-# define R128_COLOR_FACTOR_NALPHA (7 << 4)
-# define R128_COLOR_FACTOR_PREV_COLOR (8 << 4)
-# define R128_COLOR_FACTOR_MASK (15 << 4)
-# define R128_COMB_FCN_MSB (1 << 8)
-# define R128_INPUT_FACTOR_CONST_COLOR (2 << 10)
-# define R128_INPUT_FACTOR_CONST_ALPHA (3 << 10)
-# define R128_INPUT_FACTOR_INT_COLOR (4 << 10)
-# define R128_INPUT_FACTOR_INT_ALPHA (5 << 10)
-# define R128_INPUT_FACTOR_MASK (15 << 10)
-# define R128_COMB_ALPHA_DIS (0 << 14)
-# define R128_COMB_ALPHA_COPY (1 << 14)
-# define R128_COMB_ALPHA_COPY_INP (2 << 14)
-# define R128_COMB_ALPHA_MODULATE (3 << 14)
-# define R128_COMB_ALPHA_MODULATE2X (4 << 14)
-# define R128_COMB_ALPHA_MODULATE4X (5 << 14)
-# define R128_COMB_ALPHA_ADD (6 << 14)
-# define R128_COMB_ALPHA_ADD_SIGNED (7 << 14)
-# define R128_COMB_ALPHA_ADD_SIGNED2X (14 << 14)
-# define R128_COMB_ALPHA_MASK (15 << 14)
-# define R128_ALPHA_FACTOR_TEX_ALPHA (6 << 18)
-# define R128_ALPHA_FACTOR_NTEX_ALPHA (7 << 18)
-# define R128_ALPHA_FACTOR_MASK (15 << 18)
-# define R128_INP_FACTOR_A_CONST_ALPHA (1 << 25)
-# define R128_INP_FACTOR_A_INT_ALPHA (2 << 25)
-# define R128_INP_FACTOR_A_MASK (7 << 25)
-#define R128_TEX_SIZE_PITCH_C 0x1cb8
-# define R128_TEX_PITCH_SHIFT 0
-# define R128_TEX_SIZE_SHIFT 4
-# define R128_TEX_HEIGHT_SHIFT 8
-# define R128_TEX_MIN_SIZE_SHIFT 12
-# define R128_SEC_TEX_PITCH_SHIFT 16
-# define R128_SEC_TEX_SIZE_SHIFT 20
-# define R128_SEC_TEX_HEIGHT_SHIFT 24
-# define R128_SEC_TEX_MIN_SIZE_SHIFT 28
-# define R128_TEX_PITCH_MASK (0x0f << 0)
-# define R128_TEX_SIZE_MASK (0x0f << 4)
-# define R128_TEX_HEIGHT_MASK (0x0f << 8)
-# define R128_TEX_MIN_SIZE_MASK (0x0f << 12)
-# define R128_SEC_TEX_PITCH_MASK (0x0f << 16)
-# define R128_SEC_TEX_SIZE_MASK (0x0f << 20)
-# define R128_SEC_TEX_HEIGHT_MASK (0x0f << 24)
-# define R128_SEC_TEX_MIN_SIZE_MASK (0x0f << 28)
-# define R128_TEX_SIZE_PITCH_SHIFT 0
-# define R128_SEC_TEX_SIZE_PITCH_SHIFT 16
-# define R128_TEX_SIZE_PITCH_MASK (0xffff << 0)
-# define R128_SEC_TEX_SIZE_PITCH_MASK (0xffff << 16)
-#define R128_PRIM_TEX_0_OFFSET_C 0x1cbc
-#define R128_PRIM_TEX_1_OFFSET_C 0x1cc0
-#define R128_PRIM_TEX_2_OFFSET_C 0x1cc4
-#define R128_PRIM_TEX_3_OFFSET_C 0x1cc8
-#define R128_PRIM_TEX_4_OFFSET_C 0x1ccc
-#define R128_PRIM_TEX_5_OFFSET_C 0x1cd0
-#define R128_PRIM_TEX_6_OFFSET_C 0x1cd4
-#define R128_PRIM_TEX_7_OFFSET_C 0x1cd8
-#define R128_PRIM_TEX_8_OFFSET_C 0x1cdc
-#define R128_PRIM_TEX_9_OFFSET_C 0x1ce0
-#define R128_PRIM_TEX_10_OFFSET_C 0x1ce4
-# define R128_TEX_NO_TILE (0 << 30)
-# define R128_TEX_TILED_BY_HOST (1 << 30)
-# define R128_TEX_TILED_BY_STORAGE (2 << 30)
-# define R128_TEX_TILED_BY_STORAGE2 (3 << 30)
-
-#define R128_SEC_TEX_CNTL_C 0x1d00
-# define R128_SEC_SELECT_PRIM_ST (0 << 0)
-# define R128_SEC_SELECT_SEC_ST (1 << 0)
-#define R128_SEC_TEX_COMBINE_CNTL_C 0x1d04
-# define R128_INPUT_FACTOR_PREV_COLOR (8 << 10)
-# define R128_INPUT_FACTOR_PREV_ALPHA (9 << 10)
-# define R128_INP_FACTOR_A_PREV_ALPHA (4 << 25)
-#define R128_SEC_TEX_0_OFFSET_C 0x1d08
-#define R128_SEC_TEX_1_OFFSET_C 0x1d0c
-#define R128_SEC_TEX_2_OFFSET_C 0x1d10
-#define R128_SEC_TEX_3_OFFSET_C 0x1d14
-#define R128_SEC_TEX_4_OFFSET_C 0x1d18
-#define R128_SEC_TEX_5_OFFSET_C 0x1d1c
-#define R128_SEC_TEX_6_OFFSET_C 0x1d20
-#define R128_SEC_TEX_7_OFFSET_C 0x1d24
-#define R128_SEC_TEX_8_OFFSET_C 0x1d28
-#define R128_SEC_TEX_9_OFFSET_C 0x1d2c
-#define R128_SEC_TEX_10_OFFSET_C 0x1d30
-#define R128_CONSTANT_COLOR_C 0x1d34
-# define R128_CONSTANT_BLUE_SHIFT 0
-# define R128_CONSTANT_GREEN_SHIFT 8
-# define R128_CONSTANT_RED_SHIFT 16
-# define R128_CONSTANT_ALPHA_SHIFT 24
-#define R128_PRIM_TEXTURE_BORDER_COLOR_C 0x1d38
-# define R128_PRIM_TEX_BORDER_BLUE_SHIFT 0
-# define R128_PRIM_TEX_BORDER_GREEN_SHIFT 8
-# define R128_PRIM_TEX_BORDER_RED_SHIFT 16
-# define R128_PRIM_TEX_BORDER_ALPHA_SHIFT 24
-#define R128_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c
-# define R128_SEC_TEX_BORDER_BLUE_SHIFT 0
-# define R128_SEC_TEX_BORDER_GREEN_SHIFT 8
-# define R128_SEC_TEX_BORDER_RED_SHIFT 16
-# define R128_SEC_TEX_BORDER_ALPHA_SHIFT 24
-#define R128_STEN_REF_MASK_C 0x1d40
-# define R128_STEN_REFERENCE_SHIFT 0
-# define R128_STEN_MASK_SHIFT 16
-# define R128_STEN_WRITE_MASK_SHIFT 24
-#define R128_PLANE_3D_MASK_C 0x1d44
-#define R128_TEX_CACHE_STAT_COUNT 0x1974
-
-
- /* Constants */
-#define R128_AGP_TEX_OFFSET 0x02000000
-
-#define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0
-
- /* CCE packet types */
-#define R128_CCE_PACKET0 0x00000000
-#define R128_CCE_PACKET0_ONE_REG_WR 0x00008000
-#define R128_CCE_PACKET1 0x40000000
-#define R128_CCE_PACKET2 0x80000000
-#define R128_CCE_PACKET3 0xC0000000
-#define R128_CCE_PACKET3_NOP 0xC0001000
-#define R128_CCE_PACKET3_PAINT 0xC0001100
-#define R128_CCE_PACKET3_BITBLT 0xC0001200
-#define R128_CCE_PACKET3_SMALLTEXT 0xC0001300
-#define R128_CCE_PACKET3_HOSTDATA_BLT 0xC0001400
-#define R128_CCE_PACKET3_POLYLINE 0xC0001500
-#define R128_CCE_PACKET3_SCALING 0xC0001600
-#define R128_CCE_PACKET3_TRANS_SCALING 0xC0001700
-#define R128_CCE_PACKET3_POLYSCANLINES 0xC0001800
-#define R128_CCE_PACKET3_NEXT_CHAR 0xC0001900
-#define R128_CCE_PACKET3_PAINT_MULTI 0xC0001A00
-#define R128_CCE_PACKET3_BITBLT_MULTI 0xC0001B00
-#define R128_CCE_PACKET3_PLY_NEXTSCAN 0xC0001D00
-#define R128_CCE_PACKET3_SET_SCISSORS 0xC0001E00
-#define R128_CCE_PACKET3_SET_MODE24BPP 0xC0001F00
-#define R128_CCE_PACKET3_CNTL_PAINT 0xC0009100
-#define R128_CCE_PACKET3_CNTL_BITBLT 0xC0009200
-#define R128_CCE_PACKET3_CNTL_SMALLTEXT 0xC0009300
-#define R128_CCE_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400
-#define R128_CCE_PACKET3_CNTL_POLYLINE 0xC0009500
-#define R128_CCE_PACKET3_CNTL_SCALING 0xC0009600
-#define R128_CCE_PACKET3_CNTL_TRANS_SCALING 0xC0009700
-#define R128_CCE_PACKET3_CNTL_POLYSCANLINES 0xC0009800
-#define R128_CCE_PACKET3_CNTL_NEXT_CHAR 0xC0009900
-#define R128_CCE_PACKET3_CNTL_PAINT_MULTI 0xC0009A00
-#define R128_CCE_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00
-#define R128_CCE_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00
-#define R128_CCE_PACKET3_3D_SAVE_CONTEXT 0xC0002000
-#define R128_CCE_PACKET3_3D_PLAY_CONTEXT 0xC0002100
-#define R128_CCE_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300
-#define R128_CCE_PACKET3_3D_RNDR_GEN_PRIM 0xC0002500
-#define R128_CCE_PACKET3_LOAD_PALETTE 0xC0002C00
-#define R128_CCE_PACKET3_PURGE 0xC0002D00
-#define R128_CCE_PACKET3_NEXT_VERTEX_BUNDLE 0xC0002E00
-# define R128_CCE_PACKET_MASK 0xC0000000
-# define R128_CCE_PACKET_COUNT_MASK 0x3fff0000
-# define R128_CCE_PACKET_MAX_DWORDS (1 << 12)
-# define R128_CCE_PACKET0_REG_MASK 0x000007ff
-# define R128_CCE_PACKET1_REG0_MASK 0x000007ff
-# define R128_CCE_PACKET1_REG1_MASK 0x003ff800
-
-#define R128_CCE_VC_FRMT_RHW 0x00000001
-#define R128_CCE_VC_FRMT_DIFFUSE_BGR 0x00000002
-#define R128_CCE_VC_FRMT_DIFFUSE_A 0x00000004
-#define R128_CCE_VC_FRMT_DIFFUSE_ARGB 0x00000008
-#define R128_CCE_VC_FRMT_SPEC_BGR 0x00000010
-#define R128_CCE_VC_FRMT_SPEC_F 0x00000020
-#define R128_CCE_VC_FRMT_SPEC_FRGB 0x00000040
-#define R128_CCE_VC_FRMT_S_T 0x00000080
-#define R128_CCE_VC_FRMT_S2_T2 0x00000100
-#define R128_CCE_VC_FRMT_RHW2 0x00000200
-
-#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000
-#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001
-#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002
-#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003
-#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004
-#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005
-#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006
-#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007
-#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010
-#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020
-#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030
-#define R128_CCE_VC_CNTL_NUM_SHIFT 16
-
-/* hmm copyed blindly (no specs) from radeon.h ... */
-#define R128_RE_TOP_LEFT 0x26c0
-# define R128_RE_LEFT_SHIFT 0
-# define R128_RE_TOP_SHIFT 16
-#define R128_RE_WIDTH_HEIGHT 0x1c44
-# define R128_RE_WIDTH_SHIFT 0
-# define R128_RE_HEIGHT_SHIFT 16
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_version.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_version.h
deleted file mode 100644
index 589d8d40b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r128/server/r128_version.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h,v 1.6 2003/01/01 19:16:35 tsi Exp $ */
-/*
- * Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
- *
- * 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 Marc Aurele La France not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Marc Aurele La France makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as-is" without express or implied warranty.
- *
- * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
- * EVENT SHALL MARC AURELE LA FRANCE 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.
- */
-
-#ifndef _R128_VERSION_H_
-#define _R128_VERSION_H_ 1
-
-#undef R128_NAME
-#undef R128_DRIVER_NAME
-#undef R128_VERSION_MAJOR
-#undef R128_VERSION_MINOR
-#undef R128_VERSION_PATCH
-#undef R128_VERSION_CURRENT
-#undef R128_VERSION_EVALUATE
-#undef R128_VERSION_STRINGIFY
-#undef R128_VERSION_NAME
-
-#define R128_NAME "R128"
-#define R128_DRIVER_NAME "r128"
-
-#define R128_VERSION_MAJOR 4
-#define R128_VERSION_MINOR 0
-#define R128_VERSION_PATCH 1
-
-#ifndef R128_VERSION_EXTRA
-#define R128_VERSION_EXTRA ""
-#endif
-
-#define R128_VERSION_CURRENT \
- ((R128_VERSION_MAJOR << 20) | \
- (R128_VERSION_MINOR << 10) | \
- (R128_VERSION_PATCH))
-
-#define R128_VERSION_EVALUATE(__x) #__x
-#define R128_VERSION_STRINGIFY(_x) R128_VERSION_EVALUATE(_x)
-#define R128_VERSION_NAME \
- R128_VERSION_STRINGIFY(R128_VERSION_MAJOR) "." \
- R128_VERSION_STRINGIFY(R128_VERSION_MINOR) "." \
- R128_VERSION_STRINGIFY(R128_VERSION_MINOR) R128_VERSION_EXTRA
-
-#endif /* _R128_VERSION_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Doxyfile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Doxyfile
deleted file mode 100644
index 27b3d0371..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Doxyfile
+++ /dev/null
@@ -1,232 +0,0 @@
-# Doxyfile 1.3.2-Gideon
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = r200
-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/r200
-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/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Makefile
deleted file mode 100644
index e4fff5746..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-# src/mesa/drivers/dri/r200/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = r200_dri.so
-
-MINIGLX_SOURCES = server/radeon_dri.c
-
-ifeq ($(USING_EGL), 1)
-EGL_SOURCES = server/radeon_egl.c
-endif
-
-DRIVER_SOURCES = r200_context.c \
- r200_ioctl.c \
- r200_lock.c \
- r200_screen.c \
- r200_state.c \
- r200_state_init.c \
- r200_cmdbuf.c \
- r200_pixel.c \
- r200_tex.c \
- r200_texmem.c \
- r200_texstate.c \
- r200_tcl.c \
- r200_swtcl.c \
- r200_span.c \
- r200_maos.c \
- r200_sanity.c \
- r200_vtxfmt.c \
- r200_vtxfmt_c.c \
- r200_vtxfmt_sse.c \
- r200_vtxfmt_x86.c \
- $(EGL_SOURCES)
-
-C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
-
-X86_SOURCES = r200_vtxtmp_x86.S
-
-SYMLINKS = \
- server/radeon_egl.c \
- server/radeon_dri.c \
- server/radeon_dri.h \
- server/radeon.h \
- server/radeon_macros.h \
- server/radeon_reg.h
-
-##### TARGETS #####
-
-
-include ../Makefile.template
-
-#INCLUDES += -I../radeon/server
-
-server:
- mkdir -p server
-
-$(SYMLINKS): server
- @[ -e $@ ] || ln -sf ../../radeon/$@ server/
-
-symlinks: $(SYMLINKS)
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_cmdbuf.c
deleted file mode 100644
index 2891054b0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_cmdbuf.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c,v 1.1 2002/10/30 12:51:51 alanh Exp $ */
-/*
-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.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-#include "simple_list.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tcl.h"
-#include "r200_sanity.h"
-#include "radeon_reg.h"
-
-static void print_state_atom( struct r200_state_atom *state )
-{
- int i;
-
- fprintf(stderr, "emit %s/%d\n", state->name, state->cmd_size);
-
- if (0 & R200_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < state->cmd_size ; i++)
- fprintf(stderr, "\t%s[%d]: %x\n", state->name, i, state->cmd[i]);
-
-}
-
-/* The state atoms will be emitted in the order they appear in the atom list,
- * so this step is important.
- */
-void r200SetUpAtomList( r200ContextPtr rmesa )
-{
- int i, mtu;
-
- mtu = rmesa->glCtx->Const.MaxTextureUnits;
-
- make_empty_list(&rmesa->hw.atomlist);
- rmesa->hw.atomlist.name = "atom-list";
-
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.ctx );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.set );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.lin );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.msk );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.vpt );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.vtx );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.vap );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.vte );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.msc );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.cst );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.zbs );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.tcl );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.msl );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.tcg );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.grd );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.fog );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.tam );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.tf );
- for (i = 0; i < mtu; ++i)
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.tex[i] );
- for (i = 0; i < mtu; ++i)
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.cube[i] );
- for (i = 0; i < 6; ++i)
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.pix[i] );
-
- for (i = 0; i < 8; ++i)
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.lit[i] );
- for (i = 0; i < 3 + mtu; ++i)
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.mat[i] );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.eye );
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.glt );
- for (i = 0; i < 2; ++i)
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.mtl[i] );
- for (i = 0; i < 6; ++i)
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.ucp[i] );
- /* FIXME: is this a good place to insert that atom ? */
- insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.prf );
-}
-
-static void r200SaveHwState( r200ContextPtr rmesa )
-{
- struct r200_state_atom *atom;
- char * dest = rmesa->backup_store.cmd_buf;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- rmesa->backup_store.cmd_used = 0;
-
- foreach( atom, &rmesa->hw.atomlist ) {
- if ( atom->check( rmesa->glCtx, atom->idx ) ) {
- int size = atom->cmd_size * 4;
- memcpy( dest, atom->cmd, size);
- dest += size;
- rmesa->backup_store.cmd_used += size;
- if (R200_DEBUG & DEBUG_STATE)
- print_state_atom( atom );
- }
- }
-
- assert( rmesa->backup_store.cmd_used <= R200_CMD_BUF_SZ );
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "Returning to r200EmitState\n");
-}
-
-void r200EmitState( r200ContextPtr rmesa )
-{
- char *dest;
- int mtu;
- struct r200_state_atom *atom;
-
- if (R200_DEBUG & (DEBUG_STATE|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->save_on_next_emit) {
- r200SaveHwState(rmesa);
- rmesa->save_on_next_emit = GL_FALSE;
- }
-
- if (!rmesa->hw.is_dirty && !rmesa->hw.all_dirty)
- return;
-
- mtu = rmesa->glCtx->Const.MaxTextureUnits;
-
- /* To avoid going across the entire set of states multiple times, just check
- * for enough space for the case of emitting all state, and inline the
- * r200AllocCmdBuf code here without all the checks.
- */
- r200EnsureCmdBufSpace( rmesa, rmesa->hw.max_state_size );
-
- /* we need to calculate dest after EnsureCmdBufSpace
- as we may flush the buffer - airlied */
- dest = rmesa->store.cmd_buf + rmesa->store.cmd_used;
- if (R200_DEBUG & DEBUG_STATE) {
- foreach( atom, &rmesa->hw.atomlist ) {
- if ( atom->dirty || rmesa->hw.all_dirty ) {
- if ( atom->check( rmesa->glCtx, atom->idx ) )
- print_state_atom( atom );
- else
- fprintf(stderr, "skip state %s\n", atom->name);
- }
- }
- }
-
- foreach( atom, &rmesa->hw.atomlist ) {
- if ( rmesa->hw.all_dirty )
- atom->dirty = GL_TRUE;
- if ( atom->dirty ) {
- if ( atom->check( rmesa->glCtx, atom->idx ) ) {
- int size = atom->cmd_size * 4;
- memcpy( dest, atom->cmd, size);
- dest += size;
- rmesa->store.cmd_used += size;
- atom->dirty = GL_FALSE;
- }
- }
- }
-
- assert( rmesa->store.cmd_used <= R200_CMD_BUF_SZ );
-
- rmesa->hw.is_dirty = GL_FALSE;
- rmesa->hw.all_dirty = GL_FALSE;
-}
-
-/* Fire a section of the retained (indexed_verts) buffer as a regular
- * primtive.
- */
-void r200EmitVbufPrim( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint vertex_nr )
-{
- drm_radeon_cmd_header_t *cmd;
-
- assert(!(primitive & R200_VF_PRIM_WALK_IND));
-
- r200EmitState( rmesa );
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_PRIMS))
- fprintf(stderr, "%s cmd_used/4: %d prim %x nr %d\n", __FUNCTION__,
- rmesa->store.cmd_used/4, primitive, vertex_nr);
-
- cmd = (drm_radeon_cmd_header_t *)r200AllocCmdBuf( rmesa, VBUF_BUFSZ,
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = R200_CP_CMD_3D_DRAW_VBUF_2;
- cmd[2].i = (primitive |
- R200_VF_PRIM_WALK_LIST |
- R200_VF_COLOR_ORDER_RGBA |
- (vertex_nr << R200_VF_VERTEX_NUMBER_SHIFT));
-}
-
-
-void r200FlushElts( r200ContextPtr rmesa )
-{
- int *cmd = (int *)(rmesa->store.cmd_buf + rmesa->store.elts_start);
- int dwords;
- int nr = (rmesa->store.cmd_used - (rmesa->store.elts_start + 12)) / 2;
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert( rmesa->dma.flush == r200FlushElts );
- rmesa->dma.flush = NULL;
-
- /* Cope with odd number of elts:
- */
- rmesa->store.cmd_used = (rmesa->store.cmd_used + 2) & ~2;
- dwords = (rmesa->store.cmd_used - rmesa->store.elts_start) / 4;
-
- cmd[1] |= (dwords - 3) << 16;
- cmd[2] |= nr << R200_VF_VERTEX_NUMBER_SHIFT;
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
- r200Finish( rmesa->glCtx );
- }
-}
-
-
-GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint min_nr )
-{
- drm_radeon_cmd_header_t *cmd;
- GLushort *retval;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d prim %x\n", __FUNCTION__, min_nr, primitive);
-
- assert((primitive & R200_VF_PRIM_WALK_IND));
-
- r200EmitState( rmesa );
-
- cmd = (drm_radeon_cmd_header_t *)r200AllocCmdBuf( rmesa, ELTS_BUFSZ(min_nr),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = R200_CP_CMD_3D_DRAW_INDX_2;
- cmd[2].i = (primitive |
- R200_VF_PRIM_WALK_IND |
- R200_VF_COLOR_ORDER_RGBA);
-
-
- retval = (GLushort *)(cmd+3);
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x prim %x \n",
- __FUNCTION__,
- cmd[1].i, primitive);
-
- assert(!rmesa->dma.flush);
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = r200FlushElts;
-
- rmesa->store.elts_start = ((char *)cmd) - rmesa->store.cmd_buf;
-
- return retval;
-}
-
-
-
-void r200EmitVertexAOS( r200ContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset )
-{
- drm_radeon_cmd_header_t *cmd;
-
- if (R200_DEBUG & (DEBUG_PRIMS|DEBUG_IOCTL))
- fprintf(stderr, "%s: vertex_size 0x%x offset 0x%x \n",
- __FUNCTION__, vertex_size, offset);
-
- cmd = (drm_radeon_cmd_header_t *)r200AllocCmdBuf( rmesa, VERT_AOS_BUFSZ,
- __FUNCTION__ );
-
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = R200_CP_CMD_3D_LOAD_VBPNTR | (2 << 16);
- cmd[2].i = 1;
- cmd[3].i = vertex_size | (vertex_size << 8);
- cmd[4].i = offset;
-}
-
-
-void r200EmitAOS( r200ContextPtr rmesa,
- struct r200_dma_region **component,
- GLuint nr,
- GLuint offset )
-{
- drm_radeon_cmd_header_t *cmd;
- int sz = AOS_BUFSZ(nr);
- int i;
- int *tmp;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s nr arrays: %d\n", __FUNCTION__, nr);
-
- cmd = (drm_radeon_cmd_header_t *)r200AllocCmdBuf( rmesa, sz, __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = R200_CP_CMD_3D_LOAD_VBPNTR | (((sz / sizeof(int)) - 3) << 16);
- cmd[2].i = nr;
- tmp = &cmd[0].i;
- cmd += 3;
-
- for (i = 0 ; i < nr ; i++) {
- if (i & 1) {
- cmd[0].i |= ((component[i]->aos_stride << 24) |
- (component[i]->aos_size << 16));
- cmd[2].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- cmd += 3;
- }
- else {
- cmd[0].i = ((component[i]->aos_stride << 8) |
- (component[i]->aos_size << 0));
- cmd[1].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- }
- }
-
- if (R200_DEBUG & DEBUG_VERTS) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- for (i = 0 ; i < sz ; i++)
- fprintf(stderr, " %d: %x\n", i, tmp[i]);
- }
-}
-
-void r200EmitBlit( r200ContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h )
-{
- drm_radeon_cmd_header_t *cmd;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s src %x/%x %d,%d dst: %x/%x %d,%d sz: %dx%d\n",
- __FUNCTION__,
- src_pitch, src_offset, srcx, srcy,
- dst_pitch, dst_offset, dstx, dsty,
- w, h);
-
- assert( (src_pitch & 63) == 0 );
- assert( (dst_pitch & 63) == 0 );
- assert( (src_offset & 1023) == 0 );
- assert( (dst_offset & 1023) == 0 );
- assert( w < (1<<16) );
- assert( h < (1<<16) );
-
- cmd = (drm_radeon_cmd_header_t *)r200AllocCmdBuf( rmesa, 8 * sizeof(int),
- __FUNCTION__ );
-
-
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = R200_CP_CMD_BITBLT_MULTI | (5 << 16);
- cmd[2].i = (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
- RADEON_GMC_DST_PITCH_OFFSET_CNTL |
- RADEON_GMC_BRUSH_NONE |
- (color_fmt << 8) |
- RADEON_GMC_SRC_DATATYPE_COLOR |
- RADEON_ROP3_S |
- RADEON_DP_SRC_SOURCE_MEMORY |
- RADEON_GMC_CLR_CMP_CNTL_DIS |
- RADEON_GMC_WR_MSK_DIS );
-
- cmd[3].i = ((src_pitch/64)<<22) | (src_offset >> 10);
- cmd[4].i = ((dst_pitch/64)<<22) | (dst_offset >> 10);
- cmd[5].i = (srcx << 16) | srcy;
- cmd[6].i = (dstx << 16) | dsty; /* dst */
- cmd[7].i = (w << 16) | h;
-}
-
-
-void r200EmitWait( r200ContextPtr rmesa, GLuint flags )
-{
- if (rmesa->dri.drmMinor >= 6) {
- drm_radeon_cmd_header_t *cmd;
-
- assert( !(flags & ~(RADEON_WAIT_2D|RADEON_WAIT_3D)) );
-
- cmd = (drm_radeon_cmd_header_t *)r200AllocCmdBuf( rmesa, 1 * sizeof(int),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].wait.cmd_type = RADEON_CMD_WAIT;
- cmd[0].wait.flags = flags;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c
deleted file mode 100644
index 04dbc180c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.c,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "state.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_span.h"
-#include "r200_pixel.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_tcl.h"
-#include "r200_vtxfmt.h"
-#include "r200_maos.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_secondary_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-#define DRIVER_DATE "20041207"
-
-#include "vblank.h"
-#include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-#ifndef R200_DEBUG
-int R200_DEBUG = (0);
-#endif
-
-
-/* Return the width and height of the given buffer.
- */
-static void r200GetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- LOCK_HARDWARE( rmesa );
- *width = rmesa->dri.drawable->w;
- *height = rmesa->dri.drawable->h;
- UNLOCK_HARDWARE( rmesa );
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *r200GetString( GLcontext *ctx, GLenum name )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- GLuint agp_mode = rmesa->r200Screen->IsPCI ? 0 :
- rmesa->r200Screen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Tungsten Graphics, Inc.";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer, "R200", DRIVER_DATE,
- agp_mode );
-
- sprintf( & buffer[ offset ], " %sTCL",
- !(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)
- ? "" : "NO-" );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-
-/* Extension strings exported by the R200 driver.
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_texture_border_clamp", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_env_combine", NULL },
- { "GL_ARB_texture_env_dot3", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
- { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
- { "GL_EXT_blend_subtract", NULL },
- { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_EXT_texture_env_combine", NULL },
- { "GL_EXT_texture_env_dot3", NULL },
- { "GL_EXT_texture_filter_anisotropic", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_EXT_texture_mirror_clamp", NULL },
- { "GL_EXT_texture_rectangle", NULL },
- { "GL_ATI_texture_env_combine3", NULL },
- { "GL_ATI_texture_mirror_once", NULL },
- { "GL_MESA_pack_invert", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-const struct dri_extension blend_extensions[] = {
- { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
- { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
- { NULL, NULL }
-};
-
-const struct dri_extension ARB_vp_extension[] = {
- { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }
-};
-
-const struct dri_extension NV_vp_extension[] = {
- { "GL_NV_vertex_program", GL_NV_vertex_program_functions }
-};
-
-extern const struct tnl_pipeline_stage _r200_render_stage;
-extern const struct tnl_pipeline_stage _r200_tcl_stage;
-
-static const struct tnl_pipeline_stage *r200_pipeline[] = {
-
- /* Try and go straight to t&l
- */
- &_r200_tcl_stage,
-
- /* Catch any t&l fallbacks
- */
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_arb_vertex_program_stage,
- &_tnl_vertex_program_stage,
-
- /* Try again to go to tcl?
- * - no good for asymmetric-twoside (do with multipass)
- * - no good for asymmetric-unfilled (do with multipass)
- * - good for material
- * - good for texgen
- * - need to manipulate a bit of state
- *
- * - worth it/not worth it?
- */
-
- /* Else do them here.
- */
-/* &_r200_render_stage, */ /* FIXME: bugs with ut2003 */
- &_tnl_render_stage, /* FALLBACK: */
- NULL,
-};
-
-
-
-/* Initialize the driver's misc functions.
- */
-static void r200InitDriverFuncs( struct dd_function_table *functions )
-{
- functions->GetBufferSize = r200GetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = r200GetString;
-
- functions->Error = NULL;
- functions->DrawPixels = NULL;
- functions->Bitmap = NULL;
-}
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "code", DEBUG_CODEGEN },
- { "vfmt", DEBUG_VFMT },
- { "vtxf", DEBUG_VFMT },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "pix", DEBUG_PIXEL },
- { "mem", DEBUG_MEMORY },
- { NULL, 0 }
-};
-
-
-/* Create the device specific rendering context.
- */
-GLboolean r200CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- r200ScreenPtr screen = (r200ScreenPtr)(sPriv->private);
- struct dd_function_table functions;
- r200ContextPtr rmesa;
- GLcontext *ctx, *shareCtx;
- int i;
- int tcl_mode, fthrottle_mode;
-
- assert(glVisual);
- assert(driContextPriv);
- assert(screen);
-
- /* Allocate the R200 context */
- rmesa = (r200ContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
- return GL_FALSE;
-
- /* init exp fog table data */
- r200InitStaticFogData();
-
- /* Parse configuration files.
- * Do this here so that initialMaxAnisotropy is set before we create
- * the default textures.
- */
- driParseConfigFiles (&rmesa->optionCache, &screen->optionCache,
- screen->driScreen->myNum, "r200");
- rmesa->initialMaxAnisotropy = driQueryOptionf(&rmesa->optionCache,
- "def_max_anisotropy");
-
- if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) {
- if ( sPriv->drmMinor < 13 )
- fprintf( stderr, "DRM version 1.%d too old to support HyperZ, "
- "disabling.\n",sPriv->drmMinor );
- else
- rmesa->using_hyperz = GL_TRUE;
- }
-
- if ( sPriv->drmMinor >= 15 )
- rmesa->texmicrotile = GL_TRUE;
-
- /* Init default driver functions then plug in our R200-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions(&functions);
- r200InitDriverFuncs(&functions);
- r200InitIoctlFuncs(&functions);
- r200InitStateFuncs(&functions);
- r200InitTextureFuncs(&functions);
-
- /* Allocate and initialize the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((r200ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
- &functions, (void *) rmesa);
- if (!rmesa->glCtx) {
- FREE(rmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = rmesa;
-
- /* Init r200 context data */
- rmesa->dri.context = driContextPriv;
- rmesa->dri.screen = sPriv;
- rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
- rmesa->dri.hwContext = driContextPriv->hHWContext;
- rmesa->dri.hwLock = &sPriv->pSAREA->lock;
- rmesa->dri.fd = sPriv->fd;
- rmesa->dri.drmMinor = sPriv->drmMinor;
-
- rmesa->r200Screen = screen;
- rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA +
- screen->sarea_priv_offset);
-
-
- rmesa->dma.buf0_address = rmesa->r200Screen->buffers->list[0].address;
-
- (void) memset( rmesa->texture_heaps, 0, sizeof( rmesa->texture_heaps ) );
- make_empty_list( & rmesa->swapped );
-
- rmesa->nr_heaps = 1 /* screen->numTexHeaps */ ;
- assert(rmesa->nr_heaps < R200_NR_TEX_HEAPS);
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- rmesa->texture_heaps[i] = driCreateTextureHeap( i, rmesa,
- screen->texSize[i],
- 12,
- RADEON_NR_TEX_REGIONS,
- (drmTextureRegionPtr)rmesa->sarea->tex_list[i],
- & rmesa->sarea->tex_age[i],
- & rmesa->swapped,
- sizeof( r200TexObj ),
- (destroy_texture_object_t *) r200DestroyTexObj );
- }
- rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache,
- "texture_depth");
- if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- rmesa->texture_depth = ( screen->cpp == 4 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->hw.all_dirty = 1;
-
- /* Set the maximum texture size small enough that we can guarentee that
- * all texture units can bind a maximal texture and have them both in
- * texturable memory at once.
- */
-
- ctx = rmesa->glCtx;
- ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->optionCache,
- "texture_units");
- ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
- ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
-
- driCalculateMaxTextureLevels( rmesa->texture_heaps,
- rmesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
-#if ENABLE_HW_3D_TEXTURE
- 8, /* max 3D texture size is 256^3 */
-#else
- 0, /* 3D textures unsupported */
-#endif
- 11, /* max cube texture size is 2048x2048 */
- 11, /* max texture rectangle size is 2048x2048 */
- 12,
- GL_FALSE );
-
- /* adjust max texture size a bit. Hack, but I really want to use larger textures
- which will work just fine in 99.999999% of all cases, especially with texture compression... */
- if (driQueryOptionb( &rmesa->optionCache, "texture_level_hack" ))
- {
- if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1;
- }
-
- ctx->Const.MaxTextureMaxAnisotropy = 16.0;
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 10.0;
- ctx->Const.MaxLineWidthAA = 10.0;
- ctx->Const.LineWidthGranularity = 0.0625;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _ae_create_context( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, r200_pipeline );
- ctx->Driver.FlushVertices = r200FlushVertices;
-
- /* Try and keep materials and vertices separate:
- */
- _tnl_isolate_materials( ctx, GL_TRUE );
-
-
- /* Configure swrast and 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 );
-
-
- for ( i = 0 ; i < R200_MAX_TEXTURE_UNITS ; i++ ) {
- _math_matrix_ctr( &rmesa->TexGenMatrix[i] );
- _math_matrix_set_identity( &rmesa->TexGenMatrix[i] );
- }
- _math_matrix_ctr( &rmesa->tmpmat );
- _math_matrix_set_identity( &rmesa->tmpmat );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- if (!(rmesa->r200Screen->chipset & R200_CHIPSET_YCBCR_BROKEN)) {
- /* yuv textures don't work with some chips - R200 / rv280 okay so far
- others get the bit ordering right but don't actually do YUV-RGB conversion */
- _mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" );
- }
- if (rmesa->glCtx->Mesa_DXTn) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- _mesa_enable_extension( ctx, "GL_S3_s3tc" );
- }
- else if (driQueryOptionb (&rmesa->optionCache, "force_s3tc_enable")) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- }
-
- if (rmesa->r200Screen->drmSupportsCubeMaps)
- _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
- if (rmesa->r200Screen->drmSupportsBlendColor) {
- driInitExtensions( ctx, blend_extensions, GL_FALSE );
- }
- if(driQueryOptionb(&rmesa->optionCache, "arb_vertex_program"))
- driInitSingleExtension( ctx, ARB_vp_extension );
- if(driQueryOptionb(&rmesa->optionCache, "nv_vertex_program"))
- driInitSingleExtension( ctx, NV_vp_extension );
-
-#if 0
- r200InitDriverFuncs( ctx );
- r200InitIoctlFuncs( ctx );
- r200InitStateFuncs( ctx );
- r200InitTextureFuncs( ctx );
-#endif
- /* plug in a few more device driver functions */
- /* XXX these should really go right after _mesa_init_driver_functions() */
- r200InitPixelFuncs( ctx );
- r200InitSpanFuncs( ctx );
- r200InitTnlFuncs( ctx );
- r200InitState( rmesa );
- r200InitSwtcl( ctx );
-
- fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode");
- rmesa->iw.irq_seq = -1;
- rmesa->irqsEmitted = 0;
- rmesa->do_irqs = (rmesa->dri.drmMinor >= 6 &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS &&
- rmesa->r200Screen->irq);
-
- rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
-
- if (!rmesa->do_irqs)
- fprintf(stderr,
- "IRQ's not enabled, falling back to %s: %d %d %d\n",
- rmesa->do_usleeps ? "usleeps" : "busy waits",
- rmesa->dri.drmMinor,
- fthrottle_mode,
- rmesa->r200Screen->irq);
-
- rmesa->vblank_flags = (rmesa->r200Screen->irq != 0)
- ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- rmesa->prefer_gart_client_texturing =
- (getenv("R200_GART_CLIENT_TEXTURES") != 0);
-
- (*dri_interface->getUST)( & rmesa->swap_ust );
-
-
-#if DO_DEBUG
- R200_DEBUG = driParseDebugString( getenv( "R200_DEBUG" ),
- debug_control );
- R200_DEBUG |= driParseDebugString( getenv( "RADEON_DEBUG" ),
- debug_control );
-#endif
-
- tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (driQueryOptionb(&rmesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(rmesa, R200_FALLBACK_DISABLE, 1);
- }
- else if (tcl_mode == DRI_CONF_TCL_SW || getenv("R200_NO_TCL") ||
- !(rmesa->r200Screen->chipset & R200_CHIPSET_TCL)) {
- if (rmesa->r200Screen->chipset & R200_CHIPSET_TCL) {
- rmesa->r200Screen->chipset &= ~R200_CHIPSET_TCL;
- fprintf(stderr, "Disabling HW TCL support\n");
- }
- TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
- }
-
- if (rmesa->r200Screen->chipset & R200_CHIPSET_TCL) {
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
- r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
-
- _tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
- }
- return GL_TRUE;
-}
-
-
-/* Destroy the device specific context.
- */
-/* Destroy the Mesa and driver specific context data.
- */
-void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
- r200ContextPtr current = ctx ? R200_CONTEXT(ctx) : NULL;
-
- /* check if we're deleting the currently bound context */
- if (rmesa == current) {
- R200_FIREVERTICES( rmesa );
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- /* Free r200 context resources */
- assert(rmesa); /* should never be null */
- if ( rmesa ) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( rmesa->glCtx );
- _tnl_DestroyContext( rmesa->glCtx );
- _ac_DestroyContext( rmesa->glCtx );
- _swrast_DestroyContext( rmesa->glCtx );
-
- r200DestroySwtcl( rmesa->glCtx );
- r200ReleaseArrays( rmesa->glCtx, ~0 );
-
- if (rmesa->dma.current.buf) {
- r200ReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
- r200FlushCmdBuf( rmesa, __FUNCTION__ );
- }
-
- if (!(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)) {
- int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
- r200VtxfmtDestroy( rmesa->glCtx );
- }
-
- /* free the Mesa context */
- rmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context( rmesa->glCtx );
-
- if (rmesa->state.scissor.pClipRects) {
- FREE(rmesa->state.scissor.pClipRects);
- rmesa->state.scissor.pClipRects = NULL;
- }
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( rmesa->texture_heaps[ i ] );
- rmesa->texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & rmesa->swapped ) );
- }
-
- /* free the option cache */
- driDestroyOptionCache (&rmesa->optionCache);
-
- FREE( rmesa );
- }
-}
-
-
-
-
-void
-r200SwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- r200ContextPtr rmesa;
- GLcontext *ctx;
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = rmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( rmesa->doPageFlip ) {
- r200PageFlip( dPriv );
- }
- else {
- r200CopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean
-r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- r200ContextPtr newCtx =
- (r200ContextPtr) driContextPriv->driverPrivate;
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx);
-
- if ( newCtx->dri.drawable != driDrawPriv ) {
- driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
- newCtx->dri.drawable = driDrawPriv;
- r200UpdateWindow( newCtx->glCtx );
- r200UpdateViewportOffset( newCtx->glCtx );
- }
-
- _mesa_make_current( newCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if (newCtx->vb.enabled)
- r200VtxfmtMakeCurrent( newCtx->glCtx );
-
- _mesa_update_state( newCtx->glCtx );
- r200ValidateState( newCtx->glCtx );
-
- } else {
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "End %s\n", __FUNCTION__);
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-r200UnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)rmesa->glCtx);
-
- r200VtxfmtUnbindContext( rmesa->glCtx );
- return GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.h
deleted file mode 100644
index 8169af709..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.h
+++ /dev/null
@@ -1,995 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_CONTEXT_H__
-#define __R200_CONTEXT_H__
-
-#include "tnl/t_vertex.h"
-#include "drm.h"
-#include "radeon_drm.h"
-#include "dri_util.h"
-#include "texmem.h"
-
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "r200_reg.h"
-
-#define ENABLE_HW_3D_TEXTURE 1 /* XXX this is temporary! */
-
-struct r200_context;
-typedef struct r200_context r200ContextRec;
-typedef struct r200_context *r200ContextPtr;
-
-#include "r200_lock.h"
-#include "r200_screen.h"
-#include "mm.h"
-
-/* Flags for software fallback cases */
-/* See correponding strings in r200_swtcl.c */
-#define R200_FALLBACK_TEXTURE 0x01
-#define R200_FALLBACK_DRAW_BUFFER 0x02
-#define R200_FALLBACK_STENCIL 0x04
-#define R200_FALLBACK_RENDER_MODE 0x08
-#define R200_FALLBACK_DISABLE 0x10
-#define R200_FALLBACK_BORDER_MODE 0x20
-
-/* The blit width for texture uploads
- */
-#define BLIT_WIDTH_BYTES 1024
-
-/* Use the templated vertex format:
- */
-#define COLOR_IS_RGBA
-#define TAG(x) r200##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*r200_tri_func)( r200ContextPtr,
- r200Vertex *,
- r200Vertex *,
- r200Vertex * );
-
-typedef void (*r200_line_func)( r200ContextPtr,
- r200Vertex *,
- r200Vertex * );
-
-typedef void (*r200_point_func)( r200ContextPtr,
- r200Vertex * );
-
-
-struct r200_colorbuffer_state {
- GLuint clear;
- GLint drawOffset, drawPitch;
- int roundEnable;
-};
-
-
-struct r200_depthbuffer_state {
- GLuint clear;
- GLfloat scale;
-};
-
-struct r200_pixel_state {
- GLint readOffset, readPitch;
-};
-
-struct r200_scissor_state {
- drm_clip_rect_t rect;
- GLboolean enabled;
-
- GLuint numClipRects; /* Cliprects active */
- GLuint numAllocedClipRects; /* Cliprects available */
- drm_clip_rect_t *pClipRects;
-};
-
-struct r200_stencilbuffer_state {
- GLboolean hwBuffer;
- GLuint clear; /* rb3d_stencilrefmask value */
-};
-
-struct r200_stipple_state {
- GLuint mask[32];
-};
-
-
-
-#define TEX_0 0x1
-#define TEX_1 0x2
-#define TEX_2 0x4
-#define TEX_3 0x8
-#define TEX_4 0x10
-#define TEX_5 0x20
-#define TEX_ALL 0x3f
-
-typedef struct r200_tex_obj r200TexObj, *r200TexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct r200_tex_obj {
- driTextureObject base;
-
- GLuint bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint dirty_state; /* Flags (1 per texunit) for
- whether or not this texobj
- has dirty hardware state
- (pp_*) that needs to be
- brought into the
- texunit. */
-
- drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
- /* Six, for the cube faces */
-
- GLuint pp_txfilter; /* hardware register values */
- GLuint pp_txformat;
- GLuint pp_txformat_x;
- GLuint pp_txoffset; /* Image location in texmem.
- All cube faces follow. */
- GLuint pp_txsize; /* npot only */
- GLuint pp_txpitch; /* npot only */
- GLuint pp_border_color;
- GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
-
- GLboolean border_fallback;
-
- GLuint tile_bits; /* hw texture tile bits used on this texture */
-};
-
-
-struct r200_texture_env_state {
- r200TexObjPtr texobj;
- GLenum format;
- GLenum envMode;
-};
-
-#define R200_MAX_TEXTURE_UNITS 6
-
-struct r200_texture_state {
- struct r200_texture_env_state unit[R200_MAX_TEXTURE_UNITS];
-};
-
-
-struct r200_state_atom {
- struct r200_state_atom *next, *prev;
- const char *name; /* for debug */
- int cmd_size; /* size in bytes */
- GLuint idx;
- int *cmd; /* one or more cmd's */
- int *lastcmd; /* one or more cmd's */
- GLboolean dirty;
- GLboolean (*check)( GLcontext *, int ); /* is this state active? */
-};
-
-
-
-/* Trying to keep these relatively short as the variables are becoming
- * extravagently long. Drop the driver name prefix off the front of
- * everything - I think we know which driver we're in by now, and keep the
- * prefix to 3 letters unless absolutely impossible.
- */
-
-#define CTX_CMD_0 0
-#define CTX_PP_MISC 1
-#define CTX_PP_FOG_COLOR 2
-#define CTX_RE_SOLID_COLOR 3
-#define CTX_RB3D_BLENDCNTL 4
-#define CTX_RB3D_DEPTHOFFSET 5
-#define CTX_RB3D_DEPTHPITCH 6
-#define CTX_RB3D_ZSTENCILCNTL 7
-#define CTX_CMD_1 8
-#define CTX_PP_CNTL 9
-#define CTX_RB3D_CNTL 10
-#define CTX_RB3D_COLOROFFSET 11
-#define CTX_CMD_2 12 /* why */
-#define CTX_RB3D_COLORPITCH 13 /* why */
-#define CTX_STATE_SIZE_OLDDRM 14
-#define CTX_CMD_3 14
-#define CTX_RB3D_BLENDCOLOR 15
-#define CTX_RB3D_ABLENDCNTL 16
-#define CTX_RB3D_CBLENDCNTL 17
-#define CTX_STATE_SIZE_NEWDRM 18
-
-#define SET_CMD_0 0
-#define SET_SE_CNTL 1
-#define SET_RE_CNTL 2 /* replace se_coord_fmt */
-#define SET_STATE_SIZE 3
-
-#define VTE_CMD_0 0
-#define VTE_SE_VTE_CNTL 1
-#define VTE_STATE_SIZE 2
-
-#define LIN_CMD_0 0
-#define LIN_RE_LINE_PATTERN 1
-#define LIN_RE_LINE_STATE 2
-#define LIN_CMD_1 3
-#define LIN_SE_LINE_WIDTH 4
-#define LIN_STATE_SIZE 5
-
-#define MSK_CMD_0 0
-#define MSK_RB3D_STENCILREFMASK 1
-#define MSK_RB3D_ROPCNTL 2
-#define MSK_RB3D_PLANEMASK 3
-#define MSK_STATE_SIZE 4
-
-#define VPT_CMD_0 0
-#define VPT_SE_VPORT_XSCALE 1
-#define VPT_SE_VPORT_XOFFSET 2
-#define VPT_SE_VPORT_YSCALE 3
-#define VPT_SE_VPORT_YOFFSET 4
-#define VPT_SE_VPORT_ZSCALE 5
-#define VPT_SE_VPORT_ZOFFSET 6
-#define VPT_STATE_SIZE 7
-
-#define ZBS_CMD_0 0
-#define ZBS_SE_ZBIAS_FACTOR 1
-#define ZBS_SE_ZBIAS_CONSTANT 2
-#define ZBS_STATE_SIZE 3
-
-#define MSC_CMD_0 0
-#define MSC_RE_MISC 1
-#define MSC_STATE_SIZE 2
-
-#define TAM_CMD_0 0
-#define TAM_DEBUG3 1
-#define TAM_STATE_SIZE 2
-
-#define TEX_CMD_0 0
-#define TEX_PP_TXFILTER 1 /*2c00*/
-#define TEX_PP_TXFORMAT 2 /*2c04*/
-#define TEX_PP_TXFORMAT_X 3 /*2c08*/
-#define TEX_PP_TXSIZE 4 /*2c0c*/
-#define TEX_PP_TXPITCH 5 /*2c10*/
-#define TEX_PP_BORDER_COLOR 6 /*2c14*/
-#define TEX_CMD_1 7
-#define TEX_PP_TXOFFSET 8 /*2d00 */
-#define TEX_STATE_SIZE 9
-
-#define CUBE_CMD_0 0 /* 1 register follows */
-#define CUBE_PP_CUBIC_FACES 1 /* 0x2c18 */
-#define CUBE_CMD_1 2 /* 5 registers follow */
-#define CUBE_PP_CUBIC_OFFSET_F1 3 /* 0x2d04 */
-#define CUBE_PP_CUBIC_OFFSET_F2 4 /* 0x2d08 */
-#define CUBE_PP_CUBIC_OFFSET_F3 5 /* 0x2d0c */
-#define CUBE_PP_CUBIC_OFFSET_F4 6 /* 0x2d10 */
-#define CUBE_PP_CUBIC_OFFSET_F5 7 /* 0x2d14 */
-#define CUBE_STATE_SIZE 8
-
-#define PIX_CMD_0 0
-#define PIX_PP_TXCBLEND 1
-#define PIX_PP_TXCBLEND2 2
-#define PIX_PP_TXABLEND 3
-#define PIX_PP_TXABLEND2 4
-#define PIX_STATE_SIZE 5
-
-#define TF_CMD_0 0
-#define TF_TFACTOR_0 1
-#define TF_TFACTOR_1 2
-#define TF_TFACTOR_2 3
-#define TF_TFACTOR_3 4
-#define TF_TFACTOR_4 5
-#define TF_TFACTOR_5 6
-#define TF_STATE_SIZE 7
-
-#define TCL_CMD_0 0
-#define TCL_LIGHT_MODEL_CTL_0 1
-#define TCL_LIGHT_MODEL_CTL_1 2
-#define TCL_PER_LIGHT_CTL_0 3
-#define TCL_PER_LIGHT_CTL_1 4
-#define TCL_PER_LIGHT_CTL_2 5
-#define TCL_PER_LIGHT_CTL_3 6
-#define TCL_CMD_1 7
-#define TCL_UCP_VERT_BLEND_CTL 8
-#define TCL_STATE_SIZE 9
-
-#define MSL_CMD_0 0
-#define MSL_MATRIX_SELECT_0 1
-#define MSL_MATRIX_SELECT_1 2
-#define MSL_MATRIX_SELECT_2 3
-#define MSL_MATRIX_SELECT_3 4
-#define MSL_MATRIX_SELECT_4 5
-#define MSL_STATE_SIZE 6
-
-#define TCG_CMD_0 0
-#define TCG_TEX_PROC_CTL_2 1
-#define TCG_TEX_PROC_CTL_3 2
-#define TCG_TEX_PROC_CTL_0 3
-#define TCG_TEX_PROC_CTL_1 4
-#define TCG_TEX_CYL_WRAP_CTL 5
-#define TCG_STATE_SIZE 6
-
-#define MTL_CMD_0 0
-#define MTL_EMMISSIVE_RED 1
-#define MTL_EMMISSIVE_GREEN 2
-#define MTL_EMMISSIVE_BLUE 3
-#define MTL_EMMISSIVE_ALPHA 4
-#define MTL_AMBIENT_RED 5
-#define MTL_AMBIENT_GREEN 6
-#define MTL_AMBIENT_BLUE 7
-#define MTL_AMBIENT_ALPHA 8
-#define MTL_DIFFUSE_RED 9
-#define MTL_DIFFUSE_GREEN 10
-#define MTL_DIFFUSE_BLUE 11
-#define MTL_DIFFUSE_ALPHA 12
-#define MTL_SPECULAR_RED 13
-#define MTL_SPECULAR_GREEN 14
-#define MTL_SPECULAR_BLUE 15
-#define MTL_SPECULAR_ALPHA 16
-#define MTL_CMD_1 17
-#define MTL_SHININESS 18
-#define MTL_STATE_SIZE 19
-
-#define VAP_CMD_0 0
-#define VAP_SE_VAP_CNTL 1
-#define VAP_STATE_SIZE 2
-
-/* Replaces a lot of packet info from radeon
- */
-#define VTX_CMD_0 0
-#define VTX_VTXFMT_0 1
-#define VTX_VTXFMT_1 2
-#define VTX_TCL_OUTPUT_VTXFMT_0 3
-#define VTX_TCL_OUTPUT_VTXFMT_1 4
-#define VTX_CMD_1 5
-#define VTX_TCL_OUTPUT_COMPSEL 6
-#define VTX_CMD_2 7
-#define VTX_STATE_CNTL 8
-#define VTX_STATE_SIZE 9
-
-
-#define VTX_COLOR(v,n) (((v)>>(R200_VTX_COLOR_0_SHIFT+(n)*2))&\
- R200_VTX_COLOR_MASK)
-
-/**
- * Given the \c R200_SE_VTX_FMT_1 for the current vertex state, determine
- * how many components are in texture coordinate \c n.
- */
-#define VTX_TEXn_COUNT(v,n) (((v) >> (3 * n)) & 0x07)
-
-#define MAT_CMD_0 0
-#define MAT_ELT_0 1
-#define MAT_STATE_SIZE 17
-
-#define GRD_CMD_0 0
-#define GRD_VERT_GUARD_CLIP_ADJ 1
-#define GRD_VERT_GUARD_DISCARD_ADJ 2
-#define GRD_HORZ_GUARD_CLIP_ADJ 3
-#define GRD_HORZ_GUARD_DISCARD_ADJ 4
-#define GRD_STATE_SIZE 5
-
-/* position changes frequently when lighting in modelpos - separate
- * out to new state item?
- */
-#define LIT_CMD_0 0
-#define LIT_AMBIENT_RED 1
-#define LIT_AMBIENT_GREEN 2
-#define LIT_AMBIENT_BLUE 3
-#define LIT_AMBIENT_ALPHA 4
-#define LIT_DIFFUSE_RED 5
-#define LIT_DIFFUSE_GREEN 6
-#define LIT_DIFFUSE_BLUE 7
-#define LIT_DIFFUSE_ALPHA 8
-#define LIT_SPECULAR_RED 9
-#define LIT_SPECULAR_GREEN 10
-#define LIT_SPECULAR_BLUE 11
-#define LIT_SPECULAR_ALPHA 12
-#define LIT_POSITION_X 13
-#define LIT_POSITION_Y 14
-#define LIT_POSITION_Z 15
-#define LIT_POSITION_W 16
-#define LIT_DIRECTION_X 17
-#define LIT_DIRECTION_Y 18
-#define LIT_DIRECTION_Z 19
-#define LIT_DIRECTION_W 20
-#define LIT_ATTEN_QUADRATIC 21
-#define LIT_ATTEN_LINEAR 22
-#define LIT_ATTEN_CONST 23
-#define LIT_ATTEN_XXX 24
-#define LIT_CMD_1 25
-#define LIT_SPOT_DCD 26
-#define LIT_SPOT_DCM 27
-#define LIT_SPOT_EXPONENT 28
-#define LIT_SPOT_CUTOFF 29
-#define LIT_SPECULAR_THRESH 30
-#define LIT_RANGE_CUTOFF 31 /* ? */
-#define LIT_ATTEN_CONST_INV 32
-#define LIT_STATE_SIZE 33
-
-/* Fog
- */
-#define FOG_CMD_0 0
-#define FOG_R 1
-#define FOG_C 2
-#define FOG_D 3
-#define FOG_PAD 4
-#define FOG_STATE_SIZE 5
-
-/* UCP
- */
-#define UCP_CMD_0 0
-#define UCP_X 1
-#define UCP_Y 2
-#define UCP_Z 3
-#define UCP_W 4
-#define UCP_STATE_SIZE 5
-
-/* GLT - Global ambient
- */
-#define GLT_CMD_0 0
-#define GLT_RED 1
-#define GLT_GREEN 2
-#define GLT_BLUE 3
-#define GLT_ALPHA 4
-#define GLT_STATE_SIZE 5
-
-/* EYE
- */
-#define EYE_CMD_0 0
-#define EYE_X 1
-#define EYE_Y 2
-#define EYE_Z 3
-#define EYE_RESCALE_FACTOR 4
-#define EYE_STATE_SIZE 5
-
-/* CST - constant state
- */
-#define CST_CMD_0 0
-#define CST_PP_CNTL_X 1
-#define CST_CMD_1 2
-#define CST_RB3D_DEPTHXY_OFFSET 3
-#define CST_CMD_2 4
-#define CST_RE_AUX_SCISSOR_CNTL 5
-#define CST_CMD_3 6
-#define CST_RE_SCISSOR_TL_0 7
-#define CST_RE_SCISSOR_BR_0 8
-#define CST_CMD_4 9
-#define CST_SE_VAP_CNTL_STATUS 10
-#define CST_CMD_5 11
-#define CST_RE_POINTSIZE 12
-#define CST_CMD_6 13
-#define CST_SE_TCL_INPUT_VTX_0 14
-#define CST_SE_TCL_INPUT_VTX_1 15
-#define CST_SE_TCL_INPUT_VTX_2 16
-#define CST_SE_TCL_INPUT_VTX_3 17
-#define CST_STATE_SIZE 18
-
-#define PRF_CMD_0 0
-#define PRF_PP_TRI_PERF 1
-#define PRF_PP_PERF_CNTL 2
-#define PRF_STATE_SIZE 3
-
-
-struct r200_hw_state {
- /* Head of the linked list of state atoms. */
- struct r200_state_atom atomlist;
-
- /* Hardware state, stored as cmdbuf commands:
- * -- Need to doublebuffer for
- * - reviving state after loss of context
- * - eliding noop statechange loops? (except line stipple count)
- */
- struct r200_state_atom ctx;
- struct r200_state_atom set;
- struct r200_state_atom vte;
- struct r200_state_atom lin;
- struct r200_state_atom msk;
- struct r200_state_atom vpt;
- struct r200_state_atom vap;
- struct r200_state_atom vtx;
- struct r200_state_atom tcl;
- struct r200_state_atom msl;
- struct r200_state_atom tcg;
- struct r200_state_atom msc;
- struct r200_state_atom cst;
- struct r200_state_atom tam;
- struct r200_state_atom tf;
- struct r200_state_atom tex[6];
- struct r200_state_atom cube[6];
- struct r200_state_atom zbs;
- struct r200_state_atom mtl[2];
- struct r200_state_atom mat[9];
- struct r200_state_atom lit[8]; /* includes vec, scl commands */
- struct r200_state_atom ucp[6];
- struct r200_state_atom pix[6]; /* pixshader stages */
- struct r200_state_atom eye; /* eye pos */
- struct r200_state_atom grd; /* guard band clipping */
- struct r200_state_atom fog;
- struct r200_state_atom glt;
- struct r200_state_atom prf;
-
- int max_state_size; /* Number of bytes necessary for a full state emit. */
- GLboolean is_dirty, all_dirty;
-};
-
-struct r200_state {
- /* Derived state for internal purposes:
- */
- struct r200_colorbuffer_state color;
- struct r200_depthbuffer_state depth;
- struct r200_pixel_state pixel;
- struct r200_scissor_state scissor;
- struct r200_stencilbuffer_state stencil;
- struct r200_stipple_state stipple;
- struct r200_texture_state texture;
-};
-
-/* Need refcounting on dma buffers:
- */
-struct r200_dma_buffer {
- int refcount; /* the number of retained regions in buf */
- drmBufPtr buf;
-};
-
-#define GET_START(rvb) (rmesa->r200Screen->gart_buffer_offset + \
- (rvb)->address - rmesa->dma.buf0_address + \
- (rvb)->start)
-
-/* A retained region, eg vertices for indexed vertices.
- */
-struct r200_dma_region {
- struct r200_dma_buffer *buf;
- char *address; /* == buf->address */
- int start, end, ptr; /* offsets from start of buf */
- int aos_start;
- int aos_stride;
- int aos_size;
-};
-
-
-struct r200_dma {
- /* Active dma region. Allocations for vertices and retained
- * regions come from here. Also used for emitting random vertices,
- * these may be flushed by calling flush_current();
- */
- struct r200_dma_region current;
-
- void (*flush)( r200ContextPtr );
-
- char *buf0_address; /* start of buf[0], for index calcs */
- GLuint nr_released_bufs; /* flush after so many buffers released */
-};
-
-struct r200_dri_mirror {
- __DRIcontextPrivate *context; /* DRI context */
- __DRIscreenPrivate *screen; /* DRI screen */
- __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
-
- drm_context_t hwContext;
- drm_hw_lock_t *hwLock;
- int fd;
- int drmMinor;
-};
-
-
-#define R200_CMD_BUF_SZ (8*1024)
-
-struct r200_store {
- GLuint statenr;
- GLuint primnr;
- char cmd_buf[R200_CMD_BUF_SZ];
- int cmd_used;
- int elts_start;
-};
-
-
-/* r200_tcl.c
- */
-struct r200_tcl_info {
- GLuint vertex_format;
- GLint last_offset;
- GLuint hw_primitive;
-
- struct r200_dma_region *aos_components[8];
- GLuint nr_aos_components;
-
- GLuint *Elts;
-
- struct r200_dma_region indexed_verts;
- struct r200_dma_region obj;
- struct r200_dma_region rgba;
- struct r200_dma_region spec;
- struct r200_dma_region fog;
- struct r200_dma_region tex[R200_MAX_TEXTURE_UNITS];
- struct r200_dma_region norm;
-};
-
-
-/* r200_swtcl.c
- */
-struct r200_swtcl_info {
- GLuint RenderIndex;
-
- /**
- * Size of a hardware vertex. This is calculated when \c ::vertex_attrs is
- * installed in the Mesa state vector.
- */
- GLuint vertex_size;
-
- /**
- * Attributes instructing the Mesa TCL pipeline where / how to put vertex
- * data in the hardware buffer.
- */
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
-
- /**
- * Number of elements of \c ::vertex_attrs that are actually used.
- */
- GLuint vertex_attr_count;
-
- /**
- * Cached pointer to the buffer where Mesa will store vertex data.
- */
- GLubyte *verts;
-
- /* Fallback rasterization functions
- */
- r200_point_func draw_point;
- r200_line_func draw_line;
- r200_tri_func draw_tri;
-
- GLuint hw_primitive;
- GLenum render_primitive;
- GLuint numverts;
-
- /**
- * Offset of the 4UB color data within a hardware (swtcl) vertex.
- */
- GLuint coloroffset;
-
- /**
- * Offset of the 3UB specular color data within a hardware (swtcl) vertex.
- */
- GLuint specoffset;
-
- /**
- * Should Mesa project vertex data or will the hardware do it?
- */
- GLboolean needproj;
-
- struct r200_dma_region indexed_verts;
-};
-
-
-struct r200_ioctl {
- GLuint vertex_offset;
- GLuint vertex_size;
-};
-
-
-
-#define R200_MAX_PRIMS 64
-
-
-/* Want to keep a cache of these around. Each is parameterized by
- * only a single value which has only a small range. Only expect a
- * few, so just rescan the list each time?
- */
-struct dynfn {
- struct dynfn *next, *prev;
- int key[2];
- char *code;
-};
-
-struct dfn_lists {
- struct dynfn Vertex2f;
- struct dynfn Vertex2fv;
- struct dynfn Vertex3f;
- struct dynfn Vertex3fv;
- struct dynfn Color4ub;
- struct dynfn Color4ubv;
- struct dynfn Color3ub;
- struct dynfn Color3ubv;
- struct dynfn Color4f;
- struct dynfn Color4fv;
- struct dynfn Color3f;
- struct dynfn Color3fv;
- struct dynfn SecondaryColor3ubEXT;
- struct dynfn SecondaryColor3ubvEXT;
- struct dynfn SecondaryColor3fEXT;
- struct dynfn SecondaryColor3fvEXT;
- struct dynfn Normal3f;
- struct dynfn Normal3fv;
- struct dynfn TexCoord3f;
- struct dynfn TexCoord3fv;
- struct dynfn TexCoord2f;
- struct dynfn TexCoord2fv;
- struct dynfn TexCoord1f;
- struct dynfn TexCoord1fv;
- struct dynfn MultiTexCoord3fARB;
- struct dynfn MultiTexCoord3fvARB;
- struct dynfn MultiTexCoord2fARB;
- struct dynfn MultiTexCoord2fvARB;
- struct dynfn MultiTexCoord1fARB;
- struct dynfn MultiTexCoord1fvARB;
- struct dynfn FogCoordfEXT;
- struct dynfn FogCoordfvEXT;
-};
-
-struct dfn_generators {
- struct dynfn *(*Vertex2f)( GLcontext *, const int * );
- struct dynfn *(*Vertex2fv)( GLcontext *, const int * );
- struct dynfn *(*Vertex3f)( GLcontext *, const int * );
- struct dynfn *(*Vertex3fv)( GLcontext *, const int * );
- struct dynfn *(*Color4ub)( GLcontext *, const int * );
- struct dynfn *(*Color4ubv)( GLcontext *, const int * );
- struct dynfn *(*Color3ub)( GLcontext *, const int * );
- struct dynfn *(*Color3ubv)( GLcontext *, const int * );
- struct dynfn *(*Color4f)( GLcontext *, const int * );
- struct dynfn *(*Color4fv)( GLcontext *, const int * );
- struct dynfn *(*Color3f)( GLcontext *, const int * );
- struct dynfn *(*Color3fv)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3ubEXT)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3ubvEXT)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3fEXT)( GLcontext *, const int * );
- struct dynfn *(*SecondaryColor3fvEXT)( GLcontext *, const int * );
- struct dynfn *(*Normal3f)( GLcontext *, const int * );
- struct dynfn *(*Normal3fv)( GLcontext *, const int * );
- struct dynfn *(*TexCoord3f)( GLcontext *, const int * );
- struct dynfn *(*TexCoord3fv)( GLcontext *, const int * );
- struct dynfn *(*TexCoord2f)( GLcontext *, const int * );
- struct dynfn *(*TexCoord2fv)( GLcontext *, const int * );
- struct dynfn *(*TexCoord1f)( GLcontext *, const int * );
- struct dynfn *(*TexCoord1fv)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord3fARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord3fvARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord2fARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord2fvARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord1fARB)( GLcontext *, const int * );
- struct dynfn *(*MultiTexCoord1fvARB)( GLcontext *, const int * );
- struct dynfn *(*FogCoordfEXT)( GLcontext *, const int * );
- struct dynfn *(*FogCoordfvEXT)( GLcontext *, const int * );
-};
-
-
-
-struct r200_prim {
- GLuint start;
- GLuint end;
- GLuint prim;
-};
-
- /* A maximum total of 29 elements per vertex: 3 floats for position, 3
- * floats for normal, 4 floats for color, 4 bytes for secondary color,
- * 3 floats for each texture unit (18 floats total).
- *
- * we maybe need add. 4 to prevent segfault if someone specifies
- * GL_TEXTURE6/GL_TEXTURE7 (esp. for the codegen-path) (FIXME: )
- *
- * The position data is never actually stored here, so 3 elements could be
- * trimmed out of the buffer.
- */
-
-#define R200_MAX_VERTEX_SIZE ((3*6)+11)
-
-struct r200_vbinfo {
- GLint counter, initial_counter;
- GLint *dmaptr;
- void (*notify)( void );
- GLint vertex_size;
-
- union { float f; int i; r200_color_t color; } vertex[R200_MAX_VERTEX_SIZE];
-
- GLfloat *normalptr;
- GLfloat *floatcolorptr;
- GLfloat *fogptr;
- r200_color_t *colorptr;
- GLfloat *floatspecptr;
- r200_color_t *specptr;
- GLfloat *texcoordptr[8]; /* 6 (TMU) + 2 for r200_vtxfmt_c.c when GL_TEXTURE6/7 */
-
-
- GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */
- GLuint primflags;
- GLboolean enabled; /* *_NO_VTXFMT / *_NO_TCL env vars */
- GLboolean installed;
- GLboolean fell_back;
- GLboolean recheck;
- GLint nrverts;
- GLuint vtxfmt_0, vtxfmt_1;
-
- GLuint installed_vertex_format;
- GLuint installed_color_3f_sz;
-
- struct r200_prim primlist[R200_MAX_PRIMS];
- int nrprims;
-
- struct dfn_lists dfn_cache;
- struct dfn_generators codegen;
- GLvertexformat vtxfmt;
-};
-
-
-struct r200_context {
- GLcontext *glCtx; /* Mesa context */
-
- /* Driver and hardware state management
- */
- struct r200_hw_state hw;
- struct r200_state state;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ R200_NR_TEX_HEAPS ];
- driTextureObject swapped;
- int texture_depth;
- float initialMaxAnisotropy;
-
- /* Rasterization and vertex state:
- */
- GLuint TclFallback;
- GLuint Fallback;
- GLuint NewGLState;
- GLuint tnl_index; /* index of bits for last tnl_install_attrs */
-
- /* Vertex buffers
- */
- struct r200_ioctl ioctl;
- struct r200_dma dma;
- struct r200_store store;
- /* A full state emit as of the first state emit in the main store, in case
- * the context is lost.
- */
- struct r200_store backup_store;
-
- /* Page flipping
- */
- GLuint doPageFlip;
-
- /* Busy waiting
- */
- GLuint do_usleeps;
- GLuint do_irqs;
- GLuint irqsEmitted;
- drm_radeon_irq_wait_t iw;
-
- /* Clientdata textures;
- */
- GLuint prefer_gart_client_texturing;
-
- /* Drawable, cliprect and scissor information
- */
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
- unsigned int lastStamp;
- GLboolean lost_context;
- GLboolean save_on_next_emit;
- r200ScreenPtr r200Screen; /* Screen private DRI data */
- drm_radeon_sarea_t *sarea; /* Private SAREA data */
-
- /* TCL stuff
- */
- GLmatrix TexGenMatrix[R200_MAX_TEXTURE_UNITS];
- GLboolean recheck_texgen[R200_MAX_TEXTURE_UNITS];
- GLboolean TexGenNeedNormals[R200_MAX_TEXTURE_UNITS];
- GLuint TexMatEnabled;
- GLuint TexMatCompSel;
- GLuint TexGenEnabled;
- GLuint TexGenCompSel;
- GLmatrix tmpmat;
-
- /* VBI / buffer swap
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- int64_t swap_ust;
- int64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
-
- /* r200_tcl.c
- */
- struct r200_tcl_info tcl;
-
- /* r200_swtcl.c
- */
- struct r200_swtcl_info swtcl;
-
- /* r200_vtxfmt.c
- */
- struct r200_vbinfo vb;
-
- /* Mirrors of some DRI state
- */
- struct r200_dri_mirror dri;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-
- GLboolean using_hyperz;
- GLboolean texmicrotile;
-};
-
-#define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx))
-
-
-static __inline GLuint r200PackColor( 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;
- }
-}
-
-
-extern void r200DestroyContext( __DRIcontextPrivate *driContextPriv );
-extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-extern void r200SwapBuffers( __DRIdrawablePrivate *dPriv );
-extern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-extern GLboolean r200UnbindContext( __DRIcontextPrivate *driContextPriv );
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int R200_DEBUG;
-#else
-#define R200_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x001
-#define DEBUG_STATE 0x002
-#define DEBUG_IOCTL 0x004
-#define DEBUG_PRIMS 0x008
-#define DEBUG_VERTS 0x010
-#define DEBUG_FALLBACKS 0x020
-#define DEBUG_VFMT 0x040
-#define DEBUG_CODEGEN 0x080
-#define DEBUG_VERBOSE 0x100
-#define DEBUG_DRI 0x200
-#define DEBUG_DMA 0x400
-#define DEBUG_SANITY 0x800
-#define DEBUG_SYNC 0x1000
-#define DEBUG_PIXEL 0x2000
-#define DEBUG_MEMORY 0x4000
-
-#endif /* __R200_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.c
deleted file mode 100644
index a2336ce4f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ /dev/null
@@ -1,966 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c,v 1.4 2002/12/17 00:32:56 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <sched.h>
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tcl.h"
-#include "r200_sanity.h"
-#include "radeon_reg.h"
-
-#include "vblank.h"
-
-
-#define R200_TIMEOUT 512
-#define R200_IDLE_RETRY 16
-
-
-static void r200WaitForIdle( r200ContextPtr rmesa );
-
-
-/* At this point we were in FlushCmdBufLocked but we had lost our context, so
- * we need to unwire our current cmdbuf, hook the one with the saved state in
- * it, flush it, and then put the current one back. This is so commands at the
- * start of a cmdbuf can rely on the state being kept from the previous one.
- */
-static void r200BackUpAndEmitLostStateLocked( r200ContextPtr rmesa )
-{
- GLuint nr_released_bufs;
- struct r200_store saved_store;
-
- if (rmesa->backup_store.cmd_used == 0)
- return;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "Emitting backup state on lost context\n");
-
- rmesa->lost_context = GL_FALSE;
-
- nr_released_bufs = rmesa->dma.nr_released_bufs;
- saved_store = rmesa->store;
- rmesa->dma.nr_released_bufs = 0;
- rmesa->store = rmesa->backup_store;
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
- rmesa->dma.nr_released_bufs = nr_released_bufs;
- rmesa->store = saved_store;
-}
-
-int r200FlushCmdBufLocked( r200ContextPtr rmesa, const char * caller )
-{
- int ret, i;
- drm_radeon_cmd_buffer_t cmd;
-
- if (rmesa->lost_context)
- r200BackUpAndEmitLostStateLocked( rmesa );
-
- if (R200_DEBUG & DEBUG_IOCTL) {
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (0 & R200_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < rmesa->store.cmd_used ; i += 4 )
- fprintf(stderr, "%d: %x\n", i/4,
- *(int *)(&rmesa->store.cmd_buf[i]));
- }
-
- if (R200_DEBUG & DEBUG_DMA)
- fprintf(stderr, "%s: Releasing %d buffers\n", __FUNCTION__,
- rmesa->dma.nr_released_bufs);
-
-
- if (R200_DEBUG & DEBUG_SANITY) {
- if (rmesa->state.scissor.enabled)
- ret = r200SanityCmdBuffer( rmesa,
- rmesa->state.scissor.numClipRects,
- rmesa->state.scissor.pClipRects);
- else
- ret = r200SanityCmdBuffer( rmesa,
- rmesa->numClipRects,
- rmesa->pClipRects);
- if (ret) {
- fprintf(stderr, "drmSanityCommandWrite: %d\n", ret);
- goto out;
- }
- }
-
-
- if (R200_DEBUG & DEBUG_MEMORY) {
- if (! driValidateTextureHeaps( rmesa->texture_heaps, rmesa->nr_heaps,
- & rmesa->swapped ) ) {
- fprintf( stderr, "%s: texture memory is inconsistent - expect "
- "mangled textures\n", __FUNCTION__ );
- }
- }
-
-
- cmd.bufsz = rmesa->store.cmd_used;
- cmd.buf = rmesa->store.cmd_buf;
-
- if (rmesa->state.scissor.enabled) {
- cmd.nbox = rmesa->state.scissor.numClipRects;
- cmd.boxes = (drm_clip_rect_t *)rmesa->state.scissor.pClipRects;
- } else {
- cmd.nbox = rmesa->numClipRects;
- cmd.boxes = (drm_clip_rect_t *)rmesa->pClipRects;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd,
- DRM_RADEON_CMDBUF,
- &cmd, sizeof(cmd) );
-
- if (ret)
- fprintf(stderr, "drmCommandWrite: %d\n", ret);
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "\nSyncing in %s\n\n", __FUNCTION__);
- r200WaitForIdleLocked( rmesa );
- }
-
-
- out:
- rmesa->store.primnr = 0;
- rmesa->store.statenr = 0;
- rmesa->store.cmd_used = 0;
- rmesa->dma.nr_released_bufs = 0;
- rmesa->save_on_next_emit = 1;
-
- return ret;
-}
-
-
-/* Note: does not emit any commands to avoid recursion on
- * r200AllocCmdBuf.
- */
-void r200FlushCmdBuf( r200ContextPtr rmesa, const char *caller )
-{
- int ret;
-
- LOCK_HARDWARE( rmesa );
-
- ret = r200FlushCmdBufLocked( rmesa, caller );
-
- UNLOCK_HARDWARE( rmesa );
-
- if (ret) {
- fprintf(stderr, "drmRadeonCmdBuffer: %d (exiting)\n", ret);
- exit(ret);
- }
-}
-
-
-/* =============================================================
- * Hardware vertex buffer handling
- */
-
-
-void r200RefillCurrentDmaRegion( r200ContextPtr rmesa )
-{
- struct r200_dma_buffer *dmabuf;
- int fd = rmesa->dri.fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- int ret;
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush) {
- rmesa->dma.flush( rmesa );
- }
-
- if (rmesa->dma.current.buf)
- r200ReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
-
- if (rmesa->dma.nr_released_bufs > 4)
- r200FlushCmdBuf( rmesa, __FUNCTION__ );
-
- dma.context = rmesa->dri.hwContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = RADEON_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- LOCK_HARDWARE(rmesa); /* no need to validate */
-
- while (1) {
- ret = drmDMA( fd, &dma );
- if (ret == 0)
- break;
-
- if (rmesa->dma.nr_released_bufs) {
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
- }
-
- if (rmesa->do_usleeps) {
- UNLOCK_HARDWARE( rmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-
- UNLOCK_HARDWARE(rmesa);
-
- if (R200_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Allocated buffer %d\n", index);
-
- dmabuf = CALLOC_STRUCT( r200_dma_buffer );
- dmabuf->buf = &rmesa->r200Screen->buffers->list[index];
- dmabuf->refcount = 1;
-
- rmesa->dma.current.buf = dmabuf;
- rmesa->dma.current.address = dmabuf->buf->address;
- rmesa->dma.current.end = dmabuf->buf->total;
- rmesa->dma.current.start = 0;
- rmesa->dma.current.ptr = 0;
-}
-
-void r200ReleaseDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- const char *caller )
-{
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (!region->buf)
- return;
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (--region->buf->refcount == 0) {
- drm_radeon_cmd_header_t *cmd;
-
- if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s -- DISCARD BUF %d\n", __FUNCTION__,
- region->buf->buf->idx);
-
- cmd = (drm_radeon_cmd_header_t *)r200AllocCmdBuf( rmesa, sizeof(*cmd),
- __FUNCTION__ );
- cmd->dma.cmd_type = RADEON_CMD_DMA_DISCARD;
- cmd->dma.buf_idx = region->buf->buf->idx;
- FREE(region->buf);
- rmesa->dma.nr_released_bufs++;
- }
-
- region->buf = NULL;
- region->start = 0;
-}
-
-/* Allocates a region from rmesa->dma.current. If there isn't enough
- * space in current, grab a new buffer (and discard what was left of current)
- */
-void r200AllocDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int bytes,
- int alignment )
-{
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, bytes);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (region->buf)
- r200ReleaseDmaRegion( rmesa, region, __FUNCTION__ );
-
- alignment--;
- rmesa->dma.current.start = rmesa->dma.current.ptr =
- (rmesa->dma.current.ptr + alignment) & ~alignment;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- r200RefillCurrentDmaRegion( rmesa );
-
- region->start = rmesa->dma.current.start;
- region->ptr = rmesa->dma.current.start;
- region->end = rmesa->dma.current.start + bytes;
- region->address = rmesa->dma.current.address;
- region->buf = rmesa->dma.current.buf;
- region->buf->refcount++;
-
- rmesa->dma.current.ptr += bytes; /* bug - if alignment > 7 */
- rmesa->dma.current.start =
- rmesa->dma.current.ptr = (rmesa->dma.current.ptr + 0x7) & ~0x7;
-
- assert( rmesa->dma.current.ptr <= rmesa->dma.current.end );
-}
-
-void r200AllocDmaRegionVerts( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int numverts,
- int vertsize,
- int alignment )
-{
- r200AllocDmaRegion( rmesa, region, vertsize * numverts, alignment );
-}
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-
-static u_int32_t r200GetLastFrame(r200ContextPtr rmesa)
-{
- drm_radeon_getparam_t gp;
- int ret;
- u_int32_t frame;
-
- gp.param = RADEON_PARAM_LAST_FRAME;
- gp.value = (int *)&frame;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp) );
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- return frame;
-}
-
-static void r200EmitIrqLocked( r200ContextPtr rmesa )
-{
- drm_radeon_irq_emit_t ie;
- int ret;
-
- ie.irq_seq = &rmesa->iw.irq_seq;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_IRQ_EMIT,
- &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonIrqEmit: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void r200WaitIrq( r200ContextPtr rmesa )
-{
- int ret;
-
- do {
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_IRQ_WAIT,
- &rmesa->iw, sizeof(rmesa->iw) );
- } while (ret && (errno == EINTR || errno == EAGAIN));
-
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonIrqWait: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void r200WaitForFrameCompletion( r200ContextPtr rmesa )
-{
- drm_radeon_sarea_t *sarea = rmesa->sarea;
-
- if (rmesa->do_irqs) {
- if (r200GetLastFrame(rmesa) < sarea->last_frame) {
- if (!rmesa->irqsEmitted) {
- while (r200GetLastFrame (rmesa) < sarea->last_frame)
- ;
- }
- else {
- UNLOCK_HARDWARE( rmesa );
- r200WaitIrq( rmesa );
- LOCK_HARDWARE( rmesa );
- }
- rmesa->irqsEmitted = 10;
- }
-
- if (rmesa->irqsEmitted) {
- r200EmitIrqLocked( rmesa );
- rmesa->irqsEmitted--;
- }
- }
- else {
- while (r200GetLastFrame (rmesa) < sarea->last_frame) {
- UNLOCK_HARDWARE( rmesa );
- if (rmesa->do_usleeps)
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-}
-
-
-
-/* Copy the back color buffer to the front color buffer.
- */
-void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- r200ContextPtr rmesa;
- GLint nbox, i, ret;
- GLboolean missed_target;
- int64_t ust;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, (void *)rmesa->glCtx );
- }
-
- R200_FIREVERTICES( rmesa );
-
- LOCK_HARDWARE( rmesa );
-
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- r200WaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- LOCK_HARDWARE( rmesa );
-
- nbox = dPriv->numClipRects; /* must be in locked region */
-
- for ( i = 0 ; i < nbox ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS , nbox );
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- rmesa->sarea->nbox = n;
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP );
-
- if ( ret ) {
- fprintf( stderr, "DRM_R200_SWAP_BUFFERS: return = %d\n", ret );
- UNLOCK_HARDWARE( rmesa );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
- rmesa->hw.all_dirty = GL_TRUE;
-
- rmesa->swap_count++;
- (*dri_interface->getUST)( & ust );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- rmesa->swap_missed_ust = ust - rmesa->swap_ust;
- }
-
- rmesa->swap_ust = ust;
-
- sched_yield();
-}
-
-void r200PageFlip( const __DRIdrawablePrivate *dPriv )
-{
- r200ContextPtr rmesa;
- GLint ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf(stderr, "%s: pfCurrentPage: %d\n", __FUNCTION__,
- rmesa->sarea->pfCurrentPage);
- }
-
- R200_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- if (!dPriv->numClipRects) {
- UNLOCK_HARDWARE( rmesa );
- usleep( 10000 ); /* throttle invisible client 10ms */
- return;
- }
-
- /* Need to do this for the perf box placement:
- */
- {
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- b[0] = box[0];
- rmesa->sarea->nbox = 1;
- }
-
- /* Throttle the frame rate -- only allow a few pending swap buffers
- * request at a time.
- */
- r200WaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust );
- }
- LOCK_HARDWARE( rmesa );
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_FLIP );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_FLIP: return = %d\n", ret );
- exit( 1 );
- }
-
- rmesa->swap_count++;
- (void) (*dri_interface->getUST)( & rmesa->swap_ust );
-
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->r200Screen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
- }
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLuint flags = 0;
- GLuint color_mask = 0;
- GLint ret, i;
-
- if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
- }
-
- {
- LOCK_HARDWARE( rmesa );
- UNLOCK_HARDWARE( rmesa );
- if ( dPriv->numClipRects == 0 )
- return;
- }
-
- r200Flush( ctx );
-
- if ( mask & BUFFER_BIT_FRONT_LEFT ) {
- flags |= RADEON_FRONT;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ( mask & BUFFER_BIT_BACK_LEFT ) {
- flags |= RADEON_BACK;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ( mask & BUFFER_BIT_DEPTH ) {
- flags |= RADEON_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if ( (mask & BUFFER_BIT_STENCIL) && rmesa->state.stencil.hwBuffer ) {
- flags |= RADEON_STENCIL;
- mask &= ~BUFFER_BIT_STENCIL;
- }
-
- if ( mask ) {
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
- }
-
- if ( !flags )
- return;
-
- if (rmesa->using_hyperz) {
- flags |= RADEON_USE_COMP_ZBUF;
-/* if (rmesa->r200Screen->chipset & R200_CHIPSET_REAL_R200)
- flags |= RADEON_USE_HIERZ; */
- if (!(rmesa->state.stencil.hwBuffer) ||
- ((flags & RADEON_DEPTH) && (flags & RADEON_STENCIL) &&
- ((rmesa->state.stencil.clear & R200_STENCIL_WRITE_MASK) == R200_STENCIL_WRITE_MASK))) {
- flags |= RADEON_CLEAR_FASTZ;
- }
- }
-
- /* Flip top to bottom */
- cx += dPriv->x;
- cy = dPriv->y + dPriv->h - cy - ch;
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the number of clear ioctls we do.
- */
- while ( 1 ) {
- drm_radeon_getparam_t gp;
- int ret;
- int clear;
-
- gp.param = RADEON_PARAM_LAST_CLEAR;
- gp.value = (int *)&clear;
- ret = drmCommandWriteRead( rmesa->dri.fd,
- DRM_RADEON_GETPARAM, &gp, sizeof(gp) );
-
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- /* Clear throttling needs more thought.
- */
- if ( rmesa->sarea->last_clear - clear <= 25 ) {
- break;
- }
-
- if (rmesa->do_usleeps) {
- UNLOCK_HARDWARE( rmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-
- /* Send current state to the hardware */
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
-
- for ( i = 0 ; i < dPriv->numClipRects ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, dPriv->numClipRects );
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- drm_radeon_clear_t clear;
- drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- rmesa->sarea->nbox = n;
-
- clear.flags = flags;
- clear.clear_color = rmesa->state.color.clear;
- clear.clear_depth = rmesa->state.depth.clear; /* needed for hyperz */
- clear.color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- clear.depth_mask = rmesa->state.stencil.clear;
- clear.depth_boxes = depth_boxes;
-
- n--;
- b = rmesa->sarea->boxes;
- for ( ; n >= 0 ; n-- ) {
- depth_boxes[n].f[CLEAR_X1] = (float)b[n].x1;
- depth_boxes[n].f[CLEAR_Y1] = (float)b[n].y1;
- depth_boxes[n].f[CLEAR_X2] = (float)b[n].x2;
- depth_boxes[n].f[CLEAR_Y2] = (float)b[n].y2;
- depth_boxes[n].f[CLEAR_DEPTH] = ctx->Depth.Clear;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_CLEAR,
- &clear, sizeof(clear));
-
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_RADEON_CLEAR: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
- rmesa->hw.all_dirty = GL_TRUE;
-}
-
-
-void r200WaitForIdleLocked( r200ContextPtr rmesa )
-{
- int ret;
- int i = 0;
-
- do {
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_CP_IDLE);
- if (ret)
- DO_USLEEP( 1 );
- } while (ret && ++i < 100);
-
- if ( ret < 0 ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: R200 timed out... exiting\n" );
- exit( -1 );
- }
-}
-
-
-static void r200WaitForIdle( r200ContextPtr rmesa )
-{
- LOCK_HARDWARE(rmesa);
- r200WaitForIdleLocked( rmesa );
- UNLOCK_HARDWARE(rmesa);
-}
-
-
-void r200Flush( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- r200EmitState( rmesa );
-
- if (rmesa->store.cmd_used)
- r200FlushCmdBuf( rmesa, __FUNCTION__ );
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-void r200Finish( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200Flush( ctx );
-
- if (rmesa->do_irqs) {
- LOCK_HARDWARE( rmesa );
- r200EmitIrqLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- r200WaitIrq( rmesa );
- }
- else
- r200WaitForIdle( rmesa );
-}
-
-
-/* This version of AllocateMemoryMESA allocates only GART memory, and
- * only does so after the point at which the driver has been
- * initialized.
- *
- * Theoretically a valid context isn't required. However, in this
- * implementation, it is, as I'm using the hardware lock to protect
- * the kernel data structures, and the current context to get the
- * device fd.
- */
-void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size,
- GLfloat readfreq, GLfloat writefreq,
- GLfloat priority)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa;
- int region_offset;
- drm_radeon_mem_alloc_t alloc;
- int ret;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq,
- writefreq, priority);
-
- if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map)
- return NULL;
-
- if (getenv("R200_NO_ALLOC"))
- return NULL;
-
- if (rmesa->dri.drmMinor < 6)
- return NULL;
-
- alloc.region = RADEON_MEM_REGION_GART;
- alloc.alignment = 0;
- alloc.size = size;
- alloc.region_offset = &region_offset;
-
- ret = drmCommandWriteRead( rmesa->r200Screen->driScreen->fd,
- DRM_RADEON_ALLOC,
- &alloc, sizeof(alloc));
-
- if (ret) {
- fprintf(stderr, "%s: DRM_RADEON_ALLOC ret %d\n", __FUNCTION__, ret);
- return NULL;
- }
-
- {
- char *region_start = (char *)rmesa->r200Screen->gartTextures.map;
- return (void *)(region_start + region_offset);
- }
-}
-
-
-/* Called via glXFreeMemoryMESA() */
-void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa;
- ptrdiff_t region_offset;
- drm_radeon_mem_free_t memfree;
- int ret;
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %p\n", __FUNCTION__, pointer);
-
- if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map) {
- fprintf(stderr, "%s: no context\n", __FUNCTION__);
- return;
- }
-
- if (rmesa->dri.drmMinor < 6)
- return;
-
- region_offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
-
- if (region_offset < 0 ||
- region_offset > rmesa->r200Screen->gartTextures.size) {
- fprintf(stderr, "offset %d outside range 0..%d\n", region_offset,
- rmesa->r200Screen->gartTextures.size);
- return;
- }
-
- memfree.region = RADEON_MEM_REGION_GART;
- memfree.region_offset = region_offset;
-
- ret = drmCommandWrite( rmesa->r200Screen->driScreen->fd,
- DRM_RADEON_FREE,
- &memfree, sizeof(memfree));
-
- if (ret)
- fprintf(stderr, "%s: DRM_RADEON_FREE ret %d\n", __FUNCTION__, ret);
-}
-
-/* Called via glXGetMemoryOffsetMESA() */
-GLuint r200GetMemoryOffsetMESA(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa;
- GLuint card_offset;
-
- if (!ctx || !(rmesa = R200_CONTEXT(ctx)) ) {
- fprintf(stderr, "%s: no context\n", __FUNCTION__);
- return ~0;
- }
-
- if (!r200IsGartMemory( rmesa, pointer, 0 ))
- return ~0;
-
- if (rmesa->dri.drmMinor < 6)
- return ~0;
-
- card_offset = r200GartOffsetFromVirtual( rmesa, pointer );
-
- return card_offset - rmesa->r200Screen->gart_base;
-}
-
-GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer,
- GLint size )
-{
- ptrdiff_t offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
- int valid = (size >= 0 &&
- offset >= 0 &&
- offset + size < rmesa->r200Screen->gartTextures.size);
-
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "r200IsGartMemory( %p ) : %d\n", pointer, valid );
-
- return valid;
-}
-
-
-GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa, const GLvoid *pointer )
-{
- ptrdiff_t offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
-
- if (offset < 0 || offset > rmesa->r200Screen->gartTextures.size)
- return ~0;
- else
- return rmesa->r200Screen->gart_texture_offset + offset;
-}
-
-
-
-void r200InitIoctlFuncs( struct dd_function_table *functions )
-{
- functions->Clear = r200Clear;
- functions->Finish = r200Finish;
- functions->Flush = r200Flush;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.h
deleted file mode 100644
index 8927acd7f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_ioctl.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_IOCTL_H__
-#define __R200_IOCTL_H__
-
-#include "simple_list.h"
-#include "radeon_dri.h"
-#include "r200_lock.h"
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "radeon_drm.h"
-
-extern void r200EmitState( r200ContextPtr rmesa );
-extern void r200EmitVertexAOS( r200ContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset );
-
-extern void r200EmitVbufPrim( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint vertex_nr );
-
-extern void r200FlushElts( r200ContextPtr rmesa );
-
-extern GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
- GLuint primitive,
- GLuint min_nr );
-
-extern void r200EmitAOS( r200ContextPtr rmesa,
- struct r200_dma_region **regions,
- GLuint n,
- GLuint offset );
-
-extern void r200EmitBlit( r200ContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h );
-
-extern void r200EmitWait( r200ContextPtr rmesa, GLuint flags );
-
-extern void r200FlushCmdBuf( r200ContextPtr rmesa, const char * );
-extern int r200FlushCmdBufLocked( r200ContextPtr rmesa, const char * caller );
-
-extern void r200RefillCurrentDmaRegion( r200ContextPtr rmesa );
-
-extern void r200AllocDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int bytes,
- int alignment );
-
-extern void r200AllocDmaRegionVerts( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int numverts,
- int vertsize,
- int alignment );
-
-extern void r200ReleaseDmaRegion( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- const char *caller );
-
-extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable );
-extern void r200PageFlip( const __DRIdrawablePrivate *drawable );
-extern void r200Flush( GLcontext *ctx );
-extern void r200Finish( GLcontext *ctx );
-extern void r200WaitForIdleLocked( r200ContextPtr rmesa );
-extern void r200WaitForVBlank( r200ContextPtr rmesa );
-extern void r200InitIoctlFuncs( struct dd_function_table *functions );
-
-extern void *r200AllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLsizei size, GLfloat readfreq,
- GLfloat writefreq, GLfloat priority );
-extern void r200FreeMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLvoid *pointer );
-extern GLuint r200GetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer );
-
-extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer,
- GLint size );
-
-extern GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa,
- const GLvoid *pointer );
-
-void r200SetUpAtomList( r200ContextPtr rmesa );
-
-/* ================================================================
- * Helper macros:
- */
-
-/* Close off the last primitive, if it exists.
- */
-#define R200_NEWPRIM( rmesa ) \
-do { \
- if ( rmesa->dma.flush ) \
- rmesa->dma.flush( rmesa ); \
-} while (0)
-
-/* Can accomodate several state changes and primitive changes without
- * actually firing the buffer.
- */
-#define R200_STATECHANGE( rmesa, ATOM ) \
-do { \
- R200_NEWPRIM( rmesa ); \
- rmesa->hw.ATOM.dirty = GL_TRUE; \
- rmesa->hw.is_dirty = GL_TRUE; \
-} while (0)
-
-#define R200_DB_STATE( ATOM ) \
- memcpy( rmesa->hw.ATOM.lastcmd, rmesa->hw.ATOM.cmd, \
- rmesa->hw.ATOM.cmd_size * 4)
-
-static __inline int R200_DB_STATECHANGE(
- r200ContextPtr rmesa,
- struct r200_state_atom *atom )
-{
- if (memcmp(atom->cmd, atom->lastcmd, atom->cmd_size*4)) {
- int *tmp;
- R200_NEWPRIM( rmesa );
- atom->dirty = GL_TRUE;
- rmesa->hw.is_dirty = GL_TRUE;
- tmp = atom->cmd;
- atom->cmd = atom->lastcmd;
- atom->lastcmd = tmp;
- return 1;
- }
- else
- return 0;
-}
-
-
-/* Fire the buffered vertices no matter what.
- */
-#define R200_FIREVERTICES( rmesa ) \
-do { \
- if ( rmesa->store.cmd_used || rmesa->dma.flush ) { \
- r200Flush( rmesa->glCtx ); \
- } \
-} while (0)
-
-/* Command lengths. Note that any time you ensure ELTS_BUFSZ or VBUF_BUFSZ
- * are available, you will also be adding an rmesa->state.max_state_size because
- * r200EmitState is called from within r200EmitVbufPrim and r200FlushElts.
- */
-#define AOS_BUFSZ(nr) ((3 + ((nr / 2) * 3) + ((nr & 1) * 2)) * sizeof(int))
-#define VERT_AOS_BUFSZ (5 * sizeof(int))
-#define ELTS_BUFSZ(nr) (12 + nr * 2)
-#define VBUF_BUFSZ (3 * sizeof(int))
-
-/* Ensure that a minimum amount of space is available in the command buffer.
- * This is used to ensure atomicity of state updates with the rendering requests
- * that rely on them.
- *
- * An alternative would be to implement a "soft lock" such that when the buffer
- * wraps at an inopportune time, we grab the lock, flush the current buffer,
- * and hang on to the lock until the critical section is finished and we flush
- * the buffer again and unlock.
- */
-static __inline void r200EnsureCmdBufSpace( r200ContextPtr rmesa, int bytes )
-{
- if (rmesa->store.cmd_used + bytes > R200_CMD_BUF_SZ)
- r200FlushCmdBuf( rmesa, __FUNCTION__ );
- assert( bytes <= R200_CMD_BUF_SZ );
-}
-
-/* Alloc space in the command buffer
- */
-static __inline char *r200AllocCmdBuf( r200ContextPtr rmesa,
- int bytes, const char *where )
-{
- char * head;
-
- if (rmesa->store.cmd_used + bytes > R200_CMD_BUF_SZ)
- r200FlushCmdBuf( rmesa, where );
-
- head = rmesa->store.cmd_buf + rmesa->store.cmd_used;
- rmesa->store.cmd_used += bytes;
- assert( rmesa->store.cmd_used <= R200_CMD_BUF_SZ );
- return head;
-}
-
-#endif /* __R200_IOCTL_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.c
deleted file mode 100644
index 9b82c18d1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#include <string.h>
-
-#include "r200_context.h"
-#include "r200_lock.h"
-#include "r200_tex.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-/* Turn on/off page flipping according to the flags in the sarea:
- */
-static void
-r200UpdatePageFlipping( r200ContextPtr rmesa )
-{
- int use_back;
- rmesa->doPageFlip = rmesa->sarea->pfState;
-
- use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
- use_back ^= (rmesa->sarea->pfCurrentPage == 1);
-
- if (use_back) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->r200Screen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-
-
-/* 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 r200GetLock( r200ContextPtr rmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- __DRIscreenPrivate *sPriv = rmesa->dri.screen;
- drm_radeon_sarea_t *sarea = rmesa->sarea;
- int i;
-
- drmGetLock( rmesa->dri.fd, rmesa->dri.hwContext, 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 ( rmesa->lastStamp != dPriv->lastStamp ) {
- r200UpdatePageFlipping( rmesa );
- if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- r200SetCliprects( rmesa, GL_BACK_LEFT );
- else
- r200SetCliprects( rmesa, GL_FRONT_LEFT );
- r200UpdateViewportOffset( rmesa->glCtx );
- rmesa->lastStamp = dPriv->lastStamp;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
- }
- else rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] &= ~R200_COLOR_TILE_ENABLE;
-
- if ( sarea->ctx_owner != rmesa->dri.hwContext ) {
- sarea->ctx_owner = rmesa->dri.hwContext;
- }
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( rmesa->texture_heaps[ i ] );
- }
-
- rmesa->lost_context = GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.h
deleted file mode 100644
index e4c3a7e93..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_lock.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_LOCK_H__
-#define __R200_LOCK_H__
-
-extern void r200GetLock( r200ContextPtr rmesa, 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( rmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( rmesa->dri.hwLock, rmesa->dri.hwContext, \
- (DRM_LOCK_HELD | rmesa->dri.hwContext), __ret ); \
- if ( __ret ) \
- r200GetLock( rmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-#define UNLOCK_HARDWARE( rmesa ) \
- do { \
- DRM_UNLOCK( rmesa->dri.fd, \
- rmesa->dri.hwLock, \
- rmesa->dri.hwContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif /* __R200_LOCK_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.c
deleted file mode 100644
index 23e1c962a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.c
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-/* Currently, can only use arrays, verts are not implemented, though
- * verts are suspected to be faster.
- * To get an idea how the verts path works, look at the radeon implementation.
- */
-#include <string.h>
-
-#include "r200_context.h"
-#define R200_MAOS_VERTS 0
-#if (R200_MAOS_VERTS)
-#include "r200_maos_verts.c"
-#else
-#include "r200_maos_arrays.c"
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.h
deleted file mode 100644
index b9e4d3c23..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_MAOS_H__
-#define __R200_MAOS_H__
-
-#include "r200_context.h"
-
-extern void r200EmitArrays( GLcontext *ctx, GLuint inputs );
-extern void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos_arrays.c
deleted file mode 100644
index 12ea462a4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_maos_arrays.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_swtcl.h"
-#include "r200_maos.h"
-#include "r200_tcl.h"
-
-
-#if 0
-/* Usage:
- * - from r200_tcl_render
- * - call r200EmitArrays to ensure uptodate arrays in dma
- * - emit primitives (new type?) which reference the data
- * -- need to use elts for lineloop, quads, quadstrip/flat
- * -- other primitives are all well-formed (need tristrip-1,fake-poly)
- *
- */
-static void emit_ubyte_rgba3( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- r200_color_t *out = (r200_color_t *)(rvb->start + rvb->address);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p\n",
- __FUNCTION__, count, stride, (void *)out);
-
- for (i = 0; i < count; i++) {
- out->red = *data;
- out->green = *(data+1);
- out->blue = *(data+2);
- out->alpha = 0xFF;
- out++;
- data += stride;
- }
-}
-
-static void emit_ubyte_rgba4( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4) {
- for (i = 0; i < count; i++)
- ((int *)out)[i] = LE32_TO_CPU(((int *)data)[i]);
- } else {
- for (i = 0; i < count; i++) {
- *(int *)out++ = LE32_TO_CPU(*(int *)data);
- data += stride;
- }
- }
-}
-
-
-static void emit_ubyte_rgba( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- r200AllocDmaRegion( rmesa, rvb, 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = 1;
- }
- else {
- r200AllocDmaRegion( rmesa, rvb, 4 * count, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 1;
- rvb->aos_size = 1;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 3:
- emit_ubyte_rgba3( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_ubyte_rgba4( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-}
-#endif
-
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
- : "0" (nr), \
- "D" ((long)dst), \
- "S" ((long)src) ); \
-} while (0)
-#else
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int j; \
- for ( j = 0 ; j < nr ; j++ ) \
- dst[j] = ((int *)src)[j]; \
- dst += nr; \
-} while (0)
-#endif
-
-
-static void emit_vecfog( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- GLfloat *out;
-
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- r200AllocDmaRegion( rmesa, rvb, 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = 1;
- }
- else {
- r200AllocDmaRegion( rmesa, rvb, count * 4, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 1;
- rvb->aos_size = 1;
- }
-
- /* Emit the data
- */
- out = (GLfloat *)(rvb->address + rvb->start);
- for (i = 0; i < count; i++) {
- out[0] = r200ComputeFogBlendFactor( ctx, *(GLfloat *)data );
- out++;
- data += stride;
- }
-
-}
-
-
-static void emit_vec4( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4)
- COPY_DWORDS( out, data, count );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out++;
- data += stride;
- }
-}
-
-
-static void emit_vec8( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 8)
- COPY_DWORDS( out, data, count*2 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out += 2;
- data += stride;
- }
-}
-
-static void emit_vec12( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p data %p\n",
- __FUNCTION__, count, stride, (void *)out, (void *)data);
-
- if (stride == 12)
- COPY_DWORDS( out, data, count*3 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out += 3;
- data += stride;
- }
-}
-
-static void emit_vec16( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 16)
- COPY_DWORDS( out, data, count*4 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out[3] = *(int *)(data+12);
- out += 4;
- data += stride;
- }
-}
-
-
-static void emit_vector( GLcontext *ctx,
- struct r200_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d size %d stride %d\n",
- __FUNCTION__, count, size, stride);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- r200AllocDmaRegion( rmesa, rvb, size * 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = size;
- }
- else {
- r200AllocDmaRegion( rmesa, rvb, size * count * 4, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = size;
- rvb->aos_size = size;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 1:
- emit_vec4( ctx, rvb, data, stride, count );
- break;
- case 2:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 3:
- emit_vec12( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_vec16( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-
-}
-
-
-
-/* Emit any changed arrays to new GART memory, re-emit a packet to
- * update the arrays.
- */
-void r200EmitArrays( GLcontext *ctx, GLuint inputs )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
- struct r200_dma_region **component = rmesa->tcl.aos_components;
- GLuint nr = 0;
- GLuint vfmt0 = 0, vfmt1 = 0;
- GLuint count = VB->Count;
- GLuint i;
-
- if (1) {
- if (!rmesa->tcl.obj.buf)
- emit_vector( ctx,
- &rmesa->tcl.obj,
- (char *)VB->ObjPtr->data,
- VB->ObjPtr->size,
- VB->ObjPtr->stride,
- count);
-
- switch( VB->ObjPtr->size ) {
- case 4: vfmt0 |= R200_VTX_W0;
- case 3: vfmt0 |= R200_VTX_Z0;
- case 2:
- default:
- break;
- }
- component[nr++] = &rmesa->tcl.obj;
- }
-
-
- if (inputs & VERT_BIT_NORMAL) {
- if (!rmesa->tcl.norm.buf)
- emit_vector( ctx,
- &(rmesa->tcl.norm),
- (char *)VB->NormalPtr->data,
- 3,
- VB->NormalPtr->stride,
- count);
-
- vfmt0 |= R200_VTX_N0;
- component[nr++] = &rmesa->tcl.norm;
- }
-
- if (inputs & VERT_BIT_FOG) {
- if (!rmesa->tcl.fog.buf)
- emit_vecfog( ctx,
- &(rmesa->tcl.fog),
- (char *)VB->FogCoordPtr->data,
- VB->FogCoordPtr->stride,
- count);
-
- vfmt0 |= R200_VTX_DISCRETE_FOG;
- component[nr++] = &rmesa->tcl.fog;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- int emitsize;
-
- if (VB->ColorPtr[0]->size == 4 &&
- (VB->ColorPtr[0]->stride != 0 ||
- VB->ColorPtr[0]->data[0][3] != 1.0)) {
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
- emitsize = 4;
- }
- else {
- vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT;
- emitsize = 3;
- }
-
- if (!rmesa->tcl.rgba.buf)
- emit_vector( ctx,
- &(rmesa->tcl.rgba),
- (char *)VB->ColorPtr[0]->data,
- emitsize,
- VB->ColorPtr[0]->stride,
- count);
-
- component[nr++] = &rmesa->tcl.rgba;
- }
-
-
- if (inputs & VERT_BIT_COLOR1) {
- if (!rmesa->tcl.spec.buf) {
- emit_vector( ctx,
- &rmesa->tcl.spec,
- (char *)VB->SecondaryColorPtr[0]->data,
- 3,
- VB->SecondaryColorPtr[0]->stride,
- count);
- }
-
- /* How does this work?
- */
- vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_1_SHIFT;
- component[nr++] = &rmesa->tcl.spec;
- }
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- if (inputs & (VERT_BIT_TEX0 << i)) {
- if (!rmesa->tcl.tex[i].buf)
- emit_vector( ctx,
- &(rmesa->tcl.tex[i]),
- (char *)VB->TexCoordPtr[i]->data,
- VB->TexCoordPtr[i]->size,
- VB->TexCoordPtr[i]->stride,
- count );
-
- vfmt1 |= VB->TexCoordPtr[i]->size << (i * 3);
- component[nr++] = &rmesa->tcl.tex[i];
- }
- }
-
- if (vfmt0 != rmesa->hw.vtx.cmd[VTX_VTXFMT_0] ||
- vfmt1 != rmesa->hw.vtx.cmd[VTX_VTXFMT_1]) {
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = vfmt0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = vfmt1;
- }
-
- rmesa->tcl.nr_aos_components = nr;
- rmesa->tcl.vertex_format = vfmt0;
-}
-
-
-void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
-{
- GLuint unit;
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
-/* if (R200_DEBUG & DEBUG_VERTS) */
-/* _tnl_print_vert_flags( __FUNCTION__, newinputs ); */
-
- if (newinputs & VERT_BIT_POS)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_NORMAL)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_FOG)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.fog, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR0)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR1)
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
-
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
- if (newinputs & VERT_BIT_TEX(unit))
- r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[unit], __FUNCTION__ );
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.c
deleted file mode 100644
index adc6a2aa2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.c,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-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.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "swrast/swrast.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_pixel.h"
-#include "r200_swtcl.h"
-
-
-
-static GLboolean
-check_color( const GLcontext *ctx, GLenum type, GLenum format,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint cpp = rmesa->r200Screen->cpp;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if ( (pitch & 63) ||
- ctx->_ImageTransferState ||
- packing->SwapBytes ||
- packing->LsbFirst) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: failed 1\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV &&
- cpp == 4 &&
- format == GL_BGRA ) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: passed 2\n", __FUNCTION__);
- return GL_TRUE;
- }
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- return GL_FALSE;
-}
-
-static GLboolean
-check_color_per_fragment_ops( const GLcontext *ctx )
-{
- int result;
- result = (!( ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest
- ) &&
- ctx->Current.RasterPosValid);
-
- return result;
-}
-
-
-
-static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height,
- GLint *size )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- *size = ((*y + *height - 1) * rmesa->r200Screen->frontPitch +
- (*x + *width - 1) * rmesa->r200Screen->cpp);
-
- return GL_TRUE;
-}
-
-static GLboolean
-r200TryReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- GLint blit_format;
- GLuint cpp = rmesa->r200Screen->cpp;
- GLint size = width * height * cpp;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Only accelerate reading to GART buffers.
- */
- if ( !r200IsGartMemory(rmesa, pixels,
- pitch * height * rmesa->r200Screen->cpp ) ) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: dest not GART\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Need GL_PACK_INVERT_MESA to cope with upsidedown results from
- * blitter:
- */
- if (!pack->Invert) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: MESA_PACK_INVERT not set\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, pack, pixels, size, pitch))
- return GL_FALSE;
-
- switch ( rmesa->r200Screen->cpp ) {
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return GL_FALSE;
- }
-
-
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects and drawOffset are
- * correct.
- *
- * This is an unusual situation however, as the code which flushes
- * a full command buffer expects to be called unlocked. As a
- * workaround, immediately flush the buffer on aquiring the lock.
- */
- LOCK_HARDWARE( rmesa );
-
- if (rmesa->store.cmd_used)
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
-
- if (!clip_pixelrect(ctx, ctx->ReadBuffer, &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( rmesa );
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s totally clipped -- nothing to do\n",
- __FUNCTION__);
- return GL_TRUE;
- }
-
- {
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- int nbox = dPriv->numClipRects;
- int src_offset = rmesa->state.color.drawOffset
- + rmesa->r200Screen->fbLocation;
- int src_pitch = rmesa->state.color.drawPitch * rmesa->r200Screen->cpp;
- int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels );
- int dst_pitch = pitch * rmesa->r200Screen->cpp;
- drm_clip_rect_t *box = dPriv->pClipRects;
- int i;
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "readpixel blit src_pitch %d dst_pitch %d\n",
- src_pitch, dst_pitch);
-
- for (i = 0 ; i < nbox ; i++)
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- r200EmitBlit( rmesa,
- blit_format,
- src_pitch, src_offset,
- dst_pitch, dst_offset,
- bx, by,
- bx - x, by - y,
- bw, bh );
- }
-
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
- }
- UNLOCK_HARDWARE( rmesa );
-
- r200Finish( ctx ); /* required by GL */
-
- return GL_TRUE;
-}
-
-static void
-r200ReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!r200TryReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels))
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels);
-}
-
-
-
-
-static void do_draw_pix( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint pitch,
- const void *pixels,
- GLuint planemask)
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
- int nbox = dPriv->numClipRects;
- int i;
- int blit_format;
- int size;
- int src_offset = r200GartOffsetFromVirtual( rmesa, pixels );
- int src_pitch = pitch * rmesa->r200Screen->cpp;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch ( rmesa->r200Screen->cpp ) {
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return;
- }
-
-
- LOCK_HARDWARE( rmesa );
-
- if (rmesa->store.cmd_used)
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
-
- y -= height; /* cope with pixel zoom */
-
- if (!clip_pixelrect(ctx, ctx->DrawBuffer,
- &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( rmesa );
- return;
- }
-
- y = dPriv->h - y - height; /* convert from gl to hardware coords */
- x += dPriv->x;
- y += dPriv->y;
-
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- for (i = 0 ; i < nbox ; i++ )
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- r200EmitBlit( rmesa,
- blit_format,
- src_pitch, src_offset,
- rmesa->state.color.drawPitch * rmesa->r200Screen->cpp,
- rmesa->state.color.drawOffset + rmesa->r200Screen->fbLocation,
- bx - x, by - y,
- bx, by,
- bw, bh );
- }
-
- r200FlushCmdBufLocked( rmesa, __FUNCTION__ );
- r200WaitForIdleLocked( rmesa ); /* required by GL */
- UNLOCK_HARDWARE( rmesa );
-}
-
-
-
-
-static GLboolean
-r200TryDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint planemask;
- GLuint cpp = rmesa->r200Screen->cpp;
- GLint size = width * pitch * cpp;
-
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case GL_RGB:
- case GL_RGBA:
- case GL_BGRA:
- planemask = r200PackColor(cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- if (cpp == 2)
- planemask |= planemask << 16;
-
- if (planemask != ~0)
- return GL_FALSE; /* fix me -- should be possible */
-
- /* Can't do conversions on GART reads/draws.
- */
- if ( !r200IsGartMemory( rmesa, pixels, size ) ) {
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: not GART memory\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, unpack, pixels, size, pitch)) {
- return GL_FALSE;
- }
- if (!check_color_per_fragment_ops(ctx)) {
- return GL_FALSE;
- }
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != -1.0F)
- return GL_FALSE;
- break;
-
- default:
- return GL_FALSE;
- }
-
- if ( r200IsGartMemory(rmesa, pixels, size) )
- {
- do_draw_pix( ctx, x, y, width, height, pitch, pixels, planemask );
- return GL_TRUE;
- }
- else if (0)
- {
- /* Pixels is in regular memory -- get dma buffers and perform
- * upload through them.
- */
- }
- else
- return GL_FALSE;
-}
-
-static void
-r200DrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (R200_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!r200TryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-
-
-static void
-r200Bitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->Fallback)
- _swrast_Bitmap( ctx, px, py, width, height, unpack, bitmap );
- else
- r200PointsBitmap( ctx, px, py, width, height, unpack, bitmap );
-}
-
-
-
-void r200InitPixelFuncs( GLcontext *ctx )
-{
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- if (!getenv("R200_NO_BLITS") && R200_CONTEXT(ctx)->dri.drmMinor >= 6) {
- ctx->Driver.ReadPixels = r200ReadPixels;
- ctx->Driver.DrawPixels = r200DrawPixels;
- if (getenv("R200_HW_BITMAP"))
- ctx->Driver.Bitmap = r200Bitmap;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.h
deleted file mode 100644
index 8f3923b6b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_pixel.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_PIXEL_H__
-#define __R200_PIXEL_H__
-
-extern void r200InitPixelFuncs( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_reg.h
deleted file mode 100644
index dd5f17cc3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_reg.h
+++ /dev/null
@@ -1,1454 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_reg.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-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.
-*/
-
-#ifndef _R200_REG_H_
-#define _R200_REG_H_
-
-#define R200_PP_MISC 0x1c14
-#define R200_REF_ALPHA_MASK 0x000000ff
-#define R200_ALPHA_TEST_FAIL (0 << 8)
-#define R200_ALPHA_TEST_LESS (1 << 8)
-#define R200_ALPHA_TEST_LEQUAL (2 << 8)
-#define R200_ALPHA_TEST_EQUAL (3 << 8)
-#define R200_ALPHA_TEST_GEQUAL (4 << 8)
-#define R200_ALPHA_TEST_GREATER (5 << 8)
-#define R200_ALPHA_TEST_NEQUAL (6 << 8)
-#define R200_ALPHA_TEST_PASS (7 << 8)
-#define R200_ALPHA_TEST_OP_MASK (7 << 8)
-#define R200_CHROMA_FUNC_FAIL (0 << 16)
-#define R200_CHROMA_FUNC_PASS (1 << 16)
-#define R200_CHROMA_FUNC_NEQUAL (2 << 16)
-#define R200_CHROMA_FUNC_EQUAL (3 << 16)
-#define R200_CHROMA_KEY_NEAREST (0 << 18)
-#define R200_CHROMA_KEY_ZERO (1 << 18)
-#define R200_RIGHT_HAND_CUBE_D3D (0 << 24)
-#define R200_RIGHT_HAND_CUBE_OGL (1 << 24)
-#define R200_PP_FOG_COLOR 0x1c18
-#define R200_FOG_COLOR_MASK 0x00ffffff
-#define R200_FOG_VERTEX (0 << 24)
-#define R200_FOG_TABLE (1 << 24)
-#define R200_FOG_USE_DEPTH (0 << 25)
-#define R200_FOG_USE_W (1 << 25)
-#define R200_FOG_USE_DIFFUSE_ALPHA (2 << 25)
-#define R200_FOG_USE_SPEC_ALPHA (3 << 25)
-#define R200_FOG_USE_VTX_FOG (4 << 25)
-#define R200_FOG_USE_MASK (7 << 25)
-#define R200_RE_SOLID_COLOR 0x1c1c
-#define R200_RB3D_BLENDCNTL 0x1c20
-#define R200_COMB_FCN_MASK (7 << 12)
-#define R200_COMB_FCN_ADD_CLAMP (0 << 12)
-#define R200_COMB_FCN_ADD_NOCLAMP (1 << 12)
-#define R200_COMB_FCN_SUB_CLAMP (2 << 12)
-#define R200_COMB_FCN_SUB_NOCLAMP (3 << 12)
-#define R200_COMB_FCN_MIN (4 << 12)
-#define R200_COMB_FCN_MAX (5 << 12)
-#define R200_COMB_FCN_RSUB_CLAMP (6 << 12)
-#define R200_COMB_FCN_RSUB_NOCLAMP (7 << 12)
-#define R200_BLEND_GL_ZERO (32)
-#define R200_BLEND_GL_ONE (33)
-#define R200_BLEND_GL_SRC_COLOR (34)
-#define R200_BLEND_GL_ONE_MINUS_SRC_COLOR (35)
-#define R200_BLEND_GL_DST_COLOR (36)
-#define R200_BLEND_GL_ONE_MINUS_DST_COLOR (37)
-#define R200_BLEND_GL_SRC_ALPHA (38)
-#define R200_BLEND_GL_ONE_MINUS_SRC_ALPHA (39)
-#define R200_BLEND_GL_DST_ALPHA (40)
-#define R200_BLEND_GL_ONE_MINUS_DST_ALPHA (41)
-#define R200_BLEND_GL_SRC_ALPHA_SATURATE (42) /* src factor only */
-#define R200_BLEND_GL_CONST_COLOR (43)
-#define R200_BLEND_GL_ONE_MINUS_CONST_COLOR (44)
-#define R200_BLEND_GL_CONST_ALPHA (45)
-#define R200_BLEND_GL_ONE_MINUS_CONST_ALPHA (46)
-#define R200_BLEND_MASK (63)
-#define R200_SRC_BLEND_SHIFT (16)
-#define R200_DST_BLEND_SHIFT (24)
-#define R200_RB3D_DEPTHOFFSET 0x1c24
-#define R200_RB3D_DEPTHPITCH 0x1c28
-#define R200_DEPTHPITCH_MASK 0x00001ff8
-#define R200_DEPTH_HYPERZ (3 << 16)
-#define R200_DEPTH_ENDIAN_NO_SWAP (0 << 18)
-#define R200_DEPTH_ENDIAN_WORD_SWAP (1 << 18)
-#define R200_DEPTH_ENDIAN_DWORD_SWAP (2 << 18)
-#define R200_RB3D_ZSTENCILCNTL 0x1c2c
-#define R200_DEPTH_FORMAT_MASK (0xf << 0)
-#define R200_DEPTH_FORMAT_16BIT_INT_Z (0 << 0)
-#define R200_DEPTH_FORMAT_24BIT_INT_Z (2 << 0)
-#define R200_DEPTH_FORMAT_24BIT_FLOAT_Z (3 << 0)
-#define R200_DEPTH_FORMAT_32BIT_INT_Z (4 << 0)
-#define R200_DEPTH_FORMAT_32BIT_FLOAT_Z (5 << 0)
-#define R200_DEPTH_FORMAT_24BIT_FLOAT_W (9 << 0)
-#define R200_DEPTH_FORMAT_32BIT_FLOAT_W (11 << 0)
-#define R200_Z_TEST_NEVER (0 << 4)
-#define R200_Z_TEST_LESS (1 << 4)
-#define R200_Z_TEST_LEQUAL (2 << 4)
-#define R200_Z_TEST_EQUAL (3 << 4)
-#define R200_Z_TEST_GEQUAL (4 << 4)
-#define R200_Z_TEST_GREATER (5 << 4)
-#define R200_Z_TEST_NEQUAL (6 << 4)
-#define R200_Z_TEST_ALWAYS (7 << 4)
-#define R200_Z_TEST_MASK (7 << 4)
-#define R200_Z_HIERARCHY_ENABLE (1 << 8)
-#define R200_STENCIL_TEST_NEVER (0 << 12)
-#define R200_STENCIL_TEST_LESS (1 << 12)
-#define R200_STENCIL_TEST_LEQUAL (2 << 12)
-#define R200_STENCIL_TEST_EQUAL (3 << 12)
-#define R200_STENCIL_TEST_GEQUAL (4 << 12)
-#define R200_STENCIL_TEST_GREATER (5 << 12)
-#define R200_STENCIL_TEST_NEQUAL (6 << 12)
-#define R200_STENCIL_TEST_ALWAYS (7 << 12)
-#define R200_STENCIL_TEST_MASK (0x7 << 12)
-#define R200_STENCIL_FAIL_KEEP (0 << 16)
-#define R200_STENCIL_FAIL_ZERO (1 << 16)
-#define R200_STENCIL_FAIL_REPLACE (2 << 16)
-#define R200_STENCIL_FAIL_INC (3 << 16)
-#define R200_STENCIL_FAIL_DEC (4 << 16)
-#define R200_STENCIL_FAIL_INVERT (5 << 16)
-#define R200_STENCIL_FAIL_INC_WRAP (6 << 16)
-#define R200_STENCIL_FAIL_DEC_WRAP (7 << 16)
-#define R200_STENCIL_FAIL_MASK (0x7 << 16)
-#define R200_STENCIL_ZPASS_KEEP (0 << 20)
-#define R200_STENCIL_ZPASS_ZERO (1 << 20)
-#define R200_STENCIL_ZPASS_REPLACE (2 << 20)
-#define R200_STENCIL_ZPASS_INC (3 << 20)
-#define R200_STENCIL_ZPASS_DEC (4 << 20)
-#define R200_STENCIL_ZPASS_INVERT (5 << 20)
-#define R200_STENCIL_ZPASS_INC_WRAP (6 << 20)
-#define R200_STENCIL_ZPASS_DEC_WRAP (7 << 20)
-#define R200_STENCIL_ZPASS_MASK (0x7 << 20)
-#define R200_STENCIL_ZFAIL_KEEP (0 << 24)
-#define R200_STENCIL_ZFAIL_ZERO (1 << 24)
-#define R200_STENCIL_ZFAIL_REPLACE (2 << 24)
-#define R200_STENCIL_ZFAIL_INC (3 << 24)
-#define R200_STENCIL_ZFAIL_DEC (4 << 24)
-#define R200_STENCIL_ZFAIL_INVERT (5 << 24)
-#define R200_STENCIL_ZFAIL_INC_WRAP (6 << 24)
-#define R200_STENCIL_ZFAIL_DEC_WRAP (7 << 24)
-#define R200_STENCIL_ZFAIL_MASK (0x7 << 24)
-#define R200_Z_COMPRESSION_ENABLE (1 << 28)
-#define R200_FORCE_Z_DIRTY (1 << 29)
-#define R200_Z_WRITE_ENABLE (1 << 30)
-#define R200_Z_DECOMPRESSION_ENABLE (1 << 31)
-/*gap*/
-#define R200_PP_CNTL 0x1c38
-#define R200_TEX_0_ENABLE 0x00000010
-#define R200_TEX_1_ENABLE 0x00000020
-#define R200_TEX_2_ENABLE 0x00000040
-#define R200_TEX_3_ENABLE 0x00000080
-#define R200_TEX_4_ENABLE 0x00000100
-#define R200_TEX_5_ENABLE 0x00000200
-#define R200_TEX_ENABLE_MASK 0x000003f0
-#define R200_FILTER_ROUND_MODE_MASK 0x00000400
-#define R200_TEX_BLEND_7_ENABLE 0x00000800
-#define R200_TEX_BLEND_0_ENABLE 0x00001000
-#define R200_TEX_BLEND_1_ENABLE 0x00002000
-#define R200_TEX_BLEND_2_ENABLE 0x00004000
-#define R200_TEX_BLEND_3_ENABLE 0x00008000
-#define R200_TEX_BLEND_4_ENABLE 0x00010000
-#define R200_TEX_BLEND_5_ENABLE 0x00020000
-#define R200_TEX_BLEND_6_ENABLE 0x00040000
-#define R200_MULTI_PASS_ENABLE 0x00080000
-#define R200_SPECULAR_ENABLE 0x00200000
-#define R200_FOG_ENABLE 0x00400000
-#define R200_ALPHA_TEST_ENABLE 0x00800000
-#define R200_ANTI_ALIAS_NONE 0x00000000
-#define R200_ANTI_ALIAS_LINE 0x01000000
-#define R200_ANTI_ALIAS_POLY 0x02000000
-#define R200_ANTI_ALIAS_MASK 0x03000000
-#define R200_RB3D_CNTL 0x1c3c
-#define R200_ALPHA_BLEND_ENABLE (1 << 0)
-#define R200_PLANE_MASK_ENABLE (1 << 1)
-#define R200_DITHER_ENABLE (1 << 2)
-#define R200_ROUND_ENABLE (1 << 3)
-#define R200_SCALE_DITHER_ENABLE (1 << 4)
-#define R200_DITHER_INIT (1 << 5)
-#define R200_ROP_ENABLE (1 << 6)
-#define R200_STENCIL_ENABLE (1 << 7)
-#define R200_Z_ENABLE (1 << 8)
-#define R200_DEPTH_XZ_OFFEST_ENABLE (1 << 9)
-#define R200_COLOR_FORMAT_ARGB1555 (3 << 10)
-#define R200_COLOR_FORMAT_RGB565 (4 << 10)
-#define R200_COLOR_FORMAT_ARGB8888 (6 << 10)
-#define R200_COLOR_FORMAT_RGB332 (7 << 10)
-#define R200_COLOR_FORMAT_Y8 (8 << 10)
-#define R200_COLOR_FORMAT_RGB8 (9 << 10)
-#define R200_COLOR_FORMAT_YUV422_VYUY (11 << 10)
-#define R200_COLOR_FORMAT_YUV422_YVYU (12 << 10)
-#define R200_COLOR_FORMAT_aYUV444 (14 << 10)
-#define R200_COLOR_FORMAT_ARGB4444 (15 << 10)
-#define R200_CLRCMP_FLIP_ENABLE (1 << 14)
-#define R200_SEPARATE_ALPHA_ENABLE (1 << 16)
-#define R200_RB3D_COLOROFFSET 0x1c40
-#define R200_COLOROFFSET_MASK 0xfffffff0
-#define R200_RE_WIDTH_HEIGHT 0x1c44
-#define R200_RE_WIDTH_SHIFT 0
-#define R200_RE_HEIGHT_SHIFT 16
-#define R200_RB3D_COLORPITCH 0x1c48
-#define R200_COLORPITCH_MASK 0x000001ff8
-#define R200_COLOR_TILE_ENABLE (1 << 16)
-#define R200_COLOR_MICROTILE_ENABLE (1 << 17)
-#define R200_COLOR_ENDIAN_NO_SWAP (0 << 18)
-#define R200_COLOR_ENDIAN_WORD_SWAP (1 << 18)
-#define R200_COLOR_ENDIAN_DWORD_SWAP (2 << 18)
-#define R200_SE_CNTL 0x1c4c
-#define R200_FFACE_CULL_CW (0 << 0)
-#define R200_FFACE_CULL_CCW (1 << 0)
-#define R200_FFACE_CULL_DIR_MASK (1 << 0)
-#define R200_BFACE_CULL (0 << 1)
-#define R200_BFACE_SOLID (3 << 1)
-#define R200_FFACE_CULL (0 << 3)
-#define R200_FFACE_SOLID (3 << 3)
-#define R200_FFACE_CULL_MASK (3 << 3)
-#define R200_FLAT_SHADE_VTX_0 (0 << 6)
-#define R200_FLAT_SHADE_VTX_1 (1 << 6)
-#define R200_FLAT_SHADE_VTX_2 (2 << 6)
-#define R200_FLAT_SHADE_VTX_LAST (3 << 6)
-#define R200_DIFFUSE_SHADE_SOLID (0 << 8)
-#define R200_DIFFUSE_SHADE_FLAT (1 << 8)
-#define R200_DIFFUSE_SHADE_GOURAUD (2 << 8)
-#define R200_DIFFUSE_SHADE_MASK (3 << 8)
-#define R200_ALPHA_SHADE_SOLID (0 << 10)
-#define R200_ALPHA_SHADE_FLAT (1 << 10)
-#define R200_ALPHA_SHADE_GOURAUD (2 << 10)
-#define R200_ALPHA_SHADE_MASK (3 << 10)
-#define R200_SPECULAR_SHADE_SOLID (0 << 12)
-#define R200_SPECULAR_SHADE_FLAT (1 << 12)
-#define R200_SPECULAR_SHADE_GOURAUD (2 << 12)
-#define R200_SPECULAR_SHADE_MASK (3 << 12)
-#define R200_FOG_SHADE_SOLID (0 << 14)
-#define R200_FOG_SHADE_FLAT (1 << 14)
-#define R200_FOG_SHADE_GOURAUD (2 << 14)
-#define R200_FOG_SHADE_MASK (3 << 14)
-#define R200_ZBIAS_ENABLE_POINT (1 << 16)
-#define R200_ZBIAS_ENABLE_LINE (1 << 17)
-#define R200_ZBIAS_ENABLE_TRI (1 << 18)
-#define R200_WIDELINE_ENABLE (1 << 20)
-#define R200_VTX_PIX_CENTER_D3D (0 << 27)
-#define R200_VTX_PIX_CENTER_OGL (1 << 27)
-#define R200_ROUND_MODE_TRUNC (0 << 28)
-#define R200_ROUND_MODE_ROUND (1 << 28)
-#define R200_ROUND_MODE_ROUND_EVEN (2 << 28)
-#define R200_ROUND_MODE_ROUND_ODD (3 << 28)
-#define R200_ROUND_PREC_16TH_PIX (0 << 30)
-#define R200_ROUND_PREC_8TH_PIX (1 << 30)
-#define R200_ROUND_PREC_4TH_PIX (2 << 30)
-#define R200_ROUND_PREC_HALF_PIX (3 << 30)
-#define R200_RE_CNTL 0x1c50
-#define R200_STIPPLE_ENABLE 0x1
-#define R200_SCISSOR_ENABLE 0x2
-#define R200_PATTERN_ENABLE 0x4
-#define R200_PERSPECTIVE_ENABLE 0x8
-#define R200_POINT_SMOOTH 0x20
-#define R200_VTX_STQ0_D3D 0x00010000
-#define R200_VTX_STQ1_D3D 0x00040000
-#define R200_VTX_STQ2_D3D 0x00100000
-#define R200_VTX_STQ3_D3D 0x00400000
-#define R200_VTX_STQ4_D3D 0x01000000
-#define R200_VTX_STQ5_D3D 0x04000000
-/* gap */
-#define R200_RE_STIPPLE_ADDR 0x1cc8
-#define R200_RE_STIPPLE_DATA 0x1ccc
-#define R200_RE_LINE_PATTERN 0x1cd0
-#define R200_LINE_PATTERN_MASK 0x0000ffff
-#define R200_LINE_REPEAT_COUNT_SHIFT 16
-#define R200_LINE_PATTERN_START_SHIFT 24
-#define R200_LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28)
-#define R200_LINE_PATTERN_BIG_BIT_ORDER (1 << 28)
-#define R200_LINE_PATTERN_AUTO_RESET (1 << 29)
-#define R200_RE_LINE_STATE 0x1cd4
-#define R200_LINE_CURRENT_PTR_SHIFT 0
-#define R200_LINE_CURRENT_COUNT_SHIFT 8
-#define R200_RE_SCISSOR_TL_0 0x1cd8
-#define R200_RE_SCISSOR_BR_0 0x1cdc
-#define R200_RE_SCISSOR_TL_1 0x1ce0
-#define R200_RE_SCISSOR_BR_1 0x1ce4
-#define R200_RE_SCISSOR_TL_2 0x1ce8
-#define R200_RE_SCISSOR_BR_2 0x1cec
-/* gap */
-#define R200_RB3D_DEPTHXY_OFFSET 0x1d60
-#define R200_DEPTHX_SHIFT 0
-#define R200_DEPTHY_SHIFT 16
-/* gap */
-#define R200_RB3D_STENCILREFMASK 0x1d7c
-#define R200_STENCIL_REF_SHIFT 0
-#define R200_STENCIL_REF_MASK (0xff << 0)
-#define R200_STENCIL_MASK_SHIFT 16
-#define R200_STENCIL_VALUE_MASK (0xff << 16)
-#define R200_STENCIL_WRITEMASK_SHIFT 24
-#define R200_STENCIL_WRITE_MASK (0xff << 24)
-#define R200_RB3D_ROPCNTL 0x1d80
-#define R200_ROP_MASK (15 << 8)
-#define R200_ROP_CLEAR (0 << 8)
-#define R200_ROP_NOR (1 << 8)
-#define R200_ROP_AND_INVERTED (2 << 8)
-#define R200_ROP_COPY_INVERTED (3 << 8)
-#define R200_ROP_AND_REVERSE (4 << 8)
-#define R200_ROP_INVERT (5 << 8)
-#define R200_ROP_XOR (6 << 8)
-#define R200_ROP_NAND (7 << 8)
-#define R200_ROP_AND (8 << 8)
-#define R200_ROP_EQUIV (9 << 8)
-#define R200_ROP_NOOP (10 << 8)
-#define R200_ROP_OR_INVERTED (11 << 8)
-#define R200_ROP_COPY (12 << 8)
-#define R200_ROP_OR_REVERSE (13 << 8)
-#define R200_ROP_OR (14 << 8)
-#define R200_ROP_SET (15 << 8)
-#define R200_RB3D_PLANEMASK 0x1d84
-/* gap */
-#define R200_SE_VPORT_XSCALE 0x1d98
-#define R200_SE_VPORT_XOFFSET 0x1d9c
-#define R200_SE_VPORT_YSCALE 0x1da0
-#define R200_SE_VPORT_YOFFSET 0x1da4
-#define R200_SE_VPORT_ZSCALE 0x1da8
-#define R200_SE_VPORT_ZOFFSET 0x1dac
-#define R200_SE_ZBIAS_FACTOR 0x1db0
-#define R200_SE_ZBIAS_CONSTANT 0x1db4
-#define R200_SE_LINE_WIDTH 0x1db8
-#define R200_LINE_WIDTH_SHIFT 0x00000000
-#define R200_MINPOINTSIZE_SHIFT 0x00000010
-/* gap */
-#define R200_SE_VAP_CNTL 0x2080
-#define R200_VAP_TCL_ENABLE 0x00000001
-#define R200_VAP_SINGLE_BUF_STATE_ENABLE 0x00000010
-#define R200_VAP_FORCE_W_TO_ONE 0x00010000
-#define R200_VAP_D3D_TEX_DEFAULT 0x00020000
-#define R200_VAP_VF_MAX_VTX_NUM__SHIFT 18
-#define R200_VAP_DX_CLIP_SPACE_DEF 0x00400000
-#define R200_SE_VF_CNTL 0x2084
-#define R200_VF_PRIM_NONE 0x00000000
-#define R200_VF_PRIM_POINTS 0x00000001
-#define R200_VF_PRIM_LINES 0x00000002
-#define R200_VF_PRIM_LINE_STRIP 0x00000003
-#define R200_VF_PRIM_TRIANGLES 0x00000004
-#define R200_VF_PRIM_TRIANGLE_FAN 0x00000005
-#define R200_VF_PRIM_TRIANGLE_STRIP 0x00000006
-#define R200_VF_PRIM_RECT_LIST 0x00000008
-#define R200_VF_PRIM_3VRT_POINTS 0x00000009
-#define R200_VF_PRIM_3VRT_LINES 0x0000000a
-#define R200_VF_PRIM_POINT_SPRITES 0x0000000b
-#define R200_VF_PRIM_LINE_LOOP 0x0000000c
-#define R200_VF_PRIM_QUADS 0x0000000d
-#define R200_VF_PRIM_QUAD_STRIP 0x0000000e
-#define R200_VF_PRIM_POLYGON 0x0000000f
-#define R200_VF_PRIM_MASK 0x0000000f
-#define R200_VF_PRIM_WALK_IND 0x00000010
-#define R200_VF_PRIM_WALK_LIST 0x00000020
-#define R200_VF_PRIM_WALK_RING 0x00000030
-#define R200_VF_PRIM_WALK_MASK 0x00000030
-#define R200_VF_COLOR_ORDER_RGBA 0x00000040
-#define R200_VF_TCL_OUTPUT_VTX_ENABLE 0x00000200
-#define R200_VF_INDEX_SZ_4 0x00000800
-#define R200_VF_VERTEX_NUMBER_MASK 0xffff0000
-#define R200_VF_VERTEX_NUMBER_SHIFT 16
-#define R200_SE_VTX_FMT_0 0x2088
-#define R200_VTX_XY 0 /* always have xy */
-#define R200_VTX_Z0 (1<<0)
-#define R200_VTX_W0 (1<<1)
-#define R200_VTX_WEIGHT_COUNT_SHIFT (2)
-#define R200_VTX_PV_MATRIX_SEL (1<<5)
-#define R200_VTX_N0 (1<<6)
-#define R200_VTX_POINT_SIZE (1<<7)
-#define R200_VTX_DISCRETE_FOG (1<<8)
-#define R200_VTX_SHININESS_0 (1<<9)
-#define R200_VTX_SHININESS_1 (1<<10)
-#define R200_VTX_COLOR_NOT_PRESENT 0
-#define R200_VTX_PK_RGBA 1
-#define R200_VTX_FP_RGB 2
-#define R200_VTX_FP_RGBA 3
-#define R200_VTX_COLOR_MASK 3
-#define R200_VTX_COLOR_0_SHIFT 11
-#define R200_VTX_COLOR_1_SHIFT 13
-#define R200_VTX_COLOR_2_SHIFT 15
-#define R200_VTX_COLOR_3_SHIFT 17
-#define R200_VTX_COLOR_4_SHIFT 19
-#define R200_VTX_COLOR_5_SHIFT 21
-#define R200_VTX_COLOR_6_SHIFT 23
-#define R200_VTX_COLOR_7_SHIFT 25
-#define R200_VTX_XY1 (1<<28)
-#define R200_VTX_Z1 (1<<29)
-#define R200_VTX_W1 (1<<30)
-#define R200_VTX_N1 (1<<31)
-#define R200_SE_VTX_FMT_1 0x208c
-#define R200_VTX_TEX0_COMP_CNT_SHIFT 0
-#define R200_VTX_TEX1_COMP_CNT_SHIFT 3
-#define R200_VTX_TEX2_COMP_CNT_SHIFT 6
-#define R200_VTX_TEX3_COMP_CNT_SHIFT 9
-#define R200_VTX_TEX4_COMP_CNT_SHIFT 12
-#define R200_VTX_TEX5_COMP_CNT_SHIFT 15
-#define R200_SE_TCL_OUTPUT_VTX_FMT_0 0x2090
-#define R200_SE_TCL_OUTPUT_VTX_FMT_1 0x2094
-/* gap */
-#define R200_SE_VTE_CNTL 0x20b0
-#define R200_VPORT_X_SCALE_ENA 0x00000001
-#define R200_VPORT_X_OFFSET_ENA 0x00000002
-#define R200_VPORT_Y_SCALE_ENA 0x00000004
-#define R200_VPORT_Y_OFFSET_ENA 0x00000008
-#define R200_VPORT_Z_SCALE_ENA 0x00000010
-#define R200_VPORT_Z_OFFSET_ENA 0x00000020
-#define R200_VTX_XY_FMT 0x00000100
-#define R200_VTX_Z_FMT 0x00000200
-#define R200_VTX_W0_FMT 0x00000400
-#define R200_VTX_W0_NORMALIZE 0x00000800
-#define R200_VTX_ST_DENORMALIZED 0x00001000
-/* gap */
-#define R200_SE_VTX_NUM_ARRAYS 0x20c0
-#define R200_SE_VTX_AOS_ATTR01 0x20c4
-#define R200_SE_VTX_AOS_ADDR0 0x20c8
-#define R200_SE_VTX_AOS_ADDR1 0x20cc
-#define R200_SE_VTX_AOS_ATTR23 0x20d0
-#define R200_SE_VTX_AOS_ADDR2 0x20d4
-#define R200_SE_VTX_AOS_ADDR3 0x20d8
-#define R200_SE_VTX_AOS_ATTR45 0x20dc
-#define R200_SE_VTX_AOS_ADDR4 0x20e0
-#define R200_SE_VTX_AOS_ADDR5 0x20e4
-#define R200_SE_VTX_AOS_ATTR67 0x20e8
-#define R200_SE_VTX_AOS_ADDR6 0x20ec
-#define R200_SE_VTX_AOS_ADDR7 0x20f0
-#define R200_SE_VTX_AOS_ATTR89 0x20f4
-#define R200_SE_VTX_AOS_ADDR8 0x20f8
-#define R200_SE_VTX_AOS_ADDR9 0x20fc
-#define R200_SE_VTX_AOS_ATTR1011 0x2100
-#define R200_SE_VTX_AOS_ADDR10 0x2104
-#define R200_SE_VTX_AOS_ADDR11 0x2108
-#define R200_SE_VF_MAX_VTX_INDX 0x210c
-#define R200_SE_VF_MIN_VTX_INDX 0x2110
-/* gap */
-#define R200_SE_VAP_CNTL_STATUS 0x2140
-#define R200_VC_NO_SWAP (0 << 0)
-#define R200_VC_16BIT_SWAP (1 << 0)
-#define R200_VC_32BIT_SWAP (2 << 0)
-/* gap */
-#define R200_SE_VTX_STATE_CNTL 0x2180
-#define R200_VSC_COLOR_0_ASSEMBLY_CNTL_SHIFT 0x00000000
-#define R200_VSC_COLOR_1_ASSEMBLY_CNTL_SHIFT 0x00000002
-#define R200_VSC_COLOR_2_ASSEMBLY_CNTL_SHIFT 0x00000004
-#define R200_VSC_COLOR_3_ASSEMBLY_CNTL_SHIFT 0x00000006
-#define R200_VSC_COLOR_4_ASSEMBLY_CNTL_SHIFT 0x00000008
-#define R200_VSC_COLOR_5_ASSEMBLY_CNTL_SHIFT 0x0000000a
-#define R200_VSC_COLOR_6_ASSEMBLY_CNTL_SHIFT 0x0000000c
-#define R200_VSC_COLOR_7_ASSEMBLY_CNTL_SHIFT 0x0000000e
-#define R200_VSC_UPDATE_USER_COLOR_0_ENABLE 0x00010000
-#define R200_VSC_UPDATE_USER_COLOR_1_ENABLE 0x00020000
-/* gap */
-#define R200_SE_TCL_VECTOR_INDX_REG 0x2200
-#define R200_SE_TCL_VECTOR_DATA_REG 0x2204
-#define R200_SE_TCL_SCALAR_INDX_REG 0x2208
-#define R200_SE_TCL_SCALAR_DATA_REG 0x220c
-/* gap */
-#define R200_SE_TCL_MATRIX_SEL_0 0x2230
-#define R200_MODELVIEW_0_SHIFT (0)
-#define R200_MODELVIEW_1_SHIFT (8)
-#define R200_MODELVIEW_2_SHIFT (16)
-#define R200_MODELVIEW_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_1 0x2234
-#define R200_IT_MODELVIEW_0_SHIFT (0)
-#define R200_IT_MODELVIEW_1_SHIFT (8)
-#define R200_IT_MODELVIEW_2_SHIFT (16)
-#define R200_IT_MODELVIEW_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_2 0x2238
-#define R200_MODELPROJECT_0_SHIFT (0)
-#define R200_MODELPROJECT_1_SHIFT (8)
-#define R200_MODELPROJECT_2_SHIFT (16)
-#define R200_MODELPROJECT_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_3 0x223c
-#define R200_TEXMAT_0_SHIFT 0
-#define R200_TEXMAT_1_SHIFT 8
-#define R200_TEXMAT_2_SHIFT 16
-#define R200_TEXMAT_3_SHIFT 24
-#define R200_SE_TCL_MATRIX_SEL_4 0x2240
-#define R200_TEXMAT_4_SHIFT 0
-#define R200_TEXMAT_5_SHIFT 8
-/* gap */
-#define R200_SE_TCL_OUTPUT_VTX_COMP_SEL 0x2250
-#define R200_OUTPUT_XYZW (1<<0)
-#define R200_OUTPUT_COLOR_0 (1<<8)
-#define R200_OUTPUT_COLOR_1 (1<<9)
-#define R200_OUTPUT_TEX_0 (1<<16)
-#define R200_OUTPUT_TEX_1 (1<<17)
-#define R200_OUTPUT_TEX_2 (1<<18)
-#define R200_OUTPUT_TEX_3 (1<<19)
-#define R200_OUTPUT_TEX_4 (1<<20)
-#define R200_OUTPUT_TEX_5 (1<<21)
-#define R200_OUTPUT_TEX_MASK (0x3f<<16)
-#define R200_OUTPUT_DISCRETE_FOG (1<<24)
-#define R200_OUTPUT_PT_SIZE (1<<25)
-#define R200_FORCE_INORDER_PROC (1<<31)
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0 0x2254
-#define R200_VERTEX_POSITION_ADDR__SHIFT 0x00000000
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_1 0x2258
-#define R200_VTX_COLOR_0_ADDR__SHIFT 0x00000000
-#define R200_VTX_COLOR_1_ADDR__SHIFT 0x00000008
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_2 0x225c
-#define R200_VTX_TEX_0_ADDR__SHIFT 0x00000000
-#define R200_VTX_TEX_1_ADDR__SHIFT 0x00000008
-#define R200_VTX_TEX_2_ADDR__SHIFT 0x00000010
-#define R200_VTX_TEX_3_ADDR__SHIFT 0x00000018
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_3 0x2260
-#define R200_VTX_TEX_4_ADDR__SHIFT 0x00000000
-#define R200_VTX_TEX_5_ADDR__SHIFT 0x00000008
-
-/* gap */
-#define R200_SE_TCL_LIGHT_MODEL_CTL_0 0x2268
-#define R200_LIGHTING_ENABLE (1<<0)
-#define R200_LIGHT_IN_MODELSPACE (1<<1)
-#define R200_LOCAL_VIEWER (1<<2)
-#define R200_NORMALIZE_NORMALS (1<<3)
-#define R200_RESCALE_NORMALS (1<<4)
-#define R200_SPECULAR_LIGHTS (1<<5)
-#define R200_DIFFUSE_SPECULAR_COMBINE (1<<6)
-#define R200_LIGHT_ALPHA (1<<7)
-#define R200_LOCAL_LIGHT_VEC_GL (1<<8)
-#define R200_LIGHT_NO_NORMAL_AMBIENT_ONLY (1<<9)
-#define R200_LIGHT_TWOSIDE (1<<10)
-#define R200_FRONT_SHININESS_SOURCE_SHIFT (0xb)
-#define R200_BACK_SHININESS_SOURCE_SHIFT (0xd)
-#define R200_LM0_SOURCE_MATERIAL_0 (0)
-#define R200_LM0_SOURCE_MATERIAL_1 (1)
-#define R200_LM0_SOURCE_VERTEX_SHININESS_0 (2)
-#define R200_LM0_SOURCE_VERTEX_SHININESS_1 (3)
-#define R200_SE_TCL_LIGHT_MODEL_CTL_1 0x226c
-#define R200_LM1_SOURCE_LIGHT_PREMULT (0)
-#define R200_LM1_SOURCE_MATERIAL_0 (1)
-#define R200_LM1_SOURCE_VERTEX_COLOR_0 (2)
-#define R200_LM1_SOURCE_VERTEX_COLOR_1 (3)
-#define R200_LM1_SOURCE_VERTEX_COLOR_2 (4)
-#define R200_LM1_SOURCE_VERTEX_COLOR_3 (5)
-#define R200_LM1_SOURCE_VERTEX_COLOR_4 (6)
-#define R200_LM1_SOURCE_VERTEX_COLOR_5 (7)
-#define R200_LM1_SOURCE_VERTEX_COLOR_6 (8)
-#define R200_LM1_SOURCE_VERTEX_COLOR_7 (9)
-#define R200_LM1_SOURCE_MATERIAL_1 (0xf)
-#define R200_FRONT_EMISSIVE_SOURCE_SHIFT (0)
-#define R200_FRONT_AMBIENT_SOURCE_SHIFT (4)
-#define R200_FRONT_DIFFUSE_SOURCE_SHIFT (8)
-#define R200_FRONT_SPECULAR_SOURCE_SHIFT (12)
-#define R200_BACK_EMISSIVE_SOURCE_SHIFT (16)
-#define R200_BACK_AMBIENT_SOURCE_SHIFT (20)
-#define R200_BACK_DIFFUSE_SOURCE_SHIFT (24)
-#define R200_BACK_SPECULAR_SOURCE_SHIFT (28)
-#define R200_SE_TCL_PER_LIGHT_CTL_0 0x2270
-#define R200_LIGHT_0_ENABLE (1<<0)
-#define R200_LIGHT_0_ENABLE_AMBIENT (1<<1)
-#define R200_LIGHT_0_ENABLE_SPECULAR (1<<2)
-#define R200_LIGHT_0_IS_LOCAL (1<<3)
-#define R200_LIGHT_0_IS_SPOT (1<<4)
-#define R200_LIGHT_0_DUAL_CONE (1<<5)
-#define R200_LIGHT_0_ENABLE_RANGE_ATTEN (1<<6)
-#define R200_LIGHT_0_CONSTANT_RANGE_ATTEN (1<<7)
-#define R200_LIGHT_1_ENABLE (1<<16)
-#define R200_LIGHT_1_ENABLE_AMBIENT (1<<17)
-#define R200_LIGHT_1_ENABLE_SPECULAR (1<<18)
-#define R200_LIGHT_1_IS_LOCAL (1<<19)
-#define R200_LIGHT_1_IS_SPOT (1<<20)
-#define R200_LIGHT_1_DUAL_CONE (1<<21)
-#define R200_LIGHT_1_ENABLE_RANGE_ATTEN (1<<22)
-#define R200_LIGHT_1_CONSTANT_RANGE_ATTEN (1<<23)
-#define R200_LIGHT_0_SHIFT (0)
-#define R200_LIGHT_1_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_1 0x2274
-#define R200_LIGHT_2_SHIFT (0)
-#define R200_LIGHT_3_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_2 0x2278
-#define R200_LIGHT_4_SHIFT (0)
-#define R200_LIGHT_5_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_3 0x227c
-#define R200_LIGHT_6_SHIFT (0)
-#define R200_LIGHT_7_SHIFT (16)
-/* gap */
-#define R200_SE_TCL_TEX_PROC_CTL_2 0x22a8
-#define R200_TEXGEN_COMP_MASK (0xf)
-#define R200_TEXGEN_COMP_S (0x1)
-#define R200_TEXGEN_COMP_T (0x2)
-#define R200_TEXGEN_COMP_R (0x4)
-#define R200_TEXGEN_COMP_Q (0x8)
-#define R200_TEXGEN_0_COMP_MASK_SHIFT (0)
-#define R200_TEXGEN_1_COMP_MASK_SHIFT (4)
-#define R200_TEXGEN_2_COMP_MASK_SHIFT (8)
-#define R200_TEXGEN_3_COMP_MASK_SHIFT (12)
-#define R200_TEXGEN_4_COMP_MASK_SHIFT (16)
-#define R200_TEXGEN_5_COMP_MASK_SHIFT (20)
-#define R200_SE_TCL_TEX_PROC_CTL_3 0x22ac
-#define R200_TEXGEN_0_INPUT_TEX_SHIFT (0)
-#define R200_TEXGEN_1_INPUT_TEX_SHIFT (4)
-#define R200_TEXGEN_2_INPUT_TEX_SHIFT (8)
-#define R200_TEXGEN_3_INPUT_TEX_SHIFT (12)
-#define R200_TEXGEN_4_INPUT_TEX_SHIFT (16)
-#define R200_TEXGEN_5_INPUT_TEX_SHIFT (20)
-#define R200_SE_TCL_TEX_PROC_CTL_0 0x22b0
-#define R200_TEXGEN_TEXMAT_0_ENABLE (1<<0)
-#define R200_TEXGEN_TEXMAT_1_ENABLE (1<<1)
-#define R200_TEXGEN_TEXMAT_2_ENABLE (1<<2)
-#define R200_TEXGEN_TEXMAT_3_ENABLE (1<<3)
-#define R200_TEXGEN_TEXMAT_4_ENABLE (1<<4)
-#define R200_TEXGEN_TEXMAT_5_ENABLE (1<<5)
-#define R200_TEXMAT_0_ENABLE (1<<8)
-#define R200_TEXMAT_1_ENABLE (1<<9)
-#define R200_TEXMAT_2_ENABLE (1<<10)
-#define R200_TEXMAT_3_ENABLE (1<<11)
-#define R200_TEXMAT_4_ENABLE (1<<12)
-#define R200_TEXMAT_5_ENABLE (1<<13)
-#define R200_TEXGEN_FORCE_W_TO_ONE (1<<16)
-#define R200_SE_TCL_TEX_PROC_CTL_1 0x22b4
-#define R200_TEXGEN_INPUT_MASK (0xf)
-#define R200_TEXGEN_INPUT_TEXCOORD_0 (0)
-#define R200_TEXGEN_INPUT_TEXCOORD_1 (1)
-#define R200_TEXGEN_INPUT_TEXCOORD_2 (2)
-#define R200_TEXGEN_INPUT_TEXCOORD_3 (3)
-#define R200_TEXGEN_INPUT_TEXCOORD_4 (4)
-#define R200_TEXGEN_INPUT_TEXCOORD_5 (5)
-#define R200_TEXGEN_INPUT_OBJ (8)
-#define R200_TEXGEN_INPUT_EYE (9)
-#define R200_TEXGEN_INPUT_EYE_NORMAL (0xa)
-#define R200_TEXGEN_INPUT_EYE_REFLECT (0xb)
-#define R200_TEXGEN_INPUT_SPHERE (0xd)
-#define R200_TEXGEN_0_INPUT_SHIFT (0)
-#define R200_TEXGEN_1_INPUT_SHIFT (4)
-#define R200_TEXGEN_2_INPUT_SHIFT (8)
-#define R200_TEXGEN_3_INPUT_SHIFT (12)
-#define R200_TEXGEN_4_INPUT_SHIFT (16)
-#define R200_TEXGEN_5_INPUT_SHIFT (20)
-#define R200_SE_TC_TEX_CYL_WRAP_CTL 0x22b8
-/* gap */
-#define R200_SE_TCL_UCP_VERT_BLEND_CTL 0x22c0
-#define R200_UCP_IN_CLIP_SPACE (1<<0)
-#define R200_UCP_IN_MODEL_SPACE (1<<1)
-#define R200_UCP_ENABLE_0 (1<<2)
-#define R200_UCP_ENABLE_1 (1<<3)
-#define R200_UCP_ENABLE_2 (1<<4)
-#define R200_UCP_ENABLE_3 (1<<5)
-#define R200_UCP_ENABLE_4 (1<<6)
-#define R200_UCP_ENABLE_5 (1<<7)
-#define R200_TCL_FOG_MASK (3<<8)
-#define R200_TCL_FOG_DISABLE (0<<8)
-#define R200_TCL_FOG_EXP (1<<8)
-#define R200_TCL_FOG_EXP2 (2<<8)
-#define R200_TCL_FOG_LINEAR (3<<8)
-#define R200_RNG_BASED_FOG (1<<10)
-#define R200_CLIP_DISABLE (1<<11)
-#define R200_CULL_FRONT_IS_CW (0<<28)
-#define R200_CULL_FRONT_IS_CCW (1<<28)
-#define R200_CULL_FRONT (1<<29)
-#define R200_CULL_BACK (1<<30)
-#define R200_SE_TCL_POINT_SPRITE_CNTL 0x22c4
-#define R200_POINTSIZE_SEL_STATE (1<<16)
-/* gap */
-#define R200_SE_VTX_ST_POS_0_X_4 0x2300
-#define R200_SE_VTX_ST_POS_0_Y_4 0x2304
-#define R200_SE_VTX_ST_POS_0_Z_4 0x2308
-#define R200_SE_VTX_ST_POS_0_W_4 0x230c
-#define R200_SE_VTX_ST_NORM_0_X 0x2310
-#define R200_SE_VTX_ST_NORM_0_Y 0x2314
-#define R200_SE_VTX_ST_NORM_0_Z 0x2318
-#define R200_SE_VTX_ST_PVMS 0x231c
-#define R200_SE_VTX_ST_CLR_0_R 0x2320
-#define R200_SE_VTX_ST_CLR_0_G 0x2324
-#define R200_SE_VTX_ST_CLR_0_B 0x2328
-#define R200_SE_VTX_ST_CLR_0_A 0x232c
-#define R200_SE_VTX_ST_CLR_1_R 0x2330
-#define R200_SE_VTX_ST_CLR_1_G 0x2334
-#define R200_SE_VTX_ST_CLR_1_B 0x2338
-#define R200_SE_VTX_ST_CLR_1_A 0x233c
-#define R200_SE_VTX_ST_CLR_2_R 0x2340
-#define R200_SE_VTX_ST_CLR_2_G 0x2344
-#define R200_SE_VTX_ST_CLR_2_B 0x2348
-#define R200_SE_VTX_ST_CLR_2_A 0x234c
-#define R200_SE_VTX_ST_CLR_3_R 0x2350
-#define R200_SE_VTX_ST_CLR_3_G 0x2354
-#define R200_SE_VTX_ST_CLR_3_B 0x2358
-#define R200_SE_VTX_ST_CLR_3_A 0x235c
-#define R200_SE_VTX_ST_CLR_4_R 0x2360
-#define R200_SE_VTX_ST_CLR_4_G 0x2364
-#define R200_SE_VTX_ST_CLR_4_B 0x2368
-#define R200_SE_VTX_ST_CLR_4_A 0x236c
-#define R200_SE_VTX_ST_CLR_5_R 0x2370
-#define R200_SE_VTX_ST_CLR_5_G 0x2374
-#define R200_SE_VTX_ST_CLR_5_B 0x2378
-#define R200_SE_VTX_ST_CLR_5_A 0x237c
-#define R200_SE_VTX_ST_CLR_6_R 0x2380
-#define R200_SE_VTX_ST_CLR_6_G 0x2384
-#define R200_SE_VTX_ST_CLR_6_B 0x2388
-#define R200_SE_VTX_ST_CLR_6_A 0x238c
-#define R200_SE_VTX_ST_CLR_7_R 0x2390
-#define R200_SE_VTX_ST_CLR_7_G 0x2394
-#define R200_SE_VTX_ST_CLR_7_B 0x2398
-#define R200_SE_VTX_ST_CLR_7_A 0x239c
-#define R200_SE_VTX_ST_TEX_0_S 0x23a0
-#define R200_SE_VTX_ST_TEX_0_T 0x23a4
-#define R200_SE_VTX_ST_TEX_0_R 0x23a8
-#define R200_SE_VTX_ST_TEX_0_Q 0x23ac
-#define R200_SE_VTX_ST_TEX_1_S 0x23b0
-#define R200_SE_VTX_ST_TEX_1_T 0x23b4
-#define R200_SE_VTX_ST_TEX_1_R 0x23b8
-#define R200_SE_VTX_ST_TEX_1_Q 0x23bc
-#define R200_SE_VTX_ST_TEX_2_S 0x23c0
-#define R200_SE_VTX_ST_TEX_2_T 0x23c4
-#define R200_SE_VTX_ST_TEX_2_R 0x23c8
-#define R200_SE_VTX_ST_TEX_2_Q 0x23cc
-#define R200_SE_VTX_ST_TEX_3_S 0x23d0
-#define R200_SE_VTX_ST_TEX_3_T 0x23d4
-#define R200_SE_VTX_ST_TEX_3_R 0x23d8
-#define R200_SE_VTX_ST_TEX_3_Q 0x23dc
-#define R200_SE_VTX_ST_TEX_4_S 0x23e0
-#define R200_SE_VTX_ST_TEX_4_T 0x23e4
-#define R200_SE_VTX_ST_TEX_4_R 0x23e8
-#define R200_SE_VTX_ST_TEX_4_Q 0x23ec
-#define R200_SE_VTX_ST_TEX_5_S 0x23f0
-#define R200_SE_VTX_ST_TEX_5_T 0x23f4
-#define R200_SE_VTX_ST_TEX_5_R 0x23f8
-#define R200_SE_VTX_ST_TEX_5_Q 0x23fc
-#define R200_SE_VTX_ST_PNT_SPRT_SZ 0x2400
-#define R200_SE_VTX_ST_DISC_FOG 0x2404
-#define R200_SE_VTX_ST_SHININESS_0 0x2408
-#define R200_SE_VTX_ST_SHININESS_1 0x240c
-#define R200_SE_VTX_ST_BLND_WT_0 0x2410
-#define R200_SE_VTX_ST_BLND_WT_1 0x2414
-#define R200_SE_VTX_ST_BLND_WT_2 0x2418
-#define R200_SE_VTX_ST_BLND_WT_3 0x241c
-#define R200_SE_VTX_ST_POS_1_X 0x2420
-#define R200_SE_VTX_ST_POS_1_Y 0x2424
-#define R200_SE_VTX_ST_POS_1_Z 0x2428
-#define R200_SE_VTX_ST_POS_1_W 0x242c
-#define R200_SE_VTX_ST_NORM_1_X 0x2430
-#define R200_SE_VTX_ST_NORM_1_Y 0x2434
-#define R200_SE_VTX_ST_NORM_1_Z 0x2438
-#define R200_SE_VTX_ST_USR_CLR_0_R 0x2440
-#define R200_SE_VTX_ST_USR_CLR_0_G 0x2444
-#define R200_SE_VTX_ST_USR_CLR_0_B 0x2448
-#define R200_SE_VTX_ST_USR_CLR_0_A 0x244c
-#define R200_SE_VTX_ST_USR_CLR_1_R 0x2450
-#define R200_SE_VTX_ST_USR_CLR_1_G 0x2454
-#define R200_SE_VTX_ST_USR_CLR_1_B 0x2458
-#define R200_SE_VTX_ST_USR_CLR_1_A 0x245c
-#define R200_SE_VTX_ST_CLR_0_PKD 0x2460
-#define R200_SE_VTX_ST_CLR_1_PKD 0x2464
-#define R200_SE_VTX_ST_CLR_2_PKD 0x2468
-#define R200_SE_VTX_ST_CLR_3_PKD 0x246c
-#define R200_SE_VTX_ST_CLR_4_PKD 0x2470
-#define R200_SE_VTX_ST_CLR_5_PKD 0x2474
-#define R200_SE_VTX_ST_CLR_6_PKD 0x2478
-#define R200_SE_VTX_ST_CLR_7_PKD 0x247c
-#define R200_SE_VTX_ST_POS_0_X_2 0x2480
-#define R200_SE_VTX_ST_POS_0_Y_2 0x2484
-#define R200_SE_VTX_ST_PAR_CLR_LD 0x2488
-#define R200_SE_VTX_ST_USR_CLR_PKD 0x248c
-#define R200_SE_VTX_ST_POS_0_X_3 0x2490
-#define R200_SE_VTX_ST_POS_0_Y_3 0x2494
-#define R200_SE_VTX_ST_POS_0_Z_3 0x2498
-#define R200_SE_VTX_ST_END_OF_PKT 0x249c
-/* gap */
-#define R200_RE_POINTSIZE 0x2648
-#define R200_POINTSIZE_SHIFT 0
-#define R200_MAXPOINTSIZE_SHIFT 16
-/* gap */
-#define R200_RE_TOP_LEFT 0x26c0
-#define R200_RE_LEFT_SHIFT 0
-#define R200_RE_TOP_SHIFT 16
-#define R200_RE_MISC 0x26c4
-#define R200_STIPPLE_COORD_MASK 0x1f
-#define R200_STIPPLE_X_OFFSET_SHIFT 0
-#define R200_STIPPLE_X_OFFSET_MASK (0x1f << 0)
-#define R200_STIPPLE_Y_OFFSET_SHIFT 8
-#define R200_STIPPLE_Y_OFFSET_MASK (0x1f << 8)
-#define R200_STIPPLE_LITTLE_BIT_ORDER (0 << 16)
-#define R200_STIPPLE_BIG_BIT_ORDER (1 << 16)
-/* gap */
-#define R200_RE_AUX_SCISSOR_CNTL 0x26f0
-#define R200_EXCLUSIVE_SCISSOR_0 0x01000000
-#define R200_EXCLUSIVE_SCISSOR_1 0x02000000
-#define R200_EXCLUSIVE_SCISSOR_2 0x04000000
-#define R200_SCISSOR_ENABLE_0 0x10000000
-#define R200_SCISSOR_ENABLE_1 0x20000000
-#define R200_SCISSOR_ENABLE_2 0x40000000
-/* gap */
-#define R200_PP_TXFILTER_0 0x2c00
-#define R200_MAG_FILTER_NEAREST (0 << 0)
-#define R200_MAG_FILTER_LINEAR (1 << 0)
-#define R200_MAG_FILTER_MASK (1 << 0)
-#define R200_MIN_FILTER_NEAREST (0 << 1)
-#define R200_MIN_FILTER_LINEAR (1 << 1)
-#define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
-#define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
-#define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
-#define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST (8 << 1)
-#define R200_MIN_FILTER_ANISO_LINEAR (9 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
-#define R200_MIN_FILTER_MASK (15 << 1)
-#define R200_MAX_ANISO_1_TO_1 (0 << 5)
-#define R200_MAX_ANISO_2_TO_1 (1 << 5)
-#define R200_MAX_ANISO_4_TO_1 (2 << 5)
-#define R200_MAX_ANISO_8_TO_1 (3 << 5)
-#define R200_MAX_ANISO_16_TO_1 (4 << 5)
-#define R200_MAX_ANISO_MASK (7 << 5)
-#define R200_MAX_MIP_LEVEL_MASK (0x0f << 16)
-#define R200_MAX_MIP_LEVEL_SHIFT 16
-#define R200_YUV_TO_RGB (1 << 20)
-#define R200_YUV_TEMPERATURE_COOL (0 << 21)
-#define R200_YUV_TEMPERATURE_HOT (1 << 21)
-#define R200_YUV_TEMPERATURE_MASK (1 << 21)
-#define R200_WRAPEN_S (1 << 22)
-#define R200_CLAMP_S_WRAP (0 << 23)
-#define R200_CLAMP_S_MIRROR (1 << 23)
-#define R200_CLAMP_S_CLAMP_LAST (2 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
-#define R200_CLAMP_S_CLAMP_BORDER (4 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
-#define R200_CLAMP_S_CLAMP_GL (6 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
-#define R200_CLAMP_S_MASK (7 << 23)
-#define R200_WRAPEN_T (1 << 26)
-#define R200_CLAMP_T_WRAP (0 << 27)
-#define R200_CLAMP_T_MIRROR (1 << 27)
-#define R200_CLAMP_T_CLAMP_LAST (2 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
-#define R200_CLAMP_T_CLAMP_BORDER (4 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
-#define R200_CLAMP_T_CLAMP_GL (6 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
-#define R200_CLAMP_T_MASK (7 << 27)
-#define R200_KILL_LT_ZERO (1 << 30)
-#define R200_BORDER_MODE_OGL (0 << 31)
-#define R200_BORDER_MODE_D3D (1 << 31)
-#define R200_PP_TXFORMAT_0 0x2c04
-#define R200_TXFORMAT_I8 (0 << 0)
-#define R200_TXFORMAT_AI88 (1 << 0)
-#define R200_TXFORMAT_RGB332 (2 << 0)
-#define R200_TXFORMAT_ARGB1555 (3 << 0)
-#define R200_TXFORMAT_RGB565 (4 << 0)
-#define R200_TXFORMAT_ARGB4444 (5 << 0)
-#define R200_TXFORMAT_ARGB8888 (6 << 0)
-#define R200_TXFORMAT_RGBA8888 (7 << 0)
-#define R200_TXFORMAT_Y8 (8 << 0)
-#define R200_TXFORMAT_AVYU4444 (9 << 0)
-#define R200_TXFORMAT_VYUY422 (10 << 0)
-#define R200_TXFORMAT_YVYU422 (11 << 0)
-#define R200_TXFORMAT_DXT1 (12 << 0)
-#define R200_TXFORMAT_DXT23 (14 << 0)
-#define R200_TXFORMAT_DXT45 (15 << 0)
-#define R200_TXFORMAT_DVDU88 (18 << 0)
-#define R200_TXFORMAT_LDVDU655 (19 << 0)
-#define R200_TXFORMAT_LDVDU8888 (20 << 0)
-#define R200_TXFORMAT_GR1616 (21 << 0)
-#define R200_TXFORMAT_ABGR8888 (22 << 0)
-#define R200_TXFORMAT_BGR111110 (23 << 0)
-#define R200_TXFORMAT_FORMAT_MASK (31 << 0)
-#define R200_TXFORMAT_FORMAT_SHIFT 0
-#define R200_TXFORMAT_APPLE_YUV (1 << 5)
-#define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6)
-#define R200_TXFORMAT_NON_POWER2 (1 << 7)
-#define R200_TXFORMAT_WIDTH_MASK (15 << 8)
-#define R200_TXFORMAT_WIDTH_SHIFT 8
-#define R200_TXFORMAT_HEIGHT_MASK (15 << 12)
-#define R200_TXFORMAT_HEIGHT_SHIFT 12
-#define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */
-#define R200_TXFORMAT_F5_WIDTH_SHIFT 16
-#define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
-#define R200_TXFORMAT_F5_HEIGHT_SHIFT 20
-#define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
-#define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
-#define R200_TXFORMAT_ST_ROUTE_SHIFT 24
-#define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27)
-#define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
-#define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
-#define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
-#define R200_PP_TXFORMAT_X_0 0x2c08
-#define R200_DEPTH_LOG2_MASK (0xf << 0)
-#define R200_DEPTH_LOG2_SHIFT 0
-#define R200_VOLUME_FILTER_SHIFT 4
-#define R200_VOLUME_FILTER_MASK (1 << 4)
-#define R200_VOLUME_FILTER_NEAREST (0 << 4)
-#define R200_VOLUME_FILTER_LINEAR (1 << 4)
-#define R200_WRAPEN_Q (1 << 8)
-#define R200_CLAMP_Q_WRAP (0 << 9)
-#define R200_CLAMP_Q_MIRROR (1 << 9)
-#define R200_CLAMP_Q_CLAMP_LAST (2 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_LAST (3 << 9)
-#define R200_CLAMP_Q_CLAMP_BORDER (4 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_BORDER (5 << 9)
-#define R200_CLAMP_Q_CLAMP_GL (6 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_GL (7 << 9)
-#define R200_CLAMP_Q_MASK (7 << 9)
-#define R200_MIN_MIP_LEVEL_MASK (0xff << 12)
-#define R200_MIN_MIP_LEVEL_SHIFT 12
-#define R200_TEXCOORD_NONPROJ (0 << 16)
-#define R200_TEXCOORD_CUBIC_ENV (1 << 16)
-#define R200_TEXCOORD_VOLUME (2 << 16)
-#define R200_TEXCOORD_PROJ (3 << 16)
-#define R200_TEXCOORD_DEPTH (4 << 16)
-#define R200_TEXCOORD_1D_PROJ (5 << 16)
-#define R200_TEXCOORD_1D (6 << 16)
-#define R200_TEXCOORD_ZERO (7 << 16)
-#define R200_TEXCOORD_MASK (7 << 16)
-#define R200_LOD_BIAS_MASK (0xfff80000)
-#define R200_LOD_BIAS_SHIFT 19
-#define R200_PP_TXSIZE_0 0x2c0c /* NPOT only */
-#define R200_PP_TXPITCH_0 0x2c10 /* NPOT only */
-#define R200_PP_BORDER_COLOR_0 0x2c14
-#define R200_PP_CUBIC_FACES_0 0x2c18
-#define R200_FACE_WIDTH_1_SHIFT 0
-#define R200_FACE_HEIGHT_1_SHIFT 4
-#define R200_FACE_WIDTH_1_MASK (0xf << 0)
-#define R200_FACE_HEIGHT_1_MASK (0xf << 4)
-#define R200_FACE_WIDTH_2_SHIFT 8
-#define R200_FACE_HEIGHT_2_SHIFT 12
-#define R200_FACE_WIDTH_2_MASK (0xf << 8)
-#define R200_FACE_HEIGHT_2_MASK (0xf << 12)
-#define R200_FACE_WIDTH_3_SHIFT 16
-#define R200_FACE_HEIGHT_3_SHIFT 20
-#define R200_FACE_WIDTH_3_MASK (0xf << 16)
-#define R200_FACE_HEIGHT_3_MASK (0xf << 20)
-#define R200_FACE_WIDTH_4_SHIFT 24
-#define R200_FACE_HEIGHT_4_SHIFT 28
-#define R200_FACE_WIDTH_4_MASK (0xf << 24)
-#define R200_FACE_HEIGHT_4_MASK (0xf << 28)
-#define R200_PP_TXFILTER_1 0x2c20
-#define R200_PP_TXFORMAT_1 0x2c24
-#define R200_PP_TXFORMAT_X_1 0x2c28
-#define R200_PP_TXSIZE_1 0x2c2c
-#define R200_PP_TXPITCH_1 0x2c30
-#define R200_PP_BORDER_COLOR_1 0x2c34
-#define R200_PP_CUBIC_FACES_1 0x2c38
-#define R200_PP_TXFILTER_2 0x2c40
-#define R200_PP_TXFORMAT_2 0x2c44
-#define R200_PP_TXSIZE_2 0x2c4c
-#define R200_PP_TXFORMAT_X_2 0x2c48
-#define R200_PP_TXPITCH_2 0x2c50
-#define R200_PP_BORDER_COLOR_2 0x2c54
-#define R200_PP_CUBIC_FACES_2 0x2c58
-#define R200_PP_TXFILTER_3 0x2c60
-#define R200_PP_TXFORMAT_3 0x2c64
-#define R200_PP_TXSIZE_3 0x2c6c
-#define R200_PP_TXFORMAT_X_3 0x2c68
-#define R200_PP_TXPITCH_3 0x2c70
-#define R200_PP_BORDER_COLOR_3 0x2c74
-#define R200_PP_CUBIC_FACES_3 0x2c78
-#define R200_PP_TXFILTER_4 0x2c80
-#define R200_PP_TXFORMAT_4 0x2c84
-#define R200_PP_TXSIZE_4 0x2c8c
-#define R200_PP_TXFORMAT_X_4 0x2c88
-#define R200_PP_TXPITCH_4 0x2c90
-#define R200_PP_BORDER_COLOR_4 0x2c94
-#define R200_PP_CUBIC_FACES_4 0x2c98
-#define R200_PP_TXFILTER_5 0x2ca0
-#define R200_PP_TXFORMAT_5 0x2ca4
-#define R200_PP_TXSIZE_5 0x2cac
-#define R200_PP_TXFORMAT_X_5 0x2ca8
-#define R200_PP_TXPITCH_5 0x2cb0
-#define R200_PP_BORDER_COLOR_5 0x2cb4
-#define R200_PP_CUBIC_FACES_5 0x2cb8
-/* gap */
-#define R200_PP_CNTL_X 0x2cc4
-/* gap */
-#define R200_PP_TRI_PERF 0x2cf8
-#define R200_TRI_CUTOFF_MASK (0x1f << 0)
-#define R200_PP_PERF_CNTL 0x2cfc
-#define R200_PP_TXOFFSET_0 0x2d00
-#define R200_TXO_ENDIAN_NO_SWAP (0 << 0)
-#define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0)
-#define R200_TXO_ENDIAN_WORD_SWAP (2 << 0)
-#define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
-#define R200_TXO_MACRO_TILE (1 << 2)
-#define R200_TXO_MICRO_TILE (1 << 3)
-#define R200_TXO_OFFSET_MASK 0xffffffe0
-#define R200_TXO_OFFSET_SHIFT 5
-#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04
-#define R200_PP_CUBIC_OFFSET_F2_0 0x2d08
-#define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c
-#define R200_PP_CUBIC_OFFSET_F4_0 0x2d10
-#define R200_PP_CUBIC_OFFSET_F5_0 0x2d14
-#define R200_PP_TXOFFSET_1 0x2d18
-#define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c
-#define R200_PP_CUBIC_OFFSET_F2_1 0x2d20
-#define R200_PP_CUBIC_OFFSET_F3_1 0x2d24
-#define R200_PP_CUBIC_OFFSET_F4_1 0x2d28
-#define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c
-#define R200_PP_TXOFFSET_2 0x2d30
-#define R200_PP_CUBIC_OFFSET_F1_2 0x2d34
-#define R200_PP_CUBIC_OFFSET_F2_2 0x2d38
-#define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c
-#define R200_PP_CUBIC_OFFSET_F4_2 0x2d40
-#define R200_PP_CUBIC_OFFSET_F5_2 0x2d44
-#define R200_PP_TXOFFSET_3 0x2d48
-#define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c
-#define R200_PP_CUBIC_OFFSET_F2_3 0x2d50
-#define R200_PP_CUBIC_OFFSET_F3_3 0x2d54
-#define R200_PP_CUBIC_OFFSET_F4_3 0x2d58
-#define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c
-#define R200_PP_TXOFFSET_4 0x2d60
-#define R200_PP_CUBIC_OFFSET_F1_4 0x2d64
-#define R200_PP_CUBIC_OFFSET_F2_4 0x2d68
-#define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c
-#define R200_PP_CUBIC_OFFSET_F4_4 0x2d70
-#define R200_PP_CUBIC_OFFSET_F5_4 0x2d74
-#define R200_PP_TXOFFSET_5 0x2d78
-#define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c
-#define R200_PP_CUBIC_OFFSET_F2_5 0x2d80
-#define R200_PP_CUBIC_OFFSET_F3_5 0x2d84
-#define R200_PP_CUBIC_OFFSET_F4_5 0x2d88
-#define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c
-/* gap */
-#define R200_PP_TAM_DEBUG3 0x2d9c
-/* gap */
-#define R200_PP_TFACTOR_0 0x2ee0
-#define R200_PP_TFACTOR_1 0x2ee4
-#define R200_PP_TFACTOR_2 0x2ee8
-#define R200_PP_TFACTOR_3 0x2eec
-#define R200_PP_TFACTOR_4 0x2ef0
-#define R200_PP_TFACTOR_5 0x2ef4
-/* gap */
-#define R200_PP_TXCBLEND_0 0x2f00
-#define R200_TXC_ARG_A_ZERO (0)
-#define R200_TXC_ARG_A_CURRENT_COLOR (2)
-#define R200_TXC_ARG_A_CURRENT_ALPHA (3)
-#define R200_TXC_ARG_A_DIFFUSE_COLOR (4)
-#define R200_TXC_ARG_A_DIFFUSE_ALPHA (5)
-#define R200_TXC_ARG_A_SPECULAR_COLOR (6)
-#define R200_TXC_ARG_A_SPECULAR_ALPHA (7)
-#define R200_TXC_ARG_A_TFACTOR_COLOR (8)
-#define R200_TXC_ARG_A_TFACTOR_ALPHA (9)
-#define R200_TXC_ARG_A_R0_COLOR (10)
-#define R200_TXC_ARG_A_R0_ALPHA (11)
-#define R200_TXC_ARG_A_R1_COLOR (12)
-#define R200_TXC_ARG_A_R1_ALPHA (13)
-#define R200_TXC_ARG_A_R2_COLOR (14)
-#define R200_TXC_ARG_A_R2_ALPHA (15)
-#define R200_TXC_ARG_A_R3_COLOR (16)
-#define R200_TXC_ARG_A_R3_ALPHA (17)
-#define R200_TXC_ARG_A_R4_COLOR (18)
-#define R200_TXC_ARG_A_R4_ALPHA (19)
-#define R200_TXC_ARG_A_R5_COLOR (20)
-#define R200_TXC_ARG_A_R5_ALPHA (21)
-#define R200_TXC_ARG_A_TFACTOR1_COLOR (26)
-#define R200_TXC_ARG_A_TFACTOR1_ALPHA (27)
-#define R200_TXC_ARG_A_MASK (31 << 0)
-#define R200_TXC_ARG_A_SHIFT 0
-#define R200_TXC_ARG_B_ZERO (0<<5)
-#define R200_TXC_ARG_B_CURRENT_COLOR (2<<5)
-#define R200_TXC_ARG_B_CURRENT_ALPHA (3<<5)
-#define R200_TXC_ARG_B_DIFFUSE_COLOR (4<<5)
-#define R200_TXC_ARG_B_DIFFUSE_ALPHA (5<<5)
-#define R200_TXC_ARG_B_SPECULAR_COLOR (6<<5)
-#define R200_TXC_ARG_B_SPECULAR_ALPHA (7<<5)
-#define R200_TXC_ARG_B_TFACTOR_COLOR (8<<5)
-#define R200_TXC_ARG_B_TFACTOR_ALPHA (9<<5)
-#define R200_TXC_ARG_B_R0_COLOR (10<<5)
-#define R200_TXC_ARG_B_R0_ALPHA (11<<5)
-#define R200_TXC_ARG_B_R1_COLOR (12<<5)
-#define R200_TXC_ARG_B_R1_ALPHA (13<<5)
-#define R200_TXC_ARG_B_R2_COLOR (14<<5)
-#define R200_TXC_ARG_B_R2_ALPHA (15<<5)
-#define R200_TXC_ARG_B_R3_COLOR (16<<5)
-#define R200_TXC_ARG_B_R3_ALPHA (17<<5)
-#define R200_TXC_ARG_B_R4_COLOR (18<<5)
-#define R200_TXC_ARG_B_R4_ALPHA (19<<5)
-#define R200_TXC_ARG_B_R5_COLOR (20<<5)
-#define R200_TXC_ARG_B_R5_ALPHA (21<<5)
-#define R200_TXC_ARG_B_TFACTOR1_COLOR (26<<5)
-#define R200_TXC_ARG_B_TFACTOR1_ALPHA (27<<5)
-#define R200_TXC_ARG_B_MASK (31 << 5)
-#define R200_TXC_ARG_B_SHIFT 5
-#define R200_TXC_ARG_C_ZERO (0<<10)
-#define R200_TXC_ARG_C_CURRENT_COLOR (2<<10)
-#define R200_TXC_ARG_C_CURRENT_ALPHA (3<<10)
-#define R200_TXC_ARG_C_DIFFUSE_COLOR (4<<10)
-#define R200_TXC_ARG_C_DIFFUSE_ALPHA (5<<10)
-#define R200_TXC_ARG_C_SPECULAR_COLOR (6<<10)
-#define R200_TXC_ARG_C_SPECULAR_ALPHA (7<<10)
-#define R200_TXC_ARG_C_TFACTOR_COLOR (8<<10)
-#define R200_TXC_ARG_C_TFACTOR_ALPHA (9<<10)
-#define R200_TXC_ARG_C_R0_COLOR (10<<10)
-#define R200_TXC_ARG_C_R0_ALPHA (11<<10)
-#define R200_TXC_ARG_C_R1_COLOR (12<<10)
-#define R200_TXC_ARG_C_R1_ALPHA (13<<10)
-#define R200_TXC_ARG_C_R2_COLOR (14<<10)
-#define R200_TXC_ARG_C_R2_ALPHA (15<<10)
-#define R200_TXC_ARG_C_R3_COLOR (16<<10)
-#define R200_TXC_ARG_C_R3_ALPHA (17<<10)
-#define R200_TXC_ARG_C_R4_COLOR (18<<10)
-#define R200_TXC_ARG_C_R4_ALPHA (19<<10)
-#define R200_TXC_ARG_C_R5_COLOR (20<<10)
-#define R200_TXC_ARG_C_R5_ALPHA (21<<10)
-#define R200_TXC_ARG_C_TFACTOR1_COLOR (26<<10)
-#define R200_TXC_ARG_C_TFACTOR1_ALPHA (27<<10)
-#define R200_TXC_ARG_C_MASK (31 << 10)
-#define R200_TXC_ARG_C_SHIFT 10
-#define R200_TXC_COMP_ARG_A (1 << 16)
-#define R200_TXC_COMP_ARG_A_SHIFT (16)
-#define R200_TXC_BIAS_ARG_A (1 << 17)
-#define R200_TXC_SCALE_ARG_A (1 << 18)
-#define R200_TXC_NEG_ARG_A (1 << 19)
-#define R200_TXC_COMP_ARG_B (1 << 20)
-#define R200_TXC_COMP_ARG_B_SHIFT (20)
-#define R200_TXC_BIAS_ARG_B (1 << 21)
-#define R200_TXC_SCALE_ARG_B (1 << 22)
-#define R200_TXC_NEG_ARG_B (1 << 23)
-#define R200_TXC_COMP_ARG_C (1 << 24)
-#define R200_TXC_COMP_ARG_C_SHIFT (24)
-#define R200_TXC_BIAS_ARG_C (1 << 25)
-#define R200_TXC_SCALE_ARG_C (1 << 26)
-#define R200_TXC_NEG_ARG_C (1 << 27)
-#define R200_TXC_OP_MADD (0 << 28)
-#define R200_TXC_OP_CND0 (2 << 28)
-#define R200_TXC_OP_LERP (3 << 28)
-#define R200_TXC_OP_DOT3 (4 << 28)
-#define R200_TXC_OP_DOT4 (5 << 28)
-#define R200_TXC_OP_CONDITIONAL (6 << 28)
-#define R200_TXC_OP_DOT2_ADD (7 << 28)
-#define R200_TXC_OP_MASK (7 << 28)
-#define R200_PP_TXCBLEND2_0 0x2f04
-#define R200_TXC_TFACTOR_SEL_SHIFT 0
-#define R200_TXC_TFACTOR_SEL_MASK 0x7
-#define R200_TXC_TFACTOR1_SEL_SHIFT 4
-#define R200_TXC_TFACTOR1_SEL_MASK (0x7 << 4)
-#define R200_TXC_SCALE_SHIFT 8
-#define R200_TXC_SCALE_MASK (7 << 8)
-#define R200_TXC_SCALE_1X (0 << 8)
-#define R200_TXC_SCALE_2X (1 << 8)
-#define R200_TXC_SCALE_4X (2 << 8)
-#define R200_TXC_SCALE_8X (3 << 8)
-#define R200_TXC_SCALE_INV2 (5 << 8)
-#define R200_TXC_SCALE_INV4 (6 << 8)
-#define R200_TXC_SCALE_INV8 (7 << 8)
-#define R200_TXC_CLAMP_SHIFT 12
-#define R200_TXC_CLAMP_MASK (3 << 12)
-#define R200_TXC_CLAMP_WRAP (0 << 12)
-#define R200_TXC_CLAMP_0_1 (1 << 12)
-#define R200_TXC_CLAMP_8_8 (2 << 12)
-#define R200_TXC_OUTPUT_REG_MASK (7 << 16)
-#define R200_TXC_OUTPUT_REG_NONE (0 << 16)
-#define R200_TXC_OUTPUT_REG_R0 (1 << 16)
-#define R200_TXC_OUTPUT_REG_R1 (2 << 16)
-#define R200_TXC_OUTPUT_REG_R2 (3 << 16)
-#define R200_TXC_OUTPUT_REG_R3 (4 << 16)
-#define R200_TXC_OUTPUT_REG_R4 (5 << 16)
-#define R200_TXC_OUTPUT_REG_R5 (6 << 16)
-#define R200_TXC_OUTPUT_MASK_MASK (7 << 20)
-#define R200_TXC_OUTPUT_MASK_RGB (0 << 20)
-#define R200_TXC_OUTPUT_MASK_RG (1 << 20)
-#define R200_TXC_OUTPUT_MASK_RB (2 << 20)
-#define R200_TXC_OUTPUT_MASK_R (3 << 20)
-#define R200_TXC_OUTPUT_MASK_GB (4 << 20)
-#define R200_TXC_OUTPUT_MASK_G (5 << 20)
-#define R200_TXC_OUTPUT_MASK_B (6 << 20)
-#define R200_TXC_OUTPUT_MASK_NONE (7 << 20)
-#define R200_TXC_REPL_NORMAL 0
-#define R200_TXC_REPL_RED 1
-#define R200_TXC_REPL_GREEN 2
-#define R200_TXC_REPL_BLUE 3
-#define R200_TXC_REPL_ARG_A_SHIFT 26
-#define R200_TXC_REPL_ARG_A_MASK (3 << 26)
-#define R200_TXC_REPL_ARG_B_SHIFT 28
-#define R200_TXC_REPL_ARG_B_MASK (3 << 28)
-#define R200_TXC_REPL_ARG_C_SHIFT 30
-#define R200_TXC_REPL_ARG_C_MASK (3 << 30)
-#define R200_PP_TXABLEND_0 0x2f08
-#define R200_TXA_ARG_A_ZERO (0)
-#define R200_TXA_ARG_A_CURRENT_ALPHA (2) /* guess */
-#define R200_TXA_ARG_A_CURRENT_BLUE (3) /* guess */
-#define R200_TXA_ARG_A_DIFFUSE_ALPHA (4)
-#define R200_TXA_ARG_A_DIFFUSE_BLUE (5)
-#define R200_TXA_ARG_A_SPECULAR_ALPHA (6)
-#define R200_TXA_ARG_A_SPECULAR_BLUE (7)
-#define R200_TXA_ARG_A_TFACTOR_ALPHA (8)
-#define R200_TXA_ARG_A_TFACTOR_BLUE (9)
-#define R200_TXA_ARG_A_R0_ALPHA (10)
-#define R200_TXA_ARG_A_R0_BLUE (11)
-#define R200_TXA_ARG_A_R1_ALPHA (12)
-#define R200_TXA_ARG_A_R1_BLUE (13)
-#define R200_TXA_ARG_A_R2_ALPHA (14)
-#define R200_TXA_ARG_A_R2_BLUE (15)
-#define R200_TXA_ARG_A_R3_ALPHA (16)
-#define R200_TXA_ARG_A_R3_BLUE (17)
-#define R200_TXA_ARG_A_R4_ALPHA (18)
-#define R200_TXA_ARG_A_R4_BLUE (19)
-#define R200_TXA_ARG_A_R5_ALPHA (20)
-#define R200_TXA_ARG_A_R5_BLUE (21)
-#define R200_TXA_ARG_A_TFACTOR1_ALPHA (26)
-#define R200_TXA_ARG_A_TFACTOR1_BLUE (27)
-#define R200_TXA_ARG_A_MASK (31 << 0)
-#define R200_TXA_ARG_A_SHIFT 0
-#define R200_TXA_ARG_B_ZERO (0<<5)
-#define R200_TXA_ARG_B_CURRENT_ALPHA (2<<5) /* guess */
-#define R200_TXA_ARG_B_CURRENT_BLUE (3<<5) /* guess */
-#define R200_TXA_ARG_B_DIFFUSE_ALPHA (4<<5)
-#define R200_TXA_ARG_B_DIFFUSE_BLUE (5<<5)
-#define R200_TXA_ARG_B_SPECULAR_ALPHA (6<<5)
-#define R200_TXA_ARG_B_SPECULAR_BLUE (7<<5)
-#define R200_TXA_ARG_B_TFACTOR_ALPHA (8<<5)
-#define R200_TXA_ARG_B_TFACTOR_BLUE (9<<5)
-#define R200_TXA_ARG_B_R0_ALPHA (10<<5)
-#define R200_TXA_ARG_B_R0_BLUE (11<<5)
-#define R200_TXA_ARG_B_R1_ALPHA (12<<5)
-#define R200_TXA_ARG_B_R1_BLUE (13<<5)
-#define R200_TXA_ARG_B_R2_ALPHA (14<<5)
-#define R200_TXA_ARG_B_R2_BLUE (15<<5)
-#define R200_TXA_ARG_B_R3_ALPHA (16<<5)
-#define R200_TXA_ARG_B_R3_BLUE (17<<5)
-#define R200_TXA_ARG_B_R4_ALPHA (18<<5)
-#define R200_TXA_ARG_B_R4_BLUE (19<<5)
-#define R200_TXA_ARG_B_R5_ALPHA (20<<5)
-#define R200_TXA_ARG_B_R5_BLUE (21<<5)
-#define R200_TXA_ARG_B_TFACTOR1_ALPHA (26<<5)
-#define R200_TXA_ARG_B_TFACTOR1_BLUE (27<<5)
-#define R200_TXA_ARG_B_MASK (31 << 5)
-#define R200_TXA_ARG_B_SHIFT 5
-#define R200_TXA_ARG_C_ZERO (0<<10)
-#define R200_TXA_ARG_C_CURRENT_ALPHA (2<<10) /* guess */
-#define R200_TXA_ARG_C_CURRENT_BLUE (3<<10) /* guess */
-#define R200_TXA_ARG_C_DIFFUSE_ALPHA (4<<10)
-#define R200_TXA_ARG_C_DIFFUSE_BLUE (5<<10)
-#define R200_TXA_ARG_C_SPECULAR_ALPHA (6<<10)
-#define R200_TXA_ARG_C_SPECULAR_BLUE (7<<10)
-#define R200_TXA_ARG_C_TFACTOR_ALPHA (8<<10)
-#define R200_TXA_ARG_C_TFACTOR_BLUE (9<<10)
-#define R200_TXA_ARG_C_R0_ALPHA (10<<10)
-#define R200_TXA_ARG_C_R0_BLUE (11<<10)
-#define R200_TXA_ARG_C_R1_ALPHA (12<<10)
-#define R200_TXA_ARG_C_R1_BLUE (13<<10)
-#define R200_TXA_ARG_C_R2_ALPHA (14<<10)
-#define R200_TXA_ARG_C_R2_BLUE (15<<10)
-#define R200_TXA_ARG_C_R3_ALPHA (16<<10)
-#define R200_TXA_ARG_C_R3_BLUE (17<<10)
-#define R200_TXA_ARG_C_R4_ALPHA (18<<10)
-#define R200_TXA_ARG_C_R4_BLUE (19<<10)
-#define R200_TXA_ARG_C_R5_ALPHA (20<<10)
-#define R200_TXA_ARG_C_R5_BLUE (21<<10)
-#define R200_TXA_ARG_C_TFACTOR1_ALPHA (26<<10)
-#define R200_TXA_ARG_C_TFACTOR1_BLUE (27<<10)
-#define R200_TXA_ARG_C_MASK (31 << 10)
-#define R200_TXA_ARG_C_SHIFT 10
-#define R200_TXA_COMP_ARG_A (1 << 16)
-#define R200_TXA_COMP_ARG_A_SHIFT (16)
-#define R200_TXA_BIAS_ARG_A (1 << 17)
-#define R200_TXA_SCALE_ARG_A (1 << 18)
-#define R200_TXA_NEG_ARG_A (1 << 19)
-#define R200_TXA_COMP_ARG_B (1 << 20)
-#define R200_TXA_COMP_ARG_B_SHIFT (20)
-#define R200_TXA_BIAS_ARG_B (1 << 21)
-#define R200_TXA_SCALE_ARG_B (1 << 22)
-#define R200_TXA_NEG_ARG_B (1 << 23)
-#define R200_TXA_COMP_ARG_C (1 << 24)
-#define R200_TXA_COMP_ARG_C_SHIFT (24)
-#define R200_TXA_BIAS_ARG_C (1 << 25)
-#define R200_TXA_SCALE_ARG_C (1 << 26)
-#define R200_TXA_NEG_ARG_C (1 << 27)
-#define R200_TXA_OP_MADD (0 << 28)
-#define R200_TXA_OP_CND0 (2 << 28)
-#define R200_TXA_OP_LERP (3 << 28)
-#define R200_TXA_OP_CONDITIONAL (6 << 28)
-#define R200_TXA_OP_MASK (7 << 28)
-#define R200_PP_TXABLEND2_0 0x2f0c
-#define R200_TXA_TFACTOR_SEL_SHIFT 0
-#define R200_TXA_TFACTOR_SEL_MASK 0x7
-#define R200_TXA_TFACTOR1_SEL_SHIFT 4
-#define R200_TXA_TFACTOR1_SEL_MASK (0x7 << 4)
-#define R200_TXA_SCALE_SHIFT 8
-#define R200_TXA_SCALE_MASK (7 << 8)
-#define R200_TXA_SCALE_1X (0 << 8)
-#define R200_TXA_SCALE_2X (1 << 8)
-#define R200_TXA_SCALE_4X (2 << 8)
-#define R200_TXA_SCALE_8X (3 << 8)
-#define R200_TXA_SCALE_INV2 (5 << 8)
-#define R200_TXA_SCALE_INV4 (6 << 8)
-#define R200_TXA_SCALE_INV8 (7 << 8)
-#define R200_TXA_CLAMP_SHIFT 12
-#define R200_TXA_CLAMP_MASK (3 << 12)
-#define R200_TXA_CLAMP_WRAP (0 << 12)
-#define R200_TXA_CLAMP_0_1 (1 << 12)
-#define R200_TXA_CLAMP_8_8 (2 << 12)
-#define R200_TXA_OUTPUT_REG_MASK (7 << 16)
-#define R200_TXA_OUTPUT_REG_NONE (0 << 16)
-#define R200_TXA_OUTPUT_REG_R0 (1 << 16)
-#define R200_TXA_OUTPUT_REG_R1 (2 << 16)
-#define R200_TXA_OUTPUT_REG_R2 (3 << 16)
-#define R200_TXA_OUTPUT_REG_R3 (4 << 16)
-#define R200_TXA_OUTPUT_REG_R4 (5 << 16)
-#define R200_TXA_OUTPUT_REG_R5 (6 << 16)
-#define R200_TXA_DOT_ALPHA (1 << 20)
-#define R200_TXA_REPL_NORMAL 0
-#define R200_TXA_REPL_RED 1
-#define R200_TXA_REPL_GREEN 2
-#define R200_TXA_REPL_ARG_A_SHIFT 26
-#define R200_TXA_REPL_ARG_A_MASK (3 << 26)
-#define R200_TXA_REPL_ARG_B_SHIFT 28
-#define R200_TXA_REPL_ARG_B_MASK (3 << 28)
-#define R200_TXA_REPL_ARG_C_SHIFT 30
-#define R200_TXA_REPL_ARG_C_MASK (3 << 30)
-#define R200_PP_TXCBLEND_1 0x2f10
-#define R200_PP_TXCBLEND2_1 0x2f14
-#define R200_PP_TXABLEND_1 0x2f18
-#define R200_PP_TXABLEND2_1 0x2f1c
-#define R200_PP_TXCBLEND_2 0x2f20
-#define R200_PP_TXCBLEND2_2 0x2f24
-#define R200_PP_TXABLEND_2 0x2f28
-#define R200_PP_TXABLEND2_2 0x2f2c
-#define R200_PP_TXCBLEND_3 0x2f30
-#define R200_PP_TXCBLEND2_3 0x2f34
-#define R200_PP_TXABLEND_3 0x2f38
-#define R200_PP_TXABLEND2_3 0x2f3c
-#define R200_PP_TXCBLEND_4 0x2f40
-#define R200_PP_TXCBLEND2_4 0x2f44
-#define R200_PP_TXABLEND_4 0x2f48
-#define R200_PP_TXABLEND2_4 0x2f4c
-#define R200_PP_TXCBLEND_5 0x2f50
-#define R200_PP_TXCBLEND2_5 0x2f54
-#define R200_PP_TXABLEND_5 0x2f58
-#define R200_PP_TXABLEND2_5 0x2f5c
-#define R200_PP_TXCBLEND_6 0x2f60
-#define R200_PP_TXCBLEND2_6 0x2f64
-#define R200_PP_TXABLEND_6 0x2f68
-#define R200_PP_TXABLEND2_6 0x2f6c
-#define R200_PP_TXCBLEND_7 0x2f70
-#define R200_PP_TXCBLEND2_7 0x2f74
-#define R200_PP_TXABLEND_7 0x2f78
-#define R200_PP_TXABLEND2_7 0x2f7c
-/* gap */
-#define R200_RB3D_BLENDCOLOR 0x3218 /* ARGB 8888 */
-#define R200_RB3D_ABLENDCNTL 0x321C /* see BLENDCTL */
-#define R200_RB3D_CBLENDCNTL 0x3220 /* see BLENDCTL */
-
-
-/*
- * Offsets in TCL vector state. NOTE: Hardwiring matrix positions.
- * Multiple contexts could collaberate to eliminate state bouncing.
- */
-#define R200_VS_LIGHT_AMBIENT_ADDR 0x00000028
-#define R200_VS_LIGHT_DIFFUSE_ADDR 0x00000030
-#define R200_VS_LIGHT_SPECULAR_ADDR 0x00000038
-#define R200_VS_LIGHT_DIRPOS_ADDR 0x00000040
-#define R200_VS_LIGHT_HWVSPOT_ADDR 0x00000048
-#define R200_VS_LIGHT_ATTENUATION_ADDR 0x00000050
-#define R200_VS_SPOT_DUAL_CONE 0x00000058
-#define R200_VS_GLOBAL_AMBIENT_ADDR 0x0000005C
-#define R200_VS_FOG_PARAM_ADDR 0x0000005D
-#define R200_VS_EYE_VECTOR_ADDR 0x0000005E
-#define R200_VS_UCP_ADDR 0x00000060
-#define R200_VS_PNT_SPRITE_VPORT_SCALE 0x00000068
-#define R200_VS_MATRIX_0_MV 0x00000080
-#define R200_VS_MATRIX_1_INV_MV 0x00000084
-#define R200_VS_MATRIX_2_MVP 0x00000088
-#define R200_VS_MATRIX_3_TEX0 0x0000008C
-#define R200_VS_MATRIX_4_TEX1 0x00000090
-#define R200_VS_MATRIX_5_TEX2 0x00000094
-#define R200_VS_MATRIX_6_TEX3 0x00000098
-#define R200_VS_MATRIX_7_TEX4 0x0000009C
-#define R200_VS_MATRIX_8_TEX5 0x000000A0
-#define R200_VS_MAT_0_EMISS 0x000000B0
-#define R200_VS_MAT_0_AMB 0x000000B1
-#define R200_VS_MAT_0_DIF 0x000000B2
-#define R200_VS_MAT_0_SPEC 0x000000B3
-#define R200_VS_MAT_1_EMISS 0x000000B4
-#define R200_VS_MAT_1_AMB 0x000000B5
-#define R200_VS_MAT_1_DIF 0x000000B6
-#define R200_VS_MAT_1_SPEC 0x000000B7
-#define R200_VS_EYE2CLIP_MTX 0x000000B8
-#define R200_VS_PNT_SPRITE_ATT_CONST 0x000000BC
-#define R200_VS_PNT_SPRITE_EYE_IN_MODEL 0x000000BD
-#define R200_VS_PNT_SPRITE_CLAMP 0x000000BE
-#define R200_VS_MAX 0x000001C0
-
-
-/*
- * Offsets in TCL scalar state
- */
-#define R200_SS_LIGHT_DCD_ADDR 0x00000000
-#define R200_SS_LIGHT_DCM_ADDR 0x00000008
-#define R200_SS_LIGHT_SPOT_EXPONENT_ADDR 0x00000010
-#define R200_SS_LIGHT_SPOT_CUTOFF_ADDR 0x00000018
-#define R200_SS_LIGHT_SPECULAR_THRESH_ADDR 0x00000020
-#define R200_SS_LIGHT_RANGE_CUTOFF_SQRD 0x00000028
-#define R200_SS_LIGHT_RANGE_ATT_CONST 0x00000030
-#define R200_SS_VERT_GUARD_CLIP_ADJ_ADDR 0x00000080
-#define R200_SS_VERT_GUARD_DISCARD_ADJ_ADDR 0x00000081
-#define R200_SS_HORZ_GUARD_CLIP_ADJ_ADDR 0x00000082
-#define R200_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 0x00000083
-#define R200_SS_MAT_0_SHININESS 0x00000100
-#define R200_SS_MAT_1_SHININESS 0x00000101
-
-
-/*
- * Matrix indices
- */
-#define R200_MTX_MV 0
-#define R200_MTX_IMV 1
-#define R200_MTX_MVP 2
-#define R200_MTX_TEX0 3
-#define R200_MTX_TEX1 4
-#define R200_MTX_TEX2 5
-#define R200_MTX_TEX3 6
-#define R200_MTX_TEX4 7
-#define R200_MTX_TEX5 8
-
-/* Color formats for 2d packets
- */
-#define R200_CP_COLOR_FORMAT_CI8 2
-#define R200_CP_COLOR_FORMAT_ARGB1555 3
-#define R200_CP_COLOR_FORMAT_RGB565 4
-#define R200_CP_COLOR_FORMAT_ARGB8888 6
-#define R200_CP_COLOR_FORMAT_RGB332 7
-#define R200_CP_COLOR_FORMAT_RGB8 9
-#define R200_CP_COLOR_FORMAT_ARGB4444 15
-
-
-/*
- * CP type-3 packets
- */
-#define R200_CP_CMD_NOP 0xC0001000
-#define R200_CP_CMD_NEXT_CHAR 0xC0001900
-#define R200_CP_CMD_PLY_NEXTSCAN 0xC0001D00
-#define R200_CP_CMD_SET_SCISSORS 0xC0001E00
-#define R200_CP_CMD_LOAD_MICROCODE 0xC0002400
-#define R200_CP_CMD_WAIT_FOR_IDLE 0xC0002600
-#define R200_CP_CMD_3D_DRAW_VBUF 0xC0002800
-#define R200_CP_CMD_3D_DRAW_IMMD 0xC0002900
-#define R200_CP_CMD_3D_DRAW_INDX 0xC0002A00
-#define R200_CP_CMD_LOAD_PALETTE 0xC0002C00
-#define R200_CP_CMD_3D_LOAD_VBPNTR 0xC0002F00
-#define R200_CP_CMD_INDX_BUFFER 0xC0003300
-#define R200_CP_CMD_3D_DRAW_VBUF_2 0xC0003400
-#define R200_CP_CMD_3D_DRAW_IMMD_2 0xC0003500
-#define R200_CP_CMD_3D_DRAW_INDX_2 0xC0003600
-#define R200_CP_CMD_PAINT 0xC0009100
-#define R200_CP_CMD_BITBLT 0xC0009200
-#define R200_CP_CMD_SMALLTEXT 0xC0009300
-#define R200_CP_CMD_HOSTDATA_BLT 0xC0009400
-#define R200_CP_CMD_POLYLINE 0xC0009500
-#define R200_CP_CMD_POLYSCANLINES 0xC0009800
-#define R200_CP_CMD_PAINT_MULTI 0xC0009A00
-#define R200_CP_CMD_BITBLT_MULTI 0xC0009B00
-#define R200_CP_CMD_TRANS_BITBLT 0xC0009C00
-
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.c
deleted file mode 100644
index 79d0f3c55..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.c
+++ /dev/null
@@ -1,1341 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_sanity.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc, Cedar Park, TX.
-
-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, 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
-ATI, TUNGSTEN GRAPHICS 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_sanity.h"
-#include "radeon_reg.h"
-#include "r200_reg.h"
-
-/* Set this '1' to get more verbiage.
- */
-#define MORE_VERBOSE 1
-
-#if MORE_VERBOSE
-#define VERBOSE (R200_DEBUG & DEBUG_VERBOSE)
-#define NORMAL (1)
-#else
-#define VERBOSE 0
-#define NORMAL (R200_DEBUG & DEBUG_VERBOSE)
-#endif
-
-
-/* New (1.3) state mechanism. 3 commands (packet, scalar, vector) in
- * 1.3 cmdbuffers allow all previous state to be updated as well as
- * the tcl scalar and vector areas.
- */
-static struct {
- int start;
- int len;
- const char *name;
-} packet[RADEON_MAX_STATE_PACKETS] = {
- { RADEON_PP_MISC,7,"RADEON_PP_MISC" },
- { RADEON_PP_CNTL,3,"RADEON_PP_CNTL" },
- { RADEON_RB3D_COLORPITCH,1,"RADEON_RB3D_COLORPITCH" },
- { RADEON_RE_LINE_PATTERN,2,"RADEON_RE_LINE_PATTERN" },
- { RADEON_SE_LINE_WIDTH,1,"RADEON_SE_LINE_WIDTH" },
- { RADEON_PP_LUM_MATRIX,1,"RADEON_PP_LUM_MATRIX" },
- { RADEON_PP_ROT_MATRIX_0,2,"RADEON_PP_ROT_MATRIX_0" },
- { RADEON_RB3D_STENCILREFMASK,3,"RADEON_RB3D_STENCILREFMASK" },
- { RADEON_SE_VPORT_XSCALE,6,"RADEON_SE_VPORT_XSCALE" },
- { RADEON_SE_CNTL,2,"RADEON_SE_CNTL" },
- { RADEON_SE_CNTL_STATUS,1,"RADEON_SE_CNTL_STATUS" },
- { RADEON_RE_MISC,1,"RADEON_RE_MISC" },
- { RADEON_PP_TXFILTER_0,6,"RADEON_PP_TXFILTER_0" },
- { RADEON_PP_BORDER_COLOR_0,1,"RADEON_PP_BORDER_COLOR_0" },
- { RADEON_PP_TXFILTER_1,6,"RADEON_PP_TXFILTER_1" },
- { RADEON_PP_BORDER_COLOR_1,1,"RADEON_PP_BORDER_COLOR_1" },
- { RADEON_PP_TXFILTER_2,6,"RADEON_PP_TXFILTER_2" },
- { RADEON_PP_BORDER_COLOR_2,1,"RADEON_PP_BORDER_COLOR_2" },
- { RADEON_SE_ZBIAS_FACTOR,2,"RADEON_SE_ZBIAS_FACTOR" },
- { RADEON_SE_TCL_OUTPUT_VTX_FMT,11,"RADEON_SE_TCL_OUTPUT_VTX_FMT" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED,17,"RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED" },
- { R200_PP_TXCBLEND_0, 4, "R200_EMIT_PP_TXCBLEND_0" },
- { R200_PP_TXCBLEND_1, 4, "R200_PP_TXCBLEND_1" },
- { R200_PP_TXCBLEND_2, 4, "R200_PP_TXCBLEND_2" },
- { R200_PP_TXCBLEND_3, 4, "R200_PP_TXCBLEND_3" },
- { R200_PP_TXCBLEND_4, 4, "R200_PP_TXCBLEND_4" },
- { R200_PP_TXCBLEND_5, 4, "R200_PP_TXCBLEND_5" },
- { R200_PP_TXCBLEND_6, 4, "R200_PP_TXCBLEND_6" },
- { R200_PP_TXCBLEND_7, 4, "R200_PP_TXCBLEND_7" },
- { R200_SE_TCL_LIGHT_MODEL_CTL_0, 6, "R200_SE_TCL_LIGHT_MODEL_CTL_0" },
- { R200_PP_TFACTOR_0, 6, "R200_PP_TFACTOR_0" },
- { R200_SE_VTX_FMT_0, 4, "R200_SE_VTX_FMT_0" },
- { R200_SE_VAP_CNTL, 1, "R200_SE_VAP_CNTL" },
- { R200_SE_TCL_MATRIX_SEL_0, 5, "R200_SE_TCL_MATRIX_SEL_0" },
- { R200_SE_TCL_TEX_PROC_CTL_2, 5, "R200_SE_TCL_TEX_PROC_CTL_2" },
- { R200_SE_TCL_UCP_VERT_BLEND_CTL, 1, "R200_SE_TCL_UCP_VERT_BLEND_CTL" },
- { R200_PP_TXFILTER_0, 6, "R200_PP_TXFILTER_0" },
- { R200_PP_TXFILTER_1, 6, "R200_PP_TXFILTER_1" },
- { R200_PP_TXFILTER_2, 6, "R200_PP_TXFILTER_2" },
- { R200_PP_TXFILTER_3, 6, "R200_PP_TXFILTER_3" },
- { R200_PP_TXFILTER_4, 6, "R200_PP_TXFILTER_4" },
- { R200_PP_TXFILTER_5, 6, "R200_PP_TXFILTER_5" },
- { R200_PP_TXOFFSET_0, 1, "R200_PP_TXOFFSET_0" },
- { R200_PP_TXOFFSET_1, 1, "R200_PP_TXOFFSET_1" },
- { R200_PP_TXOFFSET_2, 1, "R200_PP_TXOFFSET_2" },
- { R200_PP_TXOFFSET_3, 1, "R200_PP_TXOFFSET_3" },
- { R200_PP_TXOFFSET_4, 1, "R200_PP_TXOFFSET_4" },
- { R200_PP_TXOFFSET_5, 1, "R200_PP_TXOFFSET_5" },
- { R200_SE_VTE_CNTL, 1, "R200_SE_VTE_CNTL" },
- { R200_SE_TCL_OUTPUT_VTX_COMP_SEL, 1, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL" },
- { R200_PP_TAM_DEBUG3, 1, "R200_PP_TAM_DEBUG3" },
- { R200_PP_CNTL_X, 1, "R200_PP_CNTL_X" },
- { R200_RB3D_DEPTHXY_OFFSET, 1, "R200_RB3D_DEPTHXY_OFFSET" },
- { R200_RE_AUX_SCISSOR_CNTL, 1, "R200_RE_AUX_SCISSOR_CNTL" },
- { R200_RE_SCISSOR_TL_0, 2, "R200_RE_SCISSOR_TL_0" },
- { R200_RE_SCISSOR_TL_1, 2, "R200_RE_SCISSOR_TL_1" },
- { R200_RE_SCISSOR_TL_2, 2, "R200_RE_SCISSOR_TL_2" },
- { R200_SE_VAP_CNTL_STATUS, 1, "R200_SE_VAP_CNTL_STATUS" },
- { R200_SE_VTX_STATE_CNTL, 1, "R200_SE_VTX_STATE_CNTL" },
- { R200_RE_POINTSIZE, 1, "R200_RE_POINTSIZE" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0, 4, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0" },
- { R200_PP_CUBIC_FACES_0, 1, "R200_PP_CUBIC_FACES_0" }, /* 61 */
- { R200_PP_CUBIC_OFFSET_F1_0, 5, "R200_PP_CUBIC_OFFSET_F1_0" }, /* 62 */
- { R200_PP_CUBIC_FACES_1, 1, "R200_PP_CUBIC_FACES_1" },
- { R200_PP_CUBIC_OFFSET_F1_1, 5, "R200_PP_CUBIC_OFFSET_F1_1" },
- { R200_PP_CUBIC_FACES_2, 1, "R200_PP_CUBIC_FACES_2" },
- { R200_PP_CUBIC_OFFSET_F1_2, 5, "R200_PP_CUBIC_OFFSET_F1_2" },
- { R200_PP_CUBIC_FACES_3, 1, "R200_PP_CUBIC_FACES_3" },
- { R200_PP_CUBIC_OFFSET_F1_3, 5, "R200_PP_CUBIC_OFFSET_F1_3" },
- { R200_PP_CUBIC_FACES_4, 1, "R200_PP_CUBIC_FACES_4" },
- { R200_PP_CUBIC_OFFSET_F1_4, 5, "R200_PP_CUBIC_OFFSET_F1_4" },
- { R200_PP_CUBIC_FACES_5, 1, "R200_PP_CUBIC_FACES_5" },
- { R200_PP_CUBIC_OFFSET_F1_5, 5, "R200_PP_CUBIC_OFFSET_F1_5" },
- { RADEON_PP_TEX_SIZE_0, 2, "RADEON_PP_TEX_SIZE_0" },
- { RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" },
- { RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_2" },
- { R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR" },
- { R200_SE_TCL_POINT_SPRITE_CNTL, 1, "R200_SE_TCL_POINT_SPRITE_CNTL" },
- { RADEON_PP_CUBIC_FACES_0, 1, "RADEON_PP_CUBIC_FACES_0" },
- { RADEON_PP_CUBIC_OFFSET_T0_0, 5, "RADEON_PP_CUBIC_OFFSET_T0_0" },
- { RADEON_PP_CUBIC_FACES_1, 1, "RADEON_PP_CUBIC_FACES_1" },
- { RADEON_PP_CUBIC_OFFSET_T1_0, 5, "RADEON_PP_CUBIC_OFFSET_T1_0" },
- { RADEON_PP_CUBIC_FACES_2, 1, "RADEON_PP_CUBIC_FACES_2" },
- { RADEON_PP_CUBIC_OFFSET_T2_0, 5, "RADEON_PP_CUBIC_OFFSET_T2_0" },
- { R200_PP_TRI_PERF, 2, "R200_PP_TRI_PERF" },
-};
-
-struct reg_names {
- int idx;
- const char *name;
-};
-
-static struct reg_names reg_names[] = {
- { R200_PP_MISC, "R200_PP_MISC" },
- { R200_PP_FOG_COLOR, "R200_PP_FOG_COLOR" },
- { R200_RE_SOLID_COLOR, "R200_RE_SOLID_COLOR" },
- { R200_RB3D_BLENDCNTL, "R200_RB3D_BLENDCNTL" },
- { R200_RB3D_DEPTHOFFSET, "R200_RB3D_DEPTHOFFSET" },
- { R200_RB3D_DEPTHPITCH, "R200_RB3D_DEPTHPITCH" },
- { R200_RB3D_ZSTENCILCNTL, "R200_RB3D_ZSTENCILCNTL" },
- { R200_PP_CNTL, "R200_PP_CNTL" },
- { R200_RB3D_CNTL, "R200_RB3D_CNTL" },
- { R200_RB3D_COLOROFFSET, "R200_RB3D_COLOROFFSET" },
- { R200_RE_WIDTH_HEIGHT, "R200_RE_WIDTH_HEIGHT" },
- { R200_RB3D_COLORPITCH, "R200_RB3D_COLORPITCH" },
- { R200_SE_CNTL, "R200_SE_CNTL" },
- { R200_RE_CNTL, "R200_RE_CNTL" },
- { R200_RE_MISC, "R200_RE_MISC" },
- { R200_RE_STIPPLE_ADDR, "R200_RE_STIPPLE_ADDR" },
- { R200_RE_STIPPLE_DATA, "R200_RE_STIPPLE_DATA" },
- { R200_RE_LINE_PATTERN, "R200_RE_LINE_PATTERN" },
- { R200_RE_LINE_STATE, "R200_RE_LINE_STATE" },
- { R200_RE_SCISSOR_TL_0, "R200_RE_SCISSOR_TL_0" },
- { R200_RE_SCISSOR_BR_0, "R200_RE_SCISSOR_BR_0" },
- { R200_RE_SCISSOR_TL_1, "R200_RE_SCISSOR_TL_1" },
- { R200_RE_SCISSOR_BR_1, "R200_RE_SCISSOR_BR_1" },
- { R200_RE_SCISSOR_TL_2, "R200_RE_SCISSOR_TL_2" },
- { R200_RE_SCISSOR_BR_2, "R200_RE_SCISSOR_BR_2" },
- { R200_RB3D_DEPTHXY_OFFSET, "R200_RB3D_DEPTHXY_OFFSET" },
- { R200_RB3D_STENCILREFMASK, "R200_RB3D_STENCILREFMASK" },
- { R200_RB3D_ROPCNTL, "R200_RB3D_ROPCNTL" },
- { R200_RB3D_PLANEMASK, "R200_RB3D_PLANEMASK" },
- { R200_SE_VPORT_XSCALE, "R200_SE_VPORT_XSCALE" },
- { R200_SE_VPORT_XOFFSET, "R200_SE_VPORT_XOFFSET" },
- { R200_SE_VPORT_YSCALE, "R200_SE_VPORT_YSCALE" },
- { R200_SE_VPORT_YOFFSET, "R200_SE_VPORT_YOFFSET" },
- { R200_SE_VPORT_ZSCALE, "R200_SE_VPORT_ZSCALE" },
- { R200_SE_VPORT_ZOFFSET, "R200_SE_VPORT_ZOFFSET" },
- { R200_SE_ZBIAS_FACTOR, "R200_SE_ZBIAS_FACTOR" },
- { R200_SE_ZBIAS_CONSTANT, "R200_SE_ZBIAS_CONSTANT" },
- { R200_SE_LINE_WIDTH, "R200_SE_LINE_WIDTH" },
- { R200_SE_VAP_CNTL, "R200_SE_VAP_CNTL" },
- { R200_SE_VF_CNTL, "R200_SE_VF_CNTL" },
- { R200_SE_VTX_FMT_0, "R200_SE_VTX_FMT_0" },
- { R200_SE_VTX_FMT_1, "R200_SE_VTX_FMT_1" },
- { R200_SE_TCL_OUTPUT_VTX_FMT_0, "R200_SE_TCL_OUTPUT_VTX_FMT_0" },
- { R200_SE_TCL_OUTPUT_VTX_FMT_1, "R200_SE_TCL_OUTPUT_VTX_FMT_1" },
- { R200_SE_VTE_CNTL, "R200_SE_VTE_CNTL" },
- { R200_SE_VTX_NUM_ARRAYS, "R200_SE_VTX_NUM_ARRAYS" },
- { R200_SE_VTX_AOS_ATTR01, "R200_SE_VTX_AOS_ATTR01" },
- { R200_SE_VTX_AOS_ADDR0, "R200_SE_VTX_AOS_ADDR0" },
- { R200_SE_VTX_AOS_ADDR1, "R200_SE_VTX_AOS_ADDR1" },
- { R200_SE_VTX_AOS_ATTR23, "R200_SE_VTX_AOS_ATTR23" },
- { R200_SE_VTX_AOS_ADDR2, "R200_SE_VTX_AOS_ADDR2" },
- { R200_SE_VTX_AOS_ADDR3, "R200_SE_VTX_AOS_ADDR3" },
- { R200_SE_VTX_AOS_ATTR45, "R200_SE_VTX_AOS_ATTR45" },
- { R200_SE_VTX_AOS_ADDR4, "R200_SE_VTX_AOS_ADDR4" },
- { R200_SE_VTX_AOS_ADDR5, "R200_SE_VTX_AOS_ADDR5" },
- { R200_SE_VTX_AOS_ATTR67, "R200_SE_VTX_AOS_ATTR67" },
- { R200_SE_VTX_AOS_ADDR6, "R200_SE_VTX_AOS_ADDR6" },
- { R200_SE_VTX_AOS_ADDR7, "R200_SE_VTX_AOS_ADDR7" },
- { R200_SE_VTX_AOS_ATTR89, "R200_SE_VTX_AOS_ATTR89" },
- { R200_SE_VTX_AOS_ADDR8, "R200_SE_VTX_AOS_ADDR8" },
- { R200_SE_VTX_AOS_ADDR9, "R200_SE_VTX_AOS_ADDR9" },
- { R200_SE_VTX_AOS_ATTR1011, "R200_SE_VTX_AOS_ATTR1011" },
- { R200_SE_VTX_AOS_ADDR10, "R200_SE_VTX_AOS_ADDR10" },
- { R200_SE_VTX_AOS_ADDR11, "R200_SE_VTX_AOS_ADDR11" },
- { R200_SE_VF_MAX_VTX_INDX, "R200_SE_VF_MAX_VTX_INDX" },
- { R200_SE_VF_MIN_VTX_INDX, "R200_SE_VF_MIN_VTX_INDX" },
- { R200_SE_VTX_STATE_CNTL, "R200_SE_VTX_STATE_CNTL" },
- { R200_SE_TCL_VECTOR_INDX_REG, "R200_SE_TCL_VECTOR_INDX_REG" },
- { R200_SE_TCL_VECTOR_DATA_REG, "R200_SE_TCL_VECTOR_DATA_REG" },
- { R200_SE_TCL_SCALAR_INDX_REG, "R200_SE_TCL_SCALAR_INDX_REG" },
- { R200_SE_TCL_SCALAR_DATA_REG, "R200_SE_TCL_SCALAR_DATA_REG" },
- { R200_SE_TCL_MATRIX_SEL_0, "R200_SE_TCL_MATRIX_SEL_0" },
- { R200_SE_TCL_MATRIX_SEL_1, "R200_SE_TCL_MATRIX_SEL_1" },
- { R200_SE_TCL_MATRIX_SEL_2, "R200_SE_TCL_MATRIX_SEL_2" },
- { R200_SE_TCL_MATRIX_SEL_3, "R200_SE_TCL_MATRIX_SEL_3" },
- { R200_SE_TCL_MATRIX_SEL_4, "R200_SE_TCL_MATRIX_SEL_4" },
- { R200_SE_TCL_LIGHT_MODEL_CTL_0, "R200_SE_TCL_LIGHT_MODEL_CTL_0" },
- { R200_SE_TCL_LIGHT_MODEL_CTL_1, "R200_SE_TCL_LIGHT_MODEL_CTL_1" },
- { R200_SE_TCL_PER_LIGHT_CTL_0, "R200_SE_TCL_PER_LIGHT_CTL_0" },
- { R200_SE_TCL_PER_LIGHT_CTL_1, "R200_SE_TCL_PER_LIGHT_CTL_1" },
- { R200_SE_TCL_PER_LIGHT_CTL_2, "R200_SE_TCL_PER_LIGHT_CTL_2" },
- { R200_SE_TCL_PER_LIGHT_CTL_3, "R200_SE_TCL_PER_LIGHT_CTL_3" },
- { R200_SE_TCL_TEX_PROC_CTL_2, "R200_SE_TCL_TEX_PROC_CTL_2" },
- { R200_SE_TCL_TEX_PROC_CTL_3, "R200_SE_TCL_TEX_PROC_CTL_3" },
- { R200_SE_TCL_TEX_PROC_CTL_0, "R200_SE_TCL_TEX_PROC_CTL_0" },
- { R200_SE_TCL_TEX_PROC_CTL_1, "R200_SE_TCL_TEX_PROC_CTL_1" },
- { R200_SE_TC_TEX_CYL_WRAP_CTL, "R200_SE_TC_TEX_CYL_WRAP_CTL" },
- { R200_SE_TCL_UCP_VERT_BLEND_CTL, "R200_SE_TCL_UCP_VERT_BLEND_CTL" },
- { R200_SE_TCL_POINT_SPRITE_CNTL, "R200_SE_TCL_POINT_SPRITE_CNTL" },
- { R200_SE_VTX_ST_POS_0_X_4, "R200_SE_VTX_ST_POS_0_X_4" },
- { R200_SE_VTX_ST_POS_0_Y_4, "R200_SE_VTX_ST_POS_0_Y_4" },
- { R200_SE_VTX_ST_POS_0_Z_4, "R200_SE_VTX_ST_POS_0_Z_4" },
- { R200_SE_VTX_ST_POS_0_W_4, "R200_SE_VTX_ST_POS_0_W_4" },
- { R200_SE_VTX_ST_NORM_0_X, "R200_SE_VTX_ST_NORM_0_X" },
- { R200_SE_VTX_ST_NORM_0_Y, "R200_SE_VTX_ST_NORM_0_Y" },
- { R200_SE_VTX_ST_NORM_0_Z, "R200_SE_VTX_ST_NORM_0_Z" },
- { R200_SE_VTX_ST_PVMS, "R200_SE_VTX_ST_PVMS" },
- { R200_SE_VTX_ST_CLR_0_R, "R200_SE_VTX_ST_CLR_0_R" },
- { R200_SE_VTX_ST_CLR_0_G, "R200_SE_VTX_ST_CLR_0_G" },
- { R200_SE_VTX_ST_CLR_0_B, "R200_SE_VTX_ST_CLR_0_B" },
- { R200_SE_VTX_ST_CLR_0_A, "R200_SE_VTX_ST_CLR_0_A" },
- { R200_SE_VTX_ST_CLR_1_R, "R200_SE_VTX_ST_CLR_1_R" },
- { R200_SE_VTX_ST_CLR_1_G, "R200_SE_VTX_ST_CLR_1_G" },
- { R200_SE_VTX_ST_CLR_1_B, "R200_SE_VTX_ST_CLR_1_B" },
- { R200_SE_VTX_ST_CLR_1_A, "R200_SE_VTX_ST_CLR_1_A" },
- { R200_SE_VTX_ST_CLR_2_R, "R200_SE_VTX_ST_CLR_2_R" },
- { R200_SE_VTX_ST_CLR_2_G, "R200_SE_VTX_ST_CLR_2_G" },
- { R200_SE_VTX_ST_CLR_2_B, "R200_SE_VTX_ST_CLR_2_B" },
- { R200_SE_VTX_ST_CLR_2_A, "R200_SE_VTX_ST_CLR_2_A" },
- { R200_SE_VTX_ST_CLR_3_R, "R200_SE_VTX_ST_CLR_3_R" },
- { R200_SE_VTX_ST_CLR_3_G, "R200_SE_VTX_ST_CLR_3_G" },
- { R200_SE_VTX_ST_CLR_3_B, "R200_SE_VTX_ST_CLR_3_B" },
- { R200_SE_VTX_ST_CLR_3_A, "R200_SE_VTX_ST_CLR_3_A" },
- { R200_SE_VTX_ST_CLR_4_R, "R200_SE_VTX_ST_CLR_4_R" },
- { R200_SE_VTX_ST_CLR_4_G, "R200_SE_VTX_ST_CLR_4_G" },
- { R200_SE_VTX_ST_CLR_4_B, "R200_SE_VTX_ST_CLR_4_B" },
- { R200_SE_VTX_ST_CLR_4_A, "R200_SE_VTX_ST_CLR_4_A" },
- { R200_SE_VTX_ST_CLR_5_R, "R200_SE_VTX_ST_CLR_5_R" },
- { R200_SE_VTX_ST_CLR_5_G, "R200_SE_VTX_ST_CLR_5_G" },
- { R200_SE_VTX_ST_CLR_5_B, "R200_SE_VTX_ST_CLR_5_B" },
- { R200_SE_VTX_ST_CLR_5_A, "R200_SE_VTX_ST_CLR_5_A" },
- { R200_SE_VTX_ST_CLR_6_R, "R200_SE_VTX_ST_CLR_6_R" },
- { R200_SE_VTX_ST_CLR_6_G, "R200_SE_VTX_ST_CLR_6_G" },
- { R200_SE_VTX_ST_CLR_6_B, "R200_SE_VTX_ST_CLR_6_B" },
- { R200_SE_VTX_ST_CLR_6_A, "R200_SE_VTX_ST_CLR_6_A" },
- { R200_SE_VTX_ST_CLR_7_R, "R200_SE_VTX_ST_CLR_7_R" },
- { R200_SE_VTX_ST_CLR_7_G, "R200_SE_VTX_ST_CLR_7_G" },
- { R200_SE_VTX_ST_CLR_7_B, "R200_SE_VTX_ST_CLR_7_B" },
- { R200_SE_VTX_ST_CLR_7_A, "R200_SE_VTX_ST_CLR_7_A" },
- { R200_SE_VTX_ST_TEX_0_S, "R200_SE_VTX_ST_TEX_0_S" },
- { R200_SE_VTX_ST_TEX_0_T, "R200_SE_VTX_ST_TEX_0_T" },
- { R200_SE_VTX_ST_TEX_0_R, "R200_SE_VTX_ST_TEX_0_R" },
- { R200_SE_VTX_ST_TEX_0_Q, "R200_SE_VTX_ST_TEX_0_Q" },
- { R200_SE_VTX_ST_TEX_1_S, "R200_SE_VTX_ST_TEX_1_S" },
- { R200_SE_VTX_ST_TEX_1_T, "R200_SE_VTX_ST_TEX_1_T" },
- { R200_SE_VTX_ST_TEX_1_R, "R200_SE_VTX_ST_TEX_1_R" },
- { R200_SE_VTX_ST_TEX_1_Q, "R200_SE_VTX_ST_TEX_1_Q" },
- { R200_SE_VTX_ST_TEX_2_S, "R200_SE_VTX_ST_TEX_2_S" },
- { R200_SE_VTX_ST_TEX_2_T, "R200_SE_VTX_ST_TEX_2_T" },
- { R200_SE_VTX_ST_TEX_2_R, "R200_SE_VTX_ST_TEX_2_R" },
- { R200_SE_VTX_ST_TEX_2_Q, "R200_SE_VTX_ST_TEX_2_Q" },
- { R200_SE_VTX_ST_TEX_3_S, "R200_SE_VTX_ST_TEX_3_S" },
- { R200_SE_VTX_ST_TEX_3_T, "R200_SE_VTX_ST_TEX_3_T" },
- { R200_SE_VTX_ST_TEX_3_R, "R200_SE_VTX_ST_TEX_3_R" },
- { R200_SE_VTX_ST_TEX_3_Q, "R200_SE_VTX_ST_TEX_3_Q" },
- { R200_SE_VTX_ST_TEX_4_S, "R200_SE_VTX_ST_TEX_4_S" },
- { R200_SE_VTX_ST_TEX_4_T, "R200_SE_VTX_ST_TEX_4_T" },
- { R200_SE_VTX_ST_TEX_4_R, "R200_SE_VTX_ST_TEX_4_R" },
- { R200_SE_VTX_ST_TEX_4_Q, "R200_SE_VTX_ST_TEX_4_Q" },
- { R200_SE_VTX_ST_TEX_5_S, "R200_SE_VTX_ST_TEX_5_S" },
- { R200_SE_VTX_ST_TEX_5_T, "R200_SE_VTX_ST_TEX_5_T" },
- { R200_SE_VTX_ST_TEX_5_R, "R200_SE_VTX_ST_TEX_5_R" },
- { R200_SE_VTX_ST_TEX_5_Q, "R200_SE_VTX_ST_TEX_5_Q" },
- { R200_SE_VTX_ST_PNT_SPRT_SZ, "R200_SE_VTX_ST_PNT_SPRT_SZ" },
- { R200_SE_VTX_ST_DISC_FOG, "R200_SE_VTX_ST_DISC_FOG" },
- { R200_SE_VTX_ST_SHININESS_0, "R200_SE_VTX_ST_SHININESS_0" },
- { R200_SE_VTX_ST_SHININESS_1, "R200_SE_VTX_ST_SHININESS_1" },
- { R200_SE_VTX_ST_BLND_WT_0, "R200_SE_VTX_ST_BLND_WT_0" },
- { R200_SE_VTX_ST_BLND_WT_1, "R200_SE_VTX_ST_BLND_WT_1" },
- { R200_SE_VTX_ST_BLND_WT_2, "R200_SE_VTX_ST_BLND_WT_2" },
- { R200_SE_VTX_ST_BLND_WT_3, "R200_SE_VTX_ST_BLND_WT_3" },
- { R200_SE_VTX_ST_POS_1_X, "R200_SE_VTX_ST_POS_1_X" },
- { R200_SE_VTX_ST_POS_1_Y, "R200_SE_VTX_ST_POS_1_Y" },
- { R200_SE_VTX_ST_POS_1_Z, "R200_SE_VTX_ST_POS_1_Z" },
- { R200_SE_VTX_ST_POS_1_W, "R200_SE_VTX_ST_POS_1_W" },
- { R200_SE_VTX_ST_NORM_1_X, "R200_SE_VTX_ST_NORM_1_X" },
- { R200_SE_VTX_ST_NORM_1_Y, "R200_SE_VTX_ST_NORM_1_Y" },
- { R200_SE_VTX_ST_NORM_1_Z, "R200_SE_VTX_ST_NORM_1_Z" },
- { R200_SE_VTX_ST_USR_CLR_0_R, "R200_SE_VTX_ST_USR_CLR_0_R" },
- { R200_SE_VTX_ST_USR_CLR_0_G, "R200_SE_VTX_ST_USR_CLR_0_G" },
- { R200_SE_VTX_ST_USR_CLR_0_B, "R200_SE_VTX_ST_USR_CLR_0_B" },
- { R200_SE_VTX_ST_USR_CLR_0_A, "R200_SE_VTX_ST_USR_CLR_0_A" },
- { R200_SE_VTX_ST_USR_CLR_1_R, "R200_SE_VTX_ST_USR_CLR_1_R" },
- { R200_SE_VTX_ST_USR_CLR_1_G, "R200_SE_VTX_ST_USR_CLR_1_G" },
- { R200_SE_VTX_ST_USR_CLR_1_B, "R200_SE_VTX_ST_USR_CLR_1_B" },
- { R200_SE_VTX_ST_USR_CLR_1_A, "R200_SE_VTX_ST_USR_CLR_1_A" },
- { R200_SE_VTX_ST_CLR_0_PKD, "R200_SE_VTX_ST_CLR_0_PKD" },
- { R200_SE_VTX_ST_CLR_1_PKD, "R200_SE_VTX_ST_CLR_1_PKD" },
- { R200_SE_VTX_ST_CLR_2_PKD, "R200_SE_VTX_ST_CLR_2_PKD" },
- { R200_SE_VTX_ST_CLR_3_PKD, "R200_SE_VTX_ST_CLR_3_PKD" },
- { R200_SE_VTX_ST_CLR_4_PKD, "R200_SE_VTX_ST_CLR_4_PKD" },
- { R200_SE_VTX_ST_CLR_5_PKD, "R200_SE_VTX_ST_CLR_5_PKD" },
- { R200_SE_VTX_ST_CLR_6_PKD, "R200_SE_VTX_ST_CLR_6_PKD" },
- { R200_SE_VTX_ST_CLR_7_PKD, "R200_SE_VTX_ST_CLR_7_PKD" },
- { R200_SE_VTX_ST_POS_0_X_2, "R200_SE_VTX_ST_POS_0_X_2" },
- { R200_SE_VTX_ST_POS_0_Y_2, "R200_SE_VTX_ST_POS_0_Y_2" },
- { R200_SE_VTX_ST_PAR_CLR_LD, "R200_SE_VTX_ST_PAR_CLR_LD" },
- { R200_SE_VTX_ST_USR_CLR_PKD, "R200_SE_VTX_ST_USR_CLR_PKD" },
- { R200_SE_VTX_ST_POS_0_X_3, "R200_SE_VTX_ST_POS_0_X_3" },
- { R200_SE_VTX_ST_POS_0_Y_3, "R200_SE_VTX_ST_POS_0_Y_3" },
- { R200_SE_VTX_ST_POS_0_Z_3, "R200_SE_VTX_ST_POS_0_Z_3" },
- { R200_SE_VTX_ST_END_OF_PKT, "R200_SE_VTX_ST_END_OF_PKT" },
- { R200_RE_POINTSIZE, "R200_RE_POINTSIZE" },
- { R200_RE_TOP_LEFT, "R200_RE_TOP_LEFT" },
- { R200_RE_AUX_SCISSOR_CNTL, "R200_RE_AUX_SCISSOR_CNTL" },
- { R200_PP_TXFILTER_0, "R200_PP_TXFILTER_0" },
- { R200_PP_TXFORMAT_0, "R200_PP_TXFORMAT_0" },
- { R200_PP_TXSIZE_0, "R200_PP_TXSIZE_0" },
- { R200_PP_TXFORMAT_X_0, "R200_PP_TXFORMAT_X_0" },
- { R200_PP_TXPITCH_0, "R200_PP_TXPITCH_0" },
- { R200_PP_BORDER_COLOR_0, "R200_PP_BORDER_COLOR_0" },
- { R200_PP_CUBIC_FACES_0, "R200_PP_CUBIC_FACES_0" },
- { R200_PP_TXFILTER_1, "R200_PP_TXFILTER_1" },
- { R200_PP_TXFORMAT_1, "R200_PP_TXFORMAT_1" },
- { R200_PP_TXSIZE_1, "R200_PP_TXSIZE_1" },
- { R200_PP_TXFORMAT_X_1, "R200_PP_TXFORMAT_X_1" },
- { R200_PP_TXPITCH_1, "R200_PP_TXPITCH_1" },
- { R200_PP_BORDER_COLOR_1, "R200_PP_BORDER_COLOR_1" },
- { R200_PP_CUBIC_FACES_1, "R200_PP_CUBIC_FACES_1" },
- { R200_PP_TXFILTER_2, "R200_PP_TXFILTER_2" },
- { R200_PP_TXFORMAT_2, "R200_PP_TXFORMAT_2" },
- { R200_PP_TXSIZE_2, "R200_PP_TXSIZE_2" },
- { R200_PP_TXFORMAT_X_2, "R200_PP_TXFORMAT_X_2" },
- { R200_PP_TXPITCH_2, "R200_PP_TXPITCH_2" },
- { R200_PP_BORDER_COLOR_2, "R200_PP_BORDER_COLOR_2" },
- { R200_PP_CUBIC_FACES_2, "R200_PP_CUBIC_FACES_2" },
- { R200_PP_TXFILTER_3, "R200_PP_TXFILTER_3" },
- { R200_PP_TXFORMAT_3, "R200_PP_TXFORMAT_3" },
- { R200_PP_TXSIZE_3, "R200_PP_TXSIZE_3" },
- { R200_PP_TXFORMAT_X_3, "R200_PP_TXFORMAT_X_3" },
- { R200_PP_TXPITCH_3, "R200_PP_TXPITCH_3" },
- { R200_PP_BORDER_COLOR_3, "R200_PP_BORDER_COLOR_3" },
- { R200_PP_CUBIC_FACES_3, "R200_PP_CUBIC_FACES_3" },
- { R200_PP_TXFILTER_4, "R200_PP_TXFILTER_4" },
- { R200_PP_TXFORMAT_4, "R200_PP_TXFORMAT_4" },
- { R200_PP_TXSIZE_4, "R200_PP_TXSIZE_4" },
- { R200_PP_TXFORMAT_X_4, "R200_PP_TXFORMAT_X_4" },
- { R200_PP_TXPITCH_4, "R200_PP_TXPITCH_4" },
- { R200_PP_BORDER_COLOR_4, "R200_PP_BORDER_COLOR_4" },
- { R200_PP_CUBIC_FACES_4, "R200_PP_CUBIC_FACES_4" },
- { R200_PP_TXFILTER_5, "R200_PP_TXFILTER_5" },
- { R200_PP_TXFORMAT_5, "R200_PP_TXFORMAT_5" },
- { R200_PP_TXSIZE_5, "R200_PP_TXSIZE_5" },
- { R200_PP_TXFORMAT_X_5, "R200_PP_TXFORMAT_X_5" },
- { R200_PP_TXPITCH_5, "R200_PP_TXPITCH_5" },
- { R200_PP_BORDER_COLOR_5, "R200_PP_BORDER_COLOR_5" },
- { R200_PP_CUBIC_FACES_5, "R200_PP_CUBIC_FACES_5" },
- { R200_PP_TXOFFSET_0, "R200_PP_TXOFFSET_0" },
- { R200_PP_CUBIC_OFFSET_F1_0, "R200_PP_CUBIC_OFFSET_F1_0" },
- { R200_PP_CUBIC_OFFSET_F2_0, "R200_PP_CUBIC_OFFSET_F2_0" },
- { R200_PP_CUBIC_OFFSET_F3_0, "R200_PP_CUBIC_OFFSET_F3_0" },
- { R200_PP_CUBIC_OFFSET_F4_0, "R200_PP_CUBIC_OFFSET_F4_0" },
- { R200_PP_CUBIC_OFFSET_F5_0, "R200_PP_CUBIC_OFFSET_F5_0" },
- { R200_PP_TXOFFSET_1, "R200_PP_TXOFFSET_1" },
- { R200_PP_CUBIC_OFFSET_F1_1, "R200_PP_CUBIC_OFFSET_F1_1" },
- { R200_PP_CUBIC_OFFSET_F2_1, "R200_PP_CUBIC_OFFSET_F2_1" },
- { R200_PP_CUBIC_OFFSET_F3_1, "R200_PP_CUBIC_OFFSET_F3_1" },
- { R200_PP_CUBIC_OFFSET_F4_1, "R200_PP_CUBIC_OFFSET_F4_1" },
- { R200_PP_CUBIC_OFFSET_F5_1, "R200_PP_CUBIC_OFFSET_F5_1" },
- { R200_PP_TXOFFSET_2, "R200_PP_TXOFFSET_2" },
- { R200_PP_CUBIC_OFFSET_F1_2, "R200_PP_CUBIC_OFFSET_F1_2" },
- { R200_PP_CUBIC_OFFSET_F2_2, "R200_PP_CUBIC_OFFSET_F2_2" },
- { R200_PP_CUBIC_OFFSET_F3_2, "R200_PP_CUBIC_OFFSET_F3_2" },
- { R200_PP_CUBIC_OFFSET_F4_2, "R200_PP_CUBIC_OFFSET_F4_2" },
- { R200_PP_CUBIC_OFFSET_F5_2, "R200_PP_CUBIC_OFFSET_F5_2" },
- { R200_PP_TXOFFSET_3, "R200_PP_TXOFFSET_3" },
- { R200_PP_CUBIC_OFFSET_F1_3, "R200_PP_CUBIC_OFFSET_F1_3" },
- { R200_PP_CUBIC_OFFSET_F2_3, "R200_PP_CUBIC_OFFSET_F2_3" },
- { R200_PP_CUBIC_OFFSET_F3_3, "R200_PP_CUBIC_OFFSET_F3_3" },
- { R200_PP_CUBIC_OFFSET_F4_3, "R200_PP_CUBIC_OFFSET_F4_3" },
- { R200_PP_CUBIC_OFFSET_F5_3, "R200_PP_CUBIC_OFFSET_F5_3" },
- { R200_PP_TXOFFSET_4, "R200_PP_TXOFFSET_4" },
- { R200_PP_CUBIC_OFFSET_F1_4, "R200_PP_CUBIC_OFFSET_F1_4" },
- { R200_PP_CUBIC_OFFSET_F2_4, "R200_PP_CUBIC_OFFSET_F2_4" },
- { R200_PP_CUBIC_OFFSET_F3_4, "R200_PP_CUBIC_OFFSET_F3_4" },
- { R200_PP_CUBIC_OFFSET_F4_4, "R200_PP_CUBIC_OFFSET_F4_4" },
- { R200_PP_CUBIC_OFFSET_F5_4, "R200_PP_CUBIC_OFFSET_F5_4" },
- { R200_PP_TXOFFSET_5, "R200_PP_TXOFFSET_5" },
- { R200_PP_CUBIC_OFFSET_F1_5, "R200_PP_CUBIC_OFFSET_F1_5" },
- { R200_PP_CUBIC_OFFSET_F2_5, "R200_PP_CUBIC_OFFSET_F2_5" },
- { R200_PP_CUBIC_OFFSET_F3_5, "R200_PP_CUBIC_OFFSET_F3_5" },
- { R200_PP_CUBIC_OFFSET_F4_5, "R200_PP_CUBIC_OFFSET_F4_5" },
- { R200_PP_CUBIC_OFFSET_F5_5, "R200_PP_CUBIC_OFFSET_F5_5" },
- { R200_PP_TAM_DEBUG3, "R200_PP_TAM_DEBUG3" },
- { R200_PP_TFACTOR_0, "R200_PP_TFACTOR_0" },
- { R200_PP_TFACTOR_1, "R200_PP_TFACTOR_1" },
- { R200_PP_TFACTOR_2, "R200_PP_TFACTOR_2" },
- { R200_PP_TFACTOR_3, "R200_PP_TFACTOR_3" },
- { R200_PP_TFACTOR_4, "R200_PP_TFACTOR_4" },
- { R200_PP_TFACTOR_5, "R200_PP_TFACTOR_5" },
- { R200_PP_TXCBLEND_0, "R200_PP_TXCBLEND_0" },
- { R200_PP_TXCBLEND2_0, "R200_PP_TXCBLEND2_0" },
- { R200_PP_TXABLEND_0, "R200_PP_TXABLEND_0" },
- { R200_PP_TXABLEND2_0, "R200_PP_TXABLEND2_0" },
- { R200_PP_TXCBLEND_1, "R200_PP_TXCBLEND_1" },
- { R200_PP_TXCBLEND2_1, "R200_PP_TXCBLEND2_1" },
- { R200_PP_TXABLEND_1, "R200_PP_TXABLEND_1" },
- { R200_PP_TXABLEND2_1, "R200_PP_TXABLEND2_1" },
- { R200_PP_TXCBLEND_2, "R200_PP_TXCBLEND_2" },
- { R200_PP_TXCBLEND2_2, "R200_PP_TXCBLEND2_2" },
- { R200_PP_TXABLEND_2, "R200_PP_TXABLEND_2" },
- { R200_PP_TXABLEND2_2, "R200_PP_TXABLEND2_2" },
- { R200_PP_TXCBLEND_3, "R200_PP_TXCBLEND_3" },
- { R200_PP_TXCBLEND2_3, "R200_PP_TXCBLEND2_3" },
- { R200_PP_TXABLEND_3, "R200_PP_TXABLEND_3" },
- { R200_PP_TXABLEND2_3, "R200_PP_TXABLEND2_3" },
- { R200_PP_TXCBLEND_4, "R200_PP_TXCBLEND_4" },
- { R200_PP_TXCBLEND2_4, "R200_PP_TXCBLEND2_4" },
- { R200_PP_TXABLEND_4, "R200_PP_TXABLEND_4" },
- { R200_PP_TXABLEND2_4, "R200_PP_TXABLEND2_4" },
- { R200_PP_TXCBLEND_5, "R200_PP_TXCBLEND_5" },
- { R200_PP_TXCBLEND2_5, "R200_PP_TXCBLEND2_5" },
- { R200_PP_TXABLEND_5, "R200_PP_TXABLEND_5" },
- { R200_PP_TXABLEND2_5, "R200_PP_TXABLEND2_5" },
- { R200_PP_TXCBLEND_6, "R200_PP_TXCBLEND_6" },
- { R200_PP_TXCBLEND2_6, "R200_PP_TXCBLEND2_6" },
- { R200_PP_TXABLEND_6, "R200_PP_TXABLEND_6" },
- { R200_PP_TXABLEND2_6, "R200_PP_TXABLEND2_6" },
- { R200_PP_TXCBLEND_7, "R200_PP_TXCBLEND_7" },
- { R200_PP_TXCBLEND2_7, "R200_PP_TXCBLEND2_7" },
- { R200_PP_TXABLEND_7, "R200_PP_TXABLEND_7" },
- { R200_PP_TXABLEND2_7, "R200_PP_TXABLEND2_7" },
- { R200_RB3D_BLENDCOLOR, "R200_RB3D_BLENDCOLOR" },
- { R200_RB3D_ABLENDCNTL, "R200_RB3D_ABLENDCNTL" },
- { R200_RB3D_CBLENDCNTL, "R200_RB3D_CBLENDCNTL" },
- { R200_SE_TCL_OUTPUT_VTX_COMP_SEL, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL" },
- { R200_PP_CNTL_X, "R200_PP_CNTL_X" },
- { R200_SE_VAP_CNTL_STATUS, "R200_SE_VAP_CNTL_STATUS" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_1, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_1" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_2, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_2" },
- { R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_3, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_3" },
- { R200_PP_TRI_PERF, "R200_PP_TRI_PERF" },
- { R200_PP_PERF_CNTL, "R200_PP_PERF_CNTL" },
-};
-
-static struct reg_names scalar_names[] = {
- { R200_SS_LIGHT_DCD_ADDR, "R200_SS_LIGHT_DCD_ADDR" },
- { R200_SS_LIGHT_DCM_ADDR, "R200_SS_LIGHT_DCM_ADDR" },
- { R200_SS_LIGHT_SPOT_EXPONENT_ADDR, "R200_SS_LIGHT_SPOT_EXPONENT_ADDR" },
- { R200_SS_LIGHT_SPOT_CUTOFF_ADDR, "R200_SS_LIGHT_SPOT_CUTOFF_ADDR" },
- { R200_SS_LIGHT_SPECULAR_THRESH_ADDR, "R200_SS_LIGHT_SPECULAR_THRESH_ADDR" },
- { R200_SS_LIGHT_RANGE_CUTOFF_SQRD, "R200_SS_LIGHT_RANGE_CUTOFF_SQRD" },
- { R200_SS_LIGHT_RANGE_ATT_CONST, "R200_SS_LIGHT_RANGE_ATT_CONST" },
- { R200_SS_VERT_GUARD_CLIP_ADJ_ADDR, "R200_SS_VERT_GUARD_CLIP_ADJ_ADDR" },
- { R200_SS_VERT_GUARD_DISCARD_ADJ_ADDR, "R200_SS_VERT_GUARD_DISCARD_ADJ_ADDR" },
- { R200_SS_HORZ_GUARD_CLIP_ADJ_ADDR, "R200_SS_HORZ_GUARD_CLIP_ADJ_ADDR" },
- { R200_SS_HORZ_GUARD_DISCARD_ADJ_ADDR, "R200_SS_HORZ_GUARD_DISCARD_ADJ_ADDR" },
- { R200_SS_MAT_0_SHININESS, "R200_SS_MAT_0_SHININESS" },
- { R200_SS_MAT_1_SHININESS, "R200_SS_MAT_1_SHININESS" },
- { 1000, "" },
-};
-
-/* Puff these out to make them look like normal (dword) registers.
- */
-static struct reg_names vector_names[] = {
- { 0, "start" },
- { R200_VS_LIGHT_AMBIENT_ADDR, "R200_VS_LIGHT_AMBIENT_ADDR" },
- { R200_VS_LIGHT_DIFFUSE_ADDR, "R200_VS_LIGHT_DIFFUSE_ADDR" },
- { R200_VS_LIGHT_SPECULAR_ADDR, "R200_VS_LIGHT_SPECULAR_ADDR" },
- { R200_VS_LIGHT_DIRPOS_ADDR, "R200_VS_LIGHT_DIRPOS_ADDR" },
- { R200_VS_LIGHT_HWVSPOT_ADDR, "R200_VS_LIGHT_HWVSPOT_ADDR" },
- { R200_VS_LIGHT_ATTENUATION_ADDR, "R200_VS_LIGHT_ATTENUATION_ADDR" },
- { R200_VS_SPOT_DUAL_CONE, "R200_VS_SPOT_DUAL_CONE" },
- { R200_VS_GLOBAL_AMBIENT_ADDR, "R200_VS_GLOBAL_AMBIENT_ADDR" },
- { R200_VS_FOG_PARAM_ADDR, "R200_VS_FOG_PARAM_ADDR" },
- { R200_VS_EYE_VECTOR_ADDR, "R200_VS_EYE_VECTOR_ADDR" },
- { R200_VS_UCP_ADDR, "R200_VS_UCP_ADDR" },
- { R200_VS_PNT_SPRITE_VPORT_SCALE, "R200_VS_PNT_SPRITE_VPORT_SCALE" },
- { R200_VS_MATRIX_0_MV, "R200_VS_MATRIX_0_MV" },
- { R200_VS_MATRIX_1_INV_MV, "R200_VS_MATRIX_1_INV_MV" },
- { R200_VS_MATRIX_2_MVP, "R200_VS_MATRIX_2_MVP" },
- { R200_VS_MATRIX_3_TEX0, "R200_VS_MATRIX_3_TEX0" },
- { R200_VS_MATRIX_4_TEX1, "R200_VS_MATRIX_4_TEX1" },
- { R200_VS_MATRIX_5_TEX2, "R200_VS_MATRIX_5_TEX2" },
- { R200_VS_MATRIX_6_TEX3, "R200_VS_MATRIX_6_TEX3" },
- { R200_VS_MATRIX_7_TEX4, "R200_VS_MATRIX_7_TEX4" },
- { R200_VS_MATRIX_8_TEX5, "R200_VS_MATRIX_8_TEX5" },
- { R200_VS_MAT_0_EMISS, "R200_VS_MAT_0_EMISS" },
- { R200_VS_MAT_0_AMB, "R200_VS_MAT_0_AMB" },
- { R200_VS_MAT_0_DIF, "R200_VS_MAT_0_DIF" },
- { R200_VS_MAT_0_SPEC, "R200_VS_MAT_0_SPEC" },
- { R200_VS_MAT_1_EMISS, "R200_VS_MAT_1_EMISS" },
- { R200_VS_MAT_1_AMB, "R200_VS_MAT_1_AMB" },
- { R200_VS_MAT_1_DIF, "R200_VS_MAT_1_DIF" },
- { R200_VS_MAT_1_SPEC, "R200_VS_MAT_1_SPEC" },
- { R200_VS_EYE2CLIP_MTX, "R200_VS_EYE2CLIP_MTX" },
- { R200_VS_PNT_SPRITE_ATT_CONST, "R200_VS_PNT_SPRITE_ATT_CONST" },
- { R200_VS_PNT_SPRITE_EYE_IN_MODEL, "R200_VS_PNT_SPRITE_EYE_IN_MODEL" },
- { R200_VS_PNT_SPRITE_CLAMP, "R200_VS_PNT_SPRITE_CLAMP" },
- { R200_VS_MAX, "R200_VS_MAX" },
- { 1000, "" },
-};
-
-union fi { float f; int i; };
-
-#define ISVEC 1
-#define ISFLOAT 2
-#define TOUCHED 4
-
-struct reg {
- int idx;
- struct reg_names *closest;
- int flags;
- union fi current;
- union fi *values;
- int nvalues;
- int nalloc;
- float vmin, vmax;
-};
-
-
-static struct reg regs[Elements(reg_names)+1];
-static struct reg scalars[512+1];
-static struct reg vectors[512*4+1];
-
-static int total, total_changed, bufs;
-
-static void init_regs( void )
-{
- struct reg_names *tmp;
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++) {
- regs[i].idx = reg_names[i].idx;
- regs[i].closest = &reg_names[i];
- regs[i].flags = 0;
- }
-
- for (i = 0, tmp = scalar_names ; i < Elements(scalars) ; i++) {
- if (tmp[1].idx == i) tmp++;
- scalars[i].idx = i;
- scalars[i].closest = tmp;
- scalars[i].flags = ISFLOAT;
- }
-
- for (i = 0, tmp = vector_names ; i < Elements(vectors) ; i++) {
- if (tmp[1].idx*4 == i) tmp++;
- vectors[i].idx = i;
- vectors[i].closest = tmp;
- vectors[i].flags = ISFLOAT|ISVEC;
- }
-
- regs[Elements(regs)-1].idx = -1;
- scalars[Elements(scalars)-1].idx = -1;
- vectors[Elements(vectors)-1].idx = -1;
-}
-
-static int find_or_add_value( struct reg *reg, int val )
-{
- int j;
-
- for ( j = 0 ; j < reg->nvalues ; j++)
- if ( val == reg->values[j].i )
- return 1;
-
- if (j == reg->nalloc) {
- reg->nalloc += 5;
- reg->nalloc *= 2;
- reg->values = (union fi *) realloc( reg->values,
- reg->nalloc * sizeof(union fi) );
- }
-
- reg->values[reg->nvalues++].i = val;
- return 0;
-}
-
-static struct reg *lookup_reg( struct reg *tab, int reg )
-{
- int i;
-
- for (i = 0 ; tab[i].idx != -1 ; i++) {
- if (tab[i].idx == reg)
- return &tab[i];
- }
-
- fprintf(stderr, "*** unknown reg 0x%x\n", reg);
- return NULL;
-}
-
-
-static const char *get_reg_name( struct reg *reg )
-{
- static char tmp[80];
-
- if (reg->idx == reg->closest->idx)
- return reg->closest->name;
-
-
- if (reg->flags & ISVEC) {
- if (reg->idx/4 != reg->closest->idx)
- sprintf(tmp, "%s+%d[%d]",
- reg->closest->name,
- (reg->idx/4) - reg->closest->idx,
- reg->idx%4);
- else
- sprintf(tmp, "%s[%d]", reg->closest->name, reg->idx%4);
- }
- else {
- if (reg->idx != reg->closest->idx)
- sprintf(tmp, "%s+%d", reg->closest->name, reg->idx - reg->closest->idx);
- else
- sprintf(tmp, "%s", reg->closest->name);
- }
-
- return tmp;
-}
-
-static int print_int_reg_assignment( struct reg *reg, int data )
-{
- int changed = (reg->current.i != data);
- int ever_seen = find_or_add_value( reg, data );
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, " %s <-- 0x%x", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (!ever_seen)
- fprintf(stderr, " *** BRAND NEW VALUE");
- else if (changed)
- fprintf(stderr, " *** CHANGED");
- }
-
- reg->current.i = data;
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-
-static int print_float_reg_assignment( struct reg *reg, float data )
-{
- int changed = (reg->current.f != data);
- int newmin = (data < reg->vmin);
- int newmax = (data > reg->vmax);
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, " %s <-- %.3f", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (newmin) {
- fprintf(stderr, " *** NEW MIN (prev %.3f)", reg->vmin);
- reg->vmin = data;
- }
- else if (newmax) {
- fprintf(stderr, " *** NEW MAX (prev %.3f)", reg->vmax);
- reg->vmax = data;
- }
- else if (changed) {
- fprintf(stderr, " *** CHANGED");
- }
- }
-
- reg->current.f = data;
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-static int print_reg_assignment( struct reg *reg, int data )
-{
- reg->flags |= TOUCHED;
- if (reg->flags & ISFLOAT)
- return print_float_reg_assignment( reg, *(float *)&data );
- else
- return print_int_reg_assignment( reg, data );
-}
-
-static void print_reg( struct reg *reg )
-{
- if (reg->flags & TOUCHED) {
- if (reg->flags & ISFLOAT) {
- fprintf(stderr, " %s == %f\n", get_reg_name(reg), reg->current.f);
- } else {
- fprintf(stderr, " %s == 0x%x\n", get_reg_name(reg), reg->current.i);
- }
- }
-}
-
-
-static void dump_state( void )
-{
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++)
- print_reg( &regs[i] );
-
- for (i = 0 ; i < Elements(scalars) ; i++)
- print_reg( &scalars[i] );
-
- for (i = 0 ; i < Elements(vectors) ; i++)
- print_reg( &vectors[i] );
-}
-
-
-
-static int radeon_emit_packets(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int id = (int)header.packet.packet_id;
- int sz = packet[id].len;
- int *data = (int *)cmdbuf->buf;
- int i;
-
- if (sz * sizeof(int) > cmdbuf->bufsz) {
- fprintf(stderr, "Packet overflows cmdbuf\n");
- return -EINVAL;
- }
-
- if (!packet[id].name) {
- fprintf(stderr, "*** Unknown packet 0 nr %d\n", id );
- return -EINVAL;
- }
-
-
- if (VERBOSE)
- fprintf(stderr, "Packet 0 reg %s nr %d\n", packet[id].name, sz );
-
- for ( i = 0 ; i < sz ; i++) {
- struct reg *reg = lookup_reg( regs, packet[id].start + i*4 );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars2(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset + 0x100;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars2, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
- if (start + stride * sz > 258) {
- fprintf(stderr, "emit scalars OVERFLOW %d/%d/%d\n", start, stride, sz);
- return -1;
- }
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-/* Check: inf/nan/extreme-size?
- * Check: table start, end, nr, etc.
- */
-static int radeon_emit_vectors(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int sz = header.vectors.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.vectors.offset;
- int stride = header.vectors.stride;
- int i,j;
-
- if (VERBOSE)
- fprintf(stderr, "emit vectors, start %d stride %d nr %d (end %d) (0x%x)\n",
- start, stride, sz, start + stride * sz, header.i);
-
-/* if (start + stride * (sz/4) > 128) { */
-/* fprintf(stderr, "emit vectors OVERFLOW %d/%d/%d\n", start, stride, sz); */
-/* return -1; */
-/* } */
-
- for (i = 0 ; i < sz ; start += stride) {
- int changed = 0;
- for (j = 0 ; j < 4 ; i++,j++) {
- struct reg *reg = lookup_reg( vectors, start*4+j );
- if (print_reg_assignment( reg, data[i] ))
- changed = 1;
- }
- if (changed)
- total_changed += 4;
- total += 4;
- }
-
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-#if 0
-static int print_vertex_format( int vfmt )
-{
- if (NORMAL) {
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- "vertex format",
- vfmt,
- "xy,",
- (vfmt & R200_VTX_Z0) ? "z," : "",
- (vfmt & R200_VTX_W0) ? "w0," : "",
- (vfmt & R200_VTX_FPCOLOR) ? "fpcolor," : "",
- (vfmt & R200_VTX_FPALPHA) ? "fpalpha," : "",
- (vfmt & R200_VTX_PKCOLOR) ? "pkcolor," : "",
- (vfmt & R200_VTX_FPSPEC) ? "fpspec," : "",
- (vfmt & R200_VTX_FPFOG) ? "fpfog," : "",
- (vfmt & R200_VTX_PKSPEC) ? "pkspec," : "",
- (vfmt & R200_VTX_ST0) ? "st0," : "",
- (vfmt & R200_VTX_ST1) ? "st1," : "",
- (vfmt & R200_VTX_Q1) ? "q1," : "",
- (vfmt & R200_VTX_ST2) ? "st2," : "",
- (vfmt & R200_VTX_Q2) ? "q2," : "",
- (vfmt & R200_VTX_ST3) ? "st3," : "",
- (vfmt & R200_VTX_Q3) ? "q3," : "",
- (vfmt & R200_VTX_Q0) ? "q0," : "",
- (vfmt & R200_VTX_N0) ? "n0," : "",
- (vfmt & R200_VTX_XY1) ? "xy1," : "",
- (vfmt & R200_VTX_Z1) ? "z1," : "",
- (vfmt & R200_VTX_W1) ? "w1," : "",
- (vfmt & R200_VTX_N1) ? "n1," : "");
-
-
- if (!find_or_add_value( &others[V_VTXFMT], vfmt ))
- fprintf(stderr, " *** NEW VALUE");
-
- fprintf(stderr, "\n");
- }
-
- return 0;
-}
-#endif
-
-static char *primname[0x10] = {
- "NONE",
- "POINTS",
- "LINES",
- "LINE_STRIP",
- "TRIANGLES",
- "TRIANGLE_FAN",
- "TRIANGLE_STRIP",
- "RECT_LIST",
- NULL,
- "3VRT_POINTS",
- "3VRT_LINES",
- "POINT_SPRITES",
- "LINE_LOOP",
- "QUADS",
- "QUAD_STRIP",
- "POLYGON",
-};
-
-static int print_prim_and_flags( int prim )
-{
- int numverts;
-
- if (NORMAL)
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s\n",
- "prim flags",
- prim,
- ((prim & 0x30) == R200_VF_PRIM_WALK_IND) ? "IND," : "",
- ((prim & 0x30) == R200_VF_PRIM_WALK_LIST) ? "LIST," : "",
- ((prim & 0x30) == R200_VF_PRIM_WALK_RING) ? "RING," : "",
- (prim & R200_VF_COLOR_ORDER_RGBA) ? "RGBA," : "BGRA, ",
- (prim & R200_VF_INDEX_SZ_4) ? "INDX-32," : "",
- (prim & R200_VF_TCL_OUTPUT_VTX_ENABLE) ? "TCL_OUT_VTX," : "");
-
- numverts = prim>>16;
-
- if (NORMAL)
- fprintf(stderr, " prim: %s numverts %d\n", primname[prim&0xf], numverts);
-
- switch (prim & 0xf) {
- case R200_VF_PRIM_NONE:
- case R200_VF_PRIM_POINTS:
- if (numverts < 1) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_LINES:
- case R200_VF_PRIM_POINT_SPRITES:
- if ((numverts & 1) || numverts == 0) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_LINE_STRIP:
- case R200_VF_PRIM_LINE_LOOP:
- if (numverts < 2) {
- fprintf(stderr, "Bad nr verts for line_strip %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_TRIANGLES:
- case R200_VF_PRIM_3VRT_POINTS:
- case R200_VF_PRIM_3VRT_LINES:
- case R200_VF_PRIM_RECT_LIST:
- if (numverts % 3 || numverts == 0) {
- fprintf(stderr, "Bad nr verts for tri %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_TRIANGLE_FAN:
- case R200_VF_PRIM_TRIANGLE_STRIP:
- case R200_VF_PRIM_POLYGON:
- if (numverts < 3) {
- fprintf(stderr, "Bad nr verts for strip/fan %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_QUADS:
- if (numverts % 4 || numverts == 0) {
- fprintf(stderr, "Bad nr verts for quad %d\n", numverts);
- return -1;
- }
- break;
- case R200_VF_PRIM_QUAD_STRIP:
- if (numverts % 2 || numverts < 4) {
- fprintf(stderr, "Bad nr verts for quadstrip %d\n", numverts);
- return -1;
- }
- break;
- default:
- fprintf(stderr, "Bad primitive\n");
- return -1;
- }
- return 0;
-}
-
-/* build in knowledge about each packet type
- */
-static int radeon_emit_packet3( drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int cmdsz;
- int *cmd = (int *)cmdbuf->buf;
- int *tmp;
- int i, stride, size, start;
-
- cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16);
-
- if ((cmd[0] & RADEON_CP_PACKET_MASK) != RADEON_CP_PACKET3 ||
- cmdsz * 4 > cmdbuf->bufsz ||
- cmdsz > RADEON_CP_PACKET_MAX_DWORDS) {
- fprintf(stderr, "Bad packet\n");
- return -EINVAL;
- }
-
- switch( cmd[0] & ~RADEON_CP_PACKET_COUNT_MASK ) {
- case R200_CP_CMD_NOP:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NOP, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_NEXT_CHAR:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NEXT_CHAR, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_PLY_NEXTSCAN:
- if (NORMAL)
- fprintf(stderr, "PACKET3_PLY_NEXTSCAN, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_SET_SCISSORS:
- if (NORMAL)
- fprintf(stderr, "PACKET3_SET_SCISSORS, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_LOAD_MICROCODE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_MICROCODE, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_WAIT_FOR_IDLE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_WAIT_FOR_IDLE, %d dwords\n", cmdsz);
- break;
-
- case R200_CP_CMD_3D_DRAW_VBUF:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_VBUF, %d dwords\n", cmdsz);
-/* print_vertex_format(cmd[1]); */
- if (print_prim_and_flags(cmd[2]))
- return -EINVAL;
- break;
-
- case R200_CP_CMD_3D_DRAW_IMMD:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_IMMD, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_3D_DRAW_INDX: {
- int neltdwords;
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_INDX, %d dwords\n", cmdsz);
-/* print_vertex_format(cmd[1]); */
- if (print_prim_and_flags(cmd[2]))
- return -EINVAL;
- neltdwords = cmd[2]>>16;
- neltdwords += neltdwords & 1;
- neltdwords /= 2;
- if (neltdwords + 3 != cmdsz)
- fprintf(stderr, "Mismatch in DRAW_INDX, %d vs cmdsz %d\n",
- neltdwords, cmdsz);
- break;
- }
- case R200_CP_CMD_LOAD_PALETTE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_PALETTE, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_3D_LOAD_VBPNTR:
- if (NORMAL) {
- fprintf(stderr, "PACKET3_3D_LOAD_VBPNTR, %d dwords\n", cmdsz);
- fprintf(stderr, " nr arrays: %d\n", cmd[1]);
- }
-
- if (((cmd[1]/2)*3) + ((cmd[1]%2)*2) != cmdsz - 2) {
- fprintf(stderr, " ****** MISMATCH %d/%d *******\n",
- ((cmd[1]/2)*3) + ((cmd[1]%2)*2) + 2, cmdsz);
- return -EINVAL;
- }
-
- if (NORMAL) {
- tmp = cmd+2;
- for (i = 0 ; i < cmd[1] ; i++) {
- if (i & 1) {
- stride = (tmp[0]>>24) & 0xff;
- size = (tmp[0]>>16) & 0xff;
- start = tmp[2];
- tmp += 3;
- }
- else {
- stride = (tmp[0]>>8) & 0xff;
- size = (tmp[0]) & 0xff;
- start = tmp[1];
- }
- fprintf(stderr, " array %d: start 0x%x vsize %d vstride %d\n",
- i, start, size, stride );
- }
- }
- break;
- case R200_CP_CMD_PAINT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_SMALLTEXT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_SMALLTEXT, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_HOSTDATA_BLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_HOSTDATA_BLT, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_POLYLINE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYLINE, %d dwords\n", cmdsz);
- break;
- case R200_CP_CMD_POLYSCANLINES:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYSCANLINES, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_PAINT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_BITBLT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_TRANS_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_TRANS_BITBLT, %d dwords\n",
- cmdsz);
- break;
- case R200_CP_CMD_3D_DRAW_VBUF_2:
- if (NORMAL)
- fprintf(stderr, "R200_CP_CMD_3D_DRAW_VBUF_2, %d dwords\n",
- cmdsz);
- if (print_prim_and_flags(cmd[1]))
- return -EINVAL;
- break;
- case R200_CP_CMD_3D_DRAW_IMMD_2:
- if (NORMAL)
- fprintf(stderr, "R200_CP_CMD_3D_DRAW_IMMD_2, %d dwords\n",
- cmdsz);
- if (print_prim_and_flags(cmd[1]))
- return -EINVAL;
- break;
- case R200_CP_CMD_3D_DRAW_INDX_2:
- if (NORMAL)
- fprintf(stderr, "R200_CP_CMD_3D_DRAW_INDX_2, %d dwords\n",
- cmdsz);
- if (print_prim_and_flags(cmd[1]))
- return -EINVAL;
- break;
- default:
- fprintf(stderr, "UNKNOWN PACKET, %d dwords\n", cmdsz);
- break;
- }
-
- cmdbuf->buf += cmdsz * 4;
- cmdbuf->bufsz -= cmdsz * 4;
- return 0;
-}
-
-
-/* Check cliprects for bounds, then pass on to above:
- */
-static int radeon_emit_packet3_cliprect( drm_radeon_cmd_buffer_t *cmdbuf )
-{
- drm_clip_rect_t *boxes = (drm_clip_rect_t *)cmdbuf->boxes;
- int i = 0;
-
- if (VERBOSE && total_changed) {
- dump_state();
- total_changed = 0;
- }
-
- if (NORMAL) {
- do {
- if ( i < cmdbuf->nbox ) {
- fprintf(stderr, "Emit box %d/%d %d,%d %d,%d\n",
- i, cmdbuf->nbox,
- boxes[i].x1, boxes[i].y1, boxes[i].x2, boxes[i].y2);
- }
- } while ( ++i < cmdbuf->nbox );
- }
-
- if (cmdbuf->nbox == 1)
- cmdbuf->nbox = 0;
-
- return radeon_emit_packet3( cmdbuf );
-}
-
-
-int r200SanityCmdBuffer( r200ContextPtr rmesa,
- int nbox,
- drm_clip_rect_t *boxes )
-{
- int idx;
- drm_radeon_cmd_buffer_t cmdbuf;
- drm_radeon_cmd_header_t header;
- static int inited = 0;
-
- if (!inited) {
- init_regs();
- inited = 1;
- }
-
-
- cmdbuf.buf = rmesa->store.cmd_buf;
- cmdbuf.bufsz = rmesa->store.cmd_used;
- cmdbuf.boxes = (drm_clip_rect_t *)boxes;
- cmdbuf.nbox = nbox;
-
- while ( cmdbuf.bufsz >= sizeof(header) ) {
-
- header.i = *(int *)cmdbuf.buf;
- cmdbuf.buf += sizeof(header);
- cmdbuf.bufsz -= sizeof(header);
-
- switch (header.header.cmd_type) {
- case RADEON_CMD_PACKET:
- if (radeon_emit_packets( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packets failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS:
- if (radeon_emit_scalars( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS2:
- if (radeon_emit_scalars2( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_VECTORS:
- if (radeon_emit_vectors( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_vectors failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_DMA_DISCARD:
- idx = header.dma.buf_idx;
- if (NORMAL)
- fprintf(stderr, "RADEON_CMD_DMA_DISCARD buf %d\n", idx);
- bufs++;
- break;
-
- case RADEON_CMD_PACKET3:
- if (radeon_emit_packet3( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3 failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_PACKET3_CLIP:
- if (radeon_emit_packet3_cliprect( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3_clip failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_WAIT:
- break;
-
- default:
- fprintf(stderr,"bad cmd_type %d at %p\n",
- header.header.cmd_type,
- cmdbuf.buf - sizeof(header));
- return -EINVAL;
- }
- }
-
- if (0)
- {
- static int n = 0;
- n++;
- if (n == 10) {
- fprintf(stderr, "Bufs %d Total emitted %d real changes %d (%.2f%%)\n",
- bufs,
- total, total_changed,
- ((float)total_changed/(float)total*100.0));
- fprintf(stderr, "Total emitted per buf: %.2f\n",
- (float)total/(float)bufs);
- fprintf(stderr, "Real changes per buf: %.2f\n",
- (float)total_changed/(float)bufs);
-
- bufs = n = total = total_changed = 0;
- }
- }
-
- fprintf(stderr, "leaving %s\n\n\n", __FUNCTION__);
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.h
deleted file mode 100644
index f4c110dba..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_sanity.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef R200_SANITY_H
-#define R200_SANITY_H
-
-extern int r200SanityCmdBuffer( r200ContextPtr rmesa,
- int nbox,
- drm_clip_rect_t *boxes );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c
deleted file mode 100644
index 08e4a3548..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.c,v 1.4 2003/05/08 09:25:35 herrb Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/**
- * \file r200_screen.c
- * Screen initialization functions for the R200 driver.
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <dlfcn.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#define STANDALONE_MMIO
-#include "r200_screen.h"
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_span.h"
-#include "radeon_macros.h"
-#include "radeon_reg.h"
-
-#include "drirenderbuffer.h"
-#include "utils.h"
-#include "vblank.h"
-#include "GL/internal/dri_interface.h"
-
-/* R200 configuration
- */
-#include "xmlpool.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_MAX_TEXTURE_UNITS(4,2,6)
- DRI_CONF_HYPERZ(false)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
- DRI_CONF_NO_NEG_LOD_BIAS(false)
- DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
- DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_TEXTURE_LEVEL_HACK(false)
- DRI_CONF_TEXTURE_BLEND_QUALITY(1.0,"0.0:1.0")
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_SOFTWARE
- DRI_CONF_ARB_VERTEX_PROGRAM(false)
- DRI_CONF_NV_VERTEX_PROGRAM(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 17;
-
-extern const struct dri_extension card_extensions[];
-extern const struct dri_extension blend_extensions[];
-extern const struct dri_extension ARB_vp_extension[];
-extern const struct dri_extension NV_vp_extension[];
-
-#if 1
-/* Including xf86PciInfo.h introduces a bunch of errors...
- */
-#define PCI_CHIP_R200_QD 0x5144 /* why do they have r200 names? */
-#define PCI_CHIP_R200_QE 0x5145 /* Those are all standard radeons */
-#define PCI_CHIP_R200_QF 0x5146
-#define PCI_CHIP_R200_QG 0x5147
-#define PCI_CHIP_R200_QY 0x5159
-#define PCI_CHIP_R200_QZ 0x515A
-#define PCI_CHIP_R200_LW 0x4C57
-#define PCI_CHIP_R200_LX 0x4C58
-#define PCI_CHIP_R200_LY 0x4C59
-#define PCI_CHIP_R200_LZ 0x4C5A
-#define PCI_CHIP_RV200_QW 0x5157 /* Radeon 7500 - not an R200 at all */
-#define PCI_CHIP_RV200_QX 0x5158
-#define PCI_CHIP_RS100_4136 0x4136 /* IGP RS100, RS200, RS250 are not R200 */
-#define PCI_CHIP_RS200_4137 0x4137
-#define PCI_CHIP_RS250_4237 0x4237
-#define PCI_CHIP_RS100_4336 0x4336
-#define PCI_CHIP_RS200_4337 0x4337
-#define PCI_CHIP_RS250_4437 0x4437
-#define PCI_CHIP_RS300_5834 0x5834 /* All RS300's are R200 */
-#define PCI_CHIP_RS300_5835 0x5835
-#define PCI_CHIP_RS300_5836 0x5836
-#define PCI_CHIP_RS300_5837 0x5837
-#define PCI_CHIP_R200_BB 0x4242 /* r200 (non-derived) start */
-#define PCI_CHIP_R200_BC 0x4243
-#define PCI_CHIP_R200_QH 0x5148
-#define PCI_CHIP_R200_QI 0x5149
-#define PCI_CHIP_R200_QJ 0x514A
-#define PCI_CHIP_R200_QK 0x514B
-#define PCI_CHIP_R200_QL 0x514C
-#define PCI_CHIP_R200_QM 0x514D
-#define PCI_CHIP_R200_QN 0x514E
-#define PCI_CHIP_R200_QO 0x514F /* r200 (non-derived) end */
-/* are the R200 Qh (0x5168) and following needed too? They are not in
- xf86PciInfo.h but in the pci database. Maybe just secondary ports or
- something ? Ah well, better be safe than sorry */
-#define PCI_CHIP_R200_Qh 0x5168
-#define PCI_CHIP_R200_Qi 0x5169
-#define PCI_CHIP_R200_Qj 0x516A
-#define PCI_CHIP_R200_Qk 0x516B
-#define PCI_CHIP_R200_Ql 0x516C
-
-#endif
-
-
-static r200ScreenPtr __r200Screen;
-
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-static __GLcontextModes *
-r200FillInModes( 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 */
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_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_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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;
-}
-
-
-/* Create the device specific screen private data struct.
- */
-static r200ScreenPtr
-r200CreateScreen( __DRIscreenPrivate *sPriv )
-{
- r200ScreenPtr screen;
- RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv;
- unsigned char *RADEONMMIO;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- screen = (r200ScreenPtr) CALLOC( sizeof(*screen) );
- if ( !screen ) {
- __driUtilMessage("%s: Could not allocate memory for screen structure",
- __FUNCTION__);
- return NULL;
- }
-
- screen->chipset = 0;
- switch ( dri_priv->deviceID ) {
- case PCI_CHIP_R200_QD:
- case PCI_CHIP_R200_QE:
- case PCI_CHIP_R200_QF:
- case PCI_CHIP_R200_QG:
- case PCI_CHIP_R200_QY:
- case PCI_CHIP_R200_QZ:
- case PCI_CHIP_RV200_QW:
- case PCI_CHIP_RV200_QX:
- case PCI_CHIP_R200_LW:
- case PCI_CHIP_R200_LX:
- case PCI_CHIP_R200_LY:
- case PCI_CHIP_R200_LZ:
- case PCI_CHIP_RS100_4136:
- case PCI_CHIP_RS200_4137:
- case PCI_CHIP_RS250_4237:
- case PCI_CHIP_RS100_4336:
- case PCI_CHIP_RS200_4337:
- case PCI_CHIP_RS250_4437:
- __driUtilMessage("r200CreateScreen(): Device isn't an r200!\n");
- FREE( screen );
- return NULL;
-
- case PCI_CHIP_RS300_5834:
- case PCI_CHIP_RS300_5835:
- case PCI_CHIP_RS300_5836:
- case PCI_CHIP_RS300_5837:
- break;
-
- case PCI_CHIP_R200_BB:
- case PCI_CHIP_R200_BC:
- case PCI_CHIP_R200_QH:
- case PCI_CHIP_R200_QI:
- case PCI_CHIP_R200_QJ:
- case PCI_CHIP_R200_QK:
- case PCI_CHIP_R200_QL:
- case PCI_CHIP_R200_QM:
- case PCI_CHIP_R200_QN:
- case PCI_CHIP_R200_QO:
- case PCI_CHIP_R200_Qh:
- case PCI_CHIP_R200_Qi:
- case PCI_CHIP_R200_Qj:
- case PCI_CHIP_R200_Qk:
- case PCI_CHIP_R200_Ql:
- screen->chipset |= R200_CHIPSET_REAL_R200;
- /* fallthrough */
- default:
- screen->chipset |= R200_CHIPSET_TCL;
- break;
- }
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- /* This is first since which regions we map depends on whether or
- * not we are using a PCI card.
- */
- screen->IsPCI = dri_priv->IsPCI;
-
- {
- int ret;
- drm_radeon_getparam_t gp;
-
- gp.param = RADEON_PARAM_GART_BUFFER_OFFSET;
- gp.value = &screen->gart_buffer_offset;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret);
- return NULL;
- }
-
- if (sPriv->drmMinor >= 6) {
- gp.param = RADEON_PARAM_GART_BASE;
- gp.value = &screen->gart_base;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmR200GetParam (RADEON_PARAM_GART_BASE): %d\n", ret);
- return NULL;
- }
-
-
- gp.param = RADEON_PARAM_IRQ_NR;
- gp.value = &screen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_IRQ_NR): %d\n", ret);
- return NULL;
- }
-
- /* Check if kernel module is new enough to support cube maps */
- screen->drmSupportsCubeMaps = (sPriv->drmMinor >= 7);
- /* Check if kernel module is new enough to support blend color and
- separate blend functions/equations */
- screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11);
-
- screen->drmSupportsTriPerf = (sPriv->drmMinor >= 16);
- }
- /* Check if ddx has set up a surface reg to cover depth buffer */
- screen->depthHasSurface = (sPriv->ddxMajor > 4);
- }
-
- screen->mmio.handle = dri_priv->registerHandle;
- screen->mmio.size = dri_priv->registerSize;
- if ( drmMap( sPriv->fd,
- screen->mmio.handle,
- screen->mmio.size,
- &screen->mmio.map ) ) {
- FREE( screen );
- __driUtilMessage("%s: drmMap failed\n", __FUNCTION__ );
- return NULL;
- }
-
- RADEONMMIO = screen->mmio.map;
-
- screen->status.handle = dri_priv->statusHandle;
- screen->status.size = dri_priv->statusSize;
- if ( drmMap( sPriv->fd,
- screen->status.handle,
- screen->status.size,
- &screen->status.map ) ) {
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__ );
- return NULL;
- }
- screen->scratch = (__volatile__ u_int32_t *)
- ((GLubyte *)screen->status.map + RADEON_SCRATCH_REG_OFFSET);
-
- screen->buffers = drmMapBufs( sPriv->fd );
- if ( !screen->buffers ) {
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__ );
- return NULL;
- }
-
- RADEONMMIO = screen->mmio.map;
-
- if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) {
-
- screen->gartTextures.handle = dri_priv->gartTexHandle;
- screen->gartTextures.size = dri_priv->gartTexMapSize;
- if ( drmMap( sPriv->fd,
- screen->gartTextures.handle,
- screen->gartTextures.size,
- (drmAddressPtr)&screen->gartTextures.map ) ) {
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMAP failed for GART texture area\n", __FUNCTION__);
- return NULL;
- }
-
- screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI
- ? INREG( RADEON_AIC_LO_ADDR )
- : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) );
- }
-
- screen->cpp = dri_priv->bpp / 8;
- screen->AGPMode = dri_priv->AGPMode;
-
- screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16;
-
- if ( sPriv->drmMinor >= 10 ) {
- drm_radeon_setparam_t sp;
-
- sp.param = RADEON_SETPARAM_FB_LOCATION;
- sp.value = screen->fbLocation;
-
- drmCommandWrite( sPriv->fd, DRM_RADEON_SETPARAM,
- &sp, sizeof( sp ) );
- }
-
- screen->frontOffset = dri_priv->frontOffset;
- screen->frontPitch = dri_priv->frontPitch;
- screen->backOffset = dri_priv->backOffset;
- screen->backPitch = dri_priv->backPitch;
- screen->depthOffset = dri_priv->depthOffset;
- screen->depthPitch = dri_priv->depthPitch;
-
- if ( dri_priv->textureSize == 0 ) {
- screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset;
- screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] =
- dri_priv->log2GARTTexGran;
- } else {
- screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset
- + screen->fbLocation;
- screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize;
- screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] =
- dri_priv->log2TexGran;
- }
-
- if ( !screen->gartTextures.map || dri_priv->textureSize == 0 ) {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1;
- screen->texOffset[RADEON_GART_TEX_HEAP] = 0;
- screen->texSize[RADEON_GART_TEX_HEAP] = 0;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] = 0;
- } else {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS;
- screen->texOffset[RADEON_GART_TEX_HEAP] = screen->gart_texture_offset;
- screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] =
- dri_priv->log2GARTTexGran;
- }
-
- screen->driScreen = sPriv;
- screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
-
- if ( glx_enable_extension != NULL ) {
- if ( screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
- }
-
- sPriv->psc->allocateMemory = (void *) r200AllocateMemoryMESA;
- sPriv->psc->freeMemory = (void *) r200FreeMemoryMESA;
- sPriv->psc->memoryOffset = (void *) r200GetMemoryOffsetMESA;
-
- return screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-r200DestroyScreen( __DRIscreenPrivate *sPriv )
-{
- r200ScreenPtr screen = (r200ScreenPtr)sPriv->private;
-
- if (!screen)
- return;
-
- if ( screen->gartTextures.map ) {
- drmUnmap( screen->gartTextures.map, screen->gartTextures.size );
- }
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
-
- /* free all option information */
- driDestroyOptionInfo (&screen->optionCache);
-
- FREE( screen );
- sPriv->private = NULL;
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-r200InitDriver( __DRIscreenPrivate *sPriv )
-{
- __r200Screen = r200CreateScreen( sPriv );
-
- sPriv->private = (void *) __r200Screen;
-
- return sPriv->private ? GL_TRUE : GL_FALSE;
-}
-
-
-/**
- * Create and initialize the Mesa and driver specific pixmap buffer
- * data. This is called to setup rendering to a particular window.
- *
- * \todo This function (and its interface) will need to be updated to support
- * pbuffers.
- */
-static GLboolean
-r200CreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- r200ScreenPtr screen = (r200ScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- const GLboolean swDepth = GL_FALSE;
- const GLboolean swAlpha = GL_FALSE;
- const GLboolean swAccum = mesaVis->accumRedBits > 0;
- const GLboolean swStencil = mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24;
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- swDepth,
- swStencil,
- swAccum,
- swAlpha );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- r200SetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- r200SetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- r200SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- r200SetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- r200SetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- swDepth,
- swStencil,
- swAccum,
- swAlpha,
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-r200DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-
-
-static const struct __DriverAPIRec r200API = {
- .InitDriver = r200InitDriver,
- .DestroyScreen = r200DestroyScreen,
- .CreateContext = r200CreateContext,
- .DestroyContext = r200DestroyContext,
- .CreateBuffer = r200CreateBuffer,
- .DestroyBuffer = r200DestroyBuffer,
- .SwapBuffers = r200SwapBuffers,
- .MakeCurrent = r200MakeCurrent,
- .UnbindContext = r200UnbindContext,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/**
- * 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIutilversion2 ddx_expected = { 4, 5, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 5, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions3( "R200",
- 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, &r200API);
- if ( psp != NULL ) {
- RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
- *driver_modes = r200FillInModes( dri_priv->bpp,
- (dri_priv->bpp == 16) ? 16 : 24,
- (dri_priv->bpp == 16) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- driInitExtensions( NULL, blend_extensions, GL_FALSE );
- driInitSingleExtension( NULL, ARB_vp_extension );
- driInitSingleExtension( NULL, NV_vp_extension );
- }
-
- return (void *) psp;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- r200ContextPtr rmesa;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = rmesa->swap_count;
- sInfo->swap_ust = rmesa->swap_ust;
- sInfo->swap_missed_count = rmesa->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, rmesa->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.h
deleted file mode 100644
index 91b43cbd7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_SCREEN_H__
-#define __R200_SCREEN_H__
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "radeon_drm.h"
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress map; /* Mapping of the DRM region */
-} r200RegionRec, *r200RegionPtr;
-
-
-/* chipset features */
-#define R200_CHIPSET_TCL (1 << 0)
-#define R200_CHIPSET_REAL_R200 (1 << 1)
-#define R200_CHIPSET_YCBCR_BROKEN (1 << 2)
-
-
-#define R200_NR_TEX_HEAPS 2
-
-typedef struct {
-
- int chipset;
- int cpp;
- int IsPCI; /* Current card is a PCI card */
- int AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- unsigned int fbLocation;
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- /* Shared texture data */
- int numTexHeaps;
- int texOffset[R200_NR_TEX_HEAPS];
- int texSize[R200_NR_TEX_HEAPS];
- int logTexGranularity[R200_NR_TEX_HEAPS];
-
- r200RegionRec mmio;
- r200RegionRec status;
- r200RegionRec gartTextures;
-
- drmBufMapPtr buffers;
-
- __volatile__ int32_t *scratch;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
- unsigned int gart_buffer_offset; /* offset in card memory space */
- unsigned int gart_texture_offset; /* offset in card memory space */
- unsigned int gart_base;
-
- GLboolean drmSupportsCubeMaps; /* need radeon kernel module >=1.7 */
- GLboolean drmSupportsBlendColor; /* need radeon kernel module >= 1.11 */
- GLboolean drmSupportsTriPerf; /* need radeon kernel module >= 1.16 */
- GLboolean depthHasSurface;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} r200ScreenRec, *r200ScreenPtr;
-
-#endif /* __R200_SCREEN_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.c
deleted file mode 100644
index 024e89461..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "swrast/swrast.h"
-#include "colormac.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_span.h"
-#include "r200_tex.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- r200ScreenPtr r200Screen = rmesa->r200Screen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint pitch = r200Screen->frontPitch * r200Screen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- rmesa->state.color.drawOffset + \
- (dPriv->x * r200Screen->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- rmesa->state.pixel.readOffset + \
- (dPriv->x * r200Screen->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- r200ScreenPtr r200Screen = rmesa->r200Screen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint height = dPriv->h; \
- GLuint xo = dPriv->x; \
- GLuint yo = dPriv->y; \
- char *buf = (char *)(sPriv->pFB + r200Screen->depthOffset); \
- (void) buf
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) r200##x##_RGB565
-#define TAG2(x,y) r200##x##_RGB565##y
-#include "spantmp2.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) r200##x##_ARGB8888
-#define TAG2(x,y) r200##x##_ARGB8888##y
-#include "spantmp2.h"
-
-
-/* ================================================================
- * Depth buffer
- */
-
-/* The Radeon family has depth tiling on all the time, so we have to convert
- * the x,y coordinates into the memory bus address (mba) in the same
- * manner as the engine. In each case, the linear block address (ba)
- * is calculated, and then wired with x and y to produce the final
- * memory address.
- * The chip will do address translation on its own if the surface registers
- * are set up correctly. It is not quite enough to get it working with hyperz too...
- */
-
-#define BIT(x,b) ((x & (1<<b))>>b)
-static GLuint r200_mba_z32( r200ContextPtr rmesa,
- GLint x, GLint y )
-{
- GLuint pitch = rmesa->r200Screen->frontPitch;
- if (rmesa->r200Screen->depthHasSurface) {
- return 4*(x + y*pitch);
- }
- else {
- GLuint b = ((y & 0x7FF) >> 4) * ((pitch & 0xFFF) >> 5) + ((x & 0x7FF) >> 5);
- GLuint a =
- (BIT(x,0) << 2) |
- (BIT(y,0) << 3) |
- (BIT(x,1) << 4) |
- (BIT(y,1) << 5) |
- (BIT(x,3) << 6) |
- (BIT(x,4) << 7) |
- (BIT(x,2) << 8) |
- (BIT(y,2) << 9) |
- (BIT(y,3) << 10) |
- (((pitch & 0x20) ? (b & 0x01) : ((b & 0x01) ^ (BIT(y,4)))) << 11) |
- ((b >> 1) << 12);
- return a;
- }
-}
-
-static GLuint r200_mba_z16( r200ContextPtr rmesa, GLint x, GLint y )
-{
- GLuint pitch = rmesa->r200Screen->frontPitch;
- if (rmesa->r200Screen->depthHasSurface) {
- return 2*(x + y*pitch);
- }
- else {
- GLuint b = ((y & 0x7FF) >> 4) * ((pitch & 0xFFF) >> 6) + ((x & 0x7FF) >> 6);
- GLuint a =
- (BIT(x,0) << 1) |
- (BIT(y,0) << 2) |
- (BIT(x,1) << 3) |
- (BIT(y,1) << 4) |
- (BIT(x,2) << 5) |
- (BIT(x,4) << 6) |
- (BIT(x,5) << 7) |
- (BIT(x,3) << 8) |
- (BIT(y,2) << 9) |
- (BIT(y,3) << 10) |
- (((pitch & 0x40) ? (b & 0x01) : ((b & 0x01) ^ (BIT(y,4)))) << 11) |
- ((b >> 1) << 12);
- return a;
- }
-}
-
-
-/* 16-bit depth buffer functions
- */
-
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + r200_mba_z16( rmesa, _x + xo, _y + yo )) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + r200_mba_z16( rmesa, _x + xo, _y + yo ));
-
-#define TAG(x) r200##x##_16
-#include "depthtmp.h"
-
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- tmp |= ((d) & 0x00ffffff); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + r200_mba_z32( rmesa, _x + xo, \
- _y + yo )) & 0x00ffffff;
-
-#define TAG(x) r200##x##_24_8
-#include "depthtmp.h"
-
-
-/* ================================================================
- * Stencil buffer
- */
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_STENCIL( _x, _y, d ) \
-do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0x00ffffff; \
- tmp |= (((d) & 0xff) << 24); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_STENCIL( d, _x, _y ) \
-do { \
- GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- d = tmp >> 24; \
-} while (0)
-
-#define TAG(x) r200##x##_24_8
-#include "stenciltmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void r200SetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- }
- break;
- case BUFFER_BIT_BACK_LEFT:
- if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- }
- break;
- default:
- _mesa_problem(ctx, "Bad bufferBit in %s", __FUNCTION__);
- break;
- }
-}
-
-/* Move locking out to get reasonable span performance (10x better
- * than doing this in HW_LOCK above). WaitForIdle() is the main
- * culprit.
- */
-
-static void r200SpanRenderStart( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- R200_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
- r200WaitForIdleLocked( rmesa );
-
- /* Read & rewrite the first pixel in the frame buffer. This should
- * be a noop, right? In fact without this conform fails as reading
- * from the framebuffer sometimes produces old results -- the
- * on-card read cache gets mixed up and doesn't notice that the
- * framebuffer has been updated.
- *
- * In the worst case this is buggy too as p might get the wrong
- * value first time, so really need a hidden pixel somewhere for this.
- */
- {
- int p;
- volatile int *read_buf = (volatile int *)(rmesa->dri.screen->pFB +
- rmesa->state.pixel.readOffset);
- p = *read_buf;
- *read_buf = p;
- }
-}
-
-static void r200SpanRenderFinish( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( rmesa );
-}
-
-void r200InitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = r200SetBuffer;
- swdd->SpanRenderStart = r200SpanRenderStart;
- swdd->SpanRenderFinish = r200SpanRenderFinish;
-}
-
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-r200SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- r200InitPointers_RGB565(&drb->Base);
- }
- else {
- r200InitPointers_ARGB8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = r200ReadDepthSpan_16;
- drb->Base.GetValues = r200ReadDepthPixels_16;
- drb->Base.PutRow = r200WriteDepthSpan_16;
- drb->Base.PutMonoRow = r200WriteMonoDepthSpan_16;
- drb->Base.PutValues = r200WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = r200ReadDepthSpan_24_8;
- drb->Base.GetValues = r200ReadDepthPixels_24_8;
- drb->Base.PutRow = r200WriteDepthSpan_24_8;
- drb->Base.PutMonoRow = r200WriteMonoDepthSpan_24_8;
- drb->Base.PutValues = r200WriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = r200ReadStencilSpan_24_8;
- drb->Base.GetValues = r200ReadStencilPixels_24_8;
- drb->Base.PutRow = r200WriteStencilSpan_24_8;
- drb->Base.PutMonoRow = r200WriteMonoStencilSpan_24_8;
- drb->Base.PutValues = r200WriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.h
deleted file mode 100644
index 8b9909559..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_span.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_SPAN_H__
-#define __R200_SPAN_H__
-
-#include "drirenderbuffer.h"
-
-extern void r200InitSpanFuncs( GLcontext *ctx );
-
-extern void
-r200SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.c
deleted file mode 100644
index 9a116f108..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.c
+++ /dev/null
@@ -1,2383 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-#include "enums.h"
-#include "colormac.h"
-#include "light.h"
-#include "buffers.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_tcl.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- R200_STATECHANGE( rmesa, ctx );
-
- pp_misc &= ~(R200_ALPHA_TEST_OP_MASK | R200_REF_ALPHA_MASK);
- pp_misc |= (refByte & R200_REF_ALPHA_MASK);
-
- switch ( func ) {
- case GL_NEVER:
- pp_misc |= R200_ALPHA_TEST_FAIL;
- break;
- case GL_LESS:
- pp_misc |= R200_ALPHA_TEST_LESS;
- break;
- case GL_EQUAL:
- pp_misc |= R200_ALPHA_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- pp_misc |= R200_ALPHA_TEST_LEQUAL;
- break;
- case GL_GREATER:
- pp_misc |= R200_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- pp_misc |= R200_ALPHA_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- pp_misc |= R200_ALPHA_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- pp_misc |= R200_ALPHA_TEST_PASS;
- break;
- }
-
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
-}
-
-static void r200BlendColor( GLcontext *ctx, const GLfloat cf[4] )
-{
- GLubyte color[4];
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- R200_STATECHANGE( rmesa, ctx );
- CLAMPED_FLOAT_TO_UBYTE(color[0], cf[0]);
- CLAMPED_FLOAT_TO_UBYTE(color[1], cf[1]);
- CLAMPED_FLOAT_TO_UBYTE(color[2], cf[2]);
- CLAMPED_FLOAT_TO_UBYTE(color[3], cf[3]);
- if (rmesa->r200Screen->drmSupportsBlendColor)
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCOLOR] = r200PackColor( 4, color[0], color[1], color[2], color[3] );
-}
-
-/**
- * Calculate the hardware blend factor setting. This same function is used
- * for source and destination of both alpha and RGB.
- *
- * \returns
- * The hardware register value for the specified blend factor. This value
- * will need to be shifted into the correct position for either source or
- * destination factor.
- *
- * \todo
- * Since the two cases where source and destination are handled differently
- * are essentially error cases, they should never happen. Determine if these
- * cases can be removed.
- */
-static int blend_factor( GLenum factor, GLboolean is_src )
-{
- int func;
-
- switch ( factor ) {
- case GL_ZERO:
- func = R200_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- func = R200_BLEND_GL_ONE;
- break;
- case GL_DST_COLOR:
- func = R200_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_COLOR:
- func = R200_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- func = R200_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- func = R200_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- func = (is_src) ? R200_BLEND_GL_SRC_ALPHA_SATURATE : R200_BLEND_GL_ZERO;
- break;
- case GL_CONSTANT_COLOR:
- func = R200_BLEND_GL_CONST_COLOR;
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_CONST_COLOR;
- break;
- case GL_CONSTANT_ALPHA:
- func = R200_BLEND_GL_CONST_ALPHA;
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_CONST_ALPHA;
- break;
- default:
- func = (is_src) ? R200_BLEND_GL_ONE : R200_BLEND_GL_ZERO;
- }
- return func;
-}
-
-/**
- * Sets both the blend equation and the blend function.
- * This is done in a single
- * function because some blend equations (i.e., \c GL_MIN and \c GL_MAX)
- * change the interpretation of the blend function.
- * Also, make sure that blend function and blend equation are set to their default
- * value if color blending is not enabled, since at least blend equations GL_MIN
- * and GL_FUNC_REVERSE_SUBTRACT will cause wrong results otherwise for
- * unknown reasons.
- */
-static void r200_set_blend_state( GLcontext * ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint cntl = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &
- ~(R200_ROP_ENABLE | R200_ALPHA_BLEND_ENABLE | R200_SEPARATE_ALPHA_ENABLE);
-
- int func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT);
- int eqn = R200_COMB_FCN_ADD_CLAMP;
- int funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT);
- int eqnA = R200_COMB_FCN_ADD_CLAMP;
-
- R200_STATECHANGE( rmesa, ctx );
-
- if (rmesa->r200Screen->drmSupportsBlendColor) {
- if (ctx->Color._LogicOpEnabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R200_ROP_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_ABLENDCNTL] = eqn | func;
- rmesa->hw.ctx.cmd[CTX_RB3D_CBLENDCNTL] = eqn | func;
- return;
- } else if (ctx->Color.BlendEnabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R200_ALPHA_BLEND_ENABLE | R200_SEPARATE_ALPHA_ENABLE;
- }
- else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl;
- rmesa->hw.ctx.cmd[CTX_RB3D_ABLENDCNTL] = eqn | func;
- rmesa->hw.ctx.cmd[CTX_RB3D_CBLENDCNTL] = eqn | func;
- return;
- }
- }
- else {
- if (ctx->Color._LogicOpEnabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R200_ROP_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = eqn | func;
- return;
- } else if (ctx->Color.BlendEnabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R200_ALPHA_BLEND_ENABLE;
- }
- else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl;
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = eqn | func;
- return;
- }
- }
-
- func = (blend_factor( ctx->Color.BlendSrcRGB, GL_TRUE ) << R200_SRC_BLEND_SHIFT) |
- (blend_factor( ctx->Color.BlendDstRGB, GL_FALSE ) << R200_DST_BLEND_SHIFT);
-
- switch(ctx->Color.BlendEquationRGB) {
- case GL_FUNC_ADD:
- eqn = R200_COMB_FCN_ADD_CLAMP;
- break;
-
- case GL_FUNC_SUBTRACT:
- eqn = R200_COMB_FCN_SUB_CLAMP;
- break;
-
- case GL_FUNC_REVERSE_SUBTRACT:
- eqn = R200_COMB_FCN_RSUB_CLAMP;
- break;
-
- case GL_MIN:
- eqn = R200_COMB_FCN_MIN;
- func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- case GL_MAX:
- eqn = R200_COMB_FCN_MAX;
- func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- default:
- fprintf( stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n",
- __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB );
- return;
- }
-
- if (!rmesa->r200Screen->drmSupportsBlendColor) {
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = eqn | func;
- return;
- }
-
- funcA = (blend_factor( ctx->Color.BlendSrcA, GL_TRUE ) << R200_SRC_BLEND_SHIFT) |
- (blend_factor( ctx->Color.BlendDstA, GL_FALSE ) << R200_DST_BLEND_SHIFT);
-
- switch(ctx->Color.BlendEquationA) {
- case GL_FUNC_ADD:
- eqnA = R200_COMB_FCN_ADD_CLAMP;
- break;
-
- case GL_FUNC_SUBTRACT:
- eqnA = R200_COMB_FCN_SUB_CLAMP;
- break;
-
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnA = R200_COMB_FCN_RSUB_CLAMP;
- break;
-
- case GL_MIN:
- eqnA = R200_COMB_FCN_MIN;
- funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- case GL_MAX:
- eqnA = R200_COMB_FCN_MAX;
- funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- default:
- fprintf( stderr, "[%s:%u] Invalid A blend equation (0x%04x).\n",
- __FUNCTION__, __LINE__, ctx->Color.BlendEquationA );
- return;
- }
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ABLENDCNTL] = eqnA | funcA;
- rmesa->hw.ctx.cmd[CTX_RB3D_CBLENDCNTL] = eqn | func;
-
-}
-
-static void r200BlendEquationSeparate( GLcontext *ctx,
- GLenum modeRGB, GLenum modeA )
-{
- r200_set_blend_state( ctx );
-}
-
-static void r200BlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- r200_set_blend_state( ctx );
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void r200DepthFunc( GLcontext *ctx, GLenum func )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_Z_TEST_MASK;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_TEST_ALWAYS;
- break;
- }
-}
-
-static void r200ClearDepth( GLcontext *ctx, GLclampd d )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &
- R200_DEPTH_FORMAT_MASK);
-
- switch ( format ) {
- case R200_DEPTH_FORMAT_16BIT_INT_Z:
- rmesa->state.depth.clear = d * 0x0000ffff;
- break;
- case R200_DEPTH_FORMAT_24BIT_INT_Z:
- rmesa->state.depth.clear = d * 0x00ffffff;
- break;
- }
-}
-
-static void r200DepthMask( GLcontext *ctx, GLboolean flag )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- R200_STATECHANGE( rmesa, ctx );
-
- if ( ctx->Depth.Mask ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_WRITE_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_Z_WRITE_ENABLE;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- union { int i; float f; } c, d;
- GLchan col[4];
- GLuint i;
-
- c.i = rmesa->hw.fog.cmd[FOG_C];
- d.i = rmesa->hw.fog.cmd[FOG_D];
-
- switch (pname) {
- case GL_FOG_MODE:
- if (!ctx->Fog.Enabled)
- return;
- R200_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_TCL_FOG_MASK;
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_LINEAR;
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- }
- else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = -1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- break;
- case GL_EXP:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_EXP;
- c.f = 0.0;
- d.f = -ctx->Fog.Density;
- break;
- case GL_EXP2:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_TCL_FOG_EXP2;
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- return;
- }
- break;
- case GL_FOG_DENSITY:
- switch (ctx->Fog.Mode) {
- case GL_EXP:
- c.f = 0.0;
- d.f = -ctx->Fog.Density;
- break;
- case GL_EXP2:
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- break;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- if (ctx->Fog.Mode == GL_LINEAR) {
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- } else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = -1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- }
- break;
- case GL_FOG_COLOR:
- R200_STATECHANGE( rmesa, ctx );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color );
- i = r200PackColor( 4, col[0], col[1], col[2], 0 );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] &= ~R200_FOG_COLOR_MASK;
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= i;
- break;
- case GL_FOG_COORD_SRC: {
- GLuint fmt_0 = rmesa->hw.vtx.cmd[VTX_VTXFMT_0];
- GLuint out_0 = rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0];
- GLuint fog = rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR];
-
- fog &= ~R200_FOG_USE_MASK;
- if ( ctx->Fog.FogCoordinateSource == GL_FOG_COORD ) {
- fog |= R200_FOG_USE_VTX_FOG;
- fmt_0 |= R200_VTX_DISCRETE_FOG;
- out_0 |= R200_VTX_DISCRETE_FOG;
- }
- else {
- fog |= R200_FOG_USE_SPEC_ALPHA;
- fmt_0 &= ~R200_VTX_DISCRETE_FOG;
- out_0 &= ~R200_VTX_DISCRETE_FOG;
- }
-
- if ( fog != rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] ) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] = fog;
- }
-
- if ( (fmt_0 != rmesa->hw.vtx.cmd[VTX_VTXFMT_0])
- || (out_0 != rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0])) {
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = fmt_0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] = out_0;
- }
-
- break;
- }
- default:
- return;
- }
-
- if (c.i != rmesa->hw.fog.cmd[FOG_C] || d.i != rmesa->hw.fog.cmd[FOG_D]) {
- R200_STATECHANGE( rmesa, fog );
- rmesa->hw.fog.cmd[FOG_C] = c.i;
- rmesa->hw.fog.cmd[FOG_D] = d.i;
- }
-}
-
-
-/* =============================================================
- * Scissoring
- */
-
-
-static GLboolean intersect_rect( drm_clip_rect_t *out,
- drm_clip_rect_t *a,
- drm_clip_rect_t *b )
-{
- *out = *a;
- if ( b->x1 > out->x1 ) out->x1 = b->x1;
- if ( b->y1 > out->y1 ) out->y1 = b->y1;
- if ( b->x2 < out->x2 ) out->x2 = b->x2;
- if ( b->y2 < out->y2 ) out->y2 = b->y2;
- if ( out->x1 >= out->x2 ) return GL_FALSE;
- if ( out->y1 >= out->y2 ) return GL_FALSE;
- return GL_TRUE;
-}
-
-
-void r200RecalcScissorRects( r200ContextPtr rmesa )
-{
- drm_clip_rect_t *out;
- int i;
-
- /* Grow cliprect store?
- */
- if (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- while (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- rmesa->state.scissor.numAllocedClipRects += 1; /* zero case */
- rmesa->state.scissor.numAllocedClipRects *= 2;
- }
-
- if (rmesa->state.scissor.pClipRects)
- FREE(rmesa->state.scissor.pClipRects);
-
- rmesa->state.scissor.pClipRects =
- MALLOC( rmesa->state.scissor.numAllocedClipRects *
- sizeof(drm_clip_rect_t) );
-
- if ( rmesa->state.scissor.pClipRects == NULL ) {
- rmesa->state.scissor.numAllocedClipRects = 0;
- return;
- }
- }
-
- out = rmesa->state.scissor.pClipRects;
- rmesa->state.scissor.numClipRects = 0;
-
- for ( i = 0 ; i < rmesa->numClipRects ; i++ ) {
- if ( intersect_rect( out,
- &rmesa->pClipRects[i],
- &rmesa->state.scissor.rect ) ) {
- rmesa->state.scissor.numClipRects++;
- out++;
- }
- }
-}
-
-
-static void r200UpdateScissor( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if ( rmesa->dri.drawable ) {
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- int x = ctx->Scissor.X;
- int y = dPriv->h - ctx->Scissor.Y - ctx->Scissor.Height;
- int w = ctx->Scissor.X + ctx->Scissor.Width - 1;
- int h = dPriv->h - ctx->Scissor.Y - 1;
-
- rmesa->state.scissor.rect.x1 = x + dPriv->x;
- rmesa->state.scissor.rect.y1 = y + dPriv->y;
- rmesa->state.scissor.rect.x2 = w + dPriv->x + 1;
- rmesa->state.scissor.rect.y2 = h + dPriv->y + 1;
-
- r200RecalcScissorRects( rmesa );
- }
-}
-
-
-static void r200Scissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if ( ctx->Scissor.Enabled ) {
- R200_FIREVERTICES( rmesa ); /* don't pipeline cliprect changes */
- r200UpdateScissor( ctx );
- }
-
-}
-
-
-/* =============================================================
- * Culling
- */
-
-static void r200CullFace( GLcontext *ctx, GLenum unused )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
- GLuint t = rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL];
-
- s |= R200_FFACE_SOLID | R200_BFACE_SOLID;
- t &= ~(R200_CULL_FRONT | R200_CULL_BACK);
-
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- s &= ~R200_FFACE_SOLID;
- t |= R200_CULL_FRONT;
- break;
- case GL_BACK:
- s &= ~R200_BFACE_SOLID;
- t |= R200_CULL_BACK;
- break;
- case GL_FRONT_AND_BACK:
- s &= ~(R200_FFACE_SOLID | R200_BFACE_SOLID);
- t |= (R200_CULL_FRONT | R200_CULL_BACK);
- break;
- }
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- R200_STATECHANGE(rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-
- if ( rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] != t ) {
- R200_STATECHANGE(rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] = t;
- }
-}
-
-static void r200FrontFace( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_FFACE_CULL_DIR_MASK;
-
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_CULL_FRONT_IS_CCW;
-
- switch ( mode ) {
- case GL_CW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_FFACE_CULL_CW;
- break;
- case GL_CCW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_FFACE_CULL_CCW;
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= R200_CULL_FRONT_IS_CCW;
- break;
- }
-}
-
-/* =============================================================
- * Point state
- */
-static void r200PointSize( GLcontext *ctx, GLfloat size )
-{
- if (0) fprintf(stderr, "%s: %f\n", __FUNCTION__, size );
-}
-
-/* =============================================================
- * Line state
- */
-static void r200LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, lin );
- R200_STATECHANGE( rmesa, set );
-
- /* Line width is stored in U6.4 format.
- */
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= ~0xffff;
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Line._Width * 16.0);
-
- if ( widthf > 1.0 ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_WIDELINE_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_WIDELINE_ENABLE;
- }
-}
-
-static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, lin );
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] =
- ((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern));
-}
-
-
-/* =============================================================
- * Masks
- */
-static void r200ColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint mask = r200PackColor( rmesa->r200Screen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- GLuint flag = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] & ~R200_PLANE_MASK_ENABLE;
-
- if (!(r && g && b && a))
- flag |= R200_PLANE_MASK_ENABLE;
-
- if ( rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] != flag ) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = flag;
- }
-
- if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) {
- R200_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = mask;
- }
-}
-
-
-/* =============================================================
- * Polygon state
- */
-
-static void r200PolygonOffset( GLcontext *ctx,
- GLfloat factor, GLfloat units )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat constant = units * rmesa->state.depth.scale;
-
-/* factor *= 2; */
-/* constant *= 2; */
-
-/* fprintf(stderr, "%s f:%f u:%f\n", __FUNCTION__, factor, constant); */
-
- R200_STATECHANGE( rmesa, zbs );
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = *(GLuint *)&factor;
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = *(GLuint *)&constant;
-}
-
-static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint i;
- drm_radeon_stipple_t stipple;
-
- /* Must flip pattern upside down.
- */
- for ( i = 0 ; i < 32 ; i++ ) {
- rmesa->state.stipple.mask[31 - i] = ((GLuint *) mask)[i];
- }
-
- /* TODO: push this into cmd mechanism
- */
- R200_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* FIXME: Use window x,y offsets into stipple RAM.
- */
- stipple.mask = rmesa->state.stipple.mask;
- drmCommandWrite( rmesa->dri.fd, DRM_RADEON_STIPPLE,
- &stipple, sizeof(stipple) );
- UNLOCK_HARDWARE( rmesa );
-}
-
-static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
-
- /* Can't generally do unfilled via tcl, but some good special
- * cases work.
- */
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, flag);
- if (rmesa->TclFallback) {
- r200ChooseRenderState( ctx );
- r200ChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * 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.
- */
-
-/* Examine lighting and texture state to determine if separate specular
- * should be enabled.
- */
-static void r200UpdateSpecular( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- u_int32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
-
- R200_STATECHANGE( rmesa, tcl );
- R200_STATECHANGE( rmesa, vtx );
-
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] &= ~(3<<R200_VTX_COLOR_0_SHIFT);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] &= ~(3<<R200_VTX_COLOR_1_SHIFT);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] &= ~R200_OUTPUT_COLOR_0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] &= ~R200_OUTPUT_COLOR_1;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LIGHTING_ENABLE;
-
- p &= ~R200_SPECULAR_ENABLE;
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_DIFFUSE_SPECULAR_COMBINE;
-
-
- if (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE;
- p |= R200_SPECULAR_ENABLE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &=
- ~R200_DIFFUSE_SPECULAR_COMBINE;
- }
- else if (ctx->Light.Enabled) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE;
- } else if (ctx->Fog.ColorSumEnabled ) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) |
- (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT));
- p |= R200_SPECULAR_ENABLE;
- } else {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT));
- }
-
- if (ctx->Fog.Enabled) {
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |=
- ((R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1;
- }
-
- if ( rmesa->hw.ctx.cmd[CTX_PP_CNTL] != p ) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = p;
- }
-
- /* Update vertex/render formats
- */
- if (rmesa->TclFallback) {
- r200ChooseRenderState( ctx );
- r200ChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * Materials
- */
-
-
-/* Update on colormaterial, material emmissive/ambient,
- * lightmodel.globalambient
- */
-static void update_global_ambient( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- float *fcmd = (float *)R200_DB_STATE( glt );
-
- /* Need to do more if both emmissive & ambient are PREMULT:
- * I believe this is not nessary when using source_material. This condition thus
- * will never happen currently, and the function has no dependencies on materials now
- */
- if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] &
- ((3 << R200_FRONT_EMISSIVE_SOURCE_SHIFT) |
- (3 << R200_FRONT_AMBIENT_SOURCE_SHIFT))) == 0)
- {
- COPY_3V( &fcmd[GLT_RED],
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION]);
- ACC_SCALE_3V( &fcmd[GLT_RED],
- ctx->Light.Model.Ambient,
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT]);
- }
- else
- {
- COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient );
- }
-
- R200_DB_STATECHANGE(rmesa, &rmesa->hw.glt);
-}
-
-/* Update on change to
- * - light[p].colors
- * - light[p].enabled
- */
-static void update_light_colors( GLcontext *ctx, GLuint p )
-{
- struct gl_light *l = &ctx->Light.Light[p];
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (l->Enabled) {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- float *fcmd = (float *)R200_DB_STATE( lit[p] );
-
- COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient );
- COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse );
- COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular );
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
-}
-
-static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1];
- light_model_ctl1 &= ~((0xf << R200_FRONT_EMISSIVE_SOURCE_SHIFT) |
- (0xf << R200_FRONT_AMBIENT_SOURCE_SHIFT) |
- (0xf << R200_FRONT_DIFFUSE_SOURCE_SHIFT) |
- (0xf << R200_FRONT_SPECULAR_SOURCE_SHIFT) |
- (0xf << R200_BACK_EMISSIVE_SOURCE_SHIFT) |
- (0xf << R200_BACK_AMBIENT_SOURCE_SHIFT) |
- (0xf << R200_BACK_DIFFUSE_SOURCE_SHIFT) |
- (0xf << R200_BACK_SPECULAR_SOURCE_SHIFT));
-
- if (ctx->Light.ColorMaterialEnabled) {
- GLuint mask = ctx->Light.ColorMaterialBitmask;
-
- if (mask & MAT_BIT_FRONT_EMISSION) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_EMISSIVE_SOURCE_SHIFT);
- }
- else
- light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_0 <<
- R200_FRONT_EMISSIVE_SOURCE_SHIFT);
-
- if (mask & MAT_BIT_FRONT_AMBIENT) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_AMBIENT_SOURCE_SHIFT);
- }
- else
- light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_0 <<
- R200_FRONT_AMBIENT_SOURCE_SHIFT);
-
- if (mask & MAT_BIT_FRONT_DIFFUSE) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_DIFFUSE_SOURCE_SHIFT);
- }
- else
- light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_0 <<
- R200_FRONT_DIFFUSE_SOURCE_SHIFT);
-
- if (mask & MAT_BIT_FRONT_SPECULAR) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_FRONT_SPECULAR_SOURCE_SHIFT);
- }
- else {
- light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_0 <<
- R200_FRONT_SPECULAR_SOURCE_SHIFT);
- }
-
- if (mask & MAT_BIT_BACK_EMISSION) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_BACK_EMISSIVE_SOURCE_SHIFT);
- }
-
- else light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_1 <<
- R200_BACK_EMISSIVE_SOURCE_SHIFT);
-
- if (mask & MAT_BIT_BACK_AMBIENT) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_BACK_AMBIENT_SOURCE_SHIFT);
- }
- else light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_1 <<
- R200_BACK_AMBIENT_SOURCE_SHIFT);
-
- if (mask & MAT_BIT_BACK_DIFFUSE) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_BACK_DIFFUSE_SOURCE_SHIFT);
- }
- else light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_1 <<
- R200_BACK_DIFFUSE_SOURCE_SHIFT);
-
- if (mask & MAT_BIT_BACK_SPECULAR) {
- light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 <<
- R200_BACK_SPECULAR_SOURCE_SHIFT);
- }
- else {
- light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_1 <<
- R200_BACK_SPECULAR_SOURCE_SHIFT);
- }
- }
- else {
- /* Default to SOURCE_MATERIAL:
- */
- light_model_ctl1 |=
- (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_EMISSIVE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_AMBIENT_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_DIFFUSE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_SPECULAR_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_EMISSIVE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_AMBIENT_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_DIFFUSE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_SPECULAR_SOURCE_SHIFT);
- }
-
- if (light_model_ctl1 != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1]) {
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] = light_model_ctl1;
- }
-
-
-}
-
-void r200UpdateMaterial( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
- GLfloat *fcmd = (GLfloat *)R200_DB_STATE( mtl[0] );
- GLfloat *fcmd2 = (GLfloat *)R200_DB_STATE( mtl[1] );
- GLuint mask = ~0;
-
- /* Might be possible and faster to update everything unconditionally? */
- if (ctx->Light.ColorMaterialEnabled)
- mask &= ~ctx->Light.ColorMaterialBitmask;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (mask & MAT_BIT_FRONT_EMISSION) {
- fcmd[MTL_EMMISSIVE_RED] = mat[MAT_ATTRIB_FRONT_EMISSION][0];
- fcmd[MTL_EMMISSIVE_GREEN] = mat[MAT_ATTRIB_FRONT_EMISSION][1];
- fcmd[MTL_EMMISSIVE_BLUE] = mat[MAT_ATTRIB_FRONT_EMISSION][2];
- fcmd[MTL_EMMISSIVE_ALPHA] = mat[MAT_ATTRIB_FRONT_EMISSION][3];
- }
- if (mask & MAT_BIT_FRONT_AMBIENT) {
- fcmd[MTL_AMBIENT_RED] = mat[MAT_ATTRIB_FRONT_AMBIENT][0];
- fcmd[MTL_AMBIENT_GREEN] = mat[MAT_ATTRIB_FRONT_AMBIENT][1];
- fcmd[MTL_AMBIENT_BLUE] = mat[MAT_ATTRIB_FRONT_AMBIENT][2];
- fcmd[MTL_AMBIENT_ALPHA] = mat[MAT_ATTRIB_FRONT_AMBIENT][3];
- }
- if (mask & MAT_BIT_FRONT_DIFFUSE) {
- fcmd[MTL_DIFFUSE_RED] = mat[MAT_ATTRIB_FRONT_DIFFUSE][0];
- fcmd[MTL_DIFFUSE_GREEN] = mat[MAT_ATTRIB_FRONT_DIFFUSE][1];
- fcmd[MTL_DIFFUSE_BLUE] = mat[MAT_ATTRIB_FRONT_DIFFUSE][2];
- fcmd[MTL_DIFFUSE_ALPHA] = mat[MAT_ATTRIB_FRONT_DIFFUSE][3];
- }
- if (mask & MAT_BIT_FRONT_SPECULAR) {
- fcmd[MTL_SPECULAR_RED] = mat[MAT_ATTRIB_FRONT_SPECULAR][0];
- fcmd[MTL_SPECULAR_GREEN] = mat[MAT_ATTRIB_FRONT_SPECULAR][1];
- fcmd[MTL_SPECULAR_BLUE] = mat[MAT_ATTRIB_FRONT_SPECULAR][2];
- fcmd[MTL_SPECULAR_ALPHA] = mat[MAT_ATTRIB_FRONT_SPECULAR][3];
- }
- if (mask & MAT_BIT_FRONT_SHININESS) {
- fcmd[MTL_SHININESS] = mat[MAT_ATTRIB_FRONT_SHININESS][0];
- }
-
- if (mask & MAT_BIT_BACK_EMISSION) {
- fcmd2[MTL_EMMISSIVE_RED] = mat[MAT_ATTRIB_BACK_EMISSION][0];
- fcmd2[MTL_EMMISSIVE_GREEN] = mat[MAT_ATTRIB_BACK_EMISSION][1];
- fcmd2[MTL_EMMISSIVE_BLUE] = mat[MAT_ATTRIB_BACK_EMISSION][2];
- fcmd2[MTL_EMMISSIVE_ALPHA] = mat[MAT_ATTRIB_BACK_EMISSION][3];
- }
- if (mask & MAT_BIT_BACK_AMBIENT) {
- fcmd2[MTL_AMBIENT_RED] = mat[MAT_ATTRIB_BACK_AMBIENT][0];
- fcmd2[MTL_AMBIENT_GREEN] = mat[MAT_ATTRIB_BACK_AMBIENT][1];
- fcmd2[MTL_AMBIENT_BLUE] = mat[MAT_ATTRIB_BACK_AMBIENT][2];
- fcmd2[MTL_AMBIENT_ALPHA] = mat[MAT_ATTRIB_BACK_AMBIENT][3];
- }
- if (mask & MAT_BIT_BACK_DIFFUSE) {
- fcmd2[MTL_DIFFUSE_RED] = mat[MAT_ATTRIB_BACK_DIFFUSE][0];
- fcmd2[MTL_DIFFUSE_GREEN] = mat[MAT_ATTRIB_BACK_DIFFUSE][1];
- fcmd2[MTL_DIFFUSE_BLUE] = mat[MAT_ATTRIB_BACK_DIFFUSE][2];
- fcmd2[MTL_DIFFUSE_ALPHA] = mat[MAT_ATTRIB_BACK_DIFFUSE][3];
- }
- if (mask & MAT_BIT_BACK_SPECULAR) {
- fcmd2[MTL_SPECULAR_RED] = mat[MAT_ATTRIB_BACK_SPECULAR][0];
- fcmd2[MTL_SPECULAR_GREEN] = mat[MAT_ATTRIB_BACK_SPECULAR][1];
- fcmd2[MTL_SPECULAR_BLUE] = mat[MAT_ATTRIB_BACK_SPECULAR][2];
- fcmd2[MTL_SPECULAR_ALPHA] = mat[MAT_ATTRIB_BACK_SPECULAR][3];
- }
- if (mask & MAT_BIT_BACK_SHININESS) {
- fcmd2[MTL_SHININESS] = mat[MAT_ATTRIB_BACK_SHININESS][0];
- }
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.mtl[0] );
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.mtl[1] );
-
- /* currently material changes cannot trigger a global ambient change, I believe this is correct
- update_global_ambient( ctx ); */
-}
-
-/* _NEW_LIGHT
- * _NEW_MODELVIEW
- * _MESA_NEW_NEED_EYE_COORDS
- *
- * Uses derived state from mesa:
- * _VP_inf_norm
- * _h_inf_norm
- * _Position
- * _NormDirection
- * _ModelViewInvScale
- * _NeedEyeCoords
- * _EyeZDir
- *
- * which are calculated in light.c and are correct for the current
- * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
- * and _MESA_NEW_NEED_EYE_COORDS.
- */
-static void update_light( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- /* Have to check these, or have an automatic shortcircuit mechanism
- * to remove noop statechanges. (Or just do a better job on the
- * front end).
- */
- {
- GLuint tmp = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0];
-
- if (ctx->_NeedEyeCoords)
- tmp &= ~R200_LIGHT_IN_MODELSPACE;
- else
- tmp |= R200_LIGHT_IN_MODELSPACE;
-
- if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0])
- {
- R200_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] = tmp;
- }
- }
-
- {
- GLfloat *fcmd = (GLfloat *)R200_DB_STATE( eye );
- fcmd[EYE_X] = ctx->_EyeZDir[0];
- fcmd[EYE_Y] = ctx->_EyeZDir[1];
- fcmd[EYE_Z] = - ctx->_EyeZDir[2];
- fcmd[EYE_RESCALE_FACTOR] = ctx->_ModelViewInvScale;
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.eye );
- }
-
-
-
- if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)R200_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
- fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
- fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
- fcmd[LIT_DIRECTION_W] = 0;
- }
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
- }
- }
-}
-
-static void r200Lightfv( GLcontext *ctx, GLenum light,
- GLenum pname, const GLfloat *params )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint p = light - GL_LIGHT0;
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd;
-
-
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- update_light_colors( ctx, p );
- break;
-
- case GL_SPOT_DIRECTION:
- /* picked up in update_light */
- break;
-
- case GL_POSITION: {
- /* positions picked up in update_light, but can do flag here */
- GLuint flag = (p&1)? R200_LIGHT_1_IS_LOCAL : R200_LIGHT_0_IS_LOCAL;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- R200_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_SPOT_EXPONENT:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_EXPONENT] = params[0];
- break;
-
- case GL_SPOT_CUTOFF: {
- GLuint flag = (p&1) ? R200_LIGHT_1_IS_SPOT : R200_LIGHT_0_IS_SPOT;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_CUTOFF] = l->_CosCutoff;
-
- R200_STATECHANGE(rmesa, tcl);
- if (l->SpotCutoff != 180.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
-
- break;
- }
-
- case GL_CONSTANT_ATTENUATION:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_CONST] = params[0];
- if ( params[0] == 0.0 )
- fcmd[LIT_ATTEN_CONST_INV] = FLT_MAX;
- else
- fcmd[LIT_ATTEN_CONST_INV] = 1.0 / params[0];
- break;
- case GL_LINEAR_ATTENUATION:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_LINEAR] = params[0];
- break;
- case GL_QUADRATIC_ATTENUATION:
- R200_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_QUADRATIC] = params[0];
- break;
- default:
- return;
- }
-
- /* Set RANGE_ATTEN only when needed */
- switch (pname) {
- case GL_POSITION:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION: {
- GLuint *icmd = (GLuint *)R200_DB_STATE( tcl );
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
- GLuint atten_flag = ( p&1 ) ? R200_LIGHT_1_ENABLE_RANGE_ATTEN
- : R200_LIGHT_0_ENABLE_RANGE_ATTEN;
- GLuint atten_const_flag = ( p&1 ) ? R200_LIGHT_1_CONSTANT_RANGE_ATTEN
- : R200_LIGHT_0_CONSTANT_RANGE_ATTEN;
-
- if ( l->EyePosition[3] == 0.0F ||
- ( ( fcmd[LIT_ATTEN_CONST] == 0.0 || fcmd[LIT_ATTEN_CONST] == 1.0 ) &&
- fcmd[LIT_ATTEN_QUADRATIC] == 0.0 && fcmd[LIT_ATTEN_LINEAR] == 0.0 ) ) {
- /* Disable attenuation */
- icmd[idx] &= ~atten_flag;
- } else {
- if ( fcmd[LIT_ATTEN_QUADRATIC] == 0.0 && fcmd[LIT_ATTEN_LINEAR] == 0.0 ) {
- /* Enable only constant portion of attenuation calculation */
- icmd[idx] |= ( atten_flag | atten_const_flag );
- } else {
- /* Enable full attenuation calculation */
- icmd[idx] &= ~atten_const_flag;
- icmd[idx] |= atten_flag;
- }
- }
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.tcl );
- break;
- }
- default:
- break;
- }
-}
-
-
-
-
-static void r200LightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- update_global_ambient( ctx );
- break;
-
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- R200_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.LocalViewer)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LOCAL_VIEWER;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER;
- break;
-
- case GL_LIGHT_MODEL_TWO_SIDE:
- R200_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.TwoSide)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHT_TWOSIDE;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~(R200_LIGHT_TWOSIDE);
- if (rmesa->TclFallback) {
- r200ChooseRenderState( ctx );
- r200ChooseVertexState( ctx );
- }
- break;
-
- case GL_LIGHT_MODEL_COLOR_CONTROL:
- r200UpdateSpecular(ctx);
- break;
-
- default:
- break;
- }
-}
-
-static void r200ShadeModel( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
-
- s &= ~(R200_DIFFUSE_SHADE_MASK |
- R200_ALPHA_SHADE_MASK |
- R200_SPECULAR_SHADE_MASK |
- R200_FOG_SHADE_MASK);
-
- switch ( mode ) {
- case GL_FLAT:
- s |= (R200_DIFFUSE_SHADE_FLAT |
- R200_ALPHA_SHADE_FLAT |
- R200_SPECULAR_SHADE_FLAT |
- R200_FOG_SHADE_FLAT);
- break;
- case GL_SMOOTH:
- s |= (R200_DIFFUSE_SHADE_GOURAUD |
- R200_ALPHA_SHADE_GOURAUD |
- R200_SPECULAR_SHADE_GOURAUD |
- R200_FOG_SHADE_GOURAUD);
- break;
- default:
- return;
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- R200_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-}
-
-
-/* =============================================================
- * User clip planes
- */
-
-static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
-{
- GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- R200_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
-}
-
-static void r200UpdateClipPlanes( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint p;
-
- for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- R200_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
- }
- }
-}
-
-
-/* =============================================================
- * Stencil
- */
-
-static void r200StencilFunc( GLcontext *ctx, GLenum func,
- GLint ref, GLuint mask )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref[0] << R200_STENCIL_REF_SHIFT) |
- (ctx->Stencil.ValueMask[0] << R200_STENCIL_MASK_SHIFT));
-
- R200_STATECHANGE( rmesa, ctx );
- R200_STATECHANGE( rmesa, msk );
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~R200_STENCIL_TEST_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~(R200_STENCIL_REF_MASK|
- R200_STENCIL_VALUE_MASK);
-
- switch ( ctx->Stencil.Function[0] ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_TEST_ALWAYS;
- break;
- }
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= refmask;
-}
-
-static void r200StencilMask( GLcontext *ctx, GLuint mask )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~R200_STENCIL_WRITE_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |=
- (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT);
-}
-
-static void r200StencilOp( GLcontext *ctx, GLenum fail,
- GLenum zfail, GLenum zpass )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~(R200_STENCIL_FAIL_MASK |
- R200_STENCIL_ZFAIL_MASK |
- R200_STENCIL_ZPASS_MASK);
-
- switch ( ctx->Stencil.FailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_DEC;
- break;
- case GL_INCR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INC_WRAP;
- break;
- case GL_DECR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_FAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZFailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_DEC;
- break;
- case GL_INCR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INC_WRAP;
- break;
- case GL_DECR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZFAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZPassFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_DEC;
- break;
- case GL_INCR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INC_WRAP;
- break;
- case GL_DECR_WRAP_EXT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_STENCIL_ZPASS_INVERT;
- break;
- }
-}
-
-static void r200ClearStencil( GLcontext *ctx, GLint s )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- rmesa->state.stencil.clear =
- ((GLuint) ctx->Stencil.Clear |
- (0xff << R200_STENCIL_MASK_SHIFT) |
- (ctx->Stencil.WriteMask[0] << R200_STENCIL_WRITEMASK_SHIFT));
-}
-
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-/*
- * To correctly position primitives:
- */
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-void r200UpdateWindow( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
- GLfloat sy = - v[MAT_SY];
- GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
- GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
- GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
-
- R200_FIREVERTICES( rmesa );
- R200_STATECHANGE( rmesa, vpt );
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = *(GLuint *)&sx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = *(GLuint *)&sy;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = *(GLuint *)&sz;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = *(GLuint *)&tz;
-}
-
-
-
-static void r200Viewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- /* Don't pipeline viewport changes, conflict with window offset
- * setting below. Could apply deltas to rescue pipelined viewport
- * values, or keep the originals hanging around.
- */
- R200_FIREVERTICES( R200_CONTEXT(ctx) );
- r200UpdateWindow( ctx );
-}
-
-static void r200DepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- r200UpdateWindow( ctx );
-}
-
-void r200UpdateViewportOffset( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
- GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
-
- if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx ||
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty )
- {
- /* Note: this should also modify whatever data the context reset
- * code uses...
- */
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
-
- /* update polygon stipple x/y screen offset */
- {
- GLuint stx, sty;
- GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC];
-
- m &= ~(R200_STIPPLE_X_OFFSET_MASK |
- R200_STIPPLE_Y_OFFSET_MASK);
-
- /* add magic offsets, then invert */
- stx = 31 - ((rmesa->dri.drawable->x - 1) & R200_STIPPLE_COORD_MASK);
- sty = 31 - ((rmesa->dri.drawable->y + rmesa->dri.drawable->h - 1)
- & R200_STIPPLE_COORD_MASK);
-
- m |= ((stx << R200_STIPPLE_X_OFFSET_SHIFT) |
- (sty << R200_STIPPLE_Y_OFFSET_SHIFT));
-
- if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) {
- R200_STATECHANGE( rmesa, msc );
- rmesa->hw.msc.cmd[MSC_RE_MISC] = m;
- }
- }
- }
-
- r200UpdateScissor( ctx );
-}
-
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLubyte color[4];
- CLAMPED_FLOAT_TO_UBYTE(color[0], c[0]);
- CLAMPED_FLOAT_TO_UBYTE(color[1], c[1]);
- CLAMPED_FLOAT_TO_UBYTE(color[2], c[2]);
- CLAMPED_FLOAT_TO_UBYTE(color[3], c[3]);
- rmesa->state.color.clear = r200PackColor( rmesa->r200Screen->cpp,
- color[0], color[1],
- color[2], color[3] );
-}
-
-
-static void r200RenderMode( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- FALLBACK( rmesa, R200_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-static GLuint r200_rop_tab[] = {
- R200_ROP_CLEAR,
- R200_ROP_AND,
- R200_ROP_AND_REVERSE,
- R200_ROP_COPY,
- R200_ROP_AND_INVERTED,
- R200_ROP_NOOP,
- R200_ROP_XOR,
- R200_ROP_OR,
- R200_ROP_NOR,
- R200_ROP_EQUIV,
- R200_ROP_INVERT,
- R200_ROP_OR_REVERSE,
- R200_ROP_COPY_INVERTED,
- R200_ROP_OR_INVERTED,
- R200_ROP_NAND,
- R200_ROP_SET,
-};
-
-static void r200LogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint rop = (GLuint)opcode - GL_CLEAR;
-
- ASSERT( rop < 16 );
-
- R200_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = r200_rop_tab[rop];
-}
-
-
-void r200SetCliprects( r200ContextPtr rmesa, GLenum mode )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = dPriv->pClipRects;
- break;
- case GL_BACK_LEFT:
- /* Can't ignore 2d windows if we are page flipping.
- */
- if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) {
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = dPriv->pClipRects;
- }
- else {
- rmesa->numClipRects = dPriv->numBackClipRects;
- rmesa->pClipRects = dPriv->pBackClipRects;
- }
- break;
- default:
- fprintf(stderr, "bad mode in r200SetCliprects\n");
- return;
- }
-
- if (rmesa->state.scissor.enabled)
- r200RecalcScissorRects( rmesa );
-}
-
-
-static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- R200_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- r200SetCliprects( rmesa, GL_FRONT_LEFT );
- break;
- case BUFFER_BIT_BACK_LEFT:
- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
- r200SetCliprects( rmesa, GL_BACK_LEFT );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->r200Screen->fbLocation)
- & R200_COLOROFFSET_MASK);
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
- }
-}
-
-
-static void r200ReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-/* =============================================================
- * State enable/disable
- */
-
-static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint p, flag;
-
- if ( R200_DEBUG & DEBUG_STATE )
- fprintf( stderr, "%s( %s = %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( cap ),
- state ? "GL_TRUE" : "GL_FALSE" );
-
- switch ( cap ) {
- /* Fast track this one...
- */
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- break;
-
- case GL_ALPHA_TEST:
- R200_STATECHANGE( rmesa, ctx );
- if (state) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ALPHA_TEST_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ALPHA_TEST_ENABLE;
- }
- break;
-
- case GL_BLEND:
- case GL_COLOR_LOGIC_OP:
- r200_set_blend_state( ctx );
- break;
-
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- p = cap-GL_CLIP_PLANE0;
- R200_STATECHANGE( rmesa, tcl );
- if (state) {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (R200_UCP_ENABLE_0<<p);
- r200ClipPlane( ctx, cap, NULL );
- }
- else {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(R200_UCP_ENABLE_0<<p);
- }
- break;
-
- case GL_COLOR_MATERIAL:
- r200ColorMaterial( ctx, 0, 0 );
- r200UpdateMaterial( ctx );
- break;
-
- case GL_CULL_FACE:
- r200CullFace( ctx, 0 );
- break;
-
- case GL_DEPTH_TEST:
- R200_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_Z_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_Z_ENABLE;
- }
- break;
-
- case GL_DITHER:
- R200_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~rmesa->state.color.roundEnable;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
- }
- break;
-
- case GL_FOG:
- R200_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_FOG_ENABLE;
- r200Fogfv( ctx, GL_FOG_MODE, NULL );
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_FOG_ENABLE;
- R200_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_TCL_FOG_MASK;
- }
- r200UpdateSpecular( ctx ); /* for PK_SPEC */
- if (rmesa->TclFallback)
- r200ChooseVertexState( ctx );
- _mesa_allow_light_in_model( ctx, !state );
- break;
-
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- R200_STATECHANGE(rmesa, tcl);
- p = cap - GL_LIGHT0;
- if (p&1)
- flag = (R200_LIGHT_1_ENABLE |
- R200_LIGHT_1_ENABLE_AMBIENT |
- R200_LIGHT_1_ENABLE_SPECULAR);
- else
- flag = (R200_LIGHT_0_ENABLE |
- R200_LIGHT_0_ENABLE_AMBIENT |
- R200_LIGHT_0_ENABLE_SPECULAR);
-
- if (state)
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] |= flag;
- else
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] &= ~flag;
-
- /*
- */
- update_light_colors( ctx, p );
- break;
-
- case GL_LIGHTING:
- r200UpdateSpecular(ctx);
- break;
-
- case GL_LINE_SMOOTH:
- R200_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ANTI_ALIAS_LINE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ANTI_ALIAS_LINE;
- }
- break;
-
- case GL_LINE_STIPPLE:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_PATTERN_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_PATTERN_ENABLE;
- }
- break;
-
- case GL_NORMALIZE:
- R200_STATECHANGE( rmesa, tcl );
- if ( state ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_NORMALIZE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_NORMALIZE_NORMALS;
- }
- break;
-
- /* Pointsize registers on r200 don't seem to do anything. Maybe
- * have to pass pointsizes as vertex parameters? In any case,
- * setting pointmin == pointsizemax == 1.0, and doing nothing
- * for aa is enough to satisfy conform.
- */
- case GL_POINT_SMOOTH:
- break;
-
- /* These don't really do anything, as we don't use the 3vtx
- * primitives yet.
- */
-#if 0
- case GL_POLYGON_OFFSET_POINT:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_POINT;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_POINT;
- }
- break;
-
- case GL_POLYGON_OFFSET_LINE:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_LINE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_LINE;
- }
- break;
-#endif
-
- case GL_POLYGON_OFFSET_FILL:
- R200_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_ZBIAS_ENABLE_TRI;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~R200_ZBIAS_ENABLE_TRI;
- }
- break;
-
- case GL_POLYGON_SMOOTH:
- R200_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_ANTI_ALIAS_POLY;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~R200_ANTI_ALIAS_POLY;
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- R200_STATECHANGE(rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_STIPPLE_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_STIPPLE_ENABLE;
- }
- break;
-
- case GL_RESCALE_NORMAL_EXT: {
- GLboolean tmp = ctx->_NeedEyeCoords ? state : !state;
- R200_STATECHANGE( rmesa, tcl );
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_RESCALE_NORMALS;
- }
- break;
- }
-
- case GL_SCISSOR_TEST:
- R200_FIREVERTICES( rmesa );
- rmesa->state.scissor.enabled = state;
- r200UpdateScissor( ctx );
- break;
-
- case GL_STENCIL_TEST:
- if ( rmesa->state.stencil.hwBuffer ) {
- R200_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_STENCIL_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~R200_STENCIL_ENABLE;
- }
- } else {
- FALLBACK( rmesa, R200_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_TEXTURE_GEN_Q:
- case GL_TEXTURE_GEN_R:
- case GL_TEXTURE_GEN_S:
- case GL_TEXTURE_GEN_T:
- /* Picked up in r200UpdateTextureState.
- */
- rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE;
- break;
-
- case GL_COLOR_SUM_EXT:
- r200UpdateSpecular ( ctx );
- break;
-
- case GL_VERTEX_PROGRAM_ARB:
- TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_VERTEX_PROGRAM, state);
- break;
-
- default:
- return;
- }
-}
-
-
-void r200LightingSpaceChange( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean tmp;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d BEFORE %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]);
-
- if (ctx->_NeedEyeCoords)
- tmp = ctx->Transform.RescaleNormals;
- else
- tmp = !ctx->Transform.RescaleNormals;
-
- R200_STATECHANGE( rmesa, tcl );
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_RESCALE_NORMALS;
- }
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d AFTER %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]);
-}
-
-/* =============================================================
- * Deferred state management - matrices, textures, other?
- */
-
-
-
-
-static void upload_matrix( r200ContextPtr rmesa, GLfloat *src, int idx )
-{
- float *dest = ((float *)R200_DB_STATE( mat[idx] ))+MAT_ELT_0;
- int i;
-
-
- for (i = 0 ; i < 4 ; i++) {
- *dest++ = src[i];
- *dest++ = src[i+4];
- *dest++ = src[i+8];
- *dest++ = src[i+12];
- }
-
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-static void upload_matrix_t( r200ContextPtr rmesa, const GLfloat *src, int idx )
-{
- float *dest = ((float *)R200_DB_STATE( mat[idx] ))+MAT_ELT_0;
- memcpy(dest, src, 16*sizeof(float));
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-
-static void update_texturematrix( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- GLuint tpc = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0];
- GLuint compsel = rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL];
- int unit;
-
- if (R200_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s before COMPSEL: %x\n", __FUNCTION__,
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]);
-
- rmesa->TexMatEnabled = 0;
- rmesa->TexMatCompSel = 0;
-
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
- if (!ctx->Texture.Unit[unit]._ReallyEnabled)
- continue;
-
- if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) {
- rmesa->TexMatEnabled |= (R200_TEXGEN_TEXMAT_0_ENABLE|
- R200_TEXMAT_0_ENABLE) << unit;
-
- rmesa->TexMatCompSel |= R200_OUTPUT_TEX_0 << unit;
-
- if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) {
- /* Need to preconcatenate any active texgen
- * obj/eyeplane matrices:
- */
- _math_matrix_mul_matrix( &rmesa->tmpmat,
- ctx->TextureMatrixStack[unit].Top,
- &rmesa->TexGenMatrix[unit] );
- upload_matrix( rmesa, rmesa->tmpmat.m, R200_MTX_TEX0+unit );
- }
- else {
- upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m,
- R200_MTX_TEX0+unit );
- }
- }
- else if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) {
- upload_matrix( rmesa, rmesa->TexGenMatrix[unit].m,
- R200_MTX_TEX0+unit );
- }
- }
-
- tpc = (rmesa->TexMatEnabled | rmesa->TexGenEnabled);
- if (tpc != rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0]) {
- R200_STATECHANGE(rmesa, tcg);
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0] = tpc;
- }
-
- compsel &= ~R200_OUTPUT_TEX_MASK;
- compsel |= rmesa->TexMatCompSel | rmesa->TexGenCompSel;
- if (compsel != rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]) {
- R200_STATECHANGE(rmesa, vtx);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] = compsel;
- }
-}
-
-
-
-void r200ValidateState( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint new_state = rmesa->NewGLState;
-
- if (new_state & _NEW_TEXTURE) {
- r200UpdateTextureState( ctx );
- new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */
- }
-
- /* Need an event driven matrix update?
- */
- if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
- upload_matrix( rmesa, ctx->_ModelProjectMatrix.m, R200_MTX_MVP );
-
- /* Need these for lighting (shouldn't upload otherwise)
- */
- if (new_state & (_NEW_MODELVIEW)) {
- upload_matrix( rmesa, ctx->ModelviewMatrixStack.Top->m, R200_MTX_MV );
- upload_matrix_t( rmesa, ctx->ModelviewMatrixStack.Top->inv, R200_MTX_IMV );
- }
-
- /* Does this need to be triggered on eg. modelview for
- * texgen-derived objplane/eyeplane matrices?
- */
- if (new_state & (_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) {
- update_texturematrix( ctx );
- }
-
- if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW|_MESA_NEW_NEED_EYE_COORDS)) {
- update_light( ctx );
- }
-
- /* emit all active clip planes if projection matrix changes.
- */
- if (new_state & (_NEW_PROJECTION)) {
- if (ctx->Transform.ClipPlanesEnabled)
- r200UpdateClipPlanes( ctx );
- }
-
-
- rmesa->NewGLState = 0;
-}
-
-
-static void r200InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _ae_invalidate_state( ctx, new_state );
- R200_CONTEXT(ctx)->NewGLState |= new_state;
- r200VtxfmtInvalidate( ctx );
-}
-
-/* A hack. The r200 can actually cope just fine with materials
- * between begin/ends, so fix this. But how ?
- */
-static GLboolean check_material( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLint i;
-
- for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT;
- i < _TNL_ATTRIB_MAT_BACK_INDEXES;
- i++)
- if (tnl->vb.AttribPtr[i] &&
- tnl->vb.AttribPtr[i]->stride)
- return GL_TRUE;
-
- return GL_FALSE;
-}
-
-static void r200WrapRunPipeline( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean has_material;
-
- if (0)
- fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState);
-
- /* Validate state:
- */
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- has_material = (ctx->Light.Enabled && check_material( ctx ));
-
- if (has_material) {
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE );
- }
-
- /* Run the pipeline.
- */
- _tnl_run_pipeline( ctx );
-
- if (has_material) {
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_FALSE );
- }
-}
-
-
-/* Initialize the driver's state functions.
- */
-void r200InitStateFuncs( struct dd_function_table *functions )
-{
- functions->UpdateState = r200InvalidateState;
- functions->LightingSpaceChange = r200LightingSpaceChange;
-
- functions->DrawBuffer = r200DrawBuffer;
- functions->ReadBuffer = r200ReadBuffer;
-
- functions->AlphaFunc = r200AlphaFunc;
- functions->BlendColor = r200BlendColor;
- functions->BlendEquationSeparate = r200BlendEquationSeparate;
- functions->BlendFuncSeparate = r200BlendFuncSeparate;
- functions->ClearColor = r200ClearColor;
- functions->ClearDepth = r200ClearDepth;
- functions->ClearIndex = NULL;
- functions->ClearStencil = r200ClearStencil;
- functions->ClipPlane = r200ClipPlane;
- functions->ColorMask = r200ColorMask;
- functions->CullFace = r200CullFace;
- functions->DepthFunc = r200DepthFunc;
- functions->DepthMask = r200DepthMask;
- functions->DepthRange = r200DepthRange;
- functions->Enable = r200Enable;
- functions->Fogfv = r200Fogfv;
- functions->FrontFace = r200FrontFace;
- functions->Hint = NULL;
- functions->IndexMask = NULL;
- functions->LightModelfv = r200LightModelfv;
- functions->Lightfv = r200Lightfv;
- functions->LineStipple = r200LineStipple;
- functions->LineWidth = r200LineWidth;
- functions->LogicOpcode = r200LogicOpCode;
- functions->PolygonMode = r200PolygonMode;
- functions->PolygonOffset = r200PolygonOffset;
- functions->PolygonStipple = r200PolygonStipple;
- functions->PointSize = r200PointSize;
- functions->RenderMode = r200RenderMode;
- functions->Scissor = r200Scissor;
- functions->ShadeModel = r200ShadeModel;
- functions->StencilFunc = r200StencilFunc;
- functions->StencilMask = r200StencilMask;
- functions->StencilOp = r200StencilOp;
- functions->Viewport = r200Viewport;
-
- /* Swrast hooks for imaging extensions:
- */
- functions->CopyColorTable = _swrast_CopyColorTable;
- functions->CopyColorSubTable = _swrast_CopyColorSubTable;
- functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
-
-
-void r200InitTnlFuncs( GLcontext *ctx )
-{
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = r200UpdateMaterial;
- TNL_CONTEXT(ctx)->Driver.RunPipeline = r200WrapRunPipeline;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.h
deleted file mode 100644
index d467d73bd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state.h,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_STATE_H__
-#define __R200_STATE_H__
-
-#include "r200_context.h"
-
-extern void r200InitState( r200ContextPtr rmesa );
-extern void r200InitStateFuncs( struct dd_function_table *functions );
-extern void r200InitTnlFuncs( GLcontext *ctx );
-
-extern void r200UpdateMaterial( GLcontext *ctx );
-
-extern void r200SetCliprects( r200ContextPtr rmesa, GLenum mode );
-extern void r200RecalcScissorRects( r200ContextPtr rmesa );
-extern void r200UpdateViewportOffset( GLcontext *ctx );
-extern void r200UpdateWindow( GLcontext *ctx );
-
-extern void r200ValidateState( GLcontext *ctx );
-
-extern void r200PrintDirty( r200ContextPtr rmesa,
- const char *msg );
-
-
-extern void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) do { \
- if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
- __FUNCTION__, bit, mode ); \
- r200Fallback( rmesa->glCtx, bit, mode ); \
-} while (0)
-
-extern void r200LightingSpaceChange( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state_init.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state_init.c
deleted file mode 100644
index f004cf79c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_state_init.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state_init.c,v 1.4 2003/02/22 06:21:11 dawes Exp $ */
-/*
-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.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "enums.h"
-#include "colormac.h"
-#include "api_arrayelt.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_tcl.h"
-#include "r200_tex.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-#include "xmlpool.h"
-
-/* =============================================================
- * State initialization
- */
-
-void r200PrintDirty( r200ContextPtr rmesa, const char *msg )
-{
- struct r200_state_atom *l;
-
- fprintf(stderr, msg);
- fprintf(stderr, ": ");
-
- foreach(l, &rmesa->hw.atomlist) {
- if (l->dirty || rmesa->hw.all_dirty)
- fprintf(stderr, "%s, ", l->name);
- }
-
- fprintf(stderr, "\n");
-}
-
-static int cmdpkt( int id )
-{
- drm_radeon_cmd_header_t h;
- h.i = 0;
- h.packet.cmd_type = RADEON_CMD_PACKET;
- h.packet.packet_id = id;
- return h.i;
-}
-
-static int cmdvec( int offset, int stride, int count )
-{
- drm_radeon_cmd_header_t h;
- h.i = 0;
- h.vectors.cmd_type = RADEON_CMD_VECTORS;
- h.vectors.offset = offset;
- h.vectors.stride = stride;
- h.vectors.count = count;
- return h.i;
-}
-
-static int cmdscl( int offset, int stride, int count )
-{
- drm_radeon_cmd_header_t h;
- h.i = 0;
- h.scalars.cmd_type = RADEON_CMD_SCALARS;
- h.scalars.offset = offset;
- h.scalars.stride = stride;
- h.scalars.count = count;
- return h.i;
-}
-
-static int cmdscl2( int offset, int stride, int count )
-{
- drm_radeon_cmd_header_t h;
- h.i = 0;
- h.scalars.cmd_type = RADEON_CMD_SCALARS2;
- h.scalars.offset = offset - 0x100;
- h.scalars.stride = stride;
- h.scalars.count = count;
- return h.i;
-}
-
-#define CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx, int idx ) \
-{ \
- (void) idx; \
- return FLAG; \
-}
-
-#define TCL_CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx, int idx ) \
-{ \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- (void) idx; \
- return !rmesa->TclFallback && (FLAG); \
-}
-
-
-
-CHECK( always, GL_TRUE )
-CHECK( never, GL_FALSE )
-CHECK( tex_any, ctx->Texture._EnabledUnits )
-CHECK( tex_pair, (ctx->Texture.Unit[idx]._ReallyEnabled | ctx->Texture.Unit[idx & ~1]._ReallyEnabled))
-CHECK( tex, ctx->Texture.Unit[idx]._ReallyEnabled )
-CHECK( tex_cube, ctx->Texture.Unit[idx]._ReallyEnabled & TEXTURE_CUBE_BIT)
-CHECK( fog, ctx->Fog.Enabled )
-TCL_CHECK( tcl, GL_TRUE )
-TCL_CHECK( tcl_tex, ctx->Texture.Unit[idx]._ReallyEnabled )
-TCL_CHECK( tcl_lighting, ctx->Light.Enabled )
-TCL_CHECK( tcl_light, ctx->Light.Enabled && ctx->Light.Light[idx].Enabled )
-TCL_CHECK( tcl_ucp, (ctx->Transform.ClipPlanesEnabled & (1 << idx)) )
-
-
-/* Initialize the context's hardware state.
- */
-void r200InitState( r200ContextPtr rmesa )
-{
- GLcontext *ctx = rmesa->glCtx;
- GLuint color_fmt, depth_fmt, i;
-
- switch ( rmesa->r200Screen->cpp ) {
- case 2:
- color_fmt = R200_COLOR_FORMAT_RGB565;
- break;
- case 4:
- color_fmt = R200_COLOR_FORMAT_ARGB8888;
- break;
- default:
- fprintf( stderr, "Error: Unsupported pixel depth... exiting\n" );
- exit( -1 );
- }
-
- rmesa->state.color.clear = 0x00000000;
-
- switch ( ctx->Visual.depthBits ) {
- case 16:
- rmesa->state.depth.clear = 0x0000ffff;
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffff;
- depth_fmt = R200_DEPTH_FORMAT_16BIT_INT_Z;
- rmesa->state.stencil.clear = 0x00000000;
- break;
- case 24:
- rmesa->state.depth.clear = 0x00ffffff;
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffffff;
- depth_fmt = R200_DEPTH_FORMAT_24BIT_INT_Z;
- rmesa->state.stencil.clear = 0xffff0000;
- break;
- default:
- fprintf( stderr, "Error: Unsupported depth %d... exiting\n",
- ctx->Visual.depthBits );
- exit( -1 );
- }
-
- /* Only have hw stencil when depth buffer is 24 bits deep */
- rmesa->state.stencil.hwBuffer = ( ctx->Visual.stencilBits > 0 &&
- ctx->Visual.depthBits == 24 );
-
- rmesa->Fallback = 0;
-
- if ( ctx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
- rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
- }
-
- rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
- rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
-
- rmesa->hw.max_state_size = 0;
-
-#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \
- do { \
- rmesa->hw.ATOM.cmd_size = SZ; \
- rmesa->hw.ATOM.cmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.lastcmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.name = NM; \
- rmesa->hw.ATOM.idx = IDX; \
- rmesa->hw.ATOM.check = check_##CHK; \
- rmesa->hw.ATOM.dirty = GL_FALSE; \
- rmesa->hw.max_state_size += SZ * sizeof(int); \
- } while (0)
-
-
- /* Allocate state buffers:
- */
- if (rmesa->r200Screen->drmSupportsBlendColor)
- ALLOC_STATE( ctx, always, CTX_STATE_SIZE_NEWDRM, "CTX/context", 0 );
- else
- ALLOC_STATE( ctx, always, CTX_STATE_SIZE_OLDDRM, "CTX/context", 0 );
- ALLOC_STATE( set, always, SET_STATE_SIZE, "SET/setup", 0 );
- ALLOC_STATE( lin, always, LIN_STATE_SIZE, "LIN/line", 0 );
- ALLOC_STATE( msk, always, MSK_STATE_SIZE, "MSK/mask", 0 );
- ALLOC_STATE( vpt, always, VPT_STATE_SIZE, "VPT/viewport", 0 );
- ALLOC_STATE( vtx, always, VTX_STATE_SIZE, "VTX/vertex", 0 );
- ALLOC_STATE( vap, always, VAP_STATE_SIZE, "VAP/vap", 0 );
- ALLOC_STATE( vte, always, VTE_STATE_SIZE, "VTE/vte", 0 );
- ALLOC_STATE( msc, always, MSC_STATE_SIZE, "MSC/misc", 0 );
- ALLOC_STATE( cst, always, CST_STATE_SIZE, "CST/constant", 0 );
- ALLOC_STATE( zbs, always, ZBS_STATE_SIZE, "ZBS/zbias", 0 );
- ALLOC_STATE( tf, tex_any, TF_STATE_SIZE, "TF/tfactor", 0 );
- if (rmesa->r200Screen->chipset & R200_CHIPSET_REAL_R200) {
- /* make sure texture units 0/1 are emitted pair-wise for r200 t0 hang workaround */
- ALLOC_STATE( tex[0], tex_pair, TEX_STATE_SIZE, "TEX/tex-0", 0 );
- ALLOC_STATE( tex[1], tex_pair, TEX_STATE_SIZE, "TEX/tex-1", 1 );
- ALLOC_STATE( tam, tex_any, TAM_STATE_SIZE, "TAM/tam", 0 );
- }
- else {
- ALLOC_STATE( tex[0], tex, TEX_STATE_SIZE, "TEX/tex-0", 0 );
- ALLOC_STATE( tex[1], tex, TEX_STATE_SIZE, "TEX/tex-1", 1 );
- ALLOC_STATE( tam, never, TAM_STATE_SIZE, "TAM/tam", 0 );
- }
- ALLOC_STATE( tex[2], tex, TEX_STATE_SIZE, "TEX/tex-2", 2 );
- ALLOC_STATE( tex[3], tex, TEX_STATE_SIZE, "TEX/tex-3", 3 );
- ALLOC_STATE( tex[4], tex, TEX_STATE_SIZE, "TEX/tex-4", 4 );
- ALLOC_STATE( tex[5], tex, TEX_STATE_SIZE, "TEX/tex-5", 5 );
- if (rmesa->r200Screen->drmSupportsCubeMaps) {
- ALLOC_STATE( cube[0], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-0", 0 );
- ALLOC_STATE( cube[1], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-1", 1 );
- ALLOC_STATE( cube[2], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-2", 2 );
- ALLOC_STATE( cube[3], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-3", 3 );
- ALLOC_STATE( cube[4], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-4", 4 );
- ALLOC_STATE( cube[5], tex_cube, CUBE_STATE_SIZE, "CUBE/tex-5", 5 );
- }
- else {
- ALLOC_STATE( cube[0], never, CUBE_STATE_SIZE, "CUBE/tex-0", 0 );
- ALLOC_STATE( cube[1], never, CUBE_STATE_SIZE, "CUBE/tex-1", 1 );
- ALLOC_STATE( cube[2], never, CUBE_STATE_SIZE, "CUBE/tex-2", 2 );
- ALLOC_STATE( cube[3], never, CUBE_STATE_SIZE, "CUBE/tex-3", 3 );
- ALLOC_STATE( cube[4], never, CUBE_STATE_SIZE, "CUBE/tex-4", 4 );
- ALLOC_STATE( cube[5], never, CUBE_STATE_SIZE, "CUBE/tex-5", 5 );
- }
-
- ALLOC_STATE( tcl, tcl, TCL_STATE_SIZE, "TCL/tcl", 0 );
- ALLOC_STATE( msl, tcl, MSL_STATE_SIZE, "MSL/matrix-select", 0 );
- ALLOC_STATE( tcg, tcl, TCG_STATE_SIZE, "TCG/texcoordgen", 0 );
- ALLOC_STATE( mtl[0], tcl_lighting, MTL_STATE_SIZE, "MTL0/material0", 0 );
- ALLOC_STATE( mtl[1], tcl_lighting, MTL_STATE_SIZE, "MTL1/material1", 1 );
- ALLOC_STATE( grd, tcl, GRD_STATE_SIZE, "GRD/guard-band", 0 );
- ALLOC_STATE( fog, fog, FOG_STATE_SIZE, "FOG/fog", 0 );
- ALLOC_STATE( glt, tcl_lighting, GLT_STATE_SIZE, "GLT/light-global", 0 );
- ALLOC_STATE( eye, tcl_lighting, EYE_STATE_SIZE, "EYE/eye-vector", 0 );
- ALLOC_STATE( mat[R200_MTX_MV], tcl, MAT_STATE_SIZE, "MAT/modelview", 0 );
- ALLOC_STATE( mat[R200_MTX_IMV], tcl, MAT_STATE_SIZE, "MAT/it-modelview", 0 );
- ALLOC_STATE( mat[R200_MTX_MVP], tcl, MAT_STATE_SIZE, "MAT/modelproject", 0 );
- ALLOC_STATE( mat[R200_MTX_TEX0], tcl_tex, MAT_STATE_SIZE, "MAT/texmat0", 0 );
- ALLOC_STATE( mat[R200_MTX_TEX1], tcl_tex, MAT_STATE_SIZE, "MAT/texmat1", 1 );
- ALLOC_STATE( mat[R200_MTX_TEX2], tcl_tex, MAT_STATE_SIZE, "MAT/texmat2", 2 );
- ALLOC_STATE( mat[R200_MTX_TEX3], tcl_tex, MAT_STATE_SIZE, "MAT/texmat3", 3 );
- ALLOC_STATE( mat[R200_MTX_TEX4], tcl_tex, MAT_STATE_SIZE, "MAT/texmat4", 4 );
- ALLOC_STATE( mat[R200_MTX_TEX5], tcl_tex, MAT_STATE_SIZE, "MAT/texmat5", 5 );
- ALLOC_STATE( ucp[0], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-0", 0 );
- ALLOC_STATE( ucp[1], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-1", 1 );
- ALLOC_STATE( ucp[2], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-2", 2 );
- ALLOC_STATE( ucp[3], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-3", 3 );
- ALLOC_STATE( ucp[4], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-4", 4 );
- ALLOC_STATE( ucp[5], tcl_ucp, UCP_STATE_SIZE, "UCP/userclip-5", 5 );
- ALLOC_STATE( lit[0], tcl_light, LIT_STATE_SIZE, "LIT/light-0", 0 );
- ALLOC_STATE( lit[1], tcl_light, LIT_STATE_SIZE, "LIT/light-1", 1 );
- ALLOC_STATE( lit[2], tcl_light, LIT_STATE_SIZE, "LIT/light-2", 2 );
- ALLOC_STATE( lit[3], tcl_light, LIT_STATE_SIZE, "LIT/light-3", 3 );
- ALLOC_STATE( lit[4], tcl_light, LIT_STATE_SIZE, "LIT/light-4", 4 );
- ALLOC_STATE( lit[5], tcl_light, LIT_STATE_SIZE, "LIT/light-5", 5 );
- ALLOC_STATE( lit[6], tcl_light, LIT_STATE_SIZE, "LIT/light-6", 6 );
- ALLOC_STATE( lit[7], tcl_light, LIT_STATE_SIZE, "LIT/light-7", 7 );
- ALLOC_STATE( pix[0], always, PIX_STATE_SIZE, "PIX/pixstage-0", 0 );
- ALLOC_STATE( pix[1], tex, PIX_STATE_SIZE, "PIX/pixstage-1", 1 );
- ALLOC_STATE( pix[2], tex, PIX_STATE_SIZE, "PIX/pixstage-2", 2 );
- ALLOC_STATE( pix[3], tex, PIX_STATE_SIZE, "PIX/pixstage-3", 3 );
- ALLOC_STATE( pix[4], tex, PIX_STATE_SIZE, "PIX/pixstage-4", 4 );
- ALLOC_STATE( pix[5], tex, PIX_STATE_SIZE, "PIX/pixstage-5", 5 );
- if (rmesa->r200Screen->drmSupportsTriPerf) {
- ALLOC_STATE( prf, always, PRF_STATE_SIZE, "PRF/performance-tri", 0 );
- }
- else {
- ALLOC_STATE( prf, never, PRF_STATE_SIZE, "PRF/performance-tri", 0 );
- }
-
- r200SetUpAtomList( rmesa );
-
- /* Fill in the packet headers:
- */
- rmesa->hw.ctx.cmd[CTX_CMD_0] = cmdpkt(RADEON_EMIT_PP_MISC);
- rmesa->hw.ctx.cmd[CTX_CMD_1] = cmdpkt(RADEON_EMIT_PP_CNTL);
- rmesa->hw.ctx.cmd[CTX_CMD_2] = cmdpkt(RADEON_EMIT_RB3D_COLORPITCH);
- if (rmesa->r200Screen->drmSupportsBlendColor)
- rmesa->hw.ctx.cmd[CTX_CMD_3] = cmdpkt(R200_EMIT_RB3D_BLENDCOLOR);
- rmesa->hw.lin.cmd[LIN_CMD_0] = cmdpkt(RADEON_EMIT_RE_LINE_PATTERN);
- rmesa->hw.lin.cmd[LIN_CMD_1] = cmdpkt(RADEON_EMIT_SE_LINE_WIDTH);
- rmesa->hw.msk.cmd[MSK_CMD_0] = cmdpkt(RADEON_EMIT_RB3D_STENCILREFMASK);
- rmesa->hw.vpt.cmd[VPT_CMD_0] = cmdpkt(RADEON_EMIT_SE_VPORT_XSCALE);
- rmesa->hw.set.cmd[SET_CMD_0] = cmdpkt(RADEON_EMIT_SE_CNTL);
- rmesa->hw.msc.cmd[MSC_CMD_0] = cmdpkt(RADEON_EMIT_RE_MISC);
- rmesa->hw.cst.cmd[CST_CMD_0] = cmdpkt(R200_EMIT_PP_CNTL_X);
- rmesa->hw.cst.cmd[CST_CMD_1] = cmdpkt(R200_EMIT_RB3D_DEPTHXY_OFFSET);
- rmesa->hw.cst.cmd[CST_CMD_2] = cmdpkt(R200_EMIT_RE_AUX_SCISSOR_CNTL);
- rmesa->hw.cst.cmd[CST_CMD_3] = cmdpkt(R200_EMIT_RE_SCISSOR_TL_0);
- rmesa->hw.cst.cmd[CST_CMD_4] = cmdpkt(R200_EMIT_SE_VAP_CNTL_STATUS);
- rmesa->hw.cst.cmd[CST_CMD_5] = cmdpkt(R200_EMIT_RE_POINTSIZE);
- rmesa->hw.cst.cmd[CST_CMD_6] = cmdpkt(R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0);
- rmesa->hw.tam.cmd[TAM_CMD_0] = cmdpkt(R200_EMIT_PP_TAM_DEBUG3);
- rmesa->hw.tf.cmd[TF_CMD_0] = cmdpkt(R200_EMIT_TFACTOR_0);
- rmesa->hw.tex[0].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_0);
- rmesa->hw.tex[0].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_0);
- rmesa->hw.tex[1].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_1);
- rmesa->hw.tex[1].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_1);
- rmesa->hw.tex[2].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_2);
- rmesa->hw.tex[2].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_2);
- rmesa->hw.tex[3].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_3);
- rmesa->hw.tex[3].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_3);
- rmesa->hw.tex[4].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_4);
- rmesa->hw.tex[4].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_4);
- rmesa->hw.tex[5].cmd[TEX_CMD_0] = cmdpkt(R200_EMIT_PP_TXFILTER_5);
- rmesa->hw.tex[5].cmd[TEX_CMD_1] = cmdpkt(R200_EMIT_PP_TXOFFSET_5);
- rmesa->hw.cube[0].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_0);
- rmesa->hw.cube[0].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_0);
- rmesa->hw.cube[1].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_1);
- rmesa->hw.cube[1].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_1);
- rmesa->hw.cube[2].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_2);
- rmesa->hw.cube[2].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_2);
- rmesa->hw.cube[3].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_3);
- rmesa->hw.cube[3].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_3);
- rmesa->hw.cube[4].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_4);
- rmesa->hw.cube[4].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_4);
- rmesa->hw.cube[5].cmd[CUBE_CMD_0] = cmdpkt(R200_EMIT_PP_CUBIC_FACES_5);
- rmesa->hw.cube[5].cmd[CUBE_CMD_1] = cmdpkt(R200_EMIT_PP_CUBIC_OFFSETS_5);
- rmesa->hw.pix[0].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_0);
- rmesa->hw.pix[1].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_1);
- rmesa->hw.pix[2].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_2);
- rmesa->hw.pix[3].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_3);
- rmesa->hw.pix[4].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_4);
- rmesa->hw.pix[5].cmd[PIX_CMD_0] = cmdpkt(R200_EMIT_PP_TXCBLEND_5);
- rmesa->hw.zbs.cmd[ZBS_CMD_0] = cmdpkt(RADEON_EMIT_SE_ZBIAS_FACTOR);
- rmesa->hw.tcl.cmd[TCL_CMD_0] = cmdpkt(R200_EMIT_TCL_LIGHT_MODEL_CTL_0);
- rmesa->hw.tcl.cmd[TCL_CMD_1] = cmdpkt(R200_EMIT_TCL_UCP_VERT_BLEND_CTL);
- rmesa->hw.tcg.cmd[TCG_CMD_0] = cmdpkt(R200_EMIT_TEX_PROC_CTL_2);
- rmesa->hw.msl.cmd[MSL_CMD_0] = cmdpkt(R200_EMIT_MATRIX_SELECT_0);
- rmesa->hw.vap.cmd[VAP_CMD_0] = cmdpkt(R200_EMIT_VAP_CTL);
- rmesa->hw.vtx.cmd[VTX_CMD_0] = cmdpkt(R200_EMIT_VTX_FMT_0);
- rmesa->hw.vtx.cmd[VTX_CMD_1] = cmdpkt(R200_EMIT_OUTPUT_VTX_COMP_SEL);
- rmesa->hw.vtx.cmd[VTX_CMD_2] = cmdpkt(R200_EMIT_SE_VTX_STATE_CNTL);
- rmesa->hw.vte.cmd[VTE_CMD_0] = cmdpkt(R200_EMIT_VTE_CNTL);
- rmesa->hw.prf.cmd[PRF_CMD_0] = cmdpkt(R200_EMIT_PP_TRI_PERF_CNTL);
- rmesa->hw.mtl[0].cmd[MTL_CMD_0] =
- cmdvec( R200_VS_MAT_0_EMISS, 1, 16 );
- rmesa->hw.mtl[0].cmd[MTL_CMD_1] =
- cmdscl2( R200_SS_MAT_0_SHININESS, 1, 1 );
- rmesa->hw.mtl[1].cmd[MTL_CMD_0] =
- cmdvec( R200_VS_MAT_1_EMISS, 1, 16 );
- rmesa->hw.mtl[1].cmd[MTL_CMD_1] =
- cmdscl2( R200_SS_MAT_1_SHININESS, 1, 1 );
-
- rmesa->hw.grd.cmd[GRD_CMD_0] =
- cmdscl( R200_SS_VERT_GUARD_CLIP_ADJ_ADDR, 1, 4 );
- rmesa->hw.fog.cmd[FOG_CMD_0] =
- cmdvec( R200_VS_FOG_PARAM_ADDR, 1, 4 );
- rmesa->hw.glt.cmd[GLT_CMD_0] =
- cmdvec( R200_VS_GLOBAL_AMBIENT_ADDR, 1, 4 );
- rmesa->hw.eye.cmd[EYE_CMD_0] =
- cmdvec( R200_VS_EYE_VECTOR_ADDR, 1, 4 );
-
- rmesa->hw.mat[R200_MTX_MV].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_0_MV, 1, 16);
- rmesa->hw.mat[R200_MTX_IMV].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_1_INV_MV, 1, 16);
- rmesa->hw.mat[R200_MTX_MVP].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_2_MVP, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX0].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_3_TEX0, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX1].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_4_TEX1, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX2].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_5_TEX2, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX3].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_6_TEX3, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX4].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_7_TEX4, 1, 16);
- rmesa->hw.mat[R200_MTX_TEX5].cmd[MAT_CMD_0] =
- cmdvec( R200_VS_MATRIX_8_TEX5, 1, 16);
-
- for (i = 0 ; i < 8; i++) {
- rmesa->hw.lit[i].cmd[LIT_CMD_0] =
- cmdvec( R200_VS_LIGHT_AMBIENT_ADDR + i, 8, 24 );
- rmesa->hw.lit[i].cmd[LIT_CMD_1] =
- cmdscl( R200_SS_LIGHT_DCD_ADDR + i, 8, 7 );
- }
-
- for (i = 0 ; i < 6; i++) {
- rmesa->hw.ucp[i].cmd[UCP_CMD_0] =
- cmdvec( R200_VS_UCP_ADDR + i, 1, 4 );
- }
-
- /* Initial Harware state:
- */
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = (R200_ALPHA_TEST_PASS
- /* | R200_RIGHT_HAND_CUBE_OGL*/);
-
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] = (R200_FOG_VERTEX |
- R200_FOG_USE_SPEC_ALPHA);
-
- rmesa->hw.ctx.cmd[CTX_RE_SOLID_COLOR] = 0x00000000;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = (R200_COMB_FCN_ADD_CLAMP |
- (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT));
-
- if (rmesa->r200Screen->drmSupportsBlendColor) {
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCOLOR] = 0x00000000;
- rmesa->hw.ctx.cmd[CTX_RB3D_ABLENDCNTL] = (R200_COMB_FCN_ADD_CLAMP |
- (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT));
- rmesa->hw.ctx.cmd[CTX_RB3D_CBLENDCNTL] = (R200_COMB_FCN_ADD_CLAMP |
- (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT));
- }
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHOFFSET] =
- rmesa->r200Screen->depthOffset + rmesa->r200Screen->fbLocation;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHPITCH] =
- ((rmesa->r200Screen->depthPitch &
- R200_DEPTHPITCH_MASK) |
- R200_DEPTH_ENDIAN_NO_SWAP);
-
- if (rmesa->using_hyperz)
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHPITCH] |= R200_DEPTH_HYPERZ;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] = (depth_fmt |
- R200_Z_TEST_LESS |
- R200_STENCIL_TEST_ALWAYS |
- R200_STENCIL_FAIL_KEEP |
- R200_STENCIL_ZPASS_KEEP |
- R200_STENCIL_ZFAIL_KEEP |
- R200_Z_WRITE_ENABLE);
-
- if (rmesa->using_hyperz) {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= R200_Z_COMPRESSION_ENABLE |
- R200_Z_DECOMPRESSION_ENABLE;
-/* if (rmesa->r200Screen->chipset & R200_CHIPSET_REAL_R200)
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_HIERARCHY_ENABLE;*/
- }
-
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = (R200_ANTI_ALIAS_NONE
- | R200_TEX_BLEND_0_ENABLE);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = color_fmt;
- switch ( driQueryOptioni( &rmesa->optionCache, "dither_mode" ) ) {
- case DRI_CONF_DITHER_XERRORDIFFRESET:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_INIT;
- break;
- case DRI_CONF_DITHER_ORDERED:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_SCALE_DITHER_ENABLE;
- break;
- }
- if ( driQueryOptioni( &rmesa->optionCache, "round_mode" ) ==
- DRI_CONF_ROUND_ROUND )
- rmesa->state.color.roundEnable = R200_ROUND_ENABLE;
- else
- rmesa->state.color.roundEnable = 0;
- if ( driQueryOptioni (&rmesa->optionCache, "color_reduction" ) ==
- DRI_CONF_COLOR_REDUCTION_DITHER )
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= R200_DITHER_ENABLE;
- else
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->r200Screen->fbLocation)
- & R200_COLOROFFSET_MASK);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = ((rmesa->state.color.drawPitch &
- R200_COLORPITCH_MASK) |
- R200_COLOR_ENDIAN_NO_SWAP);
- /* (fixed size) sarea is initialized to zero afaics so can omit version check. Phew! */
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
- }
-
- rmesa->hw.prf.cmd[PRF_PP_TRI_PERF] = R200_TRI_CUTOFF_MASK - R200_TRI_CUTOFF_MASK *
- driQueryOptionf (&rmesa->optionCache,"texture_blend_quality");
- rmesa->hw.prf.cmd[PRF_PP_PERF_CNTL] = 0;
-
- rmesa->hw.set.cmd[SET_SE_CNTL] = (R200_FFACE_CULL_CCW |
- R200_BFACE_SOLID |
- R200_FFACE_SOLID |
- R200_FLAT_SHADE_VTX_LAST |
- R200_DIFFUSE_SHADE_GOURAUD |
- R200_ALPHA_SHADE_GOURAUD |
- R200_SPECULAR_SHADE_GOURAUD |
- R200_FOG_SHADE_GOURAUD |
- R200_VTX_PIX_CENTER_OGL |
- R200_ROUND_MODE_TRUNC |
- R200_ROUND_PREC_8TH_PIX);
-
- rmesa->hw.set.cmd[SET_RE_CNTL] = (R200_PERSPECTIVE_ENABLE |
- R200_SCISSOR_ENABLE);
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = ((1 << 16) | 0xffff);
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_STATE] =
- ((0 << R200_LINE_CURRENT_PTR_SHIFT) |
- (1 << R200_LINE_CURRENT_COUNT_SHIFT));
-
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] = (1 << 4);
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] =
- ((0x00 << R200_STENCIL_REF_SHIFT) |
- (0xff << R200_STENCIL_MASK_SHIFT) |
- (0xff << R200_STENCIL_WRITEMASK_SHIFT));
-
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = R200_ROP_COPY;
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = 0xffffffff;
-
- rmesa->hw.tam.cmd[TAM_DEBUG3] = 0;
-
- rmesa->hw.msc.cmd[MSC_RE_MISC] =
- ((0 << R200_STIPPLE_X_OFFSET_SHIFT) |
- (0 << R200_STIPPLE_Y_OFFSET_SHIFT) |
- R200_STIPPLE_BIG_BIT_ORDER);
-
-
- rmesa->hw.cst.cmd[CST_PP_CNTL_X] = 0;
- rmesa->hw.cst.cmd[CST_RB3D_DEPTHXY_OFFSET] = 0;
- rmesa->hw.cst.cmd[CST_RE_AUX_SCISSOR_CNTL] = 0x0;
- rmesa->hw.cst.cmd[CST_RE_SCISSOR_TL_0] = 0;
- rmesa->hw.cst.cmd[CST_RE_SCISSOR_BR_0] = 0;
- rmesa->hw.cst.cmd[CST_SE_VAP_CNTL_STATUS] =
-#ifdef MESA_BIG_ENDIAN
- R200_VC_32BIT_SWAP;
-#else
- R200_VC_NO_SWAP;
-#endif
-
- if (!(rmesa->r200Screen->chipset & R200_CHIPSET_TCL)) {
- /* Bypass TCL */
- rmesa->hw.cst.cmd[CST_SE_VAP_CNTL_STATUS] |= (1<<8);
- }
-
- rmesa->hw.cst.cmd[CST_RE_POINTSIZE] = 0x100010;
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_0] =
- (0x0 << R200_VERTEX_POSITION_ADDR__SHIFT);
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_1] =
- (0x02 << R200_VTX_COLOR_0_ADDR__SHIFT) |
- (0x03 << R200_VTX_COLOR_1_ADDR__SHIFT);
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_2] =
- (0x06 << R200_VTX_TEX_0_ADDR__SHIFT) |
- (0x07 << R200_VTX_TEX_1_ADDR__SHIFT) |
- (0x08 << R200_VTX_TEX_2_ADDR__SHIFT) |
- (0x09 << R200_VTX_TEX_3_ADDR__SHIFT);
- rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_3] =
- (0x0A << R200_VTX_TEX_4_ADDR__SHIFT) |
- (0x0B << R200_VTX_TEX_5_ADDR__SHIFT);
-
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = 0x00000000;
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] = R200_BORDER_MODE_OGL;
- rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT] =
- ((i << R200_TXFORMAT_ST_ROUTE_SHIFT) | /* <-- note i */
- (2 << R200_TXFORMAT_WIDTH_SHIFT) |
- (2 << R200_TXFORMAT_HEIGHT_SHIFT));
- rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET] =
- rmesa->r200Screen->texOffset[RADEON_LOCAL_TEX_HEAP];
- rmesa->hw.tex[i].cmd[TEX_PP_BORDER_COLOR] = 0;
- rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT_X] =
- (/* R200_TEXCOORD_PROJ | */
- 0x100000); /* Small default bias */
-
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_FACES] = 0;
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F1] =
- rmesa->r200Screen->texOffset[RADEON_LOCAL_TEX_HEAP];
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F2] =
- rmesa->r200Screen->texOffset[RADEON_LOCAL_TEX_HEAP];
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F3] =
- rmesa->r200Screen->texOffset[RADEON_LOCAL_TEX_HEAP];
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F4] =
- rmesa->r200Screen->texOffset[RADEON_LOCAL_TEX_HEAP];
- rmesa->hw.cube[i].cmd[CUBE_PP_CUBIC_OFFSET_F5] =
- rmesa->r200Screen->texOffset[RADEON_LOCAL_TEX_HEAP];
-
- rmesa->hw.pix[i].cmd[PIX_PP_TXCBLEND] =
- (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_DIFFUSE_COLOR |
- R200_TXC_OP_MADD);
-
- rmesa->hw.pix[i].cmd[PIX_PP_TXCBLEND2] =
- ((i << R200_TXC_TFACTOR_SEL_SHIFT) |
- R200_TXC_SCALE_1X |
- R200_TXC_CLAMP_0_1 |
- R200_TXC_OUTPUT_REG_R0);
-
- rmesa->hw.pix[i].cmd[PIX_PP_TXABLEND] =
- (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA |
- R200_TXA_OP_MADD);
-
- rmesa->hw.pix[i].cmd[PIX_PP_TXABLEND2] =
- ((i << R200_TXA_TFACTOR_SEL_SHIFT) |
- R200_TXA_SCALE_1X |
- R200_TXA_CLAMP_0_1 |
- R200_TXA_OUTPUT_REG_R0);
- }
-
- rmesa->hw.tf.cmd[TF_TFACTOR_0] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_1] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_2] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_3] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_4] = 0;
- rmesa->hw.tf.cmd[TF_TFACTOR_5] = 0;
-
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] =
- (R200_VAP_TCL_ENABLE |
- (0x9 << R200_VAP_VF_MAX_VTX_NUM__SHIFT));
-
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] =
- (R200_VPORT_X_SCALE_ENA |
- R200_VPORT_Y_SCALE_ENA |
- R200_VPORT_Z_SCALE_ENA |
- R200_VPORT_X_OFFSET_ENA |
- R200_VPORT_Y_OFFSET_ENA |
- R200_VPORT_Z_OFFSET_ENA |
-/* FIXME: Turn on for tex rect only */
- R200_VTX_ST_DENORMALIZED |
- R200_VTX_W0_FMT);
-
-
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = 0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = 0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] =
- ((R200_VTX_Z0 | R200_VTX_W0 |
- (R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] = 0;
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] = (R200_OUTPUT_XYZW);
- rmesa->hw.vtx.cmd[VTX_STATE_CNTL] = R200_VSC_UPDATE_USER_COLOR_0_ENABLE;
-
-
- /* Matrix selection */
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_0] =
- (R200_MTX_MV << R200_MODELVIEW_0_SHIFT);
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_1] =
- (R200_MTX_IMV << R200_IT_MODELVIEW_0_SHIFT);
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_2] =
- (R200_MTX_MVP << R200_MODELPROJECT_0_SHIFT);
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_3] =
- ((R200_MTX_TEX0 << R200_TEXMAT_0_SHIFT) |
- (R200_MTX_TEX1 << R200_TEXMAT_1_SHIFT) |
- (R200_MTX_TEX2 << R200_TEXMAT_2_SHIFT) |
- (R200_MTX_TEX3 << R200_TEXMAT_3_SHIFT));
-
- rmesa->hw.msl.cmd[MSL_MATRIX_SELECT_4] =
- ((R200_MTX_TEX4 << R200_TEXMAT_4_SHIFT) |
- (R200_MTX_TEX5 << R200_TEXMAT_5_SHIFT));
-
-
- /* General TCL state */
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] =
- (R200_SPECULAR_LIGHTS |
- R200_DIFFUSE_SPECULAR_COMBINE |
- R200_LOCAL_LIGHT_VEC_GL |
- R200_LM0_SOURCE_MATERIAL_0 << R200_FRONT_SHININESS_SOURCE_SHIFT |
- R200_LM0_SOURCE_MATERIAL_1 << R200_BACK_SHININESS_SOURCE_SHIFT);
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] =
- ((R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_EMISSIVE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_AMBIENT_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_DIFFUSE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_SPECULAR_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_EMISSIVE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_AMBIENT_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_DIFFUSE_SOURCE_SHIFT) |
- (R200_LM1_SOURCE_MATERIAL_1 << R200_BACK_SPECULAR_SOURCE_SHIFT));
-
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_0] = 0; /* filled in via callbacks */
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_1] = 0;
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_2] = 0;
- rmesa->hw.tcl.cmd[TCL_PER_LIGHT_CTL_3] = 0;
-
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] =
- (R200_UCP_IN_CLIP_SPACE |
- R200_CULL_FRONT_IS_CCW);
-
- /* Texgen/Texmat state */
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_2] = 0x00ffffff;
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_3] =
- ((0 << R200_TEXGEN_0_INPUT_TEX_SHIFT) |
- (1 << R200_TEXGEN_1_INPUT_TEX_SHIFT) |
- (2 << R200_TEXGEN_2_INPUT_TEX_SHIFT) |
- (3 << R200_TEXGEN_3_INPUT_TEX_SHIFT) |
- (4 << R200_TEXGEN_4_INPUT_TEX_SHIFT) |
- (5 << R200_TEXGEN_5_INPUT_TEX_SHIFT));
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0] = 0;
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1] =
- ((0 << R200_TEXGEN_0_INPUT_SHIFT) |
- (1 << R200_TEXGEN_1_INPUT_SHIFT) |
- (2 << R200_TEXGEN_2_INPUT_SHIFT) |
- (3 << R200_TEXGEN_3_INPUT_SHIFT) |
- (4 << R200_TEXGEN_4_INPUT_SHIFT) |
- (5 << R200_TEXGEN_5_INPUT_SHIFT));
- rmesa->hw.tcg.cmd[TCG_TEX_CYL_WRAP_CTL] = 0;
-
-
- for (i = 0 ; i < 8; i++) {
- struct gl_light *l = &ctx->Light.Light[i];
- GLenum p = GL_LIGHT0 + i;
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_RANGE_CUTOFF]) = FLT_MAX;
-
- ctx->Driver.Lightfv( ctx, p, GL_AMBIENT, l->Ambient );
- ctx->Driver.Lightfv( ctx, p, GL_DIFFUSE, l->Diffuse );
- ctx->Driver.Lightfv( ctx, p, GL_SPECULAR, l->Specular );
- ctx->Driver.Lightfv( ctx, p, GL_POSITION, NULL );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_DIRECTION, NULL );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_EXPONENT, &l->SpotExponent );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_CUTOFF, &l->SpotCutoff );
- ctx->Driver.Lightfv( ctx, p, GL_CONSTANT_ATTENUATION,
- &l->ConstantAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION,
- &l->LinearAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION,
- &l->QuadraticAttenuation );
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_ATTEN_XXX]) = 0.0;
- }
-
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
- ctx->Light.Model.Ambient );
-
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
-
- for (i = 0 ; i < 6; i++) {
- ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, NULL );
- }
-
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, NULL );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL );
-
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_DISCARD_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_DISCARD_ADJ] = IEEE_ONE;
-
- rmesa->hw.eye.cmd[EYE_X] = 0;
- rmesa->hw.eye.cmd[EYE_Y] = 0;
- rmesa->hw.eye.cmd[EYE_Z] = IEEE_ONE;
- rmesa->hw.eye.cmd[EYE_RESCALE_FACTOR] = IEEE_ONE;
-
- r200LightingSpaceChange( ctx );
-
- rmesa->hw.all_dirty = GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.c
deleted file mode 100644
index 94b4978fa..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ /dev/null
@@ -1,957 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c,v 1.5 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "enums.h"
-#include "image.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast/s_context.h"
-#include "swrast/s_fog.h"
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vtx_api.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_state.h"
-#include "r200_swtcl.h"
-#include "r200_tcl.h"
-
-
-static void flush_last_swtcl_prim( r200ContextPtr rmesa );
-
-
-/***********************************************************************
- * Initialization
- ***********************************************************************/
-
-#define EMIT_ATTR( ATTR, STYLE, F0 ) \
-do { \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = (ATTR); \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = (STYLE); \
- rmesa->swtcl.vertex_attr_count++; \
- fmt_0 |= F0; \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = 0; \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = EMIT_PAD; \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].offset = (N); \
- rmesa->swtcl.vertex_attr_count++; \
-} while (0)
-
-static void r200SetVertexFormat( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- int fmt_0 = 0;
- int fmt_1 = 0;
- int offset = 0;
-
-
- /* Important:
- */
- if ( VB->NdcPtr != NULL ) {
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- }
- else {
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr;
- }
-
- assert( VB->AttribPtr[VERT_ATTRIB_POS] != NULL );
- rmesa->swtcl.vertex_attr_count = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if ( !rmesa->swtcl.needproj || (index & _TNL_BITS_TEX_ANY)) { /* need w coord for projected textures */
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F, R200_VTX_XY | R200_VTX_Z0 | R200_VTX_W0 );
- offset = 4;
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F, R200_VTX_XY | R200_VTX_Z0 );
- offset = 3;
- }
-
- rmesa->swtcl.coloroffset = offset;
-#if MESA_LITTLE_ENDIAN
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA, (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) );
-#else
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR, (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) );
-#endif
- offset += 1;
-
- rmesa->swtcl.specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
-
-#if MESA_LITTLE_ENDIAN
- if (index & _TNL_BIT_COLOR1) {
- rmesa->swtcl.specoffset = offset;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
- }
- else {
- EMIT_PAD( 3 );
- }
-
- if (index & _TNL_BIT_FOG) {
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
- }
- else {
- EMIT_PAD( 1 );
- }
-#else
- if (index & _TNL_BIT_FOG) {
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
- }
- else {
- EMIT_PAD( 1 );
- }
-
- if (index & _TNL_BIT_COLOR1) {
- rmesa->swtcl.specoffset = offset;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) );
- }
- else {
- EMIT_PAD( 3 );
- }
-#endif
- }
-
- if (index & _TNL_BITS_TEX_ANY) {
- int i;
-
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- GLuint sz = VB->TexCoordPtr[i]->size;
-
- fmt_1 |= sz << (3 * i);
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_1F + sz - 1, 0 );
- }
- }
- }
-
- if ( (rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] & R200_FOG_USE_MASK)
- != R200_FOG_USE_SPEC_ALPHA ) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] &= ~R200_FOG_USE_MASK;
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= R200_FOG_USE_SPEC_ALPHA;
- }
-
- if ( rmesa->tnl_index != index ||
- (rmesa->hw.vtx.cmd[VTX_VTXFMT_0] != fmt_0) ||
- (rmesa->hw.vtx.cmd[VTX_VTXFMT_1] != fmt_1) ) {
- R200_NEWPRIM(rmesa);
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = fmt_0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = fmt_1;
-
- rmesa->swtcl.vertex_size =
- _tnl_install_attrs( ctx,
- rmesa->swtcl.vertex_attrs,
- rmesa->swtcl.vertex_attr_count,
- NULL, 0 );
- rmesa->swtcl.vertex_size /= 4;
- rmesa->tnl_index = index;
- }
-}
-
-
-static void r200RenderStart( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- r200SetVertexFormat( ctx );
-
- if (rmesa->dma.flush != 0 &&
- rmesa->dma.flush != flush_last_swtcl_prim)
- rmesa->dma.flush( rmesa );
-}
-
-
-/**
- * Set vertex state for SW TCL. The primary purpose of this function is to
- * determine in advance whether or not the hardware can / should do the
- * projection divide or Mesa should do it.
- */
-void r200ChooseVertexState( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint vte;
- GLuint vap;
-
- /* We must ensure that we don't do _tnl_need_projected_coords while in a
- * rasterization fallback. As this function will be called again when we
- * leave a rasterization fallback, we can just skip it for now.
- */
- if (rmesa->Fallback != 0)
- return;
-
- vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL];
- vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL];
-
- /* HW perspective divide is a win, but tiny vertex formats are a
- * bigger one.
- */
- if ( ((tnl->render_inputs & _TNL_BITS_TEX_ANY) == 0)
- || (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- rmesa->swtcl.needproj = GL_TRUE;
- vte |= R200_VTX_XY_FMT | R200_VTX_Z_FMT;
- vte &= ~R200_VTX_W0_FMT;
- if (tnl->render_inputs & _TNL_BITS_TEX_ANY) {
- vap &= ~R200_VAP_FORCE_W_TO_ONE;
- }
- else {
- vap |= R200_VAP_FORCE_W_TO_ONE;
- }
- }
- else {
- rmesa->swtcl.needproj = GL_FALSE;
- vte &= ~(R200_VTX_XY_FMT | R200_VTX_Z_FMT);
- vte |= R200_VTX_W0_FMT;
- vap &= ~R200_VAP_FORCE_W_TO_ONE;
- }
-
- _tnl_need_projected_coords( ctx, rmesa->swtcl.needproj );
-
- if (vte != rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]) {
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] = vte;
- }
-
- if (vap != rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]) {
- R200_STATECHANGE( rmesa, vap );
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] = vap;
- }
-}
-
-
-/* Flush vertices in the current dma region.
- */
-static void flush_last_swtcl_prim( r200ContextPtr rmesa )
-{
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- rmesa->dma.flush = NULL;
-
- if (rmesa->dma.current.buf) {
- struct r200_dma_region *current = &rmesa->dma.current;
- GLuint current_offset = (rmesa->r200Screen->gart_buffer_offset +
- current->buf->buf->idx * RADEON_BUFFER_SIZE +
- current->start);
-
- assert (!(rmesa->swtcl.hw_primitive & R200_VF_PRIM_WALK_IND));
-
- assert (current->start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- current->ptr);
-
- if (rmesa->dma.current.start != rmesa->dma.current.ptr) {
- r200EnsureCmdBufSpace( rmesa, VERT_AOS_BUFSZ +
- rmesa->hw.max_state_size + VBUF_BUFSZ );
- r200EmitVertexAOS( rmesa,
- rmesa->swtcl.vertex_size,
- current_offset);
-
- r200EmitVbufPrim( rmesa,
- rmesa->swtcl.hw_primitive,
- rmesa->swtcl.numverts);
- }
-
- rmesa->swtcl.numverts = 0;
- current->start = current->ptr;
- }
-}
-
-
-/* Alloc space in the current dma region.
- */
-static __inline void *r200AllocDmaLowVerts( r200ContextPtr rmesa,
- int nverts, int vsize )
-{
- GLuint bytes = vsize * nverts;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- r200RefillCurrentDmaRegion( rmesa );
-
- if (!rmesa->dma.flush) {
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = flush_last_swtcl_prim;
- }
-
- ASSERT( vsize == rmesa->swtcl.vertex_size * 4 );
- ASSERT( rmesa->dma.flush == flush_last_swtcl_prim );
- ASSERT( rmesa->dma.current.start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- rmesa->dma.current.ptr );
-
-
- {
- GLubyte *head = (GLubyte *) (rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->dma.current.ptr += bytes;
- rmesa->swtcl.numverts += nverts;
- return head;
- }
-
-}
-
-
-/**************************************************************************/
-
-
-static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- R200_VF_PRIM_POINTS,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES
-};
-
-static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void r200RenderPrimitive( GLcontext *ctx, GLenum prim );
-static void r200ResetLineStipple( GLcontext *ctx );
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#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 0
-#define HAVE_QUAD_STRIPS 0
-#define HAVE_POLYGONS 1
-#define HAVE_ELTS 0
-
-#undef LOCAL_VARS
-#undef ALLOC_VERTS
-#define CTX_ARG r200ContextPtr rmesa
-#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
-#define ALLOC_VERTS( n, size ) r200AllocDmaLowVerts( rmesa, n, size * 4 )
-#define LOCAL_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- const char *r200verts = (char *)rmesa->swtcl.verts;
-#define VERT(x) (r200Vertex *)(r200verts + ((x) * vertsize * sizeof(int)))
-#define VERTEX r200Vertex
-#define DO_DEBUG_VERTS (1 && (R200_DEBUG & DEBUG_VERTS))
-
-#undef TAG
-#define TAG(x) r200_##x
-#include "tnl_dd/t_dd_triemit.h"
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define QUAD( a, b, c, d ) r200_quad( rmesa, a, b, c, d )
-#define TRI( a, b, c ) r200_triangle( rmesa, a, b, c )
-#define LINE( a, b ) r200_line( rmesa, a, b )
-#define POINT( a ) r200_point( rmesa, a )
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define R200_TWOSIDE_BIT 0x01
-#define R200_UNFILLED_BIT 0x02
-#define R200_MAX_TRIFUNC 0x04
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[R200_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK 0
-#define DO_UNFILLED (IND & R200_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & R200_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_OFFSET 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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#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) (rmesa->swtcl.verts + (e*rmesa->swtcl.vertex_size*sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- r200_color_t *color = (r200_color_t *)&((v)->ui[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-
-#define VERT_SET_SPEC( v, c ) \
-do { \
- if (specoffset) { \
- r200_color_t *spec = (r200_color_t *)&((v)->ui[specoffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- if (specoffset) { \
- r200_color_t *spec0 = (r200_color_t *)&((v0)->ui[specoffset]); \
- r200_color_t *spec1 = (r200_color_t *)&((v1)->ui[specoffset]); \
- spec0->red = spec1->red; \
- spec0->green = spec1->green; \
- spec0->blue = spec1->blue; \
- } \
-} while (0)
-
-/* These don't need LE32_TO_CPU() as they used to save and restore
- * colors which are already in the correct format.
- */
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
-
-#undef LOCAL_VARS
-#undef TAG
-#undef INIT
-
-#define LOCAL_VARS(n) \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = rmesa->swtcl.coloroffset; \
- GLuint specoffset = rmesa->swtcl.specoffset; \
- (void) color; (void) spec; (void) coloroffset; (void) specoffset;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) r200RasterPrimitive( ctx, reduced_hw_prim[x] )
-#define RENDER_PRIMITIVE rmesa->swtcl.render_primitive
-#undef TAG
-#define TAG(x) x
-#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 (R200_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R200_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (R200_TWOSIDE_BIT|R200_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_twoside();
- init_unfilled();
- init_twoside_unfilled();
-}
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- r200_point( rmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- r200_line( rmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- r200_triangle( rmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- r200_quad( rmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) do { \
- r200RenderPrimitive( ctx, x ); \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- const GLuint vertsize = rmesa->swtcl.vertex_size; \
- const char *r200verts = (char *)rmesa->swtcl.verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) elt; (void) stipple;
-#define RESET_STIPPLE if ( stipple ) r200ResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) r200_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) r200_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-void r200ChooseRenderState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint index = 0;
- GLuint flags = ctx->_TriangleCaps;
-
- if (!rmesa->TclFallback || rmesa->Fallback)
- return;
-
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT;
- if (flags & DD_TRI_UNFILLED) index |= R200_UNFILLED_BIT;
-
- if (index != rmesa->swtcl.RenderIndex) {
- 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 = r200_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = r200_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = r200_fast_clipped_poly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- }
-
- rmesa->swtcl.RenderIndex = index;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->swtcl.hw_primitive != hwprim) {
- R200_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hwprim;
- }
-}
-
-static void r200RenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- rmesa->swtcl.render_primitive = prim;
- if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED))
- r200RasterPrimitive( ctx, reduced_hw_prim[prim] );
-}
-
-static void r200RenderFinish( GLcontext *ctx )
-{
-}
-
-static void r200ResetLineStipple( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- R200_STATECHANGE( rmesa, lin );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "glEnable(GL_STENCIL) without hw stencil buffer",
- "glRenderMode(selection or feedback)",
- "R200_NO_RAST",
- "Mixing GL_CLAMP_TO_BORDER and GL_CLAMP (or GL_MIRROR_CLAMP_ATI)"
-};
-
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = rmesa->Fallback;
-
- if (mode) {
- rmesa->Fallback |= bit;
- if (oldfallback == 0) {
- R200_FIREVERTICES( rmesa );
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_RASTER, GL_TRUE );
- _swsetup_Wakeup( ctx );
- rmesa->swtcl.RenderIndex = ~0;
- if (R200_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "R200 begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- rmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
-
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = r200RenderStart;
- tnl->Driver.Render.PrimitiveNotify = r200RenderPrimitive;
- tnl->Driver.Render.Finish = r200RenderFinish;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- tnl->Driver.Render.ResetLineStipple = r200ResetLineStipple;
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_RASTER, GL_FALSE );
- if (rmesa->TclFallback) {
- /* These are already done if rmesa->TclFallback goes to
- * zero above. But not if it doesn't (R200_NO_TCL for
- * example?)
- */
- r200ChooseVertexState( ctx );
- r200ChooseRenderState( ctx );
- }
- if (R200_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "R200 end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-
-
-/**
- * Cope with depth operations by drawing individual pixels as points.
- *
- * \todo
- * The way the vertex state is set in this routine is hokey. It seems to
- * work, but it's very hackish. This whole routine is pretty hackish. If
- * the bitmap is small enough, it seems like it would be faster to copy it
- * to AGP memory and use it as a non-power-of-two texture (i.e.,
- * NV_texture_rectangle).
- */
-void
-r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const GLfloat *rc = ctx->Current.RasterColor;
- GLint row, col;
- r200Vertex vert;
- GLuint orig_vte;
- GLuint h;
-
-
- /* Turn off tcl.
- */
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_BITMAP, 1 );
-
- /* Choose tiny vertex format
- */
- {
- const GLuint fmt_0 = R200_VTX_XY | R200_VTX_Z0 | R200_VTX_W0
- | (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT);
- const GLuint fmt_1 = 0;
- GLuint vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL];
- GLuint vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL];
-
- vte &= ~(R200_VTX_XY_FMT | R200_VTX_Z_FMT);
- vte |= R200_VTX_W0_FMT;
- vap &= ~R200_VAP_FORCE_W_TO_ONE;
-
- rmesa->swtcl.vertex_size = 5;
-
- if ( (rmesa->hw.vtx.cmd[VTX_VTXFMT_0] != fmt_0)
- || (rmesa->hw.vtx.cmd[VTX_VTXFMT_1] != fmt_1) ) {
- R200_NEWPRIM(rmesa);
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = fmt_0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = fmt_1;
- }
-
- if (vte != rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]) {
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] = vte;
- }
-
- if (vap != rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]) {
- R200_STATECHANGE( rmesa, vap );
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] = vap;
- }
- }
-
- /* Ready for point primitives:
- */
- r200RenderPrimitive( ctx, GL_POINTS );
-
- /* Turn off the hw viewport transformation:
- */
- R200_STATECHANGE( rmesa, vte );
- orig_vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL];
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VPORT_X_SCALE_ENA |
- R200_VPORT_Y_SCALE_ENA |
- R200_VPORT_Z_SCALE_ENA |
- R200_VPORT_X_OFFSET_ENA |
- R200_VPORT_Y_OFFSET_ENA |
- R200_VPORT_Z_OFFSET_ENA);
-
- /* Turn off other stuff: Stipple?, texture?, blending?, etc.
- */
-
-
- /* Populate the vertex
- *
- * Incorporate FOG into RGBA
- */
- if (ctx->Fog.Enabled) {
- const GLfloat *fc = ctx->Fog.Color;
- GLfloat color[4];
- GLfloat f;
-
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
- f = _swrast_z_to_fogfactor(ctx, ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
- else
- f = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance);
-
- color[0] = f * rc[0] + (1.F - f) * fc[0];
- color[1] = f * rc[1] + (1.F - f) * fc[1];
- color[2] = f * rc[2] + (1.F - f) * fc[2];
- color[3] = rc[3];
-
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.red, color[0]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.green, color[1]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.blue, color[2]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.alpha, color[3]);
- }
- else {
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.red, rc[0]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.green, rc[1]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.blue, rc[2]);
- UNCLAMPED_FLOAT_TO_CHAN(vert.tv.color.alpha, rc[3]);
- }
-
-
- vert.tv.z = ctx->Current.RasterPos[2];
-
-
- /* Update window height
- */
- LOCK_HARDWARE( rmesa );
- UNLOCK_HARDWARE( rmesa );
- h = rmesa->dri.drawable->h + rmesa->dri.drawable->y;
- px += rmesa->dri.drawable->x;
-
- /* Clipping handled by existing mechansims in r200_ioctl.c?
- */
- for (row=0; row<height; row++) {
- const GLubyte *src = (const GLubyte *)
- _mesa_image_address2d(unpack, bitmap, width, height,
- GL_COLOR_INDEX, GL_BITMAP, row, 0 );
-
- if (unpack->LsbFirst) {
- /* Lsb first */
- GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
- for (col=0; col<width; col++) {
- if (*src & mask) {
- vert.tv.x = px+col;
- vert.tv.y = h - (py+row) - 1;
- r200_point( rmesa, &vert );
- }
- src += (mask >> 7);
- mask = ((mask << 1) & 0xff) | (mask >> 7);
- }
-
- /* get ready for next row */
- if (mask != 1)
- src++;
- }
- else {
- /* Msb first */
- GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
- for (col=0; col<width; col++) {
- if (*src & mask) {
- vert.tv.x = px+col;
- vert.tv.y = h - (py+row) - 1;
- r200_point( rmesa, &vert );
- }
- src += mask & 1;
- mask = ((mask << 7) & 0xff) | (mask >> 1);
- }
- /* get ready for next row */
- if (mask != 128)
- src++;
- }
- }
-
- /* Fire outstanding vertices, restore state
- */
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] = orig_vte;
-
- /* Unfallback
- */
- TCL_FALLBACK( ctx, R200_TCL_FALLBACK_BITMAP, 0 );
-
- /* Need to restore vertexformat?
- */
- if (rmesa->TclFallback)
- r200ChooseVertexState( ctx );
-}
-
-
-void r200FlushVertices( GLcontext *ctx, GLuint flags )
-{
- _tnl_FlushVertices( ctx, flags );
-
- if (flags & FLUSH_STORED_VERTICES)
- R200_NEWPRIM( R200_CONTEXT( ctx ) );
-}
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void r200InitSwtcl( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.Render.Start = r200RenderStart;
- tnl->Driver.Render.Finish = r200RenderFinish;
- tnl->Driver.Render.PrimitiveNotify = r200RenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = r200ResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- /* FIXME: what are these numbers? */
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- 36 * sizeof(GLfloat) );
-
- rmesa->swtcl.verts = (GLubyte *)tnl->clipspace.vertex_buf;
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->swtcl.render_primitive = GL_TRIANGLES;
- rmesa->swtcl.hw_primitive = 0;
-}
-
-
-void r200DestroySwtcl( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->swtcl.indexed_verts.buf)
- r200ReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts, __FUNCTION__ );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.h
deleted file mode 100644
index ce2b6b5f0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-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.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_SWTCL_H__
-#define __R200_SWTCL_H__
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "r200_context.h"
-
-extern void r200InitSwtcl( GLcontext *ctx );
-extern void r200DestroySwtcl( GLcontext *ctx );
-
-extern void r200FlushVertices( GLcontext *ctx, GLuint flags );
-extern void r200ChooseRenderState( GLcontext *ctx );
-extern void r200ChooseVertexState( GLcontext *ctx );
-
-extern void r200CheckTexSizes( GLcontext *ctx );
-
-extern void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void r200PrintSetupFlags(char *msg, GLuint flags );
-
-
-extern void r200_emit_indexed_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void r200_translate_vertex( GLcontext *ctx,
- const r200Vertex *src,
- SWvertex *dst );
-
-extern void r200_print_vertex( GLcontext *ctx, const r200Vertex *v );
-
-extern void r200_import_float_colors( GLcontext *ctx );
-extern void r200_import_float_spec_colors( GLcontext *ctx );
-
-extern void r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c
deleted file mode 100644
index 05c658fbe..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.c,v 1.2 2002/12/16 16:18:55 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "colormac.h"
-#include "light.h"
-
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-#include "r200_swtcl.h"
-#include "r200_maos.h"
-
-
-
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_LOOP 0
-#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 1
-
-
-#define HW_POINTS R200_VF_PRIM_POINTS
-#define HW_LINES R200_VF_PRIM_LINES
-#define HW_LINE_LOOP 0
-#define HW_LINE_STRIP R200_VF_PRIM_LINE_STRIP
-#define HW_TRIANGLES R200_VF_PRIM_TRIANGLES
-#define HW_TRIANGLE_STRIP_0 R200_VF_PRIM_TRIANGLE_STRIP
-#define HW_TRIANGLE_STRIP_1 0
-#define HW_TRIANGLE_FAN R200_VF_PRIM_TRIANGLE_FAN
-#define HW_QUADS R200_VF_PRIM_QUADS
-#define HW_QUAD_STRIP R200_VF_PRIM_QUAD_STRIP
-#define HW_POLYGON R200_VF_PRIM_POLYGON
-
-
-static GLboolean discrete_prim[0x10] = {
- 0, /* 0 none */
- 1, /* 1 points */
- 1, /* 2 lines */
- 0, /* 3 line_strip */
- 1, /* 4 tri_list */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_strip */
- 0, /* 7 tri_w_flags */
- 1, /* 8 rect list (unused) */
- 1, /* 9 3vert point */
- 1, /* a 3vert line */
- 0, /* b point sprite */
- 0, /* c line loop */
- 1, /* d quads */
- 0, /* e quad strip */
- 0, /* f polygon */
-};
-
-
-#define LOCAL_VARS r200ContextPtr rmesa = R200_CONTEXT(ctx)
-#define ELT_TYPE GLushort
-
-#define ELT_INIT(prim, hw_prim) \
- r200TclPrimitive( ctx, prim, hw_prim | R200_VF_PRIM_WALK_IND )
-
-#define GET_MESA_ELTS() rmesa->tcl.Elts
-
-
-/* Don't really know how many elts will fit in what's left of cmdbuf,
- * as there is state to emit, etc:
- */
-
-/* Testing on isosurf shows a maximum around here. Don't know if it's
- * the card or driver or kernel module that is causing the behaviour.
- */
-#define GET_MAX_HW_ELTS() 300
-
-#define RESET_STIPPLE() do { \
- R200_STATECHANGE( rmesa, lin ); \
- r200EmitState( rmesa ); \
-} while (0)
-
-#define AUTO_STIPPLE( mode ) do { \
- R200_STATECHANGE( rmesa, lin ); \
- if (mode) \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] |= \
- R200_LINE_PATTERN_AUTO_RESET; \
- else \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] &= \
- ~R200_LINE_PATTERN_AUTO_RESET; \
- r200EmitState( rmesa ); \
-} while (0)
-
-
-#define ALLOC_ELTS(nr) r200AllocElts( rmesa, nr )
-
-static GLushort *r200AllocElts( r200ContextPtr rmesa, GLuint nr )
-{
- if (rmesa->dma.flush == r200FlushElts &&
- rmesa->store.cmd_used + nr*2 < R200_CMD_BUF_SZ) {
-
- GLushort *dest = (GLushort *)(rmesa->store.cmd_buf +
- rmesa->store.cmd_used);
-
- rmesa->store.cmd_used += nr*2;
-
- return dest;
- }
- else {
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- r200EnsureCmdBufSpace( rmesa, AOS_BUFSZ(rmesa->tcl.nr_aos_components) +
- rmesa->hw.max_state_size + ELTS_BUFSZ(nr) );
-
- r200EmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components, 0 );
-
- return r200AllocEltsOpenEnded( rmesa, rmesa->tcl.hw_primitive, nr );
- }
-}
-
-
-#define CLOSE_ELTS() \
-do { \
- if (0) R200_NEWPRIM( rmesa ); \
-} \
-while (0)
-
-
-/* TODO: Try to extend existing primitive if both are identical,
- * discrete and there are no intervening state changes. (Somewhat
- * duplicates changes to DrawArrays code)
- */
-static void r200EmitPrim( GLcontext *ctx,
- GLenum prim,
- GLuint hwprim,
- GLuint start,
- GLuint count)
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- r200TclPrimitive( ctx, prim, hwprim );
-
- r200EnsureCmdBufSpace( rmesa, AOS_BUFSZ(rmesa->tcl.nr_aos_components) +
- rmesa->hw.max_state_size + VBUF_BUFSZ );
-
- r200EmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components,
- start );
-
- /* Why couldn't this packet have taken an offset param?
- */
- r200EmitVbufPrim( rmesa,
- rmesa->tcl.hw_primitive,
- count - start );
-}
-
-#define EMIT_PRIM(ctx, prim, hwprim, start, count) do { \
- r200EmitPrim( ctx, prim, hwprim, start, count ); \
- (void) rmesa; } while (0)
-
-/* Try & join small primitives
- */
-#if 0
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) 0
-#else
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) \
- ((NR) < 20 || \
- ((NR) < 40 && \
- rmesa->tcl.hw_primitive == (PRIM| \
- R200_VF_TCL_OUTPUT_VTX_ENABLE| \
- R200_VF_PRIM_WALK_IND)))
-#endif
-
-#ifdef MESA_BIG_ENDIAN
-/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
-#define EMIT_ELT(dest, offset, x) do { \
- int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
- GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
- (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); \
- (void)rmesa; } while (0)
-#else
-#define EMIT_ELT(dest, offset, x) do { \
- (dest)[offset] = (GLushort) (x); \
- (void)rmesa; } while (0)
-#endif
-
-#define EMIT_TWO_ELTS(dest, offset, x, y) *(GLuint *)((dest)+offset) = ((y)<<16)|(x);
-
-
-
-#define TAG(x) tcl_##x
-#include "tnl_dd/t_dd_dmatmp2.h"
-
-/**********************************************************************/
-/* External entrypoints */
-/**********************************************************************/
-
-void r200EmitPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void r200EmitEltPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void r200TclPrimitive( GLcontext *ctx,
- GLenum prim,
- int hw_prim )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE;
-
- if (newprim != rmesa->tcl.hw_primitive ||
- !discrete_prim[hw_prim&0xf]) {
- R200_NEWPRIM( rmesa );
- rmesa->tcl.hw_primitive = newprim;
- }
-}
-
-
-/**********************************************************************/
-/* Fog blend factor computation for hw tcl */
-/* same calculation used as in t_vb_fog.c */
-/**********************************************************************/
-
-#define FOG_EXP_TABLE_SIZE 256
-#define FOG_MAX (10.0)
-#define EXP_FOG_MAX .0006595
-#define FOG_INCR (FOG_MAX/FOG_EXP_TABLE_SIZE)
-static GLfloat exp_table[FOG_EXP_TABLE_SIZE];
-
-#if 1
-#define NEG_EXP( result, narg ) \
-do { \
- GLfloat f = (GLfloat) (narg * (1.0/FOG_INCR)); \
- GLint k = (GLint) f; \
- if (k > FOG_EXP_TABLE_SIZE-2) \
- result = (GLfloat) EXP_FOG_MAX; \
- else \
- result = exp_table[k] + (f-k)*(exp_table[k+1]-exp_table[k]); \
-} while (0)
-#else
-#define NEG_EXP( result, narg ) \
-do { \
- result = exp(-narg); \
-} while (0)
-#endif
-
-
-/**
- * Initialize the exp_table[] lookup table for approximating exp().
- */
-void
-r200InitStaticFogData( void )
-{
- GLfloat f = 0.0F;
- GLint i = 0;
- for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) {
- exp_table[i] = (GLfloat) exp(-f);
- }
-}
-
-
-/**
- * Compute per-vertex fog blend factors from fog coordinates by
- * evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function.
- * Fog coordinates are distances from the eye (typically between the
- * near and far clip plane distances).
- * Note the fog (eye Z) coords may be negative so we use ABS(z) below.
- * Fog blend factors are in the range [0,1].
- */
-float
-r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord )
-{
- GLfloat end = ctx->Fog.End;
- GLfloat d, temp;
- const GLfloat z = FABSF(fogcoord);
-
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- if (ctx->Fog.Start == ctx->Fog.End)
- d = 1.0F;
- else
- d = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
- temp = (end - z) * d;
- return CLAMP(temp, 0.0F, 1.0F);
- break;
- case GL_EXP:
- d = ctx->Fog.Density;
- NEG_EXP( temp, d * z );
- return temp;
- break;
- case GL_EXP2:
- d = ctx->Fog.Density*ctx->Fog.Density;
- NEG_EXP( temp, d * z * z );
- return temp;
- break;
- default:
- _mesa_problem(ctx, "Bad fog mode in make_fog_coord");
- return 0;
- }
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-/* TCL render.
- */
-static GLboolean r200_run_tcl_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
- GLuint i;
-
- /* TODO: separate this from the swtnl pipeline
- */
- if (rmesa->TclFallback)
- return GL_TRUE; /* fallback to software t&l */
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (VB->Count == 0)
- return GL_FALSE;
-
- /* Validate state:
- */
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- /* NOTE: inputs != tnl->render_inputs - these are the untransformed
- * inputs.
- */
- if (ctx->Light.Enabled) {
- inputs |= VERT_BIT_NORMAL;
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- inputs |= VERT_BIT_COLOR1;
- }
- }
-
- if ( ctx->Fog.FogCoordinateSource == GL_FOG_COORD ) {
- inputs |= VERT_BIT_FOG;
- }
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled) {
- if (rmesa->TexGenNeedNormals[i]) {
- inputs |= VERT_BIT_NORMAL;
- }
- inputs |= VERT_BIT_TEX(i);
- }
- }
-
- /* Do the actual work:
- */
- r200ReleaseArrays( ctx, ~0 /* stage->changed_inputs */ );
- r200EmitArrays( ctx, inputs );
-
- rmesa->tcl.Elts = VB->Elts;
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- if (rmesa->tcl.Elts)
- r200EmitEltPrimitive( ctx, start, start+length, prim );
- else
- r200EmitPrimitive( ctx, start, start+length, prim );
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-/* Initial state for tcl stage.
- */
-const struct tnl_pipeline_stage _r200_tcl_stage =
-{
- "r200 render",
- NULL, /* private */
- NULL,
- NULL,
- NULL,
- r200_run_tcl_render /* run */
-};
-
-
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-
-/*-----------------------------------------------------------------------
- * Manage TCL fallbacks
- */
-
-
-static void transition_to_swtnl( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- R200_NEWPRIM( rmesa );
-
- r200ChooseVertexState( ctx );
- r200ChooseRenderState( ctx );
-
- _mesa_validate_all_lighting_tables( ctx );
-
- tnl->Driver.NotifyMaterialChange =
- _mesa_validate_all_lighting_tables;
-
- r200ReleaseArrays( ctx, ~0 );
-
- /* Still using the D3D based hardware-rasterizer from the radeon;
- * need to put the card into D3D mode to make it work:
- */
- R200_STATECHANGE( rmesa, vap );
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~R200_VAP_TCL_ENABLE;
-}
-
-static void transition_to_hwtnl( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- _tnl_need_projected_coords( ctx, GL_FALSE );
-
- r200UpdateMaterial( ctx );
-
- tnl->Driver.NotifyMaterialChange = r200UpdateMaterial;
-
- if ( rmesa->dma.flush )
- rmesa->dma.flush( rmesa );
-
- rmesa->dma.flush = NULL;
-
- if (rmesa->swtcl.indexed_verts.buf)
- r200ReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts,
- __FUNCTION__ );
-
- R200_STATECHANGE( rmesa, vap );
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] |= R200_VAP_TCL_ENABLE;
- rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~R200_VAP_FORCE_W_TO_ONE;
-
- if ( ((rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] & R200_FOG_USE_MASK)
- == R200_FOG_USE_SPEC_ALPHA) &&
- (ctx->Fog.FogCoordinateSource == GL_FOG_COORD )) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] &= ~R200_FOG_USE_MASK;
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] |= R200_FOG_USE_VTX_FOG;
- }
-
- R200_STATECHANGE( rmesa, vte );
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VTX_XY_FMT|R200_VTX_Z_FMT);
- rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] |= R200_VTX_W0_FMT;
-
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "R200 end tcl fallback\n");
-}
-
-
-static char *fallbackStrings[] = {
- "Rasterization fallback",
- "Unfilled triangles",
- "Twosided lighting, differing materials",
- "Materials in VB (maybe between begin/end)",
- "Texgen unit 0",
- "Texgen unit 1",
- "Texgen unit 2",
- "Texgen unit 3",
- "Texgen unit 4",
- "Texgen unit 5",
- "User disable",
- "Bitmap as points",
- "Vertex program"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-
-void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint oldfallback = rmesa->TclFallback;
-
- if (mode) {
- rmesa->TclFallback |= bit;
- if (oldfallback == 0) {
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "R200 begin tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_swtnl( ctx );
- }
- }
- else {
- rmesa->TclFallback &= ~bit;
- if (oldfallback == bit) {
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "R200 end tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_hwtnl( ctx );
- }
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.h
deleted file mode 100644
index ac5bc1194..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tcl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.h,v 1.2 2002/12/16 16:18:55 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_TCL_H__
-#define __R200_TCL_H__
-
-#include "r200_context.h"
-
-extern void r200TclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim );
-extern void r200EmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-extern void r200EmitPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-
-extern void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-
-extern void r200InitStaticFogData( void );
-
-extern float r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord );
-
-#define R200_TCL_FALLBACK_RASTER 0x1 /* rasterization */
-#define R200_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */
-#define R200_TCL_FALLBACK_LIGHT_TWOSIDE 0x4 /* twoside tris */
-#define R200_TCL_FALLBACK_MATERIAL 0x8 /* material in vb */
-#define R200_TCL_FALLBACK_TEXGEN_0 0x10 /* texgen, unit 0 */
-#define R200_TCL_FALLBACK_TEXGEN_1 0x20 /* texgen, unit 1 */
-#define R200_TCL_FALLBACK_TEXGEN_2 0x40 /* texgen, unit 2 */
-#define R200_TCL_FALLBACK_TEXGEN_3 0x80 /* texgen, unit 3 */
-#define R200_TCL_FALLBACK_TEXGEN_4 0x100 /* texgen, unit 4 */
-#define R200_TCL_FALLBACK_TEXGEN_5 0x200 /* texgen, unit 5 */
-#define R200_TCL_FALLBACK_TCL_DISABLE 0x400 /* user disable */
-#define R200_TCL_FALLBACK_BITMAP 0x800 /* draw bitmap with points */
-#define R200_TCL_FALLBACK_VERTEX_PROGRAM 0x1000/* vertex program active */
-
-#define TCL_FALLBACK( ctx, bit, mode ) r200TclFallback( ctx, bit, mode )
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c
deleted file mode 100644
index 3d259c2ca..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c
+++ /dev/null
@@ -1,1183 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.c,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
-/*
-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.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "image.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "texmem.h"
-#include "teximage.h"
-#include "texobj.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_swtcl.h"
-#include "r200_tex.h"
-
-#include "xmlpool.h"
-
-
-
-/**
- * Set the texture wrap modes.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void r200SetTexWrap( r200TexObjPtr t, GLenum swrap, GLenum twrap, GLenum rwrap )
-{
- GLboolean is_clamp = GL_FALSE;
- GLboolean is_clamp_to_border = GL_FALSE;
-
- t->pp_txfilter &= ~(R200_CLAMP_S_MASK | R200_CLAMP_T_MASK | R200_BORDER_MODE_D3D);
-
- switch ( swrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= R200_CLAMP_S_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= R200_CLAMP_S_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= R200_CLAMP_S_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= R200_CLAMP_S_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= R200_CLAMP_S_MIRROR;
- break;
- case GL_MIRROR_CLAMP_EXT:
- t->pp_txfilter |= R200_CLAMP_S_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- t->pp_txfilter |= R200_CLAMP_S_MIRROR_CLAMP_LAST;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- t->pp_txfilter |= R200_CLAMP_S_MIRROR_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch ( twrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= R200_CLAMP_T_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= R200_CLAMP_T_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= R200_CLAMP_T_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= R200_CLAMP_T_CLAMP_GL | R200_BORDER_MODE_D3D;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= R200_CLAMP_T_MIRROR;
- break;
- case GL_MIRROR_CLAMP_EXT:
- t->pp_txfilter |= R200_CLAMP_T_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- t->pp_txfilter |= R200_CLAMP_T_MIRROR_CLAMP_LAST;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- t->pp_txfilter |= R200_CLAMP_T_MIRROR_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-
- t->pp_txformat_x &= ~R200_CLAMP_Q_MASK;
-
- switch ( rwrap ) {
- case GL_REPEAT:
- t->pp_txformat_x |= R200_CLAMP_Q_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txformat_x |= R200_CLAMP_Q_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txformat_x |= R200_CLAMP_Q_MIRROR;
- break;
- case GL_MIRROR_CLAMP_EXT:
- t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_LAST;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- t->pp_txformat_x |= R200_CLAMP_Q_MIRROR_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad R wrap mode in %s", __FUNCTION__);
- }
-
- if ( is_clamp_to_border ) {
- t->pp_txfilter |= R200_BORDER_MODE_D3D;
- }
-
- t->border_fallback = (is_clamp && is_clamp_to_border);
-}
-
-static void r200SetTexMaxAnisotropy( r200TexObjPtr t, GLfloat max )
-{
- t->pp_txfilter &= ~R200_MAX_ANISO_MASK;
-
- if ( max == 1.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_1_TO_1;
- } else if ( max <= 2.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_2_TO_1;
- } else if ( max <= 4.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_4_TO_1;
- } else if ( max <= 8.0 ) {
- t->pp_txfilter |= R200_MAX_ANISO_8_TO_1;
- } else {
- t->pp_txfilter |= R200_MAX_ANISO_16_TO_1;
- }
-}
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- */
-
-static void r200SetTexFilter( r200TexObjPtr t, GLenum minf, GLenum magf )
-{
- GLuint anisotropy = (t->pp_txfilter & R200_MAX_ANISO_MASK);
-
- t->pp_txfilter &= ~(R200_MIN_FILTER_MASK | R200_MAG_FILTER_MASK);
- t->pp_txformat_x &= ~R200_VOLUME_FILTER_MASK;
-
- if ( anisotropy == R200_MAX_ANISO_1_TO_1 ) {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_LINEAR_MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_NEAREST_MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_LINEAR_MIP_LINEAR;
- break;
- }
- } else {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR;
- break;
- }
- }
-
- /* Note we don't have 3D mipmaps so only use the mag filter setting
- * to set the 3D texture filter mode.
- */
- switch ( magf ) {
- case GL_NEAREST:
- t->pp_txfilter |= R200_MAG_FILTER_NEAREST;
- t->pp_txformat_x |= R200_VOLUME_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= R200_MAG_FILTER_LINEAR;
- t->pp_txformat_x |= R200_VOLUME_FILTER_LINEAR;
- break;
- }
-}
-
-static void r200SetTexBorderColor( r200TexObjPtr t, GLubyte c[4] )
-{
- t->pp_border_color = r200PackColor( 4, c[0], c[1], c[2], c[3] );
-}
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static r200TexObjPtr r200AllocTexObj( struct gl_texture_object *texObj )
-{
- r200TexObjPtr t;
-
- t = CALLOC_STRUCT( r200_tex_obj );
- texObj->DriverData = t;
- if ( t != NULL ) {
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, (void *)texObj,
- (void *)t );
- }
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->border_fallback = GL_FALSE;
-
- make_empty_list( & t->base );
-
- r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR );
- r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- r200SetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static const struct gl_texture_format *
-r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch ( type ) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? _dri_texformat_argb8888 : _dri_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
- default:
- return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch ( type ) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return _dri_texformat_rgb565;
- default:
- return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- _dri_texformat_rgba8888 : _dri_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return _dri_texformat_argb4444;
-
- case GL_RGB5_A1:
- return _dri_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return _dri_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return _dri_texformat_a8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return _dri_texformat_l8;
-
- 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 _dri_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return _dri_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
- default:
- _mesa_problem(ctx,
- "unexpected internalFormat 0x%x in r200ChooseTextureFormat",
- (int) internalFormat);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-
-static GLboolean
-r200ValidateClientStorage( GLcontext *ctx, GLenum target,
- GLint internalFormat,
- GLint srcWidth, GLint srcHeight,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (0)
- fprintf(stderr, "intformat %s format %s type %s\n",
- _mesa_lookup_enum_by_nr( internalFormat ),
- _mesa_lookup_enum_by_nr( format ),
- _mesa_lookup_enum_by_nr( type ));
-
- if (!ctx->Unpack.ClientStorage)
- return 0;
-
- if (ctx->_ImageTransferState ||
- texImage->IsCompressed ||
- texObj->GenerateMipmap)
- return 0;
-
-
- /* This list is incomplete, may be different on ppc???
- */
- switch ( internalFormat ) {
- case GL_RGBA:
- if ( format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- texImage->TexFormat = _dri_texformat_argb8888;
- }
- else
- return 0;
- break;
-
- case GL_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- texImage->TexFormat = _dri_texformat_rgb565;
- }
- else
- return 0;
- break;
-
- case GL_YCBCR_MESA:
- if ( format == GL_YCBCR_MESA &&
- type == GL_UNSIGNED_SHORT_8_8_REV_APPLE ) {
- texImage->TexFormat = &_mesa_texformat_ycbcr_rev;
- }
- else if ( format == GL_YCBCR_MESA &&
- (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)) {
- texImage->TexFormat = &_mesa_texformat_ycbcr;
- }
- else
- return 0;
- break;
-
- default:
- return 0;
- }
-
- /* Could deal with these packing issues, but currently don't:
- */
- if (packing->SkipPixels ||
- packing->SkipRows ||
- packing->SwapBytes ||
- packing->LsbFirst) {
- return 0;
- }
-
- {
- GLint srcRowStride = _mesa_image_row_stride(packing, srcWidth,
- format, type);
-
-
- if (0)
- fprintf(stderr, "%s: srcRowStride %d/%x\n",
- __FUNCTION__, srcRowStride, srcRowStride);
-
- /* Could check this later in upload, pitch restrictions could be
- * relaxed, but would need to store the image pitch somewhere,
- * as packing details might change before image is uploaded:
- */
- if (!r200IsGartMemory( rmesa, pixels, srcHeight * srcRowStride ) ||
- (srcRowStride & 63))
- return 0;
-
-
- /* Have validated that _mesa_transfer_teximage would be a straight
- * memcpy at this point. NOTE: future calls to TexSubImage will
- * overwrite the client data. This is explicitly mentioned in the
- * extension spec.
- */
- texImage->Data = (void *)pixels;
- texImage->IsClientData = GL_TRUE;
- texImage->RowStride = srcRowStride / texImage->TexFormat->TexelBytes;
-
- return 1;
- }
-}
-
-
-static void r200TexImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_teximage1d(ctx, target, level, internalFormat,
- width, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r200TexSubImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void r200TexImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-
- if (r200ValidateClientStorage( ctx, target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
- }
- else {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
-
- /* Normal path: copy (to cached memory) and eventually upload
- * via another copy to GART memory and then a blit... Could
- * eliminate one copy by going straight to (permanent) GART.
- *
- * Note, this will call r200ChooseTextureFormat.
- */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
- }
-}
-
-
-static void r200TexSubImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void r200CompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-/* can't call this, different parameters. Would never evaluate to true anyway currently
- if (r200ValidateClientStorage( ctx, target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
- }
- else */{
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
-
- /* Normal path: copy (to cached memory) and eventually upload
- * via another copy to GART memory and then a blit... Could
- * eliminate one copy by going straight to (permanent) GART.
- *
- * Note, this will call r200ChooseTextureFormat.
- */
- _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
- height, border, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
- }
-}
-
-
-static void r200CompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-#if ENABLE_HW_3D_TEXTURE
-static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-
-#if 0
- if (r200ValidateClientStorage( ctx, target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n", __FUNCTION__);
- }
- else
-#endif
- {
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__);
-
- /* Normal path: copy (to cached memory) and eventually upload
- * via another copy to GART memory and then a blit... Could
- * eliminate one copy by going straight to (permanent) GART.
- *
- * Note, this will call r200ChooseTextureFormat.
- */
- _mesa_store_teximage3d(ctx, target, level, internalFormat,
- width, height, depth, border,
- format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
- }
-}
-#endif
-
-
-#if ENABLE_HW_3D_TEXTURE
-static void
-r200TexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) r200AllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
- return;
- }
- texObj->DriverData = t;
- }
-
- _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels, packing, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-#endif
-
-
-
-static void r200TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if ( R200_DEBUG & DEBUG_STATE ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- /* This is incorrect: Need to maintain this data for each of
- * GL_TEXTURE_{123}D, GL_TEXTURE_RECTANGLE_NV, etc, and switch
- * between them according to _ReallyEnabled.
- */
- switch ( pname ) {
- case GL_TEXTURE_ENV_COLOR: {
- GLubyte c[4];
- GLuint envColor;
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
- envColor = r200PackColor( 4, c[0], c[1], c[2], c[3] );
- if ( rmesa->hw.tf.cmd[TF_TFACTOR_0 + unit] != envColor ) {
- R200_STATECHANGE( rmesa, tf );
- rmesa->hw.tf.cmd[TF_TFACTOR_0 + unit] = envColor;
- }
- break;
- }
-
- case GL_TEXTURE_LOD_BIAS_EXT: {
- GLfloat bias, min;
- GLuint b;
- const int fixed_one = 0x8000000;
-
- /* The R200's LOD bias is a signed 2's complement value with a
- * range of -16.0 <= bias < 16.0.
- *
- * NOTE: Add a small bias to the bias for conform mipsel.c test.
- */
- bias = *param + .01;
- min = driQueryOptionb (&rmesa->optionCache, "no_neg_lod_bias") ?
- 0.0 : -16.0;
- bias = CLAMP( bias, min, 16.0 );
- b = (int)(bias * fixed_one) & R200_LOD_BIAS_MASK;
-
- if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] & R200_LOD_BIAS_MASK) != b ) {
- R200_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] &= ~R200_LOD_BIAS_MASK;
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] |= b;
- }
- break;
- }
-
- default:
- return;
- }
-}
-
-
-/**
- * Changes variables and flags for a state update, which will happen at the
- * next UpdateTextureState
- */
-
-static void r200TexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj,
- GLenum pname, const GLfloat *params )
-{
- r200TexObjPtr t = (r200TexObjPtr) texObj->DriverData;
-
- if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( pname ) );
- }
-
- switch ( pname ) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- r200SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- r200SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- r200SetTexWrap( t, texObj->WrapS, texObj->WrapT, texObj->WrapR );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- r200SetTexBorderColor( t, texObj->_BorderChan );
- 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. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- /* Mark this texobj as dirty (one bit per tex unit)
- */
- t->dirty_state = TEX_ALL;
-}
-
-
-
-static void r200BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, (void *)texObj,
- ctx->Texture.CurrentUnit );
- }
-
- if ( (target == GL_TEXTURE_1D)
- || (target == GL_TEXTURE_2D)
-#if ENABLE_HW_3D_TEXTURE
- || (target == GL_TEXTURE_3D)
-#endif
- || (target == GL_TEXTURE_CUBE_MAP)
- || (target == GL_TEXTURE_RECTANGLE_NV) ) {
- assert( texObj->DriverData != NULL );
- }
-}
-
-
-static void r200DeleteTexture( GLcontext *ctx,
- struct gl_texture_object *texObj )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( R200_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p (target = %s) )\n", __FUNCTION__, (void *)texObj,
- _mesa_lookup_enum_by_nr( texObj->Target ) );
- }
-
- if ( t != NULL ) {
- if ( rmesa ) {
- R200_FIREVERTICES( rmesa );
- }
-
- driDestroyTextureObject( t );
- }
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, texObj);
-}
-
-/* Need:
- * - Same GEN_MODE for all active bits
- * - Same EyePlane/ObjPlane for all active bits when using Eye/Obj
- * - STRQ presumably all supported (matrix means incoming R values
- * can end up in STQ, this has implications for vertex support,
- * presumably ok if maos is used, though?)
- *
- * Basically impossible to do this on the fly - just collect some
- * basic info & do the checks from ValidateState().
- */
-static void r200TexGen( GLcontext *ctx,
- GLenum coord,
- GLenum pname,
- const GLfloat *params )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- rmesa->recheck_texgen[unit] = GL_TRUE;
-}
-
-
-/**
- * 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.
- * Fixup MaxAnisotropy according to user preference.
- */
-static struct gl_texture_object *
-r200NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- if (!obj)
- return NULL;
- obj->MaxAnisotropy = rmesa->initialMaxAnisotropy;
- r200AllocTexObj( obj );
- return obj;
-}
-
-
-void r200InitTextureFuncs( struct dd_function_table *functions )
-{
- /* Note: we only plug in the functions we implement in the driver
- * since _mesa_init_driver_functions() was already called.
- */
- functions->ChooseTextureFormat = r200ChooseTextureFormat;
- functions->TexImage1D = r200TexImage1D;
- functions->TexImage2D = r200TexImage2D;
-#if ENABLE_HW_3D_TEXTURE
- functions->TexImage3D = r200TexImage3D;
-#else
- functions->TexImage3D = _mesa_store_teximage3d;
-#endif
- functions->TexSubImage1D = r200TexSubImage1D;
- functions->TexSubImage2D = r200TexSubImage2D;
-#if ENABLE_HW_3D_TEXTURE
- functions->TexSubImage3D = r200TexSubImage3D;
-#else
- functions->TexSubImage3D = _mesa_store_texsubimage3d;
-#endif
- functions->NewTextureObject = r200NewTextureObject;
- functions->BindTexture = r200BindTexture;
- functions->DeleteTexture = r200DeleteTexture;
- functions->IsTextureResident = driIsTextureResident;
-
- functions->TexEnv = r200TexEnv;
- functions->TexParameter = r200TexParameter;
- functions->TexGen = r200TexGen;
-
- functions->CompressedTexImage2D = r200CompressedTexImage2D;
- functions->CompressedTexSubImage2D = r200CompressedTexSubImage2D;
-
- driInitTextureFormats();
-
-#if 000
- /* moved or obsolete code */
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- driInitTextureObjects( ctx, & rmesa->swapped,
- DRI_TEXMGR_DO_TEXTURE_1D
- | DRI_TEXMGR_DO_TEXTURE_2D );
-
- /* Hack: r200NewTextureObject is not yet installed when the
- * default textures are created. Therefore set MaxAnisotropy of the
- * default 2D texture now. */
- ctx->Shared->Default2D->MaxAnisotropy = driQueryOptionf (&rmesa->optionCache,
- "def_max_anisotropy");
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.h
deleted file mode 100644
index acabbc11b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_TEX_H__
-#define __R200_TEX_H__
-
-extern void r200UpdateTextureState( GLcontext *ctx );
-
-extern int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face );
-
-extern void r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t );
-
-extern void r200InitTextureFuncs( struct dd_function_table *functions );
-
-#endif /* __R200_TEX_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c
deleted file mode 100644
index 7472afeed..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texmem.c,v 1.5 2002/12/17 00:32:56 dawes Exp $ */
-/**************************************************************************
-
-Copyright (C) Tungsten Graphics 2002. All Rights Reserved.
-The Weather Channel, Inc. 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 on 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 ATI, 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "radeon_reg.h"
-
-#include <unistd.h> /* for usleep() */
-
-
-/**
- * Destroy any device-dependent state associated with the texture. This may
- * include NULLing out hardware state that points to the texture.
- */
-void
-r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t )
-{
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__,
- (void *)t, (void *)t->base.tObj );
- }
-
- if ( rmesa != NULL ) {
- unsigned i;
-
-
- for ( i = 0 ; i < rmesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ( t == rmesa->state.texture.unit[i].texobj ) {
- rmesa->state.texture.unit[i].texobj = NULL;
- rmesa->hw.tex[i].dirty = GL_FALSE;
- rmesa->hw.cube[i].dirty = GL_FALSE;
- }
- }
- }
-}
-
-
-/* ------------------------------------------------------------
- * Texture image conversions
- */
-
-
-static void r200UploadGARTClientSubImage( r200ContextPtr rmesa,
- r200TexObjPtr t,
- struct gl_texture_image *texImage,
- GLint hwlevel,
- GLint x, GLint y,
- GLint width, GLint height )
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- GLuint srcPitch, dstPitch;
- int blit_format;
- int srcOffset;
-
- /*
- * XXX it appears that we always upload the full image, not a subimage.
- * I.e. x==0, y==0, width=texWidth, height=texWidth. If this is ever
- * changed, the src pitch will have to change.
- */
- switch ( texFormat->TexelBytes ) {
- case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- default:
- return;
- }
-
- t->image[0][hwlevel].data = texImage->Data;
- srcOffset = r200GartOffsetFromVirtual( rmesa, texImage->Data );
-
- assert( srcOffset != ~0 );
-
- /* Don't currently need to cope with small pitches?
- */
- width = texImage->Width;
- height = texImage->Height;
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- r200EmitBlit( rmesa, blit_format,
- srcPitch,
- srcOffset,
- dstPitch,
- t->bufAddr,
- x,
- y,
- t->image[0][hwlevel].x + x,
- t->image[0][hwlevel].y + y,
- width,
- height );
-
- r200EmitWait( rmesa, RADEON_WAIT_2D );
-}
-
-static void r200UploadRectSubImage( r200ContextPtr rmesa,
- r200TexObjPtr t,
- struct gl_texture_image *texImage,
- GLint x, GLint y,
- GLint width, GLint height )
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- int blit_format, dstPitch, done;
-
- switch ( texFormat->TexelBytes ) {
- case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
- break;
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return;
- }
-
- t->image[0][0].data = texImage->Data;
-
- /* Currently don't need to cope with small pitches.
- */
- width = texImage->Width;
- height = texImage->Height;
- dstPitch = t->pp_txpitch + 32;
-
- if (rmesa->prefer_gart_client_texturing && texImage->IsClientData) {
- /* In this case, could also use GART texturing. This is
- * currently disabled, but has been tested & works.
- */
- t->pp_txoffset = r200GartOffsetFromVirtual( rmesa, texImage->Data );
- t->pp_txpitch = texImage->RowStride * texFormat->TexelBytes - 32;
-
- if (R200_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Using GART texturing for rectangular client texture\n");
-
- /* Release FB memory allocated for this image:
- */
- /* FIXME This may not be correct as driSwapOutTextureObject sets
- * FIXME dirty_images. It may be fine, though.
- */
- if ( t->base.memBlock ) {
- driSwapOutTextureObject( (driTextureObject *) t );
- }
- }
- else if (texImage->IsClientData) {
- /* Data already in GART memory, with usable pitch.
- */
- GLuint srcPitch;
- srcPitch = texImage->RowStride * texFormat->TexelBytes;
- r200EmitBlit( rmesa,
- blit_format,
- srcPitch,
- r200GartOffsetFromVirtual( rmesa, texImage->Data ),
- dstPitch, t->bufAddr,
- 0, 0,
- 0, 0,
- width, height );
- }
- else {
- /* Data not in GART memory, or bad pitch.
- */
- for (done = 0; done < height ; ) {
- struct r200_dma_region region;
- int lines = MIN2( height - done, RADEON_BUFFER_SIZE / dstPitch );
- int src_pitch;
- char *tex;
-
- src_pitch = texImage->RowStride * texFormat->TexelBytes;
-
- tex = (char *)texImage->Data + done * src_pitch;
-
- memset(&region, 0, sizeof(region));
- r200AllocDmaRegion( rmesa, &region, lines * dstPitch, 1024 );
-
- /* Copy texdata to dma:
- */
- if (0)
- fprintf(stderr, "%s: src_pitch %d dst_pitch %d\n",
- __FUNCTION__, src_pitch, dstPitch);
-
- if (src_pitch == dstPitch) {
- memcpy( region.address + region.start, tex, lines * src_pitch );
- }
- else {
- char *buf = region.address + region.start;
- int i;
- for (i = 0 ; i < lines ; i++) {
- memcpy( buf, tex, src_pitch );
- buf += dstPitch;
- tex += src_pitch;
- }
- }
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- /* Blit to framebuffer
- */
- r200EmitBlit( rmesa,
- blit_format,
- dstPitch, GET_START( &region ),
- dstPitch | (t->tile_bits >> 16),
- t->bufAddr,
- 0, 0,
- 0, done,
- width, lines );
-
- r200EmitWait( rmesa, RADEON_WAIT_2D );
-
- r200ReleaseDmaRegion( rmesa, &region, __FUNCTION__ );
- done += lines;
- }
- }
-}
-
-
-/**
- * Upload the texture image associated with texture \a t at the specified
- * level at the address relative to \a start.
- */
-static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t,
- GLint hwlevel,
- GLint x, GLint y, GLint width, GLint height,
- GLuint face )
-{
- struct gl_texture_image *texImage = NULL;
- GLuint offset;
- GLint imageWidth, imageHeight;
- GLint ret;
- drm_radeon_texture_t tex;
- drm_radeon_tex_image_t tmp;
- const int level = hwlevel + t->base.firstLevel;
-
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n",
- __FUNCTION__, (void *)t, (void *)t->base.tObj,
- level, width, height, face );
- }
-
- ASSERT(face < 6);
-
- /* Ensure we have a valid texture to upload */
- if ( ( hwlevel < 0 ) || ( hwlevel >= RADEON_MAX_TEXTURE_LEVELS ) ) {
- _mesa_problem(NULL, "bad texture level in %s", __FUNCTION__);
- return;
- }
-
- texImage = t->base.tObj->Image[face][level];
-
- if ( !texImage ) {
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: texImage %d is NULL!\n", __FUNCTION__, level );
- return;
- }
- if ( !texImage->Data ) {
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is NULL!\n", __FUNCTION__ );
- return;
- }
-
-
- if (t->base.tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- assert(level == 0);
- assert(hwlevel == 0);
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is rectangular\n", __FUNCTION__);
- r200UploadRectSubImage( rmesa, t, texImage, x, y, width, height );
- return;
- }
- else if (texImage->IsClientData) {
- if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is in GART client storage\n",
- __FUNCTION__);
- r200UploadGARTClientSubImage( rmesa, t, texImage, hwlevel,
- x, y, width, height );
- return;
- }
- else if ( R200_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is in normal memory\n",
- __FUNCTION__);
-
-
- imageWidth = texImage->Width;
- imageHeight = texImage->Height;
-
- offset = t->bufAddr + t->base.totalSize / 6 * face;
-
- if ( R200_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- GLint imageX = 0;
- GLint imageY = 0;
- GLint blitX = t->image[face][hwlevel].x;
- GLint blitY = t->image[face][hwlevel].y;
- GLint blitWidth = t->image[face][hwlevel].width;
- GLint blitHeight = t->image[face][hwlevel].height;
- fprintf( stderr, " upload image: %d,%d at %d,%d\n",
- imageWidth, imageHeight, imageX, imageY );
- fprintf( stderr, " upload blit: %d,%d at %d,%d\n",
- blitWidth, blitHeight, blitX, blitY );
- fprintf( stderr, " blit ofs: 0x%07x level: %d/%d\n",
- (GLuint)offset, hwlevel, level );
- }
-
- t->image[face][hwlevel].data = texImage->Data;
-
- /* Init the DRM_RADEON_TEXTURE command / drm_radeon_texture_t struct.
- * NOTE: we're always use a 1KB-wide blit and I8 texture format.
- * We used to use 1, 2 and 4-byte texels and used to use the texture
- * width to dictate the blit width - but that won't work for compressed
- * textures. (Brian)
- * NOTE: can't do that with texture tiling. (sroland)
- */
- tex.offset = offset;
- tex.image = &tmp;
- /* copy (x,y,width,height,data) */
- memcpy( &tmp, &t->image[face][hwlevel], sizeof(tmp) );
-
- if (texImage->TexFormat->TexelBytes) {
- /* use multi-byte upload scheme */
- tex.height = imageHeight;
- tex.width = imageWidth;
- tex.format = t->pp_txformat & R200_TXFORMAT_FORMAT_MASK;
- tex.pitch = MAX2((texImage->Width * texImage->TexFormat->TexelBytes) / 64, 1);
- tex.offset += tmp.x & ~1023;
- tmp.x = tmp.x % 1024;
- if (t->tile_bits & R200_TXO_MICRO_TILE) {
- /* need something like "tiled coordinates" ? */
- tmp.y = tmp.x / (tex.pitch * 128) * 2;
- tmp.x = tmp.x % (tex.pitch * 128) / 2 / texImage->TexFormat->TexelBytes;
- tex.pitch |= RADEON_DST_TILE_MICRO >> 22;
- }
- else {
- tmp.x = tmp.x >> (texImage->TexFormat->TexelBytes >> 1);
- }
- if ((t->tile_bits & R200_TXO_MACRO_TILE) &&
- (texImage->Width * texImage->TexFormat->TexelBytes >= 256) &&
- ((!(t->tile_bits & R200_TXO_MICRO_TILE) && (texImage->Height >= 8)) ||
- (texImage->Height >= 16))) {
- /* weird: R200 disables macro tiling if mip width is smaller than 256 bytes,
- OR if height is smaller than 8 automatically, but if micro tiling is active
- the limit is height 16 instead ? */
- tex.pitch |= RADEON_DST_TILE_MACRO >> 22;
- }
- }
- else {
- /* In case of for instance 8x8 texture (2x2 dxt blocks), padding after the first two blocks is
- needed (only with dxt1 since 2 dxt3/dxt5 blocks already use 32 Byte). */
- /* set tex.height to 1/4 since 1 "macropixel" (dxt-block) has 4 real pixels. Needed
- so the kernel module reads the right amount of data. */
- tex.format = R200_TXFORMAT_I8; /* any 1-byte texel format */
- tex.pitch = (BLIT_WIDTH_BYTES / 64);
- tex.height = (imageHeight + 3) / 4;
- tex.width = (imageWidth + 3) / 4;
- switch (t->pp_txformat & R200_TXFORMAT_FORMAT_MASK) {
- case R200_TXFORMAT_DXT1:
- tex.width *= 8;
- break;
- case R200_TXFORMAT_DXT23:
- case R200_TXFORMAT_DXT45:
- tex.width *= 16;
- break;
- default:
- fprintf(stderr, "unknown compressed tex format in uploadSubImage\n");
- }
- }
-
- LOCK_HARDWARE( rmesa );
- do {
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_TEXTURE,
- &tex, sizeof(drm_radeon_texture_t) );
- if (ret) {
- if (R200_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "DRM_RADEON_TEXTURE: again!\n");
- usleep(1);
- }
- } while ( ret && errno == EAGAIN );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_TEXTURE: return = %d\n", ret );
- fprintf( stderr, " offset=0x%08x\n",
- offset );
- fprintf( stderr, " image width=%d height=%d\n",
- imageWidth, imageHeight );
- fprintf( stderr, " blit width=%d height=%d data=%p\n",
- t->image[face][hwlevel].width, t->image[face][hwlevel].height,
- t->image[face][hwlevel].data );
- exit( 1 );
- }
-}
-
-
-/**
- * Upload the texture images associated with texture \a t. This might
- * require the allocation of texture memory.
- *
- * \param rmesa Context pointer
- * \param t Texture to be uploaded
- * \param face Cube map face to be uploaded. Zero for non-cube maps.
- */
-
-int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face )
-{
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- if ( R200_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- fprintf( stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__,
- (void *)rmesa->glCtx, (void *)t->base.tObj, t->base.totalSize,
- t->base.firstLevel, t->base.lastLevel );
- }
-
- if ( !t || t->base.totalSize == 0 )
- return 0;
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__ );
- r200Finish( rmesa->glCtx );
- }
-
- LOCK_HARDWARE( rmesa );
-
- if ( t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( rmesa->texture_heaps, rmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( rmesa );
- return -1;
- }
-
- /* Set the base offset of the texture image */
- t->bufAddr = rmesa->r200Screen->texOffset[heap]
- + t->base.memBlock->ofs;
- t->pp_txoffset = t->bufAddr;
-
- if (!(t->base.tObj->Image[0][0]->IsClientData)) {
- /* hope it's safe to add that here... */
- t->pp_txoffset |= t->tile_bits;
- }
-
- /* Mark this texobj as dirty on all units:
- */
- t->dirty_state = TEX_ALL;
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
- UNLOCK_HARDWARE( rmesa );
-
- /* Upload any images that are new */
- if (t->base.dirty_images[face]) {
- int i;
- for ( i = 0 ; i < numLevels ; i++ ) {
- if ( (t->base.dirty_images[face] & (1 << (i+t->base.firstLevel))) != 0 ) {
- uploadSubImage( rmesa, t, i, 0, 0, t->image[face][i].width,
- t->image[face][i].height, face );
- }
- }
- t->base.dirty_images[face] = 0;
- }
-
-
- if (R200_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__ );
- r200Finish( rmesa->glCtx );
- }
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c
deleted file mode 100644
index 4a6b285a5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c
+++ /dev/null
@@ -1,1468 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texstate.c,v 1.3 2003/02/15 22:18:47 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-#include "enums.h"
-
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_swtcl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-
-
-#define R200_TXFORMAT_A8 R200_TXFORMAT_I8
-#define R200_TXFORMAT_L8 R200_TXFORMAT_I8
-#define R200_TXFORMAT_AL88 R200_TXFORMAT_AI88
-#define R200_TXFORMAT_YCBCR R200_TXFORMAT_YVYU422
-#define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422
-#define R200_TXFORMAT_RGB_DXT1 R200_TXFORMAT_DXT1
-#define R200_TXFORMAT_RGBA_DXT1 R200_TXFORMAT_DXT1
-#define R200_TXFORMAT_RGBA_DXT3 R200_TXFORMAT_DXT23
-#define R200_TXFORMAT_RGBA_DXT5 R200_TXFORMAT_DXT45
-
-#define _COLOR(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 }
-#define _COLOR_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f, 0 }
-#define _ALPHA(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _ALPHA_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _YUV(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB }
-#define _INVALID(f) \
- [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \
- && (tx_table[f].format != 0xffffffff) )
-
-static const struct {
- GLuint format, filter;
-}
-tx_table[] =
-{
- _ALPHA(RGBA8888),
- _ALPHA_REV(RGBA8888),
- _ALPHA(ARGB8888),
- _ALPHA_REV(ARGB8888),
- _INVALID(RGB888),
- _COLOR(RGB565),
- _COLOR_REV(RGB565),
- _ALPHA(ARGB4444),
- _ALPHA_REV(ARGB4444),
- _ALPHA(ARGB1555),
- _ALPHA_REV(ARGB1555),
- _ALPHA(AL88),
- _ALPHA_REV(AL88),
- _ALPHA(A8),
- _COLOR(L8),
- _ALPHA(I8),
- _INVALID(CI8),
- _YUV(YCBCR),
- _YUV(YCBCR_REV),
- _INVALID(RGB_FXT1),
- _INVALID(RGBA_FXT1),
- _COLOR(RGB_DXT1),
- _ALPHA(RGBA_DXT1),
- _ALPHA(RGBA_DXT3),
- _ALPHA(RGBA_DXT5),
-};
-
-#undef _COLOR
-#undef _ALPHA
-#undef _INVALID
-
-/**
- * This function computes the number of bytes of storage needed for
- * the given texture object (all mipmap levels, all cube faces).
- * The \c image[face][level].x/y/width/height parameters for upload/blitting
- * are computed here. \c pp_txfilter, \c pp_txformat, etc. will be set here
- * too.
- *
- * \param rmesa Context pointer
- * \param tObj GL texture object whose images are to be posted to
- * hardware state.
- */
-static void r200SetTexImages( r200ContextPtr rmesa,
- struct gl_texture_object *tObj )
-{
- r200TexObjPtr t = (r200TexObjPtr)tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint curOffset, blitWidth;
- GLint i, texelBytes;
- GLint numLevels;
- GLint log2Width, log2Height, log2Depth;
-
- /* Set the hardware texture format
- */
-
- t->pp_txformat &= ~(R200_TXFORMAT_FORMAT_MASK |
- R200_TXFORMAT_ALPHA_IN_MAP);
- t->pp_txfilter &= ~R200_YUV_TO_RGB;
-
- if ( VALID_FORMAT( baseImage->TexFormat->MesaFormat ) ) {
- t->pp_txformat |= tx_table[ baseImage->TexFormat->MesaFormat ].format;
- t->pp_txfilter |= tx_table[ baseImage->TexFormat->MesaFormat ].filter;
- }
- else {
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-
- texelBytes = baseImage->TexFormat->TexelBytes;
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2;
- log2Depth = tObj->Image[0][t->base.firstLevel]->DepthLog2;
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS);
-
- /* Calculate mipmap offsets and dimensions for blitting (uploading)
- * The idea is that we lay out the mipmap levels within a block of
- * memory organized as a rectangle of width BLIT_WIDTH_BYTES.
- */
- curOffset = 0;
- blitWidth = BLIT_WIDTH_BYTES;
- t->tile_bits = 0;
-
- /* figure out if this texture is suitable for tiling. */
- if (texelBytes) {
- if (rmesa->texmicrotile && (tObj->Target != GL_TEXTURE_RECTANGLE_NV) &&
- /* texrect might be able to use micro tiling too in theory? */
- (baseImage->Height > 1)) {
- /* allow 32 (bytes) x 1 mip (which will use two times the space
- the non-tiled version would use) max if base texture is large enough */
- if ((numLevels == 1) ||
- (((baseImage->Width * texelBytes / baseImage->Height) <= 32) &&
- (baseImage->Width * texelBytes > 64)) ||
- ((baseImage->Width * texelBytes / baseImage->Height) <= 16)) {
- t->tile_bits |= R200_TXO_MICRO_TILE;
- }
- }
- if (tObj->Target != GL_TEXTURE_RECTANGLE_NV) {
- /* we can set macro tiling even for small textures, they will be untiled anyway */
- t->tile_bits |= R200_TXO_MACRO_TILE;
- }
- }
-
- for (i = 0; i < numLevels; i++) {
- const struct gl_texture_image *texImage;
- GLuint size;
-
- texImage = tObj->Image[0][i + t->base.firstLevel];
- if ( !texImage )
- break;
-
- /* find image size in bytes */
- if (texImage->IsCompressed) {
- /* need to calculate the size AFTER padding even though the texture is
- submitted without padding.
- Only handle pot textures currently - don't know if npot is even possible,
- size calculation would certainly need (trivial) adjustments.
- Align (and later pad) to 32byte, not sure what that 64byte blit width is
- good for? */
- if ((t->pp_txformat & R200_TXFORMAT_FORMAT_MASK) == R200_TXFORMAT_DXT1) {
- /* RGB_DXT1/RGBA_DXT1, 8 bytes per block */
- if ((texImage->Width + 3) < 8) /* width one block */
- size = texImage->CompressedSize * 4;
- else if ((texImage->Width + 3) < 16)
- size = texImage->CompressedSize * 2;
- else size = texImage->CompressedSize;
- }
- else /* DXT3/5, 16 bytes per block */
- if ((texImage->Width + 3) < 8)
- size = texImage->CompressedSize * 2;
- else size = texImage->CompressedSize;
- }
- else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- size = ((texImage->Width * texelBytes + 63) & ~63) * texImage->Height;
- }
- else if (t->tile_bits & R200_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 */
- int w = (texImage->Width * texelBytes * 2 + 31) & ~31;
- size = (w * ((texImage->Height + 1) / 2)) * texImage->Depth;
- blitWidth = MAX2(texImage->Width, 64 / texelBytes);
- }
- else {
- int w = (texImage->Width * texelBytes + 31) & ~31;
- size = w * texImage->Height * texImage->Depth;
- blitWidth = MAX2(texImage->Width, 64 / texelBytes);
- }
- assert(size > 0);
-
- /* Align to 32-byte offset. It is faster to do this unconditionally
- * (no branch penalty).
- */
-
- curOffset = (curOffset + 0x1f) & ~0x1f;
-
- if (texelBytes) {
- t->image[0][i].x = curOffset; /* fix x and y coords up later together with offset */
- t->image[0][i].y = 0;
- t->image[0][i].width = MIN2(size / texelBytes, blitWidth);
- t->image[0][i].height = (size / texelBytes) / t->image[0][i].width;
- }
- else {
- t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES;
- t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES;
- t->image[0][i].width = MIN2(size, BLIT_WIDTH_BYTES);
- t->image[0][i].height = size / t->image[0][i].width;
- }
-
-#if 0
- /* for debugging only and only applicable to non-rectangle targets */
- assert(size % t->image[0][i].width == 0);
- assert(t->image[0][i].x == 0
- || (size < BLIT_WIDTH_BYTES && t->image[0][i].height == 1));
-#endif
-
- if (0)
- fprintf(stderr,
- "level %d: %dx%d x=%d y=%d w=%d h=%d size=%d at %d\n",
- i, texImage->Width, texImage->Height,
- t->image[0][i].x, t->image[0][i].y,
- t->image[0][i].width, t->image[0][i].height, size, curOffset);
-
- curOffset += size;
-
- }
-
- /* Align the total size of texture memory block.
- */
- t->base.totalSize = (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK;
-
- /* Setup remaining cube face blits, if needed */
- if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
- const GLuint faceSize = t->base.totalSize;
- GLuint face;
- /* reuse face 0 x/y/width/height - just update the offset when uploading */
- for (face = 1; face < 6; face++) {
- for (i = 0; i < numLevels; i++) {
- t->image[face][i].x = t->image[0][i].x;
- t->image[face][i].y = t->image[0][i].y;
- t->image[face][i].width = t->image[0][i].width;
- t->image[face][i].height = t->image[0][i].height;
- }
- }
- t->base.totalSize = 6 * faceSize; /* total texmem needed */
- }
-
-
- /* Hardware state:
- */
- t->pp_txfilter &= ~R200_MAX_MIP_LEVEL_MASK;
- t->pp_txfilter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
-
- t->pp_txformat &= ~(R200_TXFORMAT_WIDTH_MASK |
- R200_TXFORMAT_HEIGHT_MASK |
- R200_TXFORMAT_CUBIC_MAP_ENABLE |
- R200_TXFORMAT_F5_WIDTH_MASK |
- R200_TXFORMAT_F5_HEIGHT_MASK);
- t->pp_txformat |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
- (log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
-
- t->pp_txformat_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
- if (tObj->Target == GL_TEXTURE_3D) {
- t->pp_txformat_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT);
- t->pp_txformat_x |= R200_TEXCOORD_VOLUME;
- }
- else if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
- ASSERT(log2Width == log2Height);
- t->pp_txformat |= ((log2Width << R200_TXFORMAT_F5_WIDTH_SHIFT) |
- (log2Height << R200_TXFORMAT_F5_HEIGHT_SHIFT) |
- (R200_TXFORMAT_CUBIC_MAP_ENABLE));
- t->pp_txformat_x |= R200_TEXCOORD_CUBIC_ENV;
- t->pp_cubic_faces = ((log2Width << R200_FACE_WIDTH_1_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_1_SHIFT) |
- (log2Width << R200_FACE_WIDTH_2_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_2_SHIFT) |
- (log2Width << R200_FACE_WIDTH_3_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_3_SHIFT) |
- (log2Width << R200_FACE_WIDTH_4_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_4_SHIFT));
- }
- else {
- /* If we don't in fact send enough texture coordinates, q will be 1,
- * making TEXCOORD_PROJ act like TEXCOORD_NONPROJ (Right?)
- */
- t->pp_txformat_x |= R200_TEXCOORD_PROJ;
- }
-
- t->pp_txsize = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << 0) |
- ((tObj->Image[0][t->base.firstLevel]->Height - 1) << 16));
-
- /* Only need to round to nearest 32 for textures, but the blitter
- * requires 64-byte aligned pitches, and we may/may not need the
- * blitter. NPOT only!
- */
- if (baseImage->IsCompressed)
- t->pp_txpitch = (tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63);
- else
- t->pp_txpitch = ((tObj->Image[0][t->base.firstLevel]->Width * texelBytes) + 63) & ~(63);
- t->pp_txpitch -= 32;
-
- t->dirty_state = TEX_ALL;
-
- /* FYI: r200UploadTexImages( rmesa, t ) used to be called here */
-}
-
-
-
-/* ================================================================
- * Texture combine functions
- */
-
-/* GL_ARB_texture_env_combine support
- */
-
-/* The color tables have combine functions for GL_SRC_COLOR,
- * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint r200_register_color[][R200_MAX_TEXTURE_UNITS] =
-{
- {
- R200_TXC_ARG_A_R0_COLOR,
- R200_TXC_ARG_A_R1_COLOR,
- R200_TXC_ARG_A_R2_COLOR,
- R200_TXC_ARG_A_R3_COLOR,
- R200_TXC_ARG_A_R4_COLOR,
- R200_TXC_ARG_A_R5_COLOR
- },
- {
- R200_TXC_ARG_A_R0_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R1_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R2_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R3_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R4_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R5_COLOR | R200_TXC_COMP_ARG_A
- },
- {
- R200_TXC_ARG_A_R0_ALPHA,
- R200_TXC_ARG_A_R1_ALPHA,
- R200_TXC_ARG_A_R2_ALPHA,
- R200_TXC_ARG_A_R3_ALPHA,
- R200_TXC_ARG_A_R4_ALPHA,
- R200_TXC_ARG_A_R5_ALPHA
- },
- {
- R200_TXC_ARG_A_R0_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R1_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R2_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R3_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R4_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R5_ALPHA | R200_TXC_COMP_ARG_A
- },
-};
-
-static GLuint r200_tfactor_color[] =
-{
- R200_TXC_ARG_A_TFACTOR_COLOR,
- R200_TXC_ARG_A_TFACTOR_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_TFACTOR_ALPHA,
- R200_TXC_ARG_A_TFACTOR_ALPHA | R200_TXC_COMP_ARG_A
-};
-
-static GLuint r200_primary_color[] =
-{
- R200_TXC_ARG_A_DIFFUSE_COLOR,
- R200_TXC_ARG_A_DIFFUSE_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_DIFFUSE_ALPHA,
- R200_TXC_ARG_A_DIFFUSE_ALPHA | R200_TXC_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-3
- * GL_ONE table - indices 1-4
- */
-static GLuint r200_zero_color[] =
-{
- R200_TXC_ARG_A_ZERO,
- R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_ZERO,
- R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_ZERO
-};
-
-/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint r200_register_alpha[][R200_MAX_TEXTURE_UNITS] =
-{
- {
- R200_TXA_ARG_A_R0_ALPHA,
- R200_TXA_ARG_A_R1_ALPHA,
- R200_TXA_ARG_A_R2_ALPHA,
- R200_TXA_ARG_A_R3_ALPHA,
- R200_TXA_ARG_A_R4_ALPHA,
- R200_TXA_ARG_A_R5_ALPHA
- },
- {
- R200_TXA_ARG_A_R0_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R1_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R2_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R3_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R4_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R5_ALPHA | R200_TXA_COMP_ARG_A
- },
-};
-
-static GLuint r200_tfactor_alpha[] =
-{
- R200_TXA_ARG_A_TFACTOR_ALPHA,
- R200_TXA_ARG_A_TFACTOR_ALPHA | R200_TXA_COMP_ARG_A
-};
-
-static GLuint r200_primary_alpha[] =
-{
- R200_TXA_ARG_A_DIFFUSE_ALPHA,
- R200_TXA_ARG_A_DIFFUSE_ALPHA | R200_TXA_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-1
- * GL_ONE table - indices 1-2
- */
-static GLuint r200_zero_alpha[] =
-{
- R200_TXA_ARG_A_ZERO,
- R200_TXA_ARG_A_ZERO | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_ZERO,
-};
-
-
-/* Extract the arg from slot A, shift it into the correct argument slot
- * and set the corresponding complement bit.
- */
-#define R200_COLOR_ARG( n, arg ) \
-do { \
- color_combine |= \
- ((color_arg[n] & R200_TXC_ARG_A_MASK) \
- << R200_TXC_ARG_##arg##_SHIFT); \
- color_combine |= \
- ((color_arg[n] >> R200_TXC_COMP_ARG_A_SHIFT) \
- << R200_TXC_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-#define R200_ALPHA_ARG( n, arg ) \
-do { \
- alpha_combine |= \
- ((alpha_arg[n] & R200_TXA_ARG_A_MASK) \
- << R200_TXA_ARG_##arg##_SHIFT); \
- alpha_combine |= \
- ((alpha_arg[n] >> R200_TXA_COMP_ARG_A_SHIFT) \
- << R200_TXA_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-
-/* ================================================================
- * Texture unit state management
- */
-
-static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint color_combine, alpha_combine;
- GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] &
- ~(R200_TXC_SCALE_MASK);
- GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] &
- ~(R200_TXA_DOT_ALPHA | R200_TXA_SCALE_MASK);
-
- /* texUnit->_Current can be NULL if and only if the texture unit is
- * not actually enabled.
- */
- assert( (texUnit->_ReallyEnabled == 0)
- || (texUnit->_Current != NULL) );
-
- if ( R200_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, (void *)ctx, unit );
- }
-
- /* Set the texture environment state. Isn't this nice and clean?
- * The chip will automagically set the texture alpha to 0xff when
- * the texture format does not include an alpha component. This
- * reduces the amount of special-casing we have to do, alpha-only
- * textures being a notable exception.
- */
- /* Don't cache these results.
- */
- rmesa->state.texture.unit[unit].format = 0;
- rmesa->state.texture.unit[unit].envMode = 0;
-
- if ( !texUnit->_ReallyEnabled ) {
- if ( unit == 0 ) {
- color_combine = R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO
- | R200_TXC_ARG_C_DIFFUSE_COLOR | R200_TXC_OP_MADD;
- alpha_combine = R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO
- | R200_TXA_ARG_C_DIFFUSE_ALPHA | R200_TXA_OP_MADD;
- }
- else {
- color_combine = R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO
- | R200_TXC_ARG_C_R0_COLOR | R200_TXC_OP_MADD;
- alpha_combine = R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO
- | R200_TXA_ARG_C_R0_ALPHA | R200_TXA_OP_MADD;
- }
- }
- else {
- GLuint color_arg[3], alpha_arg[3];
- GLuint i;
- const GLuint numColorArgs = texUnit->_CurrentCombine->_NumArgsRGB;
- const GLuint numAlphaArgs = texUnit->_CurrentCombine->_NumArgsA;
- GLuint RGBshift = texUnit->_CurrentCombine->ScaleShiftRGB;
- GLuint Ashift = texUnit->_CurrentCombine->ScaleShiftA;
-
-
- /* Step 1:
- * Extract the color and alpha combine function arguments.
- */
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- const GLint op = texUnit->_CurrentCombine->OperandRGB[i] - GL_SRC_COLOR;
- assert(op >= 0);
- assert(op <= 3);
- switch ( texUnit->_CurrentCombine->SourceRGB[i] ) {
- case GL_TEXTURE:
- color_arg[i] = r200_register_color[op][unit];
- break;
- case GL_CONSTANT:
- color_arg[i] = r200_tfactor_color[op];
- break;
- case GL_PRIMARY_COLOR:
- color_arg[i] = r200_primary_color[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- color_arg[i] = r200_primary_color[op];
- else
- color_arg[i] = r200_register_color[op][0];
- break;
- case GL_ZERO:
- color_arg[i] = r200_zero_color[op];
- break;
- case GL_ONE:
- color_arg[i] = r200_zero_color[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- const GLint op = texUnit->_CurrentCombine->OperandA[i] - GL_SRC_ALPHA;
- assert(op >= 0);
- assert(op <= 1);
- switch ( texUnit->_CurrentCombine->SourceA[i] ) {
- case GL_TEXTURE:
- alpha_arg[i] = r200_register_alpha[op][unit];
- break;
- case GL_CONSTANT:
- alpha_arg[i] = r200_tfactor_alpha[op];
- break;
- case GL_PRIMARY_COLOR:
- alpha_arg[i] = r200_primary_alpha[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- alpha_arg[i] = r200_primary_alpha[op];
- else
- alpha_arg[i] = r200_register_alpha[op][0];
- break;
- case GL_ZERO:
- alpha_arg[i] = r200_zero_alpha[op];
- break;
- case GL_ONE:
- alpha_arg[i] = r200_zero_alpha[op+1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- /* Step 2:
- * Build up the color and alpha combine functions.
- */
- switch ( texUnit->_CurrentCombine->ModeRGB ) {
- case GL_REPLACE:
- color_combine = (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, C );
- break;
- case GL_MODULATE:
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, B );
- break;
- case GL_ADD:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_NEG_ARG_C |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- color_combine = (R200_TXC_OP_LERP);
- R200_COLOR_ARG( 0, B );
- R200_COLOR_ARG( 1, A );
- R200_COLOR_ARG( 2, C );
- break;
-
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- RGBshift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- /* DOT3 works differently on R200 than on R100. On R100, just
- * setting the DOT3 mode did everything for you. On R200, the
- * driver has to enable the biasing and scale in the inputs to
- * put them in the proper [-1,1] range. This is what the 4x and
- * the -0.5 in the DOT3 spec do. The post-scale is then set
- * normally.
- */
-
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_DOT3 |
- R200_TXC_BIAS_ARG_A |
- R200_TXC_BIAS_ARG_B |
- R200_TXC_SCALE_ARG_A |
- R200_TXC_SCALE_ARG_B);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, B );
- break;
-
- case GL_MODULATE_ADD_ATI:
- color_combine = (R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- color_combine = (R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- color_combine = (R200_TXC_NEG_ARG_C |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG( 0, A );
- R200_COLOR_ARG( 1, C );
- R200_COLOR_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->_CurrentCombine->ModeA ) {
- case GL_REPLACE:
- alpha_combine = (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, C );
- break;
- case GL_MODULATE:
- alpha_combine = (R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, B );
- break;
- case GL_ADD:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_NEG_ARG_C |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- alpha_combine = (R200_TXA_OP_LERP);
- R200_ALPHA_ARG( 0, B );
- R200_ALPHA_ARG( 1, A );
- R200_ALPHA_ARG( 2, C );
- break;
-
- case GL_MODULATE_ADD_ATI:
- alpha_combine = (R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- alpha_combine = (R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- alpha_combine = (R200_TXA_NEG_ARG_C |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG( 0, A );
- R200_ALPHA_ARG( 1, C );
- R200_ALPHA_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- if ( (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT)
- || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) ) {
- alpha_scale |= R200_TXA_DOT_ALPHA;
- Ashift = RGBshift;
- }
-
- /* Step 3:
- * Apply the scale factor.
- */
- color_scale |= (RGBshift << R200_TXC_SCALE_SHIFT);
- alpha_scale |= (Ashift << R200_TXA_SCALE_SHIFT);
-
- /* All done!
- */
- }
-
- if ( rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] != color_combine ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] != alpha_combine ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] != color_scale ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] != alpha_scale) {
- R200_STATECHANGE( rmesa, pix[unit] );
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] = color_combine;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] = alpha_combine;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] = color_scale;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] = alpha_scale;
- }
-
- return GL_TRUE;
-}
-
-#define TEXOBJ_TXFILTER_MASK (R200_MAX_MIP_LEVEL_MASK | \
- R200_MIN_FILTER_MASK | \
- R200_MAG_FILTER_MASK | \
- R200_MAX_ANISO_MASK | \
- R200_YUV_TO_RGB | \
- R200_YUV_TEMPERATURE_MASK | \
- R200_CLAMP_S_MASK | \
- R200_CLAMP_T_MASK | \
- R200_BORDER_MODE_D3D )
-
-#define TEXOBJ_TXFORMAT_MASK (R200_TXFORMAT_WIDTH_MASK | \
- R200_TXFORMAT_HEIGHT_MASK | \
- R200_TXFORMAT_FORMAT_MASK | \
- R200_TXFORMAT_F5_WIDTH_MASK | \
- R200_TXFORMAT_F5_HEIGHT_MASK | \
- R200_TXFORMAT_ALPHA_IN_MAP | \
- R200_TXFORMAT_CUBIC_MAP_ENABLE | \
- R200_TXFORMAT_NON_POWER2)
-
-#define TEXOBJ_TXFORMAT_X_MASK (R200_DEPTH_LOG2_MASK | \
- R200_TEXCOORD_MASK | \
- R200_CLAMP_Q_MASK | \
- R200_VOLUME_FILTER_MASK)
-
-
-static void import_tex_obj_state( r200ContextPtr rmesa,
- int unit,
- r200TexObjPtr texobj )
-{
- GLuint *cmd = R200_DB_STATE( tex[unit] );
-
- cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFILTER] |= texobj->pp_txfilter & TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT] |= texobj->pp_txformat & TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT_X] &= ~TEXOBJ_TXFORMAT_X_MASK;
- cmd[TEX_PP_TXFORMAT_X] |= texobj->pp_txformat_x & TEXOBJ_TXFORMAT_X_MASK;
- cmd[TEX_PP_TXSIZE] = texobj->pp_txsize; /* NPOT only! */
- cmd[TEX_PP_TXPITCH] = texobj->pp_txpitch; /* NPOT only! */
- cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset;
- cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color;
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.tex[unit] );
-
- if (texobj->base.tObj->Target == GL_TEXTURE_CUBE_MAP) {
- GLuint *cube_cmd = R200_DB_STATE( cube[unit] );
- GLuint bytesPerFace = texobj->base.totalSize / 6;
- ASSERT(texobj->base.totalSize % 6 == 0);
- cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F1] = texobj->pp_txoffset + 1 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F2] = texobj->pp_txoffset + 2 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F3] = texobj->pp_txoffset + 3 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F4] = texobj->pp_txoffset + 4 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F5] = texobj->pp_txoffset + 5 * bytesPerFace;
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.cube[unit] );
- }
-
- texobj->dirty_state &= ~(1<<unit);
-}
-
-
-static void set_texgen_matrix( r200ContextPtr rmesa,
- GLuint unit,
- const GLfloat *s_plane,
- const GLfloat *t_plane,
- const GLfloat *r_plane,
- const GLfloat *q_plane )
-{
- GLfloat m[16];
-
- m[0] = s_plane[0];
- m[4] = s_plane[1];
- m[8] = s_plane[2];
- m[12] = s_plane[3];
-
- m[1] = t_plane[0];
- m[5] = t_plane[1];
- m[9] = t_plane[2];
- m[13] = t_plane[3];
-
- m[2] = r_plane[0];
- m[6] = r_plane[1];
- m[10] = r_plane[2];
- m[14] = r_plane[3];
-
- m[3] = q_plane[0];
- m[7] = q_plane[1];
- m[11] = q_plane[2];
- m[15] = q_plane[3];
-
- _math_matrix_loadf( &(rmesa->TexGenMatrix[unit]), m);
- _math_matrix_analyse( &(rmesa->TexGenMatrix[unit]) );
- rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE<<unit;
-}
-
-
-/*
- * Returns GL_FALSE if fallback required.
- */
-static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit*4;
- GLuint tgi, tgcm;
- GLuint mode = 0;
- GLboolean mixed_fallback = GL_FALSE;
- static const GLfloat I[16] = {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1 };
- static const GLfloat reflect[16] = {
- -1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, -1, 0,
- 0, 0, 0, 1 };
-
- rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
- rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenNeedNormals[unit] = GL_FALSE;
- tgi = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1] & ~(R200_TEXGEN_INPUT_MASK <<
- inputshift);
- tgcm = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_2] & ~(R200_TEXGEN_COMP_MASK <<
- (unit * 4));
-
- if (0)
- fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
-
- if (texUnit->TexGenEnabled & S_BIT) {
- mode = texUnit->GenModeS;
- } else {
- tgcm |= R200_TEXGEN_COMP_S << (unit * 4);
- }
-
- if (texUnit->TexGenEnabled & T_BIT) {
- if (texUnit->GenModeT != mode)
- mixed_fallback = GL_TRUE;
- } else {
- tgcm |= R200_TEXGEN_COMP_T << (unit * 4);
- }
-
- if (texUnit->TexGenEnabled & R_BIT) {
- if (texUnit->GenModeR != mode)
- mixed_fallback = GL_TRUE;
- } else {
- tgcm |= R200_TEXGEN_COMP_R << (unit * 4);
- }
-
- if (texUnit->TexGenEnabled & Q_BIT) {
- if (texUnit->GenModeQ != mode)
- mixed_fallback = GL_TRUE;
- } else {
- tgcm |= R200_TEXGEN_COMP_Q << (unit * 4);
- }
-
- if (mixed_fallback) {
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "fallback mixed texgen, 0x%x (0x%x 0x%x 0x%x 0x%x)\n",
- texUnit->TexGenEnabled, texUnit->GenModeS, texUnit->GenModeT,
- texUnit->GenModeR, texUnit->GenModeQ);
- return GL_FALSE;
- }
-
- switch (mode) {
- case GL_OBJECT_LINEAR:
- tgi |= R200_TEXGEN_INPUT_OBJ << inputshift;
- set_texgen_matrix( rmesa, unit,
- (texUnit->TexGenEnabled & S_BIT) ? texUnit->ObjectPlaneS : I,
- (texUnit->TexGenEnabled & T_BIT) ? texUnit->ObjectPlaneT : I + 4,
- (texUnit->TexGenEnabled & R_BIT) ? texUnit->ObjectPlaneR : I + 8,
- (texUnit->TexGenEnabled & Q_BIT) ? texUnit->ObjectPlaneQ : I + 12);
- break;
-
- case GL_EYE_LINEAR:
- tgi |= R200_TEXGEN_INPUT_EYE << inputshift;
- set_texgen_matrix( rmesa, unit,
- (texUnit->TexGenEnabled & S_BIT) ? texUnit->EyePlaneS : I,
- (texUnit->TexGenEnabled & T_BIT) ? texUnit->EyePlaneT : I + 4,
- (texUnit->TexGenEnabled & R_BIT) ? texUnit->EyePlaneR : I + 8,
- (texUnit->TexGenEnabled & Q_BIT) ? texUnit->EyePlaneQ : I + 12);
- break;
-
- case GL_REFLECTION_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- tgi |= R200_TEXGEN_INPUT_EYE_REFLECT<<inputshift;
- set_texgen_matrix( rmesa, unit,
- (texUnit->TexGenEnabled & S_BIT) ? reflect : I,
- (texUnit->TexGenEnabled & T_BIT) ? reflect + 4 : I + 4,
- (texUnit->TexGenEnabled & R_BIT) ? reflect + 8 : I + 8,
- I + 12);
- break;
-
- case GL_NORMAL_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- tgi |= R200_TEXGEN_INPUT_EYE_NORMAL<<inputshift;
- break;
-
- case GL_SPHERE_MAP:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- tgi |= R200_TEXGEN_INPUT_SPHERE<<inputshift;
- break;
-
- case 0:
- /* All texgen units were disabled, so just pass coords through. */
- tgi |= unit << inputshift;
- break;
-
- default:
- /* Unsupported mode, fallback:
- */
- if (R200_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "fallback unsupported texgen, %d\n",
- texUnit->GenModeS);
- return GL_FALSE;
- }
-
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
- rmesa->TexGenCompSel |= R200_OUTPUT_TEX_0 << unit;
-
- if (tgi != rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1] ||
- tgcm != rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_2])
- {
- R200_STATECHANGE(rmesa, tcg);
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_1] = tgi;
- rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_2] = tgcm;
- }
-
- return GL_TRUE;
-}
-
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE<<unit)) {
- /* Texture unit disabled */
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &= ~(1UL << unit);
- rmesa->state.texture.unit[unit].texobj = NULL;
- }
-
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~((R200_TEX_0_ENABLE |
- R200_TEX_BLEND_0_ENABLE) << unit);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_BLEND_0_ENABLE;
-
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] &= ~(7 << (unit * 3));
-
- if (rmesa->TclFallback & (R200_TCL_FALLBACK_TEXGEN_0<<unit)) {
- TCL_FALLBACK( ctx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
- }
-
- /* Actually want to keep all units less than max active texture
- * enabled, right? Fix this for >2 texunits.
- */
- /* FIXME: What should happen here if r200UpdateTextureEnv fails? */
- if (unit == 0)
- r200UpdateTextureEnv( ctx, unit );
-
-
- {
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenNeedNormals[unit] = GL_FALSE;
- rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->recheck_texgen[unit] = GL_TRUE;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
- }
- }
-}
-
-static void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- GLuint re_cntl;
-
- re_cntl = rmesa->hw.set.cmd[SET_RE_CNTL] & ~(R200_VTX_STQ0_D3D << (2 * unit));
- if (use_d3d)
- re_cntl |= R200_VTX_STQ0_D3D << (2 * unit);
-
- if ( re_cntl != rmesa->hw.set.cmd[SET_RE_CNTL] ) {
- R200_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_RE_CNTL] = re_cntl;
- }
-}
-
-static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
-
- /* Need to load the 2d images associated with this unit.
- */
- if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D);
-
- if ( t->base.dirty_images[0] ) {
- R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj );
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- set_re_cntl_d3d( ctx, unit, GL_FALSE );
-
- return GL_TRUE;
-}
-
-#if ENABLE_HW_3D_TEXTURE
-static GLboolean enable_tex_3d( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
-
- /* Need to load the 3d images associated with this unit.
- */
- if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_3D);
-
- /* R100 & R200 do not support mipmaps for 3D textures.
- */
- if ( (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR) ) {
- return GL_FALSE;
- }
-
- if ( t->base.dirty_images[0] ) {
- R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj );
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- set_re_cntl_d3d( ctx, unit, GL_TRUE );
-
- return GL_TRUE;
-}
-#endif
-
-static GLboolean enable_tex_cube( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
- GLuint face;
-
- /* Need to load the 2d images associated with this unit.
- */
- if (t->pp_txformat & R200_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~R200_TXFORMAT_NON_POWER2;
- for (face = 0; face < 6; face++)
- t->base.dirty_images[face] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_CUBE_MAP);
-
- if ( t->base.dirty_images[0] || t->base.dirty_images[1] ||
- t->base.dirty_images[2] || t->base.dirty_images[3] ||
- t->base.dirty_images[4] || t->base.dirty_images[5] ) {
- /* flush */
- R200_FIREVERTICES( rmesa );
- /* layout memory space, once for all faces */
- r200SetTexImages( rmesa, tObj );
- }
-
- /* upload (per face) */
- for (face = 0; face < 6; face++) {
- if (t->base.dirty_images[face]) {
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, face );
- }
- }
-
- if ( !t->base.memBlock ) {
- /* texmem alloc failed, use s/w fallback */
- return GL_FALSE;
- }
-
- set_re_cntl_d3d( ctx, unit, GL_TRUE );
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
-
- if (!(t->pp_txformat & R200_TXFORMAT_NON_POWER2)) {
- t->pp_txformat |= R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV);
-
- if ( t->base.dirty_images[0] ) {
- R200_FIREVERTICES( rmesa );
- r200SetTexImages( rmesa, tObj );
- r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock && !rmesa->prefer_gart_client_texturing )
- return GL_FALSE;
- }
-
- set_re_cntl_d3d( ctx, unit, GL_FALSE );
-
- return GL_TRUE;
-}
-
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r200TexObjPtr t = (r200TexObjPtr) tObj->DriverData;
- GLenum format;
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 )
- return GL_FALSE;
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( rmesa->state.texture.unit[unit].texobj != t ) {
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1UL << unit);
- }
-
- rmesa->state.texture.unit[unit].texobj = t;
- t->base.bound |= (1UL << unit);
- t->dirty_state |= 1<<unit;
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked! */
- }
-
-
- /* Newly enabled?
- */
- if ( 1|| !(rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE<<unit))) {
- R200_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= (R200_TEX_0_ENABLE |
- R200_TEX_BLEND_0_ENABLE) << unit;
-
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] &= ~(7 << (unit * 3));
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] |= 4 << (unit * 3);
-
- rmesa->recheck_texgen[unit] = GL_TRUE;
- }
-
- if (t->dirty_state & (1<<unit)) {
- import_tex_obj_state( rmesa, unit, t );
- }
-
- if (rmesa->recheck_texgen[unit]) {
- GLboolean fallback = !r200_validate_texgen( ctx, unit );
- TCL_FALLBACK( ctx, (R200_TCL_FALLBACK_TEXGEN_0<<unit), fallback);
- rmesa->recheck_texgen[unit] = 0;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- format = tObj->Image[0][tObj->BaseLevel]->Format;
- if ( rmesa->state.texture.unit[unit].format != format ||
- rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode ) {
- rmesa->state.texture.unit[unit].format = format;
- rmesa->state.texture.unit[unit].envMode = texUnit->EnvMode;
- if ( ! r200UpdateTextureEnv( ctx, unit ) ) {
- return GL_FALSE;
- }
- }
-
- FALLBACK( rmesa, R200_FALLBACK_BORDER_MODE, t->border_fallback );
- return !t->border_fallback;
-}
-
-
-
-static GLboolean r200UpdateTextureUnit( GLcontext *ctx, int unit )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if ( texUnit->_ReallyEnabled & (TEXTURE_RECT_BIT) ) {
- return (enable_tex_rect( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ) {
- return (enable_tex_2d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
-#if ENABLE_HW_3D_TEXTURE
- else if ( texUnit->_ReallyEnabled & (TEXTURE_3D_BIT) ) {
- return (enable_tex_3d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
-#endif
- else if ( texUnit->_ReallyEnabled & (TEXTURE_CUBE_BIT) ) {
- return (enable_tex_cube( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-
-void r200UpdateTextureState( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLboolean ok;
- GLuint dbg;
-
- ok = (r200UpdateTextureUnit( ctx, 0 ) &&
- r200UpdateTextureUnit( ctx, 1 ) &&
- r200UpdateTextureUnit( ctx, 2 ) &&
- r200UpdateTextureUnit( ctx, 3 ) &&
- r200UpdateTextureUnit( ctx, 4 ) &&
- r200UpdateTextureUnit( ctx, 5 ));
-
- FALLBACK( rmesa, R200_FALLBACK_TEXTURE, !ok );
-
- if (rmesa->TclFallback)
- r200ChooseVertexState( ctx );
-
-
- if (rmesa->r200Screen->chipset & R200_CHIPSET_REAL_R200) {
-
- /*
- * T0 hang workaround -------------
- * not needed for r200 derivatives?
- */
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_ENABLE_MASK) == R200_TEX_0_ENABLE &&
- (rmesa->hw.tex[0].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK) > R200_MIN_FILTER_LINEAR) {
-
- R200_STATECHANGE(rmesa, ctx);
- R200_STATECHANGE(rmesa, tex[1]);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_1_ENABLE;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] |= 0x08000000;
- }
- else {
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_1_ENABLE) &&
- (rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] & 0x08000000)) {
- R200_STATECHANGE(rmesa, tex[1]);
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &= ~0x08000000;
- }
- }
-
- /* maybe needs to be done pairwise due to 2 parallel (physical) tex units ?
- looks like that's not the case, if 8500/9100 owners don't complain remove this...
- for ( i = 0; i < ctx->Const.MaxTextureUnits; i += 2) {
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & ((R200_TEX_0_ENABLE |
- R200_TEX_1_ENABLE ) << i)) == (R200_TEX_0_ENABLE << i)) &&
- ((rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK) >
- R200_MIN_FILTER_LINEAR)) {
- R200_STATECHANGE(rmesa, ctx);
- R200_STATECHANGE(rmesa, tex[i+1]);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= (R200_TEX_1_ENABLE << i);
- rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] |= 0x08000000;
- }
- else {
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_1_ENABLE << i)) &&
- (rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] & 0x08000000)) {
- R200_STATECHANGE(rmesa, tex[i+1]);
- rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] &= ~0x08000000;
- }
- }
- } */
-
- /*
- * Texture cache LRU hang workaround -------------
- * not needed for r200 derivatives?
- */
-
- /* While the cases below attempt to only enable the workaround in the
- * specific cases necessary, they were insufficient. See bugzilla #1519,
- * #729, #814. Tests with quake3 showed no impact on performance.
- */
- dbg = 0x6;
-
- /*
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE )) &&
- ((((rmesa->hw.tex[0].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)) ||
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_2_ENABLE) &&
- ((((rmesa->hw.tex[2].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)) ||
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_4_ENABLE) &&
- ((((rmesa->hw.tex[4].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)))
- {
- dbg |= 0x02;
- }
-
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_1_ENABLE )) &&
- ((((rmesa->hw.tex[1].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)) ||
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_3_ENABLE) &&
- ((((rmesa->hw.tex[3].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)) ||
- ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_5_ENABLE) &&
- ((((rmesa->hw.tex[5].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0)))
- {
- dbg |= 0x04;
- }*/
-
- if (dbg != rmesa->hw.tam.cmd[TAM_DEBUG3]) {
- R200_STATECHANGE( rmesa, tam );
- rmesa->hw.tam.cmd[TAM_DEBUG3] = dbg;
- if (0) printf("TEXCACHE LRU HANG WORKAROUND %x\n", dbg);
- }
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.c
deleted file mode 100644
index 08173fda2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.c
+++ /dev/null
@@ -1,1227 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c,v 1.4 2003/05/06 23:52:08 daenzer Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "r200_context.h"
-#include "r200_state.h"
-#include "r200_ioctl.h"
-#include "r200_tex.h"
-#include "r200_tcl.h"
-#include "r200_swtcl.h"
-#include "r200_vtxfmt.h"
-
-#include "api_noop.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "glapi.h"
-#include "colormac.h"
-#include "light.h"
-#include "state.h"
-#include "vtxfmt.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_array_api.h"
-
-#include "dispatch.h"
-
-static void r200VtxFmtFlushVertices( GLcontext *, GLuint );
-
-static void count_func( const char *name, struct dynfn *l )
-{
- int i = 0;
- struct dynfn *f;
- foreach (f, l) i++;
- if (i) fprintf(stderr, "%s: %d\n", name, i );
-}
-
-static void count_funcs( r200ContextPtr rmesa )
-{
- count_func( "Vertex2f", &rmesa->vb.dfn_cache.Vertex2f );
- count_func( "Vertex2fv", &rmesa->vb.dfn_cache.Vertex2fv );
- count_func( "Vertex3f", &rmesa->vb.dfn_cache.Vertex3f );
- count_func( "Vertex3fv", &rmesa->vb.dfn_cache.Vertex3fv );
- count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub );
- count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv );
- count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub );
- count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv );
- count_func( "Color4f", &rmesa->vb.dfn_cache.Color4f );
- count_func( "Color4fv", &rmesa->vb.dfn_cache.Color4fv );
- count_func( "Color3f", &rmesa->vb.dfn_cache.Color3f );
- count_func( "Color3fv", &rmesa->vb.dfn_cache.Color3fv );
- count_func( "SecondaryColor3f", &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- count_func( "SecondaryColor3fv", &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- count_func( "SecondaryColor3ub", &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- count_func( "SecondaryColor3ubv", &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- count_func( "Normal3f", &rmesa->vb.dfn_cache.Normal3f );
- count_func( "Normal3fv", &rmesa->vb.dfn_cache.Normal3fv );
- count_func( "TexCoord3f", &rmesa->vb.dfn_cache.TexCoord3f );
- count_func( "TexCoord3fv", &rmesa->vb.dfn_cache.TexCoord3fv );
- count_func( "TexCoord2f", &rmesa->vb.dfn_cache.TexCoord2f );
- count_func( "TexCoord2fv", &rmesa->vb.dfn_cache.TexCoord2fv );
- count_func( "TexCoord1f", &rmesa->vb.dfn_cache.TexCoord1f );
- count_func( "TexCoord1fv", &rmesa->vb.dfn_cache.TexCoord1fv );
- count_func( "MultiTexCoord3fARB", &rmesa->vb.dfn_cache.MultiTexCoord3fARB );
- count_func( "MultiTexCoord3fvARB", &rmesa->vb.dfn_cache.MultiTexCoord3fvARB );
- count_func( "MultiTexCoord2fARB", &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- count_func( "MultiTexCoord2fvARB", &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- count_func( "MultiTexCoord1fARB", &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- count_func( "MultiTexCoord1fvARB", &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-/* count_func( "FogCoordfEXT", &rmesa->vb.dfn_cache.FogCoordfEXT );
- count_func( "FogCoordfvEXT", &rmesa->vb.dfn_cache.FogCoordfvEXT );*/
-}
-
-
-void r200_copy_to_current( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- unsigned i;
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT);
-
- if (rmesa->vb.vtxfmt_0 & R200_VTX_N0) {
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0] = rmesa->vb.normalptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1] = rmesa->vb.normalptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2] = rmesa->vb.normalptr[2];
- }
-
- if (rmesa->vb.vtxfmt_0 & R200_VTX_DISCRETE_FOG) {
- ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = rmesa->vb.fogptr[0];
- }
-
- switch( VTX_COLOR(rmesa->vb.vtxfmt_0, 0) ) {
- case R200_VTX_PK_RGBA:
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->blue );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->alpha );
- break;
-
- case R200_VTX_FP_RGB:
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = rmesa->vb.floatcolorptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = rmesa->vb.floatcolorptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = rmesa->vb.floatcolorptr[2];
- break;
-
- case R200_VTX_FP_RGBA:
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = rmesa->vb.floatcolorptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = rmesa->vb.floatcolorptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = rmesa->vb.floatcolorptr[2];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = rmesa->vb.floatcolorptr[3];
- break;
-
- default:
- break;
- }
-
- if (VTX_COLOR(rmesa->vb.vtxfmt_0, 1) == R200_VTX_PK_RGBA) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] = UBYTE_TO_FLOAT( rmesa->vb.specptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] = UBYTE_TO_FLOAT( rmesa->vb.specptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] = UBYTE_TO_FLOAT( rmesa->vb.specptr->blue );
- }
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- const unsigned count = VTX_TEXn_COUNT( rmesa->vb.vtxfmt_1, i );
- GLfloat * const src = rmesa->vb.texcoordptr[i];
-
- if ( count != 0 ) {
- switch( count ) {
- case 3:
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][1] = src[1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][2] = src[2];
- break;
- case 2:
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][1] = src[1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][2] = 0.0F;
- break;
- case 1:
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][1] = 0.0F;
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][2] = 0.0F;
- break;
- }
-
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][0] = src[0];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0+i][3] = 1.0F;
- }
- }
-
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
-}
-
-static GLboolean discreet_gl_prim[GL_POLYGON+1] = {
- 1, /* 0 points */
- 1, /* 1 lines */
- 0, /* 2 line_strip */
- 0, /* 3 line_loop */
- 1, /* 4 tris */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_strip */
- 1, /* 7 quads */
- 0, /* 8 quadstrip */
- 0, /* 9 poly */
-};
-
-static void flush_prims( r200ContextPtr rmesa )
-{
- int i,j;
- struct r200_dma_region tmp = rmesa->dma.current;
-
- tmp.buf->refcount++;
- tmp.aos_size = rmesa->vb.vertex_size;
- tmp.aos_stride = rmesa->vb.vertex_size;
- tmp.aos_start = GET_START(&tmp);
-
- rmesa->dma.current.ptr = rmesa->dma.current.start +=
- (rmesa->vb.initial_counter - rmesa->vb.counter) *
- rmesa->vb.vertex_size * 4;
-
- rmesa->tcl.vertex_format = rmesa->vb.vtxfmt_0;
- rmesa->tcl.aos_components[0] = &tmp;
- rmesa->tcl.nr_aos_components = 1;
- rmesa->dma.flush = NULL;
-
- /* Optimize the primitive list:
- */
- if (rmesa->vb.nrprims > 1) {
- for (j = 0, i = 1 ; i < rmesa->vb.nrprims; i++) {
- int pj = rmesa->vb.primlist[j].prim & 0xf;
- int pi = rmesa->vb.primlist[i].prim & 0xf;
-
- if (pj == pi && discreet_gl_prim[pj] &&
- rmesa->vb.primlist[i].start == rmesa->vb.primlist[j].end) {
- rmesa->vb.primlist[j].end = rmesa->vb.primlist[i].end;
- }
- else {
- j++;
- if (j != i) rmesa->vb.primlist[j] = rmesa->vb.primlist[i];
- }
- }
- rmesa->vb.nrprims = j+1;
- }
-
- if (rmesa->vb.vtxfmt_0 != rmesa->hw.vtx.cmd[VTX_VTXFMT_0] ||
- rmesa->vb.vtxfmt_1 != rmesa->hw.vtx.cmd[VTX_VTXFMT_1]) {
- R200_STATECHANGE( rmesa, vtx );
- rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = rmesa->vb.vtxfmt_0;
- rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = rmesa->vb.vtxfmt_1;
- }
-
-
- for (i = 0 ; i < rmesa->vb.nrprims; i++) {
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "vtxfmt prim %d: %s %d..%d\n", i,
- _mesa_lookup_enum_by_nr( rmesa->vb.primlist[i].prim &
- PRIM_MODE_MASK ),
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end);
-
- if (rmesa->vb.primlist[i].start < rmesa->vb.primlist[i].end)
- r200EmitPrimitive( rmesa->glCtx,
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end,
- rmesa->vb.primlist[i].prim );
- }
-
- rmesa->vb.nrprims = 0;
- r200ReleaseDmaRegion( rmesa, &tmp, __FUNCTION__ );
-}
-
-
-static void start_prim( r200ContextPtr rmesa, GLuint mode )
-{
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__,
- rmesa->vb.initial_counter - rmesa->vb.counter);
-
- rmesa->vb.primlist[rmesa->vb.nrprims].start =
- rmesa->vb.initial_counter - rmesa->vb.counter;
- rmesa->vb.primlist[rmesa->vb.nrprims].prim = mode;
-}
-
-static void note_last_prim( r200ContextPtr rmesa, GLuint flags )
-{
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__,
- rmesa->vb.initial_counter - rmesa->vb.counter);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- rmesa->vb.primlist[rmesa->vb.nrprims].prim |= flags;
- rmesa->vb.primlist[rmesa->vb.nrprims].end =
- rmesa->vb.initial_counter - rmesa->vb.counter;
-
- if (++(rmesa->vb.nrprims) == R200_MAX_PRIMS)
- flush_prims( rmesa );
- }
-}
-
-
-static void copy_vertex( r200ContextPtr rmesa, GLuint n, GLfloat *dst )
-{
- GLuint i;
- GLfloat *src = (GLfloat *)(rmesa->dma.current.address +
- rmesa->dma.current.ptr +
- (rmesa->vb.primlist[rmesa->vb.nrprims].start + n) *
- rmesa->vb.vertex_size * 4);
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "copy_vertex %d\n", rmesa->vb.primlist[rmesa->vb.nrprims].start + n);
-
- for (i = 0 ; i < rmesa->vb.vertex_size; i++) {
- dst[i] = src[i];
- }
-}
-
-/* NOTE: This actually reads the copied vertices back from uncached
- * memory. Could also use the counter/notify mechanism to populate
- * tmp on the fly as vertices are generated.
- */
-static GLuint copy_dma_verts( r200ContextPtr rmesa, GLfloat (*tmp)[R200_MAX_VERTEX_SIZE] )
-{
- GLuint ovf, i;
- GLuint nr = (rmesa->vb.initial_counter - rmesa->vb.counter) -
- rmesa->vb.primlist[rmesa->vb.nrprims].start;
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d verts\n", __FUNCTION__, nr);
-
- switch( rmesa->vb.prim[0] )
- {
- case GL_POINTS:
- return 0;
- case GL_LINES:
- ovf = nr&1;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_TRIANGLES:
- ovf = nr%3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUADS:
- ovf = nr&3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_LINE_STRIP:
- if (nr == 0)
- return 0;
- copy_vertex( rmesa, nr-1, tmp[0] );
- return 1;
- case GL_LINE_LOOP:
- case GL_TRIANGLE_FAN:
- case GL_POLYGON:
- if (nr == 0)
- return 0;
- else if (nr == 1) {
- copy_vertex( rmesa, 0, tmp[0] );
- return 1;
- } else {
- copy_vertex( rmesa, 0, tmp[0] );
- copy_vertex( rmesa, nr-1, tmp[1] );
- return 2;
- }
- case GL_TRIANGLE_STRIP:
- ovf = MIN2( nr, 2 );
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUAD_STRIP:
- switch (nr) {
- case 0: ovf = 0; break;
- case 1: ovf = 1; break;
- default: ovf = 2 + (nr&1); break;
- }
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- default:
- assert(0);
- return 0;
- }
-}
-
-static void VFMT_FALLBACK_OUTSIDE_BEGIN_END( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (ctx->Driver.NeedFlush)
- r200VtxFmtFlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (ctx->NewState)
- _mesa_update_state( ctx ); /* clear state so fell_back sticks */
-
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = r200FlushVertices;
-
- assert( rmesa->dma.flush == 0 );
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
-}
-
-
-/**
- * \todo
- * An interesting optimization of this function would be to have 3 element
- * table with the dispatch offsets of the TexCoord?fv functions, use count
- * to look-up the table, and a specialized version of GL_CALL that used the
- * offset number instead of the name.
- */
-static void dispatch_multitexcoord( GLuint count, GLuint unit, GLfloat * f )
-{
- switch( count ) {
- case 3:
- CALL_MultiTexCoord3fvARB(GET_DISPATCH(), (GL_TEXTURE0+unit, f));
- break;
- case 2:
- CALL_MultiTexCoord2fvARB(GET_DISPATCH(), (GL_TEXTURE0+unit, f));
- break;
- case 1:
- CALL_MultiTexCoord1fvARB(GET_DISPATCH(), (GL_TEXTURE0+unit, f));
- break;
- default:
- assert( count == 0 );
- break;
- }
-}
-
-void VFMT_FALLBACK( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat tmp[3][R200_MAX_VERTEX_SIZE];
- GLuint i, prim;
- GLuint ind0 = rmesa->vb.vtxfmt_0;
- GLuint ind1 = rmesa->vb.vtxfmt_1;
- GLuint nrverts;
- GLfloat alpha = 1.0;
- GLuint count;
- GLuint unit;
-
- if (R200_DEBUG & (DEBUG_FALLBACKS|DEBUG_VFMT))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
- return;
- }
-
- /* Copy vertices out of dma:
- */
- nrverts = copy_dma_verts( rmesa, tmp );
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- flush_prims( rmesa );
-
- /* Update ctx->Driver.CurrentExecPrimitive and swap in swtnl.
- */
- prim = rmesa->vb.prim[0];
- ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = r200FlushVertices;
-
- assert(rmesa->dma.flush == 0);
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
- CALL_Begin(GET_DISPATCH(), (prim));
-
- if (rmesa->vb.installed_color_3f_sz == 4)
- alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
-
- /* Replay saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- GLuint offset = 3;
-
- if (ind0 & R200_VTX_N0) {
- CALL_Normal3fv(GET_DISPATCH(), (&tmp[i][offset]));
- offset += 3;
- }
-
- if (ind0 & R200_VTX_DISCRETE_FOG) {
- CALL_FogCoordfvEXT(GET_DISPATCH(), (&tmp[i][offset]));
- offset++;
- }
-
- if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) {
- CALL_Color4ubv(GET_DISPATCH(), ((GLubyte *)&tmp[i][offset]));
- offset++;
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) {
- CALL_Color4fv(GET_DISPATCH(), (&tmp[i][offset]));
- offset+=4;
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
- CALL_Color3fv(GET_DISPATCH(), (&tmp[i][offset]));
- offset+=3;
- }
-
- if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) {
- CALL_SecondaryColor3ubvEXT(GET_DISPATCH(), ((GLubyte *)&tmp[i][offset]));
- offset++;
- }
-
- for ( unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++ ) {
- count = VTX_TEXn_COUNT( ind1, unit );
- dispatch_multitexcoord( count, unit, &tmp[i][offset] );
- offset += count;
- }
-
- CALL_Vertex3fv(GET_DISPATCH(), (&tmp[i][0]));
- }
-
- /* Replay current vertex
- */
- if (ind0 & R200_VTX_N0)
- CALL_Normal3fv(GET_DISPATCH(), (rmesa->vb.normalptr));
- if (ind0 & R200_VTX_DISCRETE_FOG) {
- CALL_FogCoordfvEXT(GET_DISPATCH(), (rmesa->vb.fogptr));
- }
-
- if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) {
- CALL_Color4ub(GET_DISPATCH(), (rmesa->vb.colorptr->red,
- rmesa->vb.colorptr->green,
- rmesa->vb.colorptr->blue,
- rmesa->vb.colorptr->alpha));
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) {
- CALL_Color4fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr));
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
- if (rmesa->vb.installed_color_3f_sz == 4 && alpha != 1.0) {
- CALL_Color4f(GET_DISPATCH(), (rmesa->vb.floatcolorptr[0],
- rmesa->vb.floatcolorptr[1],
- rmesa->vb.floatcolorptr[2],
- alpha));
- }
- else {
- CALL_Color3fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr));
- }
- }
-
- if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA)
- CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (rmesa->vb.specptr->red,
- rmesa->vb.specptr->green,
- rmesa->vb.specptr->blue));
-
- for ( unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++ ) {
- count = VTX_TEXn_COUNT( ind1, unit );
- dispatch_multitexcoord( count, unit, rmesa->vb.texcoordptr[unit] );
- }
-}
-
-
-
-static void wrap_buffer( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat tmp[3][R200_MAX_VERTEX_SIZE];
- GLuint i, nrverts;
-
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_PRIMS))
- fprintf(stderr, "%s %d\n", __FUNCTION__,
- rmesa->vb.initial_counter - rmesa->vb.counter);
-
- /* Don't deal with parity.
- */
- if ((((rmesa->vb.initial_counter - rmesa->vb.counter) -
- rmesa->vb.primlist[rmesa->vb.nrprims].start) & 1)) {
- rmesa->vb.counter++;
- rmesa->vb.initial_counter++;
- return;
- }
-
- /* Copy vertices out of dma:
- */
- if (rmesa->vb.prim[0] == GL_POLYGON+1)
- nrverts = 0;
- else {
- nrverts = copy_dma_verts( rmesa, tmp );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%d vertices to copy\n", nrverts);
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- }
-
- /* Fire any buffered primitives
- */
- flush_prims( rmesa );
-
- /* Get new buffer
- */
- r200RefillCurrentDmaRegion( rmesa );
-
- /* Reset counter, dmaptr
- */
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.ptr + rmesa->dma.current.address);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
-
- rmesa->dma.flush = flush_prims;
-
- /* Restart wrapped primitive:
- */
- if (rmesa->vb.prim[0] != GL_POLYGON+1)
- start_prim( rmesa, rmesa->vb.prim[0] );
-
-
- /* Reemit saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- if (R200_DEBUG & DEBUG_VERTS) {
- int j;
- fprintf(stderr, "re-emit vertex %d to %p\n", i,
- (void *)rmesa->vb.dmaptr);
- if (R200_DEBUG & DEBUG_VERBOSE)
- for (j = 0 ; j < rmesa->vb.vertex_size; j++)
- fprintf(stderr, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]);
- }
-
- memcpy( rmesa->vb.dmaptr, tmp[i], rmesa->vb.vertex_size * 4 );
- rmesa->vb.dmaptr += rmesa->vb.vertex_size;
- rmesa->vb.counter--;
- }
-}
-
-
-/**
- * Determines the hardware vertex format based on the current state vector.
- *
- * \returns
- * If the hardware TCL unit is capable of handling the current state vector,
- * \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
- *
- * \todo
- * Make this color format selection data driven. If we receive only ubytes,
- * send color as ubytes. Also check if converting (with free checking for
- * overflow) is cheaper than sending floats directly.
- *
- * \todo
- * When intializing texture coordinates, it might be faster to just copy the
- * entire \c VERT_ATTRIB_TEX0 vector into the vertex buffer. It may mean that
- * some of the data (i.e., the last texture coordinate components) get copied
- * over, but that still may be faster than the conditional branching. If
- * nothing else, the code will be smaller and easier to follow.
- */
-static GLboolean check_vtx_fmt( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint ind0 = R200_VTX_Z0;
- GLuint ind1 = 0;
- GLuint i;
- GLuint count[R200_MAX_TEXTURE_UNITS];
-
- if (rmesa->TclFallback || rmesa->vb.fell_back || ctx->CompileFlag)
- return GL_FALSE;
-
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)
- ctx->Driver.FlushVertices( ctx, FLUSH_UPDATE_CURRENT );
-
- /* Make all this event-driven:
- */
- if (ctx->Light.Enabled) {
- ind0 |= R200_VTX_N0;
-
- if (ctx->Light.ColorMaterialEnabled)
- ind0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
- else
- ind0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
- }
- else {
- /* TODO: make this data driven?
- */
- ind0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- ind0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT;
- }
- }
-
- if ( ctx->Fog.FogCoordinateSource == GL_FOG_COORD ) {
- ind0 |= R200_VTX_DISCRETE_FOG;
- }
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- count[i] = 0;
-
- if (ctx->Texture.Unit[i]._ReallyEnabled) {
- if (rmesa->TexGenNeedNormals[i]) {
- ind0 |= R200_VTX_N0;
- }
- else {
- switch( ctx->Texture.Unit[i]._ReallyEnabled ) {
- case TEXTURE_CUBE_BIT:
- case TEXTURE_3D_BIT:
- count[i] = 3;
- break;
- case TEXTURE_2D_BIT:
- case TEXTURE_RECT_BIT:
- count[i] = 2;
- break;
- case TEXTURE_1D_BIT:
- count[i] = 1;
- break;
- }
-
- ind1 |= count[i] << (3 * i);
- }
- }
- }
-
- if (R200_DEBUG & (DEBUG_VFMT|DEBUG_STATE))
- fprintf(stderr, "%s: format: 0x%x, 0x%x\n", __FUNCTION__, ind0, ind1 );
-
- R200_NEWPRIM(rmesa);
- rmesa->vb.vtxfmt_0 = ind0;
- rmesa->vb.vtxfmt_1 = ind1;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
-
- rmesa->vb.vertex_size = 3;
- rmesa->vb.normalptr = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
- rmesa->vb.colorptr = NULL;
- rmesa->vb.floatcolorptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- rmesa->vb.fogptr = ctx->Current.Attrib[VERT_ATTRIB_FOG];
- rmesa->vb.specptr = NULL;
- rmesa->vb.floatspecptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
- rmesa->vb.texcoordptr[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- rmesa->vb.texcoordptr[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1];
- rmesa->vb.texcoordptr[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX2];
- rmesa->vb.texcoordptr[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX3];
- rmesa->vb.texcoordptr[4] = ctx->Current.Attrib[VERT_ATTRIB_TEX4];
- rmesa->vb.texcoordptr[5] = ctx->Current.Attrib[VERT_ATTRIB_TEX5];
- rmesa->vb.texcoordptr[6] = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; /* dummy */
- rmesa->vb.texcoordptr[7] = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; /* dummy */
-
- /* Run through and initialize the vertex components in the order
- * the hardware understands:
- */
- if (ind0 & R200_VTX_N0) {
- rmesa->vb.normalptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.normalptr[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
- rmesa->vb.normalptr[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
- rmesa->vb.normalptr[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
- }
-
- if (ind0 & R200_VTX_DISCRETE_FOG) {
- rmesa->vb.fogptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 1;
- rmesa->vb.fogptr[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
- }
-
- if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) {
- rmesa->vb.colorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->alpha, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] );
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) {
- rmesa->vb.floatcolorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 4;
- rmesa->vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
- rmesa->vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
- rmesa->vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
- rmesa->vb.floatcolorptr[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
- }
- else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
- rmesa->vb.floatcolorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
- rmesa->vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
- rmesa->vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
- }
-
- if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) {
- rmesa->vb.specptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] );
- }
-
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- if ( count[i] != 0 ) {
- float * const attr = ctx->Current.Attrib[VERT_ATTRIB_TEX0+i];
- unsigned j;
-
- rmesa->vb.texcoordptr[i] = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
-
- for ( j = 0 ; j < count[i] ; j++ ) {
- rmesa->vb.texcoordptr[i][j] = attr[j];
- }
-
- rmesa->vb.vertex_size += count[i];
- }
- }
-
- if (rmesa->vb.installed_vertex_format != rmesa->vb.vtxfmt_0) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on vertex_format change\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- rmesa->vb.installed_vertex_format = rmesa->vb.vtxfmt_0;
- }
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- success\n", __FUNCTION__);
-
- return GL_TRUE;
-}
-
-
-void r200VtxfmtInvalidate( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- rmesa->vb.recheck = GL_TRUE;
- rmesa->vb.fell_back = GL_FALSE;
-}
-
-
-static void r200VtxfmtValidate( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- rmesa->vb.recheck = GL_FALSE;
-
- if (check_vtx_fmt( ctx )) {
- if (!rmesa->vb.installed) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall (new install)\n");
-
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.FlushVertices = r200VtxFmtFlushVertices;
- rmesa->vb.installed = GL_TRUE;
- }
- else if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: already installed", __FUNCTION__);
- }
- else {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- if (rmesa->vb.installed) {
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = r200FlushVertices;
- rmesa->vb.installed = GL_FALSE;
- }
- }
-}
-
-
-
-/* Materials:
- */
-static void r200_Materialfv( GLenum face, GLenum pname,
- const GLfloat *params )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- VFMT_FALLBACK( __FUNCTION__ );
- CALL_Materialfv(GET_DISPATCH(), (face, pname, params));
- return;
- }
- _mesa_noop_Materialfv( face, pname, params );
- r200UpdateMaterial( ctx );
-}
-
-
-/* Begin/End
- */
-static void r200_Begin( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- if (mode > GL_POLYGON) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" );
- return;
- }
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" );
- return;
- }
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- if (rmesa->vb.recheck)
- r200VtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- CALL_Begin(GET_DISPATCH(), (mode));
- return;
- }
-
-
- if (rmesa->dma.flush && rmesa->vb.counter < 12) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: flush almost-empty buffers\n", __FUNCTION__);
- flush_prims( rmesa );
- }
-
- /* Need to arrange to save vertices here? Or always copy from dma (yuk)?
- */
- if (!rmesa->dma.flush) {
- if (rmesa->dma.current.ptr + 12*rmesa->vb.vertex_size*4 >
- rmesa->dma.current.end) {
- R200_NEWPRIM( rmesa );
- r200RefillCurrentDmaRegion( rmesa );
- }
-
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
- rmesa->dma.flush = flush_prims;
- ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- }
-
-
- rmesa->vb.prim[0] = mode;
- start_prim( rmesa, mode | PRIM_BEGIN );
-}
-
-
-
-static void r200_End( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
- return;
- }
-
- note_last_prim( rmesa, PRIM_END );
- rmesa->vb.prim[0] = GL_POLYGON+1;
-}
-
-
-/* Fallback on difficult entrypoints:
- */
-#define PRE_LOOPBACK( FUNC ) \
-do { \
- if (R200_DEBUG & DEBUG_VFMT) \
- fprintf(stderr, "%s\n", __FUNCTION__); \
- VFMT_FALLBACK( __FUNCTION__ ); \
-} while (0)
-#define TAG(x) r200_fallback_##x
-#include "vtxfmt_tmp.h"
-
-
-
-static GLboolean r200NotifyBegin( GLcontext *ctx, GLenum p )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(!rmesa->vb.installed);
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- r200ValidateState( ctx );
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (rmesa->vb.recheck)
- r200VtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- r200_Begin( p );
- return GL_TRUE;
-}
-
-static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(rmesa->vb.installed);
-
- if (flags & FLUSH_UPDATE_CURRENT) {
- r200_copy_to_current( ctx );
- if (R200_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on update_current\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
- }
-
- if (flags & FLUSH_STORED_VERTICES) {
- assert (rmesa->dma.flush == 0 ||
- rmesa->dma.flush == flush_prims);
- if (rmesa->dma.flush == flush_prims)
- flush_prims( rmesa );
- ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES;
- }
-}
-
-
-
-/* At this point, don't expect very many versions of each function to
- * be generated, so not concerned about freeing them?
- */
-
-
-void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
- GLvertexformat *vfmt = &(rmesa->vb.vtxfmt);
-
- MEMSET( vfmt, 0, sizeof(GLvertexformat) );
-
- /* Hook in chooser functions for codegen, etc:
- */
- r200VtxfmtInitChoosers( vfmt );
-
- /* Handled fully in supported states, but no codegen:
- */
- vfmt->Materialfv = r200_Materialfv;
- vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
- vfmt->Rectf = _mesa_noop_Rectf; /* generic helper */
- vfmt->Begin = r200_Begin;
- vfmt->End = r200_End;
-
- /* Fallback for performance reasons: (Fix with cva/elt path here and
- * dmatmp2.h style primitive-merging)
- *
- * These should call NotifyBegin(), as should _tnl_EvalMesh, to allow
- * a driver-hook.
- */
- vfmt->DrawArrays = r200_fallback_DrawArrays;
- vfmt->DrawElements = r200_fallback_DrawElements;
- vfmt->DrawRangeElements = r200_fallback_DrawRangeElements;
-
-
- /* Not active in supported states; just keep ctx->Current uptodate:
- */
- vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexf = _mesa_noop_Indexf;
- vfmt->Indexfv = _mesa_noop_Indexfv;
-
-
- /* Active but unsupported -- fallback if we receive these:
- */
- vfmt->CallList = r200_fallback_CallList;
- vfmt->CallLists = r200_fallback_CallLists;
- vfmt->EvalCoord1f = r200_fallback_EvalCoord1f;
- vfmt->EvalCoord1fv = r200_fallback_EvalCoord1fv;
- vfmt->EvalCoord2f = r200_fallback_EvalCoord2f;
- vfmt->EvalCoord2fv = r200_fallback_EvalCoord2fv;
- vfmt->EvalMesh1 = r200_fallback_EvalMesh1;
- vfmt->EvalMesh2 = r200_fallback_EvalMesh2;
- vfmt->EvalPoint1 = r200_fallback_EvalPoint1;
- vfmt->EvalPoint2 = r200_fallback_EvalPoint2;
- vfmt->TexCoord4f = r200_fallback_TexCoord4f;
- vfmt->TexCoord4fv = r200_fallback_TexCoord4fv;
- vfmt->MultiTexCoord4fARB = r200_fallback_MultiTexCoord4fARB;
- vfmt->MultiTexCoord4fvARB = r200_fallback_MultiTexCoord4fvARB;
- vfmt->Vertex4f = r200_fallback_Vertex4f;
- vfmt->Vertex4fv = r200_fallback_Vertex4fv;
- vfmt->VertexAttrib1fNV = r200_fallback_VertexAttrib1fNV;
- vfmt->VertexAttrib1fvNV = r200_fallback_VertexAttrib1fvNV;
- vfmt->VertexAttrib2fNV = r200_fallback_VertexAttrib2fNV;
- vfmt->VertexAttrib2fvNV = r200_fallback_VertexAttrib2fvNV;
- vfmt->VertexAttrib3fNV = r200_fallback_VertexAttrib3fNV;
- vfmt->VertexAttrib3fvNV = r200_fallback_VertexAttrib3fvNV;
- vfmt->VertexAttrib4fNV = r200_fallback_VertexAttrib4fNV;
- vfmt->VertexAttrib4fvNV = r200_fallback_VertexAttrib4fvNV;
- vfmt->FogCoordfEXT = r200_fallback_FogCoordfEXT;
- vfmt->FogCoordfvEXT = r200_fallback_FogCoordfvEXT;
-
- (void)r200_fallback_vtxfmt;
-
- TNL_CONTEXT(ctx)->Driver.NotifyBegin = r200NotifyBegin;
-
- rmesa->vb.enabled = 1;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
- rmesa->vb.primflags = 0;
-
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2fv );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4f );
- make_empty_list( &rmesa->vb.dfn_cache.Color4fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3f );
- make_empty_list( &rmesa->vb.dfn_cache.Color3fv );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3f );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord3f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord3fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1fv );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord3fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord3fvARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-/* make_empty_list( &rmesa->vb.dfn_cache.FogCoordfEXT );
- make_empty_list( &rmesa->vb.dfn_cache.FogCoordfvEXT );*/
-
- r200InitCodegen( &rmesa->vb.codegen, useCodegen );
-}
-
-static void free_funcs( struct dynfn *l )
-{
- struct dynfn *f, *tmp;
- foreach_s (f, tmp, l) {
- remove_from_list( f );
- _mesa_exec_free( f->code );
- _mesa_free( f );
- }
-}
-
-void r200VtxfmtUnbindContext( GLcontext *ctx )
-{
-}
-
-
-void r200VtxfmtMakeCurrent( GLcontext *ctx )
-{
-}
-
-
-void r200VtxfmtDestroy( GLcontext *ctx )
-{
- r200ContextPtr rmesa = R200_CONTEXT( ctx );
-
- count_funcs( rmesa );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2fv );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3fv );
- free_funcs( &rmesa->vb.dfn_cache.Color4ub );
- free_funcs( &rmesa->vb.dfn_cache.Color4ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color3ub );
- free_funcs( &rmesa->vb.dfn_cache.Color3ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color4f );
- free_funcs( &rmesa->vb.dfn_cache.Color4fv );
- free_funcs( &rmesa->vb.dfn_cache.Color3f );
- free_funcs( &rmesa->vb.dfn_cache.Color3fv );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- free_funcs( &rmesa->vb.dfn_cache.Normal3f );
- free_funcs( &rmesa->vb.dfn_cache.Normal3fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord3f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord3fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1fv );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord3fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord3fvARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-/* free_funcs( &rmesa->vb.dfn_cache.FogCoordfEXT );
- free_funcs( &rmesa->vb.dfn_cache.FogCoordfvEXT );*/
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.h
deleted file mode 100644
index c347dcfb2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_VTXFMT_H__
-#define __R200_VTXFMT_H__
-
-#include "r200_context.h"
-
-
-
-extern void r200VtxfmtUpdate( GLcontext *ctx );
-extern void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
-extern void r200VtxfmtInvalidate( GLcontext *ctx );
-extern void r200VtxfmtDestroy( GLcontext *ctx );
-extern void r200VtxfmtInitChoosers( GLvertexformat *vfmt );
-
-extern void r200VtxfmtMakeCurrent( GLcontext *ctx );
-extern void r200VtxfmtUnbindContext( GLcontext *ctx );
-
-extern void r200_copy_to_current( GLcontext *ctx );
-extern void VFMT_FALLBACK( const char *caller );
-
-#define DFN( FUNC, CACHE) \
-do { \
- char *start = (char *)&FUNC; \
- char *end = (char *)&FUNC##_end; \
- insert_at_head( &CACHE, dfn ); \
- dfn->key[0] = key[0]; \
- dfn->key[1] = key[1]; \
- dfn->code = _mesa_exec_malloc(end - start); \
- _mesa_memcpy(dfn->code, start, end - start); \
-} \
-while ( 0 )
-
-#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- int *icode = (int *)(CODE+OFFSET); \
- assert (*icode == CHECKVAL); \
- *icode = (int)NEWVAL; \
-} while (0)
-
-
-/* Useful for figuring out the offsets:
- */
-#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
- /*fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__,*/ \
- /* __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL));*/ \
- *(int *)(CODE+OFFSET) = (int)(NEWVAL); \
- OFFSET += 4; \
-} while (0)
-
-/*
- */
-void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
-void r200InitX86Codegen( struct dfn_generators *gen );
-void r200InitSSECodegen( struct dfn_generators *gen );
-
-
-
-/* Defined in r200_vtxfmt_x86.c
- */
-struct dynfn *r200_makeX86Vertex2f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Vertex2fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Vertex3f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Vertex3fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4ub( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4ubv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3ub( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3ubv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color4fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Color3fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3ubEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3ubvEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3fEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86SecondaryColor3fvEXT( GLcontext *, const int * );
-struct dynfn *r200_makeX86Normal3f( GLcontext *, const int * );
-struct dynfn *r200_makeX86Normal3fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord2f( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord2fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord1f( GLcontext *, const int * );
-struct dynfn *r200_makeX86TexCoord1fv( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord1fARB( GLcontext *, const int * );
-struct dynfn *r200_makeX86MultiTexCoord1fvARB( GLcontext *, const int * );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c
deleted file mode 100644
index 1db5950c8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c
+++ /dev/null
@@ -1,1002 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "simple_list.h"
-#include "api_noop.h"
-#include "vtxfmt.h"
-
-#include "r200_vtxfmt.h"
-#include "r200_tcl.h"
-
-#include "dispatch.h"
-
-/* Fallback versions of all the entrypoints for situations where
- * codegen isn't available. This is still a lot faster than the
- * vb/pipeline implementation in Mesa.
- */
-static void r200_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = *(int *)&z;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void r200_Vertex3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = *(int *)&v[2];
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void r200_Vertex2f( GLfloat x, GLfloat y )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void r200_Vertex2fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-
-/* Color for ubyte (packed) color formats:
- */
-#if 0
-static void r200_Color3ub_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void r200_Color3ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-
-static void r200_Color4ub_ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = a;
-}
-
-static void r200_Color4ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- *(GLuint *)rmesa->vb.colorptr = LE32_TO_CPU(*(GLuint *)v);
-}
-#endif /* 0 */
-
-static void r200_Color3f_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void r200_Color3fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-static void r200_Color4f_ub( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, a );
-}
-
-static void r200_Color4fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, v[3] );
-}
-
-
-/* Color for float color+alpha formats:
- */
-#if 0
-static void r200_Color3ub_4f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void r200_Color3ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-
-static void r200_Color4ub_4f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = UBYTE_TO_FLOAT(a);
-}
-
-static void r200_Color4ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = UBYTE_TO_FLOAT(v[3]);
-}
-#endif /* 0 */
-
-
-static void r200_Color3f_4f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void r200_Color3fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-static void r200_Color4f_4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = a;
-}
-
-static void r200_Color4fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = v[3];
-}
-
-
-/* Color for float color formats:
- */
-#if 0
-static void r200_Color3ub_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
-}
-
-static void r200_Color3ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
-}
-
-static void r200_Color4ub_3f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(a);
-}
-
-static void r200_Color4ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(v[3]);
-}
-#endif /* 0 */
-
-
-static void r200_Color3f_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
-}
-
-static void r200_Color3fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-static void r200_Color4f_3f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = a;
-}
-
-static void r200_Color4fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = v[3];
-}
-
-
-/* Secondary Color:
- */
-#if 0
-static void r200_SecondaryColor3ubEXT_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void r200_SecondaryColor3ubvEXT_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-#endif /* 0 */
-
-static void r200_SecondaryColor3fEXT_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void r200_SecondaryColor3fvEXT_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- r200_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-#if 0
-static void r200_SecondaryColor3ubEXT_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void r200_SecondaryColor3ubvEXT_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-#endif /* 0 */
-
-static void r200_SecondaryColor3fEXT_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void r200_SecondaryColor3fvEXT_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-
-
-/* Normal
- */
-static void r200_Normal3f( GLfloat n0, GLfloat n1, GLfloat n2 )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = n0;
- dest[1] = n1;
- dest[2] = n2;
-}
-
-static void r200_Normal3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-
-/* FogCoord
- */
-static void r200_FogCoordfEXT( GLfloat f )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.fogptr;
- dest[0] = r200ComputeFogBlendFactor( ctx, f );
-/* ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = f;*/
-}
-
-static void r200_FogCoordfvEXT( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.fogptr;
- dest[0] = r200ComputeFogBlendFactor( ctx, v[0] );
-/* ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = v[0];*/
-}
-
-
-/* TexCoord
- */
-
-/* \todo maybe (target & 4 ? target & 5 : target & 3) is more save than (target & 7) */
-static void r200_MultiTexCoord1fARB(GLenum target, GLfloat s)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint unit = (target & 7);
- GLfloat * const dest = rmesa->vb.texcoordptr[unit];
-
- switch( ctx->Texture.Unit[unit]._ReallyEnabled ) {
- case TEXTURE_CUBE_BIT:
- case TEXTURE_3D_BIT:
- dest[2] = 0.0;
- /* FALLTHROUGH */
- case TEXTURE_2D_BIT:
- case TEXTURE_RECT_BIT:
- dest[1] = 0.0;
- /* FALLTHROUGH */
- case TEXTURE_1D_BIT:
- dest[0] = s;
- }
-}
-
-static void r200_MultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint unit = (target & 7);
- GLfloat * const dest = rmesa->vb.texcoordptr[unit];
-
- switch( ctx->Texture.Unit[unit]._ReallyEnabled ) {
- case TEXTURE_CUBE_BIT:
- case TEXTURE_3D_BIT:
- dest[2] = 0.0;
- /* FALLTHROUGH */
- case TEXTURE_2D_BIT:
- case TEXTURE_RECT_BIT:
- dest[1] = t;
- dest[0] = s;
- break;
- default:
- VFMT_FALLBACK(__FUNCTION__);
- CALL_MultiTexCoord2fARB(GET_DISPATCH(), (target, s, t));
- return;
- }
-}
-
-static void r200_MultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r)
-{
- GET_CURRENT_CONTEXT(ctx);
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint unit = (target & 7);
- GLfloat * const dest = rmesa->vb.texcoordptr[unit];
-
- switch( ctx->Texture.Unit[unit]._ReallyEnabled ) {
- case TEXTURE_CUBE_BIT:
- case TEXTURE_3D_BIT:
- dest[2] = r;
- dest[1] = t;
- dest[0] = s;
- break;
- default:
- VFMT_FALLBACK(__FUNCTION__);
- CALL_MultiTexCoord3fARB(GET_DISPATCH(), (target, s, t, r));
- return;
- }
-}
-
-static void r200_TexCoord1f(GLfloat s)
-{
- r200_MultiTexCoord1fARB(GL_TEXTURE0, s);
-}
-
-static void r200_TexCoord2f(GLfloat s, GLfloat t)
-{
- r200_MultiTexCoord2fARB(GL_TEXTURE0, s, t);
-}
-
-static void r200_TexCoord3f(GLfloat s, GLfloat t, GLfloat r)
-{
- r200_MultiTexCoord3fARB(GL_TEXTURE0, s, t, r);
-}
-
-static void r200_TexCoord1fv(const GLfloat *v)
-{
- r200_MultiTexCoord1fARB(GL_TEXTURE0, v[0]);
-}
-
-static void r200_TexCoord2fv(const GLfloat *v)
-{
- r200_MultiTexCoord2fARB(GL_TEXTURE0, v[0], v[1]);
-}
-
-static void r200_TexCoord3fv(const GLfloat *v)
-{
- r200_MultiTexCoord3fARB(GL_TEXTURE0, v[0], v[1], v[2]);
-}
-
-static void r200_MultiTexCoord1fvARB(GLenum target, const GLfloat *v)
-{
- r200_MultiTexCoord1fARB(target, v[0]);
-}
-
-static void r200_MultiTexCoord2fvARB(GLenum target, const GLfloat *v)
-{
- r200_MultiTexCoord2fARB(target, v[0], v[1]);
-}
-
-static void r200_MultiTexCoord3fvARB(GLenum target, const GLfloat *v)
-{
- r200_MultiTexCoord3fARB(target, v[0], v[1], v[2]);
-}
-
-
-static struct dynfn *lookup( struct dynfn *l, const int *key )
-{
- struct dynfn *f;
-
- foreach( f, l ) {
- if (f->key[0] == key[0] && f->key[1] == key[1])
- return f;
- }
-
- return NULL;
-}
-
-/* Can't use the loopback template for this:
- */
-
-#define CHOOSE(FN, FNTYPE, MASK0, MASK1, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- int key[2]; \
- struct dynfn *dfn; \
- \
- key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
- key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \
- \
- if (dfn) \
- SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \
- else { \
- if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- SET_ ## FN (ctx->Exec, r200_##FN); \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- CALL_ ## FN (ctx->Exec, ARGS2); \
-}
-
-
-
-/* For the _3f case, only allow one color function to be hooked in at
- * a time. Eventually, use a similar mechanism to allow selecting the
- * color component of the vertex format based on client behaviour.
- *
- * Note: Perform these actions even if there is a codegen or cached
- * codegen version of the chosen function.
- */
-#define CHOOSE_COLOR(FN, FNTYPE, NR, MASK0, MASK1, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- int key[2]; \
- struct dynfn *dfn; \
- \
- key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
- key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
- \
- if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_PK_RGBA) { \
- SET_ ## FN (ctx->Exec, r200_##FN##_ub); \
- } \
- else if (VTX_COLOR(rmesa->vb.vtxfmt_0,0) == R200_VTX_FP_RGB) { \
- \
- if (rmesa->vb.installed_color_3f_sz != NR) { \
- rmesa->vb.installed_color_3f_sz = NR; \
- if (NR == 3) ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = 1.0; \
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \
- r200_copy_to_current( ctx ); \
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \
- CALL_ ## FN (ctx->Exec, ARGS2); \
- return; \
- } \
- } \
- \
- SET_ ## FN (ctx->Exec, r200_##FN##_3f); \
- } \
- else { \
- SET_ ## FN (ctx->Exec, r200_##FN##_4f); \
- } \
- \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (!dfn) dfn = rmesa->vb.codegen.FN( ctx, key ); \
- \
- if (dfn) { \
- if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ ); \
- SET_ ## FN (ctx->Exec, (FNTYPE)dfn->code); \
- } \
- else if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ ); \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- CALL_ ## FN (ctx->Exec, ARGS2); \
-}
-
-
-
-/* Right now there are both _ub and _3f versions of the secondary color
- * functions. Currently, we only set-up the hardware to use the _ub versions.
- * The _3f versions are needed for the cases where secondary color isn't used
- * in the vertex format, but it still needs to be stored in the context
- * state vector.
- */
-#define CHOOSE_SECONDARY_COLOR(FN, FNTYPE, MASK0, MASK1, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- r200ContextPtr rmesa = R200_CONTEXT(ctx); \
- int key[2]; \
- struct dynfn *dfn; \
- \
- key[0] = rmesa->vb.vtxfmt_0 & MASK0; \
- key[1] = rmesa->vb.vtxfmt_1 & MASK1; \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached version\n", __FUNCTION__ ); \
- \
- if (dfn) \
- SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \
- else { \
- if (R200_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- SET_ ## FN (ctx->Exec, (VTX_COLOR(rmesa->vb.vtxfmt_0,1) == R200_VTX_PK_RGBA) \
- ? r200_##FN##_ub : r200_##FN##_3f); \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- CALL_ ## FN (ctx->Exec, ARGS2); \
-}
-
-
-
-
-
-
-
-/* VTXFMT_0
- */
-#define MASK_XYZW (R200_VTX_W0|R200_VTX_Z0)
-#define MASK_NORM (MASK_XYZW|R200_VTX_N0)
-#define MASK_FOG (MASK_NORM |R200_VTX_DISCRETE_FOG)
-#define MASK_COLOR (MASK_FOG |(R200_VTX_COLOR_MASK<<R200_VTX_COLOR_0_SHIFT))
-#define MASK_SPEC (MASK_COLOR|(R200_VTX_COLOR_MASK<<R200_VTX_COLOR_1_SHIFT))
-
-/* VTXFMT_1
- */
-#define MASK_ST0 (0x7 << R200_VTX_TEX0_COMP_CNT_SHIFT)
-/* FIXME: maybe something like in the radeon driver is needed here? */
-
-
-typedef void (*p4f)( GLfloat, GLfloat, GLfloat, GLfloat );
-typedef void (*p3f)( GLfloat, GLfloat, GLfloat );
-typedef void (*p2f)( GLfloat, GLfloat );
-typedef void (*p1f)( GLfloat );
-typedef void (*pe3f)( GLenum, GLfloat, GLfloat, GLfloat );
-typedef void (*pe2f)( GLenum, GLfloat, GLfloat );
-typedef void (*pe1f)( GLenum, GLfloat );
-typedef void (*p4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
-typedef void (*p3ub)( GLubyte, GLubyte, GLubyte );
-typedef void (*pfv)( const GLfloat * );
-typedef void (*pefv)( GLenum, const GLfloat * );
-typedef void (*pubv)( const GLubyte * );
-
-
-CHOOSE(Normal3f, p3f, MASK_NORM, 0,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Normal3fv, pfv, MASK_NORM, 0,
- (const GLfloat *v), (v))
-
-#if 0
-CHOOSE_COLOR(Color4ub, p4ub, 4, MASK_COLOR, 0,
- (GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d))
-CHOOSE_COLOR(Color4ubv, pubv, 4, MASK_COLOR, 0,
- (const GLubyte *v), (v))
-CHOOSE_COLOR(Color3ub, p3ub, 3, MASK_COLOR, 0,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_COLOR(Color3ubv, pubv, 3, MASK_COLOR, 0,
- (const GLubyte *v), (v))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubEXT, p3ub, MASK_SPEC, 0,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubvEXT, pubv, MASK_SPEC, 0,
- (const GLubyte *v), (v))
-#endif
-
-CHOOSE_COLOR(Color4f, p4f, 4, MASK_COLOR, 0,
- (GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d))
-CHOOSE_COLOR(Color4fv, pfv, 4, MASK_COLOR, 0,
- (const GLfloat *v), (v))
-CHOOSE_COLOR(Color3f, p3f, 3, MASK_COLOR, 0,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_COLOR(Color3fv, pfv, 3, MASK_COLOR, 0,
- (const GLfloat *v), (v))
-
-
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fEXT, p3f, MASK_SPEC, 0,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fvEXT, pfv, MASK_SPEC, 0,
- (const GLfloat *v), (v))
-
-CHOOSE(TexCoord3f, p3f, ~0, MASK_ST0,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(TexCoord3fv, pfv, ~0, MASK_ST0,
- (const GLfloat *v), (v))
-CHOOSE(TexCoord2f, p2f, ~0, MASK_ST0,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(TexCoord2fv, pfv, ~0, MASK_ST0,
- (const GLfloat *v), (v))
-CHOOSE(TexCoord1f, p1f, ~0, MASK_ST0,
- (GLfloat a), (a))
-CHOOSE(TexCoord1fv, pfv, ~0, MASK_ST0,
- (const GLfloat *v), (v))
-
-CHOOSE(MultiTexCoord3fARB, pe3f, ~0, ~0,
- (GLenum u,GLfloat a,GLfloat b,GLfloat c), (u,a,b,c))
-CHOOSE(MultiTexCoord3fvARB, pefv, ~0, ~0,
- (GLenum u,const GLfloat *v), (u,v))
-CHOOSE(MultiTexCoord2fARB, pe2f, ~0, ~0,
- (GLenum u,GLfloat a,GLfloat b), (u,a,b))
-CHOOSE(MultiTexCoord2fvARB, pefv, ~0, ~0,
- (GLenum u,const GLfloat *v), (u,v))
-CHOOSE(MultiTexCoord1fARB, pe1f, ~0, ~0,
- (GLenum u,GLfloat a), (u,a))
-CHOOSE(MultiTexCoord1fvARB, pefv, ~0, ~0,
- (GLenum u,const GLfloat *v), (u,v))
-
-CHOOSE(Vertex3f, p3f, ~0, ~0,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Vertex3fv, pfv, ~0, ~0,
- (const GLfloat *v), (v))
-CHOOSE(Vertex2f, p2f, ~0, ~0,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(Vertex2fv, pfv, ~0, ~0,
- (const GLfloat *v), (v))
-
-CHOOSE(FogCoordfEXT, p1f, MASK_FOG, ~0,
- (GLfloat f), (f))
-CHOOSE(FogCoordfvEXT, pfv, MASK_FOG, ~0,
- (const GLfloat *f), (f))
-
-
-
-
-void r200VtxfmtInitChoosers( GLvertexformat *vfmt )
-{
- vfmt->Color3f = choose_Color3f;
- vfmt->Color3fv = choose_Color3fv;
- vfmt->Color4f = choose_Color4f;
- vfmt->Color4fv = choose_Color4fv;
- vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
- vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB;
- vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB;
- vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB;
- vfmt->MultiTexCoord2fvARB = choose_MultiTexCoord2fvARB;
- vfmt->MultiTexCoord3fARB = choose_MultiTexCoord3fARB;
- vfmt->MultiTexCoord3fvARB = choose_MultiTexCoord3fvARB;
- vfmt->Normal3f = choose_Normal3f;
- vfmt->Normal3fv = choose_Normal3fv;
- vfmt->TexCoord1f = choose_TexCoord1f;
- vfmt->TexCoord1fv = choose_TexCoord1fv;
- vfmt->TexCoord2f = choose_TexCoord2f;
- vfmt->TexCoord2fv = choose_TexCoord2fv;
- vfmt->TexCoord3f = choose_TexCoord3f;
- vfmt->TexCoord3fv = choose_TexCoord3fv;
- vfmt->Vertex2f = choose_Vertex2f;
- vfmt->Vertex2fv = choose_Vertex2fv;
- vfmt->Vertex3f = choose_Vertex3f;
- vfmt->Vertex3fv = choose_Vertex3fv;
-/* vfmt->FogCoordfEXT = choose_FogCoordfEXT;
- vfmt->FogCoordfvEXT = choose_FogCoordfvEXT;*/
-
- /* TODO: restore ubyte colors to vtxfmt.
- */
-#if 0
- vfmt->Color3ub = choose_Color3ub;
- vfmt->Color3ubv = choose_Color3ubv;
- vfmt->Color4ub = choose_Color4ub;
- vfmt->Color4ubv = choose_Color4ubv;
- vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
-#endif
-}
-
-
-static struct dynfn *codegen_noop( GLcontext *ctx, const int *key )
-{
- (void) ctx; (void) key;
- return NULL;
-}
-
-void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen )
-{
- gen->Vertex3f = codegen_noop;
- gen->Vertex3fv = codegen_noop;
- gen->Color4ub = codegen_noop;
- gen->Color4ubv = codegen_noop;
- gen->Normal3f = codegen_noop;
- gen->Normal3fv = codegen_noop;
-
- gen->TexCoord3f = codegen_noop;
- gen->TexCoord3fv = codegen_noop;
- gen->TexCoord2f = codegen_noop;
- gen->TexCoord2fv = codegen_noop;
- gen->TexCoord1f = codegen_noop;
- gen->TexCoord1fv = codegen_noop;
-
- gen->MultiTexCoord3fARB = codegen_noop;
- gen->MultiTexCoord3fvARB = codegen_noop;
- gen->MultiTexCoord2fARB = codegen_noop;
- gen->MultiTexCoord2fvARB = codegen_noop;
- gen->MultiTexCoord1fARB = codegen_noop;
- gen->MultiTexCoord1fvARB = codegen_noop;
-/* gen->FogCoordfEXT = codegen_noop;
- gen->FogCoordfvEXT = codegen_noop;*/
-
- gen->Vertex2f = codegen_noop;
- gen->Vertex2fv = codegen_noop;
- gen->Color3ub = codegen_noop;
- gen->Color3ubv = codegen_noop;
- gen->Color4f = codegen_noop;
- gen->Color4fv = codegen_noop;
- gen->Color3f = codegen_noop;
- gen->Color3fv = codegen_noop;
- gen->SecondaryColor3fEXT = codegen_noop;
- gen->SecondaryColor3fvEXT = codegen_noop;
- gen->SecondaryColor3ubEXT = codegen_noop;
- gen->SecondaryColor3ubvEXT = codegen_noop;
-
- if (useCodegen) {
-#if defined(USE_X86_ASM)
- r200InitX86Codegen( gen );
-#endif
-
-#if defined(USE_SSE_ASM)
- r200InitSSECodegen( gen );
-#endif
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c
deleted file mode 100644
index 590173049..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "r200_vtxfmt.h"
-
-#if defined(USE_SSE_ASM)
-#include "x86/common_x86_asm.h"
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN( _sse_Attribute2fv );
-EXTERN( _sse_Attribute2f );
-EXTERN( _sse_Attribute3fv );
-EXTERN( _sse_Attribute3f );
-EXTERN( _sse_MultiTexCoord2fv );
-EXTERN( _sse_MultiTexCoord2f );
-EXTERN( _sse_MultiTexCoord2fv_2 );
-EXTERN( _sse_MultiTexCoord2f_2 );
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state.
- */
-
-static struct dynfn *r200_makeSSEAttribute2fv( struct dynfn * cache, const int * key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 10, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEAttribute2f( struct dynfn * cache, const int * key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute2f, (*cache) );
- FIXUP(dfn->code, 8, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEAttribute3fv( struct dynfn * cache, const int * key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 13, 0x0, (int)dest);
- FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEAttribute3f( struct dynfn * cache, const int * key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _sse_Attribute3f, (*cache) );
- FIXUP(dfn->code, 12, 0x0, (int)dest);
- FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn *r200_makeSSENormal3fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *r200_makeSSENormal3f( GLcontext *ctx, const int * key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *r200_makeSSEColor3fv( GLcontext *ctx, const int * key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return NULL;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-static struct dynfn *r200_makeSSEColor3f( GLcontext *ctx, const int * key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return NULL;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
-static struct dynfn *r200_makeSSETexCoord2fv( GLcontext *ctx, const int * key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *r200_makeSSETexCoord2f( GLcontext *ctx, const int * key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *r200_makeSSEMultiTexCoord2fv( GLcontext *ctx, const int * key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-static struct dynfn *r200_makeSSEMultiTexCoord2f( GLcontext *ctx, const int * key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-#endif
-
-void r200InitSSECodegen( struct dfn_generators *gen )
-{
- if ( cpu_has_xmm ) {
- gen->Normal3fv = (void *) r200_makeSSENormal3fv;
- gen->Normal3f = (void *) r200_makeSSENormal3f;
- gen->Color3fv = (void *) r200_makeSSEColor3fv;
- gen->Color3f = (void *) r200_makeSSEColor3f;
-#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
- gen->TexCoord2fv = (void *) r200_makeSSETexCoord2fv;
- gen->TexCoord2f = (void *) r200_makeSSETexCoord2f;
- gen->MultiTexCoord2fvARB = (void *) r200_makeSSEMultiTexCoord2fv;
- gen->MultiTexCoord2fARB = (void *) r200_makeSSEMultiTexCoord2f;
-#endif
- }
-}
-
-#else
-
-void r200InitSSECodegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c
deleted file mode 100644
index b78a55c31..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "r200_vtxfmt.h"
-
-#if defined(USE_X86_ASM)
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN ( _x86_Attribute2fv );
-EXTERN ( _x86_Attribute2f );
-EXTERN ( _x86_Attribute3fv );
-EXTERN ( _x86_Attribute3f );
-EXTERN ( _x86_Vertex3fv_6 );
-EXTERN ( _x86_Vertex3fv_8 );
-EXTERN ( _x86_Vertex3fv );
-EXTERN ( _x86_Vertex3f_4 );
-EXTERN ( _x86_Vertex3f_6 );
-EXTERN ( _x86_Vertex3f );
-EXTERN ( _x86_Color4ubv_ub );
-EXTERN ( _x86_Color4ubv_4f );
-EXTERN ( _x86_Color4ub_ub );
-EXTERN ( _x86_MultiTexCoord2fv );
-EXTERN ( _x86_MultiTexCoord2fv_2 );
-EXTERN ( _x86_MultiTexCoord2f );
-EXTERN ( _x86_MultiTexCoord2f_2 );
-
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state. Generic x86 versions.
- */
-
-struct dynfn *r200_makeX86Vertex3f( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
- key[0], key[1], rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 4: {
-
- DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- case 6: {
-
- DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- default: {
-
- DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-
-
-struct dynfn *r200_makeX86Vertex3fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x %d\n", __FUNCTION__,
- key[0], key[1], rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 6: {
-
- DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
- case 8: {
-
- DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
- FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
- FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
-
- default: {
-
- DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-static struct dynfn *
-r200_makeX86Attribute2fv( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 11, 0x0, (int)dest);
- FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-r200_makeX86Attribute2f( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute2f, (*cache) );
- FIXUP(dfn->code, 1, 0x0, (int)dest);
-
- return dfn;
-}
-
-
-static struct dynfn *
-r200_makeX86Attribute3fv( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-r200_makeX86Attribute3f( struct dynfn * cache, const int *key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key[0] );
-
- DFN ( _x86_Attribute3f, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-struct dynfn *r200_makeX86Normal3fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *r200_makeX86Normal3f( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *r200_makeX86Color4ubv( GLcontext *ctx, const int *key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
- DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
- return dfn;
- }
- else {
-
- DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
- FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
- FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
- FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
- FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
- return dfn;
- }
-}
-
-struct dynfn *r200_makeX86Color4ub( GLcontext *ctx, const int *key )
-{
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key[0] );
-
- if (VTX_COLOR(key[0],0) == R200_VTX_PK_RGBA) {
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
- FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
- FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
- FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
- return dfn;
- }
- else
- return NULL;
-}
-
-
-struct dynfn *r200_makeX86Color3fv( GLcontext *ctx, const int *key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return NULL;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-struct dynfn *r200_makeX86Color3f( GLcontext *ctx, const int *key )
-{
- if (VTX_COLOR(key[0],0) != R200_VTX_FP_RGB)
- return NULL;
- else
- {
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-
-
-#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
-struct dynfn *r200_makeX86TexCoord2fv( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *r200_makeX86TexCoord2f( GLcontext *ctx, const int *key )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- return r200_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *r200_makeX86MultiTexCoord2fvARB( GLcontext *ctx, const int *key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- } else {
- DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-struct dynfn *r200_makeX86MultiTexCoord2fARB( GLcontext *ctx,
- const int *key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (R200_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x 0x%08x\n", __FUNCTION__, key[0], key[1] );
-
- if (rmesa->vb.texcoordptr[1] == rmesa->vb.texcoordptr[0]+4) {
- DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- }
- else {
- /* Note: this might get generated multiple times, even though the
- * actual emitted code is the same.
- */
- DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-#endif
-
-void r200InitX86Codegen( struct dfn_generators *gen )
-{
- gen->Vertex3f = r200_makeX86Vertex3f;
- gen->Vertex3fv = r200_makeX86Vertex3fv;
- gen->Color4ub = r200_makeX86Color4ub; /* PKCOLOR only */
- gen->Color4ubv = r200_makeX86Color4ubv; /* PKCOLOR only */
- gen->Normal3f = r200_makeX86Normal3f;
- gen->Normal3fv = r200_makeX86Normal3fv;
-#if 0 /* Temporarily disabled as it is broken w/the new cubemap code. - idr */
- gen->TexCoord2f = r200_makeX86TexCoord2f;
- gen->TexCoord2fv = r200_makeX86TexCoord2fv;
- gen->MultiTexCoord2fARB = r200_makeX86MultiTexCoord2fARB;
- gen->MultiTexCoord2fvARB = r200_makeX86MultiTexCoord2fvARB;
-#endif
- gen->Color3f = r200_makeX86Color3f;
- gen->Color3fv = r200_makeX86Color3fv;
-
- /* Not done:
- */
-/* gen->Vertex2f = r200_makeX86Vertex2f; */
-/* gen->Vertex2fv = r200_makeX86Vertex2fv; */
-/* gen->Color3ub = r200_makeX86Color3ub; */
-/* gen->Color3ubv = r200_makeX86Color3ubv; */
-/* gen->Color4f = r200_makeX86Color4f; */
-/* gen->Color4fv = r200_makeX86Color4fv; */
-/* gen->TexCoord1f = r200_makeX86TexCoord1f; */
-/* gen->TexCoord1fv = r200_makeX86TexCoord1fv; */
-/* gen->MultiTexCoord1fARB = r200_makeX86MultiTexCoord1fARB; */
-/* gen->MultiTexCoord1fvARB = r200_makeX86MultiTexCoord1fvARB; */
-}
-
-
-#else
-
-void r200InitX86Codegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S
deleted file mode 100644
index 57a35c657..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S
+++ /dev/null
@@ -1,495 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.2 2002/11/07 18:31:59 tsi Exp $ */
-/**************************************************************************
-
-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
-on 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
-ATI, TUNGSTEN GRAPHICS 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.
-
-**************************************************************************/
-
-#define GLOBL( x ) \
-.globl x; \
-x:
-
-.data
-.align 4
-
-/*
- vertex 3f vertex size 4
-*/
-
-GLOBL ( _x86_Vertex3f_4 )
- movl (0), %ecx
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl %eax, (%ecx)
- movl %edx, 4(%ecx)
- movl 12(%esp), %eax
- movl (0), %edx
- movl %eax, 8(%ecx)
- movl %edx, 12(%ecx)
- movl (0), %eax
- addl $16, %ecx
- dec %eax
- movl %ecx, (0)
- movl %eax, (0)
- je .1
- ret
-.1: jmp *0
-
-GLOBL ( _x86_Vertex3f_4_end )
-
-/*
- vertex 3f vertex size 6
-*/
-GLOBL ( _x86_Vertex3f_6 )
- push %edi
- movl (0), %edi
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- movl (0), %eax
- movl (0), %edx
- movl (0), %ecx
- movl %eax, 12(%edi)
- movl %edx, 16(%edi)
- movl %ecx, 20(%edi)
- addl $24, %edi
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- pop %edi
- movl %eax, (0)
- je .2
- ret
-.2: jmp *0
-GLOBL ( _x86_Vertex3f_6_end )
-/*
- vertex 3f generic size
-*/
-GLOBL ( _x86_Vertex3f )
- push %edi
- push %esi
- movl $0, %esi
- movl (0), %edi
- movl 12(%esp), %eax
- movl 16(%esp), %edx
- movl 20(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- addl $12, %edi
- movl $0, %ecx
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- movl %eax, (0)
- pop %esi
- pop %edi
- je .3
- ret
-.3: jmp *0
-
-GLOBL ( _x86_Vertex3f_end )
-
-/*
- Vertex 3fv vertex size 6
-*/
-GLOBL ( _x86_Vertex3fv_6 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx, (%eax)
- movl 4(%ecx), %edx
- movl 8(%ecx), %ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (36), %edx
- movl %edx, 20(%eax)
- addl $24, %eax
- movl %eax, 0
- movl 4, %eax
- dec %eax
- movl %eax, 4
- je .4
- ret
-.4: jmp *8
-
-GLOBL ( _x86_Vertex3fv_6_end )
-
-/*
- Vertex 3fv vertex size 8
-*/
-GLOBL ( _x86_Vertex3fv_8 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx ,(%eax)
- movl 4(%ecx) ,%edx
- movl 8(%ecx) ,%ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 20(%eax)
- movl %ecx, 24(%eax)
- movl (36), %edx
- movl %edx, 28(%eax)
- addl $32, %eax
- movl %eax, (0)
- movl 4, %eax
- dec %eax
- movl %eax, (4)
- je .5
- ret
-.5: jmp *8
-
-GLOBL ( _x86_Vertex3fv_8_end )
-
-/*
- Vertex 3fv generic vertex size
-*/
-GLOBL ( _x86_Vertex3fv )
- movl 4(%esp), %edx
- push %edi
- push %esi
- movl (0x1010101), %edi
- movl (%edx), %eax
- movl 4(%edx), %ecx
- movl 8(%edx), %esi
- movl %eax, (%edi)
- movl %ecx, 4(%edi)
- movl %esi, 8(%edi)
- addl $12, %edi
- movl $6, %ecx
- movl $0x58, %esi
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl %edi, (0x1010101)
- movl (0x2020202), %eax
- pop %esi
- pop %edi
- dec %eax
- movl %eax, (0x2020202)
- je .6
- ret
-.6: jmp *0
-GLOBL ( _x86_Vertex3fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL ( _x86_Attribute2f )
- movl $0x0, %edx
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- movl %eax, (%edx)
- movl %ecx, 4(%edx)
- ret
-GLOBL ( _x86_Attribute2f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _x86_Attribute2fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %eax /* load v[1] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %eax, 4 /* store v[1] to current vertex */
- ret
-GLOBL ( _x86_Attribute2fv_end )
-
-
-/**
- * Generic handler for 3 float format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL ( _x86_Attribute3f )
- movl 4(%esp), %ecx
- movl 8(%esp), %edx
- movl 12(%esp), %eax
- movl %ecx, 0
- movl %edx, 4
- movl %eax, 8
- ret
-GLOBL ( _x86_Attribute3f_end )
-
-/**
- * Generic handler for 3 float vector format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL( _x86_Attribute3fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %edx /* load v[1] */
- movl 8(%eax), %eax /* load v[2] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %edx, 4 /* store v[1] to current vertex */
- movl %eax, 8 /* store v[2] to current vertex */
- ret
-GLOBL ( _x86_Attribute3fv_end )
-
-
-/*
- Color 4ubv_ub
-*/
-GLOBL ( _x86_Color4ubv_ub )
- movl 4(%esp), %eax
- movl $0x12345678, %edx
- movl (%eax), %eax
- movl %eax, (%edx)
- ret
-GLOBL ( _x86_Color4ubv_ub_end )
-
-/*
- Color 4ubv 4f
-*/
-GLOBL ( _x86_Color4ubv_4f )
- push %ebx
- movl $0, %edx
- xor %eax, %eax
- xor %ecx, %ecx
- movl 8(%esp), %ebx
- movl (%ebx), %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4),%eax
- movl (%edx,%ecx,4),%ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- xor %eax, %eax
- xor %ecx, %ecx
- shr $16, %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4), %eax
- movl (%edx,%ecx,4), %ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- pop %ebx
- ret
-GLOBL ( _x86_Color4ubv_4f_end )
-
-/*
-
- Color4ub_ub
-*/
-GLOBL( _x86_Color4ub_ub )
- push %ebx
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl 20(%esp), %ebx
- mov %al, (0)
- mov %dl, (0)
- mov %cl, (0)
- mov %bl, (0)
- pop %ebx
- ret
-GLOBL( _x86_Color4ub_ub_end )
-
-
-/* \todo: change the "and $7, %eax" to something like "target & 4 ? target & 5 : target & 3)" */
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $7, %eax
- movl (%ecx), %edx
- shl $3, %eax
- movl 4(%ecx), %ecx
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-
-GLOBL( _x86_MultiTexCoord2fv_2 )
- movl 4(%esp,1), %eax
- movl 8(%esp,1), %ecx
- and $0x7, %eax
- movl 0(,%eax,4), %edx
- movl (%ecx), %eax
- movl %eax, (%edx)
- movl 4(%ecx), %eax
- movl %eax, 4(%edx)
- ret
-GLOBL( _x86_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2f )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp), %ecx
- and $7, %eax
- shl $3, %eax
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _x86_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp,1), %ecx
- and $7,%eax
- movl 0(,%eax,4), %eax
- movl %edx, (%eax)
- movl %ecx, 4(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_2_end )
-
-#if defined(USE_SSE_ASM)
-/**
- * This can be used as a template for either Color3fv (when the color
- * target is also a 3f) or Normal3fv.
- */
-
-GLOBL( _sse_Attribute3fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movl 8(%eax), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3fv_end )
-
-/**
- * This can be used as a template for either Color3f (when the color
- * target is also a 3f) or Normal3f.
- */
-
-GLOBL( _sse_Attribute3f )
- movlps 4(%esp), %xmm0
- movl 12(%esp), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2f )
- movlps 4(%esp), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2f_end )
-
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $7, %eax
- movlps (%ecx), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-GLOBL( _sse_MultiTexCoord2fv_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $0x7, %eax
- movl 0(,%eax,4), %edx
- movlps (%ecx), %xmm0
- movlps %xmm0, (%edx)
- ret
-GLOBL( _sse_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2f )
- movl 4(%esp), %eax
- and $7, %eax
- movlps 8(%esp), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _sse_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movlps 8(%esp), %xmm0
- and $7,%eax
- movl 0(,%eax,4), %eax
- movlps %xmm0, (%eax)
- ret
-GLOBL( _sse_MultiTexCoord2f_2_end )
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/Makefile
deleted file mode 100644
index 57c7fc7aa..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/Makefile
+++ /dev/null
@@ -1,83 +0,0 @@
-# src/mesa/drivers/dri/r300/Makefile
-
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = r300_dri.so
-DEFINES += -DCOMPILE_R300 -DGLX_DIRECT_RENDERING -DR200_MERGED=0
-
-MINIGLX_SOURCES = server/radeon_dri.c
-
-COMMON_SOURCES = \
- ../../common/driverfuncs.c \
- ../common/mm.c \
- ../common/utils.c \
- ../common/texmem.c \
- ../common/vblank.c \
- ../common/xmlconfig.c \
- ../common/dri_util.c
-
-DRIVER_SOURCES = \
- radeon_screen.c \
- radeon_context.c \
- radeon_ioctl.c \
- radeon_lock.c \
- radeon_span.c \
- radeon_state.c \
- \
- r300_context.c \
- r300_ioctl.c \
- r300_cmdbuf.c \
- r300_state.c \
- r300_render.c \
- r300_texmem.c \
- r300_tex.c \
- r300_texstate.c \
- r300_texprog.c \
- r300_vertexprog.c \
- r300_fragprog.c \
- r300_shader.c \
- r300_maos.c
-# \
-# r200_context.c \
-# r200_ioctl.c \
-# r200_state.c \
-# r200_state_init.c \
-# r200_cmdbuf.c \
-# r200_pixel.c \
-# r200_tex.c \
-# r200_texmem.c \
-# r200_texstate.c \
-# r200_swtcl.c \
-# r200_maos.c \
-# r200_sanity.c \
-# r200_vtxfmt.c \
-# r200_vtxfmt_c.c \
-# r200_vtxfmt_sse.c \
-# r200_vtxfmt_x86.c
-
-
-C_SOURCES = $(COMMON_SOURCES) $(DRIVER_SOURCES)
-
-X86_SOURCES =
-#r200_vtxtmp_x86.S
-
-SYMLINKS = \
- server/radeon_dri.c \
- server/radeon_dri.h \
- server/radeon.h \
- server/radeon_macros.h \
- server/radeon_reg.h
-
-##### TARGETS #####
-
-
-include ../Makefile.template
-
-$(SYMLINKS):
- mkdir -p server
- for i in $(SYMLINKS) ; do rm -f $$i && test -f ../radeon/$$i && ln -s ../../radeon/$$i $$i ; done
-
-symlinks: $(SYMLINKS)
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/pixel_shader.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/pixel_shader.h
deleted file mode 100644
index 0d04859f9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/pixel_shader.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef __PIXEL_SHADER_H__
-#define __PIXEL_SHADER_H__
-
-#include "r300_reg.h"
-
-
-/* INSTR 0 */
-
-#define PFS_OP_MAD 0
-#define PFS_OP_DP3 1
-#define PFS_OP_DP4 2
-#define PFS_OP_MIN 4
-#define PFS_OP_MAX 5
-#define PFS_OP_CMP 8
-#define PFS_OP_FRC 9
-#define PFS_OP_OUTC_REPL_ALPHA 10
-
-/* "or" these with arg0 value to negate or take absolute value of an argument */
-#define PFS_ARG_NEG (1<<5)
-#define PFS_ARG_ABS (1<<6)
-
-#define MAKE_PFS_INSTR0(op, arg0, arg1, arg2, flags) \
- ( ((op)<<23) \
- | ((arg0)<<R300_FPI0_ARG0C_SHIFT) \
- | ((arg1)<<R300_FPI0_ARG1C_SHIFT) \
- | ((arg2)<<R300_FPI0_ARG2C_SHIFT) \
- | (flags) \
- )
-
-#define PFS_FLAG_X 1
-#define PFS_FLAG_Y 2
-#define PFS_FLAG_XY 3
-#define PFS_FLAG_Z 4
-#define PFS_FLAG_XZ 5
-#define PFS_FLAG_YZ 6
-#define PFS_FLAG_ALL 7
-#define PFS_FLAG_NONE 0
-
-#define EASY_PFS_INSTR0(op, arg0, arg1, arg2) \
- MAKE_PFS_INSTR0(PFS_OP_##op, \
- R300_FPI0_ARGC_##arg0, \
- R300_FPI0_ARGC_##arg1, \
- R300_FPI0_ARGC_##arg2, \
- 0)
-
-/* INSTR 1 */
-
-#define PFS_FLAG_CONST (1<<5)
-
-#define MAKE_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
- ((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
- | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
- | ((dstc) << R300_FPI1_DSTC_SHIFT) \
- | ((reg) << 23) | ((output)<<26))
-
-#define EASY_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
- MAKE_PFS_INSTR1(dstc, src0, src1, src2, PFS_FLAG_##reg, PFS_FLAG_##output)
-
-/* INSTR 2 */
-
-/* you can "or" PFS_ARG_NEG with these values to negate them */
-
-#define MAKE_PFS_INSTR2(op, arg0, arg1, arg2, flags) \
- (((op) << 23) | \
- ((arg0)<<R300_FPI2_ARG0A_SHIFT) | \
- ((arg1)<<R300_FPI2_ARG1A_SHIFT) | \
- ((arg2)<<R300_FPI2_ARG2A_SHIFT) | \
- (flags))
-
-#define EASY_PFS_INSTR2(op, arg0, arg1, arg2) \
- MAKE_PFS_INSTR2(R300_FPI2_OUTA_##op, \
- R300_FPI2_ARGA_##arg0, \
- R300_FPI2_ARGA_##arg1, \
- R300_FPI2_ARGA_##arg2, \
- 0)
-
-
-/* INSTR 3 */
-
-#define PFS_FLAG_NONE 0
-#define PFS_FLAG_REG 1
-#define PFS_FLAG_OUTPUT 2
-#define PFS_FLAG_BOTH 3
-
-#define MAKE_PFS_INSTR3(dstc, src0, src1, src2, flags) \
- ((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
- | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
- | ((dstc) << R300_FPI1_DSTC_SHIFT) \
- | ((flags) << 23))
-
-#define EASY_PFS_INSTR3(dstc, src0, src1, src2, flag) \
- MAKE_PFS_INSTR3(dstc, src0, src1, src2, PFS_FLAG_##flag)
-
- /* What are 0's ORed with flags ? They are register numbers that
- just happen to be 0 */
-#define PFS_NOP { \
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO), \
- EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL), \
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO), \
- EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT) \
- }
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_context.h
deleted file mode 100644
index 2c1eda33f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_context.h
+++ /dev/null
@@ -1,822 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_CONTEXT_H__
-#define __R200_CONTEXT_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "tnl/t_vertex.h"
-#include "drm.h"
-#include "radeon_drm.h"
-#include "dri_util.h"
-#include "texmem.h"
-
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "r200_reg.h"
-#include "radeon_context.h"
-
-#define ENABLE_HW_3D_TEXTURE 1 /* XXX this is temporary! */
-
-struct r200_context;
-typedef struct r200_context r200ContextRec;
-typedef struct r200_context *r200ContextPtr;
-
-#include "mm.h"
-
-/* The blit width for texture uploads
- */
-#define BLIT_WIDTH_BYTES 1024
-
-/* Use the templated vertex format:
- */
-#define COLOR_IS_RGBA
-#define TAG(x) r200##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*r200_tri_func) (r200ContextPtr,
- r200Vertex *, r200Vertex *, r200Vertex *);
-
-typedef void (*r200_line_func) (r200ContextPtr, r200Vertex *, r200Vertex *);
-
-typedef void (*r200_point_func) (r200ContextPtr, r200Vertex *);
-
-struct r200_depthbuffer_state {
- GLfloat scale;
-};
-
-struct r200_stencilbuffer_state {
- GLboolean hwBuffer;
- GLuint clear; /* rb3d_stencilrefmask value */
-};
-
-struct r200_stipple_state {
- GLuint mask[32];
-};
-
-typedef struct r200_tex_obj r200TexObj, *r200TexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct r200_tex_obj {
- driTextureObject base;
-
- GLuint bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint dirty_state; /* Flags (1 per texunit) for
- whether or not this texobj
- has dirty hardware state
- (pp_*) that needs to be
- brought into the
- texunit. */
-
- drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
- /* Six, for the cube faces */
-
- GLuint pp_txfilter; /* hardware register values */
- GLuint pp_txformat;
- GLuint pp_txformat_x;
- GLuint pp_txoffset; /* Image location in texmem.
- All cube faces follow. */
- GLuint pp_txsize; /* npot only */
- GLuint pp_txpitch; /* npot only */
- GLuint pp_border_color;
- GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
-
- GLboolean border_fallback;
-};
-
-struct r200_texture_env_state {
- r200TexObjPtr texobj;
- GLenum format;
- GLenum envMode;
-};
-
-#define R200_MAX_TEXTURE_UNITS 6
-
-struct r200_texture_state {
- struct r200_texture_env_state unit[R200_MAX_TEXTURE_UNITS];
-};
-
-struct r200_state_atom {
- struct r200_state_atom *next, *prev;
- const char *name; /* for debug */
- int cmd_size; /* size in bytes */
- GLuint idx;
- int *cmd; /* one or more cmd's */
- int *lastcmd; /* one or more cmd's */
- int *savedcmd; /* one or more cmd's */
- GLboolean dirty;
- GLboolean(*check) (GLcontext *, int); /* is this state active? */
-};
-
-/* Trying to keep these relatively short as the variables are becoming
- * extravagently long. Drop the driver name prefix off the front of
- * everything - I think we know which driver we're in by now, and keep the
- * prefix to 3 letters unless absolutely impossible.
- */
-
-#define CTX_CMD_0 0
-#define CTX_PP_MISC 1
-#define CTX_PP_FOG_COLOR 2
-#define CTX_RE_SOLID_COLOR 3
-#define CTX_RB3D_BLENDCNTL 4
-#define CTX_RB3D_DEPTHOFFSET 5
-#define CTX_RB3D_DEPTHPITCH 6
-#define CTX_RB3D_ZSTENCILCNTL 7
-#define CTX_CMD_1 8
-#define CTX_PP_CNTL 9
-#define CTX_RB3D_CNTL 10
-#define CTX_RB3D_COLOROFFSET 11
-#define CTX_CMD_2 12 /* why */
-#define CTX_RB3D_COLORPITCH 13 /* why */
-#define CTX_STATE_SIZE_OLDDRM 14
-#define CTX_CMD_3 14
-#define CTX_RB3D_BLENDCOLOR 15
-#define CTX_RB3D_ABLENDCNTL 16
-#define CTX_RB3D_CBLENDCNTL 17
-#define CTX_STATE_SIZE_NEWDRM 18
-
-#define SET_CMD_0 0
-#define SET_SE_CNTL 1
-#define SET_RE_CNTL 2 /* replace se_coord_fmt */
-#define SET_STATE_SIZE 3
-
-#define VTE_CMD_0 0
-#define VTE_SE_VTE_CNTL 1
-#define VTE_STATE_SIZE 2
-
-#define LIN_CMD_0 0
-#define LIN_RE_LINE_PATTERN 1
-#define LIN_RE_LINE_STATE 2
-#define LIN_CMD_1 3
-#define LIN_SE_LINE_WIDTH 4
-#define LIN_STATE_SIZE 5
-
-#define MSK_CMD_0 0
-#define MSK_RB3D_STENCILREFMASK 1
-#define MSK_RB3D_ROPCNTL 2
-#define MSK_RB3D_PLANEMASK 3
-#define MSK_STATE_SIZE 4
-
-#define VPT_CMD_0 0
-#define VPT_SE_VPORT_XSCALE 1
-#define VPT_SE_VPORT_XOFFSET 2
-#define VPT_SE_VPORT_YSCALE 3
-#define VPT_SE_VPORT_YOFFSET 4
-#define VPT_SE_VPORT_ZSCALE 5
-#define VPT_SE_VPORT_ZOFFSET 6
-#define VPT_STATE_SIZE 7
-
-#define ZBS_CMD_0 0
-#define ZBS_SE_ZBIAS_FACTOR 1
-#define ZBS_SE_ZBIAS_CONSTANT 2
-#define ZBS_STATE_SIZE 3
-
-#define MSC_CMD_0 0
-#define MSC_RE_MISC 1
-#define MSC_STATE_SIZE 2
-
-#define TAM_CMD_0 0
-#define TAM_DEBUG3 1
-#define TAM_STATE_SIZE 2
-
-#define TEX_CMD_0 0
-#define TEX_PP_TXFILTER 1 /*2c00 */
-#define TEX_PP_TXFORMAT 2 /*2c04 */
-#define TEX_PP_TXFORMAT_X 3 /*2c08 */
-#define TEX_PP_TXSIZE 4 /*2c0c */
-#define TEX_PP_TXPITCH 5 /*2c10 */
-#define TEX_PP_BORDER_COLOR 6 /*2c14 */
-#define TEX_CMD_1 7
-#define TEX_PP_TXOFFSET 8 /*2d00 */
-#define TEX_STATE_SIZE 9
-
-#define CUBE_CMD_0 0 /* 1 register follows */
-#define CUBE_PP_CUBIC_FACES 1 /* 0x2c18 */
-#define CUBE_CMD_1 2 /* 5 registers follow */
-#define CUBE_PP_CUBIC_OFFSET_F1 3 /* 0x2d04 */
-#define CUBE_PP_CUBIC_OFFSET_F2 4 /* 0x2d08 */
-#define CUBE_PP_CUBIC_OFFSET_F3 5 /* 0x2d0c */
-#define CUBE_PP_CUBIC_OFFSET_F4 6 /* 0x2d10 */
-#define CUBE_PP_CUBIC_OFFSET_F5 7 /* 0x2d14 */
-#define CUBE_STATE_SIZE 8
-
-#define PIX_CMD_0 0
-#define PIX_PP_TXCBLEND 1
-#define PIX_PP_TXCBLEND2 2
-#define PIX_PP_TXABLEND 3
-#define PIX_PP_TXABLEND2 4
-#define PIX_STATE_SIZE 5
-
-#define TF_CMD_0 0
-#define TF_TFACTOR_0 1
-#define TF_TFACTOR_1 2
-#define TF_TFACTOR_2 3
-#define TF_TFACTOR_3 4
-#define TF_TFACTOR_4 5
-#define TF_TFACTOR_5 6
-#define TF_STATE_SIZE 7
-
-#define TCL_CMD_0 0
-#define TCL_LIGHT_MODEL_CTL_0 1
-#define TCL_LIGHT_MODEL_CTL_1 2
-#define TCL_PER_LIGHT_CTL_0 3
-#define TCL_PER_LIGHT_CTL_1 4
-#define TCL_PER_LIGHT_CTL_2 5
-#define TCL_PER_LIGHT_CTL_3 6
-#define TCL_CMD_1 7
-#define TCL_UCP_VERT_BLEND_CTL 8
-#define TCL_STATE_SIZE 9
-
-#define MSL_CMD_0 0
-#define MSL_MATRIX_SELECT_0 1
-#define MSL_MATRIX_SELECT_1 2
-#define MSL_MATRIX_SELECT_2 3
-#define MSL_MATRIX_SELECT_3 4
-#define MSL_MATRIX_SELECT_4 5
-#define MSL_STATE_SIZE 6
-
-#define TCG_CMD_0 0
-#define TCG_TEX_PROC_CTL_2 1
-#define TCG_TEX_PROC_CTL_3 2
-#define TCG_TEX_PROC_CTL_0 3
-#define TCG_TEX_PROC_CTL_1 4
-#define TCG_TEX_CYL_WRAP_CTL 5
-#define TCG_STATE_SIZE 6
-
-#define MTL_CMD_0 0
-#define MTL_EMMISSIVE_RED 1
-#define MTL_EMMISSIVE_GREEN 2
-#define MTL_EMMISSIVE_BLUE 3
-#define MTL_EMMISSIVE_ALPHA 4
-#define MTL_AMBIENT_RED 5
-#define MTL_AMBIENT_GREEN 6
-#define MTL_AMBIENT_BLUE 7
-#define MTL_AMBIENT_ALPHA 8
-#define MTL_DIFFUSE_RED 9
-#define MTL_DIFFUSE_GREEN 10
-#define MTL_DIFFUSE_BLUE 11
-#define MTL_DIFFUSE_ALPHA 12
-#define MTL_SPECULAR_RED 13
-#define MTL_SPECULAR_GREEN 14
-#define MTL_SPECULAR_BLUE 15
-#define MTL_SPECULAR_ALPHA 16
-#define MTL_CMD_1 17
-#define MTL_SHININESS 18
-#define MTL_STATE_SIZE 19
-
-#define VAP_CMD_0 0
-#define VAP_SE_VAP_CNTL 1
-#define VAP_STATE_SIZE 2
-
-/* Replaces a lot of packet info from radeon
- */
-#define VTX_CMD_0 0
-#define VTX_VTXFMT_0 1
-#define VTX_VTXFMT_1 2
-#define VTX_TCL_OUTPUT_VTXFMT_0 3
-#define VTX_TCL_OUTPUT_VTXFMT_1 4
-#define VTX_CMD_1 5
-#define VTX_TCL_OUTPUT_COMPSEL 6
-#define VTX_CMD_2 7
-#define VTX_STATE_CNTL 8
-#define VTX_STATE_SIZE 9
-
-#define VTX_COLOR(v,n) (((v)>>(R200_VTX_COLOR_0_SHIFT+(n)*2))&\
- R200_VTX_COLOR_MASK)
-
-/**
- * Given the \c R200_SE_VTX_FMT_1 for the current vertex state, determine
- * how many components are in texture coordinate \c n.
- */
-#define VTX_TEXn_COUNT(v,n) (((v) >> (3 * n)) & 0x07)
-
-#define MAT_CMD_0 0
-#define MAT_ELT_0 1
-#define MAT_STATE_SIZE 17
-
-#define GRD_CMD_0 0
-#define GRD_VERT_GUARD_CLIP_ADJ 1
-#define GRD_VERT_GUARD_DISCARD_ADJ 2
-#define GRD_HORZ_GUARD_CLIP_ADJ 3
-#define GRD_HORZ_GUARD_DISCARD_ADJ 4
-#define GRD_STATE_SIZE 5
-
-/* position changes frequently when lighting in modelpos - separate
- * out to new state item?
- */
-#define LIT_CMD_0 0
-#define LIT_AMBIENT_RED 1
-#define LIT_AMBIENT_GREEN 2
-#define LIT_AMBIENT_BLUE 3
-#define LIT_AMBIENT_ALPHA 4
-#define LIT_DIFFUSE_RED 5
-#define LIT_DIFFUSE_GREEN 6
-#define LIT_DIFFUSE_BLUE 7
-#define LIT_DIFFUSE_ALPHA 8
-#define LIT_SPECULAR_RED 9
-#define LIT_SPECULAR_GREEN 10
-#define LIT_SPECULAR_BLUE 11
-#define LIT_SPECULAR_ALPHA 12
-#define LIT_POSITION_X 13
-#define LIT_POSITION_Y 14
-#define LIT_POSITION_Z 15
-#define LIT_POSITION_W 16
-#define LIT_DIRECTION_X 17
-#define LIT_DIRECTION_Y 18
-#define LIT_DIRECTION_Z 19
-#define LIT_DIRECTION_W 20
-#define LIT_ATTEN_QUADRATIC 21
-#define LIT_ATTEN_LINEAR 22
-#define LIT_ATTEN_CONST 23
-#define LIT_ATTEN_XXX 24
-#define LIT_CMD_1 25
-#define LIT_SPOT_DCD 26
-#define LIT_SPOT_DCM 27
-#define LIT_SPOT_EXPONENT 28
-#define LIT_SPOT_CUTOFF 29
-#define LIT_SPECULAR_THRESH 30
-#define LIT_RANGE_CUTOFF 31 /* ? */
-#define LIT_ATTEN_CONST_INV 32
-#define LIT_STATE_SIZE 33
-
-/* Fog
- */
-#define FOG_CMD_0 0
-#define FOG_R 1
-#define FOG_C 2
-#define FOG_D 3
-#define FOG_PAD 4
-#define FOG_STATE_SIZE 5
-
-/* UCP
- */
-#define UCP_CMD_0 0
-#define UCP_X 1
-#define UCP_Y 2
-#define UCP_Z 3
-#define UCP_W 4
-#define UCP_STATE_SIZE 5
-
-/* GLT - Global ambient
- */
-#define GLT_CMD_0 0
-#define GLT_RED 1
-#define GLT_GREEN 2
-#define GLT_BLUE 3
-#define GLT_ALPHA 4
-#define GLT_STATE_SIZE 5
-
-/* EYE
- */
-#define EYE_CMD_0 0
-#define EYE_X 1
-#define EYE_Y 2
-#define EYE_Z 3
-#define EYE_RESCALE_FACTOR 4
-#define EYE_STATE_SIZE 5
-
-/* CST - constant state
- */
-#define CST_CMD_0 0
-#define CST_PP_CNTL_X 1
-#define CST_CMD_1 2
-#define CST_RB3D_DEPTHXY_OFFSET 3
-#define CST_CMD_2 4
-#define CST_RE_AUX_SCISSOR_CNTL 5
-#define CST_CMD_3 6
-#define CST_RE_SCISSOR_TL_0 7
-#define CST_RE_SCISSOR_BR_0 8
-#define CST_CMD_4 9
-#define CST_SE_VAP_CNTL_STATUS 10
-#define CST_CMD_5 11
-#define CST_RE_POINTSIZE 12
-#define CST_CMD_6 13
-#define CST_SE_TCL_INPUT_VTX_0 14
-#define CST_SE_TCL_INPUT_VTX_1 15
-#define CST_SE_TCL_INPUT_VTX_2 16
-#define CST_SE_TCL_INPUT_VTX_3 17
-#define CST_STATE_SIZE 18
-
-struct r200_hw_state {
- /* Head of the linked list of state atoms. */
- struct r200_state_atom atomlist;
-
- /* Hardware state, stored as cmdbuf commands:
- * -- Need to doublebuffer for
- * - reviving state after loss of context
- * - eliding noop statechange loops? (except line stipple count)
- */
- struct r200_state_atom ctx;
- struct r200_state_atom set;
- struct r200_state_atom vte;
- struct r200_state_atom lin;
- struct r200_state_atom msk;
- struct r200_state_atom vpt;
- struct r200_state_atom vap;
- struct r200_state_atom vtx;
- struct r200_state_atom tcl;
- struct r200_state_atom msl;
- struct r200_state_atom tcg;
- struct r200_state_atom msc;
- struct r200_state_atom cst;
- struct r200_state_atom tam;
- struct r200_state_atom tf;
- struct r200_state_atom tex[6];
- struct r200_state_atom cube[6];
- struct r200_state_atom zbs;
- struct r200_state_atom mtl[2];
- struct r200_state_atom mat[9];
- struct r200_state_atom lit[8]; /* includes vec, scl commands */
- struct r200_state_atom ucp[6];
- struct r200_state_atom pix[6]; /* pixshader stages */
- struct r200_state_atom eye; /* eye pos */
- struct r200_state_atom grd; /* guard band clipping */
- struct r200_state_atom fog;
- struct r200_state_atom glt;
-
- int max_state_size; /* Number of bytes necessary for a full state emit. */
- GLboolean is_dirty, all_dirty;
-};
-
-struct r200_colorbuffer_state {
- int roundEnable;
-};
-
-struct r200_state {
- /* Derived state for internal purposes:
- */
- struct r200_colorbuffer_state color;
- struct r200_depthbuffer_state depth;
- struct r200_stencilbuffer_state stencil;
- struct r200_stipple_state stipple;
- struct r200_texture_state texture;
-};
-
-/* Need refcounting on dma buffers:
- */
-struct r200_dma_buffer {
- int refcount; /* the number of retained regions in buf */
- drmBufPtr buf;
-};
-
-#define GET_START(rvb) (rmesa->radeon.radeonScreen->gart_buffer_offset + \
- (rvb)->address - rmesa->dma.buf0_address + \
- (rvb)->start)
-
-/* A retained region, eg vertices for indexed vertices.
- */
-struct r200_dma_region {
- struct r200_dma_buffer *buf;
- char *address; /* == buf->address */
- int start, end, ptr; /* offsets from start of buf */
- int aos_start;
- int aos_stride;
- int aos_size;
-};
-
-struct r200_dma {
- /* Active dma region. Allocations for vertices and retained
- * regions come from here. Also used for emitting random vertices,
- * these may be flushed by calling flush_current();
- */
- struct r200_dma_region current;
-
- void (*flush) (r200ContextPtr);
-
- char *buf0_address; /* start of buf[0], for index calcs */
- GLuint nr_released_bufs; /* flush after so many buffers released */
-};
-
-#define R200_CMD_BUF_SZ (8*1024)
-
-struct r200_store {
- GLuint statenr;
- GLuint primnr;
- char cmd_buf[R200_CMD_BUF_SZ];
- int cmd_used;
- int elts_start;
-};
-
-/* r200_tcl.c
- */
-struct r200_tcl_info {
- GLuint vertex_format;
- GLint last_offset;
- GLuint hw_primitive;
-
- struct r200_dma_region *aos_components[8];
- GLuint nr_aos_components;
-
- GLuint *Elts;
-
- struct r200_dma_region indexed_verts;
- struct r200_dma_region obj;
- struct r200_dma_region rgba;
- struct r200_dma_region spec;
- struct r200_dma_region fog;
- struct r200_dma_region tex[R200_MAX_TEXTURE_UNITS];
- struct r200_dma_region norm;
-};
-
-/* r200_swtcl.c
- */
-struct r200_swtcl_info {
- GLuint RenderIndex;
-
- /**
- * Size of a hardware vertex. This is calculated when \c ::vertex_attrs is
- * installed in the Mesa state vector.
- */
- GLuint vertex_size;
-
- /**
- * Attributes instructing the Mesa TCL pipeline where / how to put vertex
- * data in the hardware buffer.
- */
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
-
- /**
- * Number of elements of \c ::vertex_attrs that are actually used.
- */
- GLuint vertex_attr_count;
-
- /**
- * Cached pointer to the buffer where Mesa will store vertex data.
- */
- GLubyte *verts;
-
- /* Fallback rasterization functions
- */
- r200_point_func draw_point;
- r200_line_func draw_line;
- r200_tri_func draw_tri;
-
- GLuint hw_primitive;
- GLenum render_primitive;
- GLuint numverts;
-
- /**
- * Offset of the 4UB color data within a hardware (swtcl) vertex.
- */
- GLuint coloroffset;
-
- /**
- * Offset of the 3UB specular color data within a hardware (swtcl) vertex.
- */
- GLuint specoffset;
-
- /**
- * Should Mesa project vertex data or will the hardware do it?
- */
- GLboolean needproj;
-
- struct r200_dma_region indexed_verts;
-};
-
-struct r200_ioctl {
- GLuint vertex_offset;
- GLuint vertex_size;
-};
-
-#define R200_MAX_PRIMS 64
-
-/* Want to keep a cache of these around. Each is parameterized by
- * only a single value which has only a small range. Only expect a
- * few, so just rescan the list each time?
- */
-struct dynfn {
- struct dynfn *next, *prev;
- int key[2];
- char *code;
-};
-
-struct dfn_lists {
- struct dynfn Vertex2f;
- struct dynfn Vertex2fv;
- struct dynfn Vertex3f;
- struct dynfn Vertex3fv;
- struct dynfn Color4ub;
- struct dynfn Color4ubv;
- struct dynfn Color3ub;
- struct dynfn Color3ubv;
- struct dynfn Color4f;
- struct dynfn Color4fv;
- struct dynfn Color3f;
- struct dynfn Color3fv;
- struct dynfn SecondaryColor3ubEXT;
- struct dynfn SecondaryColor3ubvEXT;
- struct dynfn SecondaryColor3fEXT;
- struct dynfn SecondaryColor3fvEXT;
- struct dynfn Normal3f;
- struct dynfn Normal3fv;
- struct dynfn TexCoord3f;
- struct dynfn TexCoord3fv;
- struct dynfn TexCoord2f;
- struct dynfn TexCoord2fv;
- struct dynfn TexCoord1f;
- struct dynfn TexCoord1fv;
- struct dynfn MultiTexCoord3fARB;
- struct dynfn MultiTexCoord3fvARB;
- struct dynfn MultiTexCoord2fARB;
- struct dynfn MultiTexCoord2fvARB;
- struct dynfn MultiTexCoord1fARB;
- struct dynfn MultiTexCoord1fvARB;
-};
-
-struct dfn_generators {
- struct dynfn *(*Vertex2f) (GLcontext *, const int *);
- struct dynfn *(*Vertex2fv) (GLcontext *, const int *);
- struct dynfn *(*Vertex3f) (GLcontext *, const int *);
- struct dynfn *(*Vertex3fv) (GLcontext *, const int *);
- struct dynfn *(*Color4ub) (GLcontext *, const int *);
- struct dynfn *(*Color4ubv) (GLcontext *, const int *);
- struct dynfn *(*Color3ub) (GLcontext *, const int *);
- struct dynfn *(*Color3ubv) (GLcontext *, const int *);
- struct dynfn *(*Color4f) (GLcontext *, const int *);
- struct dynfn *(*Color4fv) (GLcontext *, const int *);
- struct dynfn *(*Color3f) (GLcontext *, const int *);
- struct dynfn *(*Color3fv) (GLcontext *, const int *);
- struct dynfn *(*SecondaryColor3ubEXT) (GLcontext *, const int *);
- struct dynfn *(*SecondaryColor3ubvEXT) (GLcontext *, const int *);
- struct dynfn *(*SecondaryColor3fEXT) (GLcontext *, const int *);
- struct dynfn *(*SecondaryColor3fvEXT) (GLcontext *, const int *);
- struct dynfn *(*Normal3f) (GLcontext *, const int *);
- struct dynfn *(*Normal3fv) (GLcontext *, const int *);
- struct dynfn *(*TexCoord3f) (GLcontext *, const int *);
- struct dynfn *(*TexCoord3fv) (GLcontext *, const int *);
- struct dynfn *(*TexCoord2f) (GLcontext *, const int *);
- struct dynfn *(*TexCoord2fv) (GLcontext *, const int *);
- struct dynfn *(*TexCoord1f) (GLcontext *, const int *);
- struct dynfn *(*TexCoord1fv) (GLcontext *, const int *);
- struct dynfn *(*MultiTexCoord3fARB) (GLcontext *, const int *);
- struct dynfn *(*MultiTexCoord3fvARB) (GLcontext *, const int *);
- struct dynfn *(*MultiTexCoord2fARB) (GLcontext *, const int *);
- struct dynfn *(*MultiTexCoord2fvARB) (GLcontext *, const int *);
- struct dynfn *(*MultiTexCoord1fARB) (GLcontext *, const int *);
- struct dynfn *(*MultiTexCoord1fvARB) (GLcontext *, const int *);
-};
-
-struct r200_prim {
- GLuint start;
- GLuint end;
- GLuint prim;
-};
-
- /* A maximum total of 29 elements per vertex: 3 floats for position, 3
- * floats for normal, 4 floats for color, 4 bytes for secondary color,
- * 3 floats for each texture unit (18 floats total).
- *
- * we maybe need add. 4 to prevent segfault if someone specifies
- * GL_TEXTURE6/GL_TEXTURE7 (esp. for the codegen-path) (FIXME: )
- *
- * The position data is never actually stored here, so 3 elements could be
- * trimmed out of the buffer.
- */
-
-#define R200_MAX_VERTEX_SIZE ((3*6)+11)
-
-struct r200_vbinfo {
- GLint counter, initial_counter;
- GLint *dmaptr;
- void (*notify) (void);
- GLint vertex_size;
-
- union {
- float f;
- int i;
- r200_color_t color;
- } vertex[R200_MAX_VERTEX_SIZE];
-
- GLfloat *normalptr;
- GLfloat *floatcolorptr;
- r200_color_t *colorptr;
- GLfloat *floatspecptr;
- r200_color_t *specptr;
- GLfloat *texcoordptr[8]; /* 6 (TMU) + 2 for r200_vtxfmt_c.c when GL_TEXTURE6/7 */
-
- GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */
- GLuint primflags;
- GLboolean enabled; /* *_NO_VTXFMT / *_NO_TCL env vars */
- GLboolean installed;
- GLboolean fell_back;
- GLboolean recheck;
- GLint nrverts;
- GLuint vtxfmt_0, vtxfmt_1;
-
- GLuint installed_vertex_format;
- GLuint installed_color_3f_sz;
-
- struct r200_prim primlist[R200_MAX_PRIMS];
- int nrprims;
-
- struct dfn_lists dfn_cache;
- struct dfn_generators codegen;
- GLvertexformat vtxfmt;
-};
-
-/**
- * R200 context structure.
- */
-struct r200_context {
- struct radeon_context radeon; /* parent class, must be first */
-
- /* Driver and hardware state management
- */
- struct r200_hw_state hw;
- struct r200_state state;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap *texture_heaps[R200_NR_TEX_HEAPS];
- driTextureObject swapped;
- int texture_depth;
- float initialMaxAnisotropy;
-
- /* Rasterization and vertex state:
- */
- GLuint NewGLState;
-
- /* Vertex buffers
- */
- struct r200_ioctl ioctl;
- struct r200_dma dma;
- struct r200_store store;
- GLboolean save_on_next_unlock;
-
- /* Clientdata textures;
- */
- GLuint prefer_gart_client_texturing;
-
- /* TCL stuff
- */
- GLmatrix TexGenMatrix[R200_MAX_TEXTURE_UNITS];
- GLboolean recheck_texgen[R200_MAX_TEXTURE_UNITS];
- GLboolean TexGenNeedNormals[R200_MAX_TEXTURE_UNITS];
- GLuint TexMatEnabled;
- GLuint TexMatCompSel;
- GLuint TexGenEnabled;
- GLuint TexGenInputs;
- GLuint TexGenCompSel;
- GLmatrix tmpmat;
-
- /* r200_tcl.c
- */
- struct r200_tcl_info tcl;
-
- /* r200_swtcl.c
- */
- struct r200_swtcl_info swtcl;
-
- /* r200_vtxfmt.c
- */
- struct r200_vbinfo vb;
-};
-
-#define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx))
-
-extern void r200DestroyContext(__DRIcontextPrivate * driContextPriv);
-extern GLboolean r200CreateContext(const __GLcontextModes * glVisual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate);
-
-#endif
-#endif /* __R200_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_ioctl.h
deleted file mode 100644
index db7bd7697..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_ioctl.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_IOCTL_H__
-#define __R200_IOCTL_H__
-
-#include "simple_list.h"
-#include "radeon_dri.h"
-#include "radeon_lock.h"
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "r200_context.h"
-#include "radeon_drm.h"
-
-extern void r200EmitState(r200ContextPtr rmesa);
-extern void r200EmitVertexAOS(r200ContextPtr rmesa,
- GLuint vertex_size, GLuint offset);
-
-extern void r200EmitVbufPrim(r200ContextPtr rmesa,
- GLuint primitive, GLuint vertex_nr);
-
-extern void r200FlushElts(r200ContextPtr rmesa);
-
-extern GLushort *r200AllocEltsOpenEnded(r200ContextPtr rmesa,
- GLuint primitive, GLuint min_nr);
-
-extern void r200EmitAOS(r200ContextPtr rmesa,
- struct r200_dma_region **regions,
- GLuint n, GLuint offset);
-
-extern void r200EmitBlit(r200ContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty, GLuint w, GLuint h);
-
-extern void r200EmitWait(r200ContextPtr rmesa, GLuint flags);
-
-extern void r200FlushCmdBuf(r200ContextPtr rmesa, const char *);
-extern int r200FlushCmdBufLocked(r200ContextPtr rmesa, const char *caller);
-extern void r200Flush(GLcontext * ctx);
-
-extern void r200RefillCurrentDmaRegion(r200ContextPtr rmesa);
-
-extern void r200AllocDmaRegion(r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int bytes, int alignment);
-
-extern void r200AllocDmaRegionVerts(r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int numverts, int vertsize, int alignment);
-
-extern void r200ReleaseDmaRegion(r200ContextPtr rmesa,
- struct r200_dma_region *region,
- const char *caller);
-
-extern void r200WaitForVBlank(r200ContextPtr rmesa);
-extern void r200InitIoctlFuncs(struct dd_function_table *functions);
-
-extern void *r200AllocateMemoryMESA(__DRInativeDisplay * dpy, int scrn,
- GLsizei size, GLfloat readfreq,
- GLfloat writefreq, GLfloat priority);
-extern void r200FreeMemoryMESA(__DRInativeDisplay * dpy, int scrn,
- GLvoid * pointer);
-extern GLuint r200GetMemoryOffsetMESA(__DRInativeDisplay * dpy, int scrn,
- const GLvoid * pointer);
-
-extern GLboolean r200IsGartMemory(r200ContextPtr rmesa, const GLvoid * pointer,
- GLint size);
-
-extern GLuint r200GartOffsetFromVirtual(r200ContextPtr rmesa,
- const GLvoid * pointer);
-
-void r200SaveHwState(r200ContextPtr radeon);
-void r200SetUpAtomList(r200ContextPtr rmesa);
-
-/* ================================================================
- * Helper macros:
- */
-
-/* Close off the last primitive, if it exists.
- */
-#define R200_NEWPRIM( rmesa ) \
-do { \
- if ( rmesa->dma.flush ) \
- rmesa->dma.flush( rmesa ); \
-} while (0)
-
-/* Can accomodate several state changes and primitive changes without
- * actually firing the buffer.
- */
-#define R200_STATECHANGE( rmesa, ATOM ) \
-do { \
- R200_NEWPRIM( rmesa ); \
- rmesa->hw.ATOM.dirty = GL_TRUE; \
- rmesa->hw.is_dirty = GL_TRUE; \
-} while (0)
-
-#define R200_DB_STATE( ATOM ) \
- memcpy( rmesa->hw.ATOM.lastcmd, rmesa->hw.ATOM.cmd, \
- rmesa->hw.ATOM.cmd_size * 4)
-
-static __inline int R200_DB_STATECHANGE(r200ContextPtr rmesa,
- struct r200_state_atom *atom)
-{
- if (memcmp(atom->cmd, atom->lastcmd, atom->cmd_size * 4)) {
- int *tmp;
- R200_NEWPRIM(rmesa);
- atom->dirty = GL_TRUE;
- rmesa->hw.is_dirty = GL_TRUE;
- tmp = atom->cmd;
- atom->cmd = atom->lastcmd;
- atom->lastcmd = tmp;
- return 1;
- } else
- return 0;
-}
-
-/* Fire the buffered vertices no matter what.
- */
-#define R200_FIREVERTICES( r200 ) \
-do { \
- if ( (r200)->store.cmd_used || (r200)->dma.flush ) { \
- radeonFlush( (r200)->radeon.glCtx ); \
- } \
-} while (0)
-
-/* Command lengths. Note that any time you ensure ELTS_BUFSZ or VBUF_BUFSZ
- * are available, you will also be adding an rmesa->state.max_state_size because
- * r200EmitState is called from within r200EmitVbufPrim and r200FlushElts.
- */
-#define AOS_BUFSZ(nr) ((3 + ((nr / 2) * 3) + ((nr & 1) * 2)) * sizeof(int))
-#define VERT_AOS_BUFSZ (5 * sizeof(int))
-#define ELTS_BUFSZ(nr) (12 + nr * 2)
-#define VBUF_BUFSZ (3 * sizeof(int))
-
-/* Ensure that a minimum amount of space is available in the command buffer.
- * This is used to ensure atomicity of state updates with the rendering requests
- * that rely on them.
- *
- * An alternative would be to implement a "soft lock" such that when the buffer
- * wraps at an inopportune time, we grab the lock, flush the current buffer,
- * and hang on to the lock until the critical section is finished and we flush
- * the buffer again and unlock.
- */
-static __inline void r200EnsureCmdBufSpace(r200ContextPtr rmesa, int bytes)
-{
- if (rmesa->store.cmd_used + bytes > R200_CMD_BUF_SZ)
- r200FlushCmdBuf(rmesa, __FUNCTION__);
- assert(bytes <= R200_CMD_BUF_SZ);
-}
-
-/* Alloc space in the command buffer
- */
-static __inline char *r200AllocCmdBuf(r200ContextPtr rmesa,
- int bytes, const char *where)
-{
- char *head;
-
- if (rmesa->store.cmd_used + bytes > R200_CMD_BUF_SZ)
- r200FlushCmdBuf(rmesa, where);
-
- head = rmesa->store.cmd_buf + rmesa->store.cmd_used;
- rmesa->store.cmd_used += bytes;
- assert(rmesa->store.cmd_used <= R200_CMD_BUF_SZ);
- return head;
-}
-
-#endif /* __R200_IOCTL_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_reg.h
deleted file mode 100644
index 1336e961a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_reg.h
+++ /dev/null
@@ -1,1423 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_reg.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */
-/*
-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.
-*/
-
-#ifndef _R200_REG_H_
-#define _R200_REG_H_
-
-#define R200_PP_MISC 0x1c14
-#define R200_REF_ALPHA_MASK 0x000000ff
-#define R200_ALPHA_TEST_FAIL (0 << 8)
-#define R200_ALPHA_TEST_LESS (1 << 8)
-#define R200_ALPHA_TEST_LEQUAL (2 << 8)
-#define R200_ALPHA_TEST_EQUAL (3 << 8)
-#define R200_ALPHA_TEST_GEQUAL (4 << 8)
-#define R200_ALPHA_TEST_GREATER (5 << 8)
-#define R200_ALPHA_TEST_NEQUAL (6 << 8)
-#define R200_ALPHA_TEST_PASS (7 << 8)
-#define R200_ALPHA_TEST_OP_MASK (7 << 8)
-#define R200_CHROMA_FUNC_FAIL (0 << 16)
-#define R200_CHROMA_FUNC_PASS (1 << 16)
-#define R200_CHROMA_FUNC_NEQUAL (2 << 16)
-#define R200_CHROMA_FUNC_EQUAL (3 << 16)
-#define R200_CHROMA_KEY_NEAREST (0 << 18)
-#define R200_CHROMA_KEY_ZERO (1 << 18)
-#define R200_RIGHT_HAND_CUBE_D3D (0 << 24)
-#define R200_RIGHT_HAND_CUBE_OGL (1 << 24)
-#define R200_PP_FOG_COLOR 0x1c18
-#define R200_FOG_COLOR_MASK 0x00ffffff
-#define R200_FOG_VERTEX (0 << 24)
-#define R200_FOG_TABLE (1 << 24)
-#define R200_FOG_USE_DEPTH (0 << 25)
-#define R200_FOG_USE_W (1 << 25)
-#define R200_FOG_USE_DIFFUSE_ALPHA (2 << 25)
-#define R200_FOG_USE_SPEC_ALPHA (3 << 25)
-#define R200_FOG_USE_VTX_FOG (4 << 25)
-#define R200_FOG_USE_MASK (7 << 25)
-#define R200_RE_SOLID_COLOR 0x1c1c
-#define R200_RB3D_BLENDCNTL 0x1c20
-#define R200_COMB_FCN_MASK (7 << 12)
-#define R200_COMB_FCN_ADD_CLAMP (0 << 12)
-#define R200_COMB_FCN_ADD_NOCLAMP (1 << 12)
-#define R200_COMB_FCN_SUB_CLAMP (2 << 12)
-#define R200_COMB_FCN_SUB_NOCLAMP (3 << 12)
-#define R200_COMB_FCN_MIN (4 << 12)
-#define R200_COMB_FCN_MAX (5 << 12)
-#define R200_COMB_FCN_RSUB_CLAMP (6 << 12)
-#define R200_COMB_FCN_RSUB_NOCLAMP (7 << 12)
-#define R200_BLEND_GL_ZERO (32)
-#define R200_BLEND_GL_ONE (33)
-#define R200_BLEND_GL_SRC_COLOR (34)
-#define R200_BLEND_GL_ONE_MINUS_SRC_COLOR (35)
-#define R200_BLEND_GL_DST_COLOR (36)
-#define R200_BLEND_GL_ONE_MINUS_DST_COLOR (37)
-#define R200_BLEND_GL_SRC_ALPHA (38)
-#define R200_BLEND_GL_ONE_MINUS_SRC_ALPHA (39)
-#define R200_BLEND_GL_DST_ALPHA (40)
-#define R200_BLEND_GL_ONE_MINUS_DST_ALPHA (41)
-#define R200_BLEND_GL_SRC_ALPHA_SATURATE (42) /* src factor only */
-#define R200_BLEND_GL_CONST_COLOR (43)
-#define R200_BLEND_GL_ONE_MINUS_CONST_COLOR (44)
-#define R200_BLEND_GL_CONST_ALPHA (45)
-#define R200_BLEND_GL_ONE_MINUS_CONST_ALPHA (46)
-#define R200_BLEND_MASK (63)
-#define R200_SRC_BLEND_SHIFT (16)
-#define R200_DST_BLEND_SHIFT (24)
-#define R200_RB3D_DEPTHOFFSET 0x1c24
-#define R200_RB3D_DEPTHPITCH 0x1c28
-#define R200_DEPTHPITCH_MASK 0x00001ff8
-#define R200_DEPTH_ENDIAN_NO_SWAP (0 << 18)
-#define R200_DEPTH_ENDIAN_WORD_SWAP (1 << 18)
-#define R200_DEPTH_ENDIAN_DWORD_SWAP (2 << 18)
-#define R200_RB3D_ZSTENCILCNTL 0x1c2c
-#define R200_DEPTH_FORMAT_MASK (0xf << 0)
-#define R200_DEPTH_FORMAT_16BIT_INT_Z (0 << 0)
-#define R200_DEPTH_FORMAT_24BIT_INT_Z (2 << 0)
-#define R200_DEPTH_FORMAT_24BIT_FLOAT_Z (3 << 0)
-#define R200_DEPTH_FORMAT_32BIT_INT_Z (4 << 0)
-#define R200_DEPTH_FORMAT_32BIT_FLOAT_Z (5 << 0)
-#define R200_DEPTH_FORMAT_24BIT_FLOAT_W (9 << 0)
-#define R200_DEPTH_FORMAT_32BIT_FLOAT_W (11 << 0)
-#define R200_Z_TEST_NEVER (0 << 4)
-#define R200_Z_TEST_LESS (1 << 4)
-#define R200_Z_TEST_LEQUAL (2 << 4)
-#define R200_Z_TEST_EQUAL (3 << 4)
-#define R200_Z_TEST_GEQUAL (4 << 4)
-#define R200_Z_TEST_GREATER (5 << 4)
-#define R200_Z_TEST_NEQUAL (6 << 4)
-#define R200_Z_TEST_ALWAYS (7 << 4)
-#define R200_Z_TEST_MASK (7 << 4)
-#define R200_STENCIL_TEST_NEVER (0 << 12)
-#define R200_STENCIL_TEST_LESS (1 << 12)
-#define R200_STENCIL_TEST_LEQUAL (2 << 12)
-#define R200_STENCIL_TEST_EQUAL (3 << 12)
-#define R200_STENCIL_TEST_GEQUAL (4 << 12)
-#define R200_STENCIL_TEST_GREATER (5 << 12)
-#define R200_STENCIL_TEST_NEQUAL (6 << 12)
-#define R200_STENCIL_TEST_ALWAYS (7 << 12)
-#define R200_STENCIL_TEST_MASK (0x7 << 12)
-#define R200_STENCIL_FAIL_KEEP (0 << 16)
-#define R200_STENCIL_FAIL_ZERO (1 << 16)
-#define R200_STENCIL_FAIL_REPLACE (2 << 16)
-#define R200_STENCIL_FAIL_INC (3 << 16)
-#define R200_STENCIL_FAIL_DEC (4 << 16)
-#define R200_STENCIL_FAIL_INVERT (5 << 16)
-#define R200_STENCIL_FAIL_INC_WRAP (6 << 16)
-#define R200_STENCIL_FAIL_DEC_WRAP (7 << 16)
-#define R200_STENCIL_FAIL_MASK (0x7 << 16)
-#define R200_STENCIL_ZPASS_KEEP (0 << 20)
-#define R200_STENCIL_ZPASS_ZERO (1 << 20)
-#define R200_STENCIL_ZPASS_REPLACE (2 << 20)
-#define R200_STENCIL_ZPASS_INC (3 << 20)
-#define R200_STENCIL_ZPASS_DEC (4 << 20)
-#define R200_STENCIL_ZPASS_INVERT (5 << 20)
-#define R200_STENCIL_ZPASS_INC_WRAP (6 << 20)
-#define R200_STENCIL_ZPASS_DEC_WRAP (7 << 20)
-#define R200_STENCIL_ZPASS_MASK (0x7 << 20)
-#define R200_STENCIL_ZFAIL_KEEP (0 << 24)
-#define R200_STENCIL_ZFAIL_ZERO (1 << 24)
-#define R200_STENCIL_ZFAIL_REPLACE (2 << 24)
-#define R200_STENCIL_ZFAIL_INC (3 << 24)
-#define R200_STENCIL_ZFAIL_DEC (4 << 24)
-#define R200_STENCIL_ZFAIL_INVERT (5 << 24)
-#define R200_STENCIL_ZFAIL_INC_WRAP (6 << 24)
-#define R200_STENCIL_ZFAIL_DEC_WRAP (7 << 24)
-#define R200_STENCIL_ZFAIL_MASK (0x7 << 24)
-#define R200_Z_WRITE_ENABLE (1 << 30)
-/*gap*/
-#define R200_PP_CNTL 0x1c38
-#define R200_TEX_0_ENABLE 0x00000010
-#define R200_TEX_1_ENABLE 0x00000020
-#define R200_TEX_2_ENABLE 0x00000040
-#define R200_TEX_3_ENABLE 0x00000080
-#define R200_TEX_4_ENABLE 0x00000100
-#define R200_TEX_5_ENABLE 0x00000200
-#define R200_TEX_ENABLE_MASK 0x000003f0
-#define R200_FILTER_ROUND_MODE_MASK 0x00000400
-#define R200_TEX_BLEND_7_ENABLE 0x00000800
-#define R200_TEX_BLEND_0_ENABLE 0x00001000
-#define R200_TEX_BLEND_1_ENABLE 0x00002000
-#define R200_TEX_BLEND_2_ENABLE 0x00004000
-#define R200_TEX_BLEND_3_ENABLE 0x00008000
-#define R200_TEX_BLEND_4_ENABLE 0x00010000
-#define R200_TEX_BLEND_5_ENABLE 0x00020000
-#define R200_TEX_BLEND_6_ENABLE 0x00040000
-#define R200_MULTI_PASS_ENABLE 0x00080000
-#define R200_SPECULAR_ENABLE 0x00200000
-#define R200_FOG_ENABLE 0x00400000
-#define R200_ALPHA_TEST_ENABLE 0x00800000
-#define R200_ANTI_ALIAS_NONE 0x00000000
-#define R200_ANTI_ALIAS_LINE 0x01000000
-#define R200_ANTI_ALIAS_POLY 0x02000000
-#define R200_ANTI_ALIAS_MASK 0x03000000
-#define R200_RB3D_CNTL 0x1c3c
-#define R200_ALPHA_BLEND_ENABLE (1 << 0)
-#define R200_PLANE_MASK_ENABLE (1 << 1)
-#define R200_DITHER_ENABLE (1 << 2)
-#define R200_ROUND_ENABLE (1 << 3)
-#define R200_SCALE_DITHER_ENABLE (1 << 4)
-#define R200_DITHER_INIT (1 << 5)
-#define R200_ROP_ENABLE (1 << 6)
-#define R200_STENCIL_ENABLE (1 << 7)
-#define R200_Z_ENABLE (1 << 8)
-#define R200_DEPTH_XZ_OFFEST_ENABLE (1 << 9)
-#define R200_COLOR_FORMAT_ARGB1555 (3 << 10)
-#define R200_COLOR_FORMAT_RGB565 (4 << 10)
-#define R200_COLOR_FORMAT_ARGB8888 (6 << 10)
-#define R200_COLOR_FORMAT_RGB332 (7 << 10)
-#define R200_COLOR_FORMAT_Y8 (8 << 10)
-#define R200_COLOR_FORMAT_RGB8 (9 << 10)
-#define R200_COLOR_FORMAT_YUV422_VYUY (11 << 10)
-#define R200_COLOR_FORMAT_YUV422_YVYU (12 << 10)
-#define R200_COLOR_FORMAT_aYUV444 (14 << 10)
-#define R200_COLOR_FORMAT_ARGB4444 (15 << 10)
-#define R200_CLRCMP_FLIP_ENABLE (1 << 14)
-#define R200_SEPARATE_ALPHA_ENABLE (1 << 16)
-#define R200_RB3D_COLOROFFSET 0x1c40
-#define R200_COLOROFFSET_MASK 0xfffffff0
-#define R200_RE_WIDTH_HEIGHT 0x1c44
-#define R200_RE_WIDTH_SHIFT 0
-#define R200_RE_HEIGHT_SHIFT 16
-#define R200_RB3D_COLORPITCH 0x1c48
-#define R200_COLORPITCH_MASK 0x000001ff8
-#define R200_COLOR_ENDIAN_NO_SWAP (0 << 18)
-#define R200_COLOR_ENDIAN_WORD_SWAP (1 << 18)
-#define R200_COLOR_ENDIAN_DWORD_SWAP (2 << 18)
-#define R200_SE_CNTL 0x1c4c
-#define R200_FFACE_CULL_CW (0 << 0)
-#define R200_FFACE_CULL_CCW (1 << 0)
-#define R200_FFACE_CULL_DIR_MASK (1 << 0)
-#define R200_BFACE_CULL (0 << 1)
-#define R200_BFACE_SOLID (3 << 1)
-#define R200_FFACE_CULL (0 << 3)
-#define R200_FFACE_SOLID (3 << 3)
-#define R200_FFACE_CULL_MASK (3 << 3)
-#define R200_FLAT_SHADE_VTX_0 (0 << 6)
-#define R200_FLAT_SHADE_VTX_1 (1 << 6)
-#define R200_FLAT_SHADE_VTX_2 (2 << 6)
-#define R200_FLAT_SHADE_VTX_LAST (3 << 6)
-#define R200_DIFFUSE_SHADE_SOLID (0 << 8)
-#define R200_DIFFUSE_SHADE_FLAT (1 << 8)
-#define R200_DIFFUSE_SHADE_GOURAUD (2 << 8)
-#define R200_DIFFUSE_SHADE_MASK (3 << 8)
-#define R200_ALPHA_SHADE_SOLID (0 << 10)
-#define R200_ALPHA_SHADE_FLAT (1 << 10)
-#define R200_ALPHA_SHADE_GOURAUD (2 << 10)
-#define R200_ALPHA_SHADE_MASK (3 << 10)
-#define R200_SPECULAR_SHADE_SOLID (0 << 12)
-#define R200_SPECULAR_SHADE_FLAT (1 << 12)
-#define R200_SPECULAR_SHADE_GOURAUD (2 << 12)
-#define R200_SPECULAR_SHADE_MASK (3 << 12)
-#define R200_FOG_SHADE_SOLID (0 << 14)
-#define R200_FOG_SHADE_FLAT (1 << 14)
-#define R200_FOG_SHADE_GOURAUD (2 << 14)
-#define R200_FOG_SHADE_MASK (3 << 14)
-#define R200_ZBIAS_ENABLE_POINT (1 << 16)
-#define R200_ZBIAS_ENABLE_LINE (1 << 17)
-#define R200_ZBIAS_ENABLE_TRI (1 << 18)
-#define R200_WIDELINE_ENABLE (1 << 20)
-#define R200_VTX_PIX_CENTER_D3D (0 << 27)
-#define R200_VTX_PIX_CENTER_OGL (1 << 27)
-#define R200_ROUND_MODE_TRUNC (0 << 28)
-#define R200_ROUND_MODE_ROUND (1 << 28)
-#define R200_ROUND_MODE_ROUND_EVEN (2 << 28)
-#define R200_ROUND_MODE_ROUND_ODD (3 << 28)
-#define R200_ROUND_PREC_16TH_PIX (0 << 30)
-#define R200_ROUND_PREC_8TH_PIX (1 << 30)
-#define R200_ROUND_PREC_4TH_PIX (2 << 30)
-#define R200_ROUND_PREC_HALF_PIX (3 << 30)
-#define R200_RE_CNTL 0x1c50
-#define R200_STIPPLE_ENABLE 0x1
-#define R200_SCISSOR_ENABLE 0x2
-#define R200_PATTERN_ENABLE 0x4
-#define R200_PERSPECTIVE_ENABLE 0x8
-#define R200_POINT_SMOOTH 0x20
-#define R200_VTX_STQ0_D3D 0x00010000
-#define R200_VTX_STQ1_D3D 0x00040000
-#define R200_VTX_STQ2_D3D 0x00100000
-#define R200_VTX_STQ3_D3D 0x00400000
-#define R200_VTX_STQ4_D3D 0x01000000
-#define R200_VTX_STQ5_D3D 0x04000000
-/* gap */
-#define R200_RE_STIPPLE_ADDR 0x1cc8
-#define R200_RE_STIPPLE_DATA 0x1ccc
-#define R200_RE_LINE_PATTERN 0x1cd0
-#define R200_LINE_PATTERN_MASK 0x0000ffff
-#define R200_LINE_REPEAT_COUNT_SHIFT 16
-#define R200_LINE_PATTERN_START_SHIFT 24
-#define R200_LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28)
-#define R200_LINE_PATTERN_BIG_BIT_ORDER (1 << 28)
-#define R200_LINE_PATTERN_AUTO_RESET (1 << 29)
-#define R200_RE_LINE_STATE 0x1cd4
-#define R200_LINE_CURRENT_PTR_SHIFT 0
-#define R200_LINE_CURRENT_COUNT_SHIFT 8
-#define R200_RE_SCISSOR_TL_0 0x1cd8
-#define R200_RE_SCISSOR_BR_0 0x1cdc
-#define R200_RE_SCISSOR_TL_1 0x1ce0
-#define R200_RE_SCISSOR_BR_1 0x1ce4
-#define R200_RE_SCISSOR_TL_2 0x1ce8
-#define R200_RE_SCISSOR_BR_2 0x1cec
-/* gap */
-#define R200_RB3D_DEPTHXY_OFFSET 0x1d60
-#define R200_DEPTHX_SHIFT 0
-#define R200_DEPTHY_SHIFT 16
-/* gap */
-#define R200_RB3D_STENCILREFMASK 0x1d7c
-#define R200_STENCIL_REF_SHIFT 0
-#define R200_STENCIL_REF_MASK (0xff << 0)
-#define R200_STENCIL_MASK_SHIFT 16
-#define R200_STENCIL_VALUE_MASK (0xff << 16)
-#define R200_STENCIL_WRITEMASK_SHIFT 24
-#define R200_STENCIL_WRITE_MASK (0xff << 24)
-#define R200_RB3D_ROPCNTL 0x1d80
-#define R200_ROP_MASK (15 << 8)
-#define R200_ROP_CLEAR (0 << 8)
-#define R200_ROP_NOR (1 << 8)
-#define R200_ROP_AND_INVERTED (2 << 8)
-#define R200_ROP_COPY_INVERTED (3 << 8)
-#define R200_ROP_AND_REVERSE (4 << 8)
-#define R200_ROP_INVERT (5 << 8)
-#define R200_ROP_XOR (6 << 8)
-#define R200_ROP_NAND (7 << 8)
-#define R200_ROP_AND (8 << 8)
-#define R200_ROP_EQUIV (9 << 8)
-#define R200_ROP_NOOP (10 << 8)
-#define R200_ROP_OR_INVERTED (11 << 8)
-#define R200_ROP_COPY (12 << 8)
-#define R200_ROP_OR_REVERSE (13 << 8)
-#define R200_ROP_OR (14 << 8)
-#define R200_ROP_SET (15 << 8)
-#define R200_RB3D_PLANEMASK 0x1d84
-/* gap */
-#define R200_SE_VPORT_XSCALE 0x1d98
-#define R200_SE_VPORT_XOFFSET 0x1d9c
-#define R200_SE_VPORT_YSCALE 0x1da0
-#define R200_SE_VPORT_YOFFSET 0x1da4
-#define R200_SE_VPORT_ZSCALE 0x1da8
-#define R200_SE_VPORT_ZOFFSET 0x1dac
-#define R200_SE_ZBIAS_FACTOR 0x1db0
-#define R200_SE_ZBIAS_CONSTANT 0x1db4
-#define R200_SE_LINE_WIDTH 0x1db8
-#define R200_LINE_WIDTH_SHIFT 0x00000000
-#define R200_MINPOINTSIZE_SHIFT 0x00000010
-/* gap */
-#define R200_SE_VAP_CNTL 0x2080
-#define R200_VAP_TCL_ENABLE 0x00000001
-#define R200_VAP_SINGLE_BUF_STATE_ENABLE 0x00000010
-#define R200_VAP_FORCE_W_TO_ONE 0x00010000
-#define R200_VAP_D3D_TEX_DEFAULT 0x00020000
-#define R200_VAP_VF_MAX_VTX_NUM__SHIFT 18
-#define R200_VAP_DX_CLIP_SPACE_DEF 0x00400000
-#define R200_SE_VF_CNTL 0x2084
-#define R200_VF_PRIM_NONE 0x00000000
-#define R200_VF_PRIM_POINTS 0x00000001
-#define R200_VF_PRIM_LINES 0x00000002
-#define R200_VF_PRIM_LINE_STRIP 0x00000003
-#define R200_VF_PRIM_TRIANGLES 0x00000004
-#define R200_VF_PRIM_TRIANGLE_FAN 0x00000005
-#define R200_VF_PRIM_TRIANGLE_STRIP 0x00000006
-#define R200_VF_PRIM_RECT_LIST 0x00000008
-#define R200_VF_PRIM_3VRT_POINTS 0x00000009
-#define R200_VF_PRIM_3VRT_LINES 0x0000000a
-#define R200_VF_PRIM_POINT_SPRITES 0x0000000b
-#define R200_VF_PRIM_LINE_LOOP 0x0000000c
-#define R200_VF_PRIM_QUADS 0x0000000d
-#define R200_VF_PRIM_QUAD_STRIP 0x0000000e
-#define R200_VF_PRIM_POLYGON 0x0000000f
-#define R200_VF_PRIM_MASK 0x0000000f
-#define R200_VF_PRIM_WALK_IND 0x00000010
-#define R200_VF_PRIM_WALK_LIST 0x00000020
-#define R200_VF_PRIM_WALK_RING 0x00000030
-#define R200_VF_PRIM_WALK_MASK 0x00000030
-#define R200_VF_COLOR_ORDER_RGBA 0x00000040
-#define R200_VF_TCL_OUTPUT_VTX_ENABLE 0x00000200
-#define R200_VF_INDEX_SZ_4 0x00000800
-#define R200_VF_VERTEX_NUMBER_MASK 0xffff0000
-#define R200_VF_VERTEX_NUMBER_SHIFT 16
-#define R200_SE_VTX_FMT_0 0x2088
-#define R200_VTX_XY 0 /* always have xy */
-#define R200_VTX_Z0 (1<<0)
-#define R200_VTX_W0 (1<<1)
-#define R200_VTX_WEIGHT_COUNT_SHIFT (2)
-#define R200_VTX_PV_MATRIX_SEL (1<<5)
-#define R200_VTX_N0 (1<<6)
-#define R200_VTX_POINT_SIZE (1<<7)
-#define R200_VTX_DISCRETE_FOG (1<<8)
-#define R200_VTX_SHININESS_0 (1<<9)
-#define R200_VTX_SHININESS_1 (1<<10)
-#define R200_VTX_COLOR_NOT_PRESENT 0
-#define R200_VTX_PK_RGBA 1
-#define R200_VTX_FP_RGB 2
-#define R200_VTX_FP_RGBA 3
-#define R200_VTX_COLOR_MASK 3
-#define R200_VTX_COLOR_0_SHIFT 11
-#define R200_VTX_COLOR_1_SHIFT 13
-#define R200_VTX_COLOR_2_SHIFT 15
-#define R200_VTX_COLOR_3_SHIFT 17
-#define R200_VTX_COLOR_4_SHIFT 19
-#define R200_VTX_COLOR_5_SHIFT 21
-#define R200_VTX_COLOR_6_SHIFT 23
-#define R200_VTX_COLOR_7_SHIFT 25
-#define R200_VTX_XY1 (1<<28)
-#define R200_VTX_Z1 (1<<29)
-#define R200_VTX_W1 (1<<30)
-#define R200_VTX_N1 (1<<31)
-#define R200_SE_VTX_FMT_1 0x208c
-#define R200_VTX_TEX0_COMP_CNT_SHIFT 0
-#define R200_VTX_TEX1_COMP_CNT_SHIFT 3
-#define R200_VTX_TEX2_COMP_CNT_SHIFT 6
-#define R200_VTX_TEX3_COMP_CNT_SHIFT 9
-#define R200_VTX_TEX4_COMP_CNT_SHIFT 12
-#define R200_VTX_TEX5_COMP_CNT_SHIFT 15
-#define R200_SE_TCL_OUTPUT_VTX_FMT_0 0x2090
-#define R200_SE_TCL_OUTPUT_VTX_FMT_1 0x2094
-/* gap */
-#define R200_SE_VTE_CNTL 0x20b0
-#define R200_VPORT_X_SCALE_ENA 0x00000001
-#define R200_VPORT_X_OFFSET_ENA 0x00000002
-#define R200_VPORT_Y_SCALE_ENA 0x00000004
-#define R200_VPORT_Y_OFFSET_ENA 0x00000008
-#define R200_VPORT_Z_SCALE_ENA 0x00000010
-#define R200_VPORT_Z_OFFSET_ENA 0x00000020
-#define R200_VTX_XY_FMT 0x00000100
-#define R200_VTX_Z_FMT 0x00000200
-#define R200_VTX_W0_FMT 0x00000400
-#define R200_VTX_W0_NORMALIZE 0x00000800
-#define R200_VTX_ST_DENORMALIZED 0x00001000
-/* gap */
-#define R200_SE_VTX_NUM_ARRAYS 0x20c0
-#define R200_SE_VTX_AOS_ATTR01 0x20c4
-#define R200_SE_VTX_AOS_ADDR0 0x20c8
-#define R200_SE_VTX_AOS_ADDR1 0x20cc
-#define R200_SE_VTX_AOS_ATTR23 0x20d0
-#define R200_SE_VTX_AOS_ADDR2 0x20d4
-#define R200_SE_VTX_AOS_ADDR3 0x20d8
-#define R200_SE_VTX_AOS_ATTR45 0x20dc
-#define R200_SE_VTX_AOS_ADDR4 0x20e0
-#define R200_SE_VTX_AOS_ADDR5 0x20e4
-#define R200_SE_VTX_AOS_ATTR67 0x20e8
-#define R200_SE_VTX_AOS_ADDR6 0x20ec
-#define R200_SE_VTX_AOS_ADDR7 0x20f0
-#define R200_SE_VTX_AOS_ATTR89 0x20f4
-#define R200_SE_VTX_AOS_ADDR8 0x20f8
-#define R200_SE_VTX_AOS_ADDR9 0x20fc
-#define R200_SE_VTX_AOS_ATTR1011 0x2100
-#define R200_SE_VTX_AOS_ADDR10 0x2104
-#define R200_SE_VTX_AOS_ADDR11 0x2108
-#define R200_SE_VF_MAX_VTX_INDX 0x210c
-#define R200_SE_VF_MIN_VTX_INDX 0x2110
-/* gap */
-#define R200_SE_VAP_CNTL_STATUS 0x2140
-#define R200_VC_NO_SWAP (0 << 0)
-#define R200_VC_16BIT_SWAP (1 << 0)
-#define R200_VC_32BIT_SWAP (2 << 0)
-/* gap */
-#define R200_SE_VTX_STATE_CNTL 0x2180
-#define R200_VSC_COLOR_0_ASSEMBLY_CNTL_SHIFT 0x00000000
-#define R200_VSC_COLOR_1_ASSEMBLY_CNTL_SHIFT 0x00000002
-#define R200_VSC_COLOR_2_ASSEMBLY_CNTL_SHIFT 0x00000004
-#define R200_VSC_COLOR_3_ASSEMBLY_CNTL_SHIFT 0x00000006
-#define R200_VSC_COLOR_4_ASSEMBLY_CNTL_SHIFT 0x00000008
-#define R200_VSC_COLOR_5_ASSEMBLY_CNTL_SHIFT 0x0000000a
-#define R200_VSC_COLOR_6_ASSEMBLY_CNTL_SHIFT 0x0000000c
-#define R200_VSC_COLOR_7_ASSEMBLY_CNTL_SHIFT 0x0000000e
-#define R200_VSC_UPDATE_USER_COLOR_0_ENABLE 0x00010000
-#define R200_VSC_UPDATE_USER_COLOR_1_ENABLE 0x00020000
-/* gap */
-#define R200_SE_TCL_VECTOR_INDX_REG 0x2200
-#define R200_SE_TCL_VECTOR_DATA_REG 0x2204
-#define R200_SE_TCL_SCALAR_INDX_REG 0x2208
-#define R200_SE_TCL_SCALAR_DATA_REG 0x220c
-/* gap */
-#define R200_SE_TCL_MATRIX_SEL_0 0x2230
-#define R200_MODELVIEW_0_SHIFT (0)
-#define R200_MODELVIEW_1_SHIFT (8)
-#define R200_MODELVIEW_2_SHIFT (16)
-#define R200_MODELVIEW_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_1 0x2234
-#define R200_IT_MODELVIEW_0_SHIFT (0)
-#define R200_IT_MODELVIEW_1_SHIFT (8)
-#define R200_IT_MODELVIEW_2_SHIFT (16)
-#define R200_IT_MODELVIEW_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_2 0x2238
-#define R200_MODELPROJECT_0_SHIFT (0)
-#define R200_MODELPROJECT_1_SHIFT (8)
-#define R200_MODELPROJECT_2_SHIFT (16)
-#define R200_MODELPROJECT_3_SHIFT (24)
-#define R200_SE_TCL_MATRIX_SEL_3 0x223c
-#define R200_TEXMAT_0_SHIFT 0
-#define R200_TEXMAT_1_SHIFT 8
-#define R200_TEXMAT_2_SHIFT 16
-#define R200_TEXMAT_3_SHIFT 24
-#define R200_SE_TCL_MATRIX_SEL_4 0x2240
-#define R200_TEXMAT_4_SHIFT 0
-#define R200_TEXMAT_5_SHIFT 8
-/* gap */
-#define R200_SE_TCL_OUTPUT_VTX_COMP_SEL 0x2250
-#define R200_OUTPUT_XYZW (1<<0)
-#define R200_OUTPUT_COLOR_0 (1<<8)
-#define R200_OUTPUT_COLOR_1 (1<<9)
-#define R200_OUTPUT_TEX_0 (1<<16)
-#define R200_OUTPUT_TEX_1 (1<<17)
-#define R200_OUTPUT_TEX_2 (1<<18)
-#define R200_OUTPUT_TEX_3 (1<<19)
-#define R200_OUTPUT_TEX_4 (1<<20)
-#define R200_OUTPUT_TEX_5 (1<<21)
-#define R200_OUTPUT_TEX_MASK (0x3f<<16)
-#define R200_OUTPUT_DISCRETE_FOG (1<<24)
-#define R200_OUTPUT_PT_SIZE (1<<25)
-#define R200_FORCE_INORDER_PROC (1<<31)
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0 0x2254
-#define R200_VERTEX_POSITION_ADDR__SHIFT 0x00000000
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_1 0x2258
-#define R200_VTX_COLOR_0_ADDR__SHIFT 0x00000000
-#define R200_VTX_COLOR_1_ADDR__SHIFT 0x00000008
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_2 0x225c
-#define R200_VTX_TEX_0_ADDR__SHIFT 0x00000000
-#define R200_VTX_TEX_1_ADDR__SHIFT 0x00000008
-#define R200_VTX_TEX_2_ADDR__SHIFT 0x00000010
-#define R200_VTX_TEX_3_ADDR__SHIFT 0x00000018
-#define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_3 0x2260
-#define R200_VTX_TEX_4_ADDR__SHIFT 0x00000000
-#define R200_VTX_TEX_5_ADDR__SHIFT 0x00000008
-
-/* gap */
-#define R200_SE_TCL_LIGHT_MODEL_CTL_0 0x2268
-#define R200_LIGHTING_ENABLE (1<<0)
-#define R200_LIGHT_IN_MODELSPACE (1<<1)
-#define R200_LOCAL_VIEWER (1<<2)
-#define R200_NORMALIZE_NORMALS (1<<3)
-#define R200_RESCALE_NORMALS (1<<4)
-#define R200_SPECULAR_LIGHTS (1<<5)
-#define R200_DIFFUSE_SPECULAR_COMBINE (1<<6)
-#define R200_LIGHT_ALPHA (1<<7)
-#define R200_LOCAL_LIGHT_VEC_GL (1<<8)
-#define R200_LIGHT_NO_NORMAL_AMBIENT_ONLY (1<<9)
-#define R200_LIGHT_TWOSIDE (1<<10)
-#define R200_FRONT_SHININESS_SOURCE_SHIFT (0xb)
-#define R200_BACK_SHININESS_SOURCE_SHIFT (0xd)
-#define R200_LM0_SOURCE_MATERIAL_0 (0)
-#define R200_LM0_SOURCE_MATERIAL_1 (1)
-#define R200_LM0_SOURCE_VERTEX_SHININESS_0 (2)
-#define R200_LM0_SOURCE_VERTEX_SHININESS_1 (3)
-#define R200_SE_TCL_LIGHT_MODEL_CTL_1 0x226c
-#define R200_LM1_SOURCE_LIGHT_PREMULT (0)
-#define R200_LM1_SOURCE_MATERIAL_0 (1)
-#define R200_LM1_SOURCE_VERTEX_COLOR_0 (2)
-#define R200_LM1_SOURCE_VERTEX_COLOR_1 (3)
-#define R200_LM1_SOURCE_VERTEX_COLOR_2 (4)
-#define R200_LM1_SOURCE_VERTEX_COLOR_3 (5)
-#define R200_LM1_SOURCE_VERTEX_COLOR_4 (6)
-#define R200_LM1_SOURCE_VERTEX_COLOR_5 (7)
-#define R200_LM1_SOURCE_VERTEX_COLOR_6 (8)
-#define R200_LM1_SOURCE_VERTEX_COLOR_7 (9)
-#define R200_LM1_SOURCE_MATERIAL_1 (0xf)
-#define R200_FRONT_EMISSIVE_SOURCE_SHIFT (0)
-#define R200_FRONT_AMBIENT_SOURCE_SHIFT (4)
-#define R200_FRONT_DIFFUSE_SOURCE_SHIFT (8)
-#define R200_FRONT_SPECULAR_SOURCE_SHIFT (12)
-#define R200_BACK_EMISSIVE_SOURCE_SHIFT (16)
-#define R200_BACK_AMBIENT_SOURCE_SHIFT (20)
-#define R200_BACK_DIFFUSE_SOURCE_SHIFT (24)
-#define R200_BACK_SPECULAR_SOURCE_SHIFT (28)
-#define R200_SE_TCL_PER_LIGHT_CTL_0 0x2270
-#define R200_LIGHT_0_ENABLE (1<<0)
-#define R200_LIGHT_0_ENABLE_AMBIENT (1<<1)
-#define R200_LIGHT_0_ENABLE_SPECULAR (1<<2)
-#define R200_LIGHT_0_IS_LOCAL (1<<3)
-#define R200_LIGHT_0_IS_SPOT (1<<4)
-#define R200_LIGHT_0_DUAL_CONE (1<<5)
-#define R200_LIGHT_0_ENABLE_RANGE_ATTEN (1<<6)
-#define R200_LIGHT_0_CONSTANT_RANGE_ATTEN (1<<7)
-#define R200_LIGHT_1_ENABLE (1<<16)
-#define R200_LIGHT_1_ENABLE_AMBIENT (1<<17)
-#define R200_LIGHT_1_ENABLE_SPECULAR (1<<18)
-#define R200_LIGHT_1_IS_LOCAL (1<<19)
-#define R200_LIGHT_1_IS_SPOT (1<<20)
-#define R200_LIGHT_1_DUAL_CONE (1<<21)
-#define R200_LIGHT_1_ENABLE_RANGE_ATTEN (1<<22)
-#define R200_LIGHT_1_CONSTANT_RANGE_ATTEN (1<<23)
-#define R200_LIGHT_0_SHIFT (0)
-#define R200_LIGHT_1_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_1 0x2274
-#define R200_LIGHT_2_SHIFT (0)
-#define R200_LIGHT_3_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_2 0x2278
-#define R200_LIGHT_4_SHIFT (0)
-#define R200_LIGHT_5_SHIFT (16)
-#define R200_SE_TCL_PER_LIGHT_CTL_3 0x227c
-#define R200_LIGHT_6_SHIFT (0)
-#define R200_LIGHT_7_SHIFT (16)
-/* gap */
-#define R200_SE_TCL_TEX_PROC_CTL_2 0x22a8
-#define R200_TEXGEN_0_COMP_MASK_SHIFT (0)
-#define R200_TEXGEN_1_COMP_MASK_SHIFT (4)
-#define R200_TEXGEN_2_COMP_MASK_SHIFT (8)
-#define R200_TEXGEN_3_COMP_MASK_SHIFT (12)
-#define R200_TEXGEN_4_COMP_MASK_SHIFT (16)
-#define R200_TEXGEN_5_COMP_MASK_SHIFT (20)
-#define R200_SE_TCL_TEX_PROC_CTL_3 0x22ac
-#define R200_TEXGEN_0_INPUT_TEX_SHIFT (0)
-#define R200_TEXGEN_1_INPUT_TEX_SHIFT (4)
-#define R200_TEXGEN_2_INPUT_TEX_SHIFT (8)
-#define R200_TEXGEN_3_INPUT_TEX_SHIFT (12)
-#define R200_TEXGEN_4_INPUT_TEX_SHIFT (16)
-#define R200_TEXGEN_5_INPUT_TEX_SHIFT (20)
-#define R200_SE_TCL_TEX_PROC_CTL_0 0x22b0
-#define R200_TEXGEN_TEXMAT_0_ENABLE (1<<0)
-#define R200_TEXGEN_TEXMAT_1_ENABLE (1<<1)
-#define R200_TEXGEN_TEXMAT_2_ENABLE (1<<2)
-#define R200_TEXGEN_TEXMAT_3_ENABLE (1<<3)
-#define R200_TEXGEN_TEXMAT_4_ENABLE (1<<4)
-#define R200_TEXGEN_TEXMAT_5_ENABLE (1<<5)
-#define R200_TEXMAT_0_ENABLE (1<<8)
-#define R200_TEXMAT_1_ENABLE (1<<9)
-#define R200_TEXMAT_2_ENABLE (1<<10)
-#define R200_TEXMAT_3_ENABLE (1<<11)
-#define R200_TEXMAT_4_ENABLE (1<<12)
-#define R200_TEXMAT_5_ENABLE (1<<13)
-#define R200_TEXGEN_FORCE_W_TO_ONE (1<<16)
-#define R200_SE_TCL_TEX_PROC_CTL_1 0x22b4
-#define R200_TEXGEN_INPUT_MASK (0xf)
-#define R200_TEXGEN_INPUT_TEXCOORD_0 (0)
-#define R200_TEXGEN_INPUT_TEXCOORD_1 (1)
-#define R200_TEXGEN_INPUT_TEXCOORD_2 (2)
-#define R200_TEXGEN_INPUT_TEXCOORD_3 (3)
-#define R200_TEXGEN_INPUT_TEXCOORD_4 (4)
-#define R200_TEXGEN_INPUT_TEXCOORD_5 (5)
-#define R200_TEXGEN_INPUT_OBJ (8)
-#define R200_TEXGEN_INPUT_EYE (9)
-#define R200_TEXGEN_INPUT_EYE_NORMAL (0xa)
-#define R200_TEXGEN_INPUT_EYE_REFLECT (0xb)
-#define R200_TEXGEN_INPUT_SPHERE (0xd)
-#define R200_TEXGEN_0_INPUT_SHIFT (0)
-#define R200_TEXGEN_1_INPUT_SHIFT (4)
-#define R200_TEXGEN_2_INPUT_SHIFT (8)
-#define R200_TEXGEN_3_INPUT_SHIFT (12)
-#define R200_TEXGEN_4_INPUT_SHIFT (16)
-#define R200_TEXGEN_5_INPUT_SHIFT (20)
-#define R200_SE_TC_TEX_CYL_WRAP_CTL 0x22b8
-/* gap */
-#define R200_SE_TCL_UCP_VERT_BLEND_CTL 0x22c0
-#define R200_UCP_IN_CLIP_SPACE (1<<0)
-#define R200_UCP_IN_MODEL_SPACE (1<<1)
-#define R200_UCP_ENABLE_0 (1<<2)
-#define R200_UCP_ENABLE_1 (1<<3)
-#define R200_UCP_ENABLE_2 (1<<4)
-#define R200_UCP_ENABLE_3 (1<<5)
-#define R200_UCP_ENABLE_4 (1<<6)
-#define R200_UCP_ENABLE_5 (1<<7)
-#define R200_TCL_FOG_MASK (3<<8)
-#define R200_TCL_FOG_DISABLE (0<<8)
-#define R200_TCL_FOG_EXP (1<<8)
-#define R200_TCL_FOG_EXP2 (2<<8)
-#define R200_TCL_FOG_LINEAR (3<<8)
-#define R200_RNG_BASED_FOG (1<<10)
-#define R200_CLIP_DISABLE (1<<11)
-#define R200_CULL_FRONT_IS_CW (0<<28)
-#define R200_CULL_FRONT_IS_CCW (1<<28)
-#define R200_CULL_FRONT (1<<29)
-#define R200_CULL_BACK (1<<30)
-#define R200_SE_TCL_POINT_SPRITE_CNTL 0x22c4
-/* gap */
-#define R200_SE_VTX_ST_POS_0_X_4 0x2300
-#define R200_SE_VTX_ST_POS_0_Y_4 0x2304
-#define R200_SE_VTX_ST_POS_0_Z_4 0x2308
-#define R200_SE_VTX_ST_POS_0_W_4 0x230c
-#define R200_SE_VTX_ST_NORM_0_X 0x2310
-#define R200_SE_VTX_ST_NORM_0_Y 0x2314
-#define R200_SE_VTX_ST_NORM_0_Z 0x2318
-#define R200_SE_VTX_ST_PVMS 0x231c
-#define R200_SE_VTX_ST_CLR_0_R 0x2320
-#define R200_SE_VTX_ST_CLR_0_G 0x2324
-#define R200_SE_VTX_ST_CLR_0_B 0x2328
-#define R200_SE_VTX_ST_CLR_0_A 0x232c
-#define R200_SE_VTX_ST_CLR_1_R 0x2330
-#define R200_SE_VTX_ST_CLR_1_G 0x2334
-#define R200_SE_VTX_ST_CLR_1_B 0x2338
-#define R200_SE_VTX_ST_CLR_1_A 0x233c
-#define R200_SE_VTX_ST_CLR_2_R 0x2340
-#define R200_SE_VTX_ST_CLR_2_G 0x2344
-#define R200_SE_VTX_ST_CLR_2_B 0x2348
-#define R200_SE_VTX_ST_CLR_2_A 0x234c
-#define R200_SE_VTX_ST_CLR_3_R 0x2350
-#define R200_SE_VTX_ST_CLR_3_G 0x2354
-#define R200_SE_VTX_ST_CLR_3_B 0x2358
-#define R200_SE_VTX_ST_CLR_3_A 0x235c
-#define R200_SE_VTX_ST_CLR_4_R 0x2360
-#define R200_SE_VTX_ST_CLR_4_G 0x2364
-#define R200_SE_VTX_ST_CLR_4_B 0x2368
-#define R200_SE_VTX_ST_CLR_4_A 0x236c
-#define R200_SE_VTX_ST_CLR_5_R 0x2370
-#define R200_SE_VTX_ST_CLR_5_G 0x2374
-#define R200_SE_VTX_ST_CLR_5_B 0x2378
-#define R200_SE_VTX_ST_CLR_5_A 0x237c
-#define R200_SE_VTX_ST_CLR_6_R 0x2380
-#define R200_SE_VTX_ST_CLR_6_G 0x2384
-#define R200_SE_VTX_ST_CLR_6_B 0x2388
-#define R200_SE_VTX_ST_CLR_6_A 0x238c
-#define R200_SE_VTX_ST_CLR_7_R 0x2390
-#define R200_SE_VTX_ST_CLR_7_G 0x2394
-#define R200_SE_VTX_ST_CLR_7_B 0x2398
-#define R200_SE_VTX_ST_CLR_7_A 0x239c
-#define R200_SE_VTX_ST_TEX_0_S 0x23a0
-#define R200_SE_VTX_ST_TEX_0_T 0x23a4
-#define R200_SE_VTX_ST_TEX_0_R 0x23a8
-#define R200_SE_VTX_ST_TEX_0_Q 0x23ac
-#define R200_SE_VTX_ST_TEX_1_S 0x23b0
-#define R200_SE_VTX_ST_TEX_1_T 0x23b4
-#define R200_SE_VTX_ST_TEX_1_R 0x23b8
-#define R200_SE_VTX_ST_TEX_1_Q 0x23bc
-#define R200_SE_VTX_ST_TEX_2_S 0x23c0
-#define R200_SE_VTX_ST_TEX_2_T 0x23c4
-#define R200_SE_VTX_ST_TEX_2_R 0x23c8
-#define R200_SE_VTX_ST_TEX_2_Q 0x23cc
-#define R200_SE_VTX_ST_TEX_3_S 0x23d0
-#define R200_SE_VTX_ST_TEX_3_T 0x23d4
-#define R200_SE_VTX_ST_TEX_3_R 0x23d8
-#define R200_SE_VTX_ST_TEX_3_Q 0x23dc
-#define R200_SE_VTX_ST_TEX_4_S 0x23e0
-#define R200_SE_VTX_ST_TEX_4_T 0x23e4
-#define R200_SE_VTX_ST_TEX_4_R 0x23e8
-#define R200_SE_VTX_ST_TEX_4_Q 0x23ec
-#define R200_SE_VTX_ST_TEX_5_S 0x23f0
-#define R200_SE_VTX_ST_TEX_5_T 0x23f4
-#define R200_SE_VTX_ST_TEX_5_R 0x23f8
-#define R200_SE_VTX_ST_TEX_5_Q 0x23fc
-#define R200_SE_VTX_ST_PNT_SPRT_SZ 0x2400
-#define R200_SE_VTX_ST_DISC_FOG 0x2404
-#define R200_SE_VTX_ST_SHININESS_0 0x2408
-#define R200_SE_VTX_ST_SHININESS_1 0x240c
-#define R200_SE_VTX_ST_BLND_WT_0 0x2410
-#define R200_SE_VTX_ST_BLND_WT_1 0x2414
-#define R200_SE_VTX_ST_BLND_WT_2 0x2418
-#define R200_SE_VTX_ST_BLND_WT_3 0x241c
-#define R200_SE_VTX_ST_POS_1_X 0x2420
-#define R200_SE_VTX_ST_POS_1_Y 0x2424
-#define R200_SE_VTX_ST_POS_1_Z 0x2428
-#define R200_SE_VTX_ST_POS_1_W 0x242c
-#define R200_SE_VTX_ST_NORM_1_X 0x2430
-#define R200_SE_VTX_ST_NORM_1_Y 0x2434
-#define R200_SE_VTX_ST_NORM_1_Z 0x2438
-#define R200_SE_VTX_ST_USR_CLR_0_R 0x2440
-#define R200_SE_VTX_ST_USR_CLR_0_G 0x2444
-#define R200_SE_VTX_ST_USR_CLR_0_B 0x2448
-#define R200_SE_VTX_ST_USR_CLR_0_A 0x244c
-#define R200_SE_VTX_ST_USR_CLR_1_R 0x2450
-#define R200_SE_VTX_ST_USR_CLR_1_G 0x2454
-#define R200_SE_VTX_ST_USR_CLR_1_B 0x2458
-#define R200_SE_VTX_ST_USR_CLR_1_A 0x245c
-#define R200_SE_VTX_ST_CLR_0_PKD 0x2460
-#define R200_SE_VTX_ST_CLR_1_PKD 0x2464
-#define R200_SE_VTX_ST_CLR_2_PKD 0x2468
-#define R200_SE_VTX_ST_CLR_3_PKD 0x246c
-#define R200_SE_VTX_ST_CLR_4_PKD 0x2470
-#define R200_SE_VTX_ST_CLR_5_PKD 0x2474
-#define R200_SE_VTX_ST_CLR_6_PKD 0x2478
-#define R200_SE_VTX_ST_CLR_7_PKD 0x247c
-#define R200_SE_VTX_ST_POS_0_X_2 0x2480
-#define R200_SE_VTX_ST_POS_0_Y_2 0x2484
-#define R200_SE_VTX_ST_PAR_CLR_LD 0x2488
-#define R200_SE_VTX_ST_USR_CLR_PKD 0x248c
-#define R200_SE_VTX_ST_POS_0_X_3 0x2490
-#define R200_SE_VTX_ST_POS_0_Y_3 0x2494
-#define R200_SE_VTX_ST_POS_0_Z_3 0x2498
-#define R200_SE_VTX_ST_END_OF_PKT 0x249c
-/* gap */
-#define R200_RE_POINTSIZE 0x2648
-#define R200_POINTSIZE_SHIFT 0
-#define R200_MAXPOINTSIZE_SHIFT 16
-/* gap */
-#define R200_RE_TOP_LEFT 0x26c0
-#define R200_RE_LEFT_SHIFT 0
-#define R200_RE_TOP_SHIFT 16
-#define R200_RE_MISC 0x26c4
-#define R200_STIPPLE_COORD_MASK 0x1f
-#define R200_STIPPLE_X_OFFSET_SHIFT 0
-#define R200_STIPPLE_X_OFFSET_MASK (0x1f << 0)
-#define R200_STIPPLE_Y_OFFSET_SHIFT 8
-#define R200_STIPPLE_Y_OFFSET_MASK (0x1f << 8)
-#define R200_STIPPLE_LITTLE_BIT_ORDER (0 << 16)
-#define R200_STIPPLE_BIG_BIT_ORDER (1 << 16)
-/* gap */
-#define R200_RE_AUX_SCISSOR_CNTL 0x26f0
-#define R200_EXCLUSIVE_SCISSOR_0 0x01000000
-#define R200_EXCLUSIVE_SCISSOR_1 0x02000000
-#define R200_EXCLUSIVE_SCISSOR_2 0x04000000
-#define R200_SCISSOR_ENABLE_0 0x10000000
-#define R200_SCISSOR_ENABLE_1 0x20000000
-#define R200_SCISSOR_ENABLE_2 0x40000000
-/* gap */
-#define R200_PP_TXFILTER_0 0x2c00
-#define R200_MAG_FILTER_NEAREST (0 << 0)
-#define R200_MAG_FILTER_LINEAR (1 << 0)
-#define R200_MAG_FILTER_MASK (1 << 0)
-#define R200_MIN_FILTER_NEAREST (0 << 1)
-#define R200_MIN_FILTER_LINEAR (1 << 1)
-#define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
-#define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
-#define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
-#define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST (8 << 1)
-#define R200_MIN_FILTER_ANISO_LINEAR (9 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
-#define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
-#define R200_MIN_FILTER_MASK (15 << 1)
-#define R200_MAX_ANISO_1_TO_1 (0 << 5)
-#define R200_MAX_ANISO_2_TO_1 (1 << 5)
-#define R200_MAX_ANISO_4_TO_1 (2 << 5)
-#define R200_MAX_ANISO_8_TO_1 (3 << 5)
-#define R200_MAX_ANISO_16_TO_1 (4 << 5)
-#define R200_MAX_ANISO_MASK (7 << 5)
-#define R200_MAX_MIP_LEVEL_MASK (0x0f << 16)
-#define R200_MAX_MIP_LEVEL_SHIFT 16
-#define R200_YUV_TO_RGB (1 << 20)
-#define R200_YUV_TEMPERATURE_COOL (0 << 21)
-#define R200_YUV_TEMPERATURE_HOT (1 << 21)
-#define R200_YUV_TEMPERATURE_MASK (1 << 21)
-#define R200_WRAPEN_S (1 << 22)
-#define R200_CLAMP_S_WRAP (0 << 23)
-#define R200_CLAMP_S_MIRROR (1 << 23)
-#define R200_CLAMP_S_CLAMP_LAST (2 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
-#define R200_CLAMP_S_CLAMP_BORDER (4 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
-#define R200_CLAMP_S_CLAMP_GL (6 << 23)
-#define R200_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
-#define R200_CLAMP_S_MASK (7 << 23)
-#define R200_WRAPEN_T (1 << 26)
-#define R200_CLAMP_T_WRAP (0 << 27)
-#define R200_CLAMP_T_MIRROR (1 << 27)
-#define R200_CLAMP_T_CLAMP_LAST (2 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
-#define R200_CLAMP_T_CLAMP_BORDER (4 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
-#define R200_CLAMP_T_CLAMP_GL (6 << 27)
-#define R200_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
-#define R200_CLAMP_T_MASK (7 << 27)
-#define R200_KILL_LT_ZERO (1 << 30)
-#define R200_BORDER_MODE_OGL (0 << 31)
-#define R200_BORDER_MODE_D3D (1 << 31)
-#define R200_PP_TXFORMAT_0 0x2c04
-#define R200_TXFORMAT_I8 (0 << 0)
-#define R200_TXFORMAT_AI88 (1 << 0)
-#define R200_TXFORMAT_RGB332 (2 << 0)
-#define R200_TXFORMAT_ARGB1555 (3 << 0)
-#define R200_TXFORMAT_RGB565 (4 << 0)
-#define R200_TXFORMAT_ARGB4444 (5 << 0)
-#define R200_TXFORMAT_ARGB8888 (6 << 0)
-#define R200_TXFORMAT_RGBA8888 (7 << 0)
-#define R200_TXFORMAT_Y8 (8 << 0)
-#define R200_TXFORMAT_AVYU4444 (9 << 0)
-#define R200_TXFORMAT_VYUY422 (10 << 0)
-#define R200_TXFORMAT_YVYU422 (11 << 0)
-#define R200_TXFORMAT_DXT1 (12 << 0)
-#define R200_TXFORMAT_DXT23 (14 << 0)
-#define R200_TXFORMAT_DXT45 (15 << 0)
-#define R200_TXFORMAT_FORMAT_MASK (31 << 0)
-#define R200_TXFORMAT_FORMAT_SHIFT 0
-#define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6)
-#define R200_TXFORMAT_NON_POWER2 (1 << 7)
-#define R200_TXFORMAT_WIDTH_MASK (15 << 8)
-#define R200_TXFORMAT_WIDTH_SHIFT 8
-#define R200_TXFORMAT_HEIGHT_MASK (15 << 12)
-#define R200_TXFORMAT_HEIGHT_SHIFT 12
-#define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */
-#define R200_TXFORMAT_F5_WIDTH_SHIFT 16
-#define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
-#define R200_TXFORMAT_F5_HEIGHT_SHIFT 20
-#define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24)
-#define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
-#define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
-#define R200_TXFORMAT_ST_ROUTE_SHIFT 24
-#define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
-#define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
-#define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
-#define R200_PP_TXFORMAT_X_0 0x2c08
-#define R200_DEPTH_LOG2_MASK (0xf << 0)
-#define R200_DEPTH_LOG2_SHIFT 0
-#define R200_VOLUME_FILTER_SHIFT 4
-#define R200_VOLUME_FILTER_MASK (1 << 4)
-#define R200_VOLUME_FILTER_NEAREST (0 << 4)
-#define R200_VOLUME_FILTER_LINEAR (1 << 4)
-#define R200_WRAPEN_Q (1 << 8)
-#define R200_CLAMP_Q_WRAP (0 << 9)
-#define R200_CLAMP_Q_MIRROR (1 << 9)
-#define R200_CLAMP_Q_CLAMP_LAST (2 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_LAST (3 << 9)
-#define R200_CLAMP_Q_CLAMP_BORDER (4 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_BORDER (5 << 9)
-#define R200_CLAMP_Q_CLAMP_GL (6 << 9)
-#define R200_CLAMP_Q_MIRROR_CLAMP_GL (7 << 9)
-#define R200_CLAMP_Q_MASK (7 << 9)
-#define R200_MIN_MIP_LEVEL_MASK (0xff << 12)
-#define R200_MIN_MIP_LEVEL_SHIFT 12
-#define R200_TEXCOORD_NONPROJ (0 << 16)
-#define R200_TEXCOORD_CUBIC_ENV (1 << 16)
-#define R200_TEXCOORD_VOLUME (2 << 16)
-#define R200_TEXCOORD_PROJ (3 << 16)
-#define R200_TEXCOORD_DEPTH (4 << 16)
-#define R200_TEXCOORD_1D_PROJ (5 << 16)
-#define R200_TEXCOORD_1D (6 << 16)
-#define R200_TEXCOORD_ZERO (7 << 16)
-#define R200_TEXCOORD_MASK (7 << 16)
-#define R200_LOD_BIAS_MASK (0xfff80000)
-#define R200_LOD_BIAS_SHIFT 19
-#define R200_PP_TXSIZE_0 0x2c0c /* NPOT only */
-#define R200_PP_TXPITCH_0 0x2c10 /* NPOT only */
-#define R200_PP_BORDER_COLOR_0 0x2c14
-#define R200_PP_CUBIC_FACES_0 0x2c18
-#define R200_FACE_WIDTH_1_SHIFT 0
-#define R200_FACE_HEIGHT_1_SHIFT 4
-#define R200_FACE_WIDTH_1_MASK (0xf << 0)
-#define R200_FACE_HEIGHT_1_MASK (0xf << 4)
-#define R200_FACE_WIDTH_2_SHIFT 8
-#define R200_FACE_HEIGHT_2_SHIFT 12
-#define R200_FACE_WIDTH_2_MASK (0xf << 8)
-#define R200_FACE_HEIGHT_2_MASK (0xf << 12)
-#define R200_FACE_WIDTH_3_SHIFT 16
-#define R200_FACE_HEIGHT_3_SHIFT 20
-#define R200_FACE_WIDTH_3_MASK (0xf << 16)
-#define R200_FACE_HEIGHT_3_MASK (0xf << 20)
-#define R200_FACE_WIDTH_4_SHIFT 24
-#define R200_FACE_HEIGHT_4_SHIFT 28
-#define R200_FACE_WIDTH_4_MASK (0xf << 24)
-#define R200_FACE_HEIGHT_4_MASK (0xf << 28)
-#define R200_PP_TXFILTER_1 0x2c20
-#define R200_PP_TXFORMAT_1 0x2c24
-#define R200_PP_TXFORMAT_X_1 0x2c28
-#define R200_PP_TXSIZE_1 0x2c2c
-#define R200_PP_TXPITCH_1 0x2c30
-#define R200_PP_BORDER_COLOR_1 0x2c34
-#define R200_PP_CUBIC_FACES_1 0x2c38
-#define R200_PP_TXFILTER_2 0x2c40
-#define R200_PP_TXFORMAT_2 0x2c44
-#define R200_PP_TXSIZE_2 0x2c4c
-#define R200_PP_TXFORMAT_X_2 0x2c48
-#define R200_PP_TXPITCH_2 0x2c50
-#define R200_PP_BORDER_COLOR_2 0x2c54
-#define R200_PP_CUBIC_FACES_2 0x2c58
-#define R200_PP_TXFILTER_3 0x2c60
-#define R200_PP_TXFORMAT_3 0x2c64
-#define R200_PP_TXSIZE_3 0x2c6c
-#define R200_PP_TXFORMAT_X_3 0x2c68
-#define R200_PP_TXPITCH_3 0x2c70
-#define R200_PP_BORDER_COLOR_3 0x2c74
-#define R200_PP_CUBIC_FACES_3 0x2c78
-#define R200_PP_TXFILTER_4 0x2c80
-#define R200_PP_TXFORMAT_4 0x2c84
-#define R200_PP_TXSIZE_4 0x2c8c
-#define R200_PP_TXFORMAT_X_4 0x2c88
-#define R200_PP_TXPITCH_4 0x2c90
-#define R200_PP_BORDER_COLOR_4 0x2c94
-#define R200_PP_CUBIC_FACES_4 0x2c98
-#define R200_PP_TXFILTER_5 0x2ca0
-#define R200_PP_TXFORMAT_5 0x2ca4
-#define R200_PP_TXSIZE_5 0x2cac
-#define R200_PP_TXFORMAT_X_5 0x2ca8
-#define R200_PP_TXPITCH_5 0x2cb0
-#define R200_PP_BORDER_COLOR_5 0x2cb4
-#define R200_PP_CUBIC_FACES_5 0x2cb8
-/* gap */
-#define R200_PP_CNTL_X 0x2cc4
-/* gap */
-#define R200_PP_TXOFFSET_0 0x2d00
-#define R200_TXO_ENDIAN_NO_SWAP (0 << 0)
-#define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0)
-#define R200_TXO_ENDIAN_WORD_SWAP (2 << 0)
-#define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
-#define R200_TXO_OFFSET_MASK 0xffffffe0
-#define R200_TXO_OFFSET_SHIFT 5
-#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04
-#define R200_PP_CUBIC_OFFSET_F2_0 0x2d08
-#define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c
-#define R200_PP_CUBIC_OFFSET_F4_0 0x2d10
-#define R200_PP_CUBIC_OFFSET_F5_0 0x2d14
-#define R200_PP_TXOFFSET_1 0x2d18
-#define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c
-#define R200_PP_CUBIC_OFFSET_F2_1 0x2d20
-#define R200_PP_CUBIC_OFFSET_F3_1 0x2d24
-#define R200_PP_CUBIC_OFFSET_F4_1 0x2d28
-#define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c
-#define R200_PP_TXOFFSET_2 0x2d30
-#define R200_PP_CUBIC_OFFSET_F1_2 0x2d34
-#define R200_PP_CUBIC_OFFSET_F2_2 0x2d38
-#define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c
-#define R200_PP_CUBIC_OFFSET_F4_2 0x2d40
-#define R200_PP_CUBIC_OFFSET_F5_2 0x2d44
-#define R200_PP_TXOFFSET_3 0x2d48
-#define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c
-#define R200_PP_CUBIC_OFFSET_F2_3 0x2d50
-#define R200_PP_CUBIC_OFFSET_F3_3 0x2d54
-#define R200_PP_CUBIC_OFFSET_F4_3 0x2d58
-#define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c
-#define R200_PP_TXOFFSET_4 0x2d60
-#define R200_PP_CUBIC_OFFSET_F1_4 0x2d64
-#define R200_PP_CUBIC_OFFSET_F2_4 0x2d68
-#define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c
-#define R200_PP_CUBIC_OFFSET_F4_4 0x2d70
-#define R200_PP_CUBIC_OFFSET_F5_4 0x2d74
-#define R200_PP_TXOFFSET_5 0x2d78
-#define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c
-#define R200_PP_CUBIC_OFFSET_F2_5 0x2d80
-#define R200_PP_CUBIC_OFFSET_F3_5 0x2d84
-#define R200_PP_CUBIC_OFFSET_F4_5 0x2d88
-#define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c
-/* gap */
-#define R200_PP_TAM_DEBUG3 0x2d9c
-/* gap */
-#define R200_PP_TFACTOR_0 0x2ee0
-#define R200_PP_TFACTOR_1 0x2ee4
-#define R200_PP_TFACTOR_2 0x2ee8
-#define R200_PP_TFACTOR_3 0x2eec
-#define R200_PP_TFACTOR_4 0x2ef0
-#define R200_PP_TFACTOR_5 0x2ef4
-/* gap */
-#define R200_PP_TXCBLEND_0 0x2f00
-#define R200_TXC_ARG_A_ZERO (0)
-#define R200_TXC_ARG_A_CURRENT_COLOR (2)
-#define R200_TXC_ARG_A_CURRENT_ALPHA (3)
-#define R200_TXC_ARG_A_DIFFUSE_COLOR (4)
-#define R200_TXC_ARG_A_DIFFUSE_ALPHA (5)
-#define R200_TXC_ARG_A_SPECULAR_COLOR (6)
-#define R200_TXC_ARG_A_SPECULAR_ALPHA (7)
-#define R200_TXC_ARG_A_TFACTOR_COLOR (8)
-#define R200_TXC_ARG_A_TFACTOR_ALPHA (9)
-#define R200_TXC_ARG_A_R0_COLOR (10)
-#define R200_TXC_ARG_A_R0_ALPHA (11)
-#define R200_TXC_ARG_A_R1_COLOR (12)
-#define R200_TXC_ARG_A_R1_ALPHA (13)
-#define R200_TXC_ARG_A_R2_COLOR (14)
-#define R200_TXC_ARG_A_R2_ALPHA (15)
-#define R200_TXC_ARG_A_R3_COLOR (16)
-#define R200_TXC_ARG_A_R3_ALPHA (17)
-#define R200_TXC_ARG_A_R4_COLOR (18)
-#define R200_TXC_ARG_A_R4_ALPHA (19)
-#define R200_TXC_ARG_A_R5_COLOR (20)
-#define R200_TXC_ARG_A_R5_ALPHA (21)
-#define R200_TXC_ARG_A_TFACTOR1_COLOR (26)
-#define R200_TXC_ARG_A_TFACTOR1_ALPHA (27)
-#define R200_TXC_ARG_A_MASK (31 << 0)
-#define R200_TXC_ARG_A_SHIFT 0
-#define R200_TXC_ARG_B_ZERO (0<<5)
-#define R200_TXC_ARG_B_CURRENT_COLOR (2<<5)
-#define R200_TXC_ARG_B_CURRENT_ALPHA (3<<5)
-#define R200_TXC_ARG_B_DIFFUSE_COLOR (4<<5)
-#define R200_TXC_ARG_B_DIFFUSE_ALPHA (5<<5)
-#define R200_TXC_ARG_B_SPECULAR_COLOR (6<<5)
-#define R200_TXC_ARG_B_SPECULAR_ALPHA (7<<5)
-#define R200_TXC_ARG_B_TFACTOR_COLOR (8<<5)
-#define R200_TXC_ARG_B_TFACTOR_ALPHA (9<<5)
-#define R200_TXC_ARG_B_R0_COLOR (10<<5)
-#define R200_TXC_ARG_B_R0_ALPHA (11<<5)
-#define R200_TXC_ARG_B_R1_COLOR (12<<5)
-#define R200_TXC_ARG_B_R1_ALPHA (13<<5)
-#define R200_TXC_ARG_B_R2_COLOR (14<<5)
-#define R200_TXC_ARG_B_R2_ALPHA (15<<5)
-#define R200_TXC_ARG_B_R3_COLOR (16<<5)
-#define R200_TXC_ARG_B_R3_ALPHA (17<<5)
-#define R200_TXC_ARG_B_R4_COLOR (18<<5)
-#define R200_TXC_ARG_B_R4_ALPHA (19<<5)
-#define R200_TXC_ARG_B_R5_COLOR (20<<5)
-#define R200_TXC_ARG_B_R5_ALPHA (21<<5)
-#define R200_TXC_ARG_B_TFACTOR1_COLOR (26<<5)
-#define R200_TXC_ARG_B_TFACTOR1_ALPHA (27<<5)
-#define R200_TXC_ARG_B_MASK (31 << 5)
-#define R200_TXC_ARG_B_SHIFT 5
-#define R200_TXC_ARG_C_ZERO (0<<10)
-#define R200_TXC_ARG_C_CURRENT_COLOR (2<<10)
-#define R200_TXC_ARG_C_CURRENT_ALPHA (3<<10)
-#define R200_TXC_ARG_C_DIFFUSE_COLOR (4<<10)
-#define R200_TXC_ARG_C_DIFFUSE_ALPHA (5<<10)
-#define R200_TXC_ARG_C_SPECULAR_COLOR (6<<10)
-#define R200_TXC_ARG_C_SPECULAR_ALPHA (7<<10)
-#define R200_TXC_ARG_C_TFACTOR_COLOR (8<<10)
-#define R200_TXC_ARG_C_TFACTOR_ALPHA (9<<10)
-#define R200_TXC_ARG_C_R0_COLOR (10<<10)
-#define R200_TXC_ARG_C_R0_ALPHA (11<<10)
-#define R200_TXC_ARG_C_R1_COLOR (12<<10)
-#define R200_TXC_ARG_C_R1_ALPHA (13<<10)
-#define R200_TXC_ARG_C_R2_COLOR (14<<10)
-#define R200_TXC_ARG_C_R2_ALPHA (15<<10)
-#define R200_TXC_ARG_C_R3_COLOR (16<<10)
-#define R200_TXC_ARG_C_R3_ALPHA (17<<10)
-#define R200_TXC_ARG_C_R4_COLOR (18<<10)
-#define R200_TXC_ARG_C_R4_ALPHA (19<<10)
-#define R200_TXC_ARG_C_R5_COLOR (20<<10)
-#define R200_TXC_ARG_C_R5_ALPHA (21<<10)
-#define R200_TXC_ARG_C_TFACTOR1_COLOR (26<<10)
-#define R200_TXC_ARG_C_TFACTOR1_ALPHA (27<<10)
-#define R200_TXC_ARG_C_MASK (31 << 10)
-#define R200_TXC_ARG_C_SHIFT 10
-#define R200_TXC_COMP_ARG_A (1 << 16)
-#define R200_TXC_COMP_ARG_A_SHIFT (16)
-#define R200_TXC_BIAS_ARG_A (1 << 17)
-#define R200_TXC_SCALE_ARG_A (1 << 18)
-#define R200_TXC_NEG_ARG_A (1 << 19)
-#define R200_TXC_COMP_ARG_B (1 << 20)
-#define R200_TXC_COMP_ARG_B_SHIFT (20)
-#define R200_TXC_BIAS_ARG_B (1 << 21)
-#define R200_TXC_SCALE_ARG_B (1 << 22)
-#define R200_TXC_NEG_ARG_B (1 << 23)
-#define R200_TXC_COMP_ARG_C (1 << 24)
-#define R200_TXC_COMP_ARG_C_SHIFT (24)
-#define R200_TXC_BIAS_ARG_C (1 << 25)
-#define R200_TXC_SCALE_ARG_C (1 << 26)
-#define R200_TXC_NEG_ARG_C (1 << 27)
-#define R200_TXC_OP_MADD (0 << 28)
-#define R200_TXC_OP_CND0 (2 << 28)
-#define R200_TXC_OP_LERP (3 << 28)
-#define R200_TXC_OP_DOT3 (4 << 28)
-#define R200_TXC_OP_DOT4 (5 << 28)
-#define R200_TXC_OP_CONDITIONAL (6 << 28)
-#define R200_TXC_OP_DOT2_ADD (7 << 28)
-#define R200_TXC_OP_MASK (7 << 28)
-#define R200_PP_TXCBLEND2_0 0x2f04
-#define R200_TXC_TFACTOR_SEL_SHIFT 0
-#define R200_TXC_TFACTOR_SEL_MASK 0x7
-#define R200_TXC_TFACTOR1_SEL_SHIFT 4
-#define R200_TXC_TFACTOR1_SEL_MASK (0x7 << 4)
-#define R200_TXC_SCALE_SHIFT 8
-#define R200_TXC_SCALE_MASK (7 << 8)
-#define R200_TXC_SCALE_1X (0 << 8)
-#define R200_TXC_SCALE_2X (1 << 8)
-#define R200_TXC_SCALE_4X (2 << 8)
-#define R200_TXC_SCALE_8X (3 << 8)
-#define R200_TXC_SCALE_INV2 (5 << 8)
-#define R200_TXC_SCALE_INV4 (6 << 8)
-#define R200_TXC_SCALE_INV8 (7 << 8)
-#define R200_TXC_CLAMP_SHIFT 12
-#define R200_TXC_CLAMP_MASK (3 << 12)
-#define R200_TXC_CLAMP_WRAP (0 << 12)
-#define R200_TXC_CLAMP_0_1 (1 << 12)
-#define R200_TXC_CLAMP_8_8 (2 << 12)
-#define R200_TXC_OUTPUT_REG_MASK (7 << 16)
-#define R200_TXC_OUTPUT_REG_NONE (0 << 16)
-#define R200_TXC_OUTPUT_REG_R0 (1 << 16)
-#define R200_TXC_OUTPUT_REG_R1 (2 << 16)
-#define R200_TXC_OUTPUT_REG_R2 (3 << 16)
-#define R200_TXC_OUTPUT_REG_R3 (4 << 16)
-#define R200_TXC_OUTPUT_REG_R4 (5 << 16)
-#define R200_TXC_OUTPUT_REG_R5 (6 << 16)
-#define R200_TXC_OUTPUT_MASK_MASK (7 << 20)
-#define R200_TXC_OUTPUT_MASK_RGB (0 << 20)
-#define R200_TXC_OUTPUT_MASK_RG (1 << 20)
-#define R200_TXC_OUTPUT_MASK_RB (2 << 20)
-#define R200_TXC_OUTPUT_MASK_R (3 << 20)
-#define R200_TXC_OUTPUT_MASK_GB (4 << 20)
-#define R200_TXC_OUTPUT_MASK_G (5 << 20)
-#define R200_TXC_OUTPUT_MASK_B (6 << 20)
-#define R200_TXC_OUTPUT_MASK_NONE (7 << 20)
-#define R200_TXC_REPL_NORMAL 0
-#define R200_TXC_REPL_RED 1
-#define R200_TXC_REPL_GREEN 2
-#define R200_TXC_REPL_BLUE 3
-#define R200_TXC_REPL_ARG_A_SHIFT 26
-#define R200_TXC_REPL_ARG_A_MASK (3 << 26)
-#define R200_TXC_REPL_ARG_B_SHIFT 28
-#define R200_TXC_REPL_ARG_B_MASK (3 << 28)
-#define R200_TXC_REPL_ARG_C_SHIFT 30
-#define R200_TXC_REPL_ARG_C_MASK (3 << 30)
-#define R200_PP_TXABLEND_0 0x2f08
-#define R200_TXA_ARG_A_ZERO (0)
-#define R200_TXA_ARG_A_CURRENT_ALPHA (2) /* guess */
-#define R200_TXA_ARG_A_CURRENT_BLUE (3) /* guess */
-#define R200_TXA_ARG_A_DIFFUSE_ALPHA (4)
-#define R200_TXA_ARG_A_DIFFUSE_BLUE (5)
-#define R200_TXA_ARG_A_SPECULAR_ALPHA (6)
-#define R200_TXA_ARG_A_SPECULAR_BLUE (7)
-#define R200_TXA_ARG_A_TFACTOR_ALPHA (8)
-#define R200_TXA_ARG_A_TFACTOR_BLUE (9)
-#define R200_TXA_ARG_A_R0_ALPHA (10)
-#define R200_TXA_ARG_A_R0_BLUE (11)
-#define R200_TXA_ARG_A_R1_ALPHA (12)
-#define R200_TXA_ARG_A_R1_BLUE (13)
-#define R200_TXA_ARG_A_R2_ALPHA (14)
-#define R200_TXA_ARG_A_R2_BLUE (15)
-#define R200_TXA_ARG_A_R3_ALPHA (16)
-#define R200_TXA_ARG_A_R3_BLUE (17)
-#define R200_TXA_ARG_A_R4_ALPHA (18)
-#define R200_TXA_ARG_A_R4_BLUE (19)
-#define R200_TXA_ARG_A_R5_ALPHA (20)
-#define R200_TXA_ARG_A_R5_BLUE (21)
-#define R200_TXA_ARG_A_TFACTOR1_ALPHA (26)
-#define R200_TXA_ARG_A_TFACTOR1_BLUE (27)
-#define R200_TXA_ARG_A_MASK (31 << 0)
-#define R200_TXA_ARG_A_SHIFT 0
-#define R200_TXA_ARG_B_ZERO (0<<5)
-#define R200_TXA_ARG_B_CURRENT_ALPHA (2<<5) /* guess */
-#define R200_TXA_ARG_B_CURRENT_BLUE (3<<5) /* guess */
-#define R200_TXA_ARG_B_DIFFUSE_ALPHA (4<<5)
-#define R200_TXA_ARG_B_DIFFUSE_BLUE (5<<5)
-#define R200_TXA_ARG_B_SPECULAR_ALPHA (6<<5)
-#define R200_TXA_ARG_B_SPECULAR_BLUE (7<<5)
-#define R200_TXA_ARG_B_TFACTOR_ALPHA (8<<5)
-#define R200_TXA_ARG_B_TFACTOR_BLUE (9<<5)
-#define R200_TXA_ARG_B_R0_ALPHA (10<<5)
-#define R200_TXA_ARG_B_R0_BLUE (11<<5)
-#define R200_TXA_ARG_B_R1_ALPHA (12<<5)
-#define R200_TXA_ARG_B_R1_BLUE (13<<5)
-#define R200_TXA_ARG_B_R2_ALPHA (14<<5)
-#define R200_TXA_ARG_B_R2_BLUE (15<<5)
-#define R200_TXA_ARG_B_R3_ALPHA (16<<5)
-#define R200_TXA_ARG_B_R3_BLUE (17<<5)
-#define R200_TXA_ARG_B_R4_ALPHA (18<<5)
-#define R200_TXA_ARG_B_R4_BLUE (19<<5)
-#define R200_TXA_ARG_B_R5_ALPHA (20<<5)
-#define R200_TXA_ARG_B_R5_BLUE (21<<5)
-#define R200_TXA_ARG_B_TFACTOR1_ALPHA (26<<5)
-#define R200_TXA_ARG_B_TFACTOR1_BLUE (27<<5)
-#define R200_TXA_ARG_B_MASK (31 << 5)
-#define R200_TXA_ARG_B_SHIFT 5
-#define R200_TXA_ARG_C_ZERO (0<<10)
-#define R200_TXA_ARG_C_CURRENT_ALPHA (2<<10) /* guess */
-#define R200_TXA_ARG_C_CURRENT_BLUE (3<<10) /* guess */
-#define R200_TXA_ARG_C_DIFFUSE_ALPHA (4<<10)
-#define R200_TXA_ARG_C_DIFFUSE_BLUE (5<<10)
-#define R200_TXA_ARG_C_SPECULAR_ALPHA (6<<10)
-#define R200_TXA_ARG_C_SPECULAR_BLUE (7<<10)
-#define R200_TXA_ARG_C_TFACTOR_ALPHA (8<<10)
-#define R200_TXA_ARG_C_TFACTOR_BLUE (9<<10)
-#define R200_TXA_ARG_C_R0_ALPHA (10<<10)
-#define R200_TXA_ARG_C_R0_BLUE (11<<10)
-#define R200_TXA_ARG_C_R1_ALPHA (12<<10)
-#define R200_TXA_ARG_C_R1_BLUE (13<<10)
-#define R200_TXA_ARG_C_R2_ALPHA (14<<10)
-#define R200_TXA_ARG_C_R2_BLUE (15<<10)
-#define R200_TXA_ARG_C_R3_ALPHA (16<<10)
-#define R200_TXA_ARG_C_R3_BLUE (17<<10)
-#define R200_TXA_ARG_C_R4_ALPHA (18<<10)
-#define R200_TXA_ARG_C_R4_BLUE (19<<10)
-#define R200_TXA_ARG_C_R5_ALPHA (20<<10)
-#define R200_TXA_ARG_C_R5_BLUE (21<<10)
-#define R200_TXA_ARG_C_TFACTOR1_ALPHA (26<<10)
-#define R200_TXA_ARG_C_TFACTOR1_BLUE (27<<10)
-#define R200_TXA_ARG_C_MASK (31 << 10)
-#define R200_TXA_ARG_C_SHIFT 10
-#define R200_TXA_COMP_ARG_A (1 << 16)
-#define R200_TXA_COMP_ARG_A_SHIFT (16)
-#define R200_TXA_BIAS_ARG_A (1 << 17)
-#define R200_TXA_SCALE_ARG_A (1 << 18)
-#define R200_TXA_NEG_ARG_A (1 << 19)
-#define R200_TXA_COMP_ARG_B (1 << 20)
-#define R200_TXA_COMP_ARG_B_SHIFT (20)
-#define R200_TXA_BIAS_ARG_B (1 << 21)
-#define R200_TXA_SCALE_ARG_B (1 << 22)
-#define R200_TXA_NEG_ARG_B (1 << 23)
-#define R200_TXA_COMP_ARG_C (1 << 24)
-#define R200_TXA_COMP_ARG_C_SHIFT (24)
-#define R200_TXA_BIAS_ARG_C (1 << 25)
-#define R200_TXA_SCALE_ARG_C (1 << 26)
-#define R200_TXA_NEG_ARG_C (1 << 27)
-#define R200_TXA_OP_MADD (0 << 28)
-#define R200_TXA_OP_CND0 (2 << 28)
-#define R200_TXA_OP_LERP (3 << 28)
-#define R200_TXA_OP_CONDITIONAL (6 << 28)
-#define R200_TXA_OP_MASK (7 << 28)
-#define R200_PP_TXABLEND2_0 0x2f0c
-#define R200_TXA_TFACTOR_SEL_SHIFT 0
-#define R200_TXA_TFACTOR_SEL_MASK 0x7
-#define R200_TXA_TFACTOR1_SEL_SHIFT 4
-#define R200_TXA_TFACTOR1_SEL_MASK (0x7 << 4)
-#define R200_TXA_SCALE_SHIFT 8
-#define R200_TXA_SCALE_MASK (7 << 8)
-#define R200_TXA_SCALE_1X (0 << 8)
-#define R200_TXA_SCALE_2X (1 << 8)
-#define R200_TXA_SCALE_4X (2 << 8)
-#define R200_TXA_SCALE_8X (3 << 8)
-#define R200_TXA_SCALE_INV2 (5 << 8)
-#define R200_TXA_SCALE_INV4 (6 << 8)
-#define R200_TXA_SCALE_INV8 (7 << 8)
-#define R200_TXA_CLAMP_SHIFT 12
-#define R200_TXA_CLAMP_MASK (3 << 12)
-#define R200_TXA_CLAMP_WRAP (0 << 12)
-#define R200_TXA_CLAMP_0_1 (1 << 12)
-#define R200_TXA_CLAMP_8_8 (2 << 12)
-#define R200_TXA_OUTPUT_REG_MASK (7 << 16)
-#define R200_TXA_OUTPUT_REG_NONE (0 << 16)
-#define R200_TXA_OUTPUT_REG_R0 (1 << 16)
-#define R200_TXA_OUTPUT_REG_R1 (2 << 16)
-#define R200_TXA_OUTPUT_REG_R2 (3 << 16)
-#define R200_TXA_OUTPUT_REG_R3 (4 << 16)
-#define R200_TXA_OUTPUT_REG_R4 (5 << 16)
-#define R200_TXA_OUTPUT_REG_R5 (6 << 16)
-#define R200_TXA_DOT_ALPHA (1 << 20)
-#define R200_TXA_REPL_NORMAL 0
-#define R200_TXA_REPL_RED 1
-#define R200_TXA_REPL_GREEN 2
-#define R200_TXA_REPL_ARG_A_SHIFT 26
-#define R200_TXA_REPL_ARG_A_MASK (3 << 26)
-#define R200_TXA_REPL_ARG_B_SHIFT 28
-#define R200_TXA_REPL_ARG_B_MASK (3 << 28)
-#define R200_TXA_REPL_ARG_C_SHIFT 30
-#define R200_TXA_REPL_ARG_C_MASK (3 << 30)
-#define R200_PP_TXCBLEND_1 0x2f10
-#define R200_PP_TXCBLEND2_1 0x2f14
-#define R200_PP_TXABLEND_1 0x2f18
-#define R200_PP_TXABLEND2_1 0x2f1c
-#define R200_PP_TXCBLEND_2 0x2f20
-#define R200_PP_TXCBLEND2_2 0x2f24
-#define R200_PP_TXABLEND_2 0x2f28
-#define R200_PP_TXABLEND2_2 0x2f2c
-#define R200_PP_TXCBLEND_3 0x2f30
-#define R200_PP_TXCBLEND2_3 0x2f34
-#define R200_PP_TXABLEND_3 0x2f38
-#define R200_PP_TXABLEND2_3 0x2f3c
-#define R200_PP_TXCBLEND_4 0x2f40
-#define R200_PP_TXCBLEND2_4 0x2f44
-#define R200_PP_TXABLEND_4 0x2f48
-#define R200_PP_TXABLEND2_4 0x2f4c
-#define R200_PP_TXCBLEND_5 0x2f50
-#define R200_PP_TXCBLEND2_5 0x2f54
-#define R200_PP_TXABLEND_5 0x2f58
-#define R200_PP_TXABLEND2_5 0x2f5c
-#define R200_PP_TXCBLEND_6 0x2f60
-#define R200_PP_TXCBLEND2_6 0x2f64
-#define R200_PP_TXABLEND_6 0x2f68
-#define R200_PP_TXABLEND2_6 0x2f6c
-#define R200_PP_TXCBLEND_7 0x2f70
-#define R200_PP_TXCBLEND2_7 0x2f74
-#define R200_PP_TXABLEND_7 0x2f78
-#define R200_PP_TXABLEND2_7 0x2f7c
-/* gap */
-#define R200_RB3D_BLENDCOLOR 0x3218 /* ARGB 8888 */
-#define R200_RB3D_ABLENDCNTL 0x321C /* see BLENDCTL */
-#define R200_RB3D_CBLENDCNTL 0x3220 /* see BLENDCTL */
-
-/*
- * Offsets in TCL vector state. NOTE: Hardwiring matrix positions.
- * Multiple contexts could collaberate to eliminate state bouncing.
- */
-#define R200_VS_LIGHT_AMBIENT_ADDR 0x00000028
-#define R200_VS_LIGHT_DIFFUSE_ADDR 0x00000030
-#define R200_VS_LIGHT_SPECULAR_ADDR 0x00000038
-#define R200_VS_LIGHT_DIRPOS_ADDR 0x00000040
-#define R200_VS_LIGHT_HWVSPOT_ADDR 0x00000048
-#define R200_VS_LIGHT_ATTENUATION_ADDR 0x00000050
-#define R200_VS_SPOT_DUAL_CONE 0x00000058
-#define R200_VS_GLOBAL_AMBIENT_ADDR 0x0000005C
-#define R200_VS_FOG_PARAM_ADDR 0x0000005D
-#define R200_VS_EYE_VECTOR_ADDR 0x0000005E
-#define R200_VS_UCP_ADDR 0x00000060
-#define R200_VS_PNT_SPRITE_VPORT_SCALE 0x00000068
-#define R200_VS_MATRIX_0_MV 0x00000080
-#define R200_VS_MATRIX_1_INV_MV 0x00000084
-#define R200_VS_MATRIX_2_MVP 0x00000088
-#define R200_VS_MATRIX_3_TEX0 0x0000008C
-#define R200_VS_MATRIX_4_TEX1 0x00000090
-#define R200_VS_MATRIX_5_TEX2 0x00000094
-#define R200_VS_MATRIX_6_TEX3 0x00000098
-#define R200_VS_MATRIX_7_TEX4 0x0000009C
-#define R200_VS_MATRIX_8_TEX5 0x000000A0
-#define R200_VS_MAT_0_EMISS 0x000000B0
-#define R200_VS_MAT_0_AMB 0x000000B1
-#define R200_VS_MAT_0_DIF 0x000000B2
-#define R200_VS_MAT_0_SPEC 0x000000B3
-#define R200_VS_MAT_1_EMISS 0x000000B4
-#define R200_VS_MAT_1_AMB 0x000000B5
-#define R200_VS_MAT_1_DIF 0x000000B6
-#define R200_VS_MAT_1_SPEC 0x000000B7
-#define R200_VS_EYE2CLIP_MTX 0x000000B8
-#define R200_VS_PNT_SPRITE_ATT_CONST 0x000000BC
-#define R200_VS_PNT_SPRITE_EYE_IN_MODEL 0x000000BD
-#define R200_VS_PNT_SPRITE_CLAMP 0x000000BE
-#define R200_VS_MAX 0x000001C0
-
-/*
- * Offsets in TCL scalar state
- */
-#define R200_SS_LIGHT_DCD_ADDR 0x00000000
-#define R200_SS_LIGHT_DCM_ADDR 0x00000008
-#define R200_SS_LIGHT_SPOT_EXPONENT_ADDR 0x00000010
-#define R200_SS_LIGHT_SPOT_CUTOFF_ADDR 0x00000018
-#define R200_SS_LIGHT_SPECULAR_THRESH_ADDR 0x00000020
-#define R200_SS_LIGHT_RANGE_CUTOFF_SQRD 0x00000028
-#define R200_SS_LIGHT_RANGE_ATT_CONST 0x00000030
-#define R200_SS_VERT_GUARD_CLIP_ADJ_ADDR 0x00000080
-#define R200_SS_VERT_GUARD_DISCARD_ADJ_ADDR 0x00000081
-#define R200_SS_HORZ_GUARD_CLIP_ADJ_ADDR 0x00000082
-#define R200_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 0x00000083
-#define R200_SS_MAT_0_SHININESS 0x00000100
-#define R200_SS_MAT_1_SHININESS 0x00000101
-
-/*
- * Matrix indices
- */
-#define R200_MTX_MV 0
-#define R200_MTX_IMV 1
-#define R200_MTX_MVP 2
-#define R200_MTX_TEX0 3
-#define R200_MTX_TEX1 4
-#define R200_MTX_TEX2 5
-#define R200_MTX_TEX3 6
-#define R200_MTX_TEX4 7
-#define R200_MTX_TEX5 8
-
-/* Color formats for 2d packets
- */
-#define R200_CP_COLOR_FORMAT_CI8 2
-#define R200_CP_COLOR_FORMAT_ARGB1555 3
-#define R200_CP_COLOR_FORMAT_RGB565 4
-#define R200_CP_COLOR_FORMAT_ARGB8888 6
-#define R200_CP_COLOR_FORMAT_RGB332 7
-#define R200_CP_COLOR_FORMAT_RGB8 9
-#define R200_CP_COLOR_FORMAT_ARGB4444 15
-
-/*
- * CP type-3 packets
- */
-#define R200_CP_CMD_NOP 0xC0001000
-#define R200_CP_CMD_NEXT_CHAR 0xC0001900
-#define R200_CP_CMD_PLY_NEXTSCAN 0xC0001D00
-#define R200_CP_CMD_SET_SCISSORS 0xC0001E00
-#define R200_CP_CMD_LOAD_MICROCODE 0xC0002400
-#define R200_CP_CMD_WAIT_FOR_IDLE 0xC0002600
-#define R200_CP_CMD_3D_DRAW_VBUF 0xC0002800
-#define R200_CP_CMD_3D_DRAW_IMMD 0xC0002900
-#define R200_CP_CMD_3D_DRAW_INDX 0xC0002A00
-#define R200_CP_CMD_LOAD_PALETTE 0xC0002C00
-#define R200_CP_CMD_3D_LOAD_VBPNTR 0xC0002F00
-#define R200_CP_CMD_INDX_BUFFER 0xC0003300
-#define R200_CP_CMD_3D_DRAW_VBUF_2 0xC0003400
-#define R200_CP_CMD_3D_DRAW_IMMD_2 0xC0003500
-#define R200_CP_CMD_3D_DRAW_INDX_2 0xC0003600
-#define R200_CP_CMD_PAINT 0xC0009100
-#define R200_CP_CMD_BITBLT 0xC0009200
-#define R200_CP_CMD_SMALLTEXT 0xC0009300
-#define R200_CP_CMD_HOSTDATA_BLT 0xC0009400
-#define R200_CP_CMD_POLYLINE 0xC0009500
-#define R200_CP_CMD_POLYSCANLINES 0xC0009800
-#define R200_CP_CMD_PAINT_MULTI 0xC0009A00
-#define R200_CP_CMD_BITBLT_MULTI 0xC0009B00
-#define R200_CP_CMD_TRANS_BITBLT 0xC0009C00
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_sanity.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_sanity.h
deleted file mode 100644
index 30852b490..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_sanity.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef R200_SANITY_H
-#define R200_SANITY_H
-
-extern int r200SanityCmdBuffer(r200ContextPtr rmesa,
- int nbox, drm_clip_rect_t * boxes);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_state.h
deleted file mode 100644
index 3e1a9c8ba..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_state.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_STATE_H__
-#define __R200_STATE_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r200_context.h"
-
-extern void r200InitState(r200ContextPtr rmesa);
-extern void r200InitStateFuncs(struct dd_function_table *functions);
-extern void r200InitTnlFuncs(GLcontext * ctx);
-
-extern void r200UpdateMaterial(GLcontext * ctx);
-
-extern void r200UpdateViewportOffset(GLcontext * ctx);
-extern void r200UpdateWindow(GLcontext * ctx);
-
-extern void r200ValidateState(GLcontext * ctx);
-
-extern void r200PrintDirty(r200ContextPtr rmesa, const char *msg);
-
-extern void r200LightingSpaceChange(GLcontext * ctx);
-
-#endif
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tcl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tcl.h
deleted file mode 100644
index 4528cf152..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tcl.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.h,v 1.2 2002/12/16 16:18:55 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_TCL_H__
-#define __R200_TCL_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r200_context.h"
-
-extern void r200TclPrimitive(GLcontext * ctx, GLenum prim, int hw_prim);
-extern void r200EmitEltPrimitive(GLcontext * ctx, GLuint first, GLuint last,
- GLuint flags);
-extern void r200EmitPrimitive(GLcontext * ctx, GLuint first, GLuint last,
- GLuint flags);
-
-#endif
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tex.h
deleted file mode 100644
index bc0dbc3fb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r200_tex.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_TEX_H__
-#define __R200_TEX_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r200UpdateTextureState(GLcontext * ctx);
-
-extern int r200UploadTexImages(r200ContextPtr rmesa, r200TexObjPtr t,
- GLuint face);
-
-extern void r200DestroyTexObj(r200ContextPtr rmesa, r200TexObjPtr t);
-
-extern void r200InitTextureFuncs(struct dd_function_table *functions);
-
-#endif
-#endif /* __R200_TEX_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c
deleted file mode 100644
index d3c22fda1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#include "glheader.h"
-#include "state.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-#include "simple_list.h"
-
-#include "drm.h"
-#include "radeon_drm.h"
-
-#include "radeon_ioctl.h"
-#include "r300_context.h"
-#include "r300_ioctl.h"
-#include "radeon_reg.h"
-#include "r300_reg.h"
-#include "r300_cmdbuf.h"
-#include "r300_emit.h"
-
-
-// Set this to 1 for extremely verbose debugging of command buffers
-#define DEBUG_CMDBUF 0
-
-
-/**
- * Send the current command buffer via ioctl to the hardware.
- */
-int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller)
-{
- int ret;
- int i;
- drm_radeon_cmd_buffer_t cmd;
- int start;
-
- if (r300->radeon.lost_context) {
- start = 0;
- r300->radeon.lost_context = GL_FALSE;
- } else
- start = r300->cmdbuf.count_reemit;
-
- if (RADEON_DEBUG & DEBUG_IOCTL) {
- fprintf(stderr, "%s from %s - %i cliprects\n",
- __FUNCTION__, caller, r300->radeon.numClipRects);
-
- if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_VERBOSE)
- for (i = start; i < r300->cmdbuf.count_used; ++i)
- fprintf(stderr, "%d: %08x\n", i,
- r300->cmdbuf.cmd_buf[i]);
- }
-
- cmd.buf = (char*)(r300->cmdbuf.cmd_buf + start);
- cmd.bufsz = (r300->cmdbuf.count_used - start) * 4;
-
- if (r300->radeon.state.scissor.enabled) {
- cmd.nbox = r300->radeon.state.scissor.numClipRects;
- cmd.boxes = (drm_clip_rect_t *)r300->radeon.state.scissor.pClipRects;
- } else {
- cmd.nbox = r300->radeon.numClipRects;
- cmd.boxes = (drm_clip_rect_t *)r300->radeon.pClipRects;
- }
-
- ret = drmCommandWrite(r300->radeon.dri.fd,
- DRM_RADEON_CMDBUF, &cmd, sizeof(cmd));
-
- if (RADEON_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "Syncing in %s (from %s)\n\n", __FUNCTION__, caller);
- radeonWaitForIdleLocked(&r300->radeon);
- }
-
- r300->dma.nr_released_bufs = 0;
- r300->cmdbuf.count_used = 0;
- r300->cmdbuf.count_reemit = 0;
-
- return ret;
-}
-
-
-int r300FlushCmdBuf(r300ContextPtr r300, const char* caller)
-{
- int ret;
- int i;
- drm_radeon_cmd_buffer_t cmd;
- int start;
-
- LOCK_HARDWARE(&r300->radeon);
-
- ret=r300FlushCmdBufLocked(r300, caller);
-
- UNLOCK_HARDWARE(&r300->radeon);
-
- if (ret) {
- fprintf(stderr, "drmRadeonCmdBuffer: %d (exiting)\n", ret);
- exit(ret);
- }
-
- return ret;
-}
-
-
-static void print_state_atom(struct r300_state_atom *state, int dwords)
-{
- int i;
-
- fprintf(stderr, " emit %s/%d/%d\n", state->name, dwords, state->cmd_size);
-
- if (RADEON_DEBUG & DEBUG_VERBOSE)
- for (i = 0; i < dwords; i++)
- fprintf(stderr, " %s[%d]: %08X\n", state->name, i,
- state->cmd[i]);
-}
-
-/**
- * Emit all atoms with a dirty field equal to dirty.
- *
- * The caller must have ensured that there is enough space in the command
- * buffer.
- */
-static __inline__ void r300DoEmitState(r300ContextPtr r300, GLboolean dirty)
-{
- struct r300_state_atom* atom;
- uint32_t* dest;
-
- dest = r300->cmdbuf.cmd_buf + r300->cmdbuf.count_used;
-
- if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_STATE) {
- foreach(atom, &r300->hw.atomlist) {
- if ((atom->dirty || r300->hw.all_dirty) == dirty) {
- int dwords = (*atom->check)(r300, atom);
-
- if (dwords)
- print_state_atom(atom, dwords);
- else
- fprintf(stderr, " skip state %s\n",
- atom->name);
- }
- }
- }
-
-
- /* Emit WAIT */
- *dest = cmdwait(R300_WAIT_3D | R300_WAIT_3D_CLEAN);
- dest ++;
- r300->cmdbuf.count_used ++;
-
- /* Emit END3D */
- *dest = cmdpacify();
- dest ++;
- r300->cmdbuf.count_used ++;
-
- /* Emit actual atoms */
-
- foreach(atom, &r300->hw.atomlist) {
- if ((atom->dirty || r300->hw.all_dirty) == dirty) {
- int dwords = (*atom->check)(r300, atom);
-
- if (dwords) {
- memcpy(dest, atom->cmd, dwords*4);
- dest += dwords;
- r300->cmdbuf.count_used += dwords;
- atom->dirty = GL_FALSE;
- }
- }
- }
-}
-
-/**
- * Copy dirty hardware state atoms into the command buffer.
- *
- * We also copy out clean state if we're at the start of a buffer. That makes
- * it easy to recover from lost contexts.
- */
-void r300EmitState(r300ContextPtr r300)
-{
- if (RADEON_DEBUG & (DEBUG_STATE | DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (r300->cmdbuf.count_used && !r300->hw.is_dirty && !r300->hw.all_dirty)
- return;
-
- /* To avoid going across the entire set of states multiple times, just check
- * for enough space for the case of emitting all state, and inline the
- * r300AllocCmdBuf code here without all the checks.
- */
- r300EnsureCmdBufSpace(r300, r300->hw.max_state_size, __FUNCTION__);
-
- if (!r300->cmdbuf.count_used) {
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "Begin reemit state\n");
-
- r300DoEmitState(r300, GL_FALSE);
- r300->cmdbuf.count_reemit = r300->cmdbuf.count_used;
- }
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "Begin dirty state\n");
-
- r300DoEmitState(r300, GL_TRUE);
-
- assert(r300->cmdbuf.count_used < r300->cmdbuf.size);
-
- r300->hw.is_dirty = GL_FALSE;
- r300->hw.all_dirty = GL_FALSE;
-}
-
-#define CHECK( NM, COUNT ) \
-static int check_##NM( r300ContextPtr r300, \
- struct r300_state_atom* atom ) \
-{ \
- (void) atom; (void) r300; \
- return (COUNT); \
-}
-
-#define packet0_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->packet0.count)
-#define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
-
-CHECK( always, atom->cmd_size )
-CHECK( never, 0 )
-CHECK( variable, packet0_count(atom->cmd) ? (1 + packet0_count(atom->cmd)) : 0 )
-CHECK( vpu, vpu_count(atom->cmd) ? (1 + vpu_count(atom->cmd)*4) : 0 )
-
-#undef packet0_count
-#undef vpu_count
-
-#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \
- do { \
- r300->hw.ATOM.cmd_size = (SZ); \
- r300->hw.ATOM.cmd = (uint32_t*)CALLOC((SZ) * sizeof(uint32_t)); \
- r300->hw.ATOM.name = (NM); \
- r300->hw.ATOM.idx = (IDX); \
- r300->hw.ATOM.check = check_##CHK; \
- r300->hw.ATOM.dirty = GL_FALSE; \
- r300->hw.max_state_size += (SZ); \
- } while (0)
-
-
-/**
- * Allocate memory for the command buffer and initialize the state atom
- * list. Note that the initial hardware state is set by r300InitState().
- */
-void r300InitCmdBuf(r300ContextPtr r300)
-{
- int size, i, mtu;
-
- r300->hw.max_state_size = 2; /* reserve extra space for WAIT_IDLE */
-
- mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
- if (RADEON_DEBUG & DEBUG_TEXTURE) {
- fprintf(stderr, "Using %d maximum texture units..\n", mtu);
- }
-
- /* Initialize state atoms */
- ALLOC_STATE( vpt, always, R300_VPT_CMDSIZE, "vpt", 0 );
- r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6);
- ALLOC_STATE( unk2080, always, 2, "unk2080", 0 );
- r300->hw.unk2080.cmd[0] = cmdpacket0(0x2080, 1);
- ALLOC_STATE( vte, always, 3, "vte", 0 );
- r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2);
- ALLOC_STATE( unk2134, always, 3, "unk2134", 0 );
- r300->hw.unk2134.cmd[0] = cmdpacket0(0x2134, 2);
- ALLOC_STATE( unk2140, always, 2, "unk2140", 0 );
- r300->hw.unk2140.cmd[0] = cmdpacket0(0x2140, 1);
- ALLOC_STATE( vir[0], variable, R300_VIR_CMDSIZE, "vir/0", 0 );
- r300->hw.vir[0].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1);
- ALLOC_STATE( vir[1], variable, R300_VIR_CMDSIZE, "vir/1", 1 );
- r300->hw.vir[1].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_1_0, 1);
- ALLOC_STATE( vic, always, R300_VIC_CMDSIZE, "vic", 0 );
- r300->hw.vic.cmd[R300_VIC_CMD_0] = cmdpacket0(R300_VAP_INPUT_CNTL_0, 2);
- ALLOC_STATE( unk21DC, always, 2, "unk21DC", 0 );
- r300->hw.unk21DC.cmd[0] = cmdpacket0(0x21DC, 1);
- ALLOC_STATE( unk221C, always, 2, "unk221C", 0 );
- r300->hw.unk221C.cmd[0] = cmdpacket0(0x221C, 1);
- ALLOC_STATE( unk2220, always, 5, "unk2220", 0 );
- r300->hw.unk2220.cmd[0] = cmdpacket0(0x2220, 4);
- ALLOC_STATE( unk2288, always, 2, "unk2288", 0 );
- r300->hw.unk2288.cmd[0] = cmdpacket0(0x2288, 1);
- ALLOC_STATE( vof, always, R300_VOF_CMDSIZE, "vof", 0 );
- r300->hw.vof.cmd[R300_VOF_CMD_0] = cmdpacket0(R300_VAP_OUTPUT_VTX_FMT_0, 2);
- ALLOC_STATE( pvs, always, R300_PVS_CMDSIZE, "pvs", 0 );
- r300->hw.pvs.cmd[R300_PVS_CMD_0] = cmdpacket0(R300_VAP_PVS_CNTL_1, 3);
- ALLOC_STATE( gb_enable, always, 2, "gb_enable", 0 );
- r300->hw.gb_enable.cmd[0] = cmdpacket0(R300_GB_ENABLE, 1);
- ALLOC_STATE( gb_misc, always, R300_GB_MISC_CMDSIZE, "gb_misc", 0 );
- r300->hw.gb_misc.cmd[0] = cmdpacket0(R300_GB_MSPOS0, 5);
- ALLOC_STATE( txe, always, R300_TXE_CMDSIZE, "txe", 0 );
- r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(R300_TX_ENABLE, 1);
- ALLOC_STATE( unk4200, always, 5, "unk4200", 0 );
- r300->hw.unk4200.cmd[0] = cmdpacket0(0x4200, 4);
- ALLOC_STATE( unk4214, always, 2, "unk4214", 0 );
- r300->hw.unk4214.cmd[0] = cmdpacket0(0x4214, 1);
- ALLOC_STATE( ps, always, R300_PS_CMDSIZE, "ps", 0 );
- r300->hw.ps.cmd[0] = cmdpacket0(R300_RE_POINTSIZE, 1);
- ALLOC_STATE( unk4230, always, 4, "unk4230", 0 );
- r300->hw.unk4230.cmd[0] = cmdpacket0(0x4230, 3);
- ALLOC_STATE( lcntl, always, 2, "lcntl", 0 );
- r300->hw.lcntl.cmd[0] = cmdpacket0(R300_RE_LINE_CNT, 1);
- ALLOC_STATE( unk4260, always, 4, "unk4260", 0 );
- r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3);
- ALLOC_STATE( unk4274, always, 5, "unk4274", 0 );
- r300->hw.unk4274.cmd[0] = cmdpacket0(0x4274, 4);
- ALLOC_STATE( unk4288, always, 6, "unk4288", 0 );
- r300->hw.unk4288.cmd[0] = cmdpacket0(0x4288, 5);
- ALLOC_STATE( unk42A0, always, 2, "unk42A0", 0 );
- r300->hw.unk42A0.cmd[0] = cmdpacket0(0x42A0, 1);
- ALLOC_STATE( zbs, always, R300_ZBS_CMDSIZE, "zbs", 0 );
- r300->hw.zbs.cmd[R300_ZBS_CMD_0] = cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4);
- ALLOC_STATE( unk42B4, always, 2, "unk42B4", 0 );
- r300->hw.unk42B4.cmd[0] = cmdpacket0(0x42B4, 1);
- ALLOC_STATE( cul, always, R300_CUL_CMDSIZE, "cul", 0 );
- r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1);
- ALLOC_STATE( unk42C0, always, 3, "unk42C0", 0 );
- r300->hw.unk42C0.cmd[0] = cmdpacket0(0x42C0, 2);
- ALLOC_STATE( rc, always, R300_RC_CMDSIZE, "rc", 0 );
- r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_CNTL_0, 2);
- ALLOC_STATE( ri, always, R300_RI_CMDSIZE, "ri", 0 );
- r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R300_RS_INTERP_0, 8);
- ALLOC_STATE( rr, variable, R300_RR_CMDSIZE, "rr", 0 );
- r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1);
- ALLOC_STATE( unk43A4, always, 3, "unk43A4", 0 );
- r300->hw.unk43A4.cmd[0] = cmdpacket0(0x43A4, 2);
- ALLOC_STATE( unk43E8, always, 2, "unk43E8", 0 );
- r300->hw.unk43E8.cmd[0] = cmdpacket0(0x43E8, 1);
- ALLOC_STATE( fp, always, R300_FP_CMDSIZE, "fp", 0 );
- r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3);
- r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4);
- ALLOC_STATE( fpt, variable, R300_FPT_CMDSIZE, "fpt", 0 );
- r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0);
- ALLOC_STATE( unk46A4, always, 6, "unk46A4", 0 );
- r300->hw.unk46A4.cmd[0] = cmdpacket0(0x46A4, 5);
- ALLOC_STATE( fpi[0], variable, R300_FPI_CMDSIZE, "fpi/0", 0 );
- r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1);
- ALLOC_STATE( fpi[1], variable, R300_FPI_CMDSIZE, "fpi/1", 1 );
- r300->hw.fpi[1].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR1_0, 1);
- ALLOC_STATE( fpi[2], variable, R300_FPI_CMDSIZE, "fpi/2", 2 );
- r300->hw.fpi[2].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR2_0, 1);
- ALLOC_STATE( fpi[3], variable, R300_FPI_CMDSIZE, "fpi/3", 3 );
- r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1);
- ALLOC_STATE( unk4BC0, always, 2, "unk4BC0", 0 );
- r300->hw.unk4BC0.cmd[0] = cmdpacket0(0x4BC0, 1);
- ALLOC_STATE( unk4BC8, always, 4, "unk4BC8", 0 );
- r300->hw.unk4BC8.cmd[0] = cmdpacket0(0x4BC8, 3);
- ALLOC_STATE( at, always, R300_AT_CMDSIZE, "at", 0 );
- r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_PP_ALPHA_TEST, 2);
- ALLOC_STATE( unk4BD8, always, 2, "unk4BD8", 0 );
- r300->hw.unk4BD8.cmd[0] = cmdpacket0(0x4BD8, 1);
- ALLOC_STATE( fpp, variable, R300_FPP_CMDSIZE, "fpp", 0 );
- r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0);
- ALLOC_STATE( unk4E00, always, 2, "unk4E00", 0 );
- r300->hw.unk4E00.cmd[0] = cmdpacket0(0x4E00, 1);
- ALLOC_STATE( bld, always, R300_BLD_CMDSIZE, "bld", 0 );
- r300->hw.bld.cmd[R300_BLD_CMD_0] = cmdpacket0(R300_RB3D_CBLEND, 2);
- ALLOC_STATE( cmk, always, R300_CMK_CMDSIZE, "cmk", 0 );
- r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1);
- ALLOC_STATE( unk4E10, always, 4, "unk4E10", 0 );
- r300->hw.unk4E10.cmd[0] = cmdpacket0(0x4E10, 3);
- ALLOC_STATE( cb, always, R300_CB_CMDSIZE, "cb", 0 );
- r300->hw.cb.cmd[R300_CB_CMD_0] = cmdpacket0(R300_RB3D_COLOROFFSET0, 1);
- r300->hw.cb.cmd[R300_CB_CMD_1] = cmdpacket0(R300_RB3D_COLORPITCH0, 1);
- ALLOC_STATE( unk4E50, always, 10, "unk4E50", 0 );
- r300->hw.unk4E50.cmd[0] = cmdpacket0(0x4E50, 9);
- ALLOC_STATE( unk4E88, always, 2, "unk4E88", 0 );
- r300->hw.unk4E88.cmd[0] = cmdpacket0(0x4E88, 1);
- ALLOC_STATE( unk4EA0, always, 3, "unk4EA0 R350 only", 0 );
- r300->hw.unk4EA0.cmd[0] = cmdpacket0(0x4EA0, 2);
- ALLOC_STATE( zs, always, R300_ZS_CMDSIZE, "zstencil", 0 );
- r300->hw.zs.cmd[R300_ZS_CMD_0] = cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3);
- ALLOC_STATE( unk4F10, always, 5, "unk4F10", 0 );
- r300->hw.unk4F10.cmd[0] = cmdpacket0(0x4F10, 4);
- ALLOC_STATE( zb, always, R300_ZB_CMDSIZE, "zb", 0 );
- r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_RB3D_DEPTHOFFSET, 2);
- ALLOC_STATE( unk4F28, always, 2, "unk4F28", 0 );
- r300->hw.unk4F28.cmd[0] = cmdpacket0(0x4F28, 1);
- ALLOC_STATE( unk4F30, always, 3, "unk4F30", 0 );
- r300->hw.unk4F30.cmd[0] = cmdpacket0(0x4F30, 2);
- ALLOC_STATE( unk4F44, always, 2, "unk4F44", 0 );
- r300->hw.unk4F44.cmd[0] = cmdpacket0(0x4F44, 1);
- ALLOC_STATE( unk4F54, always, 2, "unk4F54", 0 );
- r300->hw.unk4F54.cmd[0] = cmdpacket0(0x4F54, 1);
-
- ALLOC_STATE( vpi, vpu, R300_VPI_CMDSIZE, "vpi", 0 );
- r300->hw.vpi.cmd[R300_VPI_CMD_0] = cmdvpu(R300_PVS_UPLOAD_PROGRAM, 0);
- ALLOC_STATE( vpp, vpu, R300_VPP_CMDSIZE, "vpp", 0 );
- r300->hw.vpp.cmd[R300_VPP_CMD_0] = cmdvpu(R300_PVS_UPLOAD_PARAMETERS, 0);
- ALLOC_STATE( vps, vpu, R300_VPS_CMDSIZE, "vps", 0 );
- r300->hw.vps.cmd[R300_VPS_CMD_0] = cmdvpu(R300_PVS_UPLOAD_POINTSIZE, 1);
-
- /* Textures */
- ALLOC_STATE( tex.filter, variable, mtu+1, "tex_filter", 0 );
- r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FILTER_0, 0);
-
- ALLOC_STATE( tex.unknown1, variable, mtu+1, "tex_unknown1", 0 );
- r300->hw.tex.unknown1.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_UNK1_0, 0);
-
- ALLOC_STATE( tex.size, variable, mtu+1, "tex_size", 0 );
- r300->hw.tex.size.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_SIZE_0, 0);
-
- ALLOC_STATE( tex.format, variable, mtu+1, "tex_format", 0 );
- r300->hw.tex.format.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_FORMAT_0, 0);
-
- ALLOC_STATE( tex.offset, variable, mtu+1, "tex_offset", 0 );
- r300->hw.tex.offset.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_OFFSET_0, 0);
-
- ALLOC_STATE( tex.unknown4, variable, mtu+1, "tex_unknown4", 0 );
- r300->hw.tex.unknown4.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_UNK4_0, 0);
-
- ALLOC_STATE( tex.border_color, variable, mtu+1, "tex_border_color", 0 );
- r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = cmdpacket0(R300_TX_BORDER_COLOR_0, 0);
-
-
- /* Setup the atom linked list */
- make_empty_list(&r300->hw.atomlist);
- r300->hw.atomlist.name = "atom-list";
-
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vpt);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2080);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vte);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2134);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2140);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vir[0]);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vir[1]);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vic);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk21DC);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk221C);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2220);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2288);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vof);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.pvs);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.gb_enable);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.gb_misc);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.txe);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4200);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4214);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.ps);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4230);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.lcntl);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4260);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4274);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4288);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42A0);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.zbs);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42B4);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.cul);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42C0);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.rc);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.ri);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.rr);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43A4);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43E8);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.fp);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.fpt);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk46A4);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[0]);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[1]);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[2]);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.fpi[3]);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4BC0);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4BC8);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.at);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4BD8);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.fpp);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E00);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.bld);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.cmk);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E10);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.cb);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E50);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4E88);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4EA0);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.zs);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F10);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.zb);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F28);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F30);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F44);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4F54);
-
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vpi);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vpp);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.vps);
-
- insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.filter);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.unknown1);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.size);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.format);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.offset);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.unknown4);
- insert_at_tail(&r300->hw.atomlist, &r300->hw.tex.border_color);
-
- r300->hw.is_dirty = GL_TRUE;
- r300->hw.all_dirty = GL_TRUE;
-
- /* Initialize command buffer */
- size = 256 * driQueryOptioni(&r300->radeon.optionCache, "command_buffer_size");
- if (size < 2*r300->hw.max_state_size) {
- size = 2*r300->hw.max_state_size+65535;
- }
- if (size > 64*256)
- size = 64*256;
-
- if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA)) {
- fprintf(stderr, "sizeof(drm_r300_cmd_header_t)=%d\n",
- sizeof(drm_r300_cmd_header_t));
- fprintf(stderr, "sizeof(drm_radeon_cmd_buffer_t)=%d\n",
- sizeof(drm_radeon_cmd_buffer_t));
- fprintf(stderr,
- "Allocating %d bytes command buffer (max state is %d bytes)\n",
- size*4, r300->hw.max_state_size*4);
- }
-
- r300->cmdbuf.size = size;
- r300->cmdbuf.cmd_buf = (uint32_t*)CALLOC(size*4);
- r300->cmdbuf.count_used = 0;
- r300->cmdbuf.count_reemit = 0;
-}
-
-
-/**
- * Destroy the command buffer and state atoms.
- */
-void r300DestroyCmdBuf(r300ContextPtr r300)
-{
- struct r300_state_atom* atom;
-
- FREE(r300->cmdbuf.cmd_buf);
-
- foreach(atom, &r300->hw.atomlist) {
- FREE(atom->cmd);
- }
-}
-
-void r300EmitBlit(r300ContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty, GLuint w, GLuint h)
-{
- drm_radeon_cmd_header_t *cmd;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr,
- "%s src %x/%x %d,%d dst: %x/%x %d,%d sz: %dx%d\n",
- __FUNCTION__, src_pitch, src_offset, srcx, srcy,
- dst_pitch, dst_offset, dstx, dsty, w, h);
-
- assert((src_pitch & 63) == 0);
- assert((dst_pitch & 63) == 0);
- assert((src_offset & 1023) == 0);
- assert((dst_offset & 1023) == 0);
- assert(w < (1 << 16));
- assert(h < (1 << 16));
-
- cmd =
- (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, 8,
- __FUNCTION__);
-
- cmd[0].header.cmd_type = R300_CMD_PACKET3;
- cmd[1].i = R200_CP_CMD_BITBLT_MULTI | (5 << 16);
- cmd[2].i = (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
- RADEON_GMC_DST_PITCH_OFFSET_CNTL |
- RADEON_GMC_BRUSH_NONE |
- (color_fmt << 8) |
- RADEON_GMC_SRC_DATATYPE_COLOR |
- RADEON_ROP3_S |
- RADEON_DP_SRC_SOURCE_MEMORY |
- RADEON_GMC_CLR_CMP_CNTL_DIS | RADEON_GMC_WR_MSK_DIS);
-
- cmd[3].i = ((src_pitch / 64) << 22) | (src_offset >> 10);
- cmd[4].i = ((dst_pitch / 64) << 22) | (dst_offset >> 10);
- cmd[5].i = (srcx << 16) | srcy;
- cmd[6].i = (dstx << 16) | dsty; /* dst */
- cmd[7].i = (w << 16) | h;
-}
-
-void r300EmitWait(r300ContextPtr rmesa, GLuint flags)
-{
- if (rmesa->radeon.dri.drmMinor >= 6) {
- drm_radeon_cmd_header_t *cmd;
-
- assert(!(flags & ~(R300_WAIT_2D | R300_WAIT_3D)));
-
- cmd =
- (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa,
- 1,
- __FUNCTION__);
- cmd[0].i = 0;
- cmd[0].wait.cmd_type = R300_CMD_WAIT;
- cmd[0].wait.flags = flags;
- }
-}
-
-void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset)
-{
- int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2;
- int i;
- LOCAL_VARS
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset);
-
- start_packet3(RADEON_CP_PACKET3_3D_LOAD_VBPNTR, sz-1);
- e32(nr);
- for(i=0;i+1<nr;i+=2){
- e32( (rmesa->state.aos[i].aos_size << 0)
- |(rmesa->state.aos[i].aos_stride << 8)
- |(rmesa->state.aos[i+1].aos_size << 16)
- |(rmesa->state.aos[i+1].aos_stride << 24)
- );
- e32(rmesa->state.aos[i].aos_offset+offset*4*rmesa->state.aos[i].aos_stride);
- e32(rmesa->state.aos[i+1].aos_offset+offset*4*rmesa->state.aos[i+1].aos_stride);
- }
- if(nr & 1){
- e32( (rmesa->state.aos[nr-1].aos_size << 0)
- |(rmesa->state.aos[nr-1].aos_stride << 8)
- );
- e32(rmesa->state.aos[nr-1].aos_offset+offset*4*rmesa->state.aos[nr-1].aos_stride);
- }
-
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.h
deleted file mode 100644
index b471f2ac4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_cmdbuf.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#ifndef __R300_CMDBUF_H__
-#define __R300_CMDBUF_H__
-
-#include "r300_context.h"
-
-
-extern int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller);
-extern int r300FlushCmdBuf(r300ContextPtr r300, const char* caller);
-
-extern void r300EmitState(r300ContextPtr r300);
-
-extern void r300InitCmdBuf(r300ContextPtr r300);
-extern void r300DestroyCmdBuf(r300ContextPtr r300);
-
-extern void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset);
-
-
-/**
- * Make sure that enough space is available in the command buffer
- * by flushing if necessary.
- */
-static __inline__ void r300EnsureCmdBufSpace(r300ContextPtr r300,
- int dwords, const char* caller)
-{
- assert(dwords < r300->cmdbuf.size);
-
- if (r300->cmdbuf.count_used + dwords > r300->cmdbuf.size)
- r300FlushCmdBuf(r300, caller);
-}
-
-
-/**
- * Allocate the given number of dwords in the command buffer and return
- * a pointer to the allocated area.
- * When necessary, these functions cause a flush. r300AllocCmdBuf() also
- * causes state reemission after a flush. This is necessary to ensure
- * correct hardware state after an unlock.
- */
-static __inline__ uint32_t* r300RawAllocCmdBuf(r300ContextPtr r300,
- int dwords, const char* caller)
-{
- uint32_t* ptr;
-
- r300EnsureCmdBufSpace(r300, dwords, caller);
-
- ptr = &r300->cmdbuf.cmd_buf[r300->cmdbuf.count_used];
- r300->cmdbuf.count_used += dwords;
- return ptr;
-}
-
-static __inline__ uint32_t* r300AllocCmdBuf(r300ContextPtr r300,
- int dwords, const char* caller)
-{
- uint32_t* ptr;
-
- r300EnsureCmdBufSpace(r300, dwords, caller);
-
- if (!r300->cmdbuf.count_used) {
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "Reemit state after flush (from %s)\n",
- caller);
- r300EmitState(r300);
- }
-
- ptr = &r300->cmdbuf.cmd_buf[r300->cmdbuf.count_used];
- r300->cmdbuf.count_used += dwords;
- return ptr;
-}
-
-extern void r300EmitBlit(r300ContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty, GLuint w, GLuint h);
-
-extern void r300EmitWait(r300ContextPtr rmesa, GLuint flags);
-extern void r300EmitLOAD_VBPNTR(r300ContextPtr rmesa, int start);
-extern void r300EmitVertexShader(r300ContextPtr rmesa);
-extern void r300EmitPixelShader(r300ContextPtr rmesa);
-
-#endif /* __R300_CMDBUF_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.c
deleted file mode 100644
index ba0c55069..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-#include "glheader.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#include "state.h"
-#include "bufferobj.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "radeon_ioctl.h"
-#include "radeon_span.h"
-#include "r300_context.h"
-#include "r300_cmdbuf.h"
-#include "r300_state.h"
-#include "r300_ioctl.h"
-#include "r300_tex.h"
-
-#include "vblank.h"
-#include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-
-/* hw_tcl_on derives from future_hw_tcl_on when its safe to change it. */
-int future_hw_tcl_on=0;
-int hw_tcl_on=0;
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_secondary_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-const struct dri_extension card_extensions[] = {
- {"GL_ARB_multisample", GL_ARB_multisample_functions},
- {"GL_ARB_multitexture", NULL},
- {"GL_ARB_texture_border_clamp", NULL},
- {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
-/* disable until we support it, fixes a few things in ut2004 */
-/* {"GL_ARB_texture_cube_map", NULL}, */
- {"GL_ARB_texture_env_add", NULL},
- {"GL_ARB_texture_env_combine", NULL},
- {"GL_ARB_texture_env_crossbar", NULL},
- {"GL_ARB_texture_env_dot3", NULL},
- {"GL_ARB_texture_mirrored_repeat", NULL},
- {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
- {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
-#if USE_ARB_F_P == 1
- {"GL_ARB_fragment_program", NULL},
-#endif
- {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
- {"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_secondary_color", GL_EXT_secondary_color_functions},
- {"GL_EXT_stencil_wrap", NULL},
- {"GL_EXT_texture_edge_clamp", NULL},
- {"GL_EXT_texture_env_combine", NULL},
- {"GL_EXT_texture_env_dot3", NULL},
- {"GL_EXT_texture_filter_anisotropic", NULL},
- {"GL_EXT_texture_lod_bias", NULL},
- {"GL_EXT_texture_mirror_clamp", NULL},
- {"GL_EXT_texture_rectangle", NULL},
- {"GL_ATI_texture_env_combine3", NULL},
- {"GL_ATI_texture_mirror_once", NULL},
- {"GL_MESA_pack_invert", NULL},
- {"GL_MESA_ycbcr_texture", NULL},
- {"GL_NV_blend_square", NULL},
- {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
- {"GL_SGIS_generate_mipmap", NULL},
- {NULL, NULL}
-};
-
-extern struct tnl_pipeline_stage _r300_render_stage;
-extern struct tnl_pipeline_stage _r300_tcl_stage;
-
-static const struct tnl_pipeline_stage *r300_pipeline[] = {
-
- /* Try and go straight to t&l
- */
- &_r300_tcl_stage,
-
- /* Catch any t&l fallbacks
- */
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_arb_vertex_program_stage,
- &_tnl_vertex_program_stage,
-
- /* Try again to go to tcl?
- * - no good for asymmetric-twoside (do with multipass)
- * - no good for asymmetric-unfilled (do with multipass)
- * - good for material
- * - good for texgen
- * - need to manipulate a bit of state
- *
- * - worth it/not worth it?
- */
-
- /* Else do them here.
- */
- &_r300_render_stage,
- &_tnl_render_stage, /* FALLBACK */
- 0,
-};
-
-static void r300BufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size,
- const GLvoid *data, GLenum usage, struct gl_buffer_object *obj)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- drm_radeon_mem_alloc_t alloc;
- int offset, ret;
-
- /* Free previous buffer */
- if (obj->OnCard) {
- drm_radeon_mem_free_t memfree;
-
- memfree.region = RADEON_MEM_REGION_GART;
- memfree.region_offset = (char *)obj->Data - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
-
- ret = drmCommandWrite(rmesa->radeon.radeonScreen->driScreen->fd,
- DRM_RADEON_FREE, &memfree, sizeof(memfree));
-
- if (ret) {
- WARN_ONCE("Failed to free GART memroy!\n");
- }
- obj->OnCard = GL_FALSE;
- }
-
- alloc.region = RADEON_MEM_REGION_GART;
- alloc.alignment = 4;
- alloc.size = size;
- alloc.region_offset = &offset;
-
- ret = drmCommandWriteRead( rmesa->radeon.dri.fd, DRM_RADEON_ALLOC, &alloc, sizeof(alloc));
- if (ret) {
- WARN_ONCE("Ran out of GART memory!\n");
- obj->Data = NULL;
- _mesa_buffer_data(ctx, target, size, data, usage, obj);
- return ;
- }
- obj->Data = ((char *)rmesa->radeon.radeonScreen->gartTextures.map) + offset;
-
- if (data)
- memcpy(obj->Data, data, size);
-
- obj->Size = size;
- obj->Usage = usage;
- obj->OnCard = GL_TRUE;
-#if 0
- fprintf(stderr, "allocated %d bytes at %p, offset=%d\n", size, obj->Data, offset);
-#endif
-}
-
-static void r300DeleteBuffer(GLcontext *ctx, struct gl_buffer_object *obj)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- if(r300IsGartMemory(rmesa, obj->Data, obj->Size)){
- drm_radeon_mem_free_t memfree;
- int ret;
-
- memfree.region = RADEON_MEM_REGION_GART;
- memfree.region_offset = (char *)obj->Data - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
-
- ret = drmCommandWrite(rmesa->radeon.radeonScreen->driScreen->fd,
- DRM_RADEON_FREE, &memfree, sizeof(memfree));
-
- if(ret){
- WARN_ONCE("Failed to free GART memroy!\n");
- }
- obj->Data = NULL;
- }
- _mesa_delete_buffer_object(ctx, obj);
-}
-
-/* Create the device specific rendering context.
- */
-GLboolean r300CreateContext(const __GLcontextModes * glVisual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
- struct dd_function_table functions;
- r300ContextPtr r300;
- GLcontext *ctx;
- int tcl_mode, i;
-
- assert(glVisual);
- assert(driContextPriv);
- assert(screen);
-
- /* Allocate the R300 context */
- r300 = (r300ContextPtr)CALLOC(sizeof(*r300));
- if (!r300)
- return GL_FALSE;
-
- /* Parse configuration files.
- * Do this here so that initialMaxAnisotropy is set before we create
- * the default textures.
- */
- driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache,
- screen->driScreen->myNum, "r300");
-
- /* Init default driver functions then plug in our R300-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions(&functions);
- r300InitIoctlFuncs(&functions);
- r300InitStateFuncs(&functions);
- r300InitTextureFuncs(&functions);
- r300InitShaderFuncs(&functions);
-
-#if 0 /* Needs various Mesa changes... */
- if (hw_tcl_on) {
- functions.BufferData = r300BufferData;
- functions.DeleteBuffer = r300DeleteBuffer;
- }
-#endif
-
- if (!radeonInitContext(&r300->radeon, &functions,
- glVisual, driContextPriv, sharedContextPrivate)) {
- FREE(r300);
- return GL_FALSE;
- }
-
- /* Init r300 context data */
- r300->dma.buf0_address = r300->radeon.radeonScreen->buffers->list[0].address;
-
- (void)memset(r300->texture_heaps, 0, sizeof(r300->texture_heaps));
- make_empty_list(&r300->swapped);
-
- r300->nr_heaps = 1 /* screen->numTexHeaps */ ;
- assert(r300->nr_heaps < R200_NR_TEX_HEAPS);
- for (i = 0; i < r300->nr_heaps; i++) {
- r300->texture_heaps[i] = driCreateTextureHeap(i, r300,
- screen->
- texSize[i], 12,
- RADEON_NR_TEX_REGIONS,
- (drmTextureRegionPtr)
- r300->radeon.sarea->
- tex_list[i],
- &r300->radeon.sarea->
- tex_age[i],
- &r300->swapped,
- sizeof
- (r300TexObj),
- (destroy_texture_object_t
- *)
- r300DestroyTexObj);
- }
- r300->texture_depth = driQueryOptioni(&r300->radeon.optionCache,
- "texture_depth");
- if (r300->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- r300->texture_depth = (screen->cpp == 4) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
- /* Set the maximum texture size small enough that we can guarentee that
- * all texture units can bind a maximal texture and have them both in
- * texturable memory at once.
- */
-
- ctx = r300->radeon.glCtx;
-
- ctx->Const.MaxTextureImageUnits = driQueryOptioni(&r300->radeon.optionCache,
- "texture_image_units");
- ctx->Const.MaxTextureCoordUnits = driQueryOptioni(&r300->radeon.optionCache,
- "texture_coord_units");
- ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits,
- ctx->Const.MaxTextureCoordUnits);
- ctx->Const.MaxTextureMaxAnisotropy = 16.0;
-
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = R300_POINTSIZE_MAX;
- ctx->Const.MaxPointSizeAA = R300_POINTSIZE_MAX;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = R300_LINESIZE_MAX;
- ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext(ctx);
- _ac_CreateContext(ctx);
- _tnl_CreateContext(ctx);
- _swsetup_CreateContext(ctx);
- _swsetup_Wakeup(ctx);
- _ae_create_context(ctx);
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, r300_pipeline);
-
- /* Try and keep materials and vertices separate:
- */
- _tnl_isolate_materials(ctx, GL_TRUE);
-
- /* Configure swrast and 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);
-
- /* currently bogus data */
- ctx->Const.MaxVertexProgramInstructions=VSF_MAX_FRAGMENT_LENGTH;
- ctx->Const.MaxVertexProgramAttribs=16; // r420
- ctx->Const.MaxVertexProgramTemps=VSF_MAX_FRAGMENT_TEMPS;
- ctx->Const.MaxVertexProgramLocalParams=256; // r420
- ctx->Const.MaxVertexProgramEnvParams=256; // r420
- ctx->Const.MaxVertexProgramAddressRegs=1;
-
-#if USE_ARB_F_P
- ctx->Const.MaxFragmentProgramTemps = PFS_NUM_TEMP_REGS;
- ctx->Const.MaxFragmentProgramAttribs = 11; /* copy i915... */
- ctx->Const.MaxFragmentProgramLocalParams = PFS_NUM_CONST_REGS;
- ctx->Const.MaxFragmentProgramEnvParams = PFS_NUM_CONST_REGS;
- ctx->Const.MaxFragmentProgramAluInstructions = PFS_MAX_ALU_INST;
- ctx->Const.MaxFragmentProgramTexInstructions = PFS_MAX_TEX_INST;
- ctx->Const.MaxFragmentProgramInstructions = PFS_MAX_ALU_INST+PFS_MAX_TEX_INST;
- ctx->Const.MaxFragmentProgramTexIndirections = PFS_MAX_TEX_INDIRECT;
- ctx->Const.MaxFragmentProgramAddressRegs = 0; /* and these are?? */
- ctx->_MaintainTexEnvProgram = GL_TRUE;
-#endif
-
- driInitExtensions(ctx, card_extensions, GL_TRUE);
-
- radeonInitSpanFuncs(ctx);
- r300InitCmdBuf(r300);
- r300InitState(r300);
-
-#if 0
- /* plug in a few more device driver functions */
- /* XXX these should really go right after _mesa_init_driver_functions() */
- r300InitPixelFuncs(ctx);
- r300InitSwtcl(ctx);
-#endif
- TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
-
- tcl_mode = driQueryOptioni(&r300->radeon.optionCache, "tcl_mode");
- if (driQueryOptionb(&r300->radeon.optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
-#if R200_MERGED
- FALLBACK(&r300->radeon, RADEON_FALLBACK_DISABLE, 1);
-#endif
- }
- if (tcl_mode == DRI_CONF_TCL_SW ||
- !(r300->radeon.radeonScreen->chipset & RADEON_CHIPSET_TCL)) {
- if (r300->radeon.radeonScreen->chipset & RADEON_CHIPSET_TCL) {
- r300->radeon.radeonScreen->chipset &= ~RADEON_CHIPSET_TCL;
- fprintf(stderr, "Disabling HW TCL support\n");
- }
- TCL_FALLBACK(r300->radeon.glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
- }
-
- return GL_TRUE;
-}
-
-/* Destroy the device specific context.
- */
-void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
-{
- GET_CURRENT_CONTEXT(ctx);
- r300ContextPtr r300 = (r300ContextPtr) driContextPriv->driverPrivate;
- radeonContextPtr current = ctx ? RADEON_CONTEXT(ctx) : NULL;
-
- if (RADEON_DEBUG & DEBUG_DRI) {
- fprintf(stderr, "Destroying context !\n");
- }
-
- /* check if we're deleting the currently bound context */
- if (&r300->radeon == current) {
- radeonFlush(r300->radeon.glCtx);
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- /* Free r300 context resources */
- assert(r300); /* should never be null */
-
- if (r300) {
- GLboolean release_texture_heaps;
-
- release_texture_heaps = (r300->radeon.glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext(r300->radeon.glCtx);
- _tnl_DestroyContext(r300->radeon.glCtx);
- _ac_DestroyContext(r300->radeon.glCtx);
- _swrast_DestroyContext(r300->radeon.glCtx);
-
- r300DestroyCmdBuf(r300);
-
- radeonCleanupContext(&r300->radeon);
-
- /* free the option cache */
- driDestroyOptionCache(&r300->radeon.optionCache);
-
- FREE(r300);
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.h
deleted file mode 100644
index b59f184e3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_context.h
+++ /dev/null
@@ -1,844 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#ifndef __R300_CONTEXT_H__
-#define __R300_CONTEXT_H__
-
-#include "tnl/t_vertex.h"
-#include "drm.h"
-#include "radeon_drm.h"
-#include "dri_util.h"
-#include "texmem.h"
-
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "radeon_context.h"
-
-#define USE_ARB_F_P 1
-
-struct r300_context;
-typedef struct r300_context r300ContextRec;
-typedef struct r300_context *r300ContextPtr;
-
-#include "radeon_lock.h"
-#include "mm.h"
-
-/* Checkpoint.. for convenience */
-#define CPT { fprintf(stderr, "%s:%s line %d\n", __FILE__, __FUNCTION__, __LINE__); }
-/* From http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html .
- I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble
- with other compilers ... GLUE!
-*/
-#if 1
-#define WARN_ONCE(a, ...) { \
- static int warn##__LINE__=1; \
- if(warn##__LINE__){ \
- fprintf(stderr, "*********************************WARN_ONCE*********************************\n"); \
- fprintf(stderr, "File %s function %s line %d\n", \
- __FILE__, __FUNCTION__, __LINE__); \
- fprintf(stderr, a, ## __VA_ARGS__);\
- fprintf(stderr, "***************************************************************************\n"); \
- warn##__LINE__=0;\
- } \
- }
-#else
-#define WARN_ONCE(a, ...) {}
-#endif
-
-typedef GLuint uint32_t;
-typedef GLubyte uint8_t;
-struct r300_fragment_program;
-
- /* We should probably change types within vertex_shader
- and pixel_shader structure later on */
-#define CARD32 GLuint
-#include "vertex_shader.h"
-#if USE_ARB_F_P == 1
-#include "r300_fragprog.h"
-#else
-#include "pixel_shader.h"
-#endif
-#undef CARD32
-
-static __inline__ uint32_t r300PackFloat32(float fl)
-{
- union { float fl; uint32_t u; } u;
-
- u.fl = fl;
- return u.u;
-}
-
-
-/************ DMA BUFFERS **************/
-
-/* Need refcounting on dma buffers:
- */
-struct r300_dma_buffer {
- int refcount; /* the number of retained regions in buf */
- drmBufPtr buf;
-};
-
-#define GET_START(rvb) (rmesa->radeon.radeonScreen->gart_buffer_offset + \
- (rvb)->address - rmesa->dma.buf0_address + \
- (rvb)->start)
-
-/* A retained region, eg vertices for indexed vertices.
- */
-struct r300_dma_region {
- struct r300_dma_buffer *buf;
- char *address; /* == buf->address */
- int start, end, ptr; /* offsets from start of buf */
-
- int aos_offset; /* address in GART memory */
- int aos_stride; /* distance between elements, in dwords */
- int aos_size; /* number of components (1-4) */
- int aos_format; /* format of components */
- int aos_reg; /* VAP register assignment */
-};
-
-struct r300_dma {
- /* Active dma region. Allocations for vertices and retained
- * regions come from here. Also used for emitting random vertices,
- * these may be flushed by calling flush_current();
- */
- struct r300_dma_region current;
-
- void (*flush) (r300ContextPtr);
-
- char *buf0_address; /* start of buf[0], for index calcs */
-
- /* Number of "in-flight" DMA buffers, i.e. the number of buffers
- * for which a DISCARD command is currently queued in the command buffer.
- */
- GLuint nr_released_bufs;
-};
-
- /* Texture related */
-
-typedef struct r300_tex_obj r300TexObj, *r300TexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct r300_tex_obj {
- driTextureObject base;
-
- GLuint bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint dirty_state; /* Flags (1 per texunit) for
- whether or not this texobj
- has dirty hardware state
- (pp_*) that needs to be
- brought into the
- texunit. */
-
- drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
- /* Six, for the cube faces */
-
-
- /* hardware register values */
- /* Note that R200 has 8 registers per texture and R300 only 7 */
- GLuint filter;
- GLuint pitch; /* one of the unknown registers.. unknown 1 ?*/
- GLuint size; /* npot only */
- GLuint format;
- GLuint offset; /* Image location in the card's address space.
- All cube faces follow. */
- GLuint unknown4;
- GLuint unknown5;
- /* end hardware registers */
-
- /* registers computed by r200 code - keep them here to
- compare against what is actually written.
-
- to be removed later.. */
- GLuint pp_border_color;
- GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
- GLuint format_x;
-
-
- GLboolean border_fallback;
-};
-
-struct r300_texture_env_state {
- r300TexObjPtr texobj;
- GLenum format;
- GLenum envMode;
-};
-
-#define R300_MAX_TEXTURE_UNITS 8
-
-struct r300_texture_state {
- struct r300_texture_env_state unit[R300_MAX_TEXTURE_UNITS];
- int tc_count; /* number of incoming texture coordinates from VAP */
-};
-
-/**
- * A block of hardware state.
- *
- * When check returns non-zero, the returned number of dwords must be
- * copied verbatim into the command buffer in order to update a state atom
- * when it is dirty.
- */
-struct r300_state_atom {
- struct r300_state_atom *next, *prev;
- const char* name; /* for debug */
- int cmd_size; /* maximum size in dwords */
- GLuint idx; /* index in an array (e.g. textures) */
- uint32_t* cmd;
- GLboolean dirty;
-
- int (*check)(r300ContextPtr, struct r300_state_atom* atom);
-};
-
-
-#define R300_VPT_CMD_0 0
-#define R300_VPT_XSCALE 1
-#define R300_VPT_XOFFSET 2
-#define R300_VPT_YSCALE 3
-#define R300_VPT_YOFFSET 4
-#define R300_VPT_ZSCALE 5
-#define R300_VPT_ZOFFSET 6
-#define R300_VPT_CMDSIZE 7
-
-#define R300_VIR_CMD_0 0 /* vir is variable size (at least 1) */
-#define R300_VIR_CNTL_0 1
-#define R300_VIR_CNTL_1 2
-#define R300_VIR_CNTL_2 3
-#define R300_VIR_CNTL_3 4
-#define R300_VIR_CNTL_4 5
-#define R300_VIR_CNTL_5 6
-#define R300_VIR_CNTL_6 7
-#define R300_VIR_CNTL_7 8
-#define R300_VIR_CMDSIZE 9
-
-#define R300_VIC_CMD_0 0
-#define R300_VIC_CNTL_0 1
-#define R300_VIC_CNTL_1 2
-#define R300_VIC_CMDSIZE 3
-
-#define R300_VOF_CMD_0 0
-#define R300_VOF_CNTL_0 1
-#define R300_VOF_CNTL_1 2
-#define R300_VOF_CMDSIZE 3
-
-
-#define R300_PVS_CMD_0 0
-#define R300_PVS_CNTL_1 1
-#define R300_PVS_CNTL_2 2
-#define R300_PVS_CNTL_3 3
-#define R300_PVS_CMDSIZE 4
-
-#define R300_GB_MISC_CMD_0 0
-#define R300_GB_MISC_MSPOS_0 1
-#define R300_GB_MISC_MSPOS_1 2
-#define R300_GB_MISC_TILE_CONFIG 3
-#define R300_GB_MISC_SELECT 4
-#define R300_GB_MISC_AA_CONFIG 5
-#define R300_GB_MISC_CMDSIZE 6
-
-#define R300_TXE_CMD_0 0
-#define R300_TXE_ENABLE 1
-#define R300_TXE_CMDSIZE 2
-
-#define R300_PS_CMD_0 0
-#define R300_PS_POINTSIZE 1
-#define R300_PS_CMDSIZE 2
-
-#define R300_ZBS_CMD_0 0
-#define R300_ZBS_T_FACTOR 1
-#define R300_ZBS_T_CONSTANT 2
-#define R300_ZBS_W_FACTOR 3
-#define R300_ZBS_W_CONSTANT 4
-#define R300_ZBS_CMDSIZE 5
-
-#define R300_CUL_CMD_0 0
-#define R300_CUL_CULL 1
-#define R300_CUL_CMDSIZE 2
-
-#define R300_RC_CMD_0 0
-#define R300_RC_CNTL_0 1
-#define R300_RC_CNTL_1 2
-#define R300_RC_CMDSIZE 3
-
-#define R300_RI_CMD_0 0
-#define R300_RI_INTERP_0 1
-#define R300_RI_INTERP_1 2
-#define R300_RI_INTERP_2 3
-#define R300_RI_INTERP_3 4
-#define R300_RI_INTERP_4 5
-#define R300_RI_INTERP_5 6
-#define R300_RI_INTERP_6 7
-#define R300_RI_INTERP_7 8
-#define R300_RI_CMDSIZE 9
-
-#define R300_RR_CMD_0 0 /* rr is variable size (at least 1) */
-#define R300_RR_ROUTE_0 1
-#define R300_RR_ROUTE_1 2
-#define R300_RR_ROUTE_2 3
-#define R300_RR_ROUTE_3 4
-#define R300_RR_ROUTE_4 5
-#define R300_RR_ROUTE_5 6
-#define R300_RR_ROUTE_6 7
-#define R300_RR_ROUTE_7 8
-#define R300_RR_CMDSIZE 9
-
-#define R300_FP_CMD_0 0
-#define R300_FP_CNTL0 1
-#define R300_FP_CNTL1 2
-#define R300_FP_CNTL2 3
-#define R300_FP_CMD_1 4
-#define R300_FP_NODE0 5
-#define R300_FP_NODE1 6
-#define R300_FP_NODE2 7
-#define R300_FP_NODE3 8
-#define R300_FP_CMDSIZE 9
-
-#define R300_FPT_CMD_0 0
-#define R300_FPT_INSTR_0 1
-#define R300_FPT_CMDSIZE 65
-
-#define R300_FPI_CMD_0 0
-#define R300_FPI_INSTR_0 1
-#define R300_FPI_CMDSIZE 65
-
-#define R300_FPP_CMD_0 0
-#define R300_FPP_PARAM_0 1
-#define R300_FPP_CMDSIZE (32*4+1)
-
-#define R300_AT_CMD_0 0
-#define R300_AT_ALPHA_TEST 1
-#define R300_AT_UNKNOWN 2
-#define R300_AT_CMDSIZE 3
-
-#define R300_BLD_CMD_0 0
-#define R300_BLD_CBLEND 1
-#define R300_BLD_ABLEND 2
-#define R300_BLD_CMDSIZE 3
-
-#define R300_CMK_CMD_0 0
-#define R300_CMK_COLORMASK 1
-#define R300_CMK_CMDSIZE 2
-
-#define R300_CB_CMD_0 0
-#define R300_CB_OFFSET 1
-#define R300_CB_CMD_1 2
-#define R300_CB_PITCH 3
-#define R300_CB_CMDSIZE 4
-
-#define R300_ZS_CMD_0 0
-#define R300_ZS_CNTL_0 1
-#define R300_ZS_CNTL_1 2
-#define R300_ZS_CNTL_2 3
-#define R300_ZS_CMDSIZE 4
-
-#define R300_ZB_CMD_0 0
-#define R300_ZB_OFFSET 1
-#define R300_ZB_PITCH 2
-#define R300_ZB_CMDSIZE 3
-
-#define R300_VPI_CMD_0 0
-#define R300_VPI_INSTR_0 1
-#define R300_VPI_CMDSIZE 1025 /* 256 16 byte instructions */
-
-#define R300_VPP_CMD_0 0
-#define R300_VPP_PARAM_0 1
-#define R300_VPP_CMDSIZE 1025 /* 256 4-component parameters */
-
-#define R300_VPS_CMD_0 0
-#define R300_VPS_ZERO_0 1
-#define R300_VPS_ZERO_1 2
-#define R300_VPS_POINTSIZE 3
-#define R300_VPS_ZERO_3 4
-#define R300_VPS_CMDSIZE 5
-
- /* the layout is common for all fields inside tex */
-#define R300_TEX_CMD_0 0
-#define R300_TEX_VALUE_0 1
-/* We don't really use this, instead specify mtu+1 dynamically
-#define R300_TEX_CMDSIZE (MAX_TEXTURE_UNITS+1)
-*/
-
-/**
- * Cache for hardware register state.
- */
-struct r300_hw_state {
- struct r300_state_atom atomlist;
-
- GLboolean is_dirty;
- GLboolean all_dirty;
- int max_state_size; /* in dwords */
-
- struct r300_state_atom vpt; /* viewport (1D98) */
- struct r300_state_atom unk2080; /* (2080) */
- struct r300_state_atom vof; /* VAP output format register 0x2090 */
- struct r300_state_atom vte; /* (20B0) */
- struct r300_state_atom unk2134; /* (2134) */
- struct r300_state_atom unk2140; /* (2140) */
- struct r300_state_atom vir[2]; /* vap input route (2150/21E0) */
- struct r300_state_atom vic; /* vap input control (2180) */
- struct r300_state_atom unk21DC; /* (21DC) */
- struct r300_state_atom unk221C; /* (221C) */
- struct r300_state_atom unk2220; /* (2220) */
- struct r300_state_atom unk2288; /* (2288) */
- struct r300_state_atom pvs; /* pvs_cntl (22D0) */
- struct r300_state_atom gb_enable; /* (4008) */
- struct r300_state_atom gb_misc; /* Multisampling position shifts ? (4010) */
- struct r300_state_atom unk4200; /* (4200) */
- struct r300_state_atom unk4214; /* (4214) */
- struct r300_state_atom ps; /* pointsize (421C) */
- struct r300_state_atom unk4230; /* (4230) */
- struct r300_state_atom lcntl; /* line control */
- struct r300_state_atom unk4260; /* (4260) */
- struct r300_state_atom unk4274; /* (4274) */
- struct r300_state_atom unk4288; /* (4288) */
- struct r300_state_atom unk42A0; /* (42A0) */
- struct r300_state_atom zbs; /* zbias (42A4) */
- struct r300_state_atom unk42B4; /* (42B4) */
- struct r300_state_atom cul; /* cull cntl (42B8) */
- struct r300_state_atom unk42C0; /* (42C0) */
- struct r300_state_atom rc; /* rs control (4300) */
- struct r300_state_atom ri; /* rs interpolators (4310) */
- struct r300_state_atom rr; /* rs route (4330) */
- struct r300_state_atom unk43A4; /* (43A4) */
- struct r300_state_atom unk43E8; /* (43E8) */
- struct r300_state_atom fp; /* fragment program cntl + nodes (4600) */
- struct r300_state_atom fpt; /* texi - (4620) */
- struct r300_state_atom unk46A4; /* (46A4) */
- struct r300_state_atom fpi[4]; /* fp instructions (46C0/47C0/48C0/49C0) */
- struct r300_state_atom unk4BC0; /* (4BC0) */
- struct r300_state_atom unk4BC8; /* (4BC8) */
- struct r300_state_atom at; /* alpha test (4BD4) */
- struct r300_state_atom unk4BD8; /* (4BD8) */
- struct r300_state_atom fpp; /* 0x4C00 and following */
- struct r300_state_atom unk4E00; /* (4E00) */
- struct r300_state_atom bld; /* blending (4E04) */
- struct r300_state_atom cmk; /* colormask (4E0C) */
- struct r300_state_atom unk4E10; /* (4E10) */
- struct r300_state_atom cb; /* colorbuffer (4E28) */
- struct r300_state_atom unk4E50; /* (4E50) */
- struct r300_state_atom unk4E88; /* (4E88) */
- struct r300_state_atom unk4EA0; /* (4E88) I saw it only written on RV350 hardware.. */
- struct r300_state_atom zs; /* zstencil control (4F00) */
- struct r300_state_atom unk4F10; /* (4F10) */
- struct r300_state_atom zb; /* z buffer (4F20) */
- struct r300_state_atom unk4F28; /* (4F28) */
- struct r300_state_atom unk4F30; /* (4F30) */
- struct r300_state_atom unk4F44; /* (4F44) */
- struct r300_state_atom unk4F54; /* (4F54) */
-
- struct r300_state_atom vpi; /* vp instructions */
- struct r300_state_atom vpp; /* vp parameters */
- struct r300_state_atom vps; /* vertex point size (?) */
- /* 8 texture units */
- /* the state is grouped by function and not by
- texture unit. This makes single unit updates
- really awkward - we are much better off
- updating the whole thing at once */
- struct {
- struct r300_state_atom filter;
- struct r300_state_atom unknown1;
- struct r300_state_atom size;
- struct r300_state_atom format;
- struct r300_state_atom offset;
- struct r300_state_atom unknown4;
- struct r300_state_atom border_color;
- } tex;
- struct r300_state_atom txe; /* tex enable (4104) */
-};
-
-
-/**
- * This structure holds the command buffer while it is being constructed.
- *
- * The first batch of commands in the buffer is always the state that needs
- * to be re-emitted when the context is lost. This batch can be skipped
- * otherwise.
- */
-struct r300_cmdbuf {
- int size; /* DWORDs allocated for buffer */
- uint32_t* cmd_buf;
- int count_used; /* DWORDs filled so far */
- int count_reemit; /* size of re-emission batch */
-};
-
-
-/**
- * State cache
- */
-
-struct r300_depthbuffer_state {
- GLfloat scale;
-};
-
-struct r300_stencilbuffer_state {
- GLuint clear;
- GLboolean hw_stencil;
-
-};
-
-struct r300_vap_reg_state {
- /* input register assigments */
- int i_coords;
- int i_normal;
- int i_color[2];
- int i_fog;
- int i_tex[R300_MAX_TEXTURE_UNITS];
- int i_index;
- int i_pointsize;
- };
-
-/* Vertex shader state */
-
-/* Tested with rv350 and verified from misc web pages. */
-#define VSF_MAX_FRAGMENT_LENGTH (256*4)
-
-/* Tested with rv350 and verified from misc web pages. */
-#define VSF_MAX_FRAGMENT_TEMPS (32)
-
-
-struct r300_vertex_shader_fragment {
- int length;
- union {
- GLuint d[VSF_MAX_FRAGMENT_LENGTH];
- float f[VSF_MAX_FRAGMENT_LENGTH];
- VERTEX_SHADER_INSTRUCTION i[VSF_MAX_FRAGMENT_LENGTH/4];
- } body;
- };
-
-#define VSF_DEST_PROGRAM 0x0
-#define VSF_DEST_MATRIX0 0x200
-#define VSF_DEST_MATRIX1 0x204
-#define VSF_DEST_MATRIX2 0x208
-#define VSF_DEST_VECTOR0 0x20c
-#define VSF_DEST_VECTOR1 0x20d
-#define VSF_DEST_UNKNOWN1 0x400
-#define VSF_DEST_UNKNOWN2 0x406
-
-struct r300_vertex_shader_state {
- struct r300_vertex_shader_fragment program;
-
- /* a bit of a waste - each uses only a subset of allocated space..
- but easier to program */
- struct r300_vertex_shader_fragment matrix[3];
- struct r300_vertex_shader_fragment vector[2];
-
- struct r300_vertex_shader_fragment unknown1;
- struct r300_vertex_shader_fragment unknown2;
-
- int program_start;
- int unknown_ptr1; /* pointer within program space */
- int program_end;
-
- int param_offset;
- int param_count;
-
- int unknown_ptr2; /* pointer within program space */
- int unknown_ptr3; /* pointer within program space */
- };
-
-extern int hw_tcl_on;
-
-#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : ctx->_TnlProgram)
-
-//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) :
-// (r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit))))
-#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) : \
- ctx->Texture.Unit[unit]._ReallyEnabled && r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))
-
-/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday.
- * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly.
- */
-struct r300_vertex_program {
- struct vertex_program mesa_program; /* Must be first */
- int translated;
-
- struct r300_vertex_shader_fragment program;
- struct r300_vertex_shader_fragment params;
-
- int pos_end;
- unsigned long num_temporaries; /* Number of temp vars used by program */
- int inputs[VERT_ATTRIB_MAX];
- int outputs[VERT_RESULT_MAX];
-};
-
-#if USE_ARB_F_P == 1
-#define PFS_MAX_ALU_INST 64
-#define PFS_MAX_TEX_INST 64
-#define PFS_MAX_TEX_INDIRECT 4
-#define PFS_NUM_TEMP_REGS 32
-#define PFS_NUM_CONST_REGS 32
-struct r300_fragment_program {
- struct fragment_program mesa_program;
-
- GLcontext *ctx;
- GLboolean translated;
- GLboolean error;
-
- struct {
- int length;
- GLuint inst[PFS_MAX_TEX_INST];
- } tex;
-
- struct {
- struct {
- GLuint inst0;
- GLuint inst1;
- GLuint inst2;
- GLuint inst3;
- } inst[PFS_MAX_ALU_INST];
- } alu;
- int v_pos;
- int s_pos;
-
- struct {
- int tex_offset;
- int tex_end;
- int alu_offset;
- int alu_end;
- } node[4];
- int cur_node;
- int first_node_has_tex;
-
- int alu_offset;
- int alu_end;
- int tex_offset;
- int tex_end;
-
- /* Hardware constants */
- GLfloat constant[PFS_NUM_CONST_REGS][4];
- int const_nr;
-
- /* Tracked parameters */
- struct {
- int idx; /* hardware index */
- GLfloat *values; /* pointer to values */
- } param[PFS_NUM_CONST_REGS];
- int param_nr;
- GLboolean params_uptodate;
-
- GLuint temps[PFS_NUM_TEMP_REGS];
- int temp_in_use;
- GLuint used_in_node;
- GLuint dest_in_node;
- GLuint inputs[32]; /* don't actually need 32... */
-
- int hwreg_in_use;
- int max_temp_idx;
-};
-
-#else
-/* 64 appears to be the maximum */
-#define PSF_MAX_PROGRAM_LENGTH 64
-
-struct r300_pixel_shader_program {
- struct {
- int length;
- GLuint inst[PSF_MAX_PROGRAM_LENGTH];
- } tex;
-
- /* ALU intructions (logic and integer) */
- struct {
- int length;
- struct {
- GLuint inst0;
- GLuint inst1;
- GLuint inst2;
- GLuint inst3;
- } inst[PSF_MAX_PROGRAM_LENGTH];
- } alu;
-
- /* node information */
- /* nodes are used to synchronize ALU and TEX streams */
- /* There could be up to 4 nodes each consisting of
- a number of TEX instructions followed by some ALU
- instructions */
- /* the last node of a program should always be node3 */
- struct {
- int tex_offset;
- int tex_end;
- int alu_offset;
- int alu_end;
- } node[4];
-
- int active_nodes; /* must be between 1 and 4, inclusive */
- int first_node_has_tex; /* other nodes always have it */
-
- int temp_register_count; /* magic value goes into PFS_CNTL_1 */
-
- /* entire program */
- int tex_offset;
- int tex_end;
- int alu_offset;
- int alu_end;
-
- };
-
-#define MAX_PIXEL_SHADER_PARAMS 32
-struct r300_pixel_shader_state {
- struct r300_pixel_shader_program program;
-
- int translated;
- int have_sample;
- GLuint color_reg;
- GLuint src_previous;
-
- /* parameters */
- int param_length; /* to limit the number of unnecessary writes */
- struct {
- float x;
- float y;
- float z;
- float w;
- } param[MAX_PIXEL_SHADER_PARAMS];
- };
-#endif // USE_ARB_F_P
-
-/* 8 is somewhat bogus... it is probably something like 24 */
-#define R300_MAX_AOS_ARRAYS 16
-
-#define AOS_FORMAT_FLOAT 1
-#define AOS_FORMAT_UBYTE 2
-#define AOS_FORMAT_FLOAT_COLOR 3
-
-#define REG_COORDS 0
-#define REG_COLOR0 1
-#define REG_TEX0 2
-
-struct r300_aos_rec {
- GLuint offset;
- int element_size; /* in dwords */
- int stride; /* distance between elements, in dwords */
-
- int format;
-
- int ncomponents; /* number of components - between 1 and 4, inclusive */
-
- int reg; /* which register they are assigned to. */
-
- };
-
-struct r300_state {
- struct r300_depthbuffer_state depth;
- struct r300_texture_state texture;
- struct r300_vap_reg_state vap_reg;
- struct r300_vertex_shader_state vertex_shader;
-#if USE_ARB_F_P == 0
- struct r300_pixel_shader_state pixel_shader;
-#endif
- struct r300_dma_region aos[R300_MAX_AOS_ARRAYS];
- int aos_count;
-
- GLuint *Elts;
- struct r300_dma_region elt_dma;
-
- GLuint render_inputs; /* actual render inputs that R300 was configured for.
- They are the same as tnl->render_inputs for fixed pipeline */
-
- struct {
- int transform_offset; /* Transform matrix offset, -1 if none */
- } vap_param; /* vertex processor parameter allocation - tells where to write parameters */
-
- struct r300_stencilbuffer_state stencil;
-
-};
-
-
-/**
- * R300 context structure.
- */
-struct r300_context {
- struct radeon_context radeon; /* parent class, must be first */
-
- struct r300_hw_state hw;
- struct r300_cmdbuf cmdbuf;
- struct r300_state state;
-
- /* Vertex buffers
- */
- struct r300_dma dma;
- GLboolean save_on_next_unlock;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap *texture_heaps[R200_NR_TEX_HEAPS];
- driTextureObject swapped;
- int texture_depth;
- float initialMaxAnisotropy;
-
- /* Clientdata textures;
- */
- GLuint prefer_gart_client_texturing;
-
- /* TCL stuff
- */
- GLmatrix TexGenMatrix[R300_MAX_TEXTURE_UNITS];
- GLboolean recheck_texgen[R300_MAX_TEXTURE_UNITS];
- GLboolean TexGenNeedNormals[R300_MAX_TEXTURE_UNITS];
- GLuint TexMatEnabled;
- GLuint TexMatCompSel;
- GLuint TexGenEnabled;
- GLuint TexGenInputs;
- GLuint TexGenCompSel;
- GLmatrix tmpmat;
-};
-
-#define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx))
-
-static __inline GLuint r300PackColor( 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( r, g, b, a );
- default:
- return 0;
- }
-}
-extern void r300DestroyContext(__DRIcontextPrivate * driContextPriv);
-extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate);
-
-void translate_vertex_shader(struct r300_vertex_program *vp);
-extern void r300InitShaderFuncs(struct dd_function_table *functions);
-extern void r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp);
-
-#endif /* __R300_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_emit.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_emit.h
deleted file mode 100644
index c7cb93d0a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_emit.h
+++ /dev/null
@@ -1,282 +0,0 @@
-#ifndef __EMIT_H__
-#define __EMIT_H__
-#include "glheader.h"
-#include "r300_context.h"
-#include "r300_cmdbuf.h"
-
-/* convenience macros */
-#define RADEON_CP_PACKET0 0x00000000
-#define RADEON_CP_PACKET1 0x40000000
-#define RADEON_CP_PACKET2 0x80000000
-#define RADEON_CP_PACKET3 0xC0000000
-
-#define RADEON_CP_PACKET3_NOP 0xC0001000
-#define RADEON_CP_PACKET3_NEXT_CHAR 0xC0001900
-#define RADEON_CP_PACKET3_UNK1B 0xC0001B00
-#define RADEON_CP_PACKET3_PLY_NEXTSCAN 0xC0001D00
-#define RADEON_CP_PACKET3_SET_SCISSORS 0xC0001E00
-#define RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300
-#define RADEON_CP_PACKET3_LOAD_MICROCODE 0xC0002400
-#define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xC0002600
-#define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xC0002800
-#define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xC0002900
-#define RADEON_CP_PACKET3_3D_DRAW_INDX 0xC0002A00
-#define RADEON_CP_PACKET3_LOAD_PALETTE 0xC0002C00
-#define RADEON_CP_PACKET3_INDX_BUFFER 0xC0003300
-#define RADEON_CP_PACKET3_3D_DRAW_VBUF_2 0xC0003400
-#define RADEON_CP_PACKET3_3D_DRAW_IMMD_2 0xC0003500
-#define RADEON_CP_PACKET3_3D_DRAW_INDX_2 0xC0003600
-#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xC0002F00
-#define RADEON_CP_PACKET3_CNTL_PAINT 0xC0009100
-#define RADEON_CP_PACKET3_CNTL_BITBLT 0xC0009200
-#define RADEON_CP_PACKET3_CNTL_SMALLTEXT 0xC0009300
-#define RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400
-#define RADEON_CP_PACKET3_CNTL_POLYLINE 0xC0009500
-#define RADEON_CP_PACKET3_CNTL_POLYSCANLINES 0xC0009800
-#define RADEON_CP_PACKET3_CNTL_PAINT_MULTI 0xC0009A00
-#define RADEON_CP_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00
-#define RADEON_CP_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00
-#define RADEON_CP_PACKET3_3D_CLEAR_ZMASK 0xC0003202
-#define RADEON_CP_PACKET3_3D_CLEAR_CMASK 0xC0003802
-#define RADEON_CP_PACKET3_3D_CLEAR_HIZ 0xC0003702
-
-#define CP_PACKET0(reg, n) (RADEON_CP_PACKET0 | ((n)<<16) | ((reg)>>2))
-
-/* Glue to R300 Mesa driver */
-#define LOCAL_VARS int cmd_reserved=0;\
- int cmd_written=0; \
- drm_radeon_cmd_header_t *cmd=NULL;
-
-#define PREFIX_VOID r300ContextPtr rmesa
-
-#define PREFIX PREFIX_VOID ,
-
-#define PASS_PREFIX_VOID rmesa
-#define PASS_PREFIX rmesa ,
-
-typedef GLuint CARD32;
-
-/* This files defines functions for accessing R300 hardware.
- It needs to be customized to whatever code r300_lib.c is used
- in */
-
-void static inline check_space(int dwords)
-{
-}
-
-static __inline__ uint32_t cmdpacket0(int reg, int count)
-{
- drm_r300_cmd_header_t cmd;
-
- cmd.packet0.cmd_type = R300_CMD_PACKET0;
- cmd.packet0.count = count;
- cmd.packet0.reghi = ((unsigned int)reg & 0xFF00) >> 8;
- cmd.packet0.reglo = ((unsigned int)reg & 0x00FF);
-
- return cmd.u;
-}
-
-static __inline__ uint32_t cmdvpu(int addr, int count)
-{
- drm_r300_cmd_header_t cmd;
-
- cmd.vpu.cmd_type = R300_CMD_VPU;
- cmd.vpu.count = count;
- cmd.vpu.adrhi = ((unsigned int)addr & 0xFF00) >> 8;
- cmd.vpu.adrlo = ((unsigned int)addr & 0x00FF);
-
- return cmd.u;
-}
-
-static __inline__ uint32_t cmdpacket3(int packet)
-{
- drm_r300_cmd_header_t cmd;
-
- cmd.packet3.cmd_type = R300_CMD_PACKET3;
- cmd.packet3.packet = packet;
-
- return cmd.u;
-}
-
-static __inline__ uint32_t cmdcpdelay(unsigned short count)
-{
- drm_r300_cmd_header_t cmd;
-
- cmd.delay.cmd_type = R300_CMD_CP_DELAY;
- cmd.delay.count = count;
-
- return cmd.u;
-}
-
-static __inline__ uint32_t cmdwait(unsigned char flags)
-{
- drm_r300_cmd_header_t cmd;
-
- cmd.wait.cmd_type = R300_CMD_WAIT;
- cmd.wait.flags = flags;
-
- return cmd.u;
-}
-
-static __inline__ uint32_t cmdpacify(void)
-{
- drm_r300_cmd_header_t cmd;
-
- cmd.header.cmd_type = R300_CMD_END3D;
-
- return cmd.u;
-}
-
-/* Prepare to write a register value to register at address reg.
- If num_extra > 0 then the following extra values are written
- to registers with address +4, +8 and so on.. */
-#define reg_start(reg, num_extra) \
- { \
- int _n; \
- _n=(num_extra); \
- cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \
- (_n+2), \
- __FUNCTION__); \
- cmd_reserved=_n+2; \
- cmd_written=1; \
- cmd[0].i=cmdpacket0((reg), _n+1); \
- }
-
-/* Prepare to write a register value to register at address reg.
- If num_extra > 0 then the following extra values are written
- into the same register. */
-/* It is here to permit r300_lib to compile and link anyway, but
- complain if actually called */
-#define reg_start_pump(reg, num_extra) \
- { \
- fprintf(stderr, "I am not defined.. Error ! in %s::%s at line %d\n", \
- __FILE__, __FUNCTION__, __LINE__); \
- exit(-1); \
- }
-
-/* Emit CARD32 freestyle*/
-#define e32(dword) { \
- if(cmd_written<cmd_reserved){\
- cmd[cmd_written].i=(dword); \
- cmd_written++; \
- } else { \
- fprintf(stderr, "e32 but no previous packet declaration.. Aborting! in %s::%s at line %d, cmd_written=%d cmd_reserved=%d\n", \
- __FILE__, __FUNCTION__, __LINE__, cmd_written, cmd_reserved); \
- exit(-1); \
- } \
- }
-
-#define efloat(f) e32(r300PackFloat32(f))
-
-#define vsf_start_fragment(dest, length) \
- { \
- int _n; \
- _n=(length); \
- cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \
- (_n+1), \
- __FUNCTION__); \
- cmd_reserved=_n+2; \
- cmd_written=1; \
- cmd[0].i=cmdvpu((dest), _n/4); \
- }
-
-#define start_packet3(packet, count) \
- { \
- int _n; \
- CARD32 _p; \
- _n=(count); \
- _p=(packet); \
- cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \
- (_n+3), \
- __FUNCTION__); \
- cmd_reserved=_n+3; \
- cmd_written=2; \
- if(_n>0x3fff) {\
- fprintf(stderr,"Too big packet3 %08x: cannot store %d dwords\n", \
- _p, _n); \
- exit(-1); \
- } \
- cmd[0].i=cmdpacket3(R300_CMD_PACKET3_RAW); \
- cmd[1].i=_p | ((_n & 0x3fff)<<16); \
- }
-
- /* must be sent to switch to 2d commands */
-
-void static inline end_3d(PREFIX_VOID)
-{
-LOCAL_VARS
-(void)cmd_reserved; (void)cmd_written;
-
-cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \
- 1, \
- __FUNCTION__); \
-
-cmd[0].header.cmd_type=R300_CMD_END3D;
-}
-
-void static inline cp_delay(PREFIX unsigned short count)
-{
-LOCAL_VARS
-(void)cmd_reserved; (void)cmd_written;
-
-cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \
- 1, \
- __FUNCTION__); \
-
-cmd[0].i=cmdcpdelay(count);
-}
-
-void static inline cp_wait(PREFIX unsigned char flags)
-{
-LOCAL_VARS
-(void)cmd_reserved; (void)cmd_written;
-
-cmd=(drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa, \
- 1, \
- __FUNCTION__); \
-
-cmd[0].i=cmdwait(flags);
-}
-
-/* fire vertex buffer */
-static void inline fire_AOS(PREFIX int vertex_count, int type)
-{
-LOCAL_VARS
-check_space(9);
-
-start_packet3(RADEON_CP_PACKET3_3D_DRAW_VBUF_2, 0);
-/* e32(0x840c0024); */
- e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count<<16) | type);
-}
-
-/* these are followed by the corresponding data */
-#define start_index32_packet(vertex_count, type) \
- {\
- int _vc;\
- _vc=(vertex_count); \
- start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, _vc); \
- e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (_vc<<16) | type \
- | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); \
- }
-
-#define start_index16_packet(vertex_count, type) \
- {\
- int _vc, _n;\
- _vc=(vertex_count); \
- _n=(vertex_count+1)>>1; \
- start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, _n); \
- e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (_vc<<16) | type); \
- }
-
-/* Interestingly enough this ones needs the call to setup_AOS, even thought
- some of the data so setup is not needed and some is not as arbitrary
- as when used by DRAW_VBUF_2 or DRAW_INDX_2 */
-#define start_immediate_packet(vertex_count, type, vertex_size) \
- {\
- int _vc; \
- _vc=(vertex_count); \
- start_packet3(RADEON_CP_PACKET3_3D_DRAW_IMMD_2, _vc*(vertex_size)); \
- e32(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED | (_vc<<16) | type); \
- }
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h
deleted file mode 100644
index 65e1836af..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h
+++ /dev/null
@@ -1,294 +0,0 @@
-#ifndef __R300_FIXED_PIPELINES_H__
-#define __R300_FIXED_PIPELINES_H__
-
-/******** Flat color pipeline **********/
-static struct r300_vertex_shader_state FLAT_COLOR_VERTEX_SHADER={
- program: {
- length: 20,
-
- body:{ d: {
- EASY_VSF_OP(MUL, 0, ALL, TMP),
- VSF_PARAM(3),
- VSF_ATTR_W(0),
- EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE),
-
- EASY_VSF_OP(MUL, 1, ALL, RESULT),
- VSF_REG(1),
- VSF_ATTR_UNITY(1),
- VSF_UNITY(1),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(2),
- VSF_ATTR_Z(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(1),
- VSF_ATTR_Y(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MAD, 0, ALL, RESULT),
- VSF_PARAM(0),
- VSF_ATTR_X(0),
- VSF_TMP(0),
- } }
- },
-
- matrix:{
- {
- length: 16,
- body: { f: {
- 2.0,
- 0,
- 0.0,
- 0.0,
- 0,
- 2.5,
- 0,
- 0,
- 0.0,
- 0,
- -1.00,
- -1.0,
- -3.0,
- 0,
- 6.0,
- 6.0
- } }
- },
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- vector: {
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- unknown1: {
- length: 0
- },
-
- unknown2: {
- length: 0
- },
-
- program_start: 0,
- unknown_ptr1: 4,
- program_end: 4,
-
- param_offset: 0,
- param_count: 4,
-
- unknown_ptr2: 0,
- unknown_ptr3: 4
- };
-
-static struct r300_pixel_shader_state FLAT_COLOR_PIXEL_SHADER={
- program: {
- tex: {
- length: 0
- },
- alu: {
- length: 1,
- /* My understanding is that we need at least 1 instructions for pixel shader,
- in particular because alu_end==0 means there is one instruction */
- inst: {
- PFS_NOP
- }
- },
- node: {
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0}
- },
- active_nodes: 1,
- first_node_has_tex: 0,
- temp_register_count: 0,
-
- tex_offset: 0,
- tex_end: 0,
- alu_offset: 0,
- alu_end: 0
- },
-
- param_length: 0
- };
-
-
-/******** Single texture pipeline ***********/
-static struct r300_vertex_shader_state SINGLE_TEXTURE_VERTEX_SHADER={
- program: {
- length: 24,
-
- body: { d: {
- EASY_VSF_OP(MUL, 0, ALL, TMP),
- VSF_PARAM(3),
- VSF_ATTR_W(0),
- EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE),
-
- EASY_VSF_OP(MUL, 2, ALL, RESULT),
- VSF_REG(2),
- VSF_ATTR_UNITY(2),
- VSF_UNITY(2),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(2),
- VSF_ATTR_Z(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MUL, 1, ALL, RESULT),
- VSF_REG(1),
- VSF_ATTR_UNITY(1),
- VSF_UNITY(1),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(1),
- VSF_ATTR_Y(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MAD, 0, ALL, RESULT),
- VSF_PARAM(0),
- VSF_ATTR_X(0),
- VSF_TMP(0),
- } }
- },
-
- matrix:{
- {
- length: 16,
- body: { f: {
- 2.0,
- 0,
- 0.0,
- 0.0,
- 0,
- 2.5,
- 0,
- 0,
- 0.0,
- 0,
- -1.00,
- -1.0,
- -3.0,
- 0,
- 6.0,
- 6.0
- } }
- },
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- vector: {
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- unknown1: {
- length: 0
- },
-
- unknown2: {
- length: 4,
- body: { f: {
- 0.0,
- 0.0,
- 1.0,
- 0.0
- } }
- },
-
- program_start: 0,
- unknown_ptr1: 5,
- program_end: 5,
-
- param_offset: 0,
- param_count: 4,
-
- unknown_ptr2: 0,
- unknown_ptr3: 5
- };
-
-static struct r300_pixel_shader_state SINGLE_TEXTURE_PIXEL_SHADER={
- program: {
- tex: {
- length: 1,
- inst: { 0x00018000 }
- },
- alu: {
- length: 2,
- inst:
- {
-/* I get misc problems without this after doing cold-reboot.
- This would imply that alu programming is buggy. --aet */
-#if 1
- PFS_NOP,
-#endif
-
- /* What are 0's ORed with flags ? They are register numbers that
- just happen to be 0 */
- {
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO),
- EASY_PFS_INSTR1(0, 0, 1, 0 | PFS_FLAG_CONST, NONE, ALL),
-
-#if 0
- /* no alpha in textures */
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO),
- EASY_PFS_INSTR3(0, 1, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT)
-#endif
-
- /* alpha in textures */
- EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO),
- EASY_PFS_INSTR3(0, 0, 1, 0 | PFS_FLAG_CONST, OUTPUT)
- }
- }
- },
- node: {
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0}
- },
-
- active_nodes: 1,
- first_node_has_tex: 1,
- temp_register_count: 1,
-
- tex_offset: 0,
- tex_end: 0,
- alu_offset: 0,
- alu_end: 0
- },
-
- param_length: 8,
- param: {
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0}
- }
- };
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.c
deleted file mode 100644
index 8750ff60c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ /dev/null
@@ -1,1090 +0,0 @@
-/*
- * Copyright (C) 2005 Ben Skeggs.
- *
- * 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.
- *
- */
-
-/*
- * Authors:
- * Ben Skeggs <darktama@iinet.net.au>
- */
-
-/*TODO'S
- *
- * - Implement remaining arb_f_p opcodes
- * - Depth write
- * - Negate on individual components (implement in swizzle code?)
- * - Reuse input/temp regs, if they're no longer needed.
- * - Find out whether there's any benifit in ordering registers the way
- * fglrx does (see r300_reg.h).
- * - Verify results of opcodes for accuracy, I've only checked them
- * in specific cases.
- * - and more...
- */
-
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-#include "arbfragparse.h"
-
-#include "program.h"
-#include "nvfragprog.h"
-#include "r300_context.h"
-#if USE_ARB_F_P == 1
-#include "r300_fragprog.h"
-#include "r300_reg.h"
-
-#define PFS_INVAL 0xFFFFFFFF
-
-static void dump_program(struct r300_fragment_program *rp);
-static void emit_arith(struct r300_fragment_program *rp, int op,
- pfs_reg_t dest, int mask,
- pfs_reg_t src0, pfs_reg_t src1, pfs_reg_t src2,
- int flags);
-
-/***************************************
- * begin: useful data structions for fragment program generation
- ***************************************/
-
-/* description of r300 native hw instructions */
-const struct {
- const char *name;
- int argc;
- int v_op;
- int s_op;
-} r300_fpop[] = {
- { "MAD", 3, R300_FPI0_OUTC_MAD, R300_FPI2_OUTA_MAD },
- { "DP3", 2, R300_FPI0_OUTC_DP3, PFS_INVAL },
- { "DP4", 2, R300_FPI0_OUTC_DP4, R300_FPI2_OUTA_DP4 },
- { "MIN", 2, R300_FPI0_OUTC_MIN, R300_FPI2_OUTA_MIN },
- { "MAX", 2, R300_FPI0_OUTC_MAX, R300_FPI2_OUTA_MAX },
- { "CMP", 3, R300_FPI0_OUTC_CMP, R300_FPI2_OUTA_CMP },
- { "FRC", 1, R300_FPI0_OUTC_FRC, R300_FPI2_OUTA_FRC },
- { "EX2", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_EX2 },
- { "LG2", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_LG2 },
- { "RCP", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RCP },
- { "RSQ", 1, R300_FPI0_OUTC_REPL_ALPHA, R300_FPI2_OUTA_RSQ },
- { "REPL_ALPHA", 1, R300_FPI0_OUTC_REPL_ALPHA, PFS_INVAL }
-};
-
-#define MAKE_SWZ3(x, y, z) (MAKE_SWIZZLE4(SWIZZLE_##x, \
- SWIZZLE_##y, \
- SWIZZLE_##z, \
- SWIZZLE_ZERO))
-
-/* vector swizzles r300 can support natively, with a couple of
- * cases we handle specially
- *
- * pfs_reg_t.v_swz/pfs_reg_t.s_swz is an index into this table
- **/
-static const struct r300_pfv_swizzle {
- const char *name;
- GLuint hash; /* swizzle value this matches */
- GLboolean native;
- GLuint base; /* base value for hw swizzle */
- GLuint stride; /* difference in base between arg0/1/2 */
- GLboolean dep_sca;
-} v_swiz[] = {
-/* native swizzles */
- { "xyz", MAKE_SWZ3(X, Y, Z), GL_TRUE, R300_FPI0_ARGC_SRC0C_XYZ, 4, GL_FALSE },
- { "xxx", MAKE_SWZ3(X, X, X), GL_TRUE, R300_FPI0_ARGC_SRC0C_XXX, 4, GL_FALSE },
- { "yyy", MAKE_SWZ3(Y, Y, Y), GL_TRUE, R300_FPI0_ARGC_SRC0C_YYY, 4, GL_FALSE },
- { "zzz", MAKE_SWZ3(Z, Z, Z), GL_TRUE, R300_FPI0_ARGC_SRC0C_ZZZ, 4, GL_FALSE },
- { "www", MAKE_SWZ3(W, W, W), GL_TRUE, R300_FPI0_ARGC_SRC0A, 1, GL_TRUE },
- { "yzx", MAKE_SWZ3(Y, Z, X), GL_TRUE, R300_FPI0_ARGC_SRC0C_YZX, 1, GL_FALSE },
- { "zxy", MAKE_SWZ3(Z, X, Y), GL_TRUE, R300_FPI0_ARGC_SRC0C_ZXY, 1, GL_FALSE },
-/* disable this for now, until I find a clean way of making sure xyz/w streams
- * have a source in the same register slot.. */
-// { "wzy", MAKE_SWZ3(W, Z, Y), GL_TRUE, R300_FPI0_ARGC_SRC0CA_WZY, 1, GL_TRUE },
-/* special cases */
- { NULL, MAKE_SWZ3(ONE, ONE, ONE), GL_FALSE, R300_FPI0_ARGC_ONE, 0, GL_FALSE},
- { NULL, MAKE_SWZ3(ZERO, ZERO, ZERO), GL_FALSE, R300_FPI0_ARGC_ZERO, 0, GL_FALSE},
- { NULL, PFS_INVAL, GL_FALSE, R300_FPI0_ARGC_HALF, 0, GL_FALSE},
- { NULL, PFS_INVAL, GL_FALSE, 0, 0, 0 },
-};
-#define SWIZZLE_XYZ 0
-#define SWIZZLE_XXX 1
-#define SWIZZLE_WWW 4
-#define SWIZZLE_111 7
-#define SWIZZLE_000 8
-#define SWIZZLE_HHH 9
-
-#define SWZ_X_MASK (7 << 0)
-#define SWZ_Y_MASK (7 << 3)
-#define SWZ_Z_MASK (7 << 6)
-#define SWZ_W_MASK (7 << 9)
-/* used during matching of non-native swizzles */
-static const struct {
- GLuint hash; /* used to mask matching swizzle components */
- int mask; /* actual outmask */
- int count; /* count of components matched */
-} s_mask[] = {
- { SWZ_X_MASK|SWZ_Y_MASK|SWZ_Z_MASK, 1|2|4, 3},
- { SWZ_X_MASK|SWZ_Y_MASK, 1|2, 2},
- { SWZ_X_MASK|SWZ_Z_MASK, 1|4, 2},
- { SWZ_Y_MASK|SWZ_Z_MASK, 2|4, 2},
- { SWZ_X_MASK, 1, 1},
- { SWZ_Y_MASK, 2, 1},
- { SWZ_Z_MASK, 4, 1},
- { PFS_INVAL, PFS_INVAL, PFS_INVAL}
-};
-
-/* mapping from SWIZZLE_* to r300 native values for scalar insns */
-static const struct {
- const char *name;
- int base; /* hw value of swizzle */
- int stride; /* difference between SRC0/1/2 */
- GLboolean dep_vec;
-} s_swiz[] = {
- { "x", R300_FPI2_ARGA_SRC0C_X, 3, GL_TRUE },
- { "y", R300_FPI2_ARGA_SRC0C_Y, 3, GL_TRUE },
- { "z", R300_FPI2_ARGA_SRC0C_Z, 3, GL_TRUE },
- { "w", R300_FPI2_ARGA_SRC0A , 1, GL_FALSE },
- { "0", R300_FPI2_ARGA_ZERO , 0, GL_FALSE },
- { "1", R300_FPI2_ARGA_ONE , 0, GL_FALSE },
- { ".5", R300_FPI2_ARGA_HALF, 0, GL_FALSE }
-};
-#define SWIZZLE_HALF 6
-
-/* boiler-plate reg, for convenience */
-const pfs_reg_t pfs_default_reg = {
- type: REG_TYPE_TEMP,
- index: 0,
- v_swz: 0 /* matches XYZ in table */,
- s_swz: SWIZZLE_W,
- negate: 0,
- valid: GL_FALSE
-};
-
-/* constant zero source */
-const pfs_reg_t pfs_one = {
- type: REG_TYPE_CONST,
- index: 0,
- v_swz: SWIZZLE_111,
- s_swz: SWIZZLE_ONE,
- valid: GL_TRUE
-};
-
-/* constant one source */
-const pfs_reg_t pfs_zero = {
- type: REG_TYPE_CONST,
- index: 0,
- v_swz: SWIZZLE_000,
- s_swz: SWIZZLE_ZERO,
- valid: GL_TRUE
-};
-
-/***************************************
- * end: data structures
- ***************************************/
-
-#define ERROR(fmt, args...) do { \
- fprintf(stderr, "%s::%s(): " fmt "\n", __FILE__, __func__, ##args); \
- rp->error = GL_TRUE; \
-} while(0)
-
-static int get_hw_temp(struct r300_fragment_program *rp)
-{
- int r = ffs(~rp->hwreg_in_use);
- if (!r) {
- ERROR("Out of hardware temps\n");
- return 0;
- }
-
- rp->hwreg_in_use |= (1 << --r);
- if (r > rp->max_temp_idx)
- rp->max_temp_idx = r;
-
- return r;
-}
-
-static void free_hw_temp(struct r300_fragment_program *rp, int idx)
-{
- rp->hwreg_in_use &= ~(1<<idx);
-}
-
-static pfs_reg_t get_temp_reg(struct r300_fragment_program *rp)
-{
- pfs_reg_t r = pfs_default_reg;
-
- r.index = ffs(~rp->temp_in_use);
- if (!r.index) {
- ERROR("Out of program temps\n");
- return r;
- }
- rp->temp_in_use |= (1 << --r.index);
-
- rp->temps[r.index] = get_hw_temp(rp);
- r.valid = GL_TRUE;
- return r;
-}
-
-static pfs_reg_t get_temp_reg_tex(struct r300_fragment_program *rp)
-{
- pfs_reg_t r = pfs_default_reg;
- int hwreg;
-
- hwreg = ffs(~(rp->hwreg_in_use | rp->used_in_node));
- if (!hwreg) {
- /* Try and grab an already used temp, will
- * cause an indirection, but better than failing */
- return get_temp_reg(rp);
- }
- if (hwreg > rp->max_temp_idx)
- rp->max_temp_idx = hwreg;
-
- r.index = ffs(~rp->temp_in_use);
- if (!r.index) {
- ERROR("Out of program temps\n");
- return r;
- }
- rp->temp_in_use |= (1 << --r.index);
- rp->temps[r.index] = --hwreg;
-
- r.valid = GL_TRUE;
- return r;
-}
-
-static void free_temp(struct r300_fragment_program *rp, pfs_reg_t r)
-{
- if (!rp || !(rp->temp_in_use & (1<<r.index))) return;
-
- free_hw_temp(rp, rp->temps[r.index]);
- rp->temp_in_use &= ~(1<<r.index);
-}
-
-static pfs_reg_t emit_param4fv(struct r300_fragment_program *rp, GLfloat *values)
-{
- pfs_reg_t r = pfs_default_reg;
- int pidx;
-
- r.type = REG_TYPE_CONST;
- pidx = rp->param_nr++;
- r.index = rp->const_nr++;
- if (pidx >= PFS_NUM_CONST_REGS || r.index >= PFS_NUM_CONST_REGS) {
- ERROR("Out of const/param slots!\n");
- return r;
- }
-
- rp->param[pidx].idx = r.index;
- rp->param[pidx].values = values;
- rp->params_uptodate = GL_FALSE;
-
- r.valid = GL_TRUE;
- return r;
-}
-
-static pfs_reg_t emit_const4fv(struct r300_fragment_program *rp, GLfloat *cp)
-{
- pfs_reg_t r = pfs_default_reg;
- r.type = REG_TYPE_CONST;
-
- r.index = rp->const_nr++;
- if (r.index >= PFS_NUM_CONST_REGS) {
- ERROR("Out of hw constants!\n");
- return r;
- }
-
- COPY_4V(rp->constant[r.index], cp);
-
- r.valid = GL_TRUE;
- return r;
-}
-
-static pfs_reg_t negate(pfs_reg_t r)
-{
- r.negate = 1;
- return r;
-}
-
-static int swz_native(struct r300_fragment_program *rp,
- pfs_reg_t src, pfs_reg_t *r)
-{
- /* Native swizzle, nothing to see here */
- *r = src;
- return 3;
-}
-
-static int swz_emit_partial(struct r300_fragment_program *rp,
- pfs_reg_t src, pfs_reg_t *r, int mask, int mc)
-{
- if (!r->valid)
- *r = get_temp_reg(rp);
-
- /* A partial match, src.v_swz/mask define what parts of the
- * desired swizzle we match */
- if (mc + s_mask[mask].count == 3)
- emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask|WRITEMASK_W, src, pfs_one, pfs_zero, 0);
- else
- emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask, src, pfs_one, pfs_zero, 0);
- return s_mask[mask].count;
-}
-
-static int swz_special_case(struct r300_fragment_program *rp,
- pfs_reg_t src, pfs_reg_t *r, int mask, int mc)
-{
- switch(GET_SWZ(v_swiz[src.v_swz].hash, 0)) {
- case SWIZZLE_ONE:
- case SWIZZLE_ZERO:
- if (!r->valid)
- *r = get_temp_reg(rp);
- if (mc + s_mask[mask].count == 3)
- emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask|WRITEMASK_W, src, pfs_one, pfs_zero, 0);
- else
- emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask, src, pfs_one, pfs_zero, 0);
- break;
- default:
- ERROR("Unknown special-case swizzle! %d\n", src.v_swz);
- return 0;
- }
-
- return s_mask[mask].count;
-}
-
-static pfs_reg_t swizzle(struct r300_fragment_program *rp,
- pfs_reg_t src,
- GLuint arbswz)
-{
- pfs_reg_t r = pfs_default_reg;
-
- int c_mask = 0;
- int v_matched = 0;
- src.v_swz = SWIZZLE_XYZ;
- src.s_swz = GET_SWZ(arbswz, 3);
-
- do {
- do {
-#define CUR_HASH (v_swiz[src.v_swz].hash & s_mask[c_mask].hash)
- if (CUR_HASH == (arbswz & s_mask[c_mask].hash)) {
- if (v_swiz[src.v_swz].native == GL_FALSE)
- v_matched += swz_special_case(rp, src, &r, c_mask, v_matched);
- else if (s_mask[c_mask].count == 3)
- v_matched += swz_native(rp, src, &r);
- else
- v_matched += swz_emit_partial(rp, src, &r, c_mask, v_matched);
-
- if (v_matched == 3)
- return r;
-
- /* Fill with something invalid.. all 0's was wrong before, matched
- * SWIZZLE_X. So all 1's will be okay for now */
- arbswz |= (PFS_INVAL & s_mask[c_mask].hash);
- }
- } while(v_swiz[++src.v_swz].hash != PFS_INVAL);
- src.v_swz = SWIZZLE_XYZ;
- } while (s_mask[++c_mask].hash != PFS_INVAL);
-
- ERROR("should NEVER get here\n");
- return r;
-}
-
-static pfs_reg_t t_src(struct r300_fragment_program *rp,
- struct fp_src_register fpsrc) {
- pfs_reg_t r = pfs_default_reg;
-
- switch (fpsrc.File) {
- case PROGRAM_TEMPORARY:
- r.index = fpsrc.Index;
- r.valid = GL_TRUE;
- break;
- case PROGRAM_INPUT:
- r.index = fpsrc.Index;
- r.type = REG_TYPE_INPUT;
- r.valid = GL_TRUE;
- break;
- case PROGRAM_LOCAL_PARAM:
- r = emit_param4fv(rp, rp->mesa_program.Base.LocalParams[fpsrc.Index]);
- break;
- case PROGRAM_ENV_PARAM:
- r = emit_param4fv(rp, rp->ctx->FragmentProgram.Parameters[fpsrc.Index]);
- break;
- case PROGRAM_STATE_VAR:
- case PROGRAM_NAMED_PARAM:
- r = emit_param4fv(rp, rp->mesa_program.Parameters->ParameterValues[fpsrc.Index]);
- break;
- default:
- ERROR("unknown SrcReg->File %x\n", fpsrc.File);
- return r;
- }
-
- /* no point swizzling ONE/ZERO/HALF constants... */
- if (r.v_swz < SWIZZLE_111 && r.s_swz < SWIZZLE_ZERO)
- r = swizzle(rp, r, fpsrc.Swizzle);
-
- /* WRONG! Need to be able to do individual component negation,
- * should probably handle this in the swizzling code unless
- * all components are negated, then we can do this natively */
- if (fpsrc.NegateBase)
- r.negate = GL_TRUE;
-
- return r;
-}
-
-static pfs_reg_t t_dst(struct r300_fragment_program *rp,
- struct fp_dst_register dest) {
- pfs_reg_t r = pfs_default_reg;
-
- switch (dest.File) {
- case PROGRAM_TEMPORARY:
- r.index = dest.Index;
- r.valid = GL_TRUE;
- return r;
- case PROGRAM_OUTPUT:
- r.type = REG_TYPE_OUTPUT;
- switch (dest.Index) {
- case 0:
- r.valid = GL_TRUE;
- return r;
- case 1:
- ERROR("I don't know how to write depth!\n");
- return r;
- default:
- ERROR("Bad DstReg->Index 0x%x\n", dest.Index);
- return r;
- }
- default:
- ERROR("Bad DstReg->File 0x%x\n", dest.File);
- return r;
- }
-}
-
-static void sync_streams(struct r300_fragment_program *rp) {
- /* Bring vector/scalar streams into sync, inserting nops into
- * whatever stream is lagging behind
- *
- * Using NOP == MAD out.none, 0, 0, 0
- */
- while (rp->v_pos != rp->s_pos) {
- if (rp->s_pos > rp->v_pos) {
- rp->alu.inst[rp->v_pos].inst0 = 0x00050A14;
- rp->alu.inst[rp->v_pos].inst1 = 0x00020820;
- rp->v_pos++;
- } else {
- rp->alu.inst[rp->s_pos].inst2 = 0x00040810;
- rp->alu.inst[rp->s_pos].inst3 = 0x00020820;
- rp->s_pos++;
- }
- }
-}
-
-static void emit_tex(struct r300_fragment_program *rp,
- struct fp_instruction *fpi,
- int opcode)
-{
- pfs_reg_t coord = t_src(rp, fpi->SrcReg[0]);
- pfs_reg_t dest = t_dst(rp, fpi->DstReg), rdest = pfs_default_reg;
- int unit = fpi->TexSrcUnit;
- int hwsrc, hwdest, flags = 0;
-
- if (dest.type == REG_TYPE_OUTPUT) {
- rdest = dest;
- dest = get_temp_reg_tex(rp);
- }
-
- switch (coord.type) {
- case REG_TYPE_TEMP:
- hwsrc = rp->temps[coord.index];
- break;
- case REG_TYPE_INPUT:
- hwsrc = rp->inputs[coord.index];
- break;
- case REG_TYPE_CONST:
- hwsrc = coord.index;
- flags = R300_FPITX_SRC_CONST;
- break;
- default:
- ERROR("Unknown coord.type = %d\n", coord.type);
- return;
- }
- hwdest = rp->temps[dest.index];
-
- /* Indirection if source has been written in this node, or if the dest has
- * been read/written in this node
- */
- if ((coord.type != REG_TYPE_CONST && (rp->dest_in_node & (1<<hwsrc))) ||
- (rp->used_in_node & (1<<hwdest))) {
-
- if (rp->cur_node == 3) { /* We only support 4 natively */
- ERROR("too many levels of texture indirection\n");
- return;
- }
-
- /* Finish off current node */
- sync_streams(rp);
- rp->node[rp->cur_node].alu_end = rp->v_pos - 1;
-
- /* Start new node */
- rp->cur_node++;
- rp->used_in_node = 0;
- rp->dest_in_node = 0;
- rp->node[rp->cur_node].tex_offset = rp->tex.length;
- rp->node[rp->cur_node].alu_offset = rp->v_pos;
- rp->node[rp->cur_node].tex_end = -1;
- rp->node[rp->cur_node].alu_end = -1;
- }
-
- if (rp->cur_node == 0) rp->first_node_has_tex = 1;
-
- rp->tex.inst[rp->tex.length++] = 0
- | (hwsrc << R300_FPITX_SRC_SHIFT)
- | (hwdest << R300_FPITX_DST_SHIFT)
- | (unit << R300_FPITX_IMAGE_SHIFT)
- | (opcode << R300_FPITX_OPCODE_SHIFT) /* not entirely sure about this */
- | flags;
- rp->dest_in_node |= (1 << hwdest);
- if (coord.type != REG_TYPE_CONST)
- rp->used_in_node |= (1 << hwsrc);
-
- rp->node[rp->cur_node].tex_end++;
-
- /* Copy from temp to output if needed */
- if (rdest.valid) {
- emit_arith(rp, PFS_OP_MAD, rdest, WRITEMASK_XYZW, dest, pfs_one, pfs_zero, 0);
- free_temp(rp, dest);
- }
-}
-
-#define ARG_NEG (1<<5)
-#define ARG_ABS (1<<6)
-#define SRC_CONST (1<<5)
-#define SRC_STRIDE 6
-
-static int t_hw_src(struct r300_fragment_program *rp, pfs_reg_t src)
-{
- int idx;
-
- switch (src.type) {
- case REG_TYPE_TEMP:
- idx = rp->temps[src.index];
- break;
- case REG_TYPE_INPUT:
- idx = rp->inputs[src.index];
- break;
- case REG_TYPE_CONST:
- return (src.index | SRC_CONST);
- default:
- ERROR("Invalid type for source reg\n");
- return (0 | SRC_CONST);
- }
-
- rp->used_in_node |= (1 << idx);
- return idx;
-}
-
-/* Add sources to FPI1/FPI3 lists. If source is already on list,
- * reuse the index instead of wasting a source.
- */
-static inline int add_src(int src[3], int *cnt, int reg) {
- int i;
-
- for (i=0;i<*cnt;i++)
- if (src[i] == reg) return i;
-
- if (*cnt == 3) assert(0); /* I don't *think* this can happen */
-
- src[*cnt] = reg;
- return (*cnt)++;
-}
-
-static void emit_arith(struct r300_fragment_program *rp, int op,
- pfs_reg_t dest, int mask,
- pfs_reg_t src0, pfs_reg_t src1, pfs_reg_t src2,
- int flags)
-{
- pfs_reg_t src[3] = { src0, src1, src2 };
- /* XYZ/W emit control */
- int v_idx = rp->v_pos, s_idx = rp->s_pos;
- GLboolean emit_v = GL_FALSE, emit_s = GL_FALSE;
- /* INST1/INST3 sources */
- int vsrc[3], ssrc[3];
- int nvs = 0, nss = 0;
- /* INST0/INST2 sources */
- int vswz[3], sswz[3];
- /* temp stuff */
- int hwdest, hwsrc;
- int argc;
- int vop, sop;
- int i;
- int str;
-
- if (!dest.valid || !src0.valid || !src1.valid || !src2.valid) {
- ERROR("invalid register. dest/src0/src1/src2 valid = %d/%d/%d/%d\n",
- dest.valid, src0.valid, src1.valid, src2.valid);
- return;
- }
-
- /* check opcode */
- if (op > MAX_PFS_OP) {
- ERROR("unknown opcode!\n");
- return;
- }
- argc = r300_fpop[op].argc;
- vop = r300_fpop[op].v_op;
- sop = r300_fpop[op].s_op;
-
- /* grab hwregs of dest */
- switch (dest.type) {
- case REG_TYPE_TEMP:
- hwdest = rp->temps[dest.index];
- rp->dest_in_node |= (1 << hwdest);
- rp->used_in_node |= (1 << hwdest);
- break;
- case REG_TYPE_OUTPUT:
- hwdest = 0;
- break;
- default:
- ERROR("invalid dest reg type %d\n", dest.type);
- return;
- }
-
- for (i=0;i<3;i++) {
- if (i<argc) {
- hwsrc = t_hw_src(rp, src[i]);
- if (mask & WRITEMASK_XYZ && vop != R300_FPI0_OUTC_REPL_ALPHA) {
- if (v_swiz[src[i].v_swz].dep_sca) {
- sync_streams(rp);
- v_idx = s_idx = rp->v_pos;
- emit_s = GL_TRUE;
- str = add_src(ssrc, &nss, hwsrc);
- } else
- str = add_src(vsrc, &nvs, hwsrc);
- vswz[i] = v_swiz[src[i].v_swz].base + (str * v_swiz[src[i].v_swz].stride);
- } else
- vswz[i] = R300_FPI0_ARGC_ZERO;
-
- if (mask & WRITEMASK_W || vop == R300_FPI0_OUTC_REPL_ALPHA) {
- if (s_swiz[src[i].s_swz].dep_vec) {
- sync_streams(rp);
- v_idx = s_idx = rp->v_pos;
- emit_v = GL_TRUE;
- str = add_src(vsrc, &nvs, hwsrc);
- } else
- str = add_src(ssrc, &nss, hwsrc);
- sswz[i] = s_swiz[src[i].s_swz].base + (str * s_swiz[src[i].s_swz].stride);
- } else
- sswz[i] = R300_FPI2_ARGA_ZERO;
-
- if (src[i].negate) {
- vswz[i] |= ARG_NEG;
- sswz[i] |= ARG_NEG;
- }
-
- if (flags & PFS_FLAG_ABS) {
- vswz[i] |= ARG_ABS;
- sswz[i] |= ARG_ABS;
- }
- } else {
- vswz[i] = R300_FPI0_ARGC_ZERO;
- sswz[i] = R300_FPI2_ARGA_ZERO;
- }
- }
- /* Unused sources, read constant reg 0 */
- for (i=nvs;i<3;i++)
- vsrc[i] = 0 | SRC_CONST;
- for (i=nss;i<3;i++)
- ssrc[i] = 0 | SRC_CONST;
-
- if (flags & PFS_FLAG_SAT) {
- vop |= R300_FPI0_OUTC_SAT;
- sop |= R300_FPI2_OUTA_SAT;
- }
-
- if (mask & WRITEMASK_XYZ || emit_v) {
- if (r300_fpop[op].v_op == R300_FPI0_OUTC_REPL_ALPHA) {
- sync_streams(rp);
- s_idx = v_idx = rp->v_pos;
- }
- rp->alu.inst[v_idx].inst0 = vop |
- vswz[0] << R300_FPI0_ARG0C_SHIFT |
- vswz[1] << R300_FPI0_ARG1C_SHIFT |
- vswz[2] << R300_FPI0_ARG2C_SHIFT;
- rp->alu.inst[v_idx].inst1 = hwdest << R300_FPI1_DSTC_SHIFT |
- vsrc[0] << R300_FPI1_SRC0C_SHIFT |
- vsrc[1] << R300_FPI1_SRC1C_SHIFT |
- vsrc[2] << R300_FPI1_SRC2C_SHIFT |
- ((mask & WRITEMASK_XYZ) << (dest.type == REG_TYPE_OUTPUT ? 26 : 23));
- rp->v_pos = v_idx + 1;
- }
-
- if (mask & WRITEMASK_W || emit_s || vop == R300_FPI0_OUTC_REPL_ALPHA) {
- rp->alu.inst[s_idx].inst2 = sop |
- sswz[0] << R300_FPI2_ARG0A_SHIFT |
- sswz[1] << R300_FPI2_ARG1A_SHIFT |
- sswz[2] << R300_FPI2_ARG2A_SHIFT;
- rp->alu.inst[s_idx].inst3 = hwdest << R300_FPI3_DSTA_SHIFT |
- ssrc[0] << R300_FPI3_SRC0A_SHIFT |
- ssrc[1] << R300_FPI3_SRC1A_SHIFT |
- ssrc[2] << R300_FPI3_SRC2A_SHIFT |
- (((mask & WRITEMASK_W)?1:0) << (dest.type == REG_TYPE_OUTPUT ? 24 : 23));
- rp->s_pos = s_idx + 1;
- }
-
-/* sync_streams(rp); */
- return;
-};
-
-static GLboolean parse_program(struct r300_fragment_program *rp)
-{
- struct fragment_program *mp = &rp->mesa_program;
- const struct fp_instruction *inst = mp->Instructions;
- struct fp_instruction *fpi;
- pfs_reg_t src0, src1, src2, dest, temp;
- int flags = 0;
-
- if (!inst || inst[0].Opcode == FP_OPCODE_END) {
- ERROR("empty program?\n");
- return GL_FALSE;
- }
-
- for (fpi=mp->Instructions; fpi->Opcode != FP_OPCODE_END; fpi++) {
- if (fpi->Saturate) {
- flags = PFS_FLAG_SAT;
- }
-
- switch (fpi->Opcode) {
- case FP_OPCODE_ABS:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- case FP_OPCODE_ADD:
- emit_arith(rp, PFS_OP_MAD, t_dst(rp, fpi->DstReg), fpi->DstReg.WriteMask,
- t_src(rp, fpi->SrcReg[0]),
- pfs_one,
- t_src(rp, fpi->SrcReg[1]),
- flags);
- break;
- case FP_OPCODE_CMP:
- case FP_OPCODE_COS:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- case FP_OPCODE_DP3:
- dest = t_dst(rp, fpi->DstReg);
- if (fpi->DstReg.WriteMask & WRITEMASK_W) {
- /* I assume these need to share the same alu slot */
- sync_streams(rp);
- emit_arith(rp, PFS_OP_DP4, dest, WRITEMASK_W,
- pfs_zero, pfs_zero, pfs_zero,
- flags);
- }
- emit_arith(rp, PFS_OP_DP3, t_dst(rp, fpi->DstReg),
- fpi->DstReg.WriteMask & WRITEMASK_XYZ,
- t_src(rp, fpi->SrcReg[0]),
- t_src(rp, fpi->SrcReg[1]),
- pfs_zero, flags);
- break;
- case FP_OPCODE_DP4:
- case FP_OPCODE_DPH:
- case FP_OPCODE_DST:
- case FP_OPCODE_EX2:
- case FP_OPCODE_FLR:
- case FP_OPCODE_FRC:
- case FP_OPCODE_KIL:
- case FP_OPCODE_LG2:
- case FP_OPCODE_LIT:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- case FP_OPCODE_LRP:
- /* TODO: use the special LRP form if possible */
- src0 = t_src(rp, fpi->SrcReg[0]);
- src1 = t_src(rp, fpi->SrcReg[1]);
- src2 = t_src(rp, fpi->SrcReg[2]);
- // result = tmp0tmp1 + (1 - tmp0)tmp2
- // = tmp0tmp1 + tmp2 + (-tmp0)tmp2
- // MAD temp, -tmp0, tmp2, tmp2
- // MAD result, tmp0, tmp1, temp
- temp = get_temp_reg(rp);
- emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_XYZW,
- negate(src0), src2, src2, 0);
- emit_arith(rp, PFS_OP_MAD, t_dst(rp, fpi->DstReg), fpi->DstReg.WriteMask,
- src0, src1, temp, flags);
- free_temp(rp, temp);
- break;
- case FP_OPCODE_MAD:
- emit_arith(rp, PFS_OP_MAD, t_dst(rp, fpi->DstReg), fpi->DstReg.WriteMask,
- t_src(rp, fpi->SrcReg[0]),
- t_src(rp, fpi->SrcReg[1]),
- t_src(rp, fpi->SrcReg[2]),
- flags);
- break;
- case FP_OPCODE_MAX:
- case FP_OPCODE_MIN:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- case FP_OPCODE_MOV:
- case FP_OPCODE_SWZ:
- emit_arith(rp, PFS_OP_MAD, t_dst(rp, fpi->DstReg), fpi->DstReg.WriteMask,
- t_src(rp, fpi->SrcReg[0]), pfs_one, pfs_zero,
- flags);
- break;
- case FP_OPCODE_MUL:
- emit_arith(rp, PFS_OP_MAD, t_dst(rp, fpi->DstReg), fpi->DstReg.WriteMask,
- t_src(rp, fpi->SrcReg[0]),
- t_src(rp, fpi->SrcReg[1]),
- pfs_zero,
- flags);
- break;
- case FP_OPCODE_POW:
- src0 = t_src(rp, fpi->SrcReg[0]);
- src1 = t_src(rp, fpi->SrcReg[1]);
- dest = t_dst(rp, fpi->DstReg);
- temp = get_temp_reg(rp);
-
- emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_W,
- src0, pfs_zero, pfs_zero, 0);
- emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W,
- temp, src1, pfs_zero, 0);
- emit_arith(rp, PFS_OP_EX2, dest, fpi->DstReg.WriteMask,
- temp, pfs_zero, pfs_zero, 0);
- free_temp(rp, temp);
- break;
- case FP_OPCODE_RCP:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- case FP_OPCODE_RSQ:
- emit_arith(rp, PFS_OP_RSQ, t_dst(rp, fpi->DstReg),
- fpi->DstReg.WriteMask,
- t_src(rp, fpi->SrcReg[0]), pfs_zero, pfs_zero,
- flags | PFS_FLAG_ABS);
- break;
- case FP_OPCODE_SCS:
- case FP_OPCODE_SGE:
- case FP_OPCODE_SIN:
- case FP_OPCODE_SLT:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- case FP_OPCODE_SUB:
- emit_arith(rp, PFS_OP_MAD, t_dst(rp, fpi->DstReg), fpi->DstReg.WriteMask,
- t_src(rp, fpi->SrcReg[0]),
- pfs_one,
- negate(t_src(rp, fpi->SrcReg[1])),
- flags);
- break;
- case FP_OPCODE_TEX:
- emit_tex(rp, fpi, R300_FPITX_OP_TEX);
- break;
- case FP_OPCODE_TXB:
- emit_tex(rp, fpi, R300_FPITX_OP_TXB);
- break;
- case FP_OPCODE_TXP:
- emit_tex(rp, fpi, R300_FPITX_OP_TXP);
- break;
- case FP_OPCODE_XPD:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- default:
- ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
- break;
- }
-
- if (rp->error)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-/* - Init structures
- * - Determine what hwregs each input corresponds to
- */
-static void init_program(struct r300_fragment_program *rp)
-{
- struct fragment_program *mp = &rp->mesa_program;
- struct fp_instruction *fpi;
- GLuint InputsRead = mp->InputsRead;
- GLuint fp_reg = 0;
- GLuint temps_used = 0; /* for rp->temps[] */
- int i;
-
- rp->translated = GL_FALSE;
- rp->error = GL_FALSE;
-
- rp->v_pos = 0;
- rp->s_pos = 0;
-
- rp->tex.length = 0;
- rp->node[0].alu_offset = 0;
- rp->node[0].alu_end = -1;
- rp->node[0].tex_offset = 0;
- rp->node[0].tex_end = -1;
- rp->cur_node = 0;
- rp->first_node_has_tex = 0;
- rp->used_in_node = 0;
- rp->dest_in_node = 0;
-
- rp->const_nr = 0;
- rp->param_nr = 0;
- rp->params_uptodate = GL_FALSE;
-
- rp->temp_in_use = 0;
- rp->hwreg_in_use = 0;
- rp->max_temp_idx = 0;
-
- /* Work out what temps the Mesa inputs correspond to, this must match
- * what setup_rs_unit does, which shouldn't be a problem as rs_unit
- * configures itself based on the fragprog's InputsRead
- *
- * I'm using get_hw_temp() here now rather than doing this manually.
- * This depends on get_hw_temp() allocating registers in order, starting
- * at 0 (which it currently does).
- */
-
- /* Texcoords come first */
- for (i=0;i<rp->ctx->Const.MaxTextureUnits;i++) {
- if (InputsRead & (FRAG_BIT_TEX0 << i))
- rp->inputs[FRAG_ATTRIB_TEX0+i] = get_hw_temp(rp);
- }
- InputsRead &= ~FRAG_BITS_TEX_ANY;
-
- /* Then primary colour */
- if (InputsRead & FRAG_BIT_COL0)
- rp->inputs[FRAG_ATTRIB_COL0] = get_hw_temp(rp);
- InputsRead &= ~FRAG_BIT_COL0;
-
- /* Secondary color */
- if (InputsRead & FRAG_BIT_COL1)
- rp->inputs[FRAG_ATTRIB_COL1] = get_hw_temp(rp);
- InputsRead &= ~FRAG_BIT_COL1;
-
- /* Anything else */
- if (InputsRead) {
- WARN_ONCE("Don't know how to handle inputs 0x%x\n", InputsRead);
- /* force read from hwreg 0 for now */
- for (i=0;i<32;i++)
- if (InputsRead & (1<<i)) rp->inputs[i] = 0;
- }
-
- /* Possibly the worst part of how I went about this... Find out what
- * temps are used by the mesa program so we don't clobber something
- * when we need a temp for other reasons.
- *
- * Possibly not too bad actually, as we could add to this later and
- * find out when inputs are last used so we can reuse them as temps.
- */
- if (!mp->Instructions) {
- ERROR("No instructions found in program\n");
- return;
- }
- for (fpi=mp->Instructions;fpi->Opcode != FP_OPCODE_END; fpi++) {
- for (i=0;i<3;i++) {
- if (fpi->SrcReg[i].File == PROGRAM_TEMPORARY) {
- if (!(temps_used & (1 << fpi->SrcReg[i].Index))) {
- temps_used |= (1 << fpi->SrcReg[i].Index);
- rp->temps[fpi->SrcReg[i].Index] = get_hw_temp(rp);
- }
- }
- }
- /* needed? surely if a program writes a temp it'll read it again */
- if (fpi->DstReg.File == PROGRAM_TEMPORARY) {
- if (!(temps_used & (1 << fpi->DstReg.Index))) {
- temps_used |= (1 << fpi->DstReg.Index);
- rp->temps[fpi->DstReg.Index] = get_hw_temp(rp);
- }
- }
- }
- rp->temp_in_use = temps_used;
-}
-
-static void update_params(struct r300_fragment_program *rp) {
- struct fragment_program *mp = &rp->mesa_program;
- int i;
-
- /* Ask Mesa nicely to fill in ParameterValues for us */
- if (rp->param_nr)
- _mesa_load_state_parameters(rp->ctx, mp->Parameters);
-
- for (i=0;i<rp->param_nr;i++)
- COPY_4V(rp->constant[rp->param[i].idx], rp->param[i].values);
-
- rp->params_uptodate = GL_TRUE;
-}
-
-void translate_fragment_shader(struct r300_fragment_program *rp)
-{
- int i;
-
- if (!rp->translated) {
- init_program(rp);
-
- if (parse_program(rp) == GL_FALSE) {
- dump_program(rp);
- return;
- }
-
- /* Finish off */
- sync_streams(rp);
- rp->node[rp->cur_node].alu_end = rp->v_pos - 1;
- rp->alu_offset = 0;
- rp->alu_end = rp->v_pos - 1;
- rp->tex_offset = 0;
- rp->tex_end = rp->tex.length - 1;
-
- rp->translated = GL_TRUE;
- if (0) dump_program(rp);
- }
-
-
- update_params(rp);
-}
-
-/* just some random things... */
-static void dump_program(struct r300_fragment_program *rp)
-{
- int i;
- static int pc = 0;
-
- fprintf(stderr, "pc=%d*************************************\n", pc++);
-
- fprintf(stderr, "Mesa program:\n");
- fprintf(stderr, "-------------\n");
- _mesa_debug_fp_inst(rp->mesa_program.NumTexInstructions +
- rp->mesa_program.NumAluInstructions,
- rp->mesa_program.Instructions);
- fflush(stdout);
-
- fprintf(stderr, "Hardware program\n");
- fprintf(stderr, "----------------\n");
- for (i=0;i<(rp->cur_node+1);i++) {
- fprintf(stderr, "NODE %d: alu_offset: %d, tex_offset: %d, alu_end: %d, tex_end: %d\n", i,
- rp->node[i].alu_offset,
- rp->node[i].tex_offset,
- rp->node[i].alu_end,
- rp->node[i].tex_end);
- }
-
-/* dump program in pretty_print_command_stream.tcl-readable format */
- fprintf(stderr, "%08x\n", ((rp->alu_end << 16) | (R300_PFS_INSTR0_0 >> 2)));
- for (i=0;i<=rp->alu_end;i++)
- fprintf(stderr, "%08x\n", rp->alu.inst[i].inst0);
- fprintf(stderr, "%08x\n", ((rp->alu_end << 16) | (R300_PFS_INSTR1_0 >> 2)));
- for (i=0;i<=rp->alu_end;i++)
- fprintf(stderr, "%08x\n", rp->alu.inst[i].inst1);
- fprintf(stderr, "%08x\n", ((rp->alu_end << 16) | (R300_PFS_INSTR2_0 >> 2)));
- for (i=0;i<=rp->alu_end;i++)
- fprintf(stderr, "%08x\n", rp->alu.inst[i].inst2);
- fprintf(stderr, "%08x\n", ((rp->alu_end << 16) | (R300_PFS_INSTR3_0 >> 2)));
- for (i=0;i<=rp->alu_end;i++)
- fprintf(stderr, "%08x\n", rp->alu.inst[i].inst3);
- fprintf(stderr, "00000000\n");
-
-}
-#endif // USE_ARB_F_P == 1
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.h
deleted file mode 100644
index ed318eb6a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef __R300_FRAGPROG_H_
-#define __R300_FRAGPROG_H_
-
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "program.h"
-#include "r300_context.h"
-#include "nvfragprog.h"
-
-/* representation of a register for emit_arith/swizzle */
-typedef struct _pfs_reg_t {
- enum {
- REG_TYPE_INPUT,
- REG_TYPE_OUTPUT,
- REG_TYPE_TEMP,
- REG_TYPE_CONST
- } type:2;
- GLuint index:6;
- GLuint v_swz:5;
- GLuint s_swz:5;
- GLuint negate:1; //XXX: we need to handle negate individually
- GLboolean valid:1;
-} pfs_reg_t;
-
-/* supported hw opcodes */
-#define PFS_OP_MAD 0
-#define PFS_OP_DP3 1
-#define PFS_OP_DP4 2
-#define PFS_OP_MIN 3
-#define PFS_OP_MAX 4
-#define PFS_OP_CMP 5
-#define PFS_OP_FRC 6
-#define PFS_OP_EX2 7
-#define PFS_OP_LG2 8
-#define PFS_OP_RCP 9
-#define PFS_OP_RSQ 10
-#define PFS_OP_REPL_ALPHA 11
-#define MAX_PFS_OP 11
-#define OP(n) PFS_OP_##n
-
-#define PFS_FLAG_SAT (1 << 0)
-#define PFS_FLAG_ABS (1 << 1)
-
-extern void translate_fragment_shader(struct r300_fragment_program *rp);
-
-#endif /* __R300_FRAGPROG_H_ */
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog_swz.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog_swz.c
deleted file mode 100644
index 00977ce68..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_fragprog_swz.c
+++ /dev/null
@@ -1,1343 +0,0 @@
-/*
- * Copyright (C) 2005 Jerome Glisse. 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 "r300_fragprog.h"
-#include "r300_reg.h"
-
-
-#define I0_000 ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_ZERO) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_111 ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_ZERO) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG2C_SHIFT) )
-#define I0_XXX ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_XXX) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_YYY ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_YYY) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_ZZZ ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_ZZZ) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_XYZ ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_XYZ) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_YZX ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_YZX) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_ZXY ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_ZXY) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_WZY ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0CA_WZY) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-
-#define IEMPTY 0
-#define I1_CST R300_FPI1_SRC0C_CONST
-
-#define I1_XYZ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X | \
- R300_FPI1_DSTC_REG_Y | \
- R300_FPI1_DSTC_REG_Z )
-#define I1_XY_ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X | \
- R300_FPI1_DSTC_REG_Y )
-#define I1_X_Z ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X | \
- R300_FPI1_DSTC_REG_Z )
-#define I1__YZ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_Y | \
- R300_FPI1_DSTC_REG_Z )
-#define I1_X__ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X )
-#define I1__Y_ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_Y )
-#define I1___Z ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_Z )
-
-#define SEMPTY {0,{0,0,0,0},{0,0,0,0,0,0,0,0}}
-
-struct r300_fragment_program_swizzle r300_swizzle [512] = {
- /* XXX */
- {1,{0,0,0,0},{ I0_XXX, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* YXX */
- {2,{0,0,0,0},{ I0_YYY, I1_X__,
- I0_XXX, I1__YZ,
- 0,0,
- 0,0 } },
- /* ZXX */
- {2,{0,0,0,0},{ I0_ZZZ, I1_X__,
- I0_XXX, I1__YZ,
- 0,0,
- 0,0 } },
- /* WXX */
- {2,{0,0,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__YZ,
- 0,0,
- 0,0} },
- /* 0XX */
- {2,{0,2,0,0},{ I0_XXX, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0,
- 0,0 } },
- /* 1XX */
- {2,{0,2,0,0},{ I0_XXX, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XYX */
- {2,{0,0,0,0},{ I0_YYY, I1__Y_,
- I0_XXX, I1_X_Z,
- 0,0,0,0}},
- /* YYX */
- {2,{0,0,0,0},{ I0_YYY, I1_XY_,
- I0_XXX, I1___Z,
- 0,0,0,0}},
- /* ZYX */
- {3,{0,0,0,0},{ I0_ZZZ, I1_X__,
- I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- 0,0}},
- /* WYX */
- {3,{0,0,0,0},{ I0_WZY, I1_X__,
- I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- 0,0}},
- /* 0YX */
- {3,{0,0,2,0},{ I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 1YX */
- {3,{0,0,2,0},{ I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XZX */
- {2,{0,0,0,0},{ I0_YZX, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YZX */
- {1,{0,0,0,0},{ I0_YZX, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* ZZX */
- {2,{0,0,0,0},{ I0_YZX, I1__YZ,
- I0_ZZZ, I1_X__,0,0,0,0}},
- /* WZX */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_XXX, I1_X__,0,0,0,0}},
- /* 0ZX */
- {2,{0,2,0,0},{ I0_YZX, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0,0,0}},
- /* 1ZX */
- {2,{0,2,0,0},{ I0_YZX, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XWX */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_XXX, I1_X_Z,
- 0,0}},
- /* YWX */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_YZX, I1_X_Z,
- 0,0}},
- /* ZWX */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_ZZZ, I1_X__,
- I0_XXX, I1___Z } },
- /* WWX */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1_XY_,
- I0_YZX, I1___Z,
- 0,0}},
- /* 0WX */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_YZX, I1___Z,
- I0_000, I1_X__ | I1_CST } },
- /* 1WX */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_YZX, I1___Z,
- I0_111, I1_X__ | I1_CST } },
- SEMPTY,SEMPTY,
- /* X0X */
- {2,{0,2,0,0},{ I0_XXX, I1_X_Z,
- I0_000, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Y0X */
- {2,{0,2,0,0},{ I0_YZX, I1_X_Z,
- I0_000, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Z0X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_000, I1__Y_ | I1_CST,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* W0X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_000, I1__Y_ | I1_CST,
- I0_WZY, I1_X__,
- 0,0}},
- /* 00X */
- {2,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_000, I1_XY_ | I1_CST,
- 0,0,0,0}},
- /* 10X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_000, I1__Y_ | I1_CST,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X1X */
- {2,{0,2,0,0},{ I0_XXX, I1_X_Z,
- I0_111, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Y1X */
- {2,{0,2,0,0},{ I0_YZX, I1_X_Z,
- I0_111, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Z1X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_111, I1__Y_ | I1_CST,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* W1X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_111, I1__Y_ | I1_CST,
- I0_WZY, I1_X__,
- 0,0}},
- /* 01X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_111, I1__Y_ | I1_CST,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 11X */
- {2,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_111, I1_XY_ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XXY */
- {2,{0,0,0,0},{ I0_YYY, I1___Z,
- I0_XXX, I1_XY_,
- 0,0,0,0}},
- /* YXY */
- {2,{0,0,0,0},{ I0_YYY, I1_X_Z,
- I0_XXX, I1__Y_,
- 0,0,0,0}},
- /* ZXY */
- {1,{0,0,0,0},{ I0_ZXY, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* WXY */
- {2,{0,0,0,0},{ I0_WZY, I1_X__,
- I0_ZXY, I1__YZ,
- 0,0,0,0}},
- /* 0XY */
- {2,{0,0,0,0},{ I0_ZXY, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0,0,0}},
- /* 1XY */
- {2,{0,0,0,0},{ I0_ZXY, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XYY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YYY */
- {1,{0,0,0,0},{ I0_YYY, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* ZYY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_ZZZ, I1_X__,
- 0,0,0,0}},
- /* WYY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_WZY, I1_X__,
- 0,0,0,0}},
- /* 0YY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0,0,0}},
- /* 1YY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_YYY, I1_X__,
- 0,0,0,0}},
- /* ZZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_ZZZ, I1_X__,
- 0,0,0,0}},
- /* WZY */
- {1,{0,0,0,0},{ I0_WZY, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* 0ZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0,0,0}},
- /* 1ZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XWY */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_XXX, I1_X__,
- I0_YYY, I1___Z } },
- /* YWY */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_YYY, I1_X_Z,
- 0,0}},
- /* ZWY */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_ZXY, I1_X_Z,
- 0,0}},
- /* WWY */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1_XY_,
- I0_ZXY, I1___Z,
- 0,0}},
- /* 0WY */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_ZXY, I1___Z,
- I0_000, I1_X__ | I1_CST } },
- /* 1WY */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_ZXY, I1___Z,
- I0_111, I1_X__ | I1_CST } },
- SEMPTY,SEMPTY,
- /* X0Y */
- {3,{0,2,0,0},{ I0_XXX, I1_X__,
- I0_000, I1__Y_ | I1_CST,
- I0_YYY, I1___Z,
- 0,0}},
- /* Y0Y */
- {2,{0,2,0,0},{ I0_YYY, I1_X_Z,
- I0_000, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Z0Y */
- {2,{0,2,0,0},{ I0_ZXY, I1_X_Z,
- I0_000, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* W0Y */
- {2,{0,2,0,0},{ I0_WZY, I1_X_Z,
- I0_000, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* 00Y */
- {2,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_000, I1_XY_ | I1_CST,
- 0,0,0,0}},
- /* 10Y */
- {3,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_000, I1__Y_ | I1_CST,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X1Y */
- {3,{0,2,0,0},{ I0_XXX, I1_X__,
- I0_111, I1__Y_ | I1_CST,
- I0_YYY, I1___Z,
- 0,0}},
- /* Y1Y */
- {2,{0,2,0,0},{ I0_YYY, I1_X_Z,
- I0_111, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Z1Y */
- {2,{0,2,0,0},{ I0_ZXY, I1_X_Z,
- I0_111, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* W1Y */
- {3,{0,2,0,0},{ I0_WZY, I1_X_Z,
- I0_111, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* 01Y */
- {3,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_111, I1__Y_ | I1_CST,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 11Y */
- {2,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_111, I1_XY_ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XXZ */
- {2,{0,0,0,0},{ I0_XXX, I1_XY_,
- I0_ZZZ, I1___Z,
- 0,0,0,0}},
- /* YXZ */
- {3,{0,0,0,0},{ I0_XXX, I1__Y_,
- I0_YYY, I1_X__,
- I0_ZZZ, I1___Z,
- 0,0}},
- /* ZXZ */
- {2,{0,0,0,0},{ I0_XXX, I1__Y_,
- I0_ZZZ, I1_X_Z,
- 0,0,0,0}},
- /* WXZ */
- {3,{0,0,0,0},{ I0_XXX, I1__Y_,
- I0_ZZZ, I1___Z,
- I0_WZY, I1_X__,
- 0,0}},
- /* 0XZ */
- {3,{0,0,2,0},{ I0_XXX, I1__Y_,
- I0_ZZZ, I1___Z,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 1XZ */
- {3,{0,0,2,0},{ I0_XXX, I1__Y_,
- I0_ZZZ, I1___Z,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XYZ */
- {1,{0,0,0,0},{ I0_XYZ, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* YYZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1___Z,
- I0_YYY, I1_XY_,
- 0,0,0,0}},
- /* ZYZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1_X_Z,
- I0_YYY, I1__Y_,
- 0,0,0,0}},
- /* WYZ */
- {2,{0,0,0,0},{ I0_XYZ, I1__YZ,
- I0_WZY, I1_X__,
- 0,0,0,0}},
- /* 0YZ */
- {2,{0,2,0,0},{ I0_XYZ, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0,0,0}},
- /* 1YZ */
- {2,{0,2,0,0},{ I0_XYZ, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XZZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YZZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1__YZ,
- I0_YYY, I1_X__,
- 0,0,0,0}},
- /* ZZZ */
- {1,{0,0,0,0},{ I0_ZZZ, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* WZZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1__YZ,
- I0_WZY, I1_X__,
- 0,0,0,0}},
- /* 0ZZ */
- {2,{0,2,0,0},{ I0_ZZZ, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0,0,0}},
- /* 1ZZ */
- {2,{0,2,0,0},{ I0_ZZZ, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XWZ */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_XYZ, I1_X_Z,
- 0,0}},
- /* YWZ */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_YYY, I1_X__,
- I0_XYZ, I1___Z } },
- /* ZWZ */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_ZZZ, I1_X_Z,
- 0,0}},
- /* WWZ */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1_XY_,
- I0_XYZ, I1___Z,
- 0,0}},
- /* 0WZ */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_XYZ, I1___Z,
- I0_000, I1_X__ | I1_CST } },
- /* 1WZ */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_XYZ, I1___Z,
- I0_111, I1_X__ | I1_CST } },
- SEMPTY,SEMPTY,
- /* X0Z */
- {2,{0,2,0,0},{ I0_XYZ, I1_X_Z,
- I0_000, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Y0Z */
- {3,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_000, I1__Y_ | I1_CST,
- I0_YYY, I1_X__,
- 0,0}},
- /* Z0Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1_X_Z,
- I0_000, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* W0Z */
- {3,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_000, I1__Y_ | I1_CST,
- I0_WZY, I1_X__,
- 0,0}},
- /* 00Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_000, I1_XY_ | I1_CST,
- 0,0,0,0}},
- /* 10Z */
- {3,{0,2,2,0},{ I0_ZZZ, I1___Z,
- I0_000, I1__Y_ | I1_CST,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X1Z */
- {2,{0,2,0,0},{ I0_XYZ, I1_X_Z,
- I0_111, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* Y1Z */
- {3,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_111, I1__Y_ | I1_CST,
- I0_YYY, I1_X__,
- 0,0}},
- /* Z1Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1_X_Z,
- I0_111, I1__Y_ | I1_CST,
- 0,0,0,0}},
- /* W1Z */
- {3,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_111, I1__Y_ | I1_CST,
- I0_WZY, I1_X__,
- 0,0}},
- /* 01Z */
- {3,{0,2,2,0},{ I0_ZZZ, I1___Z,
- I0_111, I1__Y_ | I1_CST,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 11Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_111, I1_XY_ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XXW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XXX, I1_XY_,
- 0,0}},
- /* YXW */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XXX, I1__Y_,
- I0_YYY, I1_X__ } },
- /* ZXW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_ZXY, I1_XY_,
- 0,0}},
- /* WXW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1_X_Z,
- I0_XXX, I1__Y_,
- 0,0}},
- /* 0XW */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XXX, I1__Y_,
- I0_000, I1_X__ | I1_CST } },
- /* 1XW */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XXX, I1__Y_,
- I0_111, I1_X__ | I1_CST } },
- SEMPTY,SEMPTY,
- /* XYW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XYZ, I1_XY_,
- 0,0}},
- /* YYW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_YYY, I1_XY_,
- 0,0}},
- /* ZYW */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XYZ, I1__Y_,
- I0_ZZZ, I1_X__ } },
- /* WYW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1_X_Z,
- I0_YYY, I1__Y_,
- 0,0}},
- /* 0YW */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_YYY, I1__Y_,
- I0_000, I1_X__ | I1_CST } },
- /* 1YW */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_YYY, I1__Y_,
- I0_111, I1_X__ | I1_CST } },
-
- SEMPTY,SEMPTY,
- /* XZW */
- {4,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XYZ, I1_X__,
- I0_ZZZ, I1__Y_ } },
- /* YZW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_YZX, I1_XY_,
- 0,0}},
- /* ZZW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_ZZZ, I1_XY_,
- 0,0}},
- /* WZW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1_X_Z,
- I0_ZZZ, I1__Y_,
- 0,0}},
- /* 0ZW */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_ZZZ, I1__Y_,
- I0_000, I1_X__ | I1_CST } },
- /* 1ZW */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_ZZZ, I1__Y_,
- I0_111, I1_X__ | I1_CST } },
-
- SEMPTY,SEMPTY,
- /* XWW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__YZ,
- I0_XYZ, I1_X__,
- 0,0}},
- /* YWW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__YZ,
- I0_YYY, I1_X__,
- 0,0}},
- /* ZWW */
- {3,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__YZ,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* WWW */
- {2,{0,1,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1_XYZ,
- 0,0,0,0}},
- /* 0WW */
- {3,{0,1,2,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__YZ,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 1WW */
- {3,{0,1,2,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__YZ,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X0W */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XYZ, I1_X__,
- I0_000, I1__Y_ | I1_CST } },
- /* Y0W */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_YYY, I1_X__,
- I0_000, I1__Y_ | I1_CST } },
- /* Z0W */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_ZZZ, I1_X__,
- I0_000, I1__Y_ | I1_CST } },
- /* 00W */
- {3,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_000, I1_XY_ | I1_CST,
- 0,0}},
- /* 10W */
- {4,{0,1,2,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_111, I1_X__ | I1_CST,
- I0_000, I1__Y_ | I1_CST } },
- SEMPTY,SEMPTY,
- /* X1W */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_XYZ, I1_X__,
- I0_111, I1__Y_ | I1_CST } },
- /* Y1W */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_YYY, I1_X__,
- I0_111, I1__Y_ | I1_CST } },
- /* Z1W */
- {4,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_ZZZ, I1_X__,
- I0_111, I1__Y_ | I1_CST } },
- /* 01W */
- {4,{0,1,2,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_000, I1_X__ | I1_CST,
- I0_111, I1__Y_ | I1_CST } },
- /* 11W */
- {3,{0,1,0,2},{ I0_WZY, I1_X__,
- I0_XXX, I1___Z,
- I0_111, I1_XY_ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XX0 */
- {2,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_XXX, I1_XY_,
- 0,0,0,0}},
- /* YX0 */
- {3,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_XXX, I1__Y_,
- I0_YYY, I1_X__,
- 0,0}},
- /* ZX0 */
- {2,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_ZXY, I1_XY_,
- 0,0,0,0}},
- /* WX0 */
- {3,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_XXX, I1__Y_,
- I0_WZY, I1_X__,
- 0,0}},
- /* 0X0 */
- {2,{2,0,0,0},{ I0_000, I1_X_Z | I1_CST,
- I0_XXX, I1__Y_,
- 0,0,0,0}},
- /* 1X0 */
- {3,{2,0,2,0},{ I0_000, I1___Z | I1_CST,
- I0_XXX, I1__Y_,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XY0 */
- {2,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_XYZ, I1_XY_,
- 0,0,0,0}},
- /* YY0 */
- {2,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_YYY, I1_XY_,
- 0,0,0,0}},
- /* ZY0 */
- {3,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_ZZZ, I1_X__,
- I0_YYY, I1__Y_,
- 0,0}},
- /* WY0 */
- {3,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_XYZ, I1__Y_,
- I0_WZY, I1_X__,
- 0,0}},
- /* 0Y0 */
- {2,{2,0,0,0},{ I0_000, I1_X_Z | I1_CST,
- I0_XYZ, I1__Y_,
- 0,0,0,0}},
- /* 1Y0 */
- {3,{2,0,2,0},{ I0_000, I1___Z | I1_CST,
- I0_XYZ, I1__Y_,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XZ0 */
- {3,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_XYZ, I1_X__,
- I0_ZZZ, I1__Y_,
- 0,0}},
- /* YZ0 */
- {2,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_YZX, I1_XY_,
- 0,0,0,0}},
- /* ZZ0 */
- {2,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_ZZZ, I1_XY_,
- 0,0,0,0}},
- /* WZ0 */
- {2,{2,0,0,0},{ I0_000, I1___Z | I1_CST,
- I0_WZY, I1_XY_,
- 0,0,0,0}},
- /* 0Z0 */
- {2,{2,0,0,0},{ I0_000, I1_X_Z | I1_CST,
- I0_ZZZ, I1__Y_,
- 0,0,0,0}},
- /* 1Z0 */
- {3,{2,0,2,0},{ I0_000, I1___Z | I1_CST,
- I0_ZZZ, I1__Y_,
- I0_111, I1_X__ | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XW0 */
- {4,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_000, I1___Z | I1_CST,
- I0_XYZ, I1_X__ } },
- /* YW0 */
- {4,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_000, I1___Z | I1_CST,
- I0_YYY, I1_X__ } },
- /* ZW0 */
- {4,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_000, I1___Z | I1_CST,
- I0_ZZZ, I1_X__ } },
- /* WW0 */
- {3,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1_XY_,
- I0_000, I1___Z | I1_CST,
- 0,0}},
- /* 0W0 */
- {3,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_000, I1_X_Z | I1_CST,
- 0,0}},
- /* 1W0 */
- {4,{0,1,2,2},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_000, I1___Z | I1_CST,
- I0_111, I1_X__ | I1_CST } },
- SEMPTY,SEMPTY,
- /* X00 */
- {2,{2,0,0,0},{ I0_000, I1__YZ | I1_CST,
- I0_XYZ, I1_X__,
- 0,0,0,0}},
- /* Y00 */
- {2,{2,0,0,0},{ I0_000, I1__YZ | I1_CST,
- I0_YYY, I1_X__,
- 0,0,0,0}},
- /* Z00 */
- {2,{2,0,0,0},{ I0_000, I1__YZ | I1_CST,
- I0_ZZZ, I1_X__,
- 0,0,0,0}},
- /* W00 */
- {2,{2,0,0,0},{ I0_000, I1__YZ | I1_CST,
- I0_WZY, I1_X__,
- 0,0,0,0}},
- /* 000 */
- {1,{2,0,0,0},{ I0_000, I1_XYZ | I1_CST,
- 0, 0, 0, 0, 0, 0 } },
- /* 100 */
- {2,{2,2,0,0},{ I0_000, I1__YZ | I1_CST,
- I0_111, I1_X__ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* X10 */
- {3,{2,0,2,0},{ I0_000, I1___Z | I1_CST,
- I0_XYZ, I1_X__,
- I0_111, I1__Y_ | I1_CST,
- 0,0}},
- /* Y10 */
- {3,{2,0,2,0},{ I0_000, I1___Z | I1_CST,
- I0_YYY, I1_X__,
- I0_111, I1__Y_ | I1_CST,
- 0,0}},
- /* Z10 */
- {3,{2,0,2,0},{ I0_000, I1___Z | I1_CST,
- I0_ZZZ, I1_X__,
- I0_111, I1__Y_ | I1_CST,
- 0,0}},
- /* W10 */
- {3,{2,0,2,0},{ I0_000, I1___Z | I1_CST,
- I0_WZY, I1_X__,
- I0_111, I1__Y_ | I1_CST,
- 0,0}},
- /* 010 */
- {2,{2,2,0,0},{ I0_000, I1_X_Z | I1_CST,
- I0_111, I1__Y_ | I1_CST,
- 0, 0, 0, 0 } },
- /* 110 */
- {2,{2,2,0,0},{ I0_000, I1___Z | I1_CST,
- I0_111, I1_XY_ | I1_CST,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
-
-
-
- /* XX1 */
- {2,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_XXX, I1_XY_,
- 0,0,0,0}},
- /* YX1 */
- {3,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_XXX, I1__Y_,
- I0_YYY, I1_X__,
- 0,0}},
- /* ZX1 */
- {2,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_ZXY, I1_XY_,
- 0,0,0,0}},
- /* WX1 */
- {3,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_XXX, I1__Y_,
- I0_WZY, I1_X__,
- 0,0}},
- /* 0X1 */
- {3,{2,0,2,0},{ I0_111, I1___Z | I1_CST,
- I0_XXX, I1__Y_,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 1X1 */
- {2,{2,0,0,0},{ I0_111, I1_X_Z | I1_CST,
- I0_XXX, I1__Y_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XY1 */
- {2,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_XYZ, I1_XY_,
- 0,0,0,0}},
- /* YY1 */
- {2,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_YYY, I1_XY_,
- 0,0,0,0}},
- /* ZY1 */
- {3,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_ZZZ, I1_X__,
- I0_YYY, I1__Y_,
- 0,0}},
- /* WY1 */
- {3,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_XYZ, I1__Y_,
- I0_WZY, I1_X__,
- 0,0}},
- /* 0Y1 */
- {3,{2,0,2,0},{ I0_111, I1___Z | I1_CST,
- I0_XYZ, I1__Y_,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 1Y1 */
- {2,{2,0,0,0},{ I0_111, I1_X_Z | I1_CST,
- I0_XYZ, I1__Y_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XZ1 */
- {3,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_XYZ, I1_X__,
- I0_ZZZ, I1__Y_,
- 0,0}},
- /* YZ1 */
- {2,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_YZX, I1_XY_,
- 0,0,0,0}},
- /* ZZ1 */
- {2,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_ZZZ, I1_XY_,
- 0,0,0,0}},
- /* WZ1 */
- {2,{2,0,0,0},{ I0_111, I1___Z | I1_CST,
- I0_WZY, I1_XY_,
- 0,0,0,0}},
- /* 0Z1 */
- {3,{2,0,2,0},{ I0_111, I1___Z | I1_CST,
- I0_ZZZ, I1__Y_,
- I0_000, I1_X__ | I1_CST,
- 0,0}},
- /* 1Z1 */
- {2,{2,0,0,0},{ I0_111, I1_X_Z | I1_CST,
- I0_ZZZ, I1__Y_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XW1 */
- {4,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_000, I1___Z | I1_CST,
- I0_XYZ, I1_X__ } },
- /* YW1 */
- {4,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_111, I1___Z | I1_CST,
- I0_YYY, I1_X__ } },
- /* ZW1 */
- {4,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_111, I1___Z | I1_CST,
- I0_ZZZ, I1_X__ } },
- /* WW1 */
- {3,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1_XY_,
- I0_111, I1___Z | I1_CST,
- 0,0}},
- /* 0W1 */
- {4,{0,1,2,2},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_111, I1___Z | I1_CST,
- I0_000, I1_X__ | I1_CST } },
- /* 1W1 */
- {3,{0,1,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_111, I1_X_Z | I1_CST,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X01 */
- {3,{2,0,2,0},{ I0_111, I1___Z | I1_CST,
- I0_XYZ, I1_X__,
- I0_000, I1__Y_ | I1_CST,
- 0,0}},
- /* Y01 */
- {3,{2,0,2,0},{ I0_111, I1___Z | I1_CST,
- I0_YYY, I1_X__,
- I0_000, I1__Y_ | I1_CST,
- 0,0}},
- /* Z01 */
- {3,{2,0,2,0},{ I0_111, I1___Z | I1_CST,
- I0_ZZZ, I1_X__,
- I0_000, I1__Y_ | I1_CST,
- 0,0}},
- /* W01 */
- {3,{2,0,2,0},{ I0_111, I1___Z | I1_CST,
- I0_WZY, I1_X__,
- I0_000, I1__Y_ | I1_CST,
- 0,0}},
- /* 001 */
- {2,{2,2,0,0},{ I0_111, I1___Z | I1_CST,
- I0_000, I1_XY_ | I1_CST,
- 0,0,0,0}},
- /* 101 */
- {2,{2,2,0,0},{ I0_111, I1_X_Z | I1_CST,
- I0_000, I1__Y_ | I1_CST,
- 0, 0, 0, 0 } },
- SEMPTY,SEMPTY,
- /* X11 */
- {2,{2,0,0,0},{ I0_111, I1__YZ | I1_CST,
- I0_XYZ, I1_X__,
- 0,0,0,0}},
- /* Y11 */
- {2,{2,0,0,0},{ I0_111, I1__YZ | I1_CST,
- I0_YYY, I1_X__,
- 0,0,0,0}},
- /* Z11 */
- {2,{2,0,0,0},{ I0_111, I1__YZ | I1_CST,
- I0_ZZZ, I1_X__,
- 0,0,0,0}},
- /* W11 */
- {2,{2,0,0,0},{ I0_111, I1__YZ | I1_CST,
- I0_WZY, I1_X__,
- 0,0,0,0}},
- /* 011 */
- {2,{2,2,0,0},{ I0_111, I1__YZ | I1_CST,
- I0_000, I1_X__ | I1_CST,
- 0,0,0,0}},
- /* 111 */
- {1,{2,0,0,0},{ I0_111, I1_XYZ | I1_CST,
- 0, 0, 0, 0, 0, 0 } },
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY
-};
-
-/******************************************************************************
-* Color source mask table
-******************************************************************************/
-
-#define S_111 R300_FPI0_ARGC_ONE
-#define S_000 R300_FPI0_ARGC_ZERO
-
-#define S0XXX R300_FPI0_ARGC_SRC0C_XXX
-#define S0YYY R300_FPI0_ARGC_SRC0C_YYY
-#define S0ZZZ R300_FPI0_ARGC_SRC0C_ZZZ
-#define S0XYZ R300_FPI0_ARGC_SRC0C_XYZ
-#define S0ZXY R300_FPI0_ARGC_SRC0C_ZXY
-#define S0YZX R300_FPI0_ARGC_SRC0C_YZX
-#define S0WZY R300_FPI0_ARGC_SRC0CA_WZY
-#define S0WZY R300_FPI0_ARGC_SRC0CA_WZY
-
-#define S1XXX R300_FPI0_ARGC_SRC1C_XXX
-#define S1YYY R300_FPI0_ARGC_SRC1C_YYY
-#define S1ZZZ R300_FPI0_ARGC_SRC1C_ZZZ
-#define S1XYZ R300_FPI0_ARGC_SRC1C_XYZ
-#define S1ZXY R300_FPI0_ARGC_SRC1C_ZXY
-#define S1YZX R300_FPI0_ARGC_SRC1C_YZX
-#define S1WZY R300_FPI0_ARGC_SRC1CA_WZY
-
-#define S2XXX R300_FPI0_ARGC_SRC2C_XXX
-#define S2YYY R300_FPI0_ARGC_SRC2C_YYY
-#define S2ZZZ R300_FPI0_ARGC_SRC2C_ZZZ
-#define S2XYZ R300_FPI0_ARGC_SRC2C_XYZ
-#define S2ZXY R300_FPI0_ARGC_SRC2C_ZXY
-#define S2YZX R300_FPI0_ARGC_SRC2C_YZX
-#define S2WZY R300_FPI0_ARGC_SRC2CA_WZY
-
-#define ntnat 32
-
-const GLuint r300_swz_srcc_mask[3][512] = {
- {
- S0XXX,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0YZX,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0ZXY,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S0YYY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S0WZY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0XYZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0ZZZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,S_000,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,S_111,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat
- },
- {
- S1XXX,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1YZX,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1ZXY,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S1YYY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S1WZY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1XYZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1ZZZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,S_000,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,S_111,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat
- },
- {
- S2XXX,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2YZX,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2ZXY,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S2YYY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S2WZY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2XYZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2ZZZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,S_000,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,S_111,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat
- }
-};
-
-/******************************************************************************
-* Alpha source mask table
-******************************************************************************/
-
-GLuint r300_swz_srca_mask[3][6] = {
- { R300_FPI2_ARGA_SRC0C_X,
- R300_FPI2_ARGA_SRC0C_Y,
- R300_FPI2_ARGA_SRC0C_Z,
- R300_FPI2_ARGA_SRC0A,
- R300_FPI2_ARGA_ZERO,
- R300_FPI2_ARGA_ONE },
- { R300_FPI2_ARGA_SRC1C_X,
- R300_FPI2_ARGA_SRC1C_Y,
- R300_FPI2_ARGA_SRC1C_Z,
- R300_FPI2_ARGA_SRC1A,
- R300_FPI2_ARGA_ZERO,
- R300_FPI2_ARGA_ONE },
- { R300_FPI2_ARGA_SRC2C_X,
- R300_FPI2_ARGA_SRC2C_Y,
- R300_FPI2_ARGA_SRC2C_Z,
- R300_FPI2_ARGA_SRC2A,
- R300_FPI2_ARGA_ZERO,
- R300_FPI2_ARGA_ONE },
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c
deleted file mode 100644
index 82379ebb3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ /dev/null
@@ -1,774 +0,0 @@
-/*
-Copyright (C) The Weather Channel, Inc. 2002.
-Copyright (C) 2004 Nicolai Haehnle.
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#include <sched.h>
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-
-#include "r300_context.h"
-#include "radeon_ioctl.h"
-#include "r300_ioctl.h"
-#include "r300_cmdbuf.h"
-#include "r300_state.h"
-#include "r300_program.h"
-#include "radeon_reg.h"
-#include "r300_emit.h"
-
-#include "vblank.h"
-
-//#define CB_DPATH
-
-#define CLEARBUFFER_COLOR 0x1
-#define CLEARBUFFER_DEPTH 0x2
-#define CLEARBUFFER_STENCIL 0x4
-
-static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
-{
- GLcontext* ctx = r300->radeon.glCtx;
- __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
- GLuint cboffset, cbpitch;
- drm_r300_cmd_header_t* cmd2;
-#ifdef CB_DPATH
- r300ContextPtr rmesa=r300;
- LOCAL_VARS;
-#else
- int i;
-#endif
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s: %s buffer (%i,%i %ix%i)\n",
- __FUNCTION__, buffer ? "back" : "front",
- dPriv->x, dPriv->y, dPriv->w, dPriv->h);
-
- if (buffer) {
- cboffset = r300->radeon.radeonScreen->backOffset;
- cbpitch = r300->radeon.radeonScreen->backPitch;
- } else {
- cboffset = r300->radeon.radeonScreen->frontOffset;
- cbpitch = r300->radeon.radeonScreen->frontPitch;
- }
-
- cboffset += r300->radeon.radeonScreen->fbLocation;
-
-#ifndef CB_DPATH
- R300_STATECHANGE(r300, vir[0]);
- ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count = 1;
- r300->hw.vir[0].cmd[1] = 0x21030003;
-
- R300_STATECHANGE(r300, vir[1]);
- ((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count = 1;
- r300->hw.vir[1].cmd[1] = 0xF688F688;
-
- R300_STATECHANGE(r300, vic);
- r300->hw.vic.cmd[R300_VIC_CNTL_0] = 0x00000001;
- r300->hw.vic.cmd[R300_VIC_CNTL_1] = 0x00000405;
-
- R300_STATECHANGE(r300, vof);
- r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT
- | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
- r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */
-
- R300_STATECHANGE(r300, txe);
- r300->hw.txe.cmd[R300_TXE_ENABLE] = 0;
-
- R300_STATECHANGE(r300, vpt);
- r300->hw.vpt.cmd[R300_VPT_XSCALE] = r300PackFloat32(1.0);
- r300->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(dPriv->x);
- r300->hw.vpt.cmd[R300_VPT_YSCALE] = r300PackFloat32(1.0);
- r300->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(dPriv->y);
- r300->hw.vpt.cmd[R300_VPT_ZSCALE] = r300PackFloat32(1.0);
- r300->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(0.0);
-
- R300_STATECHANGE(r300, at);
- r300->hw.at.cmd[R300_AT_ALPHA_TEST] = 0;
-
- R300_STATECHANGE(r300, bld);
- r300->hw.bld.cmd[R300_BLD_CBLEND] = 0;
- r300->hw.bld.cmd[R300_BLD_ABLEND] = 0;
-
- if (r300->radeon.radeonScreen->cpp == 4)
- cbpitch |= R300_COLOR_FORMAT_ARGB8888;
- else
- cbpitch |= R300_COLOR_FORMAT_RGB565;
-
- if (r300->radeon.sarea->tiling_enabled)
- cbpitch |= R300_COLOR_TILE_ENABLE;
-
- R300_STATECHANGE(r300, cb);
- r300->hw.cb.cmd[R300_CB_OFFSET] = cboffset;
- r300->hw.cb.cmd[R300_CB_PITCH] = cbpitch;
-
- R300_STATECHANGE(r300, unk221C);
- r300->hw.unk221C.cmd[1] = R300_221C_CLEAR;
-
- R300_STATECHANGE(r300, ps);
- r300->hw.ps.cmd[R300_PS_POINTSIZE] =
- ((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) |
- ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT);
-
- R300_STATECHANGE(r300, ri);
- for(i = 1; i <= 8; ++i)
- r300->hw.ri.cmd[i] = R300_RS_INTERP_USED;
-
- R300_STATECHANGE(r300, rc);
- /* The second constant is needed to get glxgears display anything .. */
- r300->hw.rc.cmd[1] = (1 << R300_RS_CNTL_CI_CNT_SHIFT) | R300_RS_CNTL_0_UNKNOWN_18;
- r300->hw.rc.cmd[2] = 0;
-
- R300_STATECHANGE(r300, rr);
- ((drm_r300_cmd_header_t*)r300->hw.rr.cmd)->packet0.count = 1;
- r300->hw.rr.cmd[1] = 0x00004000;
-
- R300_STATECHANGE(r300, cmk);
- if (flags & CLEARBUFFER_COLOR) {
- r300->hw.cmk.cmd[R300_CMK_COLORMASK] =
- (ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) |
- (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) |
- (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) |
- (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0);
- } else {
- r300->hw.cmk.cmd[R300_CMK_COLORMASK] = 0;
- }
-
- R300_STATECHANGE(r300, fp);
- r300->hw.fp.cmd[R300_FP_CNTL0] = 0; /* 1 pass, no textures */
- r300->hw.fp.cmd[R300_FP_CNTL1] = 0; /* no temporaries */
- r300->hw.fp.cmd[R300_FP_CNTL2] = 0; /* no offset, one ALU instr */
- r300->hw.fp.cmd[R300_FP_NODE0] = 0;
- r300->hw.fp.cmd[R300_FP_NODE1] = 0;
- r300->hw.fp.cmd[R300_FP_NODE2] = 0;
- r300->hw.fp.cmd[R300_FP_NODE3] = R300_PFS_NODE_LAST_NODE;
-
- R300_STATECHANGE(r300, fpi[0]);
- R300_STATECHANGE(r300, fpi[1]);
- R300_STATECHANGE(r300, fpi[2]);
- R300_STATECHANGE(r300, fpi[3]);
- ((drm_r300_cmd_header_t*)r300->hw.fpi[0].cmd)->packet0.count = 1;
- ((drm_r300_cmd_header_t*)r300->hw.fpi[1].cmd)->packet0.count = 1;
- ((drm_r300_cmd_header_t*)r300->hw.fpi[2].cmd)->packet0.count = 1;
- ((drm_r300_cmd_header_t*)r300->hw.fpi[3].cmd)->packet0.count = 1;
-
- /* MOV o0, t0 */
- r300->hw.fpi[0].cmd[1] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO));
- r300->hw.fpi[1].cmd[1] = FP_SELC(0,NO,XYZ,FP_TMP(0),0,0);
- r300->hw.fpi[2].cmd[1] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO));
- r300->hw.fpi[3].cmd[1] = FP_SELA(0,NO,W,FP_TMP(0),0,0);
-
- R300_STATECHANGE(r300, pvs);
- r300->hw.pvs.cmd[R300_PVS_CNTL_1] =
- (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
- (0 << R300_PVS_CNTL_1_POS_END_SHIFT) |
- (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
- r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; /* no parameters */
- r300->hw.pvs.cmd[R300_PVS_CNTL_3] =
- (1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT);
-
- R300_STATECHANGE(r300, vpi);
- ((drm_r300_cmd_header_t*)r300->hw.vpi.cmd)->packet0.count = 8;
-
- /* MOV o0, i0; */
- r300->hw.vpi.cmd[1] = VP_OUT(ADD,OUT,0,XYZW);
- r300->hw.vpi.cmd[2] = VP_IN(IN,0);
- r300->hw.vpi.cmd[3] = VP_ZERO();
- r300->hw.vpi.cmd[4] = 0;
-
- /* MOV o1, i1; */
- r300->hw.vpi.cmd[5] = VP_OUT(ADD,OUT,1,XYZW);
- r300->hw.vpi.cmd[6] = VP_IN(IN,1);
- r300->hw.vpi.cmd[7] = VP_ZERO();
- r300->hw.vpi.cmd[8] = 0;
-
- R300_STATECHANGE(r300, zs);
- if (flags & CLEARBUFFER_DEPTH) {
- r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE;
- r300->hw.zs.cmd[R300_ZS_CNTL_0] |= 0x6; // test and write
- r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= (R300_ZS_ALWAYS<<R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
-/*
- R300_STATECHANGE(r300, zb);
- r300->hw.zb.cmd[R300_ZB_OFFSET] =
- 1024*4*300 +
- r300->radeon.radeonScreen->frontOffset +
- r300->radeon.radeonScreen->fbLocation;
- r300->hw.zb.cmd[R300_ZB_PITCH] =
- r300->radeon.radeonScreen->depthPitch;
-*/
- } else {
- r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE;
- r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_DISABLED_1; // disable
- r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
- }
-
- R300_STATECHANGE(r300, zs);
- if (flags & CLEARBUFFER_STENCIL) {
- r300->hw.zs.cmd[R300_ZS_CNTL_0] &= ~R300_RB3D_STENCIL_ENABLE;
- r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_STENCIL_ENABLE;
- r300->hw.zs.cmd[R300_ZS_CNTL_1] &=
- ~((R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT));
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |=
- (R300_ZS_ALWAYS<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) |
- (R300_ZS_ALWAYS<<R300_RB3D_ZS1_BACK_FUNC_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) ;
- r300->hw.zs.cmd[R300_ZS_CNTL_2] = r300->state.stencil.clear;
- }
-
- /* Make sure we have enough space */
- r300EnsureCmdBufSpace(r300, r300->hw.max_state_size + 9+8, __FUNCTION__);
-
- r300EmitState(r300);
-#else
- R300_STATECHANGE(r300, cb);
- reg_start(R300_RB3D_COLOROFFSET0, 0);
- e32(cboffset);
-
- if (r300->radeon.radeonScreen->cpp == 4)
- cbpitch |= R300_COLOR_FORMAT_ARGB8888;
- else
- cbpitch |= R300_COLOR_FORMAT_RGB565;
-
- reg_start(R300_RB3D_COLORPITCH0, 0);
- e32(cbpitch);
-
- R300_STATECHANGE(r300, cmk);
- reg_start(R300_RB3D_COLORMASK, 0);
-
- if (flags & CLEARBUFFER_COLOR) {
- e32((ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) |
- (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) |
- (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) |
- (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0));
- } else {
- e32(0);
- }
-
- R300_STATECHANGE(r300, zs);
- reg_start(R300_RB3D_ZSTENCIL_CNTL_0, 2);
-
- {
- uint32_t t1, t2;
-
- t1 = r300->hw.zs.cmd[R300_ZS_CNTL_0];
- t2 = r300->hw.zs.cmd[R300_ZS_CNTL_1];
-
- if (flags & CLEARBUFFER_DEPTH) {
- t1 &= R300_RB3D_STENCIL_ENABLE;
- t1 |= 0x6; // test and write
-
- t2 &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
- t2 |= (R300_ZS_ALWAYS<<R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
-/*
- R300_STATECHANGE(r300, zb);
- r300->hw.zb.cmd[R300_ZB_OFFSET] =
- 1024*4*300 +
- r300->radeon.radeonScreen->frontOffset +
- r300->radeon.radeonScreen->fbLocation;
- r300->hw.zb.cmd[R300_ZB_PITCH] =
- r300->radeon.radeonScreen->depthPitch;
-*/
- } else {
- t1 &= R300_RB3D_STENCIL_ENABLE;
- t1 |= R300_RB3D_Z_DISABLED_1; // disable
-
- t2 &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
- }
-
- if (flags & CLEARBUFFER_STENCIL) {
- t1 &= ~R300_RB3D_STENCIL_ENABLE;
- t1 |= R300_RB3D_STENCIL_ENABLE;
-
- t2 &=
- ~((R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT));
- t2 |=
- (R300_ZS_ALWAYS<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) |
- (R300_ZS_ALWAYS<<R300_RB3D_ZS1_BACK_FUNC_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) |
- (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) ;
- }
-
- e32(t1);
- e32(t2);
- e32(r300->state.stencil.clear);
- }
-
-#endif
-
- cmd2 = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__);
- cmd2[0].packet3.cmd_type = R300_CMD_PACKET3;
- cmd2[0].packet3.packet = R300_CMD_PACKET3_CLEAR;
- cmd2[1].u = r300PackFloat32(dPriv->w / 2.0);
- cmd2[2].u = r300PackFloat32(dPriv->h / 2.0);
- cmd2[3].u = r300PackFloat32(ctx->Depth.Clear);
- cmd2[4].u = r300PackFloat32(1.0);
- cmd2[5].u = r300PackFloat32(ctx->Color.ClearColor[0]);
- cmd2[6].u = r300PackFloat32(ctx->Color.ClearColor[1]);
- cmd2[7].u = r300PackFloat32(ctx->Color.ClearColor[2]);
- cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]);
-
-}
-
-#ifdef CB_DPATH
-static void r300EmitClearState(GLcontext * ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- r300ContextPtr rmesa=r300;
- __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
- int i;
- LOCAL_VARS;
-
- R300_STATECHANGE(r300, vir[0]);
- reg_start(R300_VAP_INPUT_ROUTE_0_0, 0);
- e32(0x21030003);
-
- R300_STATECHANGE(r300, vir[1]);
- reg_start(R300_VAP_INPUT_ROUTE_1_0, 0);
- e32(0xF688F688);
-
- R300_STATECHANGE(r300, vic);
- reg_start(R300_VAP_INPUT_CNTL_0, 1);
- e32(0x00000001);
- e32(0x00000405);
-
- R300_STATECHANGE(r300, vof);
- reg_start(R300_VAP_OUTPUT_VTX_FMT_0, 1);
- e32(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT);
- e32(0); /* no textures */
-
-
- R300_STATECHANGE(r300, txe);
- reg_start(R300_TX_ENABLE, 0);
- e32(0);
-
- R300_STATECHANGE(r300, vpt);
- reg_start(R300_SE_VPORT_XSCALE, 5);
- efloat(1.0);
- efloat(dPriv->x);
- efloat(1.0);
- efloat(dPriv->y);
- efloat(1.0);
- efloat(0.0);
-
- R300_STATECHANGE(r300, at);
- reg_start(R300_PP_ALPHA_TEST, 0);
- e32(0);
-
- R300_STATECHANGE(r300, bld);
- reg_start(R300_RB3D_CBLEND, 1);
- e32(0);
- e32(0);
-
- R300_STATECHANGE(r300, unk221C);
- reg_start(0x221C, 0);
- e32(R300_221C_CLEAR);
-
- R300_STATECHANGE(r300, ps);
- reg_start(R300_RE_POINTSIZE, 0);
- e32(((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) |
- ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT));
-
- R300_STATECHANGE(r300, ri);
- reg_start(R300_RS_INTERP_0, 8);
- for(i = 0; i < 8; ++i){
- e32(R300_RS_INTERP_USED);
- }
-
- R300_STATECHANGE(r300, rc);
- /* The second constant is needed to get glxgears display anything .. */
- reg_start(R300_RS_CNTL_0, 1);
- e32(R300_RS_CNTL_0_UNKNOWN_7 | R300_RS_CNTL_0_UNKNOWN_18);
- e32(0);
-
- R300_STATECHANGE(r300, rr);
- reg_start(R300_RS_ROUTE_0, 0);
- e32(0x00004000);
-
- R300_STATECHANGE(r300, fp);
- reg_start(R300_PFS_CNTL_0, 2);
- e32(0);
- e32(0);
- e32(0);
- reg_start(R300_PFS_NODE_0, 3);
- e32(0);
- e32(0);
- e32(0);
- e32(R300_PFS_NODE_LAST_NODE);
-
- R300_STATECHANGE(r300, fpi[0]);
- R300_STATECHANGE(r300, fpi[1]);
- R300_STATECHANGE(r300, fpi[2]);
- R300_STATECHANGE(r300, fpi[3]);
-
- reg_start(R300_PFS_INSTR0_0, 0);
- e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)));
-
- reg_start(R300_PFS_INSTR1_0, 0);
- e32(FP_SELC(0,NO,XYZ,FP_TMP(0),0,0));
-
- reg_start(R300_PFS_INSTR2_0, 0);
- e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)));
-
- reg_start(R300_PFS_INSTR3_0, 0);
- e32(FP_SELA(0,NO,W,FP_TMP(0),0,0));
-
- R300_STATECHANGE(r300, pvs);
- reg_start(R300_VAP_PVS_CNTL_1, 2);
- e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
- (0 << R300_PVS_CNTL_1_POS_END_SHIFT) |
- (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT));
- e32(0);
- e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT);
-
- R300_STATECHANGE(r300, vpi);
- vsf_start_fragment(0x0, 8);
- e32(VP_OUT(ADD,OUT,0,XYZW));
- e32(VP_IN(IN,0));
- e32(VP_ZERO());
- e32(0);
-
- e32(VP_OUT(ADD,OUT,1,XYZW));
- e32(VP_IN(IN,1));
- e32(VP_ZERO());
- e32(0);
-
-}
-#endif
-
-/**
- * Buffer clear
- */
-static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
- int flags = 0;
- int bits = 0;
- int swapped;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch);
-
- {
- LOCK_HARDWARE(&r300->radeon);
- UNLOCK_HARDWARE(&r300->radeon);
- if (dPriv->numClipRects == 0)
- return;
- }
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- flags |= BUFFER_BIT_FRONT_LEFT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if (mask & BUFFER_BIT_BACK_LEFT) {
- flags |= BUFFER_BIT_BACK_LEFT;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if (mask & BUFFER_BIT_DEPTH) {
- bits |= CLEARBUFFER_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if ( (mask & BUFFER_BIT_STENCIL) && r300->state.stencil.hw_stencil) {
- bits |= CLEARBUFFER_STENCIL;
- mask &= ~BUFFER_BIT_STENCIL;
- }
-
- if (mask) {
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "%s: swrast clear, mask: %x\n",
- __FUNCTION__, mask);
- _swrast_Clear(ctx, mask, all, cx, cy, cw, ch);
- }
-
- swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1);
-
-#ifdef CB_DPATH
- if(flags || bits)
- r300EmitClearState(ctx);
-#endif
-
- if (flags & BUFFER_BIT_FRONT_LEFT) {
- r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, swapped);
- bits = 0;
- }
-
- if (flags & BUFFER_BIT_BACK_LEFT) {
- r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, swapped ^ 1);
- bits = 0;
- }
-
- if (bits)
- r300ClearBuffer(r300, bits, 0);
-
-#ifndef CB_DPATH
- /* Recalculate the hardware state. This could be done more efficiently,
- * but do keep it like this for now.
- */
- r300ResetHwState(r300);
-
- /* r300ClearBuffer has trampled all over the hardware state.. */
- r300->hw.all_dirty=GL_TRUE;
-#endif
-}
-
-void r300Flush(GLcontext * ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (r300->cmdbuf.count_used > r300->cmdbuf.count_reemit)
- r300FlushCmdBuf(r300, __FUNCTION__);
-}
-
-void r300RefillCurrentDmaRegion(r300ContextPtr rmesa)
-{
- struct r300_dma_buffer *dmabuf;
- int fd = rmesa->radeon.dri.fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- int ret;
-
- if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush) {
- rmesa->dma.flush(rmesa);
- }
-
- if (rmesa->dma.current.buf)
- r300ReleaseDmaRegion(rmesa, &rmesa->dma.current, __FUNCTION__);
-
- if (rmesa->dma.nr_released_bufs > 4)
- r300FlushCmdBuf(rmesa, __FUNCTION__);
-
- dma.context = rmesa->radeon.dri.hwContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = RADEON_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- LOCK_HARDWARE(&rmesa->radeon); /* no need to validate */
-
- ret = drmDMA(fd, &dma);
-
- if (ret != 0) {
- /* Try to release some buffers and wait until we can't get any more */
- if (rmesa->dma.nr_released_bufs) {
- r300FlushCmdBufLocked(rmesa, __FUNCTION__);
- }
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Waiting for buffers\n");
-
- radeonWaitForIdleLocked(&rmesa->radeon);
- ret = drmDMA(fd, &dma);
-
- if (ret != 0) {
- UNLOCK_HARDWARE(&rmesa->radeon);
- fprintf(stderr, "Error: Could not get dma buffer... exiting\n");
- exit(-1);
- }
- }
-
- UNLOCK_HARDWARE(&rmesa->radeon);
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Allocated buffer %d\n", index);
-
- dmabuf = CALLOC_STRUCT(r300_dma_buffer);
- dmabuf->buf = &rmesa->radeon.radeonScreen->buffers->list[index];
- dmabuf->refcount = 1;
-
- rmesa->dma.current.buf = dmabuf;
- rmesa->dma.current.address = dmabuf->buf->address;
- rmesa->dma.current.end = dmabuf->buf->total;
- rmesa->dma.current.start = 0;
- rmesa->dma.current.ptr = 0;
-}
-
-void r300ReleaseDmaRegion(r300ContextPtr rmesa,
- struct r300_dma_region *region, const char *caller)
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (!region->buf)
- return;
-
- if (rmesa->dma.flush)
- rmesa->dma.flush(rmesa);
-
- if (--region->buf->refcount == 0) {
- drm_radeon_cmd_header_t *cmd;
-
- if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA))
- fprintf(stderr, "%s -- DISCARD BUF %d\n", __FUNCTION__,
- region->buf->buf->idx);
- cmd =
- (drm_radeon_cmd_header_t *) r300AllocCmdBuf(rmesa,
- sizeof(*cmd) / 4,
- __FUNCTION__);
- cmd->dma.cmd_type = R300_CMD_DMA_DISCARD;
- cmd->dma.buf_idx = region->buf->buf->idx;
-
- FREE(region->buf);
- rmesa->dma.nr_released_bufs++;
- }
-
- region->buf = 0;
- region->start = 0;
-}
-
-/* Allocates a region from rmesa->dma.current. If there isn't enough
- * space in current, grab a new buffer (and discard what was left of current)
- */
-void r300AllocDmaRegion(r300ContextPtr rmesa,
- struct r300_dma_region *region,
- int bytes, int alignment)
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, bytes);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush(rmesa);
-
- if (region->buf)
- r300ReleaseDmaRegion(rmesa, region, __FUNCTION__);
-
- alignment--;
- rmesa->dma.current.start = rmesa->dma.current.ptr =
- (rmesa->dma.current.ptr + alignment) & ~alignment;
-
- if (rmesa->dma.current.ptr + bytes > rmesa->dma.current.end)
- r300RefillCurrentDmaRegion(rmesa);
-
- region->start = rmesa->dma.current.start;
- region->ptr = rmesa->dma.current.start;
- region->end = rmesa->dma.current.start + bytes;
- region->address = rmesa->dma.current.address;
- region->buf = rmesa->dma.current.buf;
- region->buf->refcount++;
-
- rmesa->dma.current.ptr += bytes; /* bug - if alignment > 7 */
- rmesa->dma.current.start =
- rmesa->dma.current.ptr = (rmesa->dma.current.ptr + 0x7) & ~0x7;
-
- assert(rmesa->dma.current.ptr <= rmesa->dma.current.end);
-}
-
-/* Called via glXGetMemoryOffsetMESA() */
-GLuint r300GetMemoryOffsetMESA(__DRInativeDisplay * dpy, int scrn,
- const GLvoid * pointer)
-{
- GET_CURRENT_CONTEXT(ctx);
- r300ContextPtr rmesa;
- GLuint card_offset;
-
- if (!ctx || !(rmesa = R300_CONTEXT(ctx))) {
- fprintf(stderr, "%s: no context\n", __FUNCTION__);
- return ~0;
- }
-
- if (!r300IsGartMemory(rmesa, pointer, 0))
- return ~0;
-
- if (rmesa->radeon.dri.drmMinor < 6)
- return ~0;
-
- card_offset = r300GartOffsetFromVirtual(rmesa, pointer);
-
- return card_offset - rmesa->radeon.radeonScreen->gart_base;
-}
-
-GLboolean r300IsGartMemory(r300ContextPtr rmesa, const GLvoid * pointer,
- GLint size)
-{
- int offset =
- (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
- int valid = (size >= 0 && offset >= 0
- && offset + size < rmesa->radeon.radeonScreen->gartTextures.size);
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "r300IsGartMemory( %p ) : %d\n", pointer,
- valid);
-
- return valid;
-}
-
-GLuint r300GartOffsetFromVirtual(r300ContextPtr rmesa, const GLvoid * pointer)
-{
- int offset =
- (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
-
- //fprintf(stderr, "offset=%08x\n", offset);
-
- if (offset < 0 || offset > rmesa->radeon.radeonScreen->gartTextures.size)
- return ~0;
- else
- return rmesa->radeon.radeonScreen->gart_texture_offset + offset;
-}
-
-void r300InitIoctlFuncs(struct dd_function_table *functions)
-{
- functions->Clear = r300Clear;
- functions->Finish = radeonFinish;
- functions->Flush = r300Flush;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.h
deleted file mode 100644
index 5514214cc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_ioctl.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#ifndef __R300_IOCTL_H__
-#define __R300_IOCTL_H__
-
-#include "r300_context.h"
-#include "radeon_drm.h"
-
-extern GLuint r300GetMemoryOffsetMESA(__DRInativeDisplay * dpy, int scrn,
- const GLvoid * pointer);
-
-extern GLboolean r300IsGartMemory(r300ContextPtr rmesa, const GLvoid * pointer,
- GLint size);
-
-extern GLuint r300GartOffsetFromVirtual(r300ContextPtr rmesa,
- const GLvoid * pointer);
-
-extern void r300Flush(GLcontext * ctx);
-
-extern void r300RefillCurrentDmaRegion(r300ContextPtr rmesa);
-extern void r300ReleaseDmaRegion(r300ContextPtr rmesa,
- struct r300_dma_region *region, const char *caller);
-extern void r300AllocDmaRegion(r300ContextPtr rmesa,
- struct r300_dma_region *region,
- int bytes, int alignment);
-
-extern void r300InitIoctlFuncs(struct dd_function_table *functions);
-
-#endif /* __R300_IOCTL_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.c
deleted file mode 100644
index 1908ac07a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "r300_context.h"
-#include "radeon_ioctl.h"
-#include "r300_state.h"
-#include "r300_maos.h"
-#include "r300_ioctl.h"
-
-#define DEBUG_ALL DEBUG_VERTS
-
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
- : "0" (nr), \
- "D" ((long)dst), \
- "S" ((long)src) ); \
-} while (0)
-#else
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int j; \
- for ( j = 0 ; j < nr ; j++ ) \
- dst[j] = ((int *)src)[j]; \
- dst += nr; \
-} while (0)
-#endif
-
-static void emit_vec4(GLcontext * ctx,
- struct r300_dma_region *rvb,
- GLvoid *data, int stride, int count)
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4)
- COPY_DWORDS(out, data, count);
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out++;
- data += stride;
- }
-}
-
-static void emit_vec8(GLcontext * ctx,
- struct r300_dma_region *rvb,
- GLvoid *data, int stride, int count)
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 8)
- COPY_DWORDS(out, data, count * 2);
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data + 4);
- out += 2;
- data += stride;
- }
-}
-
-static void emit_vec12(GLcontext * ctx,
- struct r300_dma_region *rvb,
- GLvoid *data, int stride, int count)
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p data %p\n",
- __FUNCTION__, count, stride, (void *)out, (void *)data);
-
- if (stride == 12)
- COPY_DWORDS(out, data, count * 3);
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data + 4);
- out[2] = *(int *)(data + 8);
- out += 3;
- data += stride;
- }
-}
-
-static void emit_vec16(GLcontext * ctx,
- struct r300_dma_region *rvb,
- GLvoid *data, int stride, int count)
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 16)
- COPY_DWORDS(out, data, count * 4);
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data + 4);
- out[2] = *(int *)(data + 8);
- out[3] = *(int *)(data + 12);
- out += 4;
- data += stride;
- }
-}
-
-static void emit_vector(GLcontext * ctx,
- struct r300_dma_region *rvb,
- GLvoid *data, int size, int stride, int count)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d size %d stride %d\n",
- __FUNCTION__, count, size, stride);
-
- if(r300IsGartMemory(rmesa, data, size*stride)){
- rvb->address = rmesa->radeon.radeonScreen->gartTextures.map;
- rvb->start = (char *)data - rvb->address;
- rvb->aos_offset = r300GartOffsetFromVirtual(rmesa, data);
-
- if(stride == 0)
- rvb->aos_stride = 0;
- else
- rvb->aos_stride = stride / 4;
-
- rvb->aos_size = size;
- return;
- }
-
- /* Gets triggered when playing with future_hw_tcl_on ...*/
- //assert(!rvb->buf);
-
- if (stride == 0) {
- r300AllocDmaRegion(rmesa, rvb, size * 4, 4);
- count = 1;
- rvb->aos_offset = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = size;
- } else {
- r300AllocDmaRegion(rmesa, rvb, size * count * 4, 4); /* alignment? */
- rvb->aos_offset = GET_START(rvb);
- rvb->aos_stride = size;
- rvb->aos_size = size;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 1:
- emit_vec4(ctx, rvb, data, stride, count);
- break;
- case 2:
- emit_vec8(ctx, rvb, data, stride, count);
- break;
- case 3:
- emit_vec12(ctx, rvb, data, stride, count);
- break;
- case 4:
- emit_vec16(ctx, rvb, data, stride, count);
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-
-}
-
-void r300EmitElts(GLcontext * ctx, GLuint *elts, unsigned long n_elts)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct r300_dma_region *rvb=&rmesa->state.elt_dma;
- unsigned short int *out;
- int i;
-
- if(r300IsGartMemory(rmesa, elts, n_elts*sizeof(unsigned short int))){
- rvb->address = rmesa->radeon.radeonScreen->gartTextures.map;
- rvb->start = (char *)elts - rvb->address;
- rvb->aos_offset = rmesa->radeon.radeonScreen->gart_texture_offset + rvb->start;
- return ;
- }
-
- r300AllocDmaRegion(rmesa, rvb, n_elts*sizeof(unsigned short int), 2);
-
- out = (unsigned short int *)(rvb->address + rvb->start);
-
- for(i=0; i < n_elts; i++)
- out[i]=(unsigned short int)elts[i];
-}
-
-/* Emit vertex data to GART memory (unless immediate mode)
- * Route inputs to the vertex processor
- */
-void r300EmitArrays(GLcontext * ctx, GLboolean immd)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- r300ContextPtr r300 = rmesa;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint nr = 0;
- GLuint count = VB->Count;
- GLuint dw,mask;
- GLuint vic_1 = 0; /* R300_VAP_INPUT_CNTL_1 */
- GLuint aa_vap_reg = 0; /* VAP register assignment */
- GLuint i;
- GLuint inputs = 0;
-
-
-#define CONFIGURE_AOS(r, f, v, sz, cn) { \
- if (RADEON_DEBUG & DEBUG_STATE) \
- fprintf(stderr, "Enabling "#v "\n"); \
- if (++nr >= R300_MAX_AOS_ARRAYS) { \
- fprintf(stderr, "Aieee! AOS array count exceeded!\n"); \
- exit(-1); \
- } \
- \
- if (hw_tcl_on == GL_FALSE) \
- rmesa->state.aos[nr-1].aos_reg = aa_vap_reg++; \
- rmesa->state.aos[nr-1].aos_format = f; \
- if (immd) { \
- rmesa->state.aos[nr-1].aos_size = 4; \
- rmesa->state.aos[nr-1].aos_stride = 4; \
- rmesa->state.aos[nr-1].aos_offset = 0; \
- } else { \
- emit_vector(ctx, \
- &rmesa->state.aos[nr-1], \
- v->data, \
- sz, \
- v->stride, \
- cn); \
- rmesa->state.vap_reg.r=rmesa->state.aos[nr-1].aos_reg; \
- } \
-}
-
- if (hw_tcl_on) {
- GLuint InputsRead = CURRENT_VERTEX_SHADER(ctx)->InputsRead;
- struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx);
- if (InputsRead & (1<<VERT_ATTRIB_POS)) {
- inputs |= _TNL_BIT_POS;
- rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_POS];
- }
- if (InputsRead & (1<<VERT_ATTRIB_NORMAL)) {
- inputs |= _TNL_BIT_NORMAL;
- rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_NORMAL];
- }
- if (InputsRead & (1<<VERT_ATTRIB_COLOR0)) {
- inputs |= _TNL_BIT_COLOR0;
- rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_COLOR0];
- }
- if (InputsRead & (1<<VERT_ATTRIB_COLOR1)) {
- inputs |= _TNL_BIT_COLOR1;
- rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_COLOR1];
- }
- if (InputsRead & (1<<VERT_ATTRIB_FOG)) {
- inputs |= _TNL_BIT_FOG;
- rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_FOG];
- }
- if(ctx->Const.MaxTextureUnits > 8) { /* Not sure if this can even happen... */
- fprintf(stderr, "%s: Cant handle that many inputs\n", __FUNCTION__);
- exit(-1);
- }
- for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
- if (InputsRead & (1<<(VERT_ATTRIB_TEX0+i))) {
- inputs |= _TNL_BIT_TEX0<<i;
- rmesa->state.aos[nr++].aos_reg = prog->inputs[VERT_ATTRIB_TEX0+i];
- }
- }
- nr = 0;
- } else {
- inputs = TNL_CONTEXT(ctx)->render_inputs;
- }
- rmesa->state.render_inputs = inputs;
-
- if (inputs & _TNL_BIT_POS) {
- CONFIGURE_AOS(i_coords, AOS_FORMAT_FLOAT,
- VB->ObjPtr,
- immd ? 4 : VB->ObjPtr->size,
- count);
-
- vic_1 |= R300_INPUT_CNTL_POS;
- }
-
- if (inputs & _TNL_BIT_NORMAL) {
- CONFIGURE_AOS(i_normal, AOS_FORMAT_FLOAT,
- VB->NormalPtr,
- immd ? 4 : VB->NormalPtr->size,
- count);
-
- vic_1 |= R300_INPUT_CNTL_NORMAL;
- }
-
- if (inputs & _TNL_BIT_COLOR0) {
- int emitsize=4;
-
- if (!immd) {
- if (VB->ColorPtr[0]->size == 4 &&
- (VB->ColorPtr[0]->stride != 0 ||
- VB->ColorPtr[0]->data[0][3] != 1.0)) {
- emitsize = 4;
- } else {
- emitsize = 3;
- }
- }
-
- CONFIGURE_AOS(i_color[0], AOS_FORMAT_FLOAT_COLOR,
- VB->ColorPtr[0],
- immd ? 4 : emitsize,
- count);
-
- vic_1 |= R300_INPUT_CNTL_COLOR;
- }
-
- if (inputs & _TNL_BIT_COLOR1) {
- CONFIGURE_AOS(i_color[1], AOS_FORMAT_FLOAT_COLOR,
- VB->SecondaryColorPtr[0],
- immd ? 4 : VB->SecondaryColorPtr[0]->size,
- count);
- }
-
-#if 0
- if (inputs & _TNL_BIT_FOG) {
- CONFIGURE_AOS( AOS_FORMAT_FLOAT,
- VB->FogCoordPtr,
- immd ? 4 : VB->FogCoordPtr->size,
- count);
- }
-#endif
-
- r300->state.texture.tc_count = 0;
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (inputs & (_TNL_BIT_TEX0 << i)) {
- CONFIGURE_AOS(i_tex[i], AOS_FORMAT_FLOAT,
- VB->TexCoordPtr[i],
- immd ? 4 : VB->TexCoordPtr[i]->size,
- count);
-
- vic_1 |= R300_INPUT_CNTL_TC0 << i;
- r300->state.texture.tc_count++;
- }
- }
-
-#define SHOW_INFO(n) do { \
- if (RADEON_DEBUG & DEBUG_ALL) { \
- fprintf(stderr, "RR[%d] - sz=%d, reg=%d, fmt=%d -- st=%d, of=0x%08x\n", \
- n, \
- r300->state.aos[n].aos_size, \
- r300->state.aos[n].aos_reg, \
- r300->state.aos[n].aos_format, \
- r300->state.aos[n].aos_stride, \
- r300->state.aos[n].aos_offset); \
- } \
-} while(0);
-
- /* setup INPUT_ROUTE */
- R300_STATECHANGE(r300, vir[0]);
- for(i=0;i+1<nr;i+=2){
- SHOW_INFO(i)
- SHOW_INFO(i+1)
- dw=(r300->state.aos[i].aos_size-1)
- | ((r300->state.aos[i].aos_reg)<<8)
- | (r300->state.aos[i].aos_format<<14)
- | (((r300->state.aos[i+1].aos_size-1)
- | ((r300->state.aos[i+1].aos_reg)<<8)
- | (r300->state.aos[i+1].aos_format<<14))<<16);
-
- if(i+2==nr){
- dw|=(1<<(13+16));
- }
- r300->hw.vir[0].cmd[R300_VIR_CNTL_0+(i>>1)]=dw;
- }
- if(nr & 1){
- SHOW_INFO(nr-1)
- dw=(r300->state.aos[nr-1].aos_size-1)
- | (r300->state.aos[nr-1].aos_format<<14)
- | ((r300->state.aos[nr-1].aos_reg)<<8)
- | (1<<13);
- r300->hw.vir[0].cmd[R300_VIR_CNTL_0+(nr>>1)]=dw;
- //fprintf(stderr, "vir0 dw=%08x\n", dw);
- }
- /* Set the rest of INPUT_ROUTE_0 to 0 */
- //for(i=((count+1)>>1); i<8; i++)r300->hw.vir[0].cmd[R300_VIR_CNTL_0+i]=(0x0);
- ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count = (nr+1)>>1;
-
-
- /* Mesa assumes that all missing components are from (0, 0, 0, 1) */
-#define ALL_COMPONENTS ((R300_INPUT_ROUTE_SELECT_X<<R300_INPUT_ROUTE_X_SHIFT) \
- | (R300_INPUT_ROUTE_SELECT_Y<<R300_INPUT_ROUTE_Y_SHIFT) \
- | (R300_INPUT_ROUTE_SELECT_Z<<R300_INPUT_ROUTE_Z_SHIFT) \
- | (R300_INPUT_ROUTE_SELECT_W<<R300_INPUT_ROUTE_W_SHIFT))
-
-#define ALL_DEFAULT ((R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_X_SHIFT) \
- | (R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_Y_SHIFT) \
- | (R300_INPUT_ROUTE_SELECT_ZERO<<R300_INPUT_ROUTE_Z_SHIFT) \
- | (R300_INPUT_ROUTE_SELECT_ONE<<R300_INPUT_ROUTE_W_SHIFT))
-
- R300_STATECHANGE(r300, vir[1]);
-
- for(i=0;i+1<nr;i+=2){
- /* do i first.. */
- mask=(1<<(r300->state.aos[i].aos_size*3))-1;
- dw=(ALL_COMPONENTS & mask)
- | (ALL_DEFAULT & ~mask)
- | R300_INPUT_ROUTE_ENABLE;
-
- /* i+1 */
- mask=(1<<(r300->state.aos[i+1].aos_size*3))-1;
- dw|=(
- (ALL_COMPONENTS & mask)
- | (ALL_DEFAULT & ~mask)
- | R300_INPUT_ROUTE_ENABLE
- )<<16;
-
- r300->hw.vir[1].cmd[R300_VIR_CNTL_0+(i>>1)]=dw;
- }
- if(nr & 1){
- mask=(1<<(r300->state.aos[nr-1].aos_size*3))-1;
- dw=(ALL_COMPONENTS & mask)
- | (ALL_DEFAULT & ~mask)
- | R300_INPUT_ROUTE_ENABLE;
- r300->hw.vir[1].cmd[R300_VIR_CNTL_0+(nr>>1)]=dw;
- //fprintf(stderr, "vir1 dw=%08x\n", dw);
- }
- /* Set the rest of INPUT_ROUTE_1 to 0 */
- //for(i=((count+1)>>1); i<8; i++)r300->hw.vir[1].cmd[R300_VIR_CNTL_0+i]=0x0;
- ((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count = (nr+1)>>1;
-
- /* Set up input_cntl */
- /* I don't think this is needed for vertex buffers, but it doesn't hurt anything */
- R300_STATECHANGE(r300, vic);
- r300->hw.vic.cmd[R300_VIC_CNTL_0]=0x5555; /* Hard coded value, no idea what it means */
- r300->hw.vic.cmd[R300_VIC_CNTL_1]=vic_1;
-
-#if 0
- r300->hw.vic.cmd[R300_VIC_CNTL_1]=0;
-
- if(r300->state.render_inputs & _TNL_BIT_POS)
- r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_POS;
-
- if(r300->state.render_inputs & _TNL_BIT_NORMAL)
- r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_NORMAL;
-
- if(r300->state.render_inputs & _TNL_BIT_COLOR0)
- r300->hw.vic.cmd[R300_VIC_CNTL_1]|=R300_INPUT_CNTL_COLOR;
-
- for(i=0;i < ctx->Const.MaxTextureUnits;i++)
- if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i))
- r300->hw.vic.cmd[R300_VIC_CNTL_1]|=(R300_INPUT_CNTL_TC0<<i);
-#endif
-
- /* Stage 3: VAP output */
-
- R300_STATECHANGE(r300, vof);
-
- r300->hw.vof.cmd[R300_VOF_CNTL_0]=0;
- r300->hw.vof.cmd[R300_VOF_CNTL_1]=0;
- if (hw_tcl_on){
- GLuint OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
-
- if(OutputsWritten & (1<<VERT_RESULT_HPOS))
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
- if(OutputsWritten & (1<<VERT_RESULT_COL0))
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
- /*if(OutputsWritten & (1<<VERT_RESULT_COL1))
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
- if(OutputsWritten & (1<<VERT_RESULT_BFC0))
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT;
- if(OutputsWritten & (1<<VERT_RESULT_BFC1))
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;*/
- //if(OutputsWritten & (1<<VERT_RESULT_FOGC))
-
- if(OutputsWritten & (1<<VERT_RESULT_PSIZ))
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
-
- for(i=0;i < ctx->Const.MaxTextureUnits;i++)
- if(OutputsWritten & (1<<(VERT_RESULT_TEX0+i)))
- r300->hw.vof.cmd[R300_VOF_CNTL_1] |= (4<<(3*i));
- } else {
- if(inputs & _TNL_BIT_POS)
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
- if(inputs & _TNL_BIT_COLOR0)
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
- if(inputs & _TNL_BIT_COLOR1)
- r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
-
- for(i=0;i < ctx->Const.MaxTextureUnits;i++)
- if(inputs & (_TNL_BIT_TEX0<<i))
- r300->hw.vof.cmd[R300_VOF_CNTL_1]|=(4<<(3*i));
- }
-
- rmesa->state.aos_count = nr;
-}
-
-void r300ReleaseArrays(GLcontext * ctx)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- int i;
-
- r300ReleaseDmaRegion(rmesa, &rmesa->state.elt_dma, __FUNCTION__);
- for (i=0;i<rmesa->state.aos_count;i++) {
- r300ReleaseDmaRegion(rmesa, &rmesa->state.aos[i], __FUNCTION__);
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.h
deleted file mode 100644
index f76c94a21..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_maos.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R300_MAOS_H__
-#define __R300_MAOS_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "r300_context.h"
-
-extern void r300EmitElts(GLcontext * ctx, GLuint *elts, unsigned long n_elts);
-extern void r300EmitArrays(GLcontext * ctx, GLboolean immd);
-extern void r300ReleaseArrays(GLcontext * ctx);
-
-#endif
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_program.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_program.h
deleted file mode 100644
index d1754c066..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_program.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
-Copyright (C) 2004 Nicolai Haehnle. 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#ifndef __R300_PROGRAM_H__
-#define __R300_PROGRAM_H__
-
-#include "r300_reg.h"
-
-/**
- * Vertex program helper macros
- */
-
-/* Produce out dword */
-#define VP_OUTCLASS_TMP R300_VPI_OUT_REG_CLASS_TEMPORARY
-#define VP_OUTCLASS_OUT R300_VPI_OUT_REG_CLASS_RESULT
-
-#define VP_OUTMASK_X R300_VPI_OUT_WRITE_X
-#define VP_OUTMASK_Y R300_VPI_OUT_WRITE_Y
-#define VP_OUTMASK_Z R300_VPI_OUT_WRITE_Z
-#define VP_OUTMASK_W R300_VPI_OUT_WRITE_W
-#define VP_OUTMASK_XY (VP_OUTMASK_X|VP_OUTMASK_Y)
-#define VP_OUTMASK_XZ (VP_OUTMASK_X|VP_OUTMASK_Z)
-#define VP_OUTMASK_XW (VP_OUTMASK_X|VP_OUTMASK_W)
-#define VP_OUTMASK_XYZ (VP_OUTMASK_XY|VP_OUTMASK_Z)
-#define VP_OUTMASK_XYW (VP_OUTMASK_XY|VP_OUTMASK_W)
-#define VP_OUTMASK_XZW (VP_OUTMASK_XZ|VP_OUTMASK_W)
-#define VP_OUTMASK_XYZW (VP_OUTMASK_XYZ|VP_OUTMASK_W)
-#define VP_OUTMASK_YZ (VP_OUTMASK_Y|VP_OUTMASK_Z)
-#define VP_OUTMASK_YW (VP_OUTMASK_Y|VP_OUTMASK_W)
-#define VP_OUTMASK_YZW (VP_OUTMASK_YZ|VP_OUTMASK_W)
-#define VP_OUTMASK_ZW (VP_OUTMASK_Z|VP_OUTMASK_W)
-
-#define VP_OUT(instr,outclass,outidx,outmask) \
- (R300_VPI_OUT_OP_##instr | \
- ((outidx) << R300_VPI_OUT_REG_INDEX_SHIFT) | \
- VP_OUTCLASS_##outclass | \
- VP_OUTMASK_##outmask)
-
-/* Produce in dword */
-#define VP_INCLASS_TMP R300_VPI_IN_REG_CLASS_TEMPORARY
-#define VP_INCLASS_IN R300_VPI_IN_REG_CLASS_ATTRIBUTE
-#define VP_INCLASS_CONST R300_VPI_IN_REG_CLASS_PARAMETER
-
-#define VP_IN(class,idx) \
- (((idx) << R300_VPI_IN_REG_INDEX_SHIFT) | \
- VP_INCLASS_##class | \
- (R300_VPI_IN_SELECT_X << R300_VPI_IN_X_SHIFT) | \
- (R300_VPI_IN_SELECT_Y << R300_VPI_IN_Y_SHIFT) | \
- (R300_VPI_IN_SELECT_Z << R300_VPI_IN_Z_SHIFT) | \
- (R300_VPI_IN_SELECT_W << R300_VPI_IN_W_SHIFT))
-#define VP_ZERO() \
- ((R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_X_SHIFT) | \
- (R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_Y_SHIFT) | \
- (R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_Z_SHIFT) | \
- (R300_VPI_IN_SELECT_ZERO << R300_VPI_IN_W_SHIFT))
-#define VP_ONE() \
- ((R300_VPI_IN_SELECT_ONE << R300_VPI_IN_X_SHIFT) | \
- (R300_VPI_IN_SELECT_ONE << R300_VPI_IN_Y_SHIFT) | \
- (R300_VPI_IN_SELECT_ONE << R300_VPI_IN_Z_SHIFT) | \
- (R300_VPI_IN_SELECT_ONE << R300_VPI_IN_W_SHIFT))
-
-#define VP_NEG(in,comp) ((in) ^ (R300_VPI_IN_NEG_##comp))
-#define VP_NEGALL(in,comp) VP_NEG(VP_NEG(VP_NEG(VP_NEG((in),X),Y),Z),W)
-
-/**
- * Fragment program helper macros
- */
-
-/* Produce unshifted source selectors */
-#define FP_TMP(idx) (idx)
-#define FP_CONST(idx) ((idx) | (1 << 5))
-
-/* Produce source/dest selector dword */
-#define FP_SELC_MASK_NO 0
-#define FP_SELC_MASK_X 1
-#define FP_SELC_MASK_Y 2
-#define FP_SELC_MASK_XY 3
-#define FP_SELC_MASK_Z 4
-#define FP_SELC_MASK_XZ 5
-#define FP_SELC_MASK_YZ 6
-#define FP_SELC_MASK_XYZ 7
-
-#define FP_SELC(destidx,regmask,outmask,src0,src1,src2) \
- (((destidx) << R300_FPI1_DSTC_SHIFT) | \
- (FP_SELC_MASK_##regmask << 23) | \
- (FP_SELC_MASK_##outmask << 26) | \
- ((src0) << R300_FPI1_SRC0C_SHIFT) | \
- ((src1) << R300_FPI1_SRC1C_SHIFT) | \
- ((src2) << R300_FPI1_SRC2C_SHIFT))
-
-#define FP_SELA_MASK_NO 0
-#define FP_SELA_MASK_W 1
-
-#define FP_SELA(destidx,regmask,outmask,src0,src1,src2) \
- (((destidx) << R300_FPI3_DSTA_SHIFT) | \
- (FP_SELA_MASK_##regmask << 23) | \
- (FP_SELA_MASK_##outmask << 24) | \
- ((src0) << R300_FPI3_SRC0A_SHIFT) | \
- ((src1) << R300_FPI3_SRC1A_SHIFT) | \
- ((src2) << R300_FPI3_SRC2A_SHIFT))
-
-/* Produce unshifted argument selectors */
-#define FP_ARGC(source) R300_FPI0_ARGC_##source
-#define FP_ARGA(source) R300_FPI2_ARGA_##source
-#define FP_ABS(arg) ((arg) | (1 << 6))
-#define FP_NEG(arg) ((arg) ^ (1 << 5))
-
-/* Produce instruction dword */
-#define FP_INSTRC(opcode,arg0,arg1,arg2) \
- (R300_FPI0_OUTC_##opcode | \
- ((arg0) << R300_FPI0_ARG0C_SHIFT) | \
- ((arg1) << R300_FPI0_ARG1C_SHIFT) | \
- ((arg2) << R300_FPI0_ARG2C_SHIFT))
-
-#define FP_INSTRA(opcode,arg0,arg1,arg2) \
- (R300_FPI2_OUTA_##opcode | \
- ((arg0) << R300_FPI2_ARG0A_SHIFT) | \
- ((arg1) << R300_FPI2_ARG1A_SHIFT) | \
- ((arg2) << R300_FPI2_ARG2A_SHIFT))
-
-extern void debug_vp(GLcontext *ctx, struct vertex_program *vp);
-extern void dump_program_params(GLcontext *ctx, struct vertex_program *vp);
-
-#endif /* __R300_PROGRAM_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_reg.h
deleted file mode 100644
index 3ea4f4fe8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_reg.h
+++ /dev/null
@@ -1,1387 +0,0 @@
-#ifndef _R300_REG_H
-#define _R300_REG_H
-
-#define R300_MC_INIT_MISC_LAT_TIMER 0x180
-# define R300_MC_MISC__MC_CPR_INIT_LAT_SHIFT 0
-# define R300_MC_MISC__MC_VF_INIT_LAT_SHIFT 4
-# define R300_MC_MISC__MC_DISP0R_INIT_LAT_SHIFT 8
-# define R300_MC_MISC__MC_DISP1R_INIT_LAT_SHIFT 12
-# define R300_MC_MISC__MC_FIXED_INIT_LAT_SHIFT 16
-# define R300_MC_MISC__MC_E2R_INIT_LAT_SHIFT 20
-# define R300_MC_MISC__MC_SAME_PAGE_PRIO_SHIFT 24
-# define R300_MC_MISC__MC_GLOBW_INIT_LAT_SHIFT 28
-
-
-#define R300_MC_INIT_GFX_LAT_TIMER 0x154
-# define R300_MC_MISC__MC_G3D0R_INIT_LAT_SHIFT 0
-# define R300_MC_MISC__MC_G3D1R_INIT_LAT_SHIFT 4
-# define R300_MC_MISC__MC_G3D2R_INIT_LAT_SHIFT 8
-# define R300_MC_MISC__MC_G3D3R_INIT_LAT_SHIFT 12
-# define R300_MC_MISC__MC_TX0R_INIT_LAT_SHIFT 16
-# define R300_MC_MISC__MC_TX1R_INIT_LAT_SHIFT 20
-# define R300_MC_MISC__MC_GLOBR_INIT_LAT_SHIFT 24
-# define R300_MC_MISC__MC_GLOBW_FULL_LAT_SHIFT 28
-
-/*
-This file contains registers and constants for the R300. They have been
-found mostly by examining command buffers captured using glxtest, as well
-as by extrapolating some known registers and constants from the R200.
-
-I am fairly certain that they are correct unless stated otherwise in comments.
-*/
-
-#define R300_SE_VPORT_XSCALE 0x1D98
-#define R300_SE_VPORT_XOFFSET 0x1D9C
-#define R300_SE_VPORT_YSCALE 0x1DA0
-#define R300_SE_VPORT_YOFFSET 0x1DA4
-#define R300_SE_VPORT_ZSCALE 0x1DA8
-#define R300_SE_VPORT_ZOFFSET 0x1DAC
-
-
-/* This register is written directly and also starts data section in many 3d CP_PACKET3's */
-#define R300_VAP_VF_CNTL 0x2084
-
-# define R300_VAP_VF_CNTL__PRIM_TYPE__SHIFT 0
-# define R300_VAP_VF_CNTL__PRIM_NONE (0<<0)
-# define R300_VAP_VF_CNTL__PRIM_POINTS (1<<0)
-# define R300_VAP_VF_CNTL__PRIM_LINES (2<<0)
-# define R300_VAP_VF_CNTL__PRIM_LINE_STRIP (3<<0)
-# define R300_VAP_VF_CNTL__PRIM_TRIANGLES (4<<0)
-# define R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN (5<<0)
-# define R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP (6<<0)
-# define R300_VAP_VF_CNTL__PRIM_LINE_LOOP (12<<0)
-# define R300_VAP_VF_CNTL__PRIM_QUADS (13<<0)
-# define R300_VAP_VF_CNTL__PRIM_QUAD_STRIP (14<<0)
-# define R300_VAP_VF_CNTL__PRIM_POLYGON (15<<0)
-
-# define R300_VAP_VF_CNTL__PRIM_WALK__SHIFT 4
- /* State based - direct writes to registers trigger vertex generation */
-# define R300_VAP_VF_CNTL__PRIM_WALK_STATE_BASED (0<<4)
-# define R300_VAP_VF_CNTL__PRIM_WALK_INDICES (1<<4)
-# define R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST (2<<4)
-# define R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED (3<<4)
-
- /* I don't think I saw these three used.. */
-# define R300_VAP_VF_CNTL__COLOR_ORDER__SHIFT 6
-# define R300_VAP_VF_CNTL__TCL_OUTPUT_CTL_ENA__SHIFT 9
-# define R300_VAP_VF_CNTL__PROG_STREAM_ENA__SHIFT 10
-
- /* index size - when not set the indices are assumed to be 16 bit */
-# define R300_VAP_VF_CNTL__INDEX_SIZE_32bit (1<<11)
- /* number of vertices */
-# define R300_VAP_VF_CNTL__NUM_VERTICES__SHIFT 16
-
-/* BEGIN: Wild guesses */
-#define R300_VAP_OUTPUT_VTX_FMT_0 0x2090
-# define R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT (1<<0)
-# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT (1<<1)
-# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT (1<<2) /* GUESS */
-# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT (1<<3) /* GUESS */
-# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT (1<<4) /* GUESS */
-# define R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT (1<<16) /* GUESS */
-
-#define R300_VAP_OUTPUT_VTX_FMT_1 0x2094
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT 0
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT 3
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT 6
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_3_COMP_CNT_SHIFT 9
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_4_COMP_CNT_SHIFT 12
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT 15
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18
-# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21
-/* END */
-
-#define R300_SE_VTE_CNTL 0x20b0
-# define R300_VPORT_X_SCALE_ENA 0x00000001
-# define R300_VPORT_X_OFFSET_ENA 0x00000002
-# define R300_VPORT_Y_SCALE_ENA 0x00000004
-# define R300_VPORT_Y_OFFSET_ENA 0x00000008
-# define R300_VPORT_Z_SCALE_ENA 0x00000010
-# define R300_VPORT_Z_OFFSET_ENA 0x00000020
-# define R300_VTX_XY_FMT 0x00000100
-# define R300_VTX_Z_FMT 0x00000200
-# define R300_VTX_W0_FMT 0x00000400
-# define R300_VTX_W0_NORMALIZE 0x00000800
-# define R300_VTX_ST_DENORMALIZED 0x00001000
-
-/* BEGIN: Vertex data assembly - lots of uncertainties */
-/* gap */
-/* Where do we get our vertex data?
-//
-// Vertex data either comes either from immediate mode registers or from
-// vertex arrays.
-// There appears to be no mixed mode (though we can force the pitch of
-// vertex arrays to 0, effectively reusing the same element over and over
-// again).
-//
-// Immediate mode is controlled by the INPUT_CNTL registers. I am not sure
-// if these registers influence vertex array processing.
-//
-// Vertex arrays are controlled via the 3D_LOAD_VBPNTR packet3.
-//
-// In both cases, vertex attributes are then passed through INPUT_ROUTE.
-
-// Beginning with INPUT_ROUTE_0_0 is a list of WORDs that route vertex data
-// into the vertex processor's input registers.
-// The first word routes the first input, the second word the second, etc.
-// The corresponding input is routed into the register with the given index.
-// The list is ended by a word with INPUT_ROUTE_END set.
-//
-// Always set COMPONENTS_4 in immediate mode. */
-
-#define R300_VAP_INPUT_ROUTE_0_0 0x2150
-# define R300_INPUT_ROUTE_COMPONENTS_1 (0 << 0)
-# define R300_INPUT_ROUTE_COMPONENTS_2 (1 << 0)
-# define R300_INPUT_ROUTE_COMPONENTS_3 (2 << 0)
-# define R300_INPUT_ROUTE_COMPONENTS_4 (3 << 0)
-# define R300_INPUT_ROUTE_COMPONENTS_RGBA (4 << 0) /* GUESS */
-# define R300_VAP_INPUT_ROUTE_IDX_SHIFT 8
-# define R300_VAP_INPUT_ROUTE_IDX_MASK (31 << 8) /* GUESS */
-# define R300_VAP_INPUT_ROUTE_END (1 << 13)
-# define R300_INPUT_ROUTE_IMMEDIATE_MODE (0 << 14) /* GUESS */
-# define R300_INPUT_ROUTE_FLOAT (1 << 14) /* GUESS */
-# define R300_INPUT_ROUTE_UNSIGNED_BYTE (2 << 14) /* GUESS */
-# define R300_INPUT_ROUTE_FLOAT_COLOR (3 << 14) /* GUESS */
-#define R300_VAP_INPUT_ROUTE_0_1 0x2154
-#define R300_VAP_INPUT_ROUTE_0_2 0x2158
-#define R300_VAP_INPUT_ROUTE_0_3 0x215C
-#define R300_VAP_INPUT_ROUTE_0_4 0x2160
-#define R300_VAP_INPUT_ROUTE_0_5 0x2164
-#define R300_VAP_INPUT_ROUTE_0_6 0x2168
-#define R300_VAP_INPUT_ROUTE_0_7 0x216C
-
-/* gap */
-/* Notes:
-// - always set up to produce at least two attributes:
-// if vertex program uses only position, fglrx will set normal, too
-// - INPUT_CNTL_0_COLOR and INPUT_CNTL_COLOR bits are always equal */
-#define R300_VAP_INPUT_CNTL_0 0x2180
-# define R300_INPUT_CNTL_0_COLOR 0x00000001
-#define R300_VAP_INPUT_CNTL_1 0x2184
-# define R300_INPUT_CNTL_POS 0x00000001
-# define R300_INPUT_CNTL_NORMAL 0x00000002
-# define R300_INPUT_CNTL_COLOR 0x00000004
-# define R300_INPUT_CNTL_TC0 0x00000400
-# define R300_INPUT_CNTL_TC1 0x00000800
-# define R300_INPUT_CNTL_TC2 0x00001000 /* GUESS */
-# define R300_INPUT_CNTL_TC3 0x00002000 /* GUESS */
-# define R300_INPUT_CNTL_TC4 0x00004000 /* GUESS */
-# define R300_INPUT_CNTL_TC5 0x00008000 /* GUESS */
-# define R300_INPUT_CNTL_TC6 0x00010000 /* GUESS */
-# define R300_INPUT_CNTL_TC7 0x00020000 /* GUESS */
-
-/* gap */
-/* Words parallel to INPUT_ROUTE_0; All words that are active in INPUT_ROUTE_0
-// are set to a swizzling bit pattern, other words are 0.
-//
-// In immediate mode, the pattern is always set to xyzw. In vertex array
-// mode, the swizzling pattern is e.g. used to set zw components in texture
-// coordinates with only tweo components. */
-#define R300_VAP_INPUT_ROUTE_1_0 0x21E0
-# define R300_INPUT_ROUTE_SELECT_X 0
-# define R300_INPUT_ROUTE_SELECT_Y 1
-# define R300_INPUT_ROUTE_SELECT_Z 2
-# define R300_INPUT_ROUTE_SELECT_W 3
-# define R300_INPUT_ROUTE_SELECT_ZERO 4
-# define R300_INPUT_ROUTE_SELECT_ONE 5
-# define R300_INPUT_ROUTE_SELECT_MASK 7
-# define R300_INPUT_ROUTE_X_SHIFT 0
-# define R300_INPUT_ROUTE_Y_SHIFT 3
-# define R300_INPUT_ROUTE_Z_SHIFT 6
-# define R300_INPUT_ROUTE_W_SHIFT 9
-# define R300_INPUT_ROUTE_ENABLE (15 << 12)
-#define R300_VAP_INPUT_ROUTE_1_1 0x21E4
-#define R300_VAP_INPUT_ROUTE_1_2 0x21E8
-#define R300_VAP_INPUT_ROUTE_1_3 0x21EC
-#define R300_VAP_INPUT_ROUTE_1_4 0x21F0
-#define R300_VAP_INPUT_ROUTE_1_5 0x21F4
-#define R300_VAP_INPUT_ROUTE_1_6 0x21F8
-#define R300_VAP_INPUT_ROUTE_1_7 0x21FC
-
-/* END */
-
-/* gap */
-/* BEGIN: Upload vertex program and data
-// The programmable vertex shader unit has a memory bank of unknown size
-// that can be written to in 16 byte units by writing the address into
-// UPLOAD_ADDRESS, followed by data in UPLOAD_DATA (multiples of 4 DWORDs).
-//
-// Pointers into the memory bank are always in multiples of 16 bytes.
-//
-// The memory bank is divided into areas with fixed meaning.
-//
-// Starting at address UPLOAD_PROGRAM: Vertex program instructions.
-// Native limits reported by drivers from ATI suggest size 256 (i.e. 4KB),
-// whereas the difference between known addresses suggests size 512.
-//
-// Starting at address UPLOAD_PARAMETERS: Vertex program parameters.
-// Native reported limits and the VPI layout suggest size 256, whereas
-// difference between known addresses suggests size 512.
-//
-// At address UPLOAD_POINTSIZE is a vector (0, 0, ps, 0), where ps is the
-// floating point pointsize. The exact purpose of this state is uncertain,
-// as there is also the R300_RE_POINTSIZE register.
-//
-// Multiple vertex programs and parameter sets can be loaded at once,
-// which could explain the size discrepancy. */
-#define R300_VAP_PVS_UPLOAD_ADDRESS 0x2200
-# define R300_PVS_UPLOAD_PROGRAM 0x00000000
-# define R300_PVS_UPLOAD_PARAMETERS 0x00000200
-# define R300_PVS_UPLOAD_POINTSIZE 0x00000406
-/* gap */
-#define R300_VAP_PVS_UPLOAD_DATA 0x2208
-/* END */
-
-/* gap */
-/* I do not know the purpose of this register. However, I do know that
-// it is set to 221C_CLEAR for clear operations and to 221C_NORMAL
-// for normal rendering. */
-#define R300_VAP_UNKNOWN_221C 0x221C
-# define R300_221C_NORMAL 0x00000000
-# define R300_221C_CLEAR 0x0001C000
-
-/* gap */
-/* Sometimes, END_OF_PKT and 0x2284=0 are the only commands sent between
-// rendering commands and overwriting vertex program parameters.
-// Therefore, I suspect writing zero to 0x2284 synchronizes the engine and
-// avoids bugs caused by still running shaders reading bad data from memory. */
-#define R300_VAP_PVS_WAITIDLE 0x2284 /* GUESS */
-
-/* Absolutely no clue what this register is about. */
-#define R300_VAP_UNKNOWN_2288 0x2288
-# define R300_2288_R300 0x00750000 /* -- nh */
-# define R300_2288_RV350 0x0000FFFF /* -- Vladimir */
-
-/* gap */
-/* Addresses are relative to the vertex program instruction area of the
-// memory bank. PROGRAM_END points to the last instruction of the active
-// program
-//
-// The meaning of the two UNKNOWN fields is obviously not known. However,
-// experiments so far have shown that both *must* point to an instruction
-// inside the vertex program, otherwise the GPU locks up.
-// fglrx usually sets CNTL_3_UNKNOWN to the end of the program and
-// CNTL_1_UNKNOWN points to instruction where last write to position takes place.
-// Most likely this is used to ignore rest of the program in cases where group of verts arent visible.
-// For some reason this "section" is sometimes accepted other instruction that have
-// no relationship with position calculations.
-*/
-#define R300_VAP_PVS_CNTL_1 0x22D0
-# define R300_PVS_CNTL_1_PROGRAM_START_SHIFT 0
-# define R300_PVS_CNTL_1_POS_END_SHIFT 10
-# define R300_PVS_CNTL_1_PROGRAM_END_SHIFT 20
-/* Addresses are relative the the vertex program parameters area. */
-#define R300_VAP_PVS_CNTL_2 0x22D4
-# define R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT 0
-# define R300_PVS_CNTL_2_PARAM_COUNT_SHIFT 16
-#define R300_VAP_PVS_CNTL_3 0x22D8
-# define R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT 10
-# define R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT 0
-
-/* The entire range from 0x2300 to 0x2AC inclusive seems to be used for
-// immediate vertices */
-#define R300_VAP_VTX_COLOR_R 0x2464
-#define R300_VAP_VTX_COLOR_G 0x2468
-#define R300_VAP_VTX_COLOR_B 0x246C
-#define R300_VAP_VTX_POS_0_X_1 0x2490 /* used for glVertex2*() */
-#define R300_VAP_VTX_POS_0_Y_1 0x2494
-#define R300_VAP_VTX_COLOR_PKD 0x249C /* RGBA */
-#define R300_VAP_VTX_POS_0_X_2 0x24A0 /* used for glVertex3*() */
-#define R300_VAP_VTX_POS_0_Y_2 0x24A4
-#define R300_VAP_VTX_POS_0_Z_2 0x24A8
-#define R300_VAP_VTX_END_OF_PKT 0x24AC /* write 0 to indicate end of packet? */
-
-/* gap */
-
-/* These are values from r300_reg/r300_reg.h - they are known to be correct
- and are here so we can use one register file instead of several
- - Vladimir */
-#define R300_GB_VAP_RASTER_VTX_FMT_0 0x4000
-# define R300_GB_VAP_RASTER_VTX_FMT_0__POS_PRESENT (1<<0)
-# define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_0_PRESENT (1<<1)
-# define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_1_PRESENT (1<<2)
-# define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_2_PRESENT (1<<3)
-# define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_3_PRESENT (1<<4)
-# define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_SPACE (0xf<<5)
-# define R300_GB_VAP_RASTER_VTX_FMT_0__PT_SIZE_PRESENT (0x1<<16)
-
-#define R300_GB_VAP_RASTER_VTX_FMT_1 0x4004
- /* each of the following is 3 bits wide, specifies number
- of components */
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT 0
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT 3
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT 6
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_3_COMP_CNT_SHIFT 9
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_4_COMP_CNT_SHIFT 12
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT 15
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18
-# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21
-
-/* UNK30 seems to enables point to quad transformation on textures
- (or something closely related to that).
- This bit is rather fatal at the time being due to lackings at pixel shader side */
-#define R300_GB_ENABLE 0x4008
-# define R300_GB_POINT_STUFF_ENABLE (1<<0)
-# define R300_GB_LINE_STUFF_ENABLE (1<<1)
-# define R300_GB_TRIANGLE_STUFF_ENABLE (1<<2)
-# define R300_GB_STENCIL_AUTO_ENABLE (1<<4)
-# define R300_GB_UNK30 (1<<30)
- /* each of the following is 2 bits wide */
-#define R300_GB_TEX_REPLICATE 0
-#define R300_GB_TEX_ST 1
-#define R300_GB_TEX_STR 2
-# define R300_GB_TEX0_SOURCE_SHIFT 16
-# define R300_GB_TEX1_SOURCE_SHIFT 18
-# define R300_GB_TEX2_SOURCE_SHIFT 20
-# define R300_GB_TEX3_SOURCE_SHIFT 22
-# define R300_GB_TEX4_SOURCE_SHIFT 24
-# define R300_GB_TEX5_SOURCE_SHIFT 26
-# define R300_GB_TEX6_SOURCE_SHIFT 28
-# define R300_GB_TEX7_SOURCE_SHIFT 30
-
-/* MSPOS - positions for multisample antialiasing (?) */
-#define R300_GB_MSPOS0 0x4010
- /* shifts - each of the fields is 4 bits */
-# define R300_GB_MSPOS0__MS_X0_SHIFT 0
-# define R300_GB_MSPOS0__MS_Y0_SHIFT 4
-# define R300_GB_MSPOS0__MS_X1_SHIFT 8
-# define R300_GB_MSPOS0__MS_Y1_SHIFT 12
-# define R300_GB_MSPOS0__MS_X2_SHIFT 16
-# define R300_GB_MSPOS0__MS_Y2_SHIFT 20
-# define R300_GB_MSPOS0__MSBD0_Y 24
-# define R300_GB_MSPOS0__MSBD0_X 28
-
-#define R300_GB_MSPOS1 0x4014
-# define R300_GB_MSPOS1__MS_X3_SHIFT 0
-# define R300_GB_MSPOS1__MS_Y3_SHIFT 4
-# define R300_GB_MSPOS1__MS_X4_SHIFT 8
-# define R300_GB_MSPOS1__MS_Y4_SHIFT 12
-# define R300_GB_MSPOS1__MS_X5_SHIFT 16
-# define R300_GB_MSPOS1__MS_Y5_SHIFT 20
-# define R300_GB_MSPOS1__MSBD1 24
-
-
-#define R300_GB_TILE_CONFIG 0x4018
-# define R300_GB_TILE_ENABLE (1<<0)
-# define R300_GB_TILE_PIPE_COUNT_RV300 0
-# define R300_GB_TILE_PIPE_COUNT_R300 (3<<1)
-# define R300_GB_TILE_PIPE_COUNT_R420 (7<<1)
-# define R300_GB_TILE_SIZE_8 0
-# define R300_GB_TILE_SIZE_16 (1<<4)
-# define R300_GB_TILE_SIZE_32 (2<<4)
-# define R300_GB_SUPER_SIZE_1 (0<<6)
-# define R300_GB_SUPER_SIZE_2 (1<<6)
-# define R300_GB_SUPER_SIZE_4 (2<<6)
-# define R300_GB_SUPER_SIZE_8 (3<<6)
-# define R300_GB_SUPER_SIZE_16 (4<<6)
-# define R300_GB_SUPER_SIZE_32 (5<<6)
-# define R300_GB_SUPER_SIZE_64 (6<<6)
-# define R300_GB_SUPER_SIZE_128 (7<<6)
-# define R300_GB_SUPER_X_SHIFT 9 /* 3 bits wide */
-# define R300_GB_SUPER_Y_SHIFT 12 /* 3 bits wide */
-# define R300_GB_SUPER_TILE_A 0
-# define R300_GB_SUPER_TILE_B (1<<15)
-# define R300_GB_SUBPIXEL_1_12 0
-# define R300_GB_SUBPIXEL_1_16 (1<<16)
-
-#define R300_GB_FIFO_SIZE 0x4024
- /* each of the following is 2 bits wide */
-#define R300_GB_FIFO_SIZE_32 0
-#define R300_GB_FIFO_SIZE_64 1
-#define R300_GB_FIFO_SIZE_128 2
-#define R300_GB_FIFO_SIZE_256 3
-# define R300_SC_IFIFO_SIZE_SHIFT 0
-# define R300_SC_TZFIFO_SIZE_SHIFT 2
-# define R300_SC_BFIFO_SIZE_SHIFT 4
-
-# define R300_US_OFIFO_SIZE_SHIFT 12
-# define R300_US_WFIFO_SIZE_SHIFT 14
- /* the following use the same constants as above, but meaning is
- is times 2 (i.e. instead of 32 words it means 64 */
-# define R300_RS_TFIFO_SIZE_SHIFT 6
-# define R300_RS_CFIFO_SIZE_SHIFT 8
-# define R300_US_RAM_SIZE_SHIFT 10
- /* watermarks, 3 bits wide */
-# define R300_RS_HIGHWATER_COL_SHIFT 16
-# define R300_RS_HIGHWATER_TEX_SHIFT 19
-# define R300_OFIFO_HIGHWATER_SHIFT 22 /* two bits only */
-# define R300_CUBE_FIFO_HIGHWATER_COL_SHIFT 24
-
-#define R300_GB_SELECT 0x401C
-# define R300_GB_FOG_SELECT_C0A 0
-# define R300_GB_FOG_SELECT_C1A 1
-# define R300_GB_FOG_SELECT_C2A 2
-# define R300_GB_FOG_SELECT_C3A 3
-# define R300_GB_FOG_SELECT_1_1_W 4
-# define R300_GB_FOG_SELECT_Z 5
-# define R300_GB_DEPTH_SELECT_Z 0
-# define R300_GB_DEPTH_SELECT_1_1_W (1<<3)
-# define R300_GB_W_SELECT_1_W 0
-# define R300_GB_W_SELECT_1 (1<<4)
-
-#define R300_GB_AA_CONFIG 0x4020
-# define R300_AA_ENABLE 0x01
-# define R300_AA_SUBSAMPLES_2 0
-# define R300_AA_SUBSAMPLES_3 (1<<1)
-# define R300_AA_SUBSAMPLES_4 (2<<1)
-# define R300_AA_SUBSAMPLES_6 (3<<1)
-
-/* END */
-
-/* gap */
-/* The upper enable bits are guessed, based on fglrx reported limits. */
-#define R300_TX_ENABLE 0x4104
-# define R300_TX_ENABLE_0 (1 << 0)
-# define R300_TX_ENABLE_1 (1 << 1)
-# define R300_TX_ENABLE_2 (1 << 2)
-# define R300_TX_ENABLE_3 (1 << 3)
-# define R300_TX_ENABLE_4 (1 << 4)
-# define R300_TX_ENABLE_5 (1 << 5)
-# define R300_TX_ENABLE_6 (1 << 6)
-# define R300_TX_ENABLE_7 (1 << 7)
-# define R300_TX_ENABLE_8 (1 << 8)
-# define R300_TX_ENABLE_9 (1 << 9)
-# define R300_TX_ENABLE_10 (1 << 10)
-# define R300_TX_ENABLE_11 (1 << 11)
-# define R300_TX_ENABLE_12 (1 << 12)
-# define R300_TX_ENABLE_13 (1 << 13)
-# define R300_TX_ENABLE_14 (1 << 14)
-# define R300_TX_ENABLE_15 (1 << 15)
-
-/* The pointsize is given in multiples of 6. The pointsize can be
-// enormous: Clear() renders a single point that fills the entire
-// framebuffer. */
-#define R300_RE_POINTSIZE 0x421C
-# define R300_POINTSIZE_Y_SHIFT 0
-# define R300_POINTSIZE_Y_MASK (0xFFFF << 0) /* GUESS */
-# define R300_POINTSIZE_X_SHIFT 16
-# define R300_POINTSIZE_X_MASK (0xFFFF << 16) /* GUESS */
-# define R300_POINTSIZE_MAX (R300_POINTSIZE_Y_MASK / 6)
-
-/* The line width is given in multiples of 6.
- In default mode lines are classified as vertical lines.
- HO: horizontal
- VE: vertical or horizontal
- HO & VE: no classification
-*/
-#define R300_RE_LINE_CNT 0x4234
-# define R300_LINESIZE_SHIFT 0
-# define R300_LINESIZE_MASK (0xFFFF << 0) /* GUESS */
-# define R300_LINESIZE_MAX (R300_LINESIZE_MASK / 6)
-# define R300_LINE_CNT_HO (1 << 16)
-# define R300_LINE_CNT_VE (1 << 17)
-
-/* Some sort of scale or clamp value for texcoordless textures. */
-#define R300_RE_UNK4238 0x4238
-
-#define R300_RE_SHADE_MODEL 0x4278
-# define R300_RE_SHADE_MODEL_SMOOTH 0x3aaaa
-# define R300_RE_SHADE_MODEL_FLAT 0x39595
-
-/* Dangerous */
-#define R300_RE_POLYGON_MODE 0x4288
-# define R300_PM_ENABLED (1 << 0)
-# define R300_PM_FRONT_POINT (0 << 0)
-# define R300_PM_BACK_POINT (0 << 0)
-# define R300_PM_FRONT_LINE (1 << 4)
-# define R300_PM_FRONT_FILL (1 << 5)
-# define R300_PM_BACK_LINE (1 << 7)
-# define R300_PM_BACK_FILL (1 << 8)
-
-/* Not sure why there are duplicate of factor and constant values.
- My best guess so far is that there are seperate zbiases for test and write.
- Ordering might be wrong.
- Some of the tests indicate that fgl has a fallback implementation of zbias
- via pixel shaders. */
-#define R300_RE_ZBIAS_T_FACTOR 0x42A4
-#define R300_RE_ZBIAS_T_CONSTANT 0x42A8
-#define R300_RE_ZBIAS_W_FACTOR 0x42AC
-#define R300_RE_ZBIAS_W_CONSTANT 0x42B0
-
-/* This register needs to be set to (1<<1) for RV350 to correctly
- perform depth test (see --vb-triangles in r300_demo)
- Don't know about other chips. - Vladimir
- This is set to 3 when GL_POLYGON_OFFSET_FILL is on.
- My guess is that there are two bits for each zbias primitive (FILL, LINE, POINT).
- One to enable depth test and one for depth write.
- Yet this doesnt explain why depth writes work ...
- */
-#define R300_RE_OCCLUSION_CNTL 0x42B4
-# define R300_OCCLUSION_ON (1<<1)
-
-#define R300_RE_CULL_CNTL 0x42B8
-# define R300_CULL_FRONT (1 << 0)
-# define R300_CULL_BACK (1 << 1)
-# define R300_FRONT_FACE_CCW (0 << 2)
-# define R300_FRONT_FACE_CW (1 << 2)
-
-
-/* BEGIN: Rasterization / Interpolators - many guesses
-// 0_UNKNOWN_18 has always been set except for clear operations.
-// TC_CNT is the number of incoming texture coordinate sets (i.e. it depends
-// on the vertex program, *not* the fragment program) */
-#define R300_RS_CNTL_0 0x4300
-# define R300_RS_CNTL_TC_CNT_SHIFT 2
-# define R300_RS_CNTL_TC_CNT_MASK (7 << 2)
-# define R300_RS_CNTL_CI_CNT_SHIFT 7 /* number of color interpolators used */
-# define R300_RS_CNTL_0_UNKNOWN_18 (1 << 18)
-/* Guess: RS_CNTL_1 holds the index of the highest used RS_ROUTE_n register. */
-#define R300_RS_CNTL_1 0x4304
-
-/* gap */
-/* Only used for texture coordinates.
-// Use the source field to route texture coordinate input from the vertex program
-// to the desired interpolator. Note that the source field is relative to the
-// outputs the vertex program *actually* writes. If a vertex program only writes
-// texcoord[1], this will be source index 0.
-// Set INTERP_USED on all interpolators that produce data used by the
-// fragment program. INTERP_USED looks like a swizzling mask, but
-// I haven't seen it used that way.
-//
-// Note: The _UNKNOWN constants are always set in their respective register.
-// I don't know if this is necessary. */
-#define R300_RS_INTERP_0 0x4310
-#define R300_RS_INTERP_1 0x4314
-# define R300_RS_INTERP_1_UNKNOWN 0x40
-#define R300_RS_INTERP_2 0x4318
-# define R300_RS_INTERP_2_UNKNOWN 0x80
-#define R300_RS_INTERP_3 0x431C
-# define R300_RS_INTERP_3_UNKNOWN 0xC0
-#define R300_RS_INTERP_4 0x4320
-#define R300_RS_INTERP_5 0x4324
-#define R300_RS_INTERP_6 0x4328
-#define R300_RS_INTERP_7 0x432C
-# define R300_RS_INTERP_SRC_SHIFT 2
-# define R300_RS_INTERP_SRC_MASK (7 << 2)
-# define R300_RS_INTERP_USED 0x00D10000
-
-/* These DWORDs control how vertex data is routed into fragment program
-// registers, after interpolators. */
-#define R300_RS_ROUTE_0 0x4330
-#define R300_RS_ROUTE_1 0x4334
-#define R300_RS_ROUTE_2 0x4338
-#define R300_RS_ROUTE_3 0x433C /* GUESS */
-#define R300_RS_ROUTE_4 0x4340 /* GUESS */
-#define R300_RS_ROUTE_5 0x4344 /* GUESS */
-#define R300_RS_ROUTE_6 0x4348 /* GUESS */
-#define R300_RS_ROUTE_7 0x434C /* GUESS */
-# define R300_RS_ROUTE_SOURCE_INTERP_0 0
-# define R300_RS_ROUTE_SOURCE_INTERP_1 1
-# define R300_RS_ROUTE_SOURCE_INTERP_2 2
-# define R300_RS_ROUTE_SOURCE_INTERP_3 3
-# define R300_RS_ROUTE_SOURCE_INTERP_4 4
-# define R300_RS_ROUTE_SOURCE_INTERP_5 5 /* GUESS */
-# define R300_RS_ROUTE_SOURCE_INTERP_6 6 /* GUESS */
-# define R300_RS_ROUTE_SOURCE_INTERP_7 7 /* GUESS */
-# define R300_RS_ROUTE_ENABLE (1 << 3) /* GUESS */
-# define R300_RS_ROUTE_DEST_SHIFT 6
-# define R300_RS_ROUTE_DEST_MASK (31 << 6) /* GUESS */
-
-/* Special handling for color: When the fragment program uses color,
-// the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the
-// color register index. */
-# define R300_RS_ROUTE_0_COLOR (1 << 14)
-# define R300_RS_ROUTE_0_COLOR_DEST_SHIFT 17
-# define R300_RS_ROUTE_0_COLOR_DEST_MASK (31 << 17) /* GUESS */
-/* As above, but for secondary color */
-# define R300_RS_ROUTE_1_COLOR1 (1 << 14)
-# define R300_RS_ROUTE_1_COLOR1_DEST_SHIFT 17
-# define R300_RS_ROUTE_1_COLOR1_DEST_MASK (31 << 17)
-# define R300_RS_ROUTE_1_UNKNOWN11 (1 << 11)
-/* END */
-
-/* BEGIN: Scissors and cliprects
-// There are four clipping rectangles. Their corner coordinates are inclusive.
-// Every pixel is assigned a number from 0 and 15 by setting bits 0-3 depending
-// on whether the pixel is inside cliprects 0-3, respectively. For example,
-// if a pixel is inside cliprects 0 and 1, but outside 2 and 3, it is assigned
-// the number 3 (binary 0011).
-// Iff the bit corresponding to the pixel's number in RE_CLIPRECT_CNTL is set,
-// the pixel is rasterized.
-//
-// In addition to this, there is a scissors rectangle. Only pixels inside the
-// scissors rectangle are drawn. (coordinates are inclusive)
-//
-// For some reason, the top-left corner of the framebuffer is at (1440, 1440)
-// for the purpose of clipping and scissors. */
-#define R300_RE_CLIPRECT_TL_0 0x43B0
-#define R300_RE_CLIPRECT_BR_0 0x43B4
-#define R300_RE_CLIPRECT_TL_1 0x43B8
-#define R300_RE_CLIPRECT_BR_1 0x43BC
-#define R300_RE_CLIPRECT_TL_2 0x43C0
-#define R300_RE_CLIPRECT_BR_2 0x43C4
-#define R300_RE_CLIPRECT_TL_3 0x43C8
-#define R300_RE_CLIPRECT_BR_3 0x43CC
-# define R300_CLIPRECT_OFFSET 1440
-# define R300_CLIPRECT_MASK 0x1FFF
-# define R300_CLIPRECT_X_SHIFT 0
-# define R300_CLIPRECT_X_MASK (0x1FFF << 0)
-# define R300_CLIPRECT_Y_SHIFT 13
-# define R300_CLIPRECT_Y_MASK (0x1FFF << 13)
-#define R300_RE_CLIPRECT_CNTL 0x43D0
-# define R300_CLIP_OUT (1 << 0)
-# define R300_CLIP_0 (1 << 1)
-# define R300_CLIP_1 (1 << 2)
-# define R300_CLIP_10 (1 << 3)
-# define R300_CLIP_2 (1 << 4)
-# define R300_CLIP_20 (1 << 5)
-# define R300_CLIP_21 (1 << 6)
-# define R300_CLIP_210 (1 << 7)
-# define R300_CLIP_3 (1 << 8)
-# define R300_CLIP_30 (1 << 9)
-# define R300_CLIP_31 (1 << 10)
-# define R300_CLIP_310 (1 << 11)
-# define R300_CLIP_32 (1 << 12)
-# define R300_CLIP_320 (1 << 13)
-# define R300_CLIP_321 (1 << 14)
-# define R300_CLIP_3210 (1 << 15)
-
-/* gap */
-#define R300_RE_SCISSORS_TL 0x43E0
-#define R300_RE_SCISSORS_BR 0x43E4
-# define R300_SCISSORS_OFFSET 1440
-# define R300_SCISSORS_X_SHIFT 0
-# define R300_SCISSORS_X_MASK (0x1FFF << 0)
-# define R300_SCISSORS_Y_SHIFT 13
-# define R300_SCISSORS_Y_MASK (0x1FFF << 13)
-/* END */
-
-/* BEGIN: Texture specification
-// The texture specification dwords are grouped by meaning and not by texture unit.
-// This means that e.g. the offset for texture image unit N is found in register
-// TX_OFFSET_0 + (4*N) */
-#define R300_TX_FILTER_0 0x4400
-# define R300_TX_REPEAT 0
-# define R300_TX_MIRRORED 1
-# define R300_TX_CLAMP 4
-# define R300_TX_CLAMP_TO_EDGE 2
-# define R300_TX_CLAMP_TO_BORDER 6
-# define R300_TX_WRAP_S_SHIFT 0
-# define R300_TX_WRAP_S_MASK (7 << 0)
-# define R300_TX_WRAP_T_SHIFT 3
-# define R300_TX_WRAP_T_MASK (7 << 3)
-# define R300_TX_WRAP_Q_SHIFT 6
-# define R300_TX_WRAP_Q_MASK (7 << 6)
-# define R300_TX_MAG_FILTER_NEAREST (1 << 9)
-# define R300_TX_MAG_FILTER_LINEAR (2 << 9)
-# define R300_TX_MAG_FILTER_MASK (3 << 9)
-# define R300_TX_MIN_FILTER_NEAREST (1 << 11)
-# define R300_TX_MIN_FILTER_LINEAR (2 << 11)
-# define R300_TX_MIN_FILTER_NEAREST_MIP_NEAREST (5 << 11)
-# define R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR (9 << 11)
-# define R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 11)
-# define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR (10 << 11)
-
-/* NOTE: NEAREST doesnt seem to exist.
- Im not seting MAG_FILTER_MASK and (3 << 11) on for all
- anisotropy modes because that would void selected mag filter */
-# define R300_TX_MIN_FILTER_ANISO_NEAREST ((0 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
-# define R300_TX_MIN_FILTER_ANISO_LINEAR ((0 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
-# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST ((1 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
-# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR ((2 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/)
-# define R300_TX_MIN_FILTER_MASK ( (15 << 11) | (3 << 13) )
-# define R300_TX_MAX_ANISO_1_TO_1 (0 << 21)
-# define R300_TX_MAX_ANISO_2_TO_1 (2 << 21)
-# define R300_TX_MAX_ANISO_4_TO_1 (4 << 21)
-# define R300_TX_MAX_ANISO_8_TO_1 (6 << 21)
-# define R300_TX_MAX_ANISO_16_TO_1 (8 << 21)
-# define R300_TX_MAX_ANISO_MASK (14 << 21)
-
-#define R300_TX_UNK1_0 0x4440
-# define R300_LOD_BIAS_MASK 0x1fff
-
-#define R300_TX_SIZE_0 0x4480
-# define R300_TX_WIDTHMASK_SHIFT 0
-# define R300_TX_WIDTHMASK_MASK (2047 << 0)
-# define R300_TX_HEIGHTMASK_SHIFT 11
-# define R300_TX_HEIGHTMASK_MASK (2047 << 11)
-# define R300_TX_UNK23 (1 << 23)
-# define R300_TX_SIZE_SHIFT 26 /* largest of width, height */
-# define R300_TX_SIZE_MASK (15 << 26)
-#define R300_TX_FORMAT_0 0x44C0
- /* The interpretation of the format word by Wladimir van der Laan */
- /* The X, Y, Z and W refer to the layout of the components.
- They are given meanings as R, G, B and Alpha by the swizzle
- specification */
-# define R300_TX_FORMAT_X8 0x0
-# define R300_TX_FORMAT_X16 0x1
-# define R300_TX_FORMAT_Y4X4 0x2
-# define R300_TX_FORMAT_Y8X8 0x3
-# define R300_TX_FORMAT_Y16X16 0x4
-# define R300_TX_FORMAT_Z3Y3X2 0x5
-# define R300_TX_FORMAT_Z5Y6X5 0x6
-# define R300_TX_FORMAT_Z6Y5X5 0x7
-# define R300_TX_FORMAT_Z11Y11X10 0x8
-# define R300_TX_FORMAT_Z10Y11X11 0x9
-# define R300_TX_FORMAT_W4Z4Y4X4 0xA
-# define R300_TX_FORMAT_W1Z5Y5X5 0xB
-# define R300_TX_FORMAT_W8Z8Y8X8 0xC
-# define R300_TX_FORMAT_W2Z10Y10X10 0xD
-# define R300_TX_FORMAT_W16Z16Y16X16 0xE
-# define R300_TX_FORMAT_DXT1 0xF
-# define R300_TX_FORMAT_DXT3 0x10
-# define R300_TX_FORMAT_DXT5 0x11
-# define R300_TX_FORMAT_D3DMFT_CxV8U8 0x12 /* no swizzle */
-# define R300_TX_FORMAT_A8R8G8B8 0x13 /* no swizzle */
-# define R300_TX_FORMAT_B8G8_B8G8 0x14 /* no swizzle */
-# define R300_TX_FORMAT_G8R8_G8B8 0x15 /* no swizzle */
- /* 0x16 - some 16 bit green format.. ?? */
-# define R300_TX_FORMAT_UNK25 (1 << 25) /* no swizzle */
-
- /* gap */
- /* Floating point formats */
- /* Note - hardware supports both 16 and 32 bit floating point */
-# define R300_TX_FORMAT_FL_I16 0x18
-# define R300_TX_FORMAT_FL_I16A16 0x19
-# define R300_TX_FORMAT_FL_R16G16B16A16 0x1A
-# define R300_TX_FORMAT_FL_I32 0x1B
-# define R300_TX_FORMAT_FL_I32A32 0x1C
-# define R300_TX_FORMAT_FL_R32G32B32A32 0x1D
- /* alpha modes, convenience mostly */
- /* if you have alpha, pick constant appropriate to the
- number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */
-# define R300_TX_FORMAT_ALPHA_1CH 0x000
-# define R300_TX_FORMAT_ALPHA_2CH 0x200
-# define R300_TX_FORMAT_ALPHA_4CH 0x600
-# define R300_TX_FORMAT_ALPHA_NONE 0xA00
- /* Swizzling */
- /* constants */
-# define R300_TX_FORMAT_X 0
-# define R300_TX_FORMAT_Y 1
-# define R300_TX_FORMAT_Z 2
-# define R300_TX_FORMAT_W 3
-# define R300_TX_FORMAT_ZERO 4
-# define R300_TX_FORMAT_ONE 5
-# define R300_TX_FORMAT_CUT_Z 6 /* 2.0*Z, everything above 1.0 is set to 0.0 */
-# define R300_TX_FORMAT_CUT_W 7 /* 2.0*W, everything above 1.0 is set to 0.0 */
-
-# define R300_TX_FORMAT_B_SHIFT 18
-# define R300_TX_FORMAT_G_SHIFT 15
-# define R300_TX_FORMAT_R_SHIFT 12
-# define R300_TX_FORMAT_A_SHIFT 9
- /* Convenience macro to take care of layout and swizzling */
-# define R300_EASY_TX_FORMAT(B, G, R, A, FMT) (\
- ((R300_TX_FORMAT_##B)<<R300_TX_FORMAT_B_SHIFT) \
- | ((R300_TX_FORMAT_##G)<<R300_TX_FORMAT_G_SHIFT) \
- | ((R300_TX_FORMAT_##R)<<R300_TX_FORMAT_R_SHIFT) \
- | ((R300_TX_FORMAT_##A)<<R300_TX_FORMAT_A_SHIFT) \
- | (R300_TX_FORMAT_##FMT) \
- )
- /* These can be ORed with result of R300_EASY_TX_FORMAT() */
- /* We don't really know what they do. Take values from a constant color ? */
-# define R300_TX_FORMAT_CONST_X (1<<5)
-# define R300_TX_FORMAT_CONST_Y (2<<5)
-# define R300_TX_FORMAT_CONST_Z (4<<5)
-# define R300_TX_FORMAT_CONST_W (8<<5)
-
-# define R300_TX_FORMAT_YUV_MODE 0x00800000
-
-#define R300_TX_OFFSET_0 0x4540
-/* BEGIN: Guess from R200 */
-# define R300_TXO_ENDIAN_NO_SWAP (0 << 0)
-# define R300_TXO_ENDIAN_BYTE_SWAP (1 << 0)
-# define R300_TXO_ENDIAN_WORD_SWAP (2 << 0)
-# define R300_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
-# define R300_TXO_OFFSET_MASK 0xffffffe0
-# define R300_TXO_OFFSET_SHIFT 5
-/* END */
-#define R300_TX_UNK4_0 0x4580
-#define R300_TX_BORDER_COLOR_0 0x45C0 //ff00ff00 == { 0, 1.0, 0, 1.0 }
-
-/* END */
-
-/* BEGIN: Fragment program instruction set
-// Fragment programs are written directly into register space.
-// There are separate instruction streams for texture instructions and ALU
-// instructions.
-// In order to synchronize these streams, the program is divided into up
-// to 4 nodes. Each node begins with a number of TEX operations, followed
-// by a number of ALU operations.
-// The first node can have zero TEX ops, all subsequent nodes must have at least
-// one TEX ops.
-// All nodes must have at least one ALU op.
-//
-// The index of the last node is stored in PFS_CNTL_0: A value of 0 means
-// 1 node, a value of 3 means 4 nodes.
-// The total amount of instructions is defined in PFS_CNTL_2. The offsets are
-// offsets into the respective instruction streams, while *_END points to the
-// last instruction relative to this offset. */
-#define R300_PFS_CNTL_0 0x4600
-# define R300_PFS_CNTL_LAST_NODES_SHIFT 0
-# define R300_PFS_CNTL_LAST_NODES_MASK (3 << 0)
-# define R300_PFS_CNTL_FIRST_NODE_HAS_TEX (1 << 3)
-#define R300_PFS_CNTL_1 0x4604
-/* There is an unshifted value here which has so far always been equal to the
-// index of the highest used temporary register. */
-#define R300_PFS_CNTL_2 0x4608
-# define R300_PFS_CNTL_ALU_OFFSET_SHIFT 0
-# define R300_PFS_CNTL_ALU_OFFSET_MASK (63 << 0)
-# define R300_PFS_CNTL_ALU_END_SHIFT 6
-# define R300_PFS_CNTL_ALU_END_MASK (63 << 0)
-# define R300_PFS_CNTL_TEX_OFFSET_SHIFT 12
-# define R300_PFS_CNTL_TEX_OFFSET_MASK (31 << 12) /* GUESS */
-# define R300_PFS_CNTL_TEX_END_SHIFT 18
-# define R300_PFS_CNTL_TEX_END_MASK (31 << 18) /* GUESS */
-
-/* gap */
-/* Nodes are stored backwards. The last active node is always stored in
-// PFS_NODE_3.
-// Example: In a 2-node program, NODE_0 and NODE_1 are set to 0. The
-// first node is stored in NODE_2, the second node is stored in NODE_3.
-//
-// Offsets are relative to the master offset from PFS_CNTL_2.
-// LAST_NODE is set for the last node, and only for the last node. */
-#define R300_PFS_NODE_0 0x4610
-#define R300_PFS_NODE_1 0x4614
-#define R300_PFS_NODE_2 0x4618
-#define R300_PFS_NODE_3 0x461C
-# define R300_PFS_NODE_ALU_OFFSET_SHIFT 0
-# define R300_PFS_NODE_ALU_OFFSET_MASK (63 << 0)
-# define R300_PFS_NODE_ALU_END_SHIFT 6
-# define R300_PFS_NODE_ALU_END_MASK (63 << 6)
-# define R300_PFS_NODE_TEX_OFFSET_SHIFT 12
-# define R300_PFS_NODE_TEX_OFFSET_MASK (31 << 12)
-# define R300_PFS_NODE_TEX_END_SHIFT 17
-# define R300_PFS_NODE_TEX_END_MASK (31 << 17)
-# define R300_PFS_NODE_LAST_NODE (1 << 22)
-
-/* TEX
-// As far as I can tell, texture instructions cannot write into output
-// registers directly. A subsequent ALU instruction is always necessary,
-// even if it's just MAD o0, r0, 1, 0 */
-#define R300_PFS_TEXI_0 0x4620
-# define R300_FPITX_SRC_SHIFT 0
-# define R300_FPITX_SRC_MASK (31 << 0)
-# define R300_FPITX_SRC_CONST (1 << 5) /* GUESS */
-# define R300_FPITX_DST_SHIFT 6
-# define R300_FPITX_DST_MASK (31 << 6)
-# define R300_FPITX_IMAGE_SHIFT 11
-# define R300_FPITX_IMAGE_MASK (15 << 11) /* GUESS based on layout and native limits */
-/* Unsure if these are opcodes, or some kind of bitfield, but this is how
- * they were set when I checked
- */
-# define R300_FPITX_OPCODE_SHIFT 15
-# define R300_FPITX_OP_TEX 1
-# define R300_FPITX_OP_TXP 3
-# define R300_FPITX_OP_TXB 4
-
-/* ALU
-// The ALU instructions register blocks are enumerated according to the order
-// in which fglrx. I assume there is space for 64 instructions, since
-// each block has space for a maximum of 64 DWORDs, and this matches reported
-// native limits.
-//
-// The basic functional block seems to be one MAD for each color and alpha,
-// and an adder that adds all components after the MUL.
-// - ADD, MUL, MAD etc.: use MAD with appropriate neutral operands
-// - DP4: Use OUTC_DP4, OUTA_DP4
-// - DP3: Use OUTC_DP3, OUTA_DP4, appropriate alpha operands
-// - DPH: Use OUTC_DP4, OUTA_DP4, appropriate alpha operands
-// - CMP: If ARG2 < 0, return ARG1, else return ARG0
-// - FLR: use FRC+MAD
-// - XPD: use MAD+MAD
-// - SGE, SLT: use MAD+CMP
-// - RSQ: use ABS modifier for argument
-// - Use OUTC_REPL_ALPHA to write results of an alpha-only operation (e.g. RCP)
-// into color register
-// - apparently, there's no quick DST operation
-// - fglrx set FPI2_UNKNOWN_31 on a "MAD fragment.color, tmp0, tmp1, tmp2"
-// - fglrx set FPI2_UNKNOWN_31 on a "MAX r2, r1, c0"
-// - fglrx once set FPI0_UNKNOWN_31 on a "FRC r1, r1"
-//
-// Operand selection
-// First stage selects three sources from the available registers and
-// constant parameters. This is defined in INSTR1 (color) and INSTR3 (alpha).
-// fglrx sorts the three source fields: Registers before constants,
-// lower indices before higher indices; I do not know whether this is necessary.
-// fglrx fills unused sources with "read constant 0"
-// According to specs, you cannot select more than two different constants.
-//
-// Second stage selects the operands from the sources. This is defined in
-// INSTR0 (color) and INSTR2 (alpha). You can also select the special constants
-// zero and one.
-// Swizzling and negation happens in this stage, as well.
-//
-// Important: Color and alpha seem to be mostly separate, i.e. their sources
-// selection appears to be fully independent (the register storage is probably
-// physically split into a color and an alpha section).
-// However (because of the apparent physical split), there is some interaction
-// WRT swizzling. If, for example, you want to load an R component into an
-// Alpha operand, this R component is taken from a *color* source, not from
-// an alpha source. The corresponding register doesn't even have to appear in
-// the alpha sources list. (I hope this alll makes sense to you)
-//
-// Destination selection
-// The destination register index is in FPI1 (color) and FPI3 (alpha) together
-// with enable bits.
-// There are separate enable bits for writing into temporary registers
-// (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_* /DSTA_OUTPUT).
-// You can write to both at once, or not write at all (the same index
-// must be used for both).
-//
-// Note: There is a special form for LRP
-// - Argument order is the same as in ARB_fragment_program.
-// - Operation is MAD
-// - ARG1 is set to ARGC_SRC1C_LRP/ARGC_SRC1A_LRP
-// - Set FPI0/FPI2_SPECIAL_LRP
-// Arbitrary LRP (including support for swizzling) requires vanilla MAD+MAD */
-#define R300_PFS_INSTR1_0 0x46C0
-# define R300_FPI1_SRC0C_SHIFT 0
-# define R300_FPI1_SRC0C_MASK (31 << 0)
-# define R300_FPI1_SRC0C_CONST (1 << 5)
-# define R300_FPI1_SRC1C_SHIFT 6
-# define R300_FPI1_SRC1C_MASK (31 << 6)
-# define R300_FPI1_SRC1C_CONST (1 << 11)
-# define R300_FPI1_SRC2C_SHIFT 12
-# define R300_FPI1_SRC2C_MASK (31 << 12)
-# define R300_FPI1_SRC2C_CONST (1 << 17)
-# define R300_FPI1_DSTC_SHIFT 18
-# define R300_FPI1_DSTC_MASK (31 << 18)
-# define R300_FPI1_DSTC_REG_X (1 << 23)
-# define R300_FPI1_DSTC_REG_Y (1 << 24)
-# define R300_FPI1_DSTC_REG_Z (1 << 25)
-# define R300_FPI1_DSTC_OUTPUT_X (1 << 26)
-# define R300_FPI1_DSTC_OUTPUT_Y (1 << 27)
-# define R300_FPI1_DSTC_OUTPUT_Z (1 << 28)
-
-#define R300_PFS_INSTR3_0 0x47C0
-# define R300_FPI3_SRC0A_SHIFT 0
-# define R300_FPI3_SRC0A_MASK (31 << 0)
-# define R300_FPI3_SRC0A_CONST (1 << 5)
-# define R300_FPI3_SRC1A_SHIFT 6
-# define R300_FPI3_SRC1A_MASK (31 << 6)
-# define R300_FPI3_SRC1A_CONST (1 << 11)
-# define R300_FPI3_SRC2A_SHIFT 12
-# define R300_FPI3_SRC2A_MASK (31 << 12)
-# define R300_FPI3_SRC2A_CONST (1 << 17)
-# define R300_FPI3_DSTA_SHIFT 18
-# define R300_FPI3_DSTA_MASK (31 << 18)
-# define R300_FPI3_DSTA_REG (1 << 23)
-# define R300_FPI3_DSTA_OUTPUT (1 << 24)
-
-#define R300_PFS_INSTR0_0 0x48C0
-# define R300_FPI0_ARGC_SRC0C_XYZ 0
-# define R300_FPI0_ARGC_SRC0C_XXX 1
-# define R300_FPI0_ARGC_SRC0C_YYY 2
-# define R300_FPI0_ARGC_SRC0C_ZZZ 3
-# define R300_FPI0_ARGC_SRC1C_XYZ 4
-# define R300_FPI0_ARGC_SRC1C_XXX 5
-# define R300_FPI0_ARGC_SRC1C_YYY 6
-# define R300_FPI0_ARGC_SRC1C_ZZZ 7
-# define R300_FPI0_ARGC_SRC2C_XYZ 8
-# define R300_FPI0_ARGC_SRC2C_XXX 9
-# define R300_FPI0_ARGC_SRC2C_YYY 10
-# define R300_FPI0_ARGC_SRC2C_ZZZ 11
-# define R300_FPI0_ARGC_SRC0A 12
-# define R300_FPI0_ARGC_SRC1A 13
-# define R300_FPI0_ARGC_SRC2A 14
-# define R300_FPI0_ARGC_SRC1C_LRP 15
-# define R300_FPI0_ARGC_ZERO 20
-# define R300_FPI0_ARGC_ONE 21
-# define R300_FPI0_ARGC_HALF 22 /* GUESS */
-# define R300_FPI0_ARGC_SRC0C_YZX 23
-# define R300_FPI0_ARGC_SRC1C_YZX 24
-# define R300_FPI0_ARGC_SRC2C_YZX 25
-# define R300_FPI0_ARGC_SRC0C_ZXY 26
-# define R300_FPI0_ARGC_SRC1C_ZXY 27
-# define R300_FPI0_ARGC_SRC2C_ZXY 28
-# define R300_FPI0_ARGC_SRC0CA_WZY 29
-# define R300_FPI0_ARGC_SRC1CA_WZY 30
-# define R300_FPI0_ARGC_SRC2CA_WZY 31
-
-# define R300_FPI0_ARG0C_SHIFT 0
-# define R300_FPI0_ARG0C_MASK (31 << 0)
-# define R300_FPI0_ARG0C_NEG (1 << 5)
-# define R300_FPI0_ARG0C_ABS (1 << 6)
-# define R300_FPI0_ARG1C_SHIFT 7
-# define R300_FPI0_ARG1C_MASK (31 << 7)
-# define R300_FPI0_ARG1C_NEG (1 << 12)
-# define R300_FPI0_ARG1C_ABS (1 << 13)
-# define R300_FPI0_ARG2C_SHIFT 14
-# define R300_FPI0_ARG2C_MASK (31 << 14)
-# define R300_FPI0_ARG2C_NEG (1 << 19)
-# define R300_FPI0_ARG2C_ABS (1 << 20)
-# define R300_FPI0_SPECIAL_LRP (1 << 21)
-# define R300_FPI0_OUTC_MAD (0 << 23)
-# define R300_FPI0_OUTC_DP3 (1 << 23)
-# define R300_FPI0_OUTC_DP4 (2 << 23)
-# define R300_FPI0_OUTC_MIN (4 << 23)
-# define R300_FPI0_OUTC_MAX (5 << 23)
-# define R300_FPI0_OUTC_CMP (8 << 23)
-# define R300_FPI0_OUTC_FRC (9 << 23)
-# define R300_FPI0_OUTC_REPL_ALPHA (10 << 23)
-# define R300_FPI0_OUTC_SAT (1 << 30)
-# define R300_FPI0_UNKNOWN_31 (1 << 31)
-
-#define R300_PFS_INSTR2_0 0x49C0
-# define R300_FPI2_ARGA_SRC0C_X 0
-# define R300_FPI2_ARGA_SRC0C_Y 1
-# define R300_FPI2_ARGA_SRC0C_Z 2
-# define R300_FPI2_ARGA_SRC1C_X 3
-# define R300_FPI2_ARGA_SRC1C_Y 4
-# define R300_FPI2_ARGA_SRC1C_Z 5
-# define R300_FPI2_ARGA_SRC2C_X 6
-# define R300_FPI2_ARGA_SRC2C_Y 7
-# define R300_FPI2_ARGA_SRC2C_Z 8
-# define R300_FPI2_ARGA_SRC0A 9
-# define R300_FPI2_ARGA_SRC1A 10
-# define R300_FPI2_ARGA_SRC2A 11
-# define R300_FPI2_ARGA_SRC1A_LRP 15
-# define R300_FPI2_ARGA_ZERO 16
-# define R300_FPI2_ARGA_ONE 17
-# define R300_FPI2_ARGA_HALF 18 /* GUESS */
-
-# define R300_FPI2_ARG0A_SHIFT 0
-# define R300_FPI2_ARG0A_MASK (31 << 0)
-# define R300_FPI2_ARG0A_NEG (1 << 5)
-# define R300_FPI2_ARG0A_ABS (1 << 6) /* GUESS */
-# define R300_FPI2_ARG1A_SHIFT 7
-# define R300_FPI2_ARG1A_MASK (31 << 7)
-# define R300_FPI2_ARG1A_NEG (1 << 12)
-# define R300_FPI2_ARG1A_ABS (1 << 13) /* GUESS */
-# define R300_FPI2_ARG2A_SHIFT 14
-# define R300_FPI2_ARG2A_MASK (31 << 14)
-# define R300_FPI2_ARG2A_NEG (1 << 19)
-# define R300_FPI2_ARG2A_ABS (1 << 20) /* GUESS */
-# define R300_FPI2_SPECIAL_LRP (1 << 21)
-# define R300_FPI2_OUTA_MAD (0 << 23)
-# define R300_FPI2_OUTA_DP4 (1 << 23)
-# define R300_FPI2_OUTA_MIN (2 << 23)
-# define R300_FPI2_OUTA_MAX (3 << 23)
-# define R300_FPI2_OUTA_CMP (6 << 23)
-# define R300_FPI2_OUTA_FRC (7 << 23)
-# define R300_FPI2_OUTA_EX2 (8 << 23)
-# define R300_FPI2_OUTA_LG2 (9 << 23)
-# define R300_FPI2_OUTA_RCP (10 << 23)
-# define R300_FPI2_OUTA_RSQ (11 << 23)
-# define R300_FPI2_OUTA_SAT (1 << 30)
-# define R300_FPI2_UNKNOWN_31 (1 << 31)
-/* END */
-
-/* gap */
-#define R300_PP_ALPHA_TEST 0x4BD4
-# define R300_REF_ALPHA_MASK 0x000000ff
-# define R300_ALPHA_TEST_FAIL (0 << 8)
-# define R300_ALPHA_TEST_LESS (1 << 8)
-# define R300_ALPHA_TEST_LEQUAL (3 << 8)
-# define R300_ALPHA_TEST_EQUAL (2 << 8)
-# define R300_ALPHA_TEST_GEQUAL (6 << 8)
-# define R300_ALPHA_TEST_GREATER (4 << 8)
-# define R300_ALPHA_TEST_NEQUAL (5 << 8)
-# define R300_ALPHA_TEST_PASS (7 << 8)
-# define R300_ALPHA_TEST_OP_MASK (7 << 8)
-# define R300_ALPHA_TEST_ENABLE (1 << 11)
-
-/* gap */
-/* Fragment program parameters in 7.16 floating point */
-#define R300_PFS_PARAM_0_X 0x4C00
-#define R300_PFS_PARAM_0_Y 0x4C04
-#define R300_PFS_PARAM_0_Z 0x4C08
-#define R300_PFS_PARAM_0_W 0x4C0C
-/* GUESS: PARAM_31 is last, based on native limits reported by fglrx */
-#define R300_PFS_PARAM_31_X 0x4DF0
-#define R300_PFS_PARAM_31_Y 0x4DF4
-#define R300_PFS_PARAM_31_Z 0x4DF8
-#define R300_PFS_PARAM_31_W 0x4DFC
-
-/* Notes:
-// - AFAIK fglrx always sets BLEND_UNKNOWN when blending is used in the application
-// - AFAIK fglrx always sets BLEND_NO_SEPARATE when CBLEND and ABLEND are set to the same
-// function (both registers are always set up completely in any case)
-// - Most blend flags are simply copied from R200 and not tested yet */
-#define R300_RB3D_CBLEND 0x4E04
-#define R300_RB3D_ABLEND 0x4E08
- /* the following only appear in CBLEND */
-# define R300_BLEND_ENABLE (1 << 0)
-# define R300_BLEND_UNKNOWN (3 << 1)
-# define R300_BLEND_NO_SEPARATE (1 << 3)
- /* the following are shared between CBLEND and ABLEND */
-# define R300_FCN_MASK (3 << 12)
-# define R300_COMB_FCN_ADD_CLAMP (0 << 12)
-# define R300_COMB_FCN_ADD_NOCLAMP (1 << 12)
-# define R300_COMB_FCN_SUB_CLAMP (2 << 12)
-# define R300_COMB_FCN_SUB_NOCLAMP (3 << 12)
-# define R300_SRC_BLEND_GL_ZERO (32 << 16)
-# define R300_SRC_BLEND_GL_ONE (33 << 16)
-# define R300_SRC_BLEND_GL_SRC_COLOR (34 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16)
-# define R300_SRC_BLEND_GL_DST_COLOR (36 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16)
-# define R300_SRC_BLEND_GL_SRC_ALPHA (38 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16)
-# define R300_SRC_BLEND_GL_DST_ALPHA (40 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16)
-# define R300_SRC_BLEND_GL_SRC_ALPHA_SATURATE (42 << 16)
-# define R300_SRC_BLEND_MASK (63 << 16)
-# define R300_DST_BLEND_GL_ZERO (32 << 24)
-# define R300_DST_BLEND_GL_ONE (33 << 24)
-# define R300_DST_BLEND_GL_SRC_COLOR (34 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24)
-# define R300_DST_BLEND_GL_DST_COLOR (36 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24)
-# define R300_DST_BLEND_GL_SRC_ALPHA (38 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24)
-# define R300_DST_BLEND_GL_DST_ALPHA (40 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24)
-# define R300_DST_BLEND_MASK (63 << 24)
-#define R300_RB3D_COLORMASK 0x4E0C
-# define R300_COLORMASK0_B (1<<0)
-# define R300_COLORMASK0_G (1<<1)
-# define R300_COLORMASK0_R (1<<2)
-# define R300_COLORMASK0_A (1<<3)
-
-/* gap */
-#define R300_RB3D_COLOROFFSET0 0x4E28
-# define R300_COLOROFFSET_MASK 0xFFFFFFF0 /* GUESS */
-#define R300_RB3D_COLOROFFSET1 0x4E2C /* GUESS */
-#define R300_RB3D_COLOROFFSET2 0x4E30 /* GUESS */
-#define R300_RB3D_COLOROFFSET3 0x4E34 /* GUESS */
-/* gap */
-/* Bit 16: Larger tiles
-// Bit 17: 4x2 tiles
-// Bit 18: Extremely weird tile like, but some pixels duplicated? */
-#define R300_RB3D_COLORPITCH0 0x4E38
-# define R300_COLORPITCH_MASK 0x00001FF8 /* GUESS */
-# define R300_COLOR_TILE_ENABLE (1 << 16) /* GUESS */
-# define R300_COLOR_MICROTILE_ENABLE (1 << 17) /* GUESS */
-# define R300_COLOR_ENDIAN_NO_SWAP (0 << 18) /* GUESS */
-# define R300_COLOR_ENDIAN_WORD_SWAP (1 << 18) /* GUESS */
-# define R300_COLOR_ENDIAN_DWORD_SWAP (2 << 18) /* GUESS */
-# define R300_COLOR_FORMAT_RGB565 (2 << 22)
-# define R300_COLOR_FORMAT_ARGB8888 (3 << 22)
-#define R300_RB3D_COLORPITCH1 0x4E3C /* GUESS */
-#define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */
-#define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */
-
-/* gap */
-/* Guess by Vladimir.
-// Set to 0A before 3D operations, set to 02 afterwards. */
-#define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C
-# define R300_RB3D_DSTCACHE_02 0x00000002
-# define R300_RB3D_DSTCACHE_0A 0x0000000A
-
-/* gap */
-/* There seems to be no "write only" setting, so use Z-test = ALWAYS for this. */
-/* Bit (1<<8) is the "test" bit. so plain write is 6 - vd */
-#define R300_RB3D_ZSTENCIL_CNTL_0 0x4F00
-# define R300_RB3D_Z_DISABLED_1 0x00000010 /* GUESS */
-# define R300_RB3D_Z_DISABLED_2 0x00000014 /* GUESS */
-# define R300_RB3D_Z_TEST 0x00000012
-# define R300_RB3D_Z_TEST_AND_WRITE 0x00000016
-# define R300_RB3D_Z_WRITE_ONLY 0x00000006
-
-# define R300_RB3D_Z_TEST 0x00000012
-# define R300_RB3D_Z_TEST_AND_WRITE 0x00000016
-# define R300_RB3D_Z_WRITE_ONLY 0x00000006
-# define R300_RB3D_STENCIL_ENABLE 0x00000001
-
-#define R300_RB3D_ZSTENCIL_CNTL_1 0x4F04
- /* functions */
-# define R300_ZS_NEVER 0
-# define R300_ZS_LESS 1
-# define R300_ZS_LEQUAL 2
-# define R300_ZS_EQUAL 3
-# define R300_ZS_GEQUAL 4
-# define R300_ZS_GREATER 5
-# define R300_ZS_NOTEQUAL 6
-# define R300_ZS_ALWAYS 7
-# define R300_ZS_MASK 7
- /* operations */
-# define R300_ZS_KEEP 0
-# define R300_ZS_ZERO 1
-# define R300_ZS_REPLACE 2
-# define R300_ZS_INCR 3
-# define R300_ZS_DECR 4
-# define R300_ZS_INVERT 5
-# define R300_ZS_INCR_WRAP 6
-# define R300_ZS_DECR_WRAP 7
-
- /* front and back refer to operations done for front
- and back faces, i.e. separate stencil function support */
-# define R300_RB3D_ZS1_DEPTH_FUNC_SHIFT 0
-# define R300_RB3D_ZS1_FRONT_FUNC_SHIFT 3
-# define R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT 6
-# define R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT 9
-# define R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT 12
-# define R300_RB3D_ZS1_BACK_FUNC_SHIFT 15
-# define R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT 18
-# define R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT 21
-# define R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT 24
-
-
-
-#define R300_RB3D_ZSTENCIL_CNTL_2 0x4F08
-# define R300_RB3D_ZS2_STENCIL_REF_SHIFT 0
-# define R300_RB3D_ZS2_STENCIL_MASK 0xFF
-# define R300_RB3D_ZS2_STENCIL_MASK_SHIFT 8
-# define R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT 16
-
-/* gap */
-
-#define R300_RB3D_ZSTENCIL_FORMAT 0x4F10
-# define R300_DEPTH_FORMAT_16BIT_INT_Z (0 << 0)
-# define R300_DEPTH_FORMAT_24BIT_INT_Z (2 << 0)
-
-/* gap */
-#define R300_RB3D_DEPTHOFFSET 0x4F20
-#define R300_RB3D_DEPTHPITCH 0x4F24
-# define R300_DEPTHPITCH_MASK 0x00001FF8 /* GUESS */
-# define R300_DEPTH_TILE_ENABLE (1 << 16) /* GUESS */
-# define R300_DEPTH_MICROTILE_ENABLE (1 << 17) /* GUESS */
-# define R300_DEPTH_ENDIAN_NO_SWAP (0 << 18) /* GUESS */
-# define R300_DEPTH_ENDIAN_WORD_SWAP (1 << 18) /* GUESS */
-# define R300_DEPTH_ENDIAN_DWORD_SWAP (2 << 18) /* GUESS */
-
-/* BEGIN: Vertex program instruction set
-// Every instruction is four dwords long:
-// DWORD 0: output and opcode
-// DWORD 1: first argument
-// DWORD 2: second argument
-// DWORD 3: third argument
-//
-// Notes:
-// - ABS r, a is implemented as MAX r, a, -a
-// - MOV is implemented as ADD to zero
-// - XPD is implemented as MUL + MAD
-// - FLR is implemented as FRC + ADD
-// - apparently, fglrx tries to schedule instructions so that there is at least
-// one instruction between the write to a temporary and the first read
-// from said temporary; however, violations of this scheduling are allowed
-// - register indices seem to be unrelated with OpenGL aliasing to conventional state
-// - only one attribute and one parameter can be loaded at a time; however, the
-// same attribute/parameter can be used for more than one argument
-// - the second software argument for POW is the third hardware argument (no idea why)
-// - MAD with only temporaries as input seems to use VPI_OUT_SELECT_MAD_2
-//
-// There is some magic surrounding LIT:
-// The single argument is replicated across all three inputs, but swizzled:
-// First argument: xyzy
-// Second argument: xyzx
-// Third argument: xyzw
-// Whenever the result is used later in the fragment program, fglrx forces x and w
-// to be 1.0 in the input selection; I don't know whether this is strictly necessary */
-#define R300_VPI_OUT_OP_DOT (1 << 0)
-#define R300_VPI_OUT_OP_MUL (2 << 0)
-#define R300_VPI_OUT_OP_ADD (3 << 0)
-#define R300_VPI_OUT_OP_MAD (4 << 0)
-#define R300_VPI_OUT_OP_DST (5 << 0)
-#define R300_VPI_OUT_OP_FRC (6 << 0)
-#define R300_VPI_OUT_OP_MAX (7 << 0)
-#define R300_VPI_OUT_OP_MIN (8 << 0)
-#define R300_VPI_OUT_OP_SGE (9 << 0)
-#define R300_VPI_OUT_OP_SLT (10 << 0)
-#define R300_VPI_OUT_OP_UNK12 (12 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */
-#define R300_VPI_OUT_OP_EXP (65 << 0)
-#define R300_VPI_OUT_OP_LOG (66 << 0)
-#define R300_VPI_OUT_OP_UNK67 (67 << 0) /* Used in fog computations, scalar(scalar) */
-#define R300_VPI_OUT_OP_LIT (68 << 0)
-#define R300_VPI_OUT_OP_POW (69 << 0)
-#define R300_VPI_OUT_OP_RCP (70 << 0)
-#define R300_VPI_OUT_OP_RSQ (72 << 0)
-#define R300_VPI_OUT_OP_UNK73 (73 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, scalar(scalar) */
-#define R300_VPI_OUT_OP_EX2 (75 << 0)
-#define R300_VPI_OUT_OP_LG2 (76 << 0)
-#define R300_VPI_OUT_OP_MAD_2 (128 << 0)
-#define R300_VPI_OUT_OP_UNK129 (129 << 0) /* all temps, vector(scalar, vector, vector) */
-
-#define R300_VPI_OUT_REG_CLASS_TEMPORARY (0 << 8)
-#define R300_VPI_OUT_REG_CLASS_RESULT (2 << 8)
-#define R300_VPI_OUT_REG_CLASS_MASK (31 << 8)
-
-#define R300_VPI_OUT_REG_INDEX_SHIFT 13
-#define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) /* GUESS based on fglrx native limits */
-
-#define R300_VPI_OUT_WRITE_X (1 << 20)
-#define R300_VPI_OUT_WRITE_Y (1 << 21)
-#define R300_VPI_OUT_WRITE_Z (1 << 22)
-#define R300_VPI_OUT_WRITE_W (1 << 23)
-
-#define R300_VPI_IN_REG_CLASS_TEMPORARY (0 << 0)
-#define R300_VPI_IN_REG_CLASS_ATTRIBUTE (1 << 0)
-#define R300_VPI_IN_REG_CLASS_PARAMETER (2 << 0)
-#define R300_VPI_IN_REG_CLASS_NONE (9 << 0)
-#define R300_VPI_IN_REG_CLASS_MASK (31 << 0) /* GUESS */
-
-#define R300_VPI_IN_REG_INDEX_SHIFT 5
-#define R300_VPI_IN_REG_INDEX_MASK (255 << 5) /* GUESS based on fglrx native limits */
-
-/* The R300 can select components from the input register arbitrarily.
-// Use the following constants, shifted by the component shift you
-// want to select */
-#define R300_VPI_IN_SELECT_X 0
-#define R300_VPI_IN_SELECT_Y 1
-#define R300_VPI_IN_SELECT_Z 2
-#define R300_VPI_IN_SELECT_W 3
-#define R300_VPI_IN_SELECT_ZERO 4
-#define R300_VPI_IN_SELECT_ONE 5
-#define R300_VPI_IN_SELECT_MASK 7
-
-#define R300_VPI_IN_X_SHIFT 13
-#define R300_VPI_IN_Y_SHIFT 16
-#define R300_VPI_IN_Z_SHIFT 19
-#define R300_VPI_IN_W_SHIFT 22
-
-#define R300_VPI_IN_NEG_X (1 << 25)
-#define R300_VPI_IN_NEG_Y (1 << 26)
-#define R300_VPI_IN_NEG_Z (1 << 27)
-#define R300_VPI_IN_NEG_W (1 << 28)
-/* END */
-
-//BEGIN: Packet 3 commands
-
-// A primitive emission dword.
-#define R300_PRIM_TYPE_NONE (0 << 0)
-#define R300_PRIM_TYPE_POINT (1 << 0)
-#define R300_PRIM_TYPE_LINE (2 << 0)
-#define R300_PRIM_TYPE_LINE_STRIP (3 << 0)
-#define R300_PRIM_TYPE_TRI_LIST (4 << 0)
-#define R300_PRIM_TYPE_TRI_FAN (5 << 0)
-#define R300_PRIM_TYPE_TRI_STRIP (6 << 0)
-#define R300_PRIM_TYPE_TRI_TYPE2 (7 << 0)
-#define R300_PRIM_TYPE_RECT_LIST (8 << 0)
-#define R300_PRIM_TYPE_3VRT_POINT_LIST (9 << 0)
-#define R300_PRIM_TYPE_3VRT_LINE_LIST (10 << 0)
-#define R300_PRIM_TYPE_POINT_SPRITES (11 << 0) // GUESS (based on r200)
-#define R300_PRIM_TYPE_LINE_LOOP (12 << 0)
-#define R300_PRIM_TYPE_QUADS (13 << 0)
-#define R300_PRIM_TYPE_QUAD_STRIP (14 << 0)
-#define R300_PRIM_TYPE_POLYGON (15 << 0)
-#define R300_PRIM_TYPE_MASK 0xF
-#define R300_PRIM_WALK_IND (1 << 4)
-#define R300_PRIM_WALK_LIST (2 << 4)
-#define R300_PRIM_WALK_RING (3 << 4)
-#define R300_PRIM_WALK_MASK (3 << 4)
-#define R300_PRIM_COLOR_ORDER_BGRA (0 << 6) // GUESS (based on r200)
-#define R300_PRIM_COLOR_ORDER_RGBA (1 << 6) // GUESS
-#define R300_PRIM_NUM_VERTICES_SHIFT 16
-
-// Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR.
-// Two parameter dwords:
-// 0. The first parameter appears to be always 0
-// 1. The second parameter is a standard primitive emission dword.
-#define R300_PACKET3_3D_DRAW_VBUF 0x00002800
-
-// Specify the full set of vertex arrays as (address, stride).
-// The first parameter is the number of vertex arrays specified.
-// The rest of the command is a variable length list of blocks, where
-// each block is three dwords long and specifies two arrays.
-// The first dword of a block is split into two words, the lower significant
-// word refers to the first array, the more significant word to the second
-// array in the block.
-// The low byte of each word contains the size of an array entry in dwords,
-// the high byte contains the stride of the array.
-// The second dword of a block contains the pointer to the first array,
-// the third dword of a block contains the pointer to the second array.
-// Note that if the total number of arrays is odd, the third dword of
-// the last block is omitted.
-#define R300_PACKET3_3D_LOAD_VBPNTR 0x00002F00
-
-#define R300_PACKET3_INDX_BUFFER 0x00003300
-# define R300_EB_UNK1_SHIFT 24
-# define R300_EB_UNK1 (0x80<<24)
-# define R300_EB_UNK2 0x0810
-#define R300_PACKET3_3D_DRAW_INDX_2 0x00003600
-
-//END
-
-#endif /* _R300_REG_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_render.c
deleted file mode 100644
index a0769e27f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_render.c
+++ /dev/null
@@ -1,726 +0,0 @@
-/**************************************************************************
-
-Copyright (C) 2004 Nicolai Haehnle.
-
-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, 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
-ATI, 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:
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#include "glheader.h"
-#include "state.h"
-#include "imports.h"
-#include "enums.h"
-#include "macros.h"
-#include "context.h"
-#include "dd.h"
-#include "simple_list.h"
-
-#include "api_arrayelt.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_vp_build.h"
-
-#include "radeon_reg.h"
-#include "radeon_macros.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "r300_context.h"
-#include "r300_ioctl.h"
-#include "r300_state.h"
-#include "r300_reg.h"
-#include "r300_program.h"
-#include "r300_tex.h"
-#include "r300_maos.h"
-#include "r300_emit.h"
-
-extern int future_hw_tcl_on;
-
-/**********************************************************************
-* Hardware rasterization
-*
-* When we fell back to software TCL, we still try to use the
-* rasterization hardware for rendering.
-**********************************************************************/
-
-static int r300_get_primitive_type(r300ContextPtr rmesa, GLcontext *ctx, int prim)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- int type=-1;
-
- switch (prim & PRIM_MODE_MASK) {
- case GL_POINTS:
- type=R300_VAP_VF_CNTL__PRIM_POINTS;
- break;
- case GL_LINES:
- type=R300_VAP_VF_CNTL__PRIM_LINES;
- break;
- case GL_LINE_STRIP:
- type=R300_VAP_VF_CNTL__PRIM_LINE_STRIP;
- break;
- case GL_LINE_LOOP:
- type=R300_VAP_VF_CNTL__PRIM_LINE_LOOP;
- break;
- case GL_TRIANGLES:
- type=R300_VAP_VF_CNTL__PRIM_TRIANGLES;
- break;
- case GL_TRIANGLE_STRIP:
- type=R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP;
- break;
- case GL_TRIANGLE_FAN:
- type=R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN;
- break;
- case GL_QUADS:
- type=R300_VAP_VF_CNTL__PRIM_QUADS;
- break;
- case GL_QUAD_STRIP:
- type=R300_VAP_VF_CNTL__PRIM_QUAD_STRIP;
- break;
- case GL_POLYGON:
- type=R300_VAP_VF_CNTL__PRIM_POLYGON;
- break;
- default:
- fprintf(stderr, "%s:%s Do not know how to handle primitive %02x - help me !\n",
- __FILE__, __FUNCTION__,
- prim & PRIM_MODE_MASK);
- return -1;
- break;
- }
- return type;
-}
-
-static int r300_get_num_verts(r300ContextPtr rmesa,
- GLcontext *ctx,
- int num_verts,
- int prim)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- int type=-1, verts_off=0;
- char *name="UNKNOWN";
-
- switch (prim & PRIM_MODE_MASK) {
- case GL_POINTS:
- name="P";
- verts_off = 0;
- break;
- case GL_LINES:
- name="L";
- verts_off = num_verts % 2;
- break;
- case GL_LINE_STRIP:
- name="LS";
- if(num_verts < 2)
- verts_off = num_verts;
- break;
- case GL_LINE_LOOP:
- name="LL";
- if(num_verts < 2)
- verts_off = num_verts;
- break;
- case GL_TRIANGLES:
- name="T";
- verts_off = num_verts % 3;
- break;
- case GL_TRIANGLE_STRIP:
- name="TS";
- if(num_verts < 3)
- verts_off = num_verts;
- break;
- case GL_TRIANGLE_FAN:
- name="TF";
- if(num_verts < 3)
- verts_off = num_verts;
- break;
- case GL_QUADS:
- name="Q";
- verts_off = num_verts % 4;
- break;
- case GL_QUAD_STRIP:
- name="QS";
- if(num_verts < 4)
- verts_off = num_verts;
- else
- verts_off = num_verts % 2;
- break;
- case GL_POLYGON:
- name="P";
- if(num_verts < 3)
- verts_off = num_verts;
- break;
- default:
- fprintf(stderr, "%s:%s Do not know how to handle primitive %02x - help me !\n",
- __FILE__, __FUNCTION__,
- prim & PRIM_MODE_MASK);
- return -1;
- break;
- }
-
- if(num_verts - verts_off == 0){
- WARN_ONCE("user error: Need more than %d vertices to draw primitive %s !\n", num_verts, name);
- return 0;
- }
-
- if(verts_off > 0){
- WARN_ONCE("user error: %d is not a valid number of vertices for primitive %s !\n", num_verts, name);
- }
-
- return num_verts - verts_off;
-}
-
-/* This function compiles GL context into state registers that
- describe data routing inside of R300 pipeline.
-
- In particular, it programs input_route, output_vtx_fmt, texture
- unit configuration and gb_output_vtx_fmt
-
- This function encompasses setup_AOS() from r300_lib.c
-*/
-
-
-
-
-/* Immediate implementation - vertex data is sent via command stream */
-
-static GLfloat default_vector[4]={0.0, 0.0, 0.0, 1.0};
-
-#define output_vector(v, i) { \
- int _i; \
- for(_i=0;_i<v->size;_i++){ \
- if(VB->Elts){ \
- efloat(VEC_ELT(v, GLfloat, VB->Elts[i])[_i]); \
- }else{ \
- efloat(VEC_ELT(v, GLfloat, i)[_i]); \
- } \
- } \
- for(_i=v->size;_i<4;_i++){ \
- efloat(default_vector[_i]); \
- } \
-}
-
-/* Immediate implementation - vertex data is sent via command stream */
-
-static void r300_render_immediate_primitive(r300ContextPtr rmesa,
- GLcontext *ctx,
- int start,
- int end,
- int prim)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i, render_inputs;
- int k, type, num_verts;
- LOCAL_VARS
-
- type=r300_get_primitive_type(rmesa, ctx, prim);
- num_verts=r300_get_num_verts(rmesa, ctx, end-start, prim);
-
-#if 0
- fprintf(stderr,"ObjPtr: size=%d stride=%d\n",
- VB->ObjPtr->size, VB->ObjPtr->stride);
- fprintf(stderr,"ColorPtr[0]: size=%d stride=%d\n",
- VB->ColorPtr[0]->size, VB->ColorPtr[0]->stride);
- fprintf(stderr,"TexCoordPtr[0]: size=%d stride=%d\n",
- VB->TexCoordPtr[0]->size, VB->TexCoordPtr[0]->stride);
-#endif
-
- if(type<0 || num_verts <= 0)return;
-
- if(!VB->ObjPtr){
- WARN_ONCE("FIXME: Don't know how to handle GL_ARB_vertex_buffer_object correctly\n");
- return;
- }
- /* A packet cannot have more than 16383 data words.. */
- if((num_verts*4*rmesa->state.aos_count)>16380){
- WARN_ONCE("Too many vertices to paint. Fix me !\n");
- return;
- }
-
- //fprintf(stderr, "aos_count=%d start=%d end=%d\n", rmesa->state.aos_count, start, end);
-
- if(rmesa->state.aos_count==0){
- WARN_ONCE("Aeiee ! aos_count==0, while it shouldn't. Skipping rendering\n");
- return;
- }
-
- render_inputs = rmesa->state.render_inputs;
-
- if(!render_inputs){
- WARN_ONCE("Aeiee ! render_inputs==0. Skipping rendering.\n");
- return;
- }
-
-
- start_immediate_packet(num_verts, type, 4*rmesa->state.aos_count);
-
- for(i=start;i<start+num_verts;i++){
-#if 0
- fprintf(stderr, "* (%f %f %f %f) (%f %f %f %f)\n",
- VEC_ELT(VB->ObjPtr, GLfloat, i)[0],
- VEC_ELT(VB->ObjPtr, GLfloat, i)[1],
- VEC_ELT(VB->ObjPtr, GLfloat, i)[2],
- VEC_ELT(VB->ObjPtr, GLfloat, i)[3],
-
- VEC_ELT(VB->ColorPtr[0], GLfloat, i)[0],
- VEC_ELT(VB->ColorPtr[0], GLfloat, i)[1],
- VEC_ELT(VB->ColorPtr[0], GLfloat, i)[2],
- VEC_ELT(VB->ColorPtr[0], GLfloat, i)[3]
- );
-#endif
-
-
- /* coordinates */
- if(render_inputs & _TNL_BIT_POS)
- output_vector(VB->ObjPtr, i);
- if(render_inputs & _TNL_BIT_NORMAL)
- output_vector(VB->NormalPtr, i);
-
- /* color components */
- if(render_inputs & _TNL_BIT_COLOR0)
- output_vector(VB->ColorPtr[0], i);
- if(render_inputs & _TNL_BIT_COLOR1)
- output_vector(VB->SecondaryColorPtr[0], i);
-
-/* if(render_inputs & _TNL_BIT_FOG) // Causes lock ups when immediate mode is on
- output_vector(VB->FogCoordPtr, i);*/
-
- /* texture coordinates */
- for(k=0;k < ctx->Const.MaxTextureUnits;k++)
- if(render_inputs & (_TNL_BIT_TEX0<<k))
- output_vector(VB->TexCoordPtr[k], i);
-
- if(render_inputs & _TNL_BIT_INDEX)
- output_vector(VB->IndexPtr[0], i);
- if(render_inputs & _TNL_BIT_POINTSIZE)
- output_vector(VB->PointSizePtr, i);
- }
-
-}
-
-
-static GLboolean r300_run_immediate_render(GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- /* Only do 2d textures */
- struct gl_texture_object *to=ctx->Texture.Unit[0].Current2D;
- r300TexObjPtr t=to->DriverData;
- LOCAL_VARS
-
-
- /* Update texture state - needs to be done only when actually changed..
- All the time for now.. */
-
-
- if (RADEON_DEBUG == DEBUG_PRIMS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-#if 1 /* we need this, somehow */
- /* Flush state - make sure command buffer is nice and large */
- r300Flush(ctx);
- /* Make sure we have enough space */
-#else
- /* Count is very imprecize, but should be good upper bound */
- r300EnsureCmdBufSpace(rmesa, rmesa->hw.max_state_size + 4+2+30
- +VB->PrimitiveCount*(1+8)+VB->Count*4*rmesa->state.texture.tc_count+4, __FUNCTION__);
-#endif
-
- /* needed before starting 3d operation .. */
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a);
-
- reg_start(0x4f18,0);
- e32(0x00000003);
-
-
-#if 0 /* looks like the Z offset issue got fixed */
- rmesa->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA
- | R300_VPORT_X_OFFSET_ENA
- | R300_VPORT_Y_SCALE_ENA
- | R300_VPORT_Y_OFFSET_ENA
- | R300_VTX_W0_FMT;
- R300_STATECHANGE(rmesa, vte);
-#endif
-
-
-
- /* Magic register - note it is right after 20b0 */
-
-
- if(rmesa->state.texture.tc_count>0){
- reg_start(0x20b4,0);
- e32(0x0000000c);
-
- }
-
- r300EmitState(rmesa);
-
-/* Setup INPUT_ROUTE and INPUT_CNTL */
- r300EmitArrays(ctx, GL_TRUE);
-
-/* Why do we need this for immediate mode?? Vertex processor needs it to know proper regs */
-// r300EmitLOAD_VBPNTR(rmesa, 0);
-/* Okay, it seems I misunderstood something, EmitAOS does the same thing */
- r300EmitAOS(rmesa, rmesa->state.aos_count, 0);
-
- for(i=0; i < VB->PrimitiveCount; i++){
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- r300_render_immediate_primitive(rmesa, ctx, start, start + length, prim);
- }
-
- /* This sequence is required after any 3d drawing packet
- I suspect it work arounds a bug (or deficiency) in hardware */
-
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a);
-
- reg_start(0x4f18,0);
- e32(0x00000003);
-
- return GL_FALSE;
-}
-
-
-/* vertex buffer implementation */
-
-static void inline fire_EB(PREFIX unsigned long addr, int vertex_count, int type)
-{
- LOCAL_VARS
- unsigned long addr_a;
-
- if(addr & 1){
- WARN_ONCE("Badly aligned buffer\n");
- return ;
- }
- addr_a = 0; /*addr & 0x1c;*/
-
- check_space(6);
-
- start_packet3(RADEON_CP_PACKET3_3D_DRAW_INDX_2, 0);
- /* TODO: R300_VAP_VF_CNTL__INDEX_SIZE_32bit . */
- e32(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (vertex_count<<16) | type);
-
- start_packet3(RADEON_CP_PACKET3_INDX_BUFFER, 2);
- e32(R300_EB_UNK1 | (addr_a << 16) | R300_EB_UNK2);
- e32(addr /*& 0xffffffe3*/);
- e32((vertex_count+1)/2 /*+ addr_a/4*/); /* Total number of dwords needed? */
-}
-
-static void r300_render_vb_primitive(r300ContextPtr rmesa,
- GLcontext *ctx,
- int start,
- int end,
- int prim)
-{
- int type, num_verts;
- radeonScreenPtr rsp=rmesa->radeon.radeonScreen;
- LOCAL_VARS
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- int i;
-
- type=r300_get_primitive_type(rmesa, ctx, prim);
- num_verts=r300_get_num_verts(rmesa, ctx, end-start, prim);
-
- if(type<0 || num_verts <= 0)return;
-
- if(rmesa->state.Elts){
- r300EmitAOS(rmesa, rmesa->state.aos_count, 0);
-#if 0
- start_index32_packet(num_verts, type);
- for(i=0; i < num_verts; i++)
- e32(rmesa->state.Elts[start+i]); /* start ? */
-#else
- WARN_ONCE("Rendering with elt buffers\n");
- if(num_verts == 1){
- start_index32_packet(num_verts, type);
- e32(rmesa->state.Elts[start]);
- return;
- }
-
- if(num_verts > 65535){ /* not implemented yet */
- WARN_ONCE("Too many elts\n");
- return;
- }
- r300EmitElts(ctx, rmesa->state.Elts+start, num_verts);
- fire_EB(PASS_PREFIX GET_START(&(rmesa->state.elt_dma)), num_verts, type);
-#endif
- }else{
- r300EmitAOS(rmesa, rmesa->state.aos_count, start);
- fire_AOS(PASS_PREFIX num_verts, type);
- }
-}
-
-static GLboolean r300_run_vb_render(GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- int i, j;
- LOCAL_VARS
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- r300ReleaseArrays(ctx);
- r300EmitArrays(ctx, GL_FALSE);
-
-// LOCK_HARDWARE(&(rmesa->radeon));
-
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a);
-
- reg_start(0x4f18,0);
- e32(0x00000003);
- r300EmitState(rmesa);
-
- rmesa->state.Elts = VB->Elts;
-
- for(i=0; i < VB->PrimitiveCount; i++){
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- r300_render_vb_primitive(rmesa, ctx, start, start + length, prim);
- }
-
- reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
- e32(0x0000000a);
-
- reg_start(0x4f18,0);
- e32(0x00000003);
-
-// end_3d(PASS_PREFIX_VOID);
-
- /* Flush state - we are done drawing.. */
-// r300FlushCmdBufLocked(rmesa, __FUNCTION__);
-// radeonWaitForIdleLocked(&(rmesa->radeon));
-
-// UNLOCK_HARDWARE(&(rmesa->radeon));
- return GL_FALSE;
-}
-
-/**
- * Called by the pipeline manager to render a batch of primitives.
- * We can return true to pass on to the next stage (i.e. software
- * rasterization) or false to indicate that the pipeline has finished
- * after we render something.
- */
-static GLboolean r300_run_render(GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
-#if 1
-
-#if 0
- return r300_run_immediate_render(ctx, stage);
-#else
- return r300_run_vb_render(ctx, stage);
-#endif
-#else
- return GL_TRUE;
-#endif
-}
-
-
-/**
- * Called by the pipeline manager once before rendering.
- * We check the GL state here to
- * a) decide whether we can do the current state in hardware and
- * b) update hardware registers
- */
-#define FALLBACK_IF(expr) \
-do { \
- if (expr) { \
- if (1 || RADEON_DEBUG & DEBUG_FALLBACKS) \
- fprintf(stderr, "%s: fallback:%s\n", \
- __FUNCTION__, #expr); \
- /*stage->active = GL_FALSE*/; \
- return; \
- } \
-} while(0)
-
-static void r300_check_render(GLcontext *ctx, struct tnl_pipeline_stage *stage)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- int i;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* We only support rendering in hardware for now */
- if (ctx->RenderMode != GL_RENDER) {
- //stage->active = GL_FALSE;
- return;
- }
-
-
- /* I'm almost certain I forgot something here */
-#if 0 /* These should work now.. */
- FALLBACK_IF(ctx->Color.DitherFlag);
- FALLBACK_IF(ctx->Color.AlphaEnabled); // GL_ALPHA_TEST
- FALLBACK_IF(ctx->Color.BlendEnabled); // GL_BLEND
- FALLBACK_IF(ctx->Polygon.OffsetFill); // GL_POLYGON_OFFSET_FILL
-#endif
- //FALLBACK_IF(ctx->Polygon.OffsetPoint); // GL_POLYGON_OFFSET_POINT
- //FALLBACK_IF(ctx->Polygon.OffsetLine); // GL_POLYGON_OFFSET_LINE
- //FALLBACK_IF(ctx->Stencil.Enabled); // GL_STENCIL_TEST
-
- //FALLBACK_IF(ctx->Fog.Enabled); // GL_FOG disable as swtcl doesnt seem to support this
- //FALLBACK_IF(ctx->Polygon.SmoothFlag); // GL_POLYGON_SMOOTH disabling to get blender going
- FALLBACK_IF(ctx->Polygon.StippleFlag); // GL_POLYGON_STIPPLE
- FALLBACK_IF(ctx->Multisample.Enabled); // GL_MULTISAMPLE_ARB
-
- FALLBACK_IF(ctx->RenderMode != GL_RENDER); // We do not do SELECT or FEEDBACK (yet ?)
-
-#if 0 /* ut2k3 fails to start if this is on */
- /* One step at a time - let one texture pass.. */
- for (i = 1; i < ctx->Const.MaxTextureUnits; i++)
- FALLBACK_IF(ctx->Texture.Unit[i].Enabled);
-#endif
-
- /* Assumed factor reg is found but pattern is still missing */
- //FALLBACK_IF(ctx->Line.StippleFlag); // GL_LINE_STIPPLE disabling to get blender going
-
- /* HW doesnt appear to directly support these */
- //FALLBACK_IF(ctx->Line.SmoothFlag); // GL_LINE_SMOOTH disabling to get blender going
- FALLBACK_IF(ctx->Point.SmoothFlag); // GL_POINT_SMOOTH
- /* Rest could be done with vertex fragments */
- if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite)
- FALLBACK_IF(ctx->Point.PointSprite); // GL_POINT_SPRITE_NV
- //GL_POINT_DISTANCE_ATTENUATION_ARB
- //GL_POINT_FADE_THRESHOLD_SIZE_ARB
-
- /* let r300_run_render do its job */
-#if 0
- stage->active = GL_FALSE;
-#endif
-}
-
-
-static void dtr(struct tnl_pipeline_stage *stage)
-{
- (void)stage;
-}
-
-static GLboolean r300_create_render(GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- return GL_TRUE;
-}
-
-
-const struct tnl_pipeline_stage _r300_render_stage = {
- "r300 hw rasterize",
- NULL,
- r300_create_render,
- dtr, /* destructor */
- r300_check_render, /* check */
- r300_run_render /* run */
-};
-
-static GLboolean r300_run_tcl_render(GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- struct r300_vertex_program *vp;
-
- hw_tcl_on=future_hw_tcl_on;
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s\n", __FUNCTION__);
- if(hw_tcl_on == GL_FALSE)
- return GL_TRUE;
- if(ctx->VertexProgram._Enabled == GL_FALSE){
- _tnl_UpdateFixedFunctionProgram(ctx);
- }
- vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx);
- if(vp->translated == GL_FALSE)
- translate_vertex_shader(vp);
- if(vp->translated == GL_FALSE){
- fprintf(stderr, "Failing back to sw-tcl\n");
- debug_vp(ctx, &vp->mesa_program);
- hw_tcl_on=future_hw_tcl_on=0;
- r300ResetHwState(rmesa);
- return GL_TRUE;
- }
-
- r300_setup_textures(ctx);
- r300_setup_rs_unit(ctx);
-
- r300SetupVertexShader(rmesa);
- r300SetupPixelShader(rmesa);
-
- return r300_run_vb_render(ctx, stage);
-}
-
-static void r300_check_tcl_render(GLcontext *ctx, struct tnl_pipeline_stage *stage)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- int i;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* We only support rendering in hardware for now */
- if (ctx->RenderMode != GL_RENDER) {
- //stage->active = GL_FALSE;
- return;
- }
-}
-
-const struct tnl_pipeline_stage _r300_tcl_stage = {
- "r300 tcl",
- NULL,
- r300_create_render,
- dtr, /* destructor */
- r300_check_tcl_render, /* check */
- r300_run_tcl_render /* run */
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_shader.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_shader.c
deleted file mode 100644
index 9c6788ec3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_shader.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "program.h"
-#include "r300_context.h"
-#include "nvvertprog.h"
-#if USE_ARB_F_P == 1
-#include "r300_fragprog.h"
-#endif
-
-static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct r300_vertex_program *vp=(void *)prog;
-
- switch(target){
- case GL_VERTEX_PROGRAM_ARB:
-#if USE_ARB_F_P == 1
- case GL_FRAGMENT_PROGRAM_ARB:
-#endif
- //rmesa->current_vp = vp;
- break;
- default:
- WARN_ONCE("Target not supported yet!\n");
- break;
- }
-}
-
-static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
-{
- struct r300_vertex_program *vp;
-#if USE_ARB_F_P == 1
- struct r300_fragment_program *fp;
-#else
- struct fragment_program *fp;
-#endif
- struct ati_fragment_shader *afs;
-
- switch(target){
- case GL_VERTEX_PROGRAM_ARB:
- vp=CALLOC_STRUCT(r300_vertex_program);
- return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id);
-
- case GL_FRAGMENT_PROGRAM_ARB:
-#if USE_ARB_F_P == 1
- fp=CALLOC_STRUCT(r300_fragment_program);
- fp->ctx = ctx;
- return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id);
-#else
- fp=CALLOC_STRUCT(fragment_program);
- return _mesa_init_fragment_program(ctx, fp, target, id);
-#endif
- case GL_FRAGMENT_PROGRAM_NV:
- fp=CALLOC_STRUCT(fragment_program);
- return _mesa_init_fragment_program(ctx, fp, target, id);
-
- case GL_FRAGMENT_SHADER_ATI:
- afs=CALLOC_STRUCT(ati_fragment_shader);
- return _mesa_init_ati_fragment_shader(ctx, afs, target, id);
- }
-
- return NULL;
-}
-
-
-static void r300DeleteProgram(GLcontext *ctx, struct program *prog)
-{
- //r300ContextPtr rmesa = R300_CONTEXT(ctx);
- //struct r300_vertex_program *vp=(void *)prog;
-
- _mesa_delete_program(ctx, prog);
-}
-
-static void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
- struct program *prog)
-{
- struct r300_vertex_program *vp=(void *)prog;
-#if USE_ARB_F_P == 1
- struct r300_fragment_program *fp=(void *)prog;
-#endif
-
- switch(target) {
- case GL_VERTEX_PROGRAM_ARB:
- /*vp->translated=GL_FALSE;
- translate_vertex_shader(vp);*/
- //debug_vp(ctx, vp);
- break;
- case GL_FRAGMENT_PROGRAM_ARB:
-#if USE_ARB_F_P == 1
- fp->translated = GL_FALSE;
-#endif
- break;
- }
-}
-
-static GLboolean r300IsProgramNative(GLcontext *ctx, GLenum target, struct program *prog)
-{
- //struct r300_vertex_program *vp=(void *)prog;
- //r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- return 1;
-}
-
-void r300InitShaderFuncs(struct dd_function_table *functions)
-{
- functions->NewProgram=r300NewProgram;
- functions->BindProgram=r300BindProgram;
- functions->DeleteProgram=r300DeleteProgram;
- functions->ProgramStringNotify=r300ProgramStringNotify;
- functions->IsProgramNative=r300IsProgramNative;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.c
deleted file mode 100644
index b6a03a227..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.c
+++ /dev/null
@@ -1,2321 +0,0 @@
-/*
-Copyright (C) The Weather Channel, Inc. 2002.
-Copyright (C) 2004 Nicolai Haehnle.
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#include "glheader.h"
-#include "state.h"
-#include "imports.h"
-#include "enums.h"
-#include "macros.h"
-#include "context.h"
-#include "dd.h"
-#include "simple_list.h"
-
-#include "api_arrayelt.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "texformat.h"
-
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "r300_context.h"
-#include "r300_ioctl.h"
-#include "r300_state.h"
-#include "r300_reg.h"
-#include "r300_program.h"
-#include "r300_emit.h"
-#if USE_ARB_F_P == 1
-#include "r300_fragprog.h"
-#else
-#include "r300_fixed_pipelines.h"
-#include "r300_texprog.h"
-#endif
-#include "r300_tex.h"
-#include "r300_maos.h"
-
-static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- int pp_misc = rmesa->hw.at.cmd[R300_AT_ALPHA_TEST];
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- R300_STATECHANGE(rmesa, at);
-
- pp_misc &= ~(R300_ALPHA_TEST_OP_MASK | R300_REF_ALPHA_MASK);
- pp_misc |= (refByte & R300_REF_ALPHA_MASK);
-
- switch (func) {
- case GL_NEVER:
- pp_misc |= R300_ALPHA_TEST_FAIL;
- break;
- case GL_LESS:
- pp_misc |= R300_ALPHA_TEST_LESS;
- break;
- case GL_EQUAL:
- pp_misc |= R300_ALPHA_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- pp_misc |= R300_ALPHA_TEST_LEQUAL;
- break;
- case GL_GREATER:
- pp_misc |= R300_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- pp_misc |= R300_ALPHA_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- pp_misc |= R300_ALPHA_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- pp_misc |= R300_ALPHA_TEST_PASS;
- //pp_misc &= ~R300_ALPHA_TEST_ENABLE;
- break;
- }
-
- rmesa->hw.at.cmd[R300_AT_ALPHA_TEST] = pp_misc;
-}
-
-static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4])
-{
- GLubyte color[4];
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- R300_STATECHANGE(rmesa, unk4E10);
-
- /* Ordering might be wrong */
- CLAMPED_FLOAT_TO_UBYTE(color[0], cf[0]);
- CLAMPED_FLOAT_TO_UBYTE(color[1], cf[1]);
- CLAMPED_FLOAT_TO_UBYTE(color[2], cf[2]);
- CLAMPED_FLOAT_TO_UBYTE(color[3], cf[3]);
-
- rmesa->hw.unk4E10.cmd[1]=r300PackColor(4, color[0], color[1], color[2], color[3]);
-}
-
-/**
- * Calculate the hardware blend factor setting. This same function is used
- * for source and destination of both alpha and RGB.
- *
- * \returns
- * The hardware register value for the specified blend factor. This value
- * will need to be shifted into the correct position for either source or
- * destination factor.
- *
- * \todo
- * Since the two cases where source and destination are handled differently
- * are essentially error cases, they should never happen. Determine if these
- * cases can be removed.
- */
-static int blend_factor(GLenum factor, GLboolean is_src)
-{
- int func;
-
- switch (factor) {
- case GL_ZERO:
- func = R200_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- func = R200_BLEND_GL_ONE;
- break;
- case GL_DST_COLOR:
- func = R200_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_COLOR:
- func = R200_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- func = R200_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- func = R200_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- func =
- (is_src) ? R200_BLEND_GL_SRC_ALPHA_SATURATE :
- R200_BLEND_GL_ZERO;
- break;
- case GL_CONSTANT_COLOR:
- func = R200_BLEND_GL_CONST_COLOR;
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_CONST_COLOR;
- break;
- case GL_CONSTANT_ALPHA:
- func = R200_BLEND_GL_CONST_ALPHA;
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_CONST_ALPHA;
- break;
- default:
- func = (is_src) ? R200_BLEND_GL_ONE : R200_BLEND_GL_ZERO;
- }
- return func;
-}
-
-/**
- * Sets both the blend equation and the blend function.
- * This is done in a single
- * function because some blend equations (i.e., \c GL_MIN and \c GL_MAX)
- * change the interpretation of the blend function.
- * Also, make sure that blend function and blend equation are set to their default
- * value if color blending is not enabled, since at least blend equations GL_MIN
- * and GL_FUNC_REVERSE_SUBTRACT will cause wrong results otherwise for
- * unknown reasons.
- */
-
-/* helper function */
-static void r300_set_blend_cntl(r300ContextPtr r300, int func, int eqn, int cbits, int funcA, int eqnA)
-{
- GLuint new_ablend, new_cblend;
-
-#if 0
- fprintf(stderr, "eqnA=%08x funcA=%08x eqn=%08x func=%08x cbits=%08x\n", eqnA, funcA, eqn, func, cbits);
-#endif
- new_ablend = eqnA | funcA;
- new_cblend = eqn | func;
-
- /* Some blend factor combinations don't seem to work when the
- * BLEND_NO_SEPARATE bit is set.
- *
- * Especially problematic candidates are the ONE_MINUS_* flags,
- * but I can't see a real pattern.
- */
-#if 0
- if (new_ablend == new_cblend) {
- new_cblend |= R300_BLEND_NO_SEPARATE;
- }
-#endif
- new_cblend |= cbits;
-
- if((new_ablend != r300->hw.bld.cmd[R300_BLD_ABLEND]) ||
- (new_cblend != r300->hw.bld.cmd[R300_BLD_CBLEND])) {
- R300_STATECHANGE(r300, bld);
- r300->hw.bld.cmd[R300_BLD_ABLEND]=new_ablend;
- r300->hw.bld.cmd[R300_BLD_CBLEND]=new_cblend;
- }
-}
-
-
-static void r300_set_blend_state(GLcontext * ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- int func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT);
- int eqn = R200_COMB_FCN_ADD_CLAMP;
- int funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT);
- int eqnA = R200_COMB_FCN_ADD_CLAMP;
-
- if (ctx->Color._LogicOpEnabled || !ctx->Color.BlendEnabled) {
- r300_set_blend_cntl(r300,
- func, eqn, 0,
- func, eqn);
- return;
- }
-
- func = (blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE) << R200_SRC_BLEND_SHIFT) |
- (blend_factor(ctx->Color.BlendDstRGB, GL_FALSE) << R200_DST_BLEND_SHIFT);
-
- switch (ctx->Color.BlendEquationRGB) {
- case GL_FUNC_ADD:
- eqn = R300_COMB_FCN_ADD_CLAMP;
- break;
-
- case GL_FUNC_SUBTRACT:
- eqn = R300_COMB_FCN_SUB_CLAMP;
- break;
-
- case GL_FUNC_REVERSE_SUBTRACT:
- eqn = R200_COMB_FCN_RSUB_CLAMP;
- break;
-
- case GL_MIN:
- eqn = R200_COMB_FCN_MIN;
- func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- case GL_MAX:
- eqn = R200_COMB_FCN_MAX;
- func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- default:
- fprintf(stderr,
- "[%s:%u] Invalid RGB blend equation (0x%04x).\n",
- __func__, __LINE__, ctx->Color.BlendEquationRGB);
- return;
- }
-
-
- funcA = (blend_factor(ctx->Color.BlendSrcA, GL_TRUE) << R200_SRC_BLEND_SHIFT) |
- (blend_factor(ctx->Color.BlendDstA, GL_FALSE) << R200_DST_BLEND_SHIFT);
-
- switch (ctx->Color.BlendEquationA) {
- case GL_FUNC_ADD:
- eqnA = R300_COMB_FCN_ADD_CLAMP;
- break;
-
- case GL_FUNC_SUBTRACT:
- eqnA = R300_COMB_FCN_SUB_CLAMP;
- break;
-
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnA = R200_COMB_FCN_RSUB_CLAMP;
- break;
-
- case GL_MIN:
- eqnA = R200_COMB_FCN_MIN;
- funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- case GL_MAX:
- eqnA = R200_COMB_FCN_MAX;
- funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
- break;
-
- default:
- fprintf(stderr, "[%s:%u] Invalid A blend equation (0x%04x).\n",
- __func__, __LINE__, ctx->Color.BlendEquationA);
- return;
- }
-
- r300_set_blend_cntl(r300,
- func, eqn, R300_BLEND_UNKNOWN | R300_BLEND_ENABLE,
- funcA, eqnA);
-}
-
-static void r300BlendEquationSeparate(GLcontext * ctx,
- GLenum modeRGB, GLenum modeA)
-{
- r300_set_blend_state(ctx);
-}
-
-static void r300BlendFuncSeparate(GLcontext * ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA)
-{
- r300_set_blend_state(ctx);
-}
-
-/**
- * Update our tracked culling state based on Mesa's state.
- */
-static void r300UpdateCulling(GLcontext* ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- uint32_t val = 0;
-
- R300_STATECHANGE(r300, cul);
- if (ctx->Polygon.CullFlag) {
- if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
- val = R300_CULL_FRONT|R300_CULL_BACK;
- else if (ctx->Polygon.CullFaceMode == GL_FRONT)
- val = R300_CULL_FRONT;
- else
- val = R300_CULL_BACK;
-
- if (ctx->Polygon.FrontFace == GL_CW)
- val |= R300_FRONT_FACE_CW;
- else
- val |= R300_FRONT_FACE_CCW;
- }
- r300->hw.cul.cmd[R300_CUL_CULL] = val;
-}
-
-static void update_early_z(GLcontext* ctx)
-{
- /* updates register 0x4f14
- if depth test is not enabled it should be 0x00000000
- if depth is enabled and alpha not it should be 0x00000001
- if depth and alpha is enabled it should be 0x00000000
- */
- r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- R300_STATECHANGE(r300, unk4F10);
- if (ctx->Color.AlphaEnabled)
- /* disable early Z */
- r300->hw.unk4F10.cmd[2] = 0x00000000;
- else {
- if (ctx->Depth.Test)
- /* enable early Z */
- r300->hw.unk4F10.cmd[2] = 0x00000001;
- else
- /* disable early Z */
- r300->hw.unk4F10.cmd[2] = 0x00000000;
- }
-}
-
-/**
- * Handle glEnable()/glDisable().
- *
- * \note Mesa already filters redundant calls to glEnable/glDisable.
- */
-static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- uint32_t newval;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s( %s = %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(cap),
- state ? "GL_TRUE" : "GL_FALSE");
-
- switch (cap) {
- /* Fast track this one...
- */
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- break;
-
- case GL_ALPHA_TEST:
- R300_STATECHANGE(r300, at);
- if (state) {
- r300->hw.at.cmd[R300_AT_ALPHA_TEST] |=
- R300_ALPHA_TEST_ENABLE;
- } else {
- r300->hw.at.cmd[R300_AT_ALPHA_TEST] &=
- ~R300_ALPHA_TEST_ENABLE;
- }
- update_early_z(ctx);
- break;
-
- case GL_BLEND:
- case GL_COLOR_LOGIC_OP:
- r300_set_blend_state(ctx);
- break;
-
- case GL_DEPTH_TEST:
- R300_STATECHANGE(r300, zs);
-
- if (state) {
- if (ctx->Depth.Mask)
- newval = R300_RB3D_Z_TEST_AND_WRITE;
- else
- newval = R300_RB3D_Z_TEST;
- } else
- newval = R300_RB3D_Z_DISABLED_1;
-
- r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE;
- r300->hw.zs.cmd[R300_ZS_CNTL_0] |= newval;
- update_early_z(ctx);
- break;
-
- case GL_STENCIL_TEST:
- WARN_ONCE("TODO - double side stencil !\n");
- if (r300->state.stencil.hw_stencil) {
- R300_STATECHANGE(r300, zs);
- if (state) {
- r300->hw.zs.cmd[R300_ZS_CNTL_0] |=
- R300_RB3D_STENCIL_ENABLE;
- } else {
- r300->hw.zs.cmd[R300_ZS_CNTL_0] &=
- ~R300_RB3D_STENCIL_ENABLE;
- }
- } else {
-#if R200_MERGED
- FALLBACK(&r300->radeon, RADEON_FALLBACK_STENCIL, state);
-#endif
- }
- break;
-
- case GL_CULL_FACE:
- r300UpdateCulling(ctx);
- break;
-
- case GL_POLYGON_OFFSET_POINT:
- case GL_POLYGON_OFFSET_LINE:
- break;
-
- case GL_POLYGON_OFFSET_FILL:
- R300_STATECHANGE(r300, unk42B4);
- if(state){
- r300->hw.unk42B4.cmd[1] |= (3<<0);
- } else {
- r300->hw.unk42B4.cmd[1] &= ~(3<<0);
- }
- break;
- default:
- radeonEnable(ctx, cap, state);
- return;
- }
-}
-
-
-static void r300UpdatePolygonMode(GLcontext *ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- uint32_t hw_mode=0;
-
- if (ctx->Polygon.FrontMode != GL_FILL ||
- ctx->Polygon.BackMode != GL_FILL) {
- GLenum f, b;
-
- if (ctx->Polygon.FrontFace == GL_CCW) {
- f = ctx->Polygon.FrontMode;
- b = ctx->Polygon.BackMode;
- } else {
- f = ctx->Polygon.BackMode;
- b = ctx->Polygon.FrontMode;
- }
-
- hw_mode |= R300_PM_ENABLED;
-
- switch (f) {
- case GL_LINE:
- hw_mode |= R300_PM_FRONT_LINE;
- break;
- case GL_POINT: /* noop */
- hw_mode |= R300_PM_FRONT_POINT;
- break;
- case GL_FILL:
- hw_mode |= R300_PM_FRONT_FILL;
- break;
- }
-
- switch (b) {
- case GL_LINE:
- hw_mode |= R300_PM_BACK_LINE;
- break;
- case GL_POINT: /* noop */
- hw_mode |= R300_PM_BACK_POINT;
- break;
- case GL_FILL:
- hw_mode |= R300_PM_BACK_FILL;
- break;
- }
- }
-
- if (r300->hw.unk4288.cmd[1] != hw_mode) {
- R300_STATECHANGE(r300, unk4288);
- r300->hw.unk4288.cmd[1] = hw_mode;
- }
-}
-
-/**
- * Change the culling mode.
- *
- * \note Mesa already filters redundant calls to this function.
- */
-static void r300CullFace(GLcontext* ctx, GLenum mode)
-{
- (void)mode;
-
- r300UpdateCulling(ctx);
-}
-
-
-/**
- * Change the polygon orientation.
- *
- * \note Mesa already filters redundant calls to this function.
- */
-static void r300FrontFace(GLcontext* ctx, GLenum mode)
-{
- (void)mode;
-
- r300UpdateCulling(ctx);
- r300UpdatePolygonMode(ctx);
-}
-
-
-/**
- * Change the depth testing function.
- *
- * \note Mesa already filters redundant calls to this function.
- */
-static void r300DepthFunc(GLcontext* ctx, GLenum func)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- R300_STATECHANGE(r300, zs);
-
- r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
-
- switch(func) {
- case GL_NEVER:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_NEVER << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- case GL_LESS:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_LESS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- case GL_EQUAL:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_EQUAL << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- case GL_LEQUAL:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_LEQUAL << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- case GL_GREATER:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_GREATER << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- case GL_NOTEQUAL:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_NOTEQUAL << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- case GL_GEQUAL:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_GEQUAL << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- case GL_ALWAYS:
- r300->hw.zs.cmd[R300_ZS_CNTL_1] |= R300_ZS_ALWAYS << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT;
- break;
- }
-}
-
-
-/**
- * Enable/Disable depth writing.
- *
- * \note Mesa already filters redundant calls to this function.
- */
-static void r300DepthMask(GLcontext* ctx, GLboolean mask)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- if (!ctx->Depth.Test)
- return;
-
- R300_STATECHANGE(r300, zs);
- r300->hw.zs.cmd[R300_ZS_CNTL_0] &= R300_RB3D_STENCIL_ENABLE;
- r300->hw.zs.cmd[R300_ZS_CNTL_0] |= mask
- ? R300_RB3D_Z_TEST_AND_WRITE : R300_RB3D_Z_TEST;
-}
-
-
-/**
- * Handle glColorMask()
- */
-static void r300ColorMask(GLcontext* ctx,
- GLboolean r, GLboolean g, GLboolean b, GLboolean a)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- int mask = (r ? R300_COLORMASK0_R : 0) |
- (g ? R300_COLORMASK0_G : 0) |
- (b ? R300_COLORMASK0_B : 0) |
- (a ? R300_COLORMASK0_A : 0);
-
- if (mask != r300->hw.cmk.cmd[R300_CMK_COLORMASK]) {
- R300_STATECHANGE(r300, cmk);
- r300->hw.cmk.cmd[R300_CMK_COLORMASK] = mask;
- }
-}
-
-/* =============================================================
- * Point state
- */
-static void r300PointSize(GLcontext * ctx, GLfloat size)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- size = ctx->Point._Size;
-
- R300_STATECHANGE(r300, ps);
- r300->hw.ps.cmd[R300_PS_POINTSIZE] =
- ((int)(size * 6) << R300_POINTSIZE_X_SHIFT) |
- ((int)(size * 6) << R300_POINTSIZE_Y_SHIFT);
-}
-
-/* =============================================================
- * Line state
- */
-static void r300LineWidth(GLcontext *ctx, GLfloat widthf)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- widthf = ctx->Line._Width;
-
- R300_STATECHANGE(r300, lcntl);
- r300->hw.lcntl.cmd[1] = (int)(widthf * 6.0);
- r300->hw.lcntl.cmd[1] |= R300_LINE_CNT_VE;
-}
-
-static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
-{
- (void)face;
- (void)mode;
-
- r300UpdatePolygonMode(ctx);
-}
-
-/* =============================================================
- * Stencil
- */
-
-static int translate_stencil_func(int func)
-{
- switch (func) {
- case GL_NEVER:
- return R300_ZS_NEVER;
- case GL_LESS:
- return R300_ZS_LESS;
- case GL_EQUAL:
- return R300_ZS_EQUAL;
- case GL_LEQUAL:
- return R300_ZS_LEQUAL;
- case GL_GREATER:
- return R300_ZS_GREATER;
- case GL_NOTEQUAL:
- return R300_ZS_NOTEQUAL;
- case GL_GEQUAL:
- return R300_ZS_GEQUAL;
- case GL_ALWAYS:
- return R300_ZS_ALWAYS;
- }
- return 0;
-}
-
-static int translate_stencil_op(int op)
-{
- switch (op) {
- case GL_KEEP:
- return R300_ZS_KEEP;
- case GL_ZERO:
- return R300_ZS_ZERO;
- case GL_REPLACE:
- return R300_ZS_REPLACE;
- case GL_INCR:
- return R300_ZS_INCR;
- case GL_DECR:
- return R300_ZS_DECR;
- case GL_INCR_WRAP_EXT:
- return R300_ZS_INCR_WRAP;
- case GL_DECR_WRAP_EXT:
- return R300_ZS_DECR_WRAP;
- case GL_INVERT:
- return R300_ZS_INVERT;
- default:
- WARN_ONCE("Do not know how to translate stencil op");
- return R300_ZS_KEEP;
- }
- return 0;
-}
-
-static void r300ShadeModel(GLcontext * ctx, GLenum mode)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- R300_STATECHANGE(rmesa, unk4274);
- switch (mode) {
- case GL_FLAT:
- rmesa->hw.unk4274.cmd[2] = R300_RE_SHADE_MODEL_FLAT;
- break;
- case GL_SMOOTH:
- rmesa->hw.unk4274.cmd[2] = R300_RE_SHADE_MODEL_SMOOTH;
- break;
- default:
- return;
- }
-}
-
-static void r300StencilFunc(GLcontext * ctx, GLenum func,
- GLint ref, GLuint mask)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref[0] << R300_RB3D_ZS2_STENCIL_REF_SHIFT) |
- (ctx->Stencil.ValueMask[0] << R300_RB3D_ZS2_STENCIL_MASK_SHIFT));
-
- GLuint flag;
-
- R300_STATECHANGE(rmesa, zs);
-
- rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(
- (R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT)
- | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT));
-
- rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= ~((R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_REF_SHIFT) |
- (R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_MASK_SHIFT));
-
- flag = translate_stencil_func(ctx->Stencil.Function[0]);
-
- rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |= (flag << R300_RB3D_ZS1_FRONT_FUNC_SHIFT)
- | (flag << R300_RB3D_ZS1_BACK_FUNC_SHIFT);
- rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= refmask;
-}
-
-static void r300StencilMask(GLcontext * ctx, GLuint mask)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- R300_STATECHANGE(rmesa, zs);
- rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= ~(R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT);
- rmesa->hw.zs.cmd[R300_ZS_CNTL_2] |= ctx->Stencil.WriteMask[0] << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT;
-}
-
-
-static void r300StencilOp(GLcontext * ctx, GLenum fail,
- GLenum zfail, GLenum zpass)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- R300_STATECHANGE(rmesa, zs);
- /* It is easier to mask what's left.. */
- rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &=
- (R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT) |
- (R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
- (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT);
-
- rmesa->hw.zs.cmd[R300_ZS_CNTL_1] |=
- (translate_stencil_op(ctx->Stencil.FailFunc[0]) << R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT)
- |(translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT)
- |(translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT)
- |(translate_stencil_op(ctx->Stencil.FailFunc[0]) << R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT)
- |(translate_stencil_op(ctx->Stencil.ZFailFunc[0]) << R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT)
- |(translate_stencil_op(ctx->Stencil.ZPassFunc[0]) << R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT);
-}
-
-static void r300ClearStencil(GLcontext * ctx, GLint s)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- rmesa->state.stencil.clear =
- ((GLuint) ctx->Stencil.Clear |
- (R300_RB3D_ZS2_STENCIL_MASK << R300_RB3D_ZS2_STENCIL_MASK_SHIFT) |
- (ctx->Stencil.WriteMask[0] << R300_RB3D_ZS2_STENCIL_WRITE_MASK_SHIFT));
-}
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-/*
- * To correctly position primitives:
- */
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-static void r300UpdateWindow(GLcontext * ctx)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable;
- GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0;
- GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
- GLfloat sy = -v[MAT_SY];
- GLfloat ty = (-v[MAT_TY]) + yoffset + SUBPIXEL_Y;
- GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
- GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
-
- R300_FIREVERTICES(rmesa);
- R300_STATECHANGE(rmesa, vpt);
-
- rmesa->hw.vpt.cmd[R300_VPT_XSCALE] = r300PackFloat32(sx);
- rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(tx);
- rmesa->hw.vpt.cmd[R300_VPT_YSCALE] = r300PackFloat32(sy);
- rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(ty);
- rmesa->hw.vpt.cmd[R300_VPT_ZSCALE] = r300PackFloat32(sz);
- rmesa->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(tz);
-}
-
-static void r300Viewport(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height)
-{
- /* Don't pipeline viewport changes, conflict with window offset
- * setting below. Could apply deltas to rescue pipelined viewport
- * values, or keep the originals hanging around.
- */
- R300_FIREVERTICES(R300_CONTEXT(ctx));
- r300UpdateWindow(ctx);
-}
-
-static void r300DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval)
-{
- r300UpdateWindow(ctx);
-}
-
-/* =============================================================
- * Polygon state
- */
-static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- GLfloat constant = units;
-
- switch (ctx->Visual.depthBits) {
- case 16:
- constant *= 4.0;
- break;
- case 24:
- constant *= 2.0;
- break;
- }
-
- factor *= 12.0;
-
-/* fprintf(stderr, "%s f:%f u:%f\n", __FUNCTION__, factor, constant); */
-
- R300_STATECHANGE(rmesa, zbs);
- rmesa->hw.zbs.cmd[R300_ZBS_T_FACTOR] = r300PackFloat32(factor);
- rmesa->hw.zbs.cmd[R300_ZBS_T_CONSTANT] = r300PackFloat32(constant);
- rmesa->hw.zbs.cmd[R300_ZBS_W_FACTOR] = r300PackFloat32(factor);
- rmesa->hw.zbs.cmd[R300_ZBS_W_CONSTANT] = r300PackFloat32(constant);
-}
-
-/* Routing and texture-related */
-
-static r300TexObj default_tex_obj={
- filter:R300_TX_MAG_FILTER_LINEAR | R300_TX_MIN_FILTER_LINEAR,
- pitch: 0x8000,
- size: (0xff << R300_TX_WIDTHMASK_SHIFT)
- | (0xff << R300_TX_HEIGHTMASK_SHIFT)
- | (0x8 << R300_TX_SIZE_SHIFT),
- format: 0x88a0c,
- offset: 0x0,
- unknown4: 0x0,
- unknown5: 0x0
- };
-
- /* there is probably a system to these value, but, for now,
- we just try by hand */
-
-static int inline translate_src(int src)
-{
- switch (src) {
- case GL_TEXTURE:
- return 1;
- break;
- case GL_CONSTANT:
- return 2;
- break;
- case GL_PRIMARY_COLOR:
- return 3;
- break;
- case GL_PREVIOUS:
- return 4;
- break;
- case GL_ZERO:
- return 5;
- break;
- case GL_ONE:
- return 6;
- break;
- default:
- return 0;
- }
-}
-
-/* r300 doesnt handle GL_CLAMP and GL_MIRROR_CLAMP_EXT correctly when filter is NEAREST.
- * Since texwrap produces same results for GL_CLAMP and GL_CLAMP_TO_EDGE we use them instead.
- * We need to recalculate wrap modes whenever filter mode is changed because someone might do:
- * glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- * glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- * glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- * Since r300 completely ignores R300_TX_CLAMP when either min or mag is nearest it cant handle
- * combinations where only one of them is nearest.
- */
-static unsigned long gen_fixed_filter(unsigned long f)
-{
- unsigned long mag, min, needs_fixing=0;
- //return f;
-
- /* We ignore MIRROR bit so we dont have to do everything twice */
- if((f & ((7-1) << R300_TX_WRAP_S_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_S_SHIFT)){
- needs_fixing |= 1;
- }
- if((f & ((7-1) << R300_TX_WRAP_T_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_T_SHIFT)){
- needs_fixing |= 2;
- }
- if((f & ((7-1) << R300_TX_WRAP_Q_SHIFT)) == (R300_TX_CLAMP << R300_TX_WRAP_Q_SHIFT)){
- needs_fixing |= 4;
- }
-
- if(!needs_fixing)
- return f;
-
- mag=f & R300_TX_MAG_FILTER_MASK;
- min=f & R300_TX_MIN_FILTER_MASK;
-
- /* TODO: Check for anisto filters too */
- if((mag != R300_TX_MAG_FILTER_NEAREST) && (min != R300_TX_MIN_FILTER_NEAREST))
- return f;
-
- /* r300 cant handle these modes hence we force nearest to linear */
- if((mag == R300_TX_MAG_FILTER_NEAREST) && (min != R300_TX_MIN_FILTER_NEAREST)){
- f &= ~R300_TX_MAG_FILTER_NEAREST;
- f |= R300_TX_MAG_FILTER_LINEAR;
- return f;
- }
-
- if((min == R300_TX_MIN_FILTER_NEAREST) && (mag != R300_TX_MAG_FILTER_NEAREST)){
- f &= ~R300_TX_MIN_FILTER_NEAREST;
- f |= R300_TX_MIN_FILTER_LINEAR;
- return f;
- }
-
- /* Both are nearest */
- if(needs_fixing & 1){
- f &= ~((7-1) << R300_TX_WRAP_S_SHIFT);
- f |= R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_S_SHIFT;
- }
- if(needs_fixing & 2){
- f &= ~((7-1) << R300_TX_WRAP_T_SHIFT);
- f |= R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_T_SHIFT;
- }
- if(needs_fixing & 4){
- f &= ~((7-1) << R300_TX_WRAP_Q_SHIFT);
- f |= R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_Q_SHIFT;
- }
- return f;
-}
-
-void r300_setup_textures(GLcontext *ctx)
-{
- int i, mtu;
- struct r300_tex_obj *t;
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- int max_texture_unit=-1; /* -1 translates into no setup costs for fields */
- struct gl_texture_unit *texUnit;
- GLuint OutputsWritten;
-
- if(hw_tcl_on)
- OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
-
- R300_STATECHANGE(r300, txe);
- R300_STATECHANGE(r300, tex.filter);
- R300_STATECHANGE(r300, tex.unknown1);
- R300_STATECHANGE(r300, tex.size);
- R300_STATECHANGE(r300, tex.format);
- R300_STATECHANGE(r300, tex.offset);
- R300_STATECHANGE(r300, tex.unknown4);
- R300_STATECHANGE(r300, tex.border_color);
-
- r300->hw.txe.cmd[R300_TXE_ENABLE]=0x0;
-
- mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "mtu=%d\n", mtu);
-
- if(mtu > R300_MAX_TEXTURE_UNITS) {
- fprintf(stderr, "Aiiee ! mtu=%d is greater than R300_MAX_TEXTURE_UNITS=%d\n",
- mtu, R300_MAX_TEXTURE_UNITS);
- exit(-1);
- }
-
- for(i=0; i < mtu; i++) {
- /*if( ((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0) != ((ctx->Texture.Unit[i].Enabled)!=0) ) {
- WARN_ONCE("Mismatch between render_inputs and ctx->Texture.Unit[i].Enabled value(%d vs %d).\n",
- ((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0), ((ctx->Texture.Unit[i].Enabled)!=0));
- }*/
-
- if(TMU_ENABLED(ctx, i)) {
- t=r300->state.texture.unit[i].texobj;
- //fprintf(stderr, "format=%08x\n", r300->state.texture.unit[i].format);
-
- if(t == NULL){
- fprintf(stderr, "Texture unit %d enabled, but corresponding texobj is NULL, using default object.\n", i);
- //exit(-1);
- t=&default_tex_obj;
- }
-
- //fprintf(stderr, "t->format=%08x\n", t->format);
- if((t->format & 0xffffff00)==0xffffff00) {
- WARN_ONCE("unknown texture format (entry %x) encountered. Help me !\n", t->format & 0xff);
- //fprintf(stderr, "t->format=%08x\n", t->format);
- }
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "Activating texture unit %d\n", i);
- max_texture_unit=i;
- r300->hw.txe.cmd[R300_TXE_ENABLE]|=(1<<i);
-
- r300->hw.tex.filter.cmd[R300_TEX_VALUE_0+i]=gen_fixed_filter(t->filter) | (i << 28);
- //r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+i]=0x0; /* move lod bias here? */
-
- /* No idea why linear filtered textures shake when puting random data */
- /*r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+i]=(rand()%0xffffffff) & (~0x1fff);*/
- r300->hw.tex.size.cmd[R300_TEX_VALUE_0+i]=t->size;
- r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=t->format;
- //fprintf(stderr, "t->format=%08x\n", t->format);
- r300->hw.tex.offset.cmd[R300_TEX_VALUE_0+i]=t->offset;
- r300->hw.tex.unknown4.cmd[R300_TEX_VALUE_0+i]=0x0;
- r300->hw.tex.border_color.cmd[R300_TEX_VALUE_0+i]=t->pp_border_color;
- }
- }
-
- ((drm_r300_cmd_header_t*)r300->hw.tex.filter.cmd)->packet0.count = max_texture_unit+1;
- ((drm_r300_cmd_header_t*)r300->hw.tex.unknown1.cmd)->packet0.count = max_texture_unit+1;
- ((drm_r300_cmd_header_t*)r300->hw.tex.size.cmd)->packet0.count = max_texture_unit+1;
- ((drm_r300_cmd_header_t*)r300->hw.tex.format.cmd)->packet0.count = max_texture_unit+1;
- ((drm_r300_cmd_header_t*)r300->hw.tex.offset.cmd)->packet0.count = max_texture_unit+1;
- ((drm_r300_cmd_header_t*)r300->hw.tex.unknown4.cmd)->packet0.count = max_texture_unit+1;
- ((drm_r300_cmd_header_t*)r300->hw.tex.border_color.cmd)->packet0.count = max_texture_unit+1;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "TX_ENABLE: %08x max_texture_unit=%d\n", r300->hw.txe.cmd[R300_TXE_ENABLE], max_texture_unit);
-}
-
-#if USE_ARB_F_P == 1
-void r300_setup_rs_unit(GLcontext *ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- /* I'm still unsure if these are needed */
- GLuint interp_magic[8] = {
- 0x00,
- 0x40,
- 0x80,
- 0xC0,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- };
- GLuint OutputsWritten;
- GLuint InputsRead;
- int vp_reg, fp_reg, high_rr;
- int in_texcoords, col_interp_nr;
- int i;
-
- if(hw_tcl_on)
- OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
- else
- OutputsWritten = r300->state.render_inputs;
-
- if (ctx->FragmentProgram._Current)
- InputsRead = ctx->FragmentProgram._Current->InputsRead;
- else {
- fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
- return; /* This should only ever happen once.. */
- }
-
- R300_STATECHANGE(r300, ri);
- R300_STATECHANGE(r300, rc);
- R300_STATECHANGE(r300, rr);
-
- vp_reg = fp_reg = in_texcoords = col_interp_nr = high_rr = 0;
- r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
- r300->hw.rr.cmd[R300_RR_ROUTE_1] = 0;
-
- for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
- if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i)))
- in_texcoords++;
-
- r300->hw.ri.cmd[R300_RI_INTERP_0+i] = 0
- | R300_RS_INTERP_USED
- | (vp_reg << R300_RS_INTERP_SRC_SHIFT)
- | interp_magic[i];
-
- if (InputsRead & (FRAG_BIT_TEX0<<i)) {
- //assert(r300->state.texture.tc_count != 0);
- r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] = 0
- | R300_RS_ROUTE_ENABLE
- | i /* source INTERP */
- | (fp_reg << R300_RS_ROUTE_DEST_SHIFT);
- high_rr = fp_reg;
-
- if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i))) {
- vp_reg++;
- } else {
- /* Unsure of how to handle this situation, for now print errors and
- * the program will just recieve bogus data
- */
- fprintf(stderr, "fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
- }
- InputsRead &= ~(FRAG_BIT_TEX0<<i);
- fp_reg++;
- }
- }
-
- if (InputsRead & FRAG_BIT_COL0) {
- if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL0) : _TNL_BIT_COLOR0)))
- fprintf(stderr, "fragprog wants col0, vp doesn't provide it\n");
-
- r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
- | R300_RS_ROUTE_0_COLOR
- | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
- InputsRead &= ~FRAG_BIT_COL0;
- col_interp_nr++;
- }
-
- if (InputsRead & FRAG_BIT_COL1) {
- if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL1) : _TNL_BIT_COLOR1)))
- fprintf(stderr, "fragprog wants col1, vp doesn't provide it\n");
-
- r300->hw.rr.cmd[R300_RR_ROUTE_1] |= R300_RS_ROUTE_1_UNKNOWN11
- | R300_RS_ROUTE_1_COLOR1
- | (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT);
- InputsRead &= ~FRAG_BIT_COL1;
- if (high_rr < 1) high_rr = 1;
- col_interp_nr++;
- }
-
- r300->hw.rc.cmd[1] = 0
- | (in_texcoords << R300_RS_CNTL_TC_CNT_SHIFT)
- | (col_interp_nr << R300_RS_CNTL_CI_CNT_SHIFT)
- | R300_RS_CNTL_0_UNKNOWN_18;
-
- assert(high_rr >= 0);
- r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, high_rr+1);
- r300->hw.rc.cmd[2] = 0xC0 | high_rr;
-
- if (InputsRead)
- WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
-}
-#else
-void r300_setup_rs_unit(GLcontext *ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- int i, cur_reg;
- /* I'm still unsure if these are needed */
- GLuint interp_magic[8] = {
- 0x00,
- 0x40,
- 0x80,
- 0xC0,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- };
- GLuint OutputsWritten;
-
- if(hw_tcl_on)
- OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
-
- /* This needs to be rewritten - it is a hack at best */
-
- R300_STATECHANGE(r300, ri);
- R300_STATECHANGE(r300, rc);
- R300_STATECHANGE(r300, rr);
-
- cur_reg = 0;
- r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
-
- for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
- r300->hw.ri.cmd[R300_RI_INTERP_0+i] = 0
- | R300_RS_INTERP_USED
- | (cur_reg << R300_RS_INTERP_SRC_SHIFT)
- | interp_magic[i];
-// fprintf(stderr, "RS_INTERP[%d] = 0x%x\n", i, r300->hw.ri.cmd[R300_RI_INTERP_0+i]);
-
- if (TMU_ENABLED(ctx, i)) {
- assert(r300->state.texture.tc_count != 0);
- r300->hw.rr.cmd[R300_RR_ROUTE_0 + cur_reg] = 0
- | R300_RS_ROUTE_ENABLE
- | i /* source INTERP */
- | (cur_reg << R300_RS_ROUTE_DEST_SHIFT);
-// fprintf(stderr, "RS_ROUTE[%d] = 0x%x\n", cur_reg, r300->hw.rr.cmd[R300_RR_ROUTE_0 + cur_reg]);
- cur_reg++;
- }
- }
- if (hw_tcl_on ? OutputsWritten & (1<<VERT_RESULT_COL0) : r300->state.render_inputs & _TNL_BIT_COLOR0)
- r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
- | R300_RS_ROUTE_0_COLOR
- | (cur_reg << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
-
-// fprintf(stderr, "ADJ_RR0 = 0x%x\n", r300->hw.rr.cmd[R300_RR_ROUTE_0]);
-
- r300->hw.rc.cmd[1] = 0
- | (cur_reg /* count */ << R300_RS_CNTL_TC_CNT_SHIFT)
- | R300_RS_CNTL_0_UNKNOWN_7
- | R300_RS_CNTL_0_UNKNOWN_18;
-
- if (r300->state.texture.tc_count > 0) {
- r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, cur_reg);
- r300->hw.rc.cmd[2] = 0xC0 | (cur_reg-1); /* index of highest */
- } else {
- r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1);
- r300->hw.rc.cmd[2] = 0x0;
- }
-
-
-// fprintf(stderr, "rendering with %d texture co-ordinate sets\n", cur_reg);
-}
-#endif // USE_ARB_F_P
-
-#define vpucount(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
-
-#define bump_vpu_count(ptr, new_count) do{\
- drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr));\
- int _nc=(new_count)/4; \
- if(_nc>_p->vpu.count)_p->vpu.count=_nc;\
- }while(0)
-
-void static inline setup_vertex_shader_fragment(r300ContextPtr r300, int dest, struct r300_vertex_shader_fragment *vsf)
-{
- int i;
-
- if(vsf->length==0)return;
-
- if(vsf->length & 0x3){
- fprintf(stderr,"VERTEX_SHADER_FRAGMENT must have length divisible by 4\n");
- exit(-1);
- }
-
- switch((dest>>8) & 0xf){
- case 0:
- R300_STATECHANGE(r300, vpi);
- for(i=0;i<vsf->length;i++)
- r300->hw.vpi.cmd[R300_VPI_INSTR_0+i+4*(dest & 0xff)]=(vsf->body.d[i]);
- bump_vpu_count(r300->hw.vpi.cmd, vsf->length+4*(dest & 0xff));
- break;
-
- case 2:
- R300_STATECHANGE(r300, vpp);
- for(i=0;i<vsf->length;i++)
- r300->hw.vpp.cmd[R300_VPP_PARAM_0+i+4*(dest & 0xff)]=(vsf->body.d[i]);
- bump_vpu_count(r300->hw.vpp.cmd, vsf->length+4*(dest & 0xff));
- break;
- case 4:
- R300_STATECHANGE(r300, vps);
- for(i=0;i<vsf->length;i++)
- r300->hw.vps.cmd[1+i+4*(dest & 0xff)]=(vsf->body.d[i]);
- bump_vpu_count(r300->hw.vps.cmd, vsf->length+4*(dest & 0xff));
- break;
- default:
- fprintf(stderr, "%s:%s don't know how to handle dest %04x\n", __FILE__, __FUNCTION__, dest);
- exit(-1);
- }
-}
-
-void r300SetupVertexProgram(r300ContextPtr rmesa);
-
-/* just a skeleton for now.. */
-
-/* Generate a vertex shader that simply transforms vertex and texture coordinates,
- while leaving colors intact. Nothing fancy (like lights)
-
- If implementing lights make a copy first, so it is easy to switch between the two versions */
-static void r300GenerateSimpleVertexShader(r300ContextPtr r300)
-{
- int i;
- GLuint o_reg = 0;
-
- /* Allocate parameters */
- r300->state.vap_param.transform_offset=0x0; /* transform matrix */
- r300->state.vertex_shader.param_offset=0x0;
- r300->state.vertex_shader.param_count=0x4; /* 4 vector values - 4x4 matrix */
-
- r300->state.vertex_shader.program_start=0x0;
- r300->state.vertex_shader.unknown_ptr1=0x4; /* magic value ? */
- r300->state.vertex_shader.program_end=0x0;
-
- r300->state.vertex_shader.unknown_ptr2=0x0; /* magic value */
- r300->state.vertex_shader.unknown_ptr3=0x4; /* magic value */
-
- /* Initialize matrix and vector parameters.. these should really be restructured */
- /* TODO: fix vertex_shader structure */
- r300->state.vertex_shader.matrix[0].length=16;
- r300->state.vertex_shader.matrix[1].length=0;
- r300->state.vertex_shader.matrix[2].length=0;
- r300->state.vertex_shader.vector[0].length=0;
- r300->state.vertex_shader.vector[1].length=0;
- r300->state.vertex_shader.unknown1.length=0;
- r300->state.vertex_shader.unknown2.length=0;
-
-#define WRITE_OP(oper,source1,source2,source3) {\
- r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].op=(oper); \
- r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src1=(source1); \
- r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src2=(source2); \
- r300->state.vertex_shader.program.body.i[r300->state.vertex_shader.program_end].src3=(source3); \
- r300->state.vertex_shader.program_end++; \
- }
-
- /* Multiply vertex coordinates with transform matrix */
-
- WRITE_OP(
- EASY_VSF_OP(MUL, 0, ALL, TMP),
- VSF_PARAM(3),
- VSF_ATTR_W(0),
- EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE)
- )
-
- WRITE_OP(
- EASY_VSF_OP(MUL, 1, ALL, RESULT),
- VSF_REG(1),
- VSF_ATTR_UNITY(1),
- VSF_UNITY(1)
- )
-
- WRITE_OP(
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(2),
- VSF_ATTR_Z(0),
- VSF_TMP(0)
- )
-
- WRITE_OP(
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(1),
- VSF_ATTR_Y(0),
- VSF_TMP(0)
- )
-
- WRITE_OP(
- EASY_VSF_OP(MAD, 0, ALL, RESULT),
- VSF_PARAM(0),
- VSF_ATTR_X(0),
- VSF_TMP(0)
- )
- o_reg += 2;
-
- if (r300->state.render_inputs & _TNL_BIT_COLOR1) {
- WRITE_OP(
- EASY_VSF_OP(MUL, o_reg++, ALL, RESULT),
- VSF_REG(r300->state.vap_reg.i_color[1]),
- VSF_ATTR_UNITY(r300->state.vap_reg.i_color[1]),
- VSF_UNITY(r300->state.vap_reg.i_color[1])
- )
- }
-
- /* Pass through texture coordinates, if any */
- for(i=0;i < r300->radeon.glCtx->Const.MaxTextureUnits;i++)
- if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i)){
- // fprintf(stderr, "i_tex[%d]=%d\n", i, r300->state.vap_reg.i_tex[i]);
- WRITE_OP(
- EASY_VSF_OP(MUL, o_reg++ /* 2+i */, ALL, RESULT),
- VSF_REG(r300->state.vap_reg.i_tex[i]),
- VSF_ATTR_UNITY(r300->state.vap_reg.i_tex[i]),
- VSF_UNITY(r300->state.vap_reg.i_tex[i])
- )
- }
-
- r300->state.vertex_shader.program_end--; /* r300 wants program length to be one more - no idea why */
- r300->state.vertex_shader.program.length=(r300->state.vertex_shader.program_end+1)*4;
-
- r300->state.vertex_shader.unknown_ptr1=r300->state.vertex_shader.program_end; /* magic value ? */
- r300->state.vertex_shader.unknown_ptr2=r300->state.vertex_shader.program_end; /* magic value ? */
- r300->state.vertex_shader.unknown_ptr3=r300->state.vertex_shader.program_end; /* magic value ? */
-
-}
-
-
-void r300SetupVertexShader(r300ContextPtr rmesa)
-{
- GLcontext* ctx = rmesa->radeon.glCtx;
- struct r300_vertex_shader_fragment unk4={
- length: 4,
- body: { f: {
- /*0.0*/(rand()%100)/10.0,
- /*0.0*/(rand()%100)/10.0,
- /*1.0*/(rand()%100)/10.0,
- /*0.0*/(rand()%100)/10.0
- } }
- };
- LOCAL_VARS
-
- /* Reset state, in case we don't use something */
- ((drm_r300_cmd_header_t*)rmesa->hw.vpp.cmd)->vpu.count = 0;
- ((drm_r300_cmd_header_t*)rmesa->hw.vpi.cmd)->vpu.count = 0;
- ((drm_r300_cmd_header_t*)rmesa->hw.vps.cmd)->vpu.count = 0;
-
- /* Not sure why this doesnt work...
- 0x400 area might have something to do with pixel shaders as it appears right after pfs programming.
- 0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */
- //setup_vertex_shader_fragment(rmesa, 0x406, &unk4);
- if(hw_tcl_on && ((struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx))->translated){
- r300SetupVertexProgram(rmesa);
- return ;
- }
-
-/* This needs to be replaced by vertex shader generation code */
-
-
-#if 0
- /* textures enabled ? */
- if(rmesa->state.texture.tc_count>0){
- rmesa->state.vertex_shader=SINGLE_TEXTURE_VERTEX_SHADER;
- } else {
- rmesa->state.vertex_shader=FLAT_COLOR_VERTEX_SHADER;
- }
-#endif
-
- r300GenerateSimpleVertexShader(rmesa);
-
- rmesa->state.vertex_shader.matrix[0].length=16;
- memcpy(rmesa->state.vertex_shader.matrix[0].body.f, ctx->_ModelProjectMatrix.m, 16*4);
-
- setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(rmesa->state.vertex_shader.program));
-
- setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX0, &(rmesa->state.vertex_shader.matrix[0]));
-#if 0
- setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX1, &(rmesa->state.vertex_shader.matrix[0]));
- setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX2, &(rmesa->state.vertex_shader.matrix[0]));
-
- setup_vertex_shader_fragment(rmesa, VSF_DEST_VECTOR0, &(rmesa->state.vertex_shader.vector[0]));
- setup_vertex_shader_fragment(rmesa, VSF_DEST_VECTOR1, &(rmesa->state.vertex_shader.vector[1]));
-#endif
-
-#if 0
- setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, &(rmesa->state.vertex_shader.unknown1));
- setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, &(rmesa->state.vertex_shader.unknown2));
-#endif
-
- R300_STATECHANGE(rmesa, pvs);
- rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(rmesa->state.vertex_shader.program_start << R300_PVS_CNTL_1_PROGRAM_START_SHIFT)
- | (rmesa->state.vertex_shader.unknown_ptr1 << R300_PVS_CNTL_1_POS_END_SHIFT)
- | (rmesa->state.vertex_shader.program_end << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
- rmesa->hw.pvs.cmd[R300_PVS_CNTL_2]=(rmesa->state.vertex_shader.param_offset << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT)
- | (rmesa->state.vertex_shader.param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
- rmesa->hw.pvs.cmd[R300_PVS_CNTL_3]=(rmesa->state.vertex_shader.unknown_ptr2 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT)
- | (rmesa->state.vertex_shader.unknown_ptr3 << 0);
-
- /* This is done for vertex shader fragments, but also needs to be done for vap_pvs,
- so I leave it as a reminder */
-#if 0
- reg_start(R300_VAP_PVS_WAITIDLE,0);
- e32(0x00000000);
-#endif
-}
-
-void r300SetupVertexProgram(r300ContextPtr rmesa)
-{
- GLcontext* ctx = rmesa->radeon.glCtx;
- int inst_count;
- int param_count;
- LOCAL_VARS
- struct r300_vertex_program *prog=(struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx);
-
-
- /* Reset state, in case we don't use something */
- ((drm_r300_cmd_header_t*)rmesa->hw.vpp.cmd)->vpu.count = 0;
- ((drm_r300_cmd_header_t*)rmesa->hw.vpi.cmd)->vpu.count = 0;
- ((drm_r300_cmd_header_t*)rmesa->hw.vps.cmd)->vpu.count = 0;
-
- r300VertexProgUpdateParams(ctx, prog);
-
- setup_vertex_shader_fragment(rmesa, VSF_DEST_PROGRAM, &(prog->program));
-
- setup_vertex_shader_fragment(rmesa, VSF_DEST_MATRIX0, &(prog->params));
-
-#if 0
- setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN1, &(rmesa->state.vertex_shader.unknown1));
- setup_vertex_shader_fragment(rmesa, VSF_DEST_UNKNOWN2, &(rmesa->state.vertex_shader.unknown2));
-#endif
-
- inst_count=prog->program.length/4 - 1;
- param_count=prog->params.length/4;
-
- R300_STATECHANGE(rmesa, pvs);
- rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT)
- | (inst_count/*pos_end*/ << R300_PVS_CNTL_1_POS_END_SHIFT)
- | (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
- rmesa->hw.pvs.cmd[R300_PVS_CNTL_2]=(0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT)
- | (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
- rmesa->hw.pvs.cmd[R300_PVS_CNTL_3]=(0/*rmesa->state.vertex_shader.unknown_ptr2*/ << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT)
- | (inst_count /*rmesa->state.vertex_shader.unknown_ptr3*/ << 0);
-
- /* This is done for vertex shader fragments, but also needs to be done for vap_pvs,
- so I leave it as a reminder */
-#if 0
- reg_start(R300_VAP_PVS_WAITIDLE,0);
- e32(0x00000000);
-#endif
-}
-
-/* This is probably wrong for some values, I need to test this
- * some more. Range checking would be a good idea also..
- *
- * But it works for most things. I'll fix it later if someone
- * else with a better clue doesn't
- */
-static unsigned int r300PackFloat24(float f)
-{
- float mantissa;
- int exponent;
- unsigned int float24 = 0;
-
- if (f == 0.0) return 0;
-
- mantissa = frexpf(f, &exponent);
-
- /* Handle -ve */
- if (mantissa < 0) {
- float24 |= (1<<23);
- mantissa = mantissa * -1.0;
- }
- /* Handle exponent, bias of 63 */
- exponent += 62;
- float24 |= (exponent << 16);
- /* Kill 7 LSB of mantissa */
- float24 |= (r300PackFloat32(mantissa) & 0x7FFFFF) >> 7;
-
- return float24;
-}
-
-#if USE_ARB_F_P == 1
-void r300SetupPixelShader(r300ContextPtr rmesa)
-{
- GLcontext *ctx = rmesa->radeon.glCtx;
- struct r300_fragment_program *rp =
- (struct r300_fragment_program *)ctx->FragmentProgram._Current;
- int i,k;
-
- if (!rp) /* should only happenen once, just after context is created */
- return;
-
- translate_fragment_shader(rp);
- if (!rp->translated) {
- fprintf(stderr, "%s: No valid fragment shader, exiting\n", __func__);
- exit(-1);
- }
-
- R300_STATECHANGE(rmesa, fpt);
- for(i=0;i<rp->tex.length;i++)
- rmesa->hw.fpt.cmd[R300_FPT_INSTR_0+i]=rp->tex.inst[i];
- rmesa->hw.fpt.cmd[R300_FPT_CMD_0]=cmdpacket0(R300_PFS_TEXI_0, rp->tex.length);
-
-#define OUTPUT_FIELD(st, reg, field) \
- R300_STATECHANGE(rmesa, st); \
- for(i=0;i<=rp->alu_end;i++) \
- rmesa->hw.st.cmd[R300_FPI_INSTR_0+i]=rp->alu.inst[i].field;\
- rmesa->hw.st.cmd[R300_FPI_CMD_0]=cmdpacket0(reg, rp->alu_end+1);
-
- OUTPUT_FIELD(fpi[0], R300_PFS_INSTR0_0, inst0);
- OUTPUT_FIELD(fpi[1], R300_PFS_INSTR1_0, inst1);
- OUTPUT_FIELD(fpi[2], R300_PFS_INSTR2_0, inst2);
- OUTPUT_FIELD(fpi[3], R300_PFS_INSTR3_0, inst3);
-#undef OUTPUT_FIELD
-
- R300_STATECHANGE(rmesa, fp);
- /* I just want to say, the way these nodes are stored.. weird.. */
- for (i=0,k=(4-(rp->cur_node+1));i<4;i++,k++) {
- if (i<(rp->cur_node+1)) {
- rmesa->hw.fp.cmd[R300_FP_NODE0+k]=
- (rp->node[i].alu_offset << R300_PFS_NODE_ALU_OFFSET_SHIFT)
- | (rp->node[i].alu_end << R300_PFS_NODE_ALU_END_SHIFT)
- | (rp->node[i].tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT)
- | (rp->node[i].tex_end << R300_PFS_NODE_TEX_END_SHIFT)
- | ( (k==3) ? R300_PFS_NODE_LAST_NODE : 0);
- } else {
- rmesa->hw.fp.cmd[R300_FP_NODE0+(3-i)] = 0;
- }
- }
-
- /* PFS_CNTL_0 */
- rmesa->hw.fp.cmd[R300_FP_CNTL0]=
- rp->cur_node
- | (rp->first_node_has_tex<<3);
- /* PFS_CNTL_1 */
- rmesa->hw.fp.cmd[R300_FP_CNTL1]=rp->max_temp_idx;
- /* PFS_CNTL_2 */
- rmesa->hw.fp.cmd[R300_FP_CNTL2]=
- (rp->alu_offset << R300_PFS_CNTL_ALU_OFFSET_SHIFT)
- | (rp->alu_end << R300_PFS_CNTL_ALU_END_SHIFT)
- | (rp->tex_offset << R300_PFS_CNTL_TEX_OFFSET_SHIFT)
- | (rp->tex_end << R300_PFS_CNTL_TEX_END_SHIFT);
-
- R300_STATECHANGE(rmesa, fpp);
- for(i=0;i<rp->const_nr;i++){
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+0]=r300PackFloat24(rp->constant[i][0]);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+1]=r300PackFloat24(rp->constant[i][1]);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+2]=r300PackFloat24(rp->constant[i][2]);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+3]=r300PackFloat24(rp->constant[i][3]);
- }
- rmesa->hw.fpp.cmd[R300_FPP_CMD_0]=cmdpacket0(R300_PFS_PARAM_0_X, rp->const_nr*4);
-}
-#else
-/* just a skeleton for now.. */
-void r300GenerateTexturePixelShader(r300ContextPtr r300)
-{
- int i, mtu;
- mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
- GLenum envMode;
- GLuint OutputsWritten = CURRENT_VERTEX_SHADER(r300->radeon.glCtx)->OutputsWritten;
-
- int tex_inst=0, alu_inst=0;
-
- for(i=0;i<mtu;i++){
- /* No need to proliferate {} */
- if(!TMU_ENABLED(r300->radeon.glCtx, i))continue;
-
- envMode = r300->radeon.glCtx->Texture.Unit[i].EnvMode;
- //fprintf(stderr, "envMode=%s\n", _mesa_lookup_enum_by_nr(envMode));
-
- /* Fetch textured pixel */
-
- r300->state.pixel_shader.program.tex.inst[tex_inst]=0x00018000;
- tex_inst++;
-
- switch(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeRGB){
- case GL_REPLACE:
- WARN_ONCE("ModeA==GL_REPLACE is possibly broken.\n");
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst0=
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst1=
- EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL);
- break;
- case GL_MODULATE:
- WARN_ONCE("ModeRGB==GL_MODULATE is possibly broken.\n");
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst0=
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst1=
- EASY_PFS_INSTR1(0, 0, 1, 0 | PFS_FLAG_CONST, NONE, ALL);
-
- break;
- default:
- WARN_ONCE("ModeRGB=%s is not implemented yet !\n",
- _mesa_lookup_enum_by_nr(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeRGB));
- /* PFS_NOP */
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst0=
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst1=
- EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL);
- }
- switch(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeA){
- case GL_REPLACE:
- WARN_ONCE("ModeA==GL_REPLACE is possibly broken.\n");
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst2=
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst3=
- EASY_PFS_INSTR3(0, 0, 0| PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT);
-
-#if 0
- fprintf(stderr, "numArgsA=%d sourceA[0]=%s op=%d\n",
- r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->_NumArgsA,
- _mesa_lookup_enum_by_nr(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->SourceA[0]),
- r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->OperandA[0]-GL_SRC_ALPHA);
-#endif
- break;
- case GL_MODULATE:
- WARN_ONCE("ModeA==GL_MODULATE is possibly broken.\n");
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst2=
- EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst3=
- EASY_PFS_INSTR3(0, 0, 1, 0 | PFS_FLAG_CONST, OUTPUT);
-
- break;
- default:
- WARN_ONCE("ModeA=%s is not implemented yet !\n",
- _mesa_lookup_enum_by_nr(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeA));
- /* PFS_NOP */
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst2=
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst3=
- EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT);
-
- }
-
- alu_inst++;
- }
-
- r300->state.pixel_shader.program.tex.length=tex_inst;
- r300->state.pixel_shader.program.tex_offset=0;
- r300->state.pixel_shader.program.tex_end=tex_inst-1;
-
-#if 0
- /* saturate last instruction, like i915 driver does */
- r300->state.pixel_shader.program.alu.inst[alu_inst-1].inst0|=R300_FPI0_OUTC_SAT;
- r300->state.pixel_shader.program.alu.inst[alu_inst-1].inst2|=R300_FPI2_OUTA_SAT;
-#endif
-
- r300->state.pixel_shader.program.alu.length=alu_inst;
- r300->state.pixel_shader.program.alu_offset=0;
- r300->state.pixel_shader.program.alu_end=alu_inst-1;
-}
-
-void r300SetupPixelShader(r300ContextPtr rmesa)
-{
-int i,k;
-
- /* This needs to be replaced by pixel shader generation code */
-
- /* textures enabled ? */
- if(rmesa->state.texture.tc_count>0){
-#if 1
- r300GenerateTextureFragmentShader(rmesa);
-#else
- rmesa->state.pixel_shader=SINGLE_TEXTURE_PIXEL_SHADER;
- r300GenerateTexturePixelShader(rmesa);
-#endif
- } else {
- rmesa->state.pixel_shader=FLAT_COLOR_PIXEL_SHADER;
- }
-
- R300_STATECHANGE(rmesa, fpt);
- for(i=0;i<rmesa->state.pixel_shader.program.tex.length;i++)
- rmesa->hw.fpt.cmd[R300_FPT_INSTR_0+i]=rmesa->state.pixel_shader.program.tex.inst[i];
- rmesa->hw.fpt.cmd[R300_FPT_CMD_0]=cmdpacket0(R300_PFS_TEXI_0, rmesa->state.pixel_shader.program.tex.length);
-
-#define OUTPUT_FIELD(st, reg, field) \
- R300_STATECHANGE(rmesa, st); \
- for(i=0;i<rmesa->state.pixel_shader.program.alu.length;i++) \
- rmesa->hw.st.cmd[R300_FPI_INSTR_0+i]=rmesa->state.pixel_shader.program.alu.inst[i].field;\
- rmesa->hw.st.cmd[R300_FPI_CMD_0]=cmdpacket0(reg, rmesa->state.pixel_shader.program.alu.length);
-
- OUTPUT_FIELD(fpi[0], R300_PFS_INSTR0_0, inst0);
- OUTPUT_FIELD(fpi[1], R300_PFS_INSTR1_0, inst1);
- OUTPUT_FIELD(fpi[2], R300_PFS_INSTR2_0, inst2);
- OUTPUT_FIELD(fpi[3], R300_PFS_INSTR3_0, inst3);
-#undef OUTPUT_FIELD
-
- R300_STATECHANGE(rmesa, fp);
- for(i=0;i<4;i++){
- rmesa->hw.fp.cmd[R300_FP_NODE0+i]=
- (rmesa->state.pixel_shader.program.node[i].alu_offset << R300_PFS_NODE_ALU_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.node[i].alu_end << R300_PFS_NODE_ALU_END_SHIFT)
- | (rmesa->state.pixel_shader.program.node[i].tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.node[i].tex_end << R300_PFS_NODE_TEX_END_SHIFT)
- | ( (i==3) ? R300_PFS_NODE_LAST_NODE : 0);
- }
-
- /* PFS_CNTL_0 */
- rmesa->hw.fp.cmd[R300_FP_CNTL0]=
- (rmesa->state.pixel_shader.program.active_nodes-1)
- | (rmesa->state.pixel_shader.program.first_node_has_tex<<3);
- /* PFS_CNTL_1 */
- rmesa->hw.fp.cmd[R300_FP_CNTL1]=rmesa->state.pixel_shader.program.temp_register_count;
- /* PFS_CNTL_2 */
- rmesa->hw.fp.cmd[R300_FP_CNTL2]=
- (rmesa->state.pixel_shader.program.alu_offset << R300_PFS_CNTL_ALU_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.alu_end << R300_PFS_CNTL_ALU_END_SHIFT)
- | (rmesa->state.pixel_shader.program.tex_offset << R300_PFS_CNTL_TEX_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.tex_end << R300_PFS_CNTL_TEX_END_SHIFT);
-
- R300_STATECHANGE(rmesa, fpp);
- for(i=0;i<rmesa->state.pixel_shader.param_length;i++){
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+0]=r300PackFloat32(rmesa->state.pixel_shader.param[i].x);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+1]=r300PackFloat32(rmesa->state.pixel_shader.param[i].y);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+2]=r300PackFloat32(rmesa->state.pixel_shader.param[i].z);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+3]=r300PackFloat32(rmesa->state.pixel_shader.param[i].w);
- }
- rmesa->hw.fpp.cmd[R300_FPP_CMD_0]=cmdpacket0(R300_PFS_PARAM_0_X, rmesa->state.pixel_shader.param_length);
-
-}
-#endif
-
-/**
- * Called by Mesa after an internal state update.
- */
-static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- _swrast_InvalidateState(ctx, new_state);
- _swsetup_InvalidateState(ctx, new_state);
- _ac_InvalidateState(ctx, new_state);
- _tnl_InvalidateState(ctx, new_state);
- _ae_invalidate_state(ctx, new_state);
-
- /* Go inefficiency! */
- r300ResetHwState(r300);
-}
-
-/* Checks that r300ResetHwState actually modifies all states.
- Should probably be burried in somewhere else as this file is getting longish. */
-static void verify_r300ResetHwState(r300ContextPtr r300, int stage)
-{
- struct r300_state_atom* atom;
- int i;
- drm_r300_cmd_header_t cmd;
-
- if(stage){ /* mess around with states */
- unsigned long fp1, cb1;
-
- fp1=r300->hw.fp.cmd[R300_FP_CMD_1]; /* some special cases... */
- cb1=r300->hw.cb.cmd[R300_CB_CMD_1];
-
- fprintf(stderr, "verify begin:\n");
-
- foreach(atom, &r300->hw.atomlist) {
- for(i=1; i < (*atom->check)(r300, atom); i++)
- atom->cmd[i]=0xdeadbeef;
- }
- r300->hw.fp.cmd[R300_FP_CMD_1]=fp1;
- r300->hw.cb.cmd[R300_CB_CMD_1]=cb1;
-
- foreach(atom, &r300->hw.atomlist) {
- cmd.u=atom->cmd[0];
- switch(cmd.header.cmd_type){
- case R300_CMD_PACKET0:
- case R300_CMD_VPU:
- case R300_CMD_PACKET3:
- case R300_CMD_END3D:
- case R300_CMD_CP_DELAY:
- case R300_CMD_DMA_DISCARD:
- break;
- default: fprintf(stderr, "unknown cmd_type %d in atom %s\n",
- cmd.header.cmd_type, atom->name);
- }
-
- }
- } else { /* check that they were set */
- foreach(atom, &r300->hw.atomlist) {
- for(i=1; i < (*atom->check)(r300, atom); i++)
- if(atom->cmd[i]==0xdeadbeef)
- fprintf(stderr, "atom %s is untouched\n", atom->name);
- }
- }
-}
-
-/**
- * Completely recalculates hardware state based on the Mesa state.
- */
-void r300ResetHwState(r300ContextPtr r300)
-{
- GLcontext* ctx = r300->radeon.glCtx;
- int i;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- //verify_r300ResetHwState(r300, 1);
-
- /* This is a place to initialize registers which
- have bitfields accessed by different functions
- and not all bits are used */
-#if 0
- /* initialize similiar to r200 */
- r300->hw.zs.cmd[R300_ZS_CNTL_0] = 0;
- r300->hw.zs.cmd[R300_ZS_CNTL_1] =
- (R300_ZS_ALWAYS << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
- (R300_ZS_KEEP << R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
- (R300_ZS_KEEP << R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) |
- (R300_ZS_KEEP << R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) |
- (R300_ZS_ALWAYS << R300_RB3D_ZS1_BACK_FUNC_SHIFT) |
- (R300_ZS_KEEP << R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) |
- (R300_ZS_KEEP << R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) |
- (R300_ZS_KEEP << R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT);
- r300->hw.zs.cmd[R300_ZS_CNTL_2] = 0x00ffff00;
-#endif
-
- /* go and compute register values from GL state */
-
- r300UpdateWindow(ctx);
-
- r300ColorMask(ctx,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- r300Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test);
- r300DepthMask(ctx, ctx->Depth.Mask);
- r300DepthFunc(ctx, ctx->Depth.Func);
-
- /* stencil */
- r300Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
- r300StencilMask(ctx, ctx->Stencil.WriteMask[0]);
- r300StencilFunc(ctx, ctx->Stencil.Function[0], ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]);
- r300StencilOp(ctx, ctx->Stencil.FailFunc[0], ctx->Stencil.ZFailFunc[0], ctx->Stencil.ZPassFunc[0]);
-
- r300UpdateCulling(ctx);
-
- r300UpdateTextureState(ctx);
-
-// r300_setup_routing(ctx, GL_TRUE);
- if(hw_tcl_on == GL_FALSE){
- r300EmitArrays(ctx, GL_TRUE); /* Just do the routing */
- r300_setup_textures(ctx);
- r300_setup_rs_unit(ctx);
-
- r300SetupVertexShader(r300);
- r300SetupPixelShader(r300);
- }
-
- r300_set_blend_state(ctx);
-
- r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
- r300Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled);
-
- /* Initialize magic registers
- TODO : learn what they really do, or get rid of
- those we don't have to touch */
- r300->hw.unk2080.cmd[1] = 0x0030045A; /* Dangerous */
-
- r300->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA
- | R300_VPORT_X_OFFSET_ENA
- | R300_VPORT_Y_SCALE_ENA
- | R300_VPORT_Y_OFFSET_ENA
- | R300_VPORT_Z_SCALE_ENA
- | R300_VPORT_Z_OFFSET_ENA
- | R300_VTX_W0_FMT;
- r300->hw.vte.cmd[2] = 0x00000008;
-
- r300->hw.unk2134.cmd[1] = 0x00FFFFFF;
- r300->hw.unk2134.cmd[2] = 0x00000000;
-#ifdef MESA_BIG_ENDIAN
- r300->hw.unk2140.cmd[1] = 0x00000002;
-#else
- r300->hw.unk2140.cmd[1] = 0x00000000;
-#endif
-
-#if 0 /* Done in setup routing */
- ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count = 1;
- r300->hw.vir[0].cmd[1] = 0x21030003;
-
- ((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count = 1;
- r300->hw.vir[1].cmd[1] = 0xF688F688;
-
- r300->hw.vic.cmd[R300_VIR_CNTL_0] = 0x00000001;
- r300->hw.vic.cmd[R300_VIR_CNTL_1] = 0x00000405;
-#endif
-
- r300->hw.unk21DC.cmd[1] = 0xAAAAAAAA;
-
- r300->hw.unk221C.cmd[1] = R300_221C_NORMAL;
-
- r300->hw.unk2220.cmd[1] = r300PackFloat32(1.0);
- r300->hw.unk2220.cmd[2] = r300PackFloat32(1.0);
- r300->hw.unk2220.cmd[3] = r300PackFloat32(1.0);
- r300->hw.unk2220.cmd[4] = r300PackFloat32(1.0);
-
- if (GET_CHIP(r300->radeon.radeonScreen) == RADEON_CHIP_R300)
- r300->hw.unk2288.cmd[1] = R300_2288_R300;
- else
- r300->hw.unk2288.cmd[1] = R300_2288_RV350;
-
-#if 0
- r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT
- | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
- r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */
-
-
- r300->hw.pvs.cmd[R300_PVS_CNTL_1] = 0;
- r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0;
- r300->hw.pvs.cmd[R300_PVS_CNTL_3] = 0;
-#endif
-
- r300->hw.gb_enable.cmd[1] = R300_GB_POINT_STUFF_ENABLE
- | R300_GB_LINE_STUFF_ENABLE
- | R300_GB_TRIANGLE_STUFF_ENABLE /*| R300_GB_UNK30*/;
-
- r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_0] = 0x66666666;
- r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_1] = 0x06666666;
- if (GET_CHIP(r300->radeon.radeonScreen) == RADEON_CHIP_R300)
- r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE
- | R300_GB_TILE_PIPE_COUNT_R300
- | R300_GB_TILE_SIZE_16;
- else if (GET_CHIP(r300->radeon.radeonScreen) == RADEON_CHIP_R420)
- r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE
- | R300_GB_TILE_PIPE_COUNT_R420
- | R300_GB_TILE_SIZE_16;
- else
- r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE
- | R300_GB_TILE_PIPE_COUNT_RV300
- | R300_GB_TILE_SIZE_16;
- r300->hw.gb_misc.cmd[R300_GB_MISC_SELECT] = 0x00000000;
- r300->hw.gb_misc.cmd[R300_GB_MISC_AA_CONFIG] = 0x00000000; /* No antialiasing */
-
- //r300->hw.txe.cmd[R300_TXE_ENABLE] = 0;
-
- r300->hw.unk4200.cmd[1] = r300PackFloat32(0.0);
- r300->hw.unk4200.cmd[2] = r300PackFloat32(0.0);
- r300->hw.unk4200.cmd[3] = r300PackFloat32(1.0);
- r300->hw.unk4200.cmd[4] = r300PackFloat32(1.0);
-
- r300->hw.unk4214.cmd[1] = 0x00050005;
-
- r300PointSize(ctx, 0.0);
-#if 0
- r300->hw.ps.cmd[R300_PS_POINTSIZE] = (6 << R300_POINTSIZE_X_SHIFT) |
- (6 << R300_POINTSIZE_Y_SHIFT);
-#endif
-
- r300->hw.unk4230.cmd[1] = 0x01800000;//18000006;
- r300->hw.unk4230.cmd[2] = 0x00020006;
- r300->hw.unk4230.cmd[3] = r300PackFloat32(1.0 / 192.0);
-
- r300LineWidth(ctx, 0.0);
-
- r300->hw.unk4260.cmd[1] = 0;
- r300->hw.unk4260.cmd[2] = r300PackFloat32(0.0);
- r300->hw.unk4260.cmd[3] = r300PackFloat32(1.0);
-
- r300->hw.unk4274.cmd[1] = 0x00000002;
- r300ShadeModel(ctx, ctx->Light.ShadeModel);
- r300->hw.unk4274.cmd[3] = 0x00000000;
- r300->hw.unk4274.cmd[4] = 0x00000000;
-
- r300PolygonMode(ctx, GL_FRONT, ctx->Polygon.FrontMode);
- r300PolygonMode(ctx, GL_BACK, ctx->Polygon.BackMode);
- r300->hw.unk4288.cmd[2] = 0x00000001;
- r300->hw.unk4288.cmd[3] = 0x00000000;
- r300->hw.unk4288.cmd[4] = 0x00000000;
- r300->hw.unk4288.cmd[5] = 0x00000000;
-
- r300->hw.unk42A0.cmd[1] = 0x00000000;
-
- r300PolygonOffset(ctx, ctx->Polygon.OffsetFactor, ctx->Polygon.OffsetUnits);
- r300Enable(ctx, GL_POLYGON_OFFSET_FILL, ctx->Polygon.OffsetFill);
-
- r300->hw.unk42C0.cmd[1] = 0x4B7FFFFF;
- r300->hw.unk42C0.cmd[2] = 0x00000000;
-
-
- r300->hw.unk43A4.cmd[1] = 0x0000001C;
- r300->hw.unk43A4.cmd[2] = 0x2DA49525;
-
- r300->hw.unk43E8.cmd[1] = 0x00FFFFFF;
-
-#if 0
- r300->hw.fp.cmd[R300_FP_CNTL0] = 0;
- r300->hw.fp.cmd[R300_FP_CNTL1] = 0;
- r300->hw.fp.cmd[R300_FP_CNTL2] = 0;
- r300->hw.fp.cmd[R300_FP_NODE0] = 0;
- r300->hw.fp.cmd[R300_FP_NODE1] = 0;
- r300->hw.fp.cmd[R300_FP_NODE2] = 0;
- r300->hw.fp.cmd[R300_FP_NODE3] = 0;
-#endif
-
- r300->hw.unk46A4.cmd[1] = 0x00001B01;
- r300->hw.unk46A4.cmd[2] = 0x00001B0F;
- r300->hw.unk46A4.cmd[3] = 0x00001B0F;
- r300->hw.unk46A4.cmd[4] = 0x00001B0F;
- r300->hw.unk46A4.cmd[5] = 0x00000001;
-
-#if 0
- for(i = 1; i <= 64; ++i) {
- /* create NOP instructions */
- r300->hw.fpi[0].cmd[i] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO));
- r300->hw.fpi[1].cmd[i] = FP_SELC(0,XYZ,NO,FP_TMP(0),0,0);
- r300->hw.fpi[2].cmd[i] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO));
- r300->hw.fpi[3].cmd[i] = FP_SELA(0,W,NO,FP_TMP(0),0,0);
- }
-#endif
-
- r300->hw.unk4BC0.cmd[1] = 0;
-
- r300->hw.unk4BC8.cmd[1] = 0;
- r300->hw.unk4BC8.cmd[2] = 0;
- r300->hw.unk4BC8.cmd[3] = 0;
-
-
- r300->hw.at.cmd[R300_AT_UNKNOWN] = 0;
- r300->hw.unk4BD8.cmd[1] = 0;
-
- r300->hw.unk4E00.cmd[1] = 0;
-
-#if 0
- r300->hw.bld.cmd[R300_BLD_CBLEND] = 0;
- r300->hw.bld.cmd[R300_BLD_ABLEND] = 0;
-#endif
-
- r300BlendColor(ctx, ctx->Color.BlendColor);
- r300->hw.unk4E10.cmd[2] = 0;
- r300->hw.unk4E10.cmd[3] = 0;
-
- /* Again, r300ClearBuffer uses this */
- r300->hw.cb.cmd[R300_CB_OFFSET] = r300->radeon.state.color.drawOffset +
- r300->radeon.radeonScreen->fbLocation;
- r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.state.color.drawPitch;
-
- if (r300->radeon.radeonScreen->cpp == 4)
- r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_ARGB8888;
- else
- r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_RGB565;
-
- if (r300->radeon.sarea->tiling_enabled)
- r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_TILE_ENABLE;
-
- r300->hw.unk4E50.cmd[1] = 0;
- r300->hw.unk4E50.cmd[2] = 0;
- r300->hw.unk4E50.cmd[3] = 0;
- r300->hw.unk4E50.cmd[4] = 0;
- r300->hw.unk4E50.cmd[5] = 0;
- r300->hw.unk4E50.cmd[6] = 0;
- r300->hw.unk4E50.cmd[7] = 0;
- r300->hw.unk4E50.cmd[8] = 0;
- r300->hw.unk4E50.cmd[9] = 0;
-
- r300->hw.unk4E88.cmd[1] = 0;
-
- r300->hw.unk4EA0.cmd[1] = 0x00000000;
- r300->hw.unk4EA0.cmd[2] = 0xffffffff;
-
- switch (ctx->Visual.depthBits) {
- case 16:
- r300->hw.unk4F10.cmd[1] = R300_DEPTH_FORMAT_16BIT_INT_Z;
- break;
- case 24:
- r300->hw.unk4F10.cmd[1] = R300_DEPTH_FORMAT_24BIT_INT_Z;
- break;
- default:
- fprintf(stderr, "Error: Unsupported depth %d... exiting\n",
- ctx->Visual.depthBits);
- exit(-1);
-
- }
- r300->hw.unk4F10.cmd[3] = 0x00000003;
- r300->hw.unk4F10.cmd[4] = 0x00000000;
-
- r300->hw.zb.cmd[R300_ZB_OFFSET] =
- r300->radeon.radeonScreen->depthOffset +
- r300->radeon.radeonScreen->fbLocation;
- r300->hw.zb.cmd[R300_ZB_PITCH] = r300->radeon.radeonScreen->depthPitch;
-
- if (r300->radeon.sarea->tiling_enabled) {
- /* Turn off when clearing buffers ? */
- r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTH_TILE_ENABLE;
-
- if (ctx->Visual.depthBits == 24)
- r300->hw.zb.cmd[R300_ZB_PITCH] |= R300_DEPTH_MICROTILE_ENABLE;
- }
-
- r300->hw.unk4F28.cmd[1] = 0;
-
- r300->hw.unk4F30.cmd[1] = 0;
- r300->hw.unk4F30.cmd[2] = 0;
-
- r300->hw.unk4F44.cmd[1] = 0;
-
- r300->hw.unk4F54.cmd[1] = 0;
-
-#if 0
- ((drm_r300_cmd_header_t*)r300->hw.vpi.cmd)->vpu.count = 0;
- for(i = 1; i < R300_VPI_CMDSIZE; i += 4) {
- /* MOV t0, t0 */
- r300->hw.vpi.cmd[i+0] = VP_OUT(ADD,TMP,0,XYZW);
- r300->hw.vpi.cmd[i+1] = VP_IN(TMP,0);
- r300->hw.vpi.cmd[i+2] = VP_ZERO();
- r300->hw.vpi.cmd[i+3] = VP_ZERO();
- }
-
- ((drm_r300_cmd_header_t*)r300->hw.vpp.cmd)->vpu.count = 0;
- for(i = 1; i < R300_VPP_CMDSIZE; ++i)
- r300->hw.vpp.cmd[i] = 0;
-#endif
-
- r300->hw.vps.cmd[R300_VPS_ZERO_0] = 0;
- r300->hw.vps.cmd[R300_VPS_ZERO_1] = 0;
- r300->hw.vps.cmd[R300_VPS_POINTSIZE] = r300PackFloat32(1.0);
- r300->hw.vps.cmd[R300_VPS_ZERO_3] = 0;
-
-//END: TODO
- //verify_r300ResetHwState(r300, 0);
- r300->hw.all_dirty = GL_TRUE;
-}
-
-
-
-/**
- * Calculate initial hardware state and register state functions.
- * Assumes that the command buffer and state atoms have been
- * initialized already.
- */
-void r300InitState(r300ContextPtr r300)
-{
- GLcontext *ctx = r300->radeon.glCtx;
- GLuint depth_fmt;
-
- radeonInitState(&r300->radeon);
-
- switch (ctx->Visual.depthBits) {
- case 16:
- r300->state.depth.scale = 1.0 / (GLfloat) 0xffff;
- depth_fmt = R200_DEPTH_FORMAT_16BIT_INT_Z;
- r300->state.stencil.clear = 0x00000000;
- break;
- case 24:
- r300->state.depth.scale = 1.0 / (GLfloat) 0xffffff;
- depth_fmt = R200_DEPTH_FORMAT_24BIT_INT_Z;
- r300->state.stencil.clear = 0x00ff0000;
- break;
- default:
- fprintf(stderr, "Error: Unsupported depth %d... exiting\n",
- ctx->Visual.depthBits);
- exit(-1);
- }
-
- /* Only have hw stencil when depth buffer is 24 bits deep */
- r300->state.stencil.hw_stencil = (ctx->Visual.stencilBits > 0 &&
- ctx->Visual.depthBits == 24);
-
- memset(&(r300->state.texture), 0, sizeof(r300->state.texture));
-
- r300ResetHwState(r300);
-}
-
-static void r300RenderMode( GLcontext *ctx, GLenum mode )
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- WARN_ONCE("TODO: fallback properly when rendering mode is not GL_RENDER\n"
- "\tThe way things are now neither selection nor feedback modes work\n")
-// FALLBACK( rmesa, R300_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-/**
- * Initialize driver's state callback functions
- */
-void r300InitStateFuncs(struct dd_function_table* functions)
-{
- radeonInitStateFuncs(functions);
-
- functions->UpdateState = r300InvalidateState;
- functions->AlphaFunc = r300AlphaFunc;
- functions->BlendColor = r300BlendColor;
- functions->BlendEquationSeparate = r300BlendEquationSeparate;
- functions->BlendFuncSeparate = r300BlendFuncSeparate;
- functions->Enable = r300Enable;
- functions->ColorMask = r300ColorMask;
- functions->DepthFunc = r300DepthFunc;
- functions->DepthMask = r300DepthMask;
- functions->CullFace = r300CullFace;
- functions->FrontFace = r300FrontFace;
- functions->ShadeModel = r300ShadeModel;
-
- /* Stencil related */
- functions->ClearStencil = r300ClearStencil;
- functions->StencilFunc = r300StencilFunc;
- functions->StencilMask = r300StencilMask;
- functions->StencilOp = r300StencilOp;
-
- /* Viewport related */
- functions->Viewport = r300Viewport;
- functions->DepthRange = r300DepthRange;
- functions->PointSize = r300PointSize;
- functions->LineWidth = r300LineWidth;
-
- functions->PolygonOffset = r300PolygonOffset;
- functions->PolygonMode = r300PolygonMode;
-
- functions->RenderMode = r300RenderMode;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.h
deleted file mode 100644
index 131834fa7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_state.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#ifndef __R300_STATE_H__
-#define __R300_STATE_H__
-
-#include "r300_context.h"
-
-#define R300_STATECHANGE(r300, atom) \
- do { \
- r300->hw.atom.dirty = GL_TRUE; \
- r300->hw.is_dirty = GL_TRUE; \
- } while(0)
-
-/* Fire the buffered vertices no matter what.
- TODO: This has not been implemented yet
- */
-#define R300_FIREVERTICES( r300 ) \
-do { \
- \
- if ( (r300)->cmdbuf.count_used || (r300)->dma.flush ) { \
- r300Flush( (r300)->radeon.glCtx ); \
- } \
- \
-} while (0)
-
-
-extern void r300ResetHwState(r300ContextPtr r300);
-
-extern void r300InitState(r300ContextPtr r300);
-extern void r300InitStateFuncs(struct dd_function_table* functions);
-extern void r300SetupVertexShader(r300ContextPtr rmesa);
-extern void r300SetupPixelShader(r300ContextPtr rmesa);
-
-extern void r300_setup_textures(GLcontext *ctx);
-extern void r300_setup_rs_unit(GLcontext *ctx);
-
-#endif /* __R300_STATE_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.c
deleted file mode 100644
index e6c8c1801..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.c
+++ /dev/null
@@ -1,1051 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_tex.c,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
-/*
-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.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "image.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "texmem.h"
-#include "teximage.h"
-#include "texobj.h"
-
-#include "r300_context.h"
-#include "r300_state.h"
-#include "r300_ioctl.h"
-//#include "r300_swtcl.h"
-#include "r300_tex.h"
-
-#include "xmlpool.h"
-
-/**
- * Set the texture wrap modes.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void r300SetTexWrap(r300TexObjPtr t, GLenum swrap, GLenum twrap,
- GLenum rwrap)
-{
- GLboolean is_clamp = GL_FALSE;
- unsigned long hw_swrap=0, hw_twrap=0, hw_qwrap=0;
-
- t->filter &=
- ~(R300_TX_WRAP_S_MASK | R300_TX_WRAP_T_MASK | R300_TX_WRAP_Q_MASK);
-
- switch (swrap) {
- case GL_REPEAT:
- hw_swrap |= R300_TX_REPEAT;
- break;
- case GL_CLAMP:
- hw_swrap |= R300_TX_CLAMP;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- hw_swrap |= R300_TX_CLAMP_TO_EDGE;
- break;
- case GL_CLAMP_TO_BORDER:
- hw_swrap |= R300_TX_CLAMP_TO_BORDER;
- break;
- case GL_MIRRORED_REPEAT:
- hw_swrap |= R300_TX_REPEAT | R300_TX_MIRRORED;
- break;
- case GL_MIRROR_CLAMP_EXT:
- hw_swrap |= R300_TX_CLAMP | R300_TX_MIRRORED;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- hw_swrap |= R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- hw_swrap |= R300_TX_CLAMP_TO_BORDER | R300_TX_MIRRORED;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch (twrap) {
- case GL_REPEAT:
- hw_twrap |= R300_TX_REPEAT;
- break;
- case GL_CLAMP:
- hw_twrap |= R300_TX_CLAMP;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- hw_twrap |= R300_TX_CLAMP_TO_EDGE;
- break;
- case GL_CLAMP_TO_BORDER:
- hw_twrap |= R300_TX_CLAMP_TO_BORDER;
- break;
- case GL_MIRRORED_REPEAT:
- hw_twrap |= R300_TX_REPEAT | R300_TX_MIRRORED;
- break;
- case GL_MIRROR_CLAMP_EXT:
- hw_twrap |= R300_TX_CLAMP | R300_TX_MIRRORED;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- hw_twrap |= R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- hw_twrap |= R300_TX_CLAMP_TO_BORDER | R300_TX_MIRRORED;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-
- switch (rwrap) {
- case GL_REPEAT:
- hw_qwrap |= R300_TX_REPEAT;
- break;
- case GL_CLAMP:
- hw_qwrap |= R300_TX_CLAMP;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- hw_qwrap |= R300_TX_CLAMP_TO_EDGE;
- break;
- case GL_CLAMP_TO_BORDER:
- hw_qwrap |= R300_TX_CLAMP_TO_BORDER;
- break;
- case GL_MIRRORED_REPEAT:
- hw_qwrap |= R300_TX_REPEAT | R300_TX_MIRRORED;
- break;
- case GL_MIRROR_CLAMP_EXT:
- hw_qwrap |= R300_TX_CLAMP | R300_TX_MIRRORED;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- hw_qwrap |= R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- hw_qwrap |= R300_TX_CLAMP_TO_BORDER | R300_TX_MIRRORED;
- break;
- default:
- _mesa_problem(NULL, "bad R wrap mode in %s", __FUNCTION__);
- }
-
- t->filter |= hw_swrap << R300_TX_WRAP_S_SHIFT;
- t->filter |= hw_twrap << R300_TX_WRAP_T_SHIFT;
- t->filter |= hw_qwrap << R300_TX_WRAP_Q_SHIFT;
-
-#if 0
- t->format_x &= ~R200_CLAMP_Q_MASK;
- t->border_fallback = (is_clamp && is_clamp_to_border);
-#endif
-}
-
-static void r300SetTexMaxAnisotropy(r300TexObjPtr t, GLfloat max)
-{
-
- t->filter &= ~R300_TX_MAX_ANISO_MASK;
-
- if (max <= 1.0) {
- t->filter |= R300_TX_MAX_ANISO_1_TO_1;
- } else if (max <= 2.0) {
- t->filter |= R300_TX_MAX_ANISO_2_TO_1;
- } else if (max <= 4.0) {
- t->filter |= R300_TX_MAX_ANISO_4_TO_1;
- } else if (max <= 8.0) {
- t->filter |= R300_TX_MAX_ANISO_8_TO_1;
- } else {
- t->filter |= R300_TX_MAX_ANISO_16_TO_1;
- }
-}
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- */
-
-static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf)
-{
- GLuint anisotropy = (t->filter & R300_TX_MAX_ANISO_MASK);
-
- t->filter &= ~(R300_TX_MIN_FILTER_MASK | R300_TX_MAG_FILTER_MASK);
-#if 0
- //t->format_x &= ~R200_VOLUME_FILTER_MASK;
-#endif
-
- if (anisotropy == R300_TX_MAX_ANISO_1_TO_1) {
- switch (minf) {
- case GL_NEAREST:
- t->filter |= R300_TX_MIN_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->filter |= R300_TX_MIN_FILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->filter |= R300_TX_MIN_FILTER_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t->filter |= R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->filter |= R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t->filter |= R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR;
- break;
- }
- } else {
- switch (minf) {
- case GL_NEAREST:
- t->filter |= R300_TX_MIN_FILTER_ANISO_NEAREST;
- break;
- case GL_LINEAR:
- t->filter |= R300_TX_MIN_FILTER_ANISO_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- t->filter |=
- R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- t->filter |=
- R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR;
- break;
- }
- }
-
- /* Note we don't have 3D mipmaps so only use the mag filter setting
- * to set the 3D texture filter mode.
- */
- switch (magf) {
- case GL_NEAREST:
- t->filter |= R300_TX_MAG_FILTER_NEAREST;
- /*t->format_x |= R200_VOLUME_FILTER_NEAREST;*/
- break;
- case GL_LINEAR:
- t->filter |= R300_TX_MAG_FILTER_LINEAR;
- /*t->format_x |= R200_VOLUME_FILTER_LINEAR;*/
- break;
- }
-}
-
-static void r300SetTexBorderColor(r300TexObjPtr t, GLubyte c[4])
-{
- t->pp_border_color = r300PackColor(4, c[0], c[1], c[2], c[3]);
-}
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static r300TexObjPtr r300AllocTexObj(struct gl_texture_object *texObj)
-{
- r300TexObjPtr t;
-
- t = CALLOC_STRUCT(r300_tex_obj);
- texObj->DriverData = t;
- if (t != NULL) {
- if (RADEON_DEBUG & DEBUG_TEXTURE) {
- fprintf(stderr, "%s( %p, %p )\n", __FUNCTION__,
- (void *)texObj, (void *)t);
- }
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->border_fallback = GL_FALSE;
-
- make_empty_list(&t->base);
-
- r300SetTexWrap(t, texObj->WrapS, texObj->WrapT, texObj->WrapR);
- r300SetTexMaxAnisotropy(t, texObj->MaxAnisotropy);
- r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter);
- r300SetTexBorderColor(t, texObj->_BorderChan);
- }
-
- return t;
-}
-
-static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx,
- GLint
- internalFormat,
- GLenum format,
- GLenum type)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- const GLboolean do32bpt =
- (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32);
- const GLboolean force16bpt =
- (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16);
- (void)format;
-
-#if 0
- fprintf(stderr, "InternalFormat=%s(%d) type=%s format=%s\n",
- _mesa_lookup_enum_by_nr(internalFormat), internalFormat,
- _mesa_lookup_enum_by_nr(type),
- _mesa_lookup_enum_by_nr(format));
- fprintf(stderr, "do32bpt=%d force16bpt=%d\n",
- do32bpt, force16bpt);
-#endif
-
- switch (internalFormat) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch (type) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? _dri_texformat_argb8888 :
- _dri_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
- default:
- return do32bpt ? _dri_texformat_rgba8888 :
- _dri_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch (type) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return _dri_texformat_rgb565;
- default:
- return do32bpt ? _dri_texformat_rgba8888 :
- _dri_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- _dri_texformat_rgba8888 : _dri_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return _dri_texformat_argb4444;
-
- case GL_RGB5_A1:
- return _dri_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? _dri_texformat_rgba8888 :
- _dri_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return _dri_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return _dri_texformat_a8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return _dri_texformat_l8;
-
- 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 _dri_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return _dri_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- default:
- _mesa_problem(ctx,
- "unexpected internalFormat 0x%x in r300ChooseTextureFormat",
- (int)internalFormat);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-static GLboolean
-r300ValidateClientStorage(GLcontext * ctx, GLenum target,
- GLint internalFormat,
- GLint srcWidth, GLint srcHeight,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
- if (0)
- fprintf(stderr, "intformat %s format %s type %s\n",
- _mesa_lookup_enum_by_nr(internalFormat),
- _mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(type));
-
- if (!ctx->Unpack.ClientStorage)
- return 0;
-
- if (ctx->_ImageTransferState ||
- texImage->IsCompressed || texObj->GenerateMipmap)
- return 0;
-
- /* This list is incomplete, may be different on ppc???
- */
- switch (internalFormat) {
- case GL_RGBA:
- if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV) {
- texImage->TexFormat = _dri_texformat_argb8888;
- } else
- return 0;
- break;
-
- case GL_RGB:
- if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
- texImage->TexFormat = _dri_texformat_rgb565;
- } else
- return 0;
- break;
-
- case GL_YCBCR_MESA:
- if (format == GL_YCBCR_MESA &&
- type == GL_UNSIGNED_SHORT_8_8_REV_APPLE) {
- texImage->TexFormat = &_mesa_texformat_ycbcr_rev;
- } else if (format == GL_YCBCR_MESA &&
- (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)) {
- texImage->TexFormat = &_mesa_texformat_ycbcr;
- } else
- return 0;
- break;
-
- default:
- return 0;
- }
-
- /* Could deal with these packing issues, but currently don't:
- */
- if (packing->SkipPixels ||
- packing->SkipRows || packing->SwapBytes || packing->LsbFirst) {
- return 0;
- }
-
- {
- GLint srcRowStride = _mesa_image_row_stride(packing, srcWidth,
- format, type);
-
- if (0)
- fprintf(stderr, "%s: srcRowStride %d/%x\n",
- __FUNCTION__, srcRowStride, srcRowStride);
-
- /* Could check this later in upload, pitch restrictions could be
- * relaxed, but would need to store the image pitch somewhere,
- * as packing details might change before image is uploaded:
- */
- if (!r300IsGartMemory(rmesa, pixels, srcHeight * srcRowStride)
- || (srcRowStride & 63))
- return 0;
-
- /* Have validated that _mesa_transfer_teximage would be a straight
- * memcpy at this point. NOTE: future calls to TexSubImage will
- * overwrite the client data. This is explicitly mentioned in the
- * extension spec.
- */
- texImage->Data = (void *)pixels;
- texImage->IsClientData = GL_TRUE;
- texImage->RowStride =
- srcRowStride / texImage->TexFormat->TexelBytes;
-
- return 1;
- }
-}
-
-static void r300TexImage1D(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)
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
-
- if (t) {
- driSwapOutTextureObject(t);
- } else {
- t = (driTextureObject *) r300AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_teximage1d(ctx, target, level, internalFormat,
- width, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-static void r300TexSubImage1D(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)
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
-
- assert(t); /* this _should_ be true */
- if (t) {
- driSwapOutTextureObject(t);
- } else {
- t = (driTextureObject *) r300AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-static void r300TexImage2D(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)
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face =
- (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if (t != NULL) {
- driSwapOutTextureObject(t);
- } else {
- t = (driTextureObject *) r300AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-
- if (r300ValidateClientStorage(ctx, target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n",
- __FUNCTION__);
- } else {
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n",
- __FUNCTION__);
-
- /* Normal path: copy (to cached memory) and eventually upload
- * via another copy to GART memory and then a blit... Could
- * eliminate one copy by going straight to (permanent) GART.
- *
- * Note, this will call r300ChooseTextureFormat.
- */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
- }
-}
-
-static void r300TexSubImage2D(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)
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face =
- (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert(t); /* this _should_ be true */
- if (t) {
- driSwapOutTextureObject(t);
- } else {
- t = (driTextureObject *) r300AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-#if ENABLE_HW_3D_TEXTURE
-static void r300TexImage3D(GLcontext * ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- 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)
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
-
- if (t) {
- driSwapOutTextureObject(t);
- } else {
- t = (driTextureObject *) r300AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
- return;
- }
- }
-
- texImage->IsClientData = GL_FALSE;
-
-#if 0
- if (r300ValidateClientStorage(ctx, target,
- internalFormat,
- width, height,
- format, type, pixels,
- packing, texObj, texImage)) {
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using client storage\n",
- __FUNCTION__);
- } else
-#endif
- {
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: Using normal storage\n",
- __FUNCTION__);
-
- /* Normal path: copy (to cached memory) and eventually upload
- * via another copy to GART memory and then a blit... Could
- * eliminate one copy by going straight to (permanent) GART.
- *
- * Note, this will call r300ChooseTextureFormat.
- */
- _mesa_store_teximage3d(ctx, target, level, internalFormat,
- width, height, depth, border,
- format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
- }
-}
-#endif
-
-#if ENABLE_HW_3D_TEXTURE
-static void
-r300TexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid * pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- assert(t); /* this _should_ be true */
- if (t) {
- driSwapOutTextureObject(t);
- } else {
- t = (driTextureObject *) r300AllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
- return;
- }
- texObj->DriverData = t;
- }
-
- _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-#endif
-
-static void r300TexEnv(GLcontext * ctx, GLenum target,
- GLenum pname, const GLfloat * param)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if (RADEON_DEBUG & DEBUG_STATE) {
- fprintf(stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr(pname));
- }
-
- /* This is incorrect: Need to maintain this data for each of
- * GL_TEXTURE_{123}D, GL_TEXTURE_RECTANGLE_NV, etc, and switch
- * between them according to _ReallyEnabled.
- */
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR:{
- WARN_ONCE("I am broken - Fixme !\n");
- /*
- GLubyte c[4];
- GLuint envColor;
- UNCLAMPED_FLOAT_TO_RGBA_CHAN(c, texUnit->EnvColor);
- envColor = radeonPackColor(4, c[0], c[1], c[2], c[3]);
- if (rmesa->hw.tf.cmd[TF_TFACTOR_0 + unit] != envColor) {
- R200_STATECHANGE(rmesa, tf);
- rmesa->hw.tf.cmd[TF_TFACTOR_0 + unit] =
- envColor;
- }
- break;
- */}
-
- case GL_TEXTURE_LOD_BIAS_EXT:{
- GLfloat bias, min;
- GLuint b;
-
- /* The R300's LOD bias is a signed 2's complement value with a
- * range of -16.0 <= bias < 16.0.
- *
- * NOTE: Add a small bias to the bias for conform mipsel.c test.
- */
- bias = *param + .01;
- min =
- driQueryOptionb(&rmesa->radeon.optionCache,
- "no_neg_lod_bias") ? 0.0 : -16.0;
- bias = CLAMP(bias, min, 16.0);
-
- /* 0.0 - 16.0 == 0x0 - 0x1000 */
- /* 0.0 - -16.0 == 0x1001 - 0x1fff */
- b = 0x1000 / 16.0 * bias;
- b &= R300_LOD_BIAS_MASK;
-
- if(b != (rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] & R300_LOD_BIAS_MASK)){
- R300_STATECHANGE(rmesa, tex.unknown1);
- rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] &= ~R300_LOD_BIAS_MASK;
- rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] |= b;
- }
- break;
- }
-
- default:
- return;
- }
-}
-
-/**
- * Changes variables and flags for a state update, which will happen at the
- * next UpdateTextureState
- */
-
-static void r300TexParameter(GLcontext * ctx, GLenum target,
- struct gl_texture_object *texObj,
- GLenum pname, const GLfloat * params)
-{
- r300TexObjPtr t = (r300TexObjPtr) texObj->DriverData;
-
- if (RADEON_DEBUG & (DEBUG_STATE | DEBUG_TEXTURE)) {
- fprintf(stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(pname));
- }
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- r300SetTexMaxAnisotropy(t, texObj->MaxAnisotropy);
- r300SetTexFilter(t, texObj->MinFilter, texObj->MagFilter);
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- r300SetTexWrap(t, texObj->WrapS, texObj->WrapT, texObj->WrapR);
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- r300SetTexBorderColor(t, texObj->_BorderChan);
- 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. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- driSwapOutTextureObject((driTextureObject *) t);
- break;
-
- default:
- return;
- }
-
- /* Mark this texobj as dirty (one bit per tex unit)
- */
- t->dirty_state = TEX_ALL;
-}
-
-static void r300BindTexture(GLcontext * ctx, GLenum target,
- struct gl_texture_object *texObj)
-{
- if (RADEON_DEBUG & (DEBUG_STATE | DEBUG_TEXTURE)) {
- fprintf(stderr, "%s( %p ) unit=%d\n", __FUNCTION__,
- (void *)texObj, ctx->Texture.CurrentUnit);
- }
-
- if ((target == GL_TEXTURE_1D)
- || (target == GL_TEXTURE_2D)
-#if ENABLE_HW_3D_TEXTURE
- || (target == GL_TEXTURE_3D)
-#endif
- || (target == GL_TEXTURE_CUBE_MAP)
- || (target == GL_TEXTURE_RECTANGLE_NV)) {
- assert(texObj->DriverData != NULL);
- }
-}
-
-static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- driTextureObject *t = (driTextureObject *) texObj->DriverData;
-
- if (RADEON_DEBUG & (DEBUG_STATE | DEBUG_TEXTURE)) {
- fprintf(stderr, "%s( %p (target = %s) )\n", __FUNCTION__,
- (void *)texObj,
- _mesa_lookup_enum_by_nr(texObj->Target));
- }
-
- if (t != NULL) {
- if (rmesa) {
- R300_FIREVERTICES(rmesa);
- }
-
- driDestroyTextureObject(t);
- }
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, texObj);
-}
-
-/* Need:
- * - Same GEN_MODE for all active bits
- * - Same EyePlane/ObjPlane for all active bits when using Eye/Obj
- * - STRQ presumably all supported (matrix means incoming R values
- * can end up in STQ, this has implications for vertex support,
- * presumably ok if maos is used, though?)
- *
- * Basically impossible to do this on the fly - just collect some
- * basic info & do the checks from ValidateState().
- */
-static void r300TexGen(GLcontext * ctx,
- GLenum coord, GLenum pname, const GLfloat * params)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
-#if 0 /* Disable this for now - looks like we will be recalculating everything
- anyway */
- rmesa->recheck_texgen[unit] = GL_TRUE;
-#endif
-}
-
-/**
- * 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.
- * Fixup MaxAnisotropy according to user preference.
- */
-static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
- GLuint name,
- GLenum target)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- if (!obj)
- return NULL;
- obj->MaxAnisotropy = rmesa->initialMaxAnisotropy;
-
- r300AllocTexObj(obj);
- return obj;
-}
-
-void r300InitTextureFuncs(struct dd_function_table *functions)
-{
- /* Note: we only plug in the functions we implement in the driver
- * since _mesa_init_driver_functions() was already called.
- */
- functions->ChooseTextureFormat = r300ChooseTextureFormat;
- functions->TexImage1D = r300TexImage1D;
- functions->TexImage2D = r300TexImage2D;
-#if ENABLE_HW_3D_TEXTURE
- functions->TexImage3D = r300TexImage3D;
-#else
- functions->TexImage3D = _mesa_store_teximage3d;
-#endif
- functions->TexSubImage1D = r300TexSubImage1D;
- functions->TexSubImage2D = r300TexSubImage2D;
-#if ENABLE_HW_3D_TEXTURE
- functions->TexSubImage3D = r300TexSubImage3D;
-#else
- functions->TexSubImage3D = _mesa_store_texsubimage3d;
-#endif
- functions->NewTextureObject = r300NewTextureObject;
- functions->BindTexture = r300BindTexture;
- functions->DeleteTexture = r300DeleteTexture;
- functions->IsTextureResident = driIsTextureResident;
-
- functions->TexEnv = r300TexEnv;
- functions->TexParameter = r300TexParameter;
- functions->TexGen = r300TexGen;
-
- driInitTextureFormats();
-
-#if 0
- /* moved or obsolete code */
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- driInitTextureObjects(ctx, &rmesa->swapped,
- DRI_TEXMGR_DO_TEXTURE_1D
- | DRI_TEXMGR_DO_TEXTURE_2D);
-
- /* Hack: r300NewTextureObject is not yet installed when the
- * default textures are created. Therefore set MaxAnisotropy of the
- * default 2D texture now. */
- ctx->Shared->Default2D->MaxAnisotropy =
- driQueryOptionf(&rmesa->optionCache, "def_max_anisotropy");
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.h
deleted file mode 100644
index a18ff0e2c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_tex.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __r300_TEX_H__
-#define __r300_TEX_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r300UpdateTextureState(GLcontext * ctx);
-
-extern int r300UploadTexImages(r300ContextPtr rmesa, r300TexObjPtr t,
- GLuint face);
-
-extern void r300DestroyTexObj(r300ContextPtr rmesa, r300TexObjPtr t);
-
-extern void r300InitTextureFuncs(struct dd_function_table *functions);
-
-#endif
-#endif /* __r300_TEX_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texmem.c
deleted file mode 100644
index 5c70e2e3c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texmem.c
+++ /dev/null
@@ -1,514 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_texmem.c,v 1.5 2002/12/17 00:32:56 dawes Exp $ */
-/**************************************************************************
-
-Copyright (C) Tungsten Graphics 2002. All Rights Reserved.
-The Weather Channel, Inc. 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 on 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 ATI, 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
-#include "simple_list.h"
-#include "radeon_reg.h" /* gets definition for usleep */
-#include "r300_context.h"
-#include "r300_state.h"
-#include "r300_cmdbuf.h"
-#include "radeon_ioctl.h"
-/*
-#include "r300_swtcl.h"
-*/
-#include "r300_tex.h"
-#include "r300_ioctl.h"
-#include <unistd.h> /* for usleep() */
-
-/**
- * Destroy any device-dependent state associated with the texture. This may
- * include NULLing out hardware state that points to the texture.
- */
-void r300DestroyTexObj(r300ContextPtr rmesa, r300TexObjPtr t)
-{
- if (RADEON_DEBUG & DEBUG_TEXTURE) {
- fprintf(stderr, "%s( %p, %p )\n", __FUNCTION__,
- (void *)t, (void *)t->base.tObj);
- }
-
- if (rmesa != NULL) {
- unsigned i;
-
- for (i = 0; i < rmesa->radeon.glCtx->Const.MaxTextureUnits; i++) {
- if (t == rmesa->state.texture.unit[i].texobj) {
- rmesa->state.texture.unit[i].texobj = NULL;
- /* This code below is meant to shorten state
- pushed to the hardware by not programming
- unneeded units.
-
- This does not appear to be worthwhile on R300 */
-#if 0
- remove_from_list(&rmesa->hw.tex[i]);
- make_empty_list(&rmesa->hw.tex[i]);
- remove_from_list(&rmesa->hw.cube[i]);
- make_empty_list(&rmesa->hw.cube[i]);
-#endif
- }
- }
- }
-}
-
-/* ------------------------------------------------------------
- * Texture image conversions
- */
-
-static void r300UploadGARTClientSubImage(r300ContextPtr rmesa,
- r300TexObjPtr t,
- struct gl_texture_image *texImage,
- GLint hwlevel,
- GLint x, GLint y,
- GLint width, GLint height)
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- GLuint srcPitch, dstPitch;
- int blit_format;
- int srcOffset;
-
- /*
- * XXX it appears that we always upload the full image, not a subimage.
- * I.e. x==0, y==0, width=texWidth, height=texWidth. If this is ever
- * changed, the src pitch will have to change.
- */
- switch (texFormat->TexelBytes) {
- case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- srcPitch = t->image[0][0].width * texFormat->TexelBytes;
- dstPitch = t->image[0][0].width * texFormat->TexelBytes;
- break;
- default:
- return;
- }
-
- t->image[0][hwlevel].data = texImage->Data;
- srcOffset = r300GartOffsetFromVirtual(rmesa, texImage->Data);
-
- assert(srcOffset != ~0);
-
- /* Don't currently need to cope with small pitches?
- */
- width = texImage->Width;
- height = texImage->Height;
-
- r300EmitWait(rmesa, R300_WAIT_3D);
-
- r300EmitBlit(rmesa, blit_format,
- srcPitch,
- srcOffset,
- dstPitch,
- t->bufAddr,
- x,
- y,
- t->image[0][hwlevel].x + x,
- t->image[0][hwlevel].y + y, width, height);
-
- r300EmitWait(rmesa, R300_WAIT_2D);
-}
-
-static void r300UploadRectSubImage(r300ContextPtr rmesa,
- r300TexObjPtr t,
- struct gl_texture_image *texImage,
- GLint x, GLint y, GLint width, GLint height)
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- int blit_format, dstPitch, done;
-
- switch (texFormat->TexelBytes) {
- case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
- break;
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return;
- }
-
- t->image[0][0].data = texImage->Data;
-
- /* Currently don't need to cope with small pitches.
- */
- width = texImage->Width;
- height = texImage->Height;
- dstPitch = t->pitch + 32;
-
- if (rmesa->prefer_gart_client_texturing && texImage->IsClientData) {
- /* In this case, could also use GART texturing. This is
- * currently disabled, but has been tested & works.
- */
- t->offset =
- r300GartOffsetFromVirtual(rmesa, texImage->Data);
- t->pitch =
- texImage->RowStride * texFormat->TexelBytes - 32;
-
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Using GART texturing for rectangular client texture\n");
-
- /* Release FB memory allocated for this image:
- */
- /* FIXME This may not be correct as driSwapOutTextureObject sets
- * FIXME dirty_images. It may be fine, though.
- */
- if (t->base.memBlock) {
- driSwapOutTextureObject((driTextureObject *) t);
- }
- } else if (texImage->IsClientData) {
- /* Data already in GART memory, with usable pitch.
- */
- GLuint srcPitch;
- srcPitch = texImage->RowStride * texFormat->TexelBytes;
- r300EmitBlit(rmesa,
- blit_format,
- srcPitch,
- r300GartOffsetFromVirtual(rmesa, texImage->Data),
- dstPitch, t->bufAddr, 0, 0, 0, 0, width, height);
- } else {
- /* Data not in GART memory, or bad pitch.
- */
- for (done = 0; done < height;) {
- struct r300_dma_region region;
- int lines =
- MIN2(height - done, RADEON_BUFFER_SIZE / dstPitch);
- int src_pitch;
- char *tex;
-
- src_pitch = texImage->RowStride * texFormat->TexelBytes;
-
- tex = (char *)texImage->Data + done * src_pitch;
-
- memset(&region, 0, sizeof(region));
- r300AllocDmaRegion(rmesa, &region, lines * dstPitch,
- 1024);
-
- /* Copy texdata to dma:
- */
- if (0)
- fprintf(stderr,
- "%s: src_pitch %d dst_pitch %d\n",
- __FUNCTION__, src_pitch, dstPitch);
-
- if (src_pitch == dstPitch) {
- memcpy(region.address + region.start, tex,
- lines * src_pitch);
- } else {
- char *buf = region.address + region.start;
- int i;
- for (i = 0; i < lines; i++) {
- memcpy(buf, tex, src_pitch);
- buf += dstPitch;
- tex += src_pitch;
- }
- }
-
- r300EmitWait(rmesa, R300_WAIT_3D);
-
- /* Blit to framebuffer
- */
- r300EmitBlit(rmesa,
- blit_format,
- dstPitch, GET_START(&region),
- dstPitch, t->bufAddr,
- 0, 0, 0, done, width, lines);
-
- r300EmitWait(rmesa, R300_WAIT_2D);
-
- r300ReleaseDmaRegion(rmesa, &region, __FUNCTION__);
- done += lines;
- }
- }
-}
-
-/**
- * Upload the texture image associated with texture \a t at the specified
- * level at the address relative to \a start.
- */
-static void uploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t,
- GLint hwlevel,
- GLint x, GLint y, GLint width, GLint height,
- GLuint face)
-{
- struct gl_texture_image *texImage = NULL;
- GLuint offset;
- GLint imageWidth, imageHeight;
- GLint ret;
- drm_radeon_texture_t tex;
- drm_radeon_tex_image_t tmp;
- const int level = hwlevel + t->base.firstLevel;
-
- if (RADEON_DEBUG & DEBUG_TEXTURE) {
- fprintf(stderr,
- "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n",
- __FUNCTION__, (void *)t, (void *)t->base.tObj, level,
- width, height, face);
- }
-
- ASSERT(face < 6);
-
- /* Ensure we have a valid texture to upload */
- if ((hwlevel < 0) || (hwlevel >= RADEON_MAX_TEXTURE_LEVELS)) {
- _mesa_problem(NULL, "bad texture level in %s", __FUNCTION__);
- return;
- }
-
- texImage = t->base.tObj->Image[face][level];
-
- if (!texImage) {
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: texImage %d is NULL!\n",
- __FUNCTION__, level);
- return;
- }
- if (!texImage->Data) {
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: image data is NULL!\n",
- __FUNCTION__);
- return;
- }
-
- if (t->base.tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- assert(level == 0);
- assert(hwlevel == 0);
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: image data is rectangular\n",
- __FUNCTION__);
- r300UploadRectSubImage(rmesa, t, texImage, x, y, width, height);
- return;
- } else if (texImage->IsClientData) {
- if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "%s: image data is in GART client storage\n",
- __FUNCTION__);
- r300UploadGARTClientSubImage(rmesa, t, texImage, hwlevel, x, y,
- width, height);
- return;
- } else if (RADEON_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: image data is in normal memory\n",
- __FUNCTION__);
-
- imageWidth = texImage->Width;
- imageHeight = texImage->Height;
-
- offset = t->bufAddr;
-
- if (RADEON_DEBUG & (DEBUG_TEXTURE | DEBUG_IOCTL)) {
- GLint imageX = 0;
- GLint imageY = 0;
- GLint blitX = t->image[face][hwlevel].x;
- GLint blitY = t->image[face][hwlevel].y;
- GLint blitWidth = t->image[face][hwlevel].width;
- GLint blitHeight = t->image[face][hwlevel].height;
- fprintf(stderr, " upload image: %d,%d at %d,%d\n",
- imageWidth, imageHeight, imageX, imageY);
- fprintf(stderr, " upload blit: %d,%d at %d,%d\n",
- blitWidth, blitHeight, blitX, blitY);
- fprintf(stderr, " blit ofs: 0x%07x level: %d/%d\n",
- (GLuint) offset, hwlevel, level);
- }
-
- t->image[face][hwlevel].data = texImage->Data;
-
- /* Init the DRM_RADEON_TEXTURE command / drm_radeon_texture_t struct.
- * NOTE: we're always use a 1KB-wide blit and I8 texture format.
- * We used to use 1, 2 and 4-byte texels and used to use the texture
- * width to dictate the blit width - but that won't work for compressed
- * textures. (Brian)
- */
-
- tex.offset = offset;
- tex.pitch = BLIT_WIDTH_BYTES / 64;
- tex.format = R200_TXFORMAT_I8; /* any 1-byte texel format */
-#if 0 /* I am not sure HOSTDATA_BLT actually works.. Experiment here - V.D */
- tex.format = R200_TXFORMAT_RGBA8888; /* any 4-byte texel format */
-#endif
- if (texImage->TexFormat->TexelBytes) {
- tex.width = imageWidth * texImage->TexFormat->TexelBytes; /* in bytes */
- tex.height = imageHeight;
- } else {
- tex.width = imageWidth; /* compressed */
- tex.height = imageHeight;
- if (tex.height < 4)
- tex.height = 4;
- }
- tex.image = &tmp;
-#if 0
- tex.width /= 4;
-#endif
-
- /* copy (x,y,width,height,data) */
- memcpy(&tmp, &t->image[face][hwlevel], sizeof(tmp));
-#if 0
- tex.image->width /=4;
-#endif
-
-#if 0
- sleep(1);
-
- fprintf(stderr, "*** Uploading texture\n");
- fprintf(stderr, " offset=0x%08x\n", offset);
- fprintf(stderr, " image width=%d height=%d\n",
- imageWidth, imageHeight);
- fprintf(stderr, " blit width=%d height=%d data=%p\n",
- t->image[face][hwlevel].width,
- t->image[face][hwlevel].height,
- t->image[face][hwlevel].data);
-#endif
-
- LOCK_HARDWARE(&rmesa->radeon);
- do {
- ret = drmCommandWriteRead(rmesa->radeon.dri.fd, DRM_RADEON_TEXTURE,
- &tex, sizeof(drm_radeon_texture_t));
- if (ret) {
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr,
- "DRM_RADEON_TEXTURE: again!\n");
- usleep(1);
- }
- } while (ret && errno == EAGAIN);
-
- UNLOCK_HARDWARE(&rmesa->radeon);
-
- if (ret) {
- fprintf(stderr, "DRM_RADEON_TEXTURE: return = %d\n", ret);
- fprintf(stderr, " offset=0x%08x\n", offset);
- fprintf(stderr, " image width=%d height=%d\n",
- imageWidth, imageHeight);
- fprintf(stderr, " blit width=%d height=%d data=%p\n",
- t->image[face][hwlevel].width,
- t->image[face][hwlevel].height,
- t->image[face][hwlevel].data);
- exit(1);
- }
-}
-
-/**
- * Upload the texture images associated with texture \a t. This might
- * require the allocation of texture memory.
- *
- * \param rmesa Context pointer
- * \param t Texture to be uploaded
- * \param face Cube map face to be uploaded. Zero for non-cube maps.
- */
-
-int r300UploadTexImages(r300ContextPtr rmesa, r300TexObjPtr t, GLuint face)
-{
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- if (RADEON_DEBUG & (DEBUG_TEXTURE | DEBUG_IOCTL)) {
- fprintf(stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__,
- (void *)rmesa->radeon.glCtx, (void *)t->base.tObj,
- t->base.totalSize, t->base.firstLevel,
- t->base.lastLevel);
- }
-
- if (!t || t->base.totalSize == 0)
- return 0;
-
- if (RADEON_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
- radeonFinish(rmesa->radeon.glCtx);
- }
-
- LOCK_HARDWARE(&rmesa->radeon);
-
- if (t->base.memBlock == NULL) {
- int heap;
-
- heap = driAllocateTexture(rmesa->texture_heaps, rmesa->nr_heaps,
- (driTextureObject *) t);
- if (heap == -1) {
- UNLOCK_HARDWARE(&rmesa->radeon);
- return -1;
- }
-
- /* Set the base offset of the texture image */
- t->bufAddr = rmesa->radeon.radeonScreen->texOffset[heap]
- + t->base.memBlock->ofs;
- t->offset = t->bufAddr;
-
- /* Mark this texobj as dirty on all units:
- */
- t->dirty_state = TEX_ALL;
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU((driTextureObject *) t);
- UNLOCK_HARDWARE(&rmesa->radeon);
-
- /* Upload any images that are new */
- if (t->base.dirty_images[face]) {
- int i;
- for (i = 0; i < numLevels; i++) {
- if ((t->base.
- dirty_images[face] & (1 <<
- (i + t->base.firstLevel))) !=
- 0) {
- uploadSubImage(rmesa, t, i, 0, 0,
- t->image[face][i].width,
- t->image[face][i].height, face);
- }
- }
- t->base.dirty_images[face] = 0;
- }
-
- if (RADEON_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
- radeonFinish(rmesa->radeon.glCtx);
- }
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.c
deleted file mode 100644
index 71d28db05..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.c
+++ /dev/null
@@ -1,270 +0,0 @@
-#include "glheader.h"
-#include "state.h"
-#include "imports.h"
-#include "enums.h"
-#include "macros.h"
-#include "context.h"
-#include "dd.h"
-#include "simple_list.h"
-
-#include "api_arrayelt.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "texformat.h"
-
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "r300_context.h"
-#if USE_ARB_F_P == 0
-#include "r300_ioctl.h"
-#include "r300_state.h"
-#include "r300_reg.h"
-#include "r300_program.h"
-#include "r300_emit.h"
-#include "r300_fixed_pipelines.h"
-#include "r300_tex.h"
-#include "pixel_shader.h"
-#include "r300_texprog.h"
-
-/* TODO: we probably should have a better way to emit alu instructions */
-#define INST0 p->alu.inst[p->alu.length].inst0 =
-#define INST1 p->alu.inst[p->alu.length].inst1 =
-#define INST2 p->alu.inst[p->alu.length].inst2 =
-#define INST3 p->alu.inst[p->alu.length].inst3 =
-#define EMIT_INST p->alu.length++
-
-void emit_tex(struct r300_pixel_shader_program *p, GLuint dest, GLuint unit, GLuint src)
-{
- p->tex.inst[p->tex.length++] = 0
- | (src << R300_FPITX_SRC_SHIFT)
- | (dest << R300_FPITX_DST_SHIFT)
- | (unit << R300_FPITX_IMAGE_SHIFT)
- /* I don't know if this is needed, but the hardcoded 0x18000 set it, so I will too */
- | (3 << 15);
-// fprintf(stderr, "emit texinst: 0x%x\n", p->tex.inst[p->tex.length-1]);
-}
-
-GLuint get_source(struct r300_pixel_shader_state *ps, GLenum src, GLuint unit, GLuint tc_reg) {
- switch (src) {
- case GL_TEXTURE:
- if (!ps->have_sample) {
- emit_tex(&ps->program, tc_reg, unit, tc_reg);
- ps->have_sample = 1;
- }
- return tc_reg;
- case GL_CONSTANT:
- WARN_ONCE("TODO: Implement envcolor\n");
- return ps->color_reg;
- case GL_PRIMARY_COLOR:
- return ps->color_reg;
- case GL_PREVIOUS:
- return ps->src_previous;
- default:
- WARN_ONCE("Unknown source enum\n");
- return ps->src_previous;
- }
-}
-
-GLuint get_temp(struct r300_pixel_shader_program *p)
-{
- return p->temp_register_count++;
-}
-
-inline void emit_texenv_color(r300ContextPtr r300, struct r300_pixel_shader_state *ps,
- GLuint out, GLenum envmode, GLenum format, GLuint unit, GLuint tc_reg) {
- struct r300_pixel_shader_program *p = &ps->program;
-
- const GLuint Cp = get_source(ps, GL_PREVIOUS, unit, tc_reg);
- const GLuint Cs = get_source(ps, GL_TEXTURE, unit, tc_reg);
-
- switch(envmode) {
- case GL_DECAL: /* TODO */
- case GL_BLEND: /* TODO */
- case GL_REPLACE:
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- switch (format) {
- case GL_ALPHA:
- // Cv = Cp
- INST1 EASY_PFS_INSTR1(out, Cp, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- default:
- // Cv = Cs
- INST1 EASY_PFS_INSTR1(out, Cs, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- }
- break;
- case GL_MODULATE:
- switch (format) {
- case GL_ALPHA:
- // Cv = Cp
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- INST1 EASY_PFS_INSTR1(out, Cp, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- default:
- // Cv = CpCs
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO);
- INST1 EASY_PFS_INSTR1(out, Cp, Cs, PFS_FLAG_CONST, ALL, NONE);
- break;
- }
- break;
- case GL_ADD:
- switch (format) {
- case GL_ALPHA:
- // Cv = Cp
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- INST1 EASY_PFS_INSTR1(out, Cp, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- default:
- // Cv = Cp + Cs
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, SRC1C_XYZ);
- INST1 EASY_PFS_INSTR1(out, Cp, Cs, PFS_FLAG_CONST, ALL, NONE);
- break;
- }
- break;
- default:
- fprintf(stderr, "%s: should never get here!\n", __func__);
- break;
- }
-
- return;
-}
-
-inline void emit_texenv_alpha(r300ContextPtr r300, struct r300_pixel_shader_state *ps,
- GLuint out, GLenum envmode, GLenum format, GLuint unit, GLuint tc_reg) {
- struct r300_pixel_shader_program *p = &ps->program;
-
- const GLuint Ap = get_source(ps, GL_PREVIOUS, unit, tc_reg);
- const GLuint As = get_source(ps, GL_TEXTURE, unit, tc_reg);
-
- switch(envmode) {
- case GL_DECAL: /* TODO */
- case GL_BLEND: /* TODO */
- case GL_REPLACE:
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
- switch (format) {
- case GL_LUMINANCE:
- case GL_RGB:
- // Av = Ap
- INST3 EASY_PFS_INSTR3(out, Ap, PFS_FLAG_CONST, PFS_FLAG_CONST, REG);
- break;
- default:
- INST3 EASY_PFS_INSTR3(out, As, PFS_FLAG_CONST, PFS_FLAG_CONST, REG);
- break;
- }
- break;
- case GL_MODULATE:
- case GL_ADD:
- switch (format) {
- case GL_LUMINANCE:
- case GL_RGB:
- // Av = Ap
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
- INST3 EASY_PFS_INSTR3(out, Ap, PFS_FLAG_CONST, PFS_FLAG_CONST, REG);
- break;
- default:
- // Av = ApAs
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO);
- INST3 EASY_PFS_INSTR3(out, Ap, As, PFS_FLAG_CONST, REG);
- break;
- }
- break;
- default:
- fprintf(stderr, "%s: should never get here!\n", __func__);
- break;
- }
-
- return;
-}
-
-GLuint emit_texenv(r300ContextPtr r300, GLuint tc_reg, GLuint unit)
-{
- struct r300_pixel_shader_state *ps = &r300->state.pixel_shader;
- struct r300_pixel_shader_program *p = &ps->program;
- GLcontext *ctx = r300->radeon.glCtx;
- struct gl_texture_object *texobj = ctx->Texture.Unit[unit]._Current;
- GLenum envmode = ctx->Texture.Unit[unit].EnvMode;
- GLenum format = texobj->Image[0][texobj->BaseLevel]->Format;
-
- const GLuint out = tc_reg;
- const GLuint Cf = get_source(ps, GL_PRIMARY_COLOR, unit, tc_reg);
-
- WARN_ONCE("Texture environments are currently incomplete / wrong! Help me!\n");
-// fprintf(stderr, "EnvMode = %s\n", _mesa_lookup_enum_by_nr(ctx->Texture.Unit[unit].EnvMode));
-
- switch (envmode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_DECAL:
- case GL_BLEND:
- case GL_ADD:
- /* Maybe these should be combined? I thought it'd be messy */
- emit_texenv_color(r300, ps, out, envmode, format, unit, tc_reg);
- emit_texenv_alpha(r300, ps, out, envmode, format, unit, tc_reg);
- EMIT_INST;
- return out;
- break;
- case GL_COMBINE:
- WARN_ONCE("EnvMode == GL_COMBINE unsupported! Help Me!!\n");
- return get_source(ps, GL_TEXTURE, unit, tc_reg);
- break;
- default:
- WARN_ONCE("Unknown EnvMode == %d, name=%s\n", envmode,
- _mesa_lookup_enum_by_nr(envmode));
- return get_source(ps, GL_TEXTURE, unit, tc_reg);
- break;
- }
-
-}
-
-void r300GenerateTextureFragmentShader(r300ContextPtr r300)
-{
- struct r300_pixel_shader_state *ps = &r300->state.pixel_shader;
- struct r300_pixel_shader_program *p = &ps->program;
- GLcontext *ctx = r300->radeon.glCtx;
- int i, tc_reg;
- GLuint OutputsWritten;
-
- if(hw_tcl_on)
- OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
-
- p->tex.length = 0;
- p->alu.length = 0;
- p->active_nodes = 1;
- p->first_node_has_tex = 1;
- p->temp_register_count = r300->state.texture.tc_count + 1; /* texcoords and colour reg */
-
- ps->color_reg = r300->state.texture.tc_count;
- ps->src_previous = ps->color_reg;
-
- tc_reg = 0;
- for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
- if (TMU_ENABLED(ctx, i)) {
- ps->have_sample = 0;
- ps->src_previous = emit_texenv(r300, tc_reg, i);
- tc_reg++;
- }
- }
-
-/* Do a MOV from last output, to destination reg.. This won't be needed when we
- * have a better way of emitting alu instructions
- */
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- INST1 EASY_PFS_INSTR1(0, ps->src_previous, PFS_FLAG_CONST, PFS_FLAG_CONST, NONE, ALL);
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
- INST3 EASY_PFS_INSTR3(0, ps->src_previous, PFS_FLAG_CONST, PFS_FLAG_CONST, OUTPUT);
- EMIT_INST;
-
- p->node[3].tex_end = ps->program.tex.length - 1;
- p->node[3].tex_offset = 0;
- p->node[3].alu_end = ps->program.alu.length - 1;
- p->node[3].alu_offset = 0;
-
- p->tex_end = ps->program.tex.length - 1;
- p->tex_offset = 0;
- p->alu_end = ps->program.alu.length - 1;
- p->alu_offset = 0;
-}
-#endif // USE_ARB_F_P == 0
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.h
deleted file mode 100644
index 4e91a1169..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texprog.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __R300_TEXPROG_H_
-#define __R300_TEXPROG_H_
-
-#include "r300_context.h"
-
-void r300GenerateTextureFragmentShader(r300ContextPtr r300);
-
-#endif
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texstate.c
deleted file mode 100644
index b06629ca1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_texstate.c
+++ /dev/null
@@ -1,1465 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_texstate.c,v 1.3 2003/02/15 22:18:47 dawes Exp $ */
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-#include "enums.h"
-
-#include "r300_context.h"
-#include "r300_state.h"
-#include "r300_ioctl.h"
-#include "radeon_ioctl.h"
-//#include "r300_swtcl.h"
-#include "r300_tex.h"
-//#include "r300_tcl.h"
-#include "r300_reg.h"
-
-#define R200_TXFORMAT_A8 R200_TXFORMAT_I8
-#define R200_TXFORMAT_L8 R200_TXFORMAT_I8
-#define R200_TXFORMAT_AL88 R200_TXFORMAT_AI88
-#define R200_TXFORMAT_YCBCR R200_TXFORMAT_YVYU422
-#define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422
-
-#define _COLOR(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 }
-#define _COLOR_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f, 0 }
-#define _ALPHA(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _ALPHA_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _YUV(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB }
-#define _INVALID(f) \
- [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \
- && tx_table[f].flag )
-
-#define _ASSIGN(entry, format) \
- [ MESA_FORMAT_ ## entry ] = { format, 0, 1}
-
-static const struct {
- GLuint format, filter;
-} tx_table0[] = {
- _ALPHA(RGBA8888),
- _ALPHA_REV(RGBA8888),
- _ALPHA(ARGB8888),
- _ALPHA_REV(ARGB8888),
- _INVALID(RGB888),
- _COLOR(RGB565),
- _COLOR_REV(RGB565),
- _ALPHA(ARGB4444),
- _ALPHA_REV(ARGB4444),
- _ALPHA(ARGB1555),
- _ALPHA_REV(ARGB1555),
- _ALPHA(AL88),
- _ALPHA_REV(AL88),
- _ALPHA(A8),
- _COLOR(L8),
- _ALPHA(I8),
- _INVALID(CI8),
- _YUV(YCBCR),
- _YUV(YCBCR_REV),
- };
-
-static const struct {
- GLuint format, filter, flag;
-} tx_table[] = {
- /*
- * Note that the _REV formats are the same as the non-REV formats.
- * This is because the REV and non-REV formats are identical as a
- * byte string, but differ when accessed as 16-bit or 32-bit words
- * depending on the endianness of the host. Since the textures are
- * transferred to the R300 as a byte string (i.e. without any
- * byte-swapping), the R300 sees the REV and non-REV formats
- * identically. -- paulus
- */
- _ASSIGN(RGBA8888, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8)),
- _ASSIGN(RGBA8888_REV, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8)),
- _ASSIGN(ARGB8888, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)),
- _ASSIGN(ARGB8888_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)),
- _ASSIGN(RGB888, 0xffffffff),
- _ASSIGN(RGB565, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
- _ASSIGN(RGB565_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
- _ASSIGN(ARGB4444, R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4)),
- _ASSIGN(ARGB4444_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4)),
- _ASSIGN(ARGB1555, R300_EASY_TX_FORMAT(Z, Y, X, W, W1Z5Y5X5)),
- _ASSIGN(ARGB1555_REV, R300_EASY_TX_FORMAT(Z, Y, X, W, W1Z5Y5X5)),
- _ASSIGN(AL88, R300_EASY_TX_FORMAT(Y, Y, Y, X, Y8X8)),
- _ASSIGN(AL88_REV, R300_EASY_TX_FORMAT(Y, Y, Y, X, Y8X8)),
- _ASSIGN(RGB332, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z3Y3X2)),
- _ASSIGN(A8, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X8)),
- _ASSIGN(L8, R300_EASY_TX_FORMAT(X, X, X, ONE, X8)),
- _ASSIGN(I8, R300_EASY_TX_FORMAT(X, X, X, X, X8)),
- _ASSIGN(CI8, R300_EASY_TX_FORMAT(X, X, X, X, X8)),
- _ASSIGN(YCBCR, R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8)|R300_TX_FORMAT_YUV_MODE ),
- _ASSIGN(YCBCR_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8)|R300_TX_FORMAT_YUV_MODE),
- };
-
-#undef _COLOR
-#undef _ALPHA
-#undef _INVALID
-#undef _ASSIGN
-
-
-/**
- * This function computes the number of bytes of storage needed for
- * the given texture object (all mipmap levels, all cube faces).
- * The \c image[face][level].x/y/width/height parameters for upload/blitting
- * are computed here. \c filter, \c format, etc. will be set here
- * too.
- *
- * \param rmesa Context pointer
- * \param tObj GL texture object whose images are to be posted to
- * hardware state.
- */
-static void r300SetTexImages(r300ContextPtr rmesa,
- struct gl_texture_object *tObj)
-{
- r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage =
- tObj->Image[0][tObj->BaseLevel];
- GLint curOffset;
- GLint i;
- GLint numLevels;
- GLint log2Width, log2Height, log2Depth;
-
- /* Set the hardware texture format
- */
-
- t->format &= ~(R200_TXFORMAT_FORMAT_MASK |
- R200_TXFORMAT_ALPHA_IN_MAP);
-#if 0
- t->filter &= ~R200_YUV_TO_RGB;
-#endif
- if (VALID_FORMAT(baseImage->TexFormat->MesaFormat)) {
- t->format =
- tx_table[baseImage->TexFormat->MesaFormat].format;
-#if 1
- t->filter |=
- tx_table[baseImage->TexFormat->MesaFormat].filter;
-#endif
- } else {
- _mesa_problem(NULL, "unexpected texture format in %s",
- __FUNCTION__);
- return;
- }
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel((driTextureObject *) t);
- log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2;
- log2Depth = tObj->Image[0][t->base.firstLevel]->DepthLog2;
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS);
-
- /* Calculate mipmap offsets and dimensions for blitting (uploading)
- * The idea is that we lay out the mipmap levels within a block of
- * memory organized as a rectangle of width BLIT_WIDTH_BYTES.
- */
- curOffset = 0;
-
- for (i = 0; i < numLevels; i++) {
- const struct gl_texture_image *texImage;
- GLuint size;
-
- texImage = tObj->Image[0][i + t->base.firstLevel];
- if (!texImage)
- break;
-
- /* find image size in bytes */
- if (texImage->IsCompressed) {
- size = texImage->CompressedSize;
- } else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- size =
- ((texImage->Width *
- texImage->TexFormat->TexelBytes + 63)
- & ~63) * texImage->Height;
- } else {
- int w =
- texImage->Width * texImage->TexFormat->TexelBytes;
- if (w < 32)
- w = 32;
- size = w * texImage->Height * texImage->Depth;
- }
- assert(size > 0);
-
- if(0)
- fprintf(stderr, "w=%d h=%d d=%d tb=%d intFormat=%d\n", texImage->Width, texImage->Height,
- texImage->Depth, texImage->TexFormat->TexelBytes,
- texImage->IntFormat);
-
- /* Align to 32-byte offset. It is faster to do this unconditionally
- * (no branch penalty).
- */
-
- curOffset = (curOffset + 0x1f) & ~0x1f;
-
- t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES;
- t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES;
- t->image[0][i].width = MIN2(size, BLIT_WIDTH_BYTES);
- t->image[0][i].height = size / t->image[0][i].width;
-
-#if 0
- /* for debugging only and only applicable to non-rectangle targets */
- assert(size % t->image[0][i].width == 0);
- assert(t->image[0][i].x == 0
- || (size < BLIT_WIDTH_BYTES
- && t->image[0][i].height == 1));
-#endif
-
- if (0)
- fprintf(stderr,
- "level %d: %dx%d x=%d y=%d w=%d h=%d size=%d at %d\n",
- i, texImage->Width, texImage->Height,
- t->image[0][i].x, t->image[0][i].y,
- t->image[0][i].width, t->image[0][i].height,
- size, curOffset);
-
- curOffset += size;
-
- }
-
- /* Align the total size of texture memory block.
- */
- t->base.totalSize =
- (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK;
-
- /* Setup remaining cube face blits, if needed */
- if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
- /* Round totalSize up to multiple of BLIT_WIDTH_BYTES */
- const GLuint faceSize =
- (t->base.totalSize + BLIT_WIDTH_BYTES - 1)
- & ~(BLIT_WIDTH_BYTES - 1);
- const GLuint lines = faceSize / BLIT_WIDTH_BYTES;
- GLuint face;
- /* reuse face 0 x/y/width/height - just adjust y */
- for (face = 1; face < 6; face++) {
- for (i = 0; i < numLevels; i++) {
- t->image[face][i].x = t->image[0][i].x;
- t->image[face][i].y =
- t->image[0][i].y + face * lines;
- t->image[face][i].width = t->image[0][i].width;
- t->image[face][i].height =
- t->image[0][i].height;
- }
- }
- t->base.totalSize = 6 * faceSize; /* total texmem needed */
- }
-
- /* Hardware state:
- */
-#if 0
- t->filter &= ~R200_MAX_MIP_LEVEL_MASK;
- t->filter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
-#endif
-#if 0
- t->format &= ~(R200_TXFORMAT_WIDTH_MASK |
- R200_TXFORMAT_HEIGHT_MASK |
- R200_TXFORMAT_CUBIC_MAP_ENABLE |
- R200_TXFORMAT_F5_WIDTH_MASK |
- R200_TXFORMAT_F5_HEIGHT_MASK);
- t->format |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
- (log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
-#endif
-
- t->format_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
- if (tObj->Target == GL_TEXTURE_3D) {
- t->format_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT);
- t->format_x |= R200_TEXCOORD_VOLUME;
- } else if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
- ASSERT(log2Width == log2Height);
- t->format |= ((log2Width << R200_TXFORMAT_F5_WIDTH_SHIFT) |
- (log2Height << R200_TXFORMAT_F5_HEIGHT_SHIFT)
- | (R200_TXFORMAT_CUBIC_MAP_ENABLE));
- t->format_x |= R200_TEXCOORD_CUBIC_ENV;
- t->pp_cubic_faces = ((log2Width << R200_FACE_WIDTH_1_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_1_SHIFT) |
- (log2Width << R200_FACE_WIDTH_2_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_2_SHIFT) |
- (log2Width << R200_FACE_WIDTH_3_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_3_SHIFT) |
- (log2Width << R200_FACE_WIDTH_4_SHIFT) |
- (log2Height << R200_FACE_HEIGHT_4_SHIFT));
- }
-
- t->size = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << R300_TX_WIDTHMASK_SHIFT)
- |((tObj->Image[0][t->base.firstLevel]->Height - 1) << R300_TX_HEIGHTMASK_SHIFT)
- |((log2Width>log2Height)?log2Width:log2Height)<<R300_TX_SIZE_SHIFT);
-
- /* Only need to round to nearest 32 for textures, but the blitter
- * requires 64-byte aligned pitches, and we may/may not need the
- * blitter. NPOT only!
- */
- if (baseImage->IsCompressed)
- t->pitch =
- (tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63);
- else
- t->pitch =
- ((tObj->Image[0][t->base.firstLevel]->Width *
- baseImage->TexFormat->TexelBytes) + 63) & ~(63);
- t->pitch -= 32;
-
- t->dirty_state = TEX_ALL;
-
- /* FYI: r300UploadTexImages( rmesa, t ) used to be called here */
-}
-
-/* ================================================================
- * Texture combine functions
- */
-
-/* GL_ARB_texture_env_combine support
- */
-
-/* The color tables have combine functions for GL_SRC_COLOR,
- * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint r300_register_color[][R200_MAX_TEXTURE_UNITS] = {
- {
- R200_TXC_ARG_A_R0_COLOR,
- R200_TXC_ARG_A_R1_COLOR,
- R200_TXC_ARG_A_R2_COLOR,
- R200_TXC_ARG_A_R3_COLOR,
- R200_TXC_ARG_A_R4_COLOR,
- R200_TXC_ARG_A_R5_COLOR},
- {
- R200_TXC_ARG_A_R0_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R1_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R2_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R3_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R4_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R5_COLOR | R200_TXC_COMP_ARG_A},
- {
- R200_TXC_ARG_A_R0_ALPHA,
- R200_TXC_ARG_A_R1_ALPHA,
- R200_TXC_ARG_A_R2_ALPHA,
- R200_TXC_ARG_A_R3_ALPHA,
- R200_TXC_ARG_A_R4_ALPHA,
- R200_TXC_ARG_A_R5_ALPHA},
- {
- R200_TXC_ARG_A_R0_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R1_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R2_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R3_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R4_ALPHA | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_R5_ALPHA | R200_TXC_COMP_ARG_A},
-};
-
-static GLuint r300_tfactor_color[] = {
- R200_TXC_ARG_A_TFACTOR_COLOR,
- R200_TXC_ARG_A_TFACTOR_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_TFACTOR_ALPHA,
- R200_TXC_ARG_A_TFACTOR_ALPHA | R200_TXC_COMP_ARG_A
-};
-
-static GLuint r300_primary_color[] = {
- R200_TXC_ARG_A_DIFFUSE_COLOR,
- R200_TXC_ARG_A_DIFFUSE_COLOR | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_DIFFUSE_ALPHA,
- R200_TXC_ARG_A_DIFFUSE_ALPHA | R200_TXC_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-3
- * GL_ONE table - indices 1-4
- */
-static GLuint r300_zero_color[] = {
- R200_TXC_ARG_A_ZERO,
- R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_ZERO,
- R200_TXC_ARG_A_ZERO | R200_TXC_COMP_ARG_A,
- R200_TXC_ARG_A_ZERO
-};
-
-/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint r300_register_alpha[][R200_MAX_TEXTURE_UNITS] = {
- {
- R200_TXA_ARG_A_R0_ALPHA,
- R200_TXA_ARG_A_R1_ALPHA,
- R200_TXA_ARG_A_R2_ALPHA,
- R200_TXA_ARG_A_R3_ALPHA,
- R200_TXA_ARG_A_R4_ALPHA,
- R200_TXA_ARG_A_R5_ALPHA},
- {
- R200_TXA_ARG_A_R0_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R1_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R2_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R3_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R4_ALPHA | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_R5_ALPHA | R200_TXA_COMP_ARG_A},
-};
-
-static GLuint r300_tfactor_alpha[] = {
- R200_TXA_ARG_A_TFACTOR_ALPHA,
- R200_TXA_ARG_A_TFACTOR_ALPHA | R200_TXA_COMP_ARG_A
-};
-
-static GLuint r300_primary_alpha[] = {
- R200_TXA_ARG_A_DIFFUSE_ALPHA,
- R200_TXA_ARG_A_DIFFUSE_ALPHA | R200_TXA_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-1
- * GL_ONE table - indices 1-2
- */
-static GLuint r300_zero_alpha[] = {
- R200_TXA_ARG_A_ZERO,
- R200_TXA_ARG_A_ZERO | R200_TXA_COMP_ARG_A,
- R200_TXA_ARG_A_ZERO,
-};
-
-/* Extract the arg from slot A, shift it into the correct argument slot
- * and set the corresponding complement bit.
- */
-#define R200_COLOR_ARG( n, arg ) \
-do { \
- color_combine |= \
- ((color_arg[n] & R200_TXC_ARG_A_MASK) \
- << R200_TXC_ARG_##arg##_SHIFT); \
- color_combine |= \
- ((color_arg[n] >> R200_TXC_COMP_ARG_A_SHIFT) \
- << R200_TXC_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-#define R200_ALPHA_ARG( n, arg ) \
-do { \
- alpha_combine |= \
- ((alpha_arg[n] & R200_TXA_ARG_A_MASK) \
- << R200_TXA_ARG_##arg##_SHIFT); \
- alpha_combine |= \
- ((alpha_arg[n] >> R200_TXA_COMP_ARG_A_SHIFT) \
- << R200_TXA_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-/* ================================================================
- * Texture unit state management
- */
-
-static GLboolean r300UpdateTextureEnv(GLcontext * ctx, int unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint color_combine, alpha_combine;
-
-#if 0 /* disable for now.. */
- GLuint color_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] &
- ~(R200_TXC_SCALE_MASK);
- GLuint alpha_scale = rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] &
- ~(R200_TXA_DOT_ALPHA | R200_TXA_SCALE_MASK);
-#endif
-
- GLuint color_scale=0, alpha_scale=0;
-
- /* texUnit->_Current can be NULL if and only if the texture unit is
- * not actually enabled.
- */
- assert((texUnit->_ReallyEnabled == 0)
- || (texUnit->_Current != NULL));
-
- if (RADEON_DEBUG & DEBUG_TEXTURE) {
- fprintf(stderr, "%s( %p, %d )\n", __FUNCTION__, (void *)ctx,
- unit);
- }
-
- /* Set the texture environment state. Isn't this nice and clean?
- * The chip will automagically set the texture alpha to 0xff when
- * the texture format does not include an alpha component. This
- * reduces the amount of special-casing we have to do, alpha-only
- * textures being a notable exception.
- */
- /* Don't cache these results.
- */
-#if 0
- rmesa->state.texture.unit[unit].format = 0;
-#endif
- rmesa->state.texture.unit[unit].envMode = 0;
-
-
- if (!texUnit->_ReallyEnabled) {
- if (unit == 0) {
- color_combine =
- R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_DIFFUSE_COLOR | R200_TXC_OP_MADD;
- alpha_combine =
- R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_DIFFUSE_ALPHA | R200_TXA_OP_MADD;
- } else {
- color_combine =
- R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR | R200_TXC_OP_MADD;
- alpha_combine =
- R200_TXA_ARG_A_ZERO | R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA | R200_TXA_OP_MADD;
- }
- } else {
- GLuint color_arg[3], alpha_arg[3];
- GLuint i;
- const GLuint numColorArgs =
- texUnit->_CurrentCombine->_NumArgsRGB;
- const GLuint numAlphaArgs = texUnit->_CurrentCombine->_NumArgsA;
- GLuint RGBshift = texUnit->_CurrentCombine->ScaleShiftRGB;
- GLuint Ashift = texUnit->_CurrentCombine->ScaleShiftA;
-
- /* Step 1:
- * Extract the color and alpha combine function arguments.
- */
- for (i = 0; i < numColorArgs; i++) {
- const GLint op =
- texUnit->_CurrentCombine->OperandRGB[i] -
- GL_SRC_COLOR;
- assert(op >= 0);
- assert(op <= 3);
- switch (texUnit->_CurrentCombine->SourceRGB[i]) {
- case GL_TEXTURE:
- color_arg[i] = r300_register_color[op][unit];
- break;
- case GL_CONSTANT:
- color_arg[i] = r300_tfactor_color[op];
- break;
- case GL_PRIMARY_COLOR:
- color_arg[i] = r300_primary_color[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- color_arg[i] = r300_primary_color[op];
- else
- color_arg[i] =
- r300_register_color[op][0];
- break;
- case GL_ZERO:
- color_arg[i] = r300_zero_color[op];
- break;
- case GL_ONE:
- color_arg[i] = r300_zero_color[op + 1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- for (i = 0; i < numAlphaArgs; i++) {
- const GLint op =
- texUnit->_CurrentCombine->OperandA[i] -
- GL_SRC_ALPHA;
- assert(op >= 0);
- assert(op <= 1);
- switch (texUnit->_CurrentCombine->SourceA[i]) {
- case GL_TEXTURE:
- alpha_arg[i] = r300_register_alpha[op][unit];
- break;
- case GL_CONSTANT:
- alpha_arg[i] = r300_tfactor_alpha[op];
- break;
- case GL_PRIMARY_COLOR:
- alpha_arg[i] = r300_primary_alpha[op];
- break;
- case GL_PREVIOUS:
- if (unit == 0)
- alpha_arg[i] = r300_primary_alpha[op];
- else
- alpha_arg[i] =
- r300_register_alpha[op][0];
- break;
- case GL_ZERO:
- alpha_arg[i] = r300_zero_alpha[op];
- break;
- case GL_ONE:
- alpha_arg[i] = r300_zero_alpha[op + 1];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- /* Step 2:
- * Build up the color and alpha combine functions.
- */
- switch (texUnit->_CurrentCombine->ModeRGB) {
- case GL_REPLACE:
- color_combine = (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG(0, C);
- break;
- case GL_MODULATE:
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, B);
- break;
- case GL_ADD:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_OP_MADD);
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, C);
- break;
- case GL_ADD_SIGNED:
- color_combine = (R200_TXC_ARG_B_ZERO | R200_TXC_COMP_ARG_B | R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, C);
- break;
- case GL_SUBTRACT:
- color_combine = (R200_TXC_ARG_B_ZERO |
- R200_TXC_COMP_ARG_B |
- R200_TXC_NEG_ARG_C | R200_TXC_OP_MADD);
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, C);
- break;
- case GL_INTERPOLATE:
- color_combine = (R200_TXC_OP_LERP);
- R200_COLOR_ARG(0, B);
- R200_COLOR_ARG(1, A);
- R200_COLOR_ARG(2, C);
- break;
-
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- RGBshift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- /* DOT3 works differently on R200 than on R100. On R100, just
- * setting the DOT3 mode did everything for you. On R200, the
- * driver has to enable the biasing and scale in the inputs to
- * put them in the proper [-1,1] range. This is what the 4x and
- * the -0.5 in the DOT3 spec do. The post-scale is then set
- * normally.
- */
-
- color_combine = (R200_TXC_ARG_C_ZERO |
- R200_TXC_OP_DOT3 |
- R200_TXC_BIAS_ARG_A |
- R200_TXC_BIAS_ARG_B |
- R200_TXC_SCALE_ARG_A |
- R200_TXC_SCALE_ARG_B);
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, B);
- break;
-
- case GL_MODULATE_ADD_ATI:
- color_combine = (R200_TXC_OP_MADD);
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, C);
- R200_COLOR_ARG(2, B);
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- color_combine = (R200_TXC_BIAS_ARG_C | /* new */
- R200_TXC_OP_MADD); /* was ADDSIGNED */
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, C);
- R200_COLOR_ARG(2, B);
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- color_combine = (R200_TXC_NEG_ARG_C | R200_TXC_OP_MADD);
- R200_COLOR_ARG(0, A);
- R200_COLOR_ARG(1, C);
- R200_COLOR_ARG(2, B);
- break;
- default:
- return GL_FALSE;
- }
-
- switch (texUnit->_CurrentCombine->ModeA) {
- case GL_REPLACE:
- alpha_combine = (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG(0, C);
- break;
- case GL_MODULATE:
- alpha_combine = (R200_TXA_ARG_C_ZERO |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG(0, A);
- R200_ALPHA_ARG(1, B);
- break;
- case GL_ADD:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_OP_MADD);
- R200_ALPHA_ARG(0, A);
- R200_ALPHA_ARG(1, C);
- break;
- case GL_ADD_SIGNED:
- alpha_combine = (R200_TXA_ARG_B_ZERO | R200_TXA_COMP_ARG_B | R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG(0, A);
- R200_ALPHA_ARG(1, C);
- break;
- case GL_SUBTRACT:
- alpha_combine = (R200_TXA_ARG_B_ZERO |
- R200_TXA_COMP_ARG_B |
- R200_TXA_NEG_ARG_C | R200_TXA_OP_MADD);
- R200_ALPHA_ARG(0, A);
- R200_ALPHA_ARG(1, C);
- break;
- case GL_INTERPOLATE:
- alpha_combine = (R200_TXA_OP_LERP);
- R200_ALPHA_ARG(0, B);
- R200_ALPHA_ARG(1, A);
- R200_ALPHA_ARG(2, C);
- break;
-
- case GL_MODULATE_ADD_ATI:
- alpha_combine = (R200_TXA_OP_MADD);
- R200_ALPHA_ARG(0, A);
- R200_ALPHA_ARG(1, C);
- R200_ALPHA_ARG(2, B);
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- alpha_combine = (R200_TXA_BIAS_ARG_C | /* new */
- R200_TXA_OP_MADD); /* was ADDSIGNED */
- R200_ALPHA_ARG(0, A);
- R200_ALPHA_ARG(1, C);
- R200_ALPHA_ARG(2, B);
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- alpha_combine = (R200_TXA_NEG_ARG_C | R200_TXA_OP_MADD);
- R200_ALPHA_ARG(0, A);
- R200_ALPHA_ARG(1, C);
- R200_ALPHA_ARG(2, B);
- break;
- default:
- return GL_FALSE;
- }
-
- if ((texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT)
- || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA)) {
- alpha_scale |= R200_TXA_DOT_ALPHA;
- Ashift = RGBshift;
- }
-
- /* Step 3:
- * Apply the scale factor.
- */
- color_scale |= (RGBshift << R200_TXC_SCALE_SHIFT);
- alpha_scale |= (Ashift << R200_TXA_SCALE_SHIFT);
-
- /* All done!
- */
- }
-
-#if 0
- fprintf(stderr, "color_combine=%08x alpha_combine=%08x color_scale=%08x alpha_scale=%08x\n",
- color_combine, alpha_combine, color_scale, alpha_scale);
-#endif
-
-#if 0
- if (rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] != color_combine ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] != alpha_combine ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] != color_scale ||
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] != alpha_scale) {
- R300_STATECHANGE(rmesa, pix[unit]);
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND] = color_combine;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND] = alpha_combine;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXCBLEND2] = color_scale;
- rmesa->hw.pix[unit].cmd[PIX_PP_TXABLEND2] = alpha_scale;
- }
-
-#endif
-
- return GL_TRUE;
-}
-
-#define TEXOBJ_TXFILTER_MASK (R200_MAX_MIP_LEVEL_MASK | \
- R200_MIN_FILTER_MASK | \
- R200_MAG_FILTER_MASK | \
- R200_MAX_ANISO_MASK | \
- R200_YUV_TO_RGB | \
- R200_YUV_TEMPERATURE_MASK | \
- R200_CLAMP_S_MASK | \
- R200_CLAMP_T_MASK | \
- R200_BORDER_MODE_D3D )
-
-#define TEXOBJ_TXFORMAT_MASK (R200_TXFORMAT_WIDTH_MASK | \
- R200_TXFORMAT_HEIGHT_MASK | \
- R200_TXFORMAT_FORMAT_MASK | \
- R200_TXFORMAT_F5_WIDTH_MASK | \
- R200_TXFORMAT_F5_HEIGHT_MASK | \
- R200_TXFORMAT_ALPHA_IN_MAP | \
- R200_TXFORMAT_CUBIC_MAP_ENABLE | \
- R200_TXFORMAT_NON_POWER2)
-
-#define TEXOBJ_TXFORMAT_X_MASK (R200_DEPTH_LOG2_MASK | \
- R200_TEXCOORD_MASK | \
- R200_CLAMP_Q_MASK | \
- R200_VOLUME_FILTER_MASK)
-
-static void import_tex_obj_state(r300ContextPtr rmesa,
- int unit, r300TexObjPtr texobj)
-{
-#if 0 /* needs fixing.. or should be done elsewhere */
- GLuint *cmd = R300_DB_STATE(tex[unit]);
-
- cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFILTER] |= texobj->filter & TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT] |= texobj->format & TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT_X] &= ~TEXOBJ_TXFORMAT_X_MASK;
- cmd[TEX_PP_TXFORMAT_X] |=
- texobj->format_x & TEXOBJ_TXFORMAT_X_MASK;
- cmd[TEX_PP_TXSIZE] = texobj->size; /* NPOT only! */
- cmd[TEX_PP_TXPITCH] = texobj->pitch; /* NPOT only! */
- cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset;
- cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color;
- R200_DB_STATECHANGE(rmesa, &rmesa->hw.tex[unit]);
-
- if (texobj->base.tObj->Target == GL_TEXTURE_CUBE_MAP) {
- GLuint *cube_cmd = R200_DB_STATE(cube[unit]);
- GLuint bytesPerFace = texobj->base.totalSize / 6;
- ASSERT(texobj->totalSize % 6 == 0);
- cube_cmd[CUBE_PP_CUBIC_FACES] = texobj->pp_cubic_faces;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F1] =
- texobj->pp_txoffset + 1 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F2] =
- texobj->pp_txoffset + 2 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F3] =
- texobj->pp_txoffset + 3 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F4] =
- texobj->pp_txoffset + 4 * bytesPerFace;
- cube_cmd[CUBE_PP_CUBIC_OFFSET_F5] =
- texobj->pp_txoffset + 5 * bytesPerFace;
- R200_DB_STATECHANGE(rmesa, &rmesa->hw.cube[unit]);
- }
-
- texobj->dirty_state &= ~(1 << unit);
-#endif
-}
-
-static void set_texgen_matrix(r300ContextPtr rmesa,
- GLuint unit,
- const GLfloat * s_plane,
- const GLfloat * t_plane, const GLfloat * r_plane)
-{
- static const GLfloat scale_identity[4] = { 1, 1, 1, 1 };
-
- if (!TEST_EQ_4V(s_plane, scale_identity) ||
- !TEST_EQ_4V(t_plane, scale_identity) ||
- !TEST_EQ_4V(r_plane, scale_identity)) {
- rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit;
- rmesa->TexGenMatrix[unit].m[0] = s_plane[0];
- rmesa->TexGenMatrix[unit].m[4] = s_plane[1];
- rmesa->TexGenMatrix[unit].m[8] = s_plane[2];
- rmesa->TexGenMatrix[unit].m[12] = s_plane[3];
-
- rmesa->TexGenMatrix[unit].m[1] = t_plane[0];
- rmesa->TexGenMatrix[unit].m[5] = t_plane[1];
- rmesa->TexGenMatrix[unit].m[9] = t_plane[2];
- rmesa->TexGenMatrix[unit].m[13] = t_plane[3];
-
- /* NOTE: r_plane goes in the 4th row, not 3rd! */
- rmesa->TexGenMatrix[unit].m[3] = r_plane[0];
- rmesa->TexGenMatrix[unit].m[7] = r_plane[1];
- rmesa->TexGenMatrix[unit].m[11] = r_plane[2];
- rmesa->TexGenMatrix[unit].m[15] = r_plane[3];
-
- //rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-}
-
-/* Need this special matrix to get correct reflection map coords */
-static void set_texgen_reflection_matrix(r300ContextPtr rmesa, GLuint unit)
-{
- static const GLfloat m[16] = {
- -1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, 0, -1,
- 0, 0, -1, 0
- };
- _math_matrix_loadf(&(rmesa->TexGenMatrix[unit]), m);
- _math_matrix_analyse(&(rmesa->TexGenMatrix[unit]));
- rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit;
-}
-
-/* Need this special matrix to get correct normal map coords */
-static void set_texgen_normal_map_matrix(r300ContextPtr rmesa, GLuint unit)
-{
- static const GLfloat m[16] = {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 0, 1,
- 0, 0, 1, 0
- };
- _math_matrix_loadf(&(rmesa->TexGenMatrix[unit]), m);
- _math_matrix_analyse(&(rmesa->TexGenMatrix[unit]));
- rmesa->TexGenEnabled |= R200_TEXMAT_0_ENABLE << unit;
-}
-
-/* Ignoring the Q texcoord for now.
- *
- * Returns GL_FALSE if fallback required.
- */
-static GLboolean r300_validate_texgen(GLcontext * ctx, GLuint unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit * 4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
- rmesa->TexGenEnabled &= ~(R200_TEXGEN_TEXMAT_0_ENABLE << unit);
- rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE << unit);
- rmesa->TexGenInputs &= ~(R200_TEXGEN_INPUT_MASK << inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
-
- if (0)
- fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
-
- if ((texUnit->TexGenEnabled & (S_BIT | T_BIT | R_BIT)) == 0) {
- /* Disabled, no fallback:
- */
- rmesa->TexGenInputs |=
- (R200_TEXGEN_INPUT_TEXCOORD_0 + unit) << inputshift;
- return GL_TRUE;
- } else if (texUnit->TexGenEnabled & Q_BIT) {
- /* Very easy to do this, in fact would remove a fallback case
- * elsewhere, but I haven't done it yet... Fallback:
- */
- /*fprintf(stderr, "fallback Q_BIT\n"); */
- return GL_FALSE;
- } else if (texUnit->TexGenEnabled == (S_BIT | T_BIT) &&
- texUnit->GenModeS == texUnit->GenModeT) {
- /* OK */
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
- /* continue */
- } else if (texUnit->TexGenEnabled == (S_BIT | T_BIT | R_BIT) &&
- texUnit->GenModeS == texUnit->GenModeT &&
- texUnit->GenModeT == texUnit->GenModeR) {
- /* OK */
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
- /* continue */
- } else {
- /* Mixed modes, fallback:
- */
- /* fprintf(stderr, "fallback mixed texgen\n"); */
- return GL_FALSE;
- }
-
- rmesa->TexGenEnabled |= R200_TEXGEN_TEXMAT_0_ENABLE << unit;
-
- switch (texUnit->GenModeS) {
- case GL_OBJECT_LINEAR:
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_OBJ << inputshift;
- set_texgen_matrix(rmesa, unit,
- texUnit->ObjectPlaneS,
- texUnit->ObjectPlaneT, texUnit->ObjectPlaneR);
- break;
-
- case GL_EYE_LINEAR:
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_EYE << inputshift;
- set_texgen_matrix(rmesa, unit,
- texUnit->EyePlaneS,
- texUnit->EyePlaneT, texUnit->EyePlaneR);
- break;
-
- case GL_REFLECTION_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenInputs |=
- R200_TEXGEN_INPUT_EYE_REFLECT << inputshift;
- set_texgen_reflection_matrix(rmesa, unit);
- break;
-
- case GL_NORMAL_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenInputs |=
- R200_TEXGEN_INPUT_EYE_NORMAL << inputshift;
- set_texgen_normal_map_matrix(rmesa, unit);
- break;
-
- case GL_SPHERE_MAP:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenInputs |= R200_TEXGEN_INPUT_SPHERE << inputshift;
- break;
-
- default:
- /* Unsupported mode, fallback:
- */
- /* fprintf(stderr, "fallback unsupported texgen\n"); */
- return GL_FALSE;
- }
-
- rmesa->TexGenCompSel |= R200_OUTPUT_TEX_0 << unit;
-
- if (tmp != rmesa->TexGenEnabled) {
- //rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- return GL_TRUE;
-}
-
-static void disable_tex(GLcontext * ctx, int unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
-
-#if 0 /* This needs to be redone.. or done elsewhere */
- if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE << unit)) {
- /* Texture unit disabled */
- if (rmesa->state.texture.unit[unit].texobj != NULL) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1UL << unit);
- rmesa->state.texture.unit[unit].texobj = NULL;
- }
-
- R300_STATECHANGE(rmesa, ctx);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~((R200_TEX_0_ENABLE |
- R200_TEX_BLEND_0_ENABLE) <<
- unit);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_BLEND_0_ENABLE;
-
- R300_STATECHANGE(rmesa, tcl);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] &=
- ~(7 << (unit * 3));
-
- if (rmesa->radeon.TclFallback & (RADEON_TCL_FALLBACK_TEXGEN_0 << unit)) {
- TCL_FALLBACK(ctx, (RADEON_TCL_FALLBACK_TEXGEN_0 << unit),
- GL_FALSE);
- }
-
- /* Actually want to keep all units less than max active texture
- * enabled, right? Fix this for >2 texunits.
- */
- /* FIXME: What should happen here if r300UpdateTextureEnv fails? */
- if (unit == 0)
- r300UpdateTextureEnv(ctx, unit);
-
- {
- GLuint inputshift =
- R200_TEXGEN_0_INPUT_SHIFT + unit * 4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenEnabled &=
- ~(R200_TEXGEN_TEXMAT_0_ENABLE << unit);
- rmesa->TexGenEnabled &= ~(R200_TEXMAT_0_ENABLE << unit);
- rmesa->TexGenEnabled &=
- ~(R200_TEXGEN_INPUT_MASK << inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
- rmesa->TexGenCompSel &= ~(R200_OUTPUT_TEX_0 << unit);
- rmesa->TexGenInputs &=
- ~(R200_TEXGEN_INPUT_MASK << inputshift);
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->recheck_texgen[unit] = GL_TRUE;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
- }
- }
-#endif
-}
-
-static GLboolean enable_tex_2d(GLcontext * ctx, int unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
-
- /* Need to load the 2d images associated with this unit.
- */
-#if 0
- if (t->format & R200_TXFORMAT_NON_POWER2) {
- t->format &= ~R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-#endif
-
- ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D);
-
- if (t->base.dirty_images[0]) {
- R300_FIREVERTICES(rmesa);
- r300SetTexImages(rmesa, tObj);
- r300UploadTexImages(rmesa, (r300TexObjPtr) tObj->DriverData, 0);
- if (!t->base.memBlock)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-#if ENABLE_HW_3D_TEXTURE
-static GLboolean enable_tex_3d(GLcontext * ctx, int unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
-
- /* Need to load the 3d images associated with this unit.
- */
- if (t->format & R200_TXFORMAT_NON_POWER2) {
- t->format &= ~R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_3D);
-
- /* R100 & R200 do not support mipmaps for 3D textures.
- */
- if ((tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) {
- return GL_FALSE;
- }
-
- if (t->base.dirty_images[0]) {
- R300_FIREVERTICES(rmesa);
- r300SetTexImages(rmesa, tObj);
- r300UploadTexImages(rmesa, (r300TexObjPtr) tObj->DriverData, 0);
- if (!t->base.memBlock)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-#endif
-
-static GLboolean enable_tex_cube(GLcontext * ctx, int unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
- GLuint face;
-
- /* Need to load the 2d images associated with this unit.
- */
- if (t->format & R200_TXFORMAT_NON_POWER2) {
- t->format &= ~R200_TXFORMAT_NON_POWER2;
- for (face = 0; face < 6; face++)
- t->base.dirty_images[face] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_CUBE_MAP);
-
- if (t->base.dirty_images[0] || t->base.dirty_images[1] ||
- t->base.dirty_images[2] || t->base.dirty_images[3] ||
- t->base.dirty_images[4] || t->base.dirty_images[5]) {
- /* flush */
- R300_FIREVERTICES(rmesa);
- /* layout memory space, once for all faces */
- r300SetTexImages(rmesa, tObj);
- }
-
- /* upload (per face) */
- for (face = 0; face < 6; face++) {
- if (t->base.dirty_images[face]) {
- r300UploadTexImages(rmesa,
- (r300TexObjPtr) tObj->DriverData,
- face);
- }
- }
-
- if (!t->base.memBlock) {
- /* texmem alloc failed, use s/w fallback */
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect(GLcontext * ctx, int unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
-
-#if 0
- if (!(t->format & R200_TXFORMAT_NON_POWER2)) {
- t->format |= R200_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-#endif
-
- ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV);
-
- if (t->base.dirty_images[0]) {
- R300_FIREVERTICES(rmesa);
- r300SetTexImages(rmesa, tObj);
- r300UploadTexImages(rmesa, (r300TexObjPtr) tObj->DriverData, 0);
- if (!t->base.memBlock && !rmesa->prefer_gart_client_texturing)
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean update_tex_common(GLcontext * ctx, int unit)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData;
- GLenum format;
-
- /* Fallback if there's a texture border */
- if (tObj->Image[0][tObj->BaseLevel]->Border > 0)
- return GL_FALSE;
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if (rmesa->state.texture.unit[unit].texobj != t) {
- if (rmesa->state.texture.unit[unit].texobj != NULL) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1UL << unit);
- }
-
- rmesa->state.texture.unit[unit].texobj = t;
- t->base.bound |= (1UL << unit);
- t->dirty_state |= 1 << unit;
- driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */
- }
-
-#if 0 /* do elsewhere ? */
- /* Newly enabled?
- */
- if (1
- || !(rmesa->hw.ctx.
- cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE << unit))) {
- R300_STATECHANGE(rmesa, ctx);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= (R200_TEX_0_ENABLE |
- R200_TEX_BLEND_0_ENABLE) <<
- unit;
-
- R300_STATECHANGE(rmesa, vtx);
- rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_1] |= 4 << (unit * 3);
-
- rmesa->recheck_texgen[unit] = GL_TRUE;
- }
-
- if (t->dirty_state & (1 << unit)) {
- import_tex_obj_state(rmesa, unit, t);
- }
-
- if (rmesa->recheck_texgen[unit]) {
- GLboolean fallback = !r300_validate_texgen(ctx, unit);
- TCL_FALLBACK(ctx, (RADEON_TCL_FALLBACK_TEXGEN_0 << unit),
- fallback);
- rmesa->recheck_texgen[unit] = 0;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-#endif
-
- format = tObj->Image[0][tObj->BaseLevel]->Format;
- if (rmesa->state.texture.unit[unit].format != format ||
- rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode) {
- //rmesa->state.texture.unit[unit].format = format;
- rmesa->state.texture.unit[unit].envMode = texUnit->EnvMode;
- if (!r300UpdateTextureEnv(ctx, unit)) {
- return GL_FALSE;
- }
- }
-
-#if R200_MERGED
- FALLBACK(&rmesa->radeon, RADEON_FALLBACK_BORDER_MODE, t->border_fallback);
-#endif
-
- return !t->border_fallback;
-}
-
-static GLboolean r300UpdateTextureUnit(GLcontext * ctx, int unit)
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if (texUnit->_ReallyEnabled & (TEXTURE_RECT_BIT)) {
- return (enable_tex_rect(ctx, unit) &&
- update_tex_common(ctx, unit));
- } else if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
- return (enable_tex_2d(ctx, unit) &&
- update_tex_common(ctx, unit));
- }
-#if ENABLE_HW_3D_TEXTURE
- else if (texUnit->_ReallyEnabled & (TEXTURE_3D_BIT)) {
- return (enable_tex_3d(ctx, unit) &&
- update_tex_common(ctx, unit));
- }
-#endif
- else if (texUnit->_ReallyEnabled & (TEXTURE_CUBE_BIT)) {
- return (enable_tex_cube(ctx, unit) &&
- update_tex_common(ctx, unit));
- } else if (texUnit->_ReallyEnabled) {
- return GL_FALSE;
- } else {
- disable_tex(ctx, unit);
- return GL_TRUE;
- }
-}
-
-void r300UpdateTextureState(GLcontext * ctx)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- GLboolean ok;
- GLuint dbg;
- int i;
-
- ok = (r300UpdateTextureUnit(ctx, 0) &&
- r300UpdateTextureUnit(ctx, 1) &&
- r300UpdateTextureUnit(ctx, 2) &&
- r300UpdateTextureUnit(ctx, 3) &&
- r300UpdateTextureUnit(ctx, 4) &&
- r300UpdateTextureUnit(ctx, 5) &&
- r300UpdateTextureUnit(ctx, 6) &&
- r300UpdateTextureUnit(ctx, 7)
- );
-
-#if R200_MERGED
- FALLBACK(&rmesa->radeon, RADEON_FALLBACK_TEXTURE, !ok);
-#endif
-
- /* This needs correction, or just be done elsewhere
- if (rmesa->radeon.TclFallback)
- r300ChooseVertexState(ctx);
- */
-
-#if 0 /* Workaround - disable.. */
- if (GET_CHIP(rmesa->radeon.radeonScreen) == RADEON_CHIP_REAL_R200) {
- /*
- * T0 hang workaround -------------
- * not needed for r200 derivatives?
- */
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_ENABLE_MASK) ==
- R200_TEX_0_ENABLE
- && (rmesa->hw.tex[0].
- cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK) >
- R200_MIN_FILTER_LINEAR) {
-
- R300_STATECHANGE(rmesa, ctx);
- R300_STATECHANGE(rmesa, tex[1]);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_1_ENABLE;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &=
- ~TEXOBJ_TXFORMAT_MASK;
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] |= 0x08000000;
- } else {
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_1_ENABLE)
- && (rmesa->hw.tex[1].
- cmd[TEX_PP_TXFORMAT] & 0x08000000)) {
- R300_STATECHANGE(rmesa, tex[1]);
- rmesa->hw.tex[1].cmd[TEX_PP_TXFORMAT] &=
- ~0x08000000;
- }
- }
-
- /* maybe needs to be done pairwise due to 2 parallel (physical) tex units ?
- looks like that's not the case, if 8500/9100 owners don't complain remove this...
- for ( i = 0; i < ctx->Const.MaxTextureUnits; i += 2) {
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & ((R200_TEX_0_ENABLE |
- R200_TEX_1_ENABLE ) << i)) == (R200_TEX_0_ENABLE << i)) &&
- ((rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK) >
- R200_MIN_FILTER_LINEAR)) {
- R300_STATECHANGE(rmesa, ctx);
- R300_STATECHANGE(rmesa, tex[i+1]);
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= (R200_TEX_1_ENABLE << i);
- rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] |= 0x08000000;
- }
- else {
- if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_1_ENABLE << i)) &&
- (rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] & 0x08000000)) {
- R300_STATECHANGE(rmesa, tex[i+1]);
- rmesa->hw.tex[i+1].cmd[TEX_PP_TXFORMAT] &= ~0x08000000;
- }
- }
- } */
-
- /*
- * Texture cache LRU hang workaround -------------
- * not needed for r200 derivatives?
- */
- dbg = 0x0;
-
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_0_ENABLE)) &&
- ((((rmesa->hw.tex[0].
- cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04)
- == 0))
- || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_2_ENABLE)
- &&
- ((((rmesa->hw.tex[2].
- cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0))
- || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_4_ENABLE)
- &&
- ((((rmesa->hw.tex[4].
- cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0))) {
- dbg |= 0x02;
- }
-
- if (((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (R200_TEX_1_ENABLE)) &&
- ((((rmesa->hw.tex[1].
- cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) & 0x04)
- == 0))
- || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_3_ENABLE)
- &&
- ((((rmesa->hw.tex[3].
- cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0))
- || ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_5_ENABLE)
- &&
- ((((rmesa->hw.tex[5].
- cmd[TEX_PP_TXFILTER] & R200_MIN_FILTER_MASK)) &
- 0x04) == 0))) {
- dbg |= 0x04;
- }
-
- if (dbg != rmesa->hw.tam.cmd[TAM_DEBUG3]) {
- R300_STATECHANGE(rmesa, tam);
- rmesa->hw.tam.cmd[TAM_DEBUG3] = dbg;
- if (0)
- printf("TEXCACHE LRU HANG WORKAROUND %x\n",
- dbg);
- }
- }
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_vertexprog.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_vertexprog.c
deleted file mode 100644
index 717832048..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/r300_vertexprog.c
+++ /dev/null
@@ -1,952 +0,0 @@
-/**************************************************************************
-
-Copyright (C) 2005 Aapo Tahkola.
-
-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, 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
-ATI, 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:
- * Aapo Tahkola <aet@rasterburn.org>
- */
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "program.h"
-#include "r300_context.h"
-#include "r300_program.h"
-#include "nvvertprog.h"
-
-#define SCALAR_FLAG (1<<31)
-#define FLAG_MASK (1<<31)
-#define OP_MASK (0xf) /* we are unlikely to have more than 15 */
-#define OPN(operator, ip, op) {#operator, VP_OPCODE_##operator, ip, op}
-
-static struct{
- char *name;
- int opcode;
- unsigned long ip; /* number of input operands and flags */
- unsigned long op;
-}op_names[]={
- OPN(ABS, 1, 1),
- OPN(ADD, 2, 1),
- OPN(ARL, 1, 1|SCALAR_FLAG),
- OPN(DP3, 2, 3|SCALAR_FLAG),
- OPN(DP4, 2, 3|SCALAR_FLAG),
- OPN(DPH, 2, 3|SCALAR_FLAG),
- OPN(DST, 2, 1),
- OPN(EX2, 1|SCALAR_FLAG, 4|SCALAR_FLAG),
- OPN(EXP, 1|SCALAR_FLAG, 1),
- OPN(FLR, 1, 1),
- OPN(FRC, 1, 1),
- OPN(LG2, 1|SCALAR_FLAG, 4|SCALAR_FLAG),
- OPN(LIT, 1, 1),
- OPN(LOG, 1|SCALAR_FLAG, 1),
- OPN(MAD, 3, 1),
- OPN(MAX, 2, 1),
- OPN(MIN, 2, 1),
- OPN(MOV, 1, 1),
- OPN(MUL, 2, 1),
- OPN(POW, 2|SCALAR_FLAG, 4|SCALAR_FLAG),
- OPN(RCP, 1|SCALAR_FLAG, 4|SCALAR_FLAG),
- OPN(RSQ, 1|SCALAR_FLAG, 4|SCALAR_FLAG),
- OPN(SGE, 2, 1),
- OPN(SLT, 2, 1),
- OPN(SUB, 2, 1),
- OPN(SWZ, 1, 1),
- OPN(XPD, 2, 1),
- OPN(RCC, 0, 0), //extra
- OPN(PRINT, 0, 0),
- OPN(END, 0, 0),
-};
-#undef OPN
-#define OPN(rf) {#rf, PROGRAM_##rf}
-
-static struct{
- char *name;
- int id;
-}register_file_names[]={
- OPN(TEMPORARY),
- OPN(INPUT),
- OPN(OUTPUT),
- OPN(LOCAL_PARAM),
- OPN(ENV_PARAM),
- OPN(NAMED_PARAM),
- OPN(STATE_VAR),
- OPN(WRITE_ONLY),
- OPN(ADDRESS),
-};
-
-static char *dst_mask_names[4]={ "X", "Y", "Z", "W" };
-
-/* from vertex program spec:
- Instruction Inputs Output Description
- ----------- ------ ------ --------------------------------
- ABS v v absolute value
- ADD v,v v add
- ARL v a address register load
- DP3 v,v ssss 3-component dot product
- DP4 v,v ssss 4-component dot product
- DPH v,v ssss homogeneous dot product
- DST v,v v distance vector
- EX2 s ssss exponential base 2
- EXP s v exponential base 2 (approximate)
- FLR v v floor
- FRC v v fraction
- LG2 s ssss logarithm base 2
- LIT v v compute light coefficients
- LOG s v logarithm base 2 (approximate)
- MAD v,v,v v multiply and add
- MAX v,v v maximum
- MIN v,v v minimum
- MOV v v move
- MUL v,v v multiply
- POW s,s ssss exponentiate
- RCP s ssss reciprocal
- RSQ s ssss reciprocal square root
- SGE v,v v set on greater than or equal
- SLT v,v v set on less than
- SUB v,v v subtract
- SWZ v v extended swizzle
- XPD v,v v cross product
-*/
-
-void dump_program_params(GLcontext *ctx, struct vertex_program *vp)
-{
- int i;
- int pi;
-
- fprintf(stderr, "NumInstructions=%d\n", vp->Base.NumInstructions);
- fprintf(stderr, "NumTemporaries=%d\n", vp->Base.NumTemporaries);
- fprintf(stderr, "NumParameters=%d\n", vp->Base.NumParameters);
- fprintf(stderr, "NumAttributes=%d\n", vp->Base.NumAttributes);
- fprintf(stderr, "NumAddressRegs=%d\n", vp->Base.NumAddressRegs);
-
- _mesa_load_state_parameters(ctx, vp->Parameters);
-
-#if 0
- for(pi=0; pi < vp->Base.NumParameters; pi++){
- fprintf(stderr, "{ ");
- for(i=0; i < 4; i++)
- fprintf(stderr, "%f ", vp->Base.LocalParams[pi][i]);
- fprintf(stderr, "}\n");
- }
-#endif
- for(pi=0; pi < vp->Parameters->NumParameters; pi++){
- fprintf(stderr, "param %02d:", pi);
-
- switch(vp->Parameters->Parameters[pi].Type){
-
- case NAMED_PARAMETER:
- fprintf(stderr, "%s", vp->Parameters->Parameters[pi].Name);
- fprintf(stderr, "(NAMED_PARAMETER)");
- break;
-
- case CONSTANT:
- fprintf(stderr, "(CONSTANT)");
- break;
-
- case STATE:
- fprintf(stderr, "(STATE)\n");
- break;
-
- }
-
- fprintf(stderr, "{ ");
- for(i=0; i < 4; i++)
- fprintf(stderr, "%f ", vp->Parameters->ParameterValues[pi][i]);
- fprintf(stderr, "}\n");
-
- }
-}
-
-void debug_vp(GLcontext *ctx, struct vertex_program *vp)
-{
- struct vp_instruction *vpi;
- int i, operand_index;
- int operator_index;
-
- dump_program_params(ctx, vp);
-
- vpi=vp->Instructions;
-
- for(;; vpi++){
- if(vpi->Opcode == VP_OPCODE_END)
- break;
-
- for(i=0; i < sizeof(op_names) / sizeof(*op_names); i++){
- if(vpi->Opcode == op_names[i].opcode){
- fprintf(stderr, "%s ", op_names[i].name);
- break;
- }
- }
- operator_index=i;
-
- for(i=0; i < sizeof(register_file_names) / sizeof(*register_file_names); i++){
- if(vpi->DstReg.File == register_file_names[i].id){
- fprintf(stderr, "%s ", register_file_names[i].name);
- break;
- }
- }
-
- fprintf(stderr, "%d.", vpi->DstReg.Index);
-
- for(i=0; i < 4; i++)
- if(vpi->DstReg.WriteMask & (1<<i))
- fprintf(stderr, "%s", dst_mask_names[i]);
- fprintf(stderr, " ");
-
- for(operand_index=0; operand_index < (op_names[operator_index].ip & (~FLAG_MASK));
- operand_index++){
-
- if(vpi->SrcReg[operand_index].Negate)
- fprintf(stderr, "-");
-
- for(i=0; i < sizeof(register_file_names) / sizeof(*register_file_names); i++){
- if(vpi->SrcReg[operand_index].File == register_file_names[i].id){
- fprintf(stderr, "%s ", register_file_names[i].name);
- break;
- }
- }
- fprintf(stderr, "%d.", vpi->SrcReg[operand_index].Index);
-
- for(i=0; i < 4; i++)
- fprintf(stderr, "%s", dst_mask_names[GET_SWZ(vpi->SrcReg[operand_index].Swizzle, i)]);
-
- if(operand_index+1 < (op_names[operator_index].ip & (~FLAG_MASK)) )
- fprintf(stderr, ",");
- }
- fprintf(stderr, "\n");
- }
-
-}
-
-void r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program *vp)
-{
- int pi;
- struct vertex_program *mesa_vp=(void *)vp;
- int dst_index;
-
- _mesa_load_state_parameters(ctx, mesa_vp->Parameters);
-
- //debug_vp(ctx, mesa_vp);
- if(mesa_vp->Parameters->NumParameters * 4 > VSF_MAX_FRAGMENT_LENGTH){
- fprintf(stderr, "%s:Params exhausted\n", __FUNCTION__);
- exit(-1);
- }
- dst_index=0;
- for(pi=0; pi < mesa_vp->Parameters->NumParameters; pi++){
- switch(mesa_vp->Parameters->Parameters[pi].Type){
-
- case STATE:
- case NAMED_PARAMETER:
- //fprintf(stderr, "%s", vp->Parameters->Parameters[pi].Name);
- case CONSTANT:
- vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][0];
- vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][1];
- vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][2];
- vp->params.body.f[dst_index++]=mesa_vp->Parameters->ParameterValues[pi][3];
- break;
-
- default: _mesa_problem(NULL, "Bad param type in %s", __FUNCTION__);
- }
-
- }
-
- vp->params.length=dst_index;
-}
-
-static unsigned long t_dst_mask(GLuint mask)
-{
- unsigned long flags=0;
-
- if(mask & WRITEMASK_X) flags |= VSF_FLAG_X;
- if(mask & WRITEMASK_Y) flags |= VSF_FLAG_Y;
- if(mask & WRITEMASK_Z) flags |= VSF_FLAG_Z;
- if(mask & WRITEMASK_W) flags |= VSF_FLAG_W;
-
- return flags;
-}
-
-static unsigned long t_dst_class(enum register_file file)
-{
-
- switch(file){
- case PROGRAM_TEMPORARY:
- return VSF_OUT_CLASS_TMP;
- case PROGRAM_OUTPUT:
- return VSF_OUT_CLASS_RESULT;
- /*
- case PROGRAM_INPUT:
- case PROGRAM_LOCAL_PARAM:
- case PROGRAM_ENV_PARAM:
- case PROGRAM_NAMED_PARAM:
- case PROGRAM_STATE_VAR:
- case PROGRAM_WRITE_ONLY:
- case PROGRAM_ADDRESS:
- */
- default:
- fprintf(stderr, "problem in %s", __FUNCTION__);
- exit(0);
- }
-}
-
-static unsigned long t_dst_index(struct r300_vertex_program *vp, struct vp_dst_register *dst)
-{
- if(dst->File == PROGRAM_OUTPUT) {
- if (vp->outputs[dst->Index] != -1)
- return vp->outputs[dst->Index];
- else {
- WARN_ONCE("Unknown output %d\n", dst->Index);
- return 10;
- }
- }
- return dst->Index;
-}
-
-static unsigned long t_src_class(enum register_file file)
-{
-
- switch(file){
- case PROGRAM_TEMPORARY:
- return VSF_IN_CLASS_TMP;
-
- case PROGRAM_INPUT:
- return VSF_IN_CLASS_ATTR;
-
- case PROGRAM_LOCAL_PARAM:
- case PROGRAM_ENV_PARAM:
- case PROGRAM_NAMED_PARAM:
- case PROGRAM_STATE_VAR:
- return VSF_IN_CLASS_PARAM;
- /*
- case PROGRAM_OUTPUT:
- case PROGRAM_WRITE_ONLY:
- case PROGRAM_ADDRESS:
- */
- default:
- fprintf(stderr, "problem in %s", __FUNCTION__);
- exit(0);
- }
-}
-
-static unsigned long t_swizzle(GLubyte swizzle)
-{
- switch(swizzle){
- case SWIZZLE_X: return VSF_IN_COMPONENT_X;
- case SWIZZLE_Y: return VSF_IN_COMPONENT_Y;
- case SWIZZLE_Z: return VSF_IN_COMPONENT_Z;
- case SWIZZLE_W: return VSF_IN_COMPONENT_W;
- case SWIZZLE_ZERO: return VSF_IN_COMPONENT_ZERO;
- case SWIZZLE_ONE: return VSF_IN_COMPONENT_ONE;
- default:
- fprintf(stderr, "problem in %s", __FUNCTION__);
- exit(0);
- }
-}
-
-static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller)
-{
- int i;
-
- if(vp == NULL){
- fprintf(stderr, "vp null in call to %s from %s\n", __FUNCTION__, caller);
- return ;
- }
-
- fprintf(stderr, "%s:<", caller);
- for(i=0; i < VERT_ATTRIB_MAX; i++)
- fprintf(stderr, "%d ", vp->inputs[i]);
- fprintf(stderr, ">\n");
-
-}
-
-static unsigned long t_src_index(struct r300_vertex_program *vp, struct vp_src_register *src)
-{
- int i;
- int max_reg=-1;
-
- if(src->File == PROGRAM_INPUT){
- if(vp->inputs[src->Index] != -1)
- return vp->inputs[src->Index];
-
- for(i=0; i < VERT_ATTRIB_MAX; i++)
- if(vp->inputs[i] > max_reg)
- max_reg=vp->inputs[i];
-
- vp->inputs[src->Index]=max_reg+1;
-
- //vp_dump_inputs(vp, __FUNCTION__);
-
- return vp->inputs[src->Index];
- }else{
- return src->Index;
- }
-}
-
-static unsigned long t_src(struct r300_vertex_program *vp, struct vp_src_register *src)
-{
-
- return MAKE_VSF_SOURCE(t_src_index(vp, src),
- t_swizzle(GET_SWZ(src->Swizzle, 0)),
- t_swizzle(GET_SWZ(src->Swizzle, 1)),
- t_swizzle(GET_SWZ(src->Swizzle, 2)),
- t_swizzle(GET_SWZ(src->Swizzle, 3)),
- t_src_class(src->File),
- src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
-}
-
-static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct vp_src_register *src)
-{
-
- return MAKE_VSF_SOURCE(t_src_index(vp, src),
- t_swizzle(GET_SWZ(src->Swizzle, 0)),
- t_swizzle(GET_SWZ(src->Swizzle, 0)),
- t_swizzle(GET_SWZ(src->Swizzle, 0)),
- t_swizzle(GET_SWZ(src->Swizzle, 0)),
- t_src_class(src->File),
- src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
-}
-
-static unsigned long t_opcode(enum vp_opcode opcode)
-{
-
- switch(opcode){
- case VP_OPCODE_DST: return R300_VPI_OUT_OP_DST;
- case VP_OPCODE_EX2: return R300_VPI_OUT_OP_EX2;
- case VP_OPCODE_EXP: return R300_VPI_OUT_OP_EXP;
- case VP_OPCODE_FRC: return R300_VPI_OUT_OP_FRC;
- case VP_OPCODE_LG2: return R300_VPI_OUT_OP_LG2;
- case VP_OPCODE_LOG: return R300_VPI_OUT_OP_LOG;
- case VP_OPCODE_MAX: return R300_VPI_OUT_OP_MAX;
- case VP_OPCODE_MIN: return R300_VPI_OUT_OP_MIN;
- case VP_OPCODE_MUL: return R300_VPI_OUT_OP_MUL;
- case VP_OPCODE_POW: return R300_VPI_OUT_OP_POW;
- case VP_OPCODE_RCP: return R300_VPI_OUT_OP_RCP;
- case VP_OPCODE_RSQ: return R300_VPI_OUT_OP_RSQ;
- case VP_OPCODE_SGE: return R300_VPI_OUT_OP_SGE;
- case VP_OPCODE_SLT: return R300_VPI_OUT_OP_SLT;
- case VP_OPCODE_DP4: return R300_VPI_OUT_OP_DOT;
-
- default:
- fprintf(stderr, "%s: Should not be called with opcode %d!", __FUNCTION__, opcode);
- }
- exit(-1);
- return 0;
-}
-
-static unsigned long op_operands(enum vp_opcode opcode)
-{
- int i;
-
- /* Can we trust mesas opcodes to be in order ? */
- for(i=0; i < sizeof(op_names) / sizeof(*op_names); i++)
- if(op_names[i].opcode == opcode)
- return op_names[i].ip;
-
- fprintf(stderr, "op %d not found in op_names\n", opcode);
- exit(-1);
- return 0;
-}
-
-/* TODO: Get rid of t_src_class call */
-#define CMP_SRCS(a, b) (a.Index != b.Index && \
- ((t_src_class(a.File) == VSF_IN_CLASS_PARAM && \
- t_src_class(b.File) == VSF_IN_CLASS_PARAM) || \
- (t_src_class(a.File) == VSF_IN_CLASS_ATTR && \
- t_src_class(b.File) == VSF_IN_CLASS_ATTR))) \
-
-#define SRCS_WRITABLE 1
-void translate_vertex_shader(struct r300_vertex_program *vp)
-{
- struct vertex_program *mesa_vp=(void *)vp;
- struct vp_instruction *vpi;
- int i, cur_reg=0;
- VERTEX_SHADER_INSTRUCTION *o_inst;
- unsigned long operands;
- int are_srcs_scalar;
- unsigned long hw_op;
- /* Initial value should be last tmp reg that hw supports.
- Strangely enough r300 doesnt mind even though these would be out of range.
- Smart enough to realize that it doesnt need it? */
- int u_temp_i=VSF_MAX_FRAGMENT_TEMPS-1;
-#ifdef SRCS_WRITABLE
- struct vp_src_register src[3];
-#else
-#define src vpi->SrcReg
-#endif
- vp->pos_end=0; /* Not supported yet */
- vp->program.length=0;
- vp->num_temporaries=mesa_vp->Base.NumTemporaries;
-
- for(i=0; i < VERT_ATTRIB_MAX; i++)
- vp->inputs[i] = -1;
-
- for(i=0; i < VERT_RESULT_MAX; i++)
- vp->outputs[i] = -1;
-
- assert(mesa_vp->OutputsWritten & (1 << VERT_RESULT_HPOS));
- assert(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL0));
-
- /* Assign outputs */
- if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_HPOS))
- vp->outputs[VERT_RESULT_HPOS] = cur_reg++;
-
- if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_PSIZ))
- vp->outputs[VERT_RESULT_PSIZ] = cur_reg++;
-
- if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL0))
- vp->outputs[VERT_RESULT_COL0] = cur_reg++;
-
-#if 0 /* Not supported yet */
- if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_BFC0))
- vp->outputs[VERT_RESULT_BFC0] = cur_reg++;
-
- if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL1))
- vp->outputs[VERT_RESULT_COL1] = cur_reg++;
-
- if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_BFC1))
- vp->outputs[VERT_RESULT_BFC1] = cur_reg++;
-
- if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_FOGC))
- vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
-#endif
-
- for(i=VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++)
- if(mesa_vp->OutputsWritten & (1 << i))
- vp->outputs[i] = cur_reg++;
-
- o_inst=vp->program.body.i;
- for(vpi=mesa_vp->Instructions; vpi->Opcode != VP_OPCODE_END; vpi++, o_inst++){
-
- operands=op_operands(vpi->Opcode);
- are_srcs_scalar=operands & SCALAR_FLAG;
- operands &= OP_MASK;
-
- for(i=0; i < operands; i++)
- src[i]=vpi->SrcReg[i];
-#if 1
- if(operands == 3){ /* TODO: scalars */
- if( CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2]) ){
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, u_temp_i,
- VSF_FLAG_ALL, VSF_OUT_CLASS_TMP);
-
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[2]),
- SWIZZLE_X, SWIZZLE_Y,
- SWIZZLE_Z, SWIZZLE_W,
- t_src_class(src[2].File), VSF_FLAG_NONE);
-
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[2]),
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- t_src_class(src[2].File), VSF_FLAG_NONE);
- o_inst->src3=0;
- o_inst++;
-
- src[2].File=PROGRAM_TEMPORARY;
- src[2].Index=u_temp_i;
- u_temp_i--;
- }
-
- }
- if(operands >= 2){
- if( CMP_SRCS(src[1], src[0]) ){
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, u_temp_i,
- VSF_FLAG_ALL, VSF_OUT_CLASS_TMP);
-
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- SWIZZLE_X, SWIZZLE_Y,
- SWIZZLE_Z, SWIZZLE_W,
- t_src_class(src[0].File), VSF_FLAG_NONE);
-
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- t_src_class(src[0].File), VSF_FLAG_NONE);
- o_inst->src3=0;
- o_inst++;
-
- src[0].File=PROGRAM_TEMPORARY;
- src[0].Index=u_temp_i;
- u_temp_i--;
- }
- }
-#endif
- /* these ops need special handling.
- Ops that need temp vars should probably be given reg indexes starting at the end of tmp area. */
- switch(vpi->Opcode){
- case VP_OPCODE_MOV://ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- t_src_class(src[0].File), VSF_FLAG_NONE);
-
- o_inst->src3=0;
-
- goto next;
-
- case VP_OPCODE_ADD:
- hw_op=(src[0].File == PROGRAM_TEMPORARY &&
- src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
- o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- SWIZZLE_ONE, SWIZZLE_ONE,
- SWIZZLE_ONE, SWIZZLE_ONE,
- t_src_class(src[0].File), VSF_FLAG_NONE);
- o_inst->src3=t_src(vp, &src[1]);
- goto next;
-
- case VP_OPCODE_MAD:
- hw_op=(src[0].File == PROGRAM_TEMPORARY &&
- src[1].File == PROGRAM_TEMPORARY &&
- src[2].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
- o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=t_src(vp, &src[1]);
- o_inst->src3=t_src(vp, &src[2]);
- goto next;
-
- case VP_OPCODE_MUL: /* HW mul can take third arg but appears to have some other limitations. */
- hw_op=(src[0].File == PROGRAM_TEMPORARY &&
- src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
- o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=t_src(vp, &src[1]);
-
- o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- t_src_class(src[1].File), VSF_FLAG_NONE);
- goto next;
-
- case VP_OPCODE_DP3://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO}
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)),
- SWIZZLE_ZERO,
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE);
-
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
- t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 2)),
- SWIZZLE_ZERO,
- t_src_class(src[1].File),
- src[1].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE);
-
- o_inst->src3=0;
- goto next;
-
- case VP_OPCODE_SUB://ADD RESULT 1.X Y Z W TMP 0{} {X Y Z W} PARAM 1{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
-#if 1
- hw_op=(src[0].File == PROGRAM_TEMPORARY &&
- src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
- o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- SWIZZLE_ONE, SWIZZLE_ONE,
- SWIZZLE_ONE, SWIZZLE_ONE,
- t_src_class(src[0].File), VSF_FLAG_NONE);
- o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
- t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 2)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 3)),
- t_src_class(src[1].File),
- (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
-#else
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
- t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 2)),
- t_swizzle(GET_SWZ(src[1].Swizzle, 3)),
- t_src_class(src[1].File),
- (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
- o_inst->src3=0;
-#endif
- goto next;
-
- case VP_OPCODE_ABS://MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)),
- t_src_class(src[0].File),
- (!src[0].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
- o_inst->src3=0;
- goto next;
-
- case VP_OPCODE_FLR:
- /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W}
- ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */
-
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, u_temp_i,
- t_dst_mask(vpi->DstReg.WriteMask), VSF_OUT_CLASS_TMP);
-
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=0;
- o_inst->src3=0;
- o_inst++;
-
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=MAKE_VSF_SOURCE(u_temp_i,
- VSF_IN_COMPONENT_X,
- VSF_IN_COMPONENT_Y,
- VSF_IN_COMPONENT_Z,
- VSF_IN_COMPONENT_W,
- VSF_IN_CLASS_TMP,
- /* Not 100% sure about this */
- (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE/*VSF_FLAG_ALL*/);
-
- o_inst->src3=0;
- u_temp_i--;
- goto next;
-
- case VP_OPCODE_LG2:// LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X}
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
- o_inst->src2=0;
- o_inst->src3=0;
- goto next;
-
- case VP_OPCODE_LIT://LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W}
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
- /* NOTE: Users swizzling might not work. */
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
- o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
- goto next;
-
- case VP_OPCODE_DPH://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W}
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)),
- VSF_IN_COMPONENT_ONE,
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE);
- o_inst->src2=t_src(vp, &src[1]);
- o_inst->src3=0;
- goto next;
-
- case VP_OPCODE_XPD:
- /* mul r0, r1.yzxw, r2.zxyw
- mad r0, -r2.yzxw, r1.zxyw, r0
- NOTE: might need MAD_2
- */
-
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, u_temp_i,
- t_dst_mask(vpi->DstReg.WriteMask), VSF_OUT_CLASS_TMP);
-
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
-
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
- t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
- t_src_class(src[1].File),
- src[1].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
-
- o_inst->src3=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- SWIZZLE_ZERO, SWIZZLE_ZERO,
- t_src_class(src[1].File),
- VSF_FLAG_NONE);
- o_inst++;
- u_temp_i--;
-
- o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
- t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
- t_src_class(src[1].File),
- (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE);
-
- o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
- t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
- t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
- t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
- t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
- t_src_class(src[0].File),
- src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
-
- o_inst->src3=MAKE_VSF_SOURCE(u_temp_i+1,
- VSF_IN_COMPONENT_X,
- VSF_IN_COMPONENT_Y,
- VSF_IN_COMPONENT_Z,
- VSF_IN_COMPONENT_W,
- VSF_IN_CLASS_TMP,
- VSF_FLAG_NONE);
-
- goto next;
-
- case VP_OPCODE_ARL:
- case VP_OPCODE_SWZ:
- case VP_OPCODE_RCC:
- case VP_OPCODE_PRINT:
- //vp->num_temporaries++;
- fprintf(stderr, "Dont know how to handle op %d yet\n", vpi->Opcode);
- exit(-1);
- break;
- case VP_OPCODE_END:
- break;
- default:
- break;
- }
-
- o_inst->op=MAKE_VSF_OP(t_opcode(vpi->Opcode), t_dst_index(vp, &vpi->DstReg),
- t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
- if(are_srcs_scalar){
- switch(operands){
- case 1:
- o_inst->src1=t_src_scalar(vp, &src[0]);
- o_inst->src2=0;
- o_inst->src3=0;
- break;
-
- case 2:
- o_inst->src1=t_src_scalar(vp, &src[0]);
- o_inst->src2=t_src_scalar(vp, &src[1]);
- o_inst->src3=0;
- break;
-
- case 3:
- o_inst->src1=t_src_scalar(vp, &src[0]);
- o_inst->src2=t_src_scalar(vp, &src[1]);
- o_inst->src3=t_src_scalar(vp, &src[2]);
- break;
-
- default:
- fprintf(stderr, "scalars and op RCC not handled yet");
- exit(-1);
- break;
- }
- }else{
- switch(operands){
- case 1:
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=0;
- o_inst->src3=0;
- break;
-
- case 2:
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=t_src(vp, &src[1]);
- o_inst->src3=0;
- break;
-
- case 3:
- o_inst->src1=t_src(vp, &src[0]);
- o_inst->src2=t_src(vp, &src[1]);
- o_inst->src3=t_src(vp, &src[2]);
- break;
-
- default:
- fprintf(stderr, "scalars and op RCC not handled yet");
- exit(-1);
- break;
- }
- }
- next: ;
- }
-
- vp->program.length=(o_inst - vp->program.body.i) * 4;
-
- if(u_temp_i < vp->num_temporaries)
- vp->translated=GL_FALSE; /* temps exhausted - program cannot be run */
- else
- vp->translated=GL_TRUE;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.c
deleted file mode 100644
index 97507617c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/**
- * \file radeon_context.c
- * Common context initialization.
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <dlfcn.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "state.h"
-#include "matrix.h"
-#include "framebuffer.h"
-
-#include "drivers/common/driverfuncs.h"
-#include "swrast/swrast.h"
-
-#include "radeon_screen.h"
-#include "r200_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_macros.h"
-#include "radeon_reg.h"
-#include "r200_state.h"
-
-#include "utils.h"
-#include "vblank.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-
-#define DRIVER_DATE "20040924"
-
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *) "Tungsten Graphics, Inc.";
-
- case GL_RENDERER:
- {
- unsigned offset;
- GLuint agp_mode = radeon->radeonScreen->IsPCI ? 0 :
- radeon->radeonScreen->AGPMode;
- const char* chipname;
-
- if (IS_FAMILY_R300(radeon))
- chipname = "R300";
- else
- chipname = "R200";
-
- offset = driGetRendererString(buffer, chipname, DRIVER_DATE,
- agp_mode);
-
- sprintf(&buffer[offset], " %sTCL",
- !(radeon->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)
- ? "" : "NO-");
-
- return (GLubyte *) buffer;
- }
-
- default:
- return NULL;
- }
-}
-
-
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize(GLframebuffer * buffer,
- GLuint * width, GLuint * height)
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- LOCK_HARDWARE(radeon);
- *width = radeon->dri.drawable->w;
- *height = radeon->dri.drawable->h;
- UNLOCK_HARDWARE(radeon);
-}
-
-
-/* Initialize the driver's misc functions.
- */
-static void radeonInitDriverFuncs(struct dd_function_table *functions)
-{
- functions->GetBufferSize = radeonGetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = radeonGetString;
-}
-
-
-/**
- * Create and initialize all common fields of the context,
- * including the Mesa context itself.
- */
-GLboolean radeonInitContext(radeonContextPtr radeon,
- struct dd_function_table* functions,
- const __GLcontextModes * glVisual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
- GLcontext* ctx;
- GLcontext* shareCtx;
- int fthrottle_mode;
-
- /* Fill in additional standard functions. */
- radeonInitDriverFuncs(functions);
-
- /* Allocate and initialize the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((radeonContextPtr)sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- radeon->glCtx = _mesa_create_context(glVisual, shareCtx,
- functions, (void *)radeon);
- if (!radeon->glCtx)
- return GL_FALSE;
-
- ctx = radeon->glCtx;
- driContextPriv->driverPrivate = radeon;
-
- /* DRI fields */
- radeon->dri.context = driContextPriv;
- radeon->dri.screen = sPriv;
- radeon->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
- radeon->dri.hwContext = driContextPriv->hHWContext;
- radeon->dri.hwLock = &sPriv->pSAREA->lock;
- radeon->dri.fd = sPriv->fd;
- radeon->dri.drmMinor = sPriv->drmMinor;
-
- radeon->radeonScreen = screen;
- radeon->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA +
- screen->sarea_priv_offset);
-
- /* Setup IRQs */
- fthrottle_mode = driQueryOptioni(&radeon->optionCache, "fthrottle_mode");
- radeon->iw.irq_seq = -1;
- radeon->irqsEmitted = 0;
- radeon->do_irqs = (radeon->dri.drmMinor >= 6 &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS &&
- radeon->radeonScreen->irq);
-
- radeon->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
-
- if (!radeon->do_irqs)
- fprintf(stderr,
- "IRQ's not enabled, falling back to %s: %d %d %d\n",
- radeon->do_usleeps ? "usleeps" : "busy waits",
- radeon->dri.drmMinor,
- fthrottle_mode, radeon->radeonScreen->irq);
-
- radeon->vblank_flags = (radeon->radeonScreen->irq != 0)
- ? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- (*dri_interface->getUST) (&radeon->swap_ust);
-
- return GL_TRUE;
-}
-
-
-/**
- * Cleanup common context fields.
- * Called by r200DestroyContext/r300DestroyContext
- */
-void radeonCleanupContext(radeonContextPtr radeon)
-{
- /* free the Mesa context */
- radeon->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(radeon->glCtx);
-
- if (radeon->state.scissor.pClipRects) {
- FREE(radeon->state.scissor.pClipRects);
- radeon->state.scissor.pClipRects = 0;
- }
-}
-
-
-/**
- * Swap front and back buffer.
- */
-void radeonSwapBuffers(__DRIdrawablePrivate * dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- radeonContextPtr radeon;
- GLcontext *ctx;
-
- radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = radeon->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
- if (radeon->doPageFlip) {
- radeonPageFlip(dPriv);
- } else {
- radeonCopyBuffer(dPriv);
- }
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!",
- __FUNCTION__);
- }
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv)
-{
- if (driContextPriv) {
- radeonContextPtr radeon =
- (radeonContextPtr) driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
- radeon->glCtx);
-
- if (radeon->dri.drawable != driDrawPriv) {
- driDrawableInitVBlank(driDrawPriv,
- radeon->vblank_flags);
- radeon->dri.drawable = driDrawPriv;
-
-#if R200_MERGED
- if (IS_FAMILY_R200(radeon)) {
- r200UpdateWindow(radeon->glCtx);
- r200UpdateViewportOffset(radeon->glCtx);
- }
-#endif
- }
-
- _mesa_make_current(radeon->glCtx,
- (GLframebuffer *) driDrawPriv->
- driverPrivate,
- (GLframebuffer *) driReadPriv->
- driverPrivate);
-
- if (!radeon->glCtx->Viewport.Width) {
- _mesa_set_viewport(radeon->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
-
- _mesa_update_state(radeon->glCtx);
-
-#if R200_MERGED
- if (IS_FAMILY_R200(radeon))
- r200ValidateState(radeon->glCtx);
-#endif
-
- } else {
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
- _mesa_make_current(0, 0, 0);
- }
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "End %s\n", __FUNCTION__);
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean radeonUnbindContext(__DRIcontextPrivate * driContextPriv)
-{
- radeonContextPtr radeon = (radeonContextPtr) driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
- radeon->glCtx);
-
- return GL_TRUE;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.h
deleted file mode 100644
index 189bc6ad0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_context.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#ifndef __RADEON_CONTEXT_H__
-#define __RADEON_CONTEXT_H__
-
-#include "mtypes.h"
-#include "radeon_screen.h"
-#include "drm.h"
-#include "dri_util.h"
-
-struct radeon_context;
-typedef struct radeon_context radeonContextRec;
-typedef struct radeon_context* radeonContextPtr;
-
-static __inline GLuint radeonPackColor(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 TEX_0 0x1
-#define TEX_1 0x2
-#define TEX_2 0x4
-#define TEX_3 0x8
-#define TEX_4 0x10
-#define TEX_5 0x20
-#define TEX_6 0x40
-#define TEX_7 0x80
-#define TEX_ALL 0xff
-
-
-/* Rasterizing fallbacks */
-/* See correponding strings in r200_swtcl.c */
-#define RADEON_FALLBACK_TEXTURE 0x01
-#define RADEON_FALLBACK_DRAW_BUFFER 0x02
-#define RADEON_FALLBACK_STENCIL 0x04
-#define RADEON_FALLBACK_RENDER_MODE 0x08
-#define RADEON_FALLBACK_BLEND_EQ 0x10
-#define RADEON_FALLBACK_BLEND_FUNC 0x20
-#define RADEON_FALLBACK_DISABLE 0x40
-#define RADEON_FALLBACK_BORDER_MODE 0x80
-
-#if R200_MERGED
-extern void radeonFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
-
-#define FALLBACK( radeon, bit, mode ) do { \
- if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
- __FUNCTION__, bit, mode ); \
- radeonFallback( (radeon)->glCtx, bit, mode ); \
-} while (0)
-#else
-#define FALLBACK( radeon, bit, mode ) fprintf(stderr, "%s:%s\n", __LINE__, __FILE__);
-#endif
-
-/* TCL fallbacks */
-extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
-
-#define RADEON_TCL_FALLBACK_RASTER 0x0001 /* rasterization */
-#define RADEON_TCL_FALLBACK_UNFILLED 0x0002 /* unfilled tris */
-#define RADEON_TCL_FALLBACK_LIGHT_TWOSIDE 0x0004 /* twoside tris */
-#define RADEON_TCL_FALLBACK_MATERIAL 0x0008 /* material in vb */
-#define RADEON_TCL_FALLBACK_TEXGEN_0 0x0010 /* texgen, unit 0 */
-#define RADEON_TCL_FALLBACK_TEXGEN_1 0x0020 /* texgen, unit 1 */
-#define RADEON_TCL_FALLBACK_TEXGEN_2 0x0040 /* texgen, unit 2 */
-#define RADEON_TCL_FALLBACK_TEXGEN_3 0x0080 /* texgen, unit 3 */
-#define RADEON_TCL_FALLBACK_TEXGEN_4 0x0100 /* texgen, unit 4 */
-#define RADEON_TCL_FALLBACK_TEXGEN_5 0x0200 /* texgen, unit 5 */
-#define RADEON_TCL_FALLBACK_TCL_DISABLE 0x0400 /* user disable */
-#define RADEON_TCL_FALLBACK_BITMAP 0x0800 /* draw bitmap with points */
-#define RADEON_TCL_FALLBACK_VERTEX_PROGRAM 0x1000 /* vertex program active */
-
-#if R200_MERGED
-#define TCL_FALLBACK( ctx, bit, mode ) radeonTclFallback( ctx, bit, mode )
-#else
-#define TCL_FALLBACK( ctx, bit, mode ) ;
-#endif
-
-
-struct radeon_dri_mirror {
- __DRIcontextPrivate *context; /* DRI context */
- __DRIscreenPrivate *screen; /* DRI screen */
- __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
-
- drm_context_t hwContext;
- drm_hw_lock_t *hwLock;
- int fd;
- int drmMinor;
-};
-
-/**
- * Derived state for internal purposes.
- */
-struct radeon_scissor_state {
- drm_clip_rect_t rect;
- GLboolean enabled;
-
- GLuint numClipRects; /* Cliprects active */
- GLuint numAllocedClipRects; /* Cliprects available */
- drm_clip_rect_t *pClipRects;
-};
-
-struct radeon_colorbuffer_state {
- GLuint clear;
- GLint drawOffset, drawPitch;
-};
-
-struct radeon_pixel_state {
- GLint readOffset, readPitch;
-};
-
-struct radeon_state {
- struct radeon_colorbuffer_state color;
- struct radeon_pixel_state pixel;
- struct radeon_scissor_state scissor;
-};
-
-/**
- * Common per-context variables shared by R200 and R300.
- * R200- and R300-specific code "derive" their own context from this
- * structure.
- */
-struct radeon_context {
- GLcontext *glCtx; /* Mesa context */
- radeonScreenPtr radeonScreen; /* Screen private DRI data */
-
- /* Fallback state */
- GLuint Fallback;
- GLuint TclFallback;
-
- /* Page flipping */
- GLuint doPageFlip;
-
- /* Drawable, cliprect and scissor information */
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
- unsigned int lastStamp;
- GLboolean lost_context;
- drm_radeon_sarea_t *sarea; /* Private SAREA data */
-
- /* Mirrors of some DRI state */
- struct radeon_dri_mirror dri;
-
- /* Busy waiting */
- GLuint do_usleeps;
- GLuint do_irqs;
- GLuint irqsEmitted;
- drm_radeon_irq_wait_t iw;
-
- /* VBI / buffer swap */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- int64_t swap_ust;
- int64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
-
- /* Derived state */
- struct radeon_state state;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define RADEON_CONTEXT(glctx) ((radeonContextPtr)(ctx->DriverCtx))
-
-extern void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
-extern GLboolean radeonInitContext(radeonContextPtr radeon,
- struct dd_function_table* functions,
- const __GLcontextModes * glVisual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate);
-extern void radeonCleanupContext(radeonContextPtr radeon);
-extern GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv);
-extern GLboolean radeonUnbindContext(__DRIcontextPrivate * driContextPriv);
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int RADEON_DEBUG;
-#else
-#define RADEON_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x0001
-#define DEBUG_STATE 0x0002
-#define DEBUG_IOCTL 0x0004
-#define DEBUG_PRIMS 0x0008
-#define DEBUG_VERTS 0x0010
-#define DEBUG_FALLBACKS 0x0020
-#define DEBUG_VFMT 0x0040
-#define DEBUG_CODEGEN 0x0080
-#define DEBUG_VERBOSE 0x0100
-#define DEBUG_DRI 0x0200
-#define DEBUG_DMA 0x0400
-#define DEBUG_SANITY 0x0800
-#define DEBUG_SYNC 0x1000
-#define DEBUG_PIXEL 0x2000
-#define DEBUG_MEMORY 0x4000
-
-#endif /* __RADEON_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.c
deleted file mode 100644
index af489e2a8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <sched.h>
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
-#include "swrast/swrast.h"
-#include "r200_context.h"
-#include "r300_context.h"
-#include "r200_state.h"
-#include "radeon_ioctl.h"
-#include "r200_ioctl.h"
-#include "r300_ioctl.h"
-#include "r200_tcl.h"
-#include "r200_sanity.h"
-#include "r300_state.h"
-#include "radeon_reg.h"
-
-#include "vblank.h"
-
-static void radeonWaitForIdle(radeonContextPtr radeon);
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-
-static uint32_t radeonGetLastFrame(radeonContextPtr radeon)
-{
- drm_radeon_getparam_t gp;
- int ret;
- uint32_t frame;
-
- gp.param = RADEON_PARAM_LAST_FRAME;
- gp.value = (int *)&frame;
- ret = drmCommandWriteRead(radeon->dri.fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__,
- ret);
- exit(1);
- }
-
- return frame;
-}
-
-static void radeonEmitIrqLocked(radeonContextPtr radeon)
-{
- drm_radeon_irq_emit_t ie;
- int ret;
-
- ie.irq_seq = &radeon->iw.irq_seq;
- ret = drmCommandWriteRead(radeon->dri.fd, DRM_RADEON_IRQ_EMIT,
- &ie, sizeof(ie));
- if (ret) {
- fprintf(stderr, "%s: drmRadeonIrqEmit: %d\n", __FUNCTION__,
- ret);
- exit(1);
- }
-}
-
-static void radeonWaitIrq(radeonContextPtr radeon)
-{
- int ret;
-
- do {
- ret = drmCommandWrite(radeon->dri.fd, DRM_RADEON_IRQ_WAIT,
- &radeon->iw, sizeof(radeon->iw));
- } while (ret && (errno == EINTR || errno == EAGAIN));
-
- if (ret) {
- fprintf(stderr, "%s: drmRadeonIrqWait: %d\n", __FUNCTION__,
- ret);
- exit(1);
- }
-}
-
-static void radeonWaitForFrameCompletion(radeonContextPtr radeon)
-{
- drm_radeon_sarea_t *sarea = radeon->sarea;
-
- if (radeon->do_irqs) {
- if (radeonGetLastFrame(radeon) < sarea->last_frame) {
- if (!radeon->irqsEmitted) {
- while (radeonGetLastFrame(radeon) <
- sarea->last_frame) ;
- } else {
- UNLOCK_HARDWARE(radeon);
- radeonWaitIrq(radeon);
- LOCK_HARDWARE(radeon);
- }
- radeon->irqsEmitted = 10;
- }
-
- if (radeon->irqsEmitted) {
- radeonEmitIrqLocked(radeon);
- radeon->irqsEmitted--;
- }
- } else {
- while (radeonGetLastFrame(radeon) < sarea->last_frame) {
- UNLOCK_HARDWARE(radeon);
- if (radeon->do_usleeps)
- DO_USLEEP(1);
- LOCK_HARDWARE(radeon);
- }
- }
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv)
-{
- radeonContextPtr radeon;
- GLint nbox, i, ret;
- GLboolean missed_target;
- int64_t ust;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_IOCTL) {
- fprintf(stderr, "\n%s( %p )\n\n", __FUNCTION__,
- (void *)radeon->glCtx);
- }
-
- if (IS_FAMILY_R200(radeon))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(radeon->glCtx);
-
- LOCK_HARDWARE(radeon);
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- radeonWaitForFrameCompletion(radeon);
- UNLOCK_HARDWARE(radeon);
- driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags,
- &missed_target);
- LOCK_HARDWARE(radeon);
-
- nbox = dPriv->numClipRects; /* must be in locked region */
-
- for (i = 0; i < nbox;) {
- GLint nr = MIN2(i + RADEON_NR_SAREA_CLIPRECTS, nbox);
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = radeon->sarea->boxes;
- GLint n = 0;
-
- for (; i < nr; i++) {
- *b++ = box[i];
- n++;
- }
- radeon->sarea->nbox = n;
-
- ret = drmCommandNone(radeon->dri.fd, DRM_RADEON_SWAP);
-
- if (ret) {
- fprintf(stderr, "DRM_RADEON_SWAP: return = %d\n",
- ret);
- UNLOCK_HARDWARE(radeon);
- exit(1);
- }
- }
-
- UNLOCK_HARDWARE(radeon);
-
- if (IS_FAMILY_R200(radeon))
- ((r200ContextPtr)radeon)->hw.all_dirty = GL_TRUE;
- else
- ((r300ContextPtr)radeon)->hw.all_dirty = GL_TRUE;
-
- radeon->swap_count++;
- (*dri_interface->getUST) (&ust);
- if (missed_target) {
- radeon->swap_missed_count++;
- radeon->swap_missed_ust = ust - radeon->swap_ust;
- }
-
- radeon->swap_ust = ust;
-
- sched_yield();
-}
-
-void radeonPageFlip(const __DRIdrawablePrivate * dPriv)
-{
- radeonContextPtr radeon;
- GLint ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_IOCTL) {
- fprintf(stderr, "%s: pfCurrentPage: %d\n", __FUNCTION__,
- radeon->sarea->pfCurrentPage);
- }
-
- if (IS_FAMILY_R200(radeon))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(radeon->glCtx);
- LOCK_HARDWARE(radeon);
-
- if (!dPriv->numClipRects) {
- UNLOCK_HARDWARE(radeon);
- usleep(10000); /* throttle invisible client 10ms */
- return;
- }
-
- /* Need to do this for the perf box placement:
- */
- {
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = radeon->sarea->boxes;
- b[0] = box[0];
- radeon->sarea->nbox = 1;
- }
-
- /* Throttle the frame rate -- only allow a few pending swap buffers
- * request at a time.
- */
- radeonWaitForFrameCompletion(radeon);
- UNLOCK_HARDWARE(radeon);
- driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags,
- &missed_target);
- if (missed_target) {
- radeon->swap_missed_count++;
- (void)(*dri_interface->getUST) (&radeon->swap_missed_ust);
- }
- LOCK_HARDWARE(radeon);
-
- ret = drmCommandNone(radeon->dri.fd, DRM_RADEON_FLIP);
-
- UNLOCK_HARDWARE(radeon);
-
- if (ret) {
- fprintf(stderr, "DRM_RADEON_FLIP: return = %d\n", ret);
- exit(1);
- }
-
- radeon->swap_count++;
- (void)(*dri_interface->getUST) (&radeon->swap_ust);
-
- if (radeon->sarea->pfCurrentPage == 1) {
- radeon->state.color.drawOffset = radeon->radeonScreen->frontOffset;
- radeon->state.color.drawPitch = radeon->radeonScreen->frontPitch;
- } else {
- radeon->state.color.drawOffset = radeon->radeonScreen->backOffset;
- radeon->state.color.drawPitch = radeon->radeonScreen->backPitch;
- }
-
- if (IS_FAMILY_R200(radeon)) {
- r200ContextPtr r200 = (r200ContextPtr)radeon;
-
- R200_STATECHANGE(r200, ctx);
- r200->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = radeon->state.color.drawOffset
- + radeon->radeonScreen->fbLocation;
- r200->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = radeon->state.color.drawPitch;
- }
- if (IS_FAMILY_R300(radeon)) {
- r300ContextPtr r300 = (r300ContextPtr)radeon;
- R300_STATECHANGE(r300, cb);
- r300->hw.cb.cmd[R300_CB_OFFSET] = r300->radeon.state.color.drawOffset +
- r300->radeon.radeonScreen->fbLocation;
- r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.state.color.drawPitch;
-
- if (r300->radeon.radeonScreen->cpp == 4)
- r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_ARGB8888;
- else
- r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_FORMAT_RGB565;
-
- if (r300->radeon.sarea->tiling_enabled)
- r300->hw.cb.cmd[R300_CB_PITCH] |= R300_COLOR_TILE_ENABLE;
- }
-}
-
-void radeonWaitForIdleLocked(radeonContextPtr radeon)
-{
- int ret;
- int i = 0;
-
- do {
- ret = drmCommandNone(radeon->dri.fd, DRM_RADEON_CP_IDLE);
- if (ret)
- DO_USLEEP(1);
- } while (ret && ++i < 100);
-
- if (ret < 0) {
- UNLOCK_HARDWARE(radeon);
- fprintf(stderr, "Error: R200 timed out... exiting\n");
- exit(-1);
- }
-}
-
-static void radeonWaitForIdle(radeonContextPtr radeon)
-{
- LOCK_HARDWARE(radeon);
- radeonWaitForIdleLocked(radeon);
- UNLOCK_HARDWARE(radeon);
-}
-
-void radeonFlush(GLcontext * ctx)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- if (IS_FAMILY_R300(radeon))
- r300Flush(ctx);
-#if R200_MERGED
- else
- r200Flush(ctx);
-#endif
-}
-
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-void radeonFinish(GLcontext * ctx)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- radeonFlush(ctx);
-
- if (radeon->do_irqs) {
- LOCK_HARDWARE(radeon);
- radeonEmitIrqLocked(radeon);
- UNLOCK_HARDWARE(radeon);
- radeonWaitIrq(radeon);
- } else
- radeonWaitForIdle(radeon);
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.h
deleted file mode 100644
index 7c19325dd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_ioctl.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_IOCTL_H__
-#define __RADEON_IOCTL_H__
-
-#include "simple_list.h"
-#include "radeon_dri.h"
-#include "radeon_lock.h"
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "r200_context.h"
-#include "radeon_drm.h"
-
-extern void radeonCopyBuffer(const __DRIdrawablePrivate * drawable);
-extern void radeonPageFlip(const __DRIdrawablePrivate * drawable);
-extern void radeonFlush(GLcontext * ctx);
-extern void radeonFinish(GLcontext * ctx);
-extern void radeonWaitForIdleLocked(radeonContextPtr radeon);
-
-#endif /* __RADEON_IOCTL_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.c
deleted file mode 100644
index 3c7fc72a4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#include <string.h>
-
-#include "r200_context.h"
-#include "radeon_lock.h"
-#include "r200_tex.h"
-#include "r200_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-
-#include "framebuffer.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-/* Turn on/off page flipping according to the flags in the sarea:
- */
-static void radeonUpdatePageFlipping(radeonContextPtr radeon)
-{
- int use_back;
-
- radeon->doPageFlip = radeon->sarea->pfState;
-
- use_back = (radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
- use_back ^= (radeon->sarea->pfCurrentPage == 1);
-
- if (use_back) {
- radeon->state.color.drawOffset = radeon->radeonScreen->backOffset;
- radeon->state.color.drawPitch = radeon->radeonScreen->backPitch;
- } else {
- radeon->state.color.drawOffset = radeon->radeonScreen->frontOffset;
- radeon->state.color.drawPitch = radeon->radeonScreen->frontPitch;
- }
-}
-
-/**
- * Called by radeonGetLock() after the lock has been obtained.
- */
-#if R200_MERGED
-static void r200RegainedLock(r200ContextPtr r200)
-{
- __DRIdrawablePrivate *dPriv = r200->radeon.dri.drawable;
- int i;
-
- if (r200->radeon.lastStamp != dPriv->lastStamp) {
- radeonUpdatePageFlipping(&r200->radeon);
- R200_STATECHANGE(r200, ctx);
- r200->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] =
- r200->radeon.state.color.drawOffset
- + r200->radeon.radeonScreen->fbLocation;
- r200->hw.ctx.cmd[CTX_RB3D_COLORPITCH] =
- r200->radeon.state.color.drawPitch;
-
- if (r200->radeon.glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- radeonSetCliprects(&r200->radeon, GL_BACK_LEFT);
- else
- radeonSetCliprects(&r200->radeon, GL_FRONT_LEFT);
- r200UpdateViewportOffset(r200->radeon.glCtx);
- r200->radeon.lastStamp = dPriv->lastStamp;
- }
-
- for (i = 0; i < r200->nr_heaps; i++) {
- DRI_AGE_TEXTURES(r200->texture_heaps[i]);
- }
-}
-#endif
-
-static void r300RegainedLock(radeonContextPtr radeon)
-{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
-
- if (radeon->lastStamp != dPriv->lastStamp) {
- _mesa_resize_framebuffer(radeon->glCtx,
- (GLframebuffer*)dPriv->driverPrivate,
- dPriv->w, dPriv->h);
-
- radeonUpdatePageFlipping(radeon);
-
- if (radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- radeonSetCliprects(radeon, GL_BACK_LEFT);
- else
- radeonSetCliprects(radeon, GL_FRONT_LEFT);
-
- radeonUpdateScissor(radeon->glCtx);
- radeon->lastStamp = dPriv->lastStamp;
- }
-
-#if R200_MERGED
- for (i = 0; i < r200->nr_heaps; i++) {
- DRI_AGE_TEXTURES(r200->texture_heaps[i]);
- }
-#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 radeonGetLock(radeonContextPtr radeon, GLuint flags)
-{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
- __DRIscreenPrivate *sPriv = radeon->dri.screen;
- drm_radeon_sarea_t *sarea = radeon->sarea;
-
- drmGetLock(radeon->dri.fd, radeon->dri.hwContext, 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 (sarea->ctx_owner != radeon->dri.hwContext)
- sarea->ctx_owner = radeon->dri.hwContext;
-
- if (IS_FAMILY_R300(radeon))
- r300RegainedLock(radeon);
-#if R200_MERGED
- else
- r200RegainedLock((r200ContextPtr)radeon);
-#endif
-
- radeon->lost_context = GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.h
deleted file mode 100644
index c9acbce0c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_lock.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_LOCK_H__
-#define __RADEON_LOCK_H__
-
-#include "r200_ioctl.h"
-
-extern void radeonGetLock(radeonContextPtr radeon, 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( radeon ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( (radeon)->dri.hwLock, (radeon)->dri.hwContext, \
- (DRM_LOCK_HELD | (radeon)->dri.hwContext), __ret ); \
- if ( __ret ) \
- radeonGetLock( (radeon), 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-#if R200_MERGED
-#define UNLOCK_HARDWARE( radeon ) \
- do { \
- DRM_UNLOCK( (radeon)->dri.fd, \
- (radeon)->dri.hwLock, \
- (radeon)->dri.hwContext ); \
- DEBUG_RESET(); \
- if (IS_FAMILY_R200((radeon))) { \
- r200ContextPtr __r200 = (r200ContextPtr)(radeon); \
- if (__r200->save_on_next_unlock) \
- r200SaveHwState( __r200 ); \
- __r200->save_on_next_unlock = GL_FALSE; \
- } \
- } while (0)
-#else
-#define UNLOCK_HARDWARE( radeon ) \
- do { \
- DRM_UNLOCK( (radeon)->dri.fd, \
- (radeon)->dri.hwLock, \
- (radeon)->dri.hwContext ); \
- DEBUG_RESET(); \
- } while (0)
-#endif
-#endif /* __RADEON_LOCK_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.c
deleted file mode 100644
index 663bc973b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.c
+++ /dev/null
@@ -1,879 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/**
- * \file radeon_screen.c
- * Screen initialization functions for the R200 driver.
- *
- * \author Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <dlfcn.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "mtypes.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#define STANDALONE_MMIO
-#include "radeon_screen.h"
-#include "r200_context.h"
-#include "r300_context.h"
-#include "radeon_ioctl.h"
-#include "r200_ioctl.h"
-#include "radeon_macros.h"
-#include "radeon_reg.h"
-#include "radeon_span.h"
-
-#include "utils.h"
-#include "vblank.h"
-#include "GL/internal/dri_interface.h"
-#include "drirenderbuffer.h"
-
-/* R200 configuration
- */
-#include "xmlpool.h"
-
-const char __driR200ConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_MAX_TEXTURE_UNITS(4, 2, 6)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_DEF_MAX_ANISOTROPY(1.0, "1.0,2.0,4.0,8.0,16.0")
- DRI_CONF_NO_NEG_LOD_BIAS(false)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
- DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_SOFTWARE
- DRI_CONF_ARB_VERTEX_PROGRAM(true)
- DRI_CONF_NV_VERTEX_PROGRAM(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driR200NConfigOptions = 13;
-
-/* TODO: integrate these into xmlpool.h! */
-#define DRI_CONF_MAX_TEXTURE_IMAGE_UNITS(def,min,max) \
-DRI_CONF_OPT_BEGIN_V(texture_image_units,int,def, # min ":" # max ) \
- DRI_CONF_DESC(en,"Number of texture image units") \
- DRI_CONF_DESC(de,"Anzahl der Textureinheiten") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_MAX_TEXTURE_COORD_UNITS(def,min,max) \
-DRI_CONF_OPT_BEGIN_V(texture_coord_units,int,def, # min ":" # max ) \
- DRI_CONF_DESC(en,"Number of texture coordinate units") \
- DRI_CONF_DESC(de,"Anzahl der Texturkoordinateneinheiten") \
-DRI_CONF_OPT_END
-
-#define DRI_CONF_COMMAND_BUFFER_SIZE(def,min,max) \
-DRI_CONF_OPT_BEGIN_V(command_buffer_size,int,def, # min ":" # max ) \
- DRI_CONF_DESC(en,"Size of command buffer (in KB)") \
- DRI_CONF_DESC(de,"Grösse des Befehlspuffers (in KB)") \
-DRI_CONF_OPT_END
-
-
-const char __driR300ConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_MAX_TEXTURE_IMAGE_UNITS(16, 2, 16)
- DRI_CONF_MAX_TEXTURE_COORD_UNITS(8, 2, 8)
- DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_DEF_MAX_ANISOTROPY(1.0, "1.0,2.0,4.0,8.0,16.0")
- DRI_CONF_NO_NEG_LOD_BIAS(false)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
- DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driR300NConfigOptions = 13;
-
-extern const struct dri_extension card_extensions[];
-
-#ifndef RADEON_DEBUG
-int RADEON_DEBUG = 0;
-#endif
-
-static const struct dri_debug_control debug_control[] = {
- {"fall", DEBUG_FALLBACKS},
- {"tex", DEBUG_TEXTURE},
- {"ioctl", DEBUG_IOCTL},
- {"prim", DEBUG_PRIMS},
- {"vert", DEBUG_VERTS},
- {"state", DEBUG_STATE},
- {"code", DEBUG_CODEGEN},
- {"vfmt", DEBUG_VFMT},
- {"vtxf", DEBUG_VFMT},
- {"verb", DEBUG_VERBOSE},
- {"dri", DEBUG_DRI},
- {"dma", DEBUG_DMA},
- {"san", DEBUG_SANITY},
- {"sync", DEBUG_SYNC},
- {"pix", DEBUG_PIXEL},
- {"mem", DEBUG_MEMORY},
- {"allmsg", ~DEBUG_SYNC}, /* avoid the term "sync" because the parser uses strstr */
- {NULL, 0}
-};
-
-#if 1
-/* Including xf86PciInfo.h introduces a bunch of errors...
- */
-#define PCI_CHIP_R200_QD 0x5144 /* why do they have r200 names? */
-#define PCI_CHIP_R200_QE 0x5145 /* Those are all standard radeons */
-#define PCI_CHIP_R200_QF 0x5146
-#define PCI_CHIP_R200_QG 0x5147
-#define PCI_CHIP_R200_QY 0x5159
-#define PCI_CHIP_R200_QZ 0x515A
-#define PCI_CHIP_R200_LW 0x4C57
-#define PCI_CHIP_R200_LY 0x4C59
-#define PCI_CHIP_R200_LZ 0x4C5A
-#define PCI_CHIP_RV200_QW 0x5157 /* Radeon 7500 - not an R200 at all */
-#define PCI_CHIP_RV200_QX 0x5158
-#define PCI_CHIP_RS100_4136 0x4136 /* IGP RS100, RS200, RS250 are not R200 */
-#define PCI_CHIP_RS200_4137 0x4137
-#define PCI_CHIP_RS250_4237 0x4237
-#define PCI_CHIP_RS100_4336 0x4336
-#define PCI_CHIP_RS200_4337 0x4337
-#define PCI_CHIP_RS250_4437 0x4437
-#define PCI_CHIP_RS300_5834 0x5834 /* All RS300's are R200 */
-#define PCI_CHIP_RS300_5835 0x5835
-#define PCI_CHIP_RS300_5836 0x5836
-#define PCI_CHIP_RS300_5837 0x5837
-#define PCI_CHIP_R200_BB 0x4242 /* r200 (non-derived) start */
-#define PCI_CHIP_R200_BC 0x4243
-#define PCI_CHIP_R200_QH 0x5148
-#define PCI_CHIP_R200_QI 0x5149
-#define PCI_CHIP_R200_QJ 0x514A
-#define PCI_CHIP_R200_QK 0x514B
-#define PCI_CHIP_R200_QL 0x514C
-#define PCI_CHIP_R200_QM 0x514D
-#define PCI_CHIP_R200_QN 0x514E
-#define PCI_CHIP_R200_QO 0x514F /* r200 (non-derived) end */
-/* are the R200 Qh (0x5168) and following needed too? They are not in xf86PciInfo.h
- but in the pci database. Maybe just secondary ports or something ? */
-
-#define PCI_CHIP_R300_AD 0x4144
-#define PCI_CHIP_R300_AE 0x4145
-#define PCI_CHIP_R300_AF 0x4146
-#define PCI_CHIP_R300_AG 0x4147
-#define PCI_CHIP_RV350_AP 0x4150
-#define PCI_CHIP_RV350_AR 0x4152
-#define PCI_CHIP_RV350_AS 0x4153
-#define PCI_CHIP_RV350_NJ 0x4E4A
-#define PCI_CHIP_RV350_NP 0x4E50
-#define PCI_CHIP_RV350_NQ 0x4E51 /* Saphire 9600 256MB card */
-#define PCI_CHIP_RV350_NT 0x4E54
-#define PCI_CHIP_RV350_NQ_2 0x4E71 /* Saphire 9600 256MB card - Second Head */
-#define PCI_CHIP_R300_ND 0x4E44
-#define PCI_CHIP_R300_NE 0x4E45
-#define PCI_CHIP_R300_NF 0x4E46
-#define PCI_CHIP_R300_NG 0x4E47
-#define PCI_CHIP_R350_NH 0x4E48
-#define PCI_CHIP_R420_JI 0x4A49
-#define PCI_CHIP_R420_JK 0x4a4b
-#endif
-
-
-static radeonScreenPtr __radeonScreen;
-
-static int getSwapInfo(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo);
-
-static __GLcontextModes *radeonFillInModes(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_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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;
-}
-
-
-/* Create the device specific screen private data struct.
- */
-static radeonScreenPtr radeonCreateScreen(__DRIscreenPrivate * sPriv)
-{
- radeonScreenPtr screen;
- RADEONDRIPtr dri_priv = (RADEONDRIPtr) sPriv->pDevPriv;
- unsigned char *RADEONMMIO;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC)
- (*dri_interface->getProcAddress("glxEnableExtension"));
- void *const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- screen = (radeonScreenPtr) CALLOC(sizeof(*screen));
- if (!screen) {
- __driUtilMessage
- ("%s: Could not allocate memory for screen structure",
- __FUNCTION__);
- return NULL;
- }
-
-#if DO_DEBUG
- RADEON_DEBUG = driParseDebugString(getenv("RADEON_DEBUG"), debug_control);
-#endif
-
- /* Get family and potential quirks from the PCI device ID.
- */
- switch (dri_priv->deviceID) {
- case PCI_CHIP_R200_QD:
- case PCI_CHIP_R200_QE:
- case PCI_CHIP_R200_QF:
- case PCI_CHIP_R200_QG:
- case PCI_CHIP_R200_QY:
- case PCI_CHIP_R200_QZ:
- case PCI_CHIP_RV200_QW:
- case PCI_CHIP_RV200_QX:
- case PCI_CHIP_R200_LW:
- case PCI_CHIP_R200_LY:
- case PCI_CHIP_R200_LZ:
- case PCI_CHIP_RS100_4136:
- case PCI_CHIP_RS200_4137:
- case PCI_CHIP_RS250_4237:
- case PCI_CHIP_RS100_4336:
- case PCI_CHIP_RS200_4337:
- case PCI_CHIP_RS250_4437:
- __driUtilMessage("radeonCreateScreen(): Device isn't an r200!\n");
- FREE(screen);
- return NULL;
-
- case PCI_CHIP_RS300_5834:
- case PCI_CHIP_RS300_5835:
- case PCI_CHIP_RS300_5836:
- case PCI_CHIP_RS300_5837:
- screen->chipset = RADEON_CHIP_UNREAL_R200;
- break;
-
- case PCI_CHIP_R200_BB:
- case PCI_CHIP_R200_BC:
- case PCI_CHIP_R200_QH:
- case PCI_CHIP_R200_QI:
- case PCI_CHIP_R200_QJ:
- case PCI_CHIP_R200_QK:
- case PCI_CHIP_R200_QL:
- case PCI_CHIP_R200_QM:
- case PCI_CHIP_R200_QN:
- case PCI_CHIP_R200_QO:
- screen->chipset = RADEON_CHIP_REAL_R200 | RADEON_CHIPSET_TCL;
- break;
-
- /* TODO: Check all those chips for the exact flags required.
- */
- case PCI_CHIP_R300_AD:
- case PCI_CHIP_R300_AE:
- case PCI_CHIP_R300_AF:
- case PCI_CHIP_R300_AG:
- case PCI_CHIP_RV350_AP:
- case PCI_CHIP_RV350_AR:
- case PCI_CHIP_RV350_AS:
- case PCI_CHIP_RV350_NJ:
- case PCI_CHIP_RV350_NP:
- case PCI_CHIP_RV350_NT:
- case PCI_CHIP_RV350_NQ:
-/* case PCI_CHIP_RV350_NQ: -- Should we have the second head in here too? */
- screen->chipset = RADEON_CHIP_RV350;
- break;
-
- case PCI_CHIP_R300_ND: /* confirmed -- nh */
- case PCI_CHIP_R300_NE:
- case PCI_CHIP_R300_NF:
- case PCI_CHIP_R300_NG:
- case PCI_CHIP_R350_NH:
- screen->chipset = RADEON_CHIP_R300;
- break;
-
- case PCI_CHIP_R420_JI:
- case PCI_CHIP_R420_JK:
- screen->chipset = RADEON_CHIP_R420;
- break;
-
- default:
- fprintf(stderr,
- "Unknown device ID %04X, please report. Assuming plain R300.\n",
- dri_priv->deviceID);
- screen->chipset = RADEON_CHIP_R300;
- }
-
- /* Parse configuration */
- if (GET_CHIP(screen) >= RADEON_CHIP_R300) {
- driParseOptionInfo(&screen->optionCache,
- __driR300ConfigOptions, __driR300NConfigOptions);
- } else {
- driParseOptionInfo(&screen->optionCache,
- __driR200ConfigOptions, __driR200NConfigOptions);
- }
-
- /* This is first since which regions we map depends on whether or
- * not we are using a PCI card.
- */
- screen->IsPCI = dri_priv->IsPCI;
-
- {
- int ret;
- drm_radeon_getparam_t gp;
-
- gp.param = RADEON_PARAM_GART_BUFFER_OFFSET;
- gp.value = &screen->gart_buffer_offset;
-
- ret = drmCommandWriteRead(sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE(screen);
- fprintf(stderr,
- "drmRadeonGetParam (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n",
- ret);
- return NULL;
- }
-
- if (sPriv->drmMinor >= 6) {
- gp.param = RADEON_PARAM_GART_BASE;
- gp.value = &screen->gart_base;
-
- ret =
- drmCommandWriteRead(sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE(screen);
- fprintf(stderr,
- "drmR200GetParam (RADEON_PARAM_GART_BASE): %d\n",
- ret);
- return NULL;
- }
-
- gp.param = RADEON_PARAM_IRQ_NR;
- gp.value = &screen->irq;
-
- ret =
- drmCommandWriteRead(sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE(screen);
- fprintf(stderr,
- "drmRadeonGetParam (RADEON_PARAM_IRQ_NR): %d\n",
- ret);
- return NULL;
- }
-
- /* Check if kernel module is new enough to support cube maps */
- screen->drmSupportsCubeMaps = (sPriv->drmMinor >= 7);
- /* Check if kernel module is new enough to support blend color and
- separate blend functions/equations */
- screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11);
-
- }
- }
-
- screen->mmio.handle = dri_priv->registerHandle;
- screen->mmio.size = dri_priv->registerSize;
- if (drmMap(sPriv->fd,
- screen->mmio.handle, screen->mmio.size, &screen->mmio.map)) {
- FREE(screen);
- __driUtilMessage("%s: drmMap failed\n", __FUNCTION__);
- return NULL;
- }
-
- RADEONMMIO = screen->mmio.map;
-
- screen->status.handle = dri_priv->statusHandle;
- screen->status.size = dri_priv->statusSize;
- if (drmMap(sPriv->fd,
- screen->status.handle,
- screen->status.size, &screen->status.map)) {
- drmUnmap(screen->mmio.map, screen->mmio.size);
- FREE(screen);
- __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__);
- return NULL;
- }
- screen->scratch = (__volatile__ uint32_t *)
- ((GLubyte *) screen->status.map + RADEON_SCRATCH_REG_OFFSET);
-
- screen->buffers = drmMapBufs(sPriv->fd);
- if (!screen->buffers) {
- drmUnmap(screen->status.map, screen->status.size);
- drmUnmap(screen->mmio.map, screen->mmio.size);
- FREE(screen);
- __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__);
- return NULL;
- }
-
- if (dri_priv->gartTexHandle && dri_priv->gartTexMapSize) {
-
- screen->gartTextures.handle = dri_priv->gartTexHandle;
- screen->gartTextures.size = dri_priv->gartTexMapSize;
- if (drmMap(sPriv->fd,
- screen->gartTextures.handle,
- screen->gartTextures.size,
- (drmAddressPtr) & screen->gartTextures.map)) {
- drmUnmapBufs(screen->buffers);
- drmUnmap(screen->status.map, screen->status.size);
- drmUnmap(screen->mmio.map, screen->mmio.size);
- FREE(screen);
- __driUtilMessage
- ("%s: drmMAP failed for GART texture area\n",
- __FUNCTION__);
- return NULL;
- }
-
- screen->gart_texture_offset =
- dri_priv->gartTexOffset +
- (screen->IsPCI ? INREG(RADEON_AIC_LO_ADDR)
- : ((INREG(RADEON_MC_AGP_LOCATION) & 0x0ffffU) << 16));
- }
-
- screen->cpp = dri_priv->bpp / 8;
- screen->AGPMode = dri_priv->AGPMode;
-
- screen->fbLocation = (INREG(RADEON_MC_FB_LOCATION) & 0xffff) << 16;
-
- if (sPriv->drmMinor >= 10) {
- drm_radeon_setparam_t sp;
-
- sp.param = RADEON_SETPARAM_FB_LOCATION;
- sp.value = screen->fbLocation;
-
- drmCommandWrite(sPriv->fd, DRM_RADEON_SETPARAM,
- &sp, sizeof(sp));
- }
-
- screen->frontOffset = dri_priv->frontOffset;
- screen->frontPitch = dri_priv->frontPitch;
- screen->backOffset = dri_priv->backOffset;
- screen->backPitch = dri_priv->backPitch;
- screen->depthOffset = dri_priv->depthOffset;
- screen->depthPitch = dri_priv->depthPitch;
-
- if ( dri_priv->textureSize == 0 ) {
- screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset;
- screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] =
- dri_priv->log2GARTTexGran;
- } else {
- screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset
- + screen->fbLocation;
- screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize;
- screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] =
- dri_priv->log2TexGran;
- }
-
- if (!screen->gartTextures.map || dri_priv->textureSize == 0) {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1;
- screen->texOffset[RADEON_GART_TEX_HEAP] = 0;
- screen->texSize[RADEON_GART_TEX_HEAP] = 0;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] = 0;
- } else {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS;
- screen->texOffset[RADEON_GART_TEX_HEAP] =
- screen->gart_texture_offset;
- screen->texSize[RADEON_GART_TEX_HEAP] =
- dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] =
- dri_priv->log2GARTTexGran;
- }
-
- screen->driScreen = sPriv;
- screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
-
- if (glx_enable_extension != NULL) {
- if (screen->irq != 0) {
- (*glx_enable_extension) (psc, "GLX_SGI_swap_control");
- (*glx_enable_extension) (psc, "GLX_SGI_video_sync");
- (*glx_enable_extension) (psc, "GLX_MESA_swap_control");
- }
-
- (*glx_enable_extension) (psc, "GLX_MESA_swap_frame_usage");
- }
-
-#if R200_MERGED
- sPriv->psc->allocateMemory = (void *)r200AllocateMemoryMESA;
- sPriv->psc->freeMemory = (void *)r200FreeMemoryMESA;
- sPriv->psc->memoryOffset = (void *)r200GetMemoryOffsetMESA;
-
- if (glx_enable_extension != NULL) {
- (*glx_enable_extension) (psc, "GLX_MESA_allocate_memory");
- }
-#endif
-
- return screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void radeonDestroyScreen(__DRIscreenPrivate * sPriv)
-{
- radeonScreenPtr screen = (radeonScreenPtr) sPriv->private;
-
- if (!screen)
- return;
-
- if (screen->gartTextures.map) {
- drmUnmap(screen->gartTextures.map, screen->gartTextures.size);
- }
- drmUnmapBufs(screen->buffers);
- drmUnmap(screen->status.map, screen->status.size);
- drmUnmap(screen->mmio.map, screen->mmio.size);
-
- /* free all option information */
- driDestroyOptionInfo(&screen->optionCache);
-
- FREE(screen);
- sPriv->private = NULL;
-}
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean radeonInitDriver(__DRIscreenPrivate * sPriv)
-{
- __radeonScreen = radeonCreateScreen(sPriv);
-
- sPriv->private = (void *)__radeonScreen;
-
- return sPriv->private ? GL_TRUE : GL_FALSE;
-}
-
-/**
- * Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- *
- * \todo This function (and its interface) will need to be updated to support
- * pbuffers.
- */
-static GLboolean
-radeonCreateBuffer(__DRIscreenPrivate * driScrnPriv,
- __DRIdrawablePrivate * driDrawPriv,
- const __GLcontextModes * mesaVis, GLboolean isPixmap)
-{
- radeonScreenPtr screen = (radeonScreenPtr)driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- } else {
- const GLboolean swDepth = GL_FALSE;
- const GLboolean swAlpha = GL_FALSE;
- const GLboolean swAccum = mesaVis->accumRedBits > 0;
- const GLboolean swStencil = mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24;
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- swDepth,
- swStencil, swAccum, swAlpha);
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- radeonSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- radeonSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- radeonSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- radeonSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- radeonSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- swDepth,
- swStencil,
- swAccum,
- swAlpha,
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-static void radeonDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->
- driverPrivate));
-}
-
-
-/**
- * Choose the appropriate CreateContext function based on the chipset.
- */
-static GLboolean radeonCreateContext(const __GLcontextModes * glVisual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPriv)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
- int chip = GET_CHIP(screen);
-
- if (chip >= RADEON_CHIP_R300)
- return r300CreateContext(glVisual, driContextPriv, sharedContextPriv);
-#if R200_MERGED
- else
- return r200CreateContext(glVisual, driContextPriv, sharedContextPriv);
-#endif
-}
-
-
-/**
- * Choose the appropriate DestroyContext function based on the chipset.
- */
-static void radeonDestroyContext(__DRIcontextPrivate * driContextPriv)
-{
- radeonContextPtr radeon = (radeonContextPtr) driContextPriv->driverPrivate;
- int chip = GET_CHIP(radeon->radeonScreen);
-
- if (chip >= RADEON_CHIP_R300)
- return r300DestroyContext(driContextPriv);
-#if R200_MERGED
- else
- return r200DestroyContext(driContextPriv);
-#endif
-}
-
-
-static const struct __DriverAPIRec radeonAPI = {
- .InitDriver = radeonInitDriver,
- .DestroyScreen = radeonDestroyScreen,
- .CreateContext = radeonCreateContext,
- .DestroyContext = radeonDestroyContext,
- .CreateBuffer = radeonCreateBuffer,
- .DestroyBuffer = radeonDestroyBuffer,
- .SwapBuffers = radeonSwapBuffers,
- .MakeCurrent = radeonMakeCurrent,
- .UnbindContext = radeonUnbindContext,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/**
- * 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-void *__driCreateNewScreen_20050727(__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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes)
-{
- __DRIscreenPrivate *psp;
- static const __DRIutilversion2 ddx_expected = { 4, 5, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 17, 0 };
-
- dri_interface = interface;
-
- if (!driCheckDriDdxDrmVersions3("R300",
- 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, &radeonAPI);
- if (psp != NULL) {
- RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
- *driver_modes = radeonFillInModes(dri_priv->bpp,
- (dri_priv->bpp ==
- 16) ? 16 : 24,
- (dri_priv->bpp ==
- 16) ? 0 : 8,
- (dri_priv->backOffset !=
- dri_priv->depthOffset));
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *)psp;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int getSwapInfo(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo)
-{
- radeonContextPtr radeon;
-
- if ((dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL)) {
- return -1;
- }
-
- radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = radeon->swap_count;
- sInfo->swap_ust = radeon->swap_ust;
- sInfo->swap_missed_count = radeon->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage(dPriv, 0, radeon->swap_missed_ust)
- : 0.0;
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.h
deleted file mode 100644
index ac8471fea..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_screen.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_SCREEN_H__
-#define __RADEON_SCREEN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "radeon_drm.h"
-#include "dri_util.h"
-#include "xmlconfig.h"
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress map; /* Mapping of the DRM region */
-} radeonRegionRec, *radeonRegionPtr;
-
-/* chipset features */
-#define RADEON_CHIP_UNREAL_R200 0
-#define RADEON_CHIP_REAL_R200 1
-#define RADEON_CHIP_R300 2
-#define RADEON_CHIP_RV350 3
-#define RADEON_CHIP_R420 4
-#define RADEON_CHIP_MASK 0x0f
-
-#define RADEON_CHIPSET_TCL (1 << 8)
-
-#define GET_CHIP(screen) ((screen)->chipset & RADEON_CHIP_MASK)
-#define IS_FAMILY_R200(radeon) (GET_CHIP((radeon)->radeonScreen) < RADEON_CHIP_R300)
-#define IS_FAMILY_R300(radeon) (GET_CHIP((radeon)->radeonScreen) >= RADEON_CHIP_R300)
-
-#define R200_NR_TEX_HEAPS 2
-
-typedef struct {
- int chipset;
- int cpp;
- int IsPCI; /* Current card is a PCI card */
- int AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- unsigned int fbLocation;
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- /* Shared texture data */
- int numTexHeaps;
- int texOffset[R200_NR_TEX_HEAPS];
- int texSize[R200_NR_TEX_HEAPS];
- int logTexGranularity[R200_NR_TEX_HEAPS];
-
- radeonRegionRec mmio;
- radeonRegionRec status;
- radeonRegionRec gartTextures;
-
- drmBufMapPtr buffers;
-
- __volatile__ int32_t *scratch;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
- unsigned int gart_buffer_offset; /* offset in card memory space */
- unsigned int gart_texture_offset; /* offset in card memory space */
- unsigned int gart_base;
-
- GLboolean drmSupportsCubeMaps; /* need radeon kernel module >=1.7 */
- GLboolean drmSupportsBlendColor; /* need radeon kernel module >= 1.11 */
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} radeonScreenRec, *radeonScreenPtr;
-
-#endif
-#endif /* __RADEON_SCREEN_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.c
deleted file mode 100644
index 8902c93e5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "swrast/swrast.h"
-#include "colormac.h"
-
-#include "r200_context.h"
-#include "radeon_ioctl.h"
-#include "r300_ioctl.h"
-#include "radeon_span.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- radeonContextPtr radeon = RADEON_CONTEXT(ctx); \
- driRenderbuffer* drb = (driRenderbuffer*)rb; \
- __DRIscreenPrivate *sPriv = radeon->dri.screen; \
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable; \
- GLuint pitch = drb->pitch * drb->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- drb->offset + \
- (dPriv->x * drb->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) p
-
-#define LOCAL_DEPTH_VARS \
- radeonContextPtr radeon = RADEON_CONTEXT(ctx); \
- driRenderbuffer* drb = (driRenderbuffer*)rb; \
- __DRIscreenPrivate *sPriv = radeon->dri.screen; \
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable; \
- GLuint pitch = drb->pitch; \
- GLuint height = dPriv->h; \
- GLuint xo = dPriv->x; \
- GLuint yo = dPriv->y; \
- char *buf = (char *)(sPriv->pFB + drb->offset); \
- (void) buf; (void) pitch
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#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_LOCK()
-
-#define HW_CLIPLOOP() \
- do { \
- int _nc = dPriv->numClipRects; \
- \
- while ( _nc-- ) { \
- int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \
- int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \
- int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \
- int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-#define HW_UNLOCK()
-
-/* ================================================================
- * 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) * 255 / 0xf8; \
- rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
- rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) radeon##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 ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16) | \
- (a << 24) ); \
-} while (0)
-
-#define WRITE_PIXEL( _x, _y, p ) \
-do { \
- *(GLuint *)(buf + _x*4 + _y*pitch) = p; \
-} while (0)
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- volatile GLuint *ptr = (volatile GLuint *)(buf + _x*4 + _y*pitch); \
- GLuint p = *ptr; \
- 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) radeon##x##_ARGB8888
-#include "spantmp.h"
-
-/* ================================================================
- * Depth buffer
- */
-
-/* 16-bit depth buffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + (_x + xo + (_y + yo)*pitch)*2 ) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + (_x + xo + (_y + yo)*pitch)*2 );
-
-#define TAG(x) radeon##x##_16_LINEAR
-#include "depthtmp.h"
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- *
- * Careful: It looks like the R300 uses ZZZS byte order while the R200
- * uses SZZZ for 24 bit depth, 8 bit stencil mode.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint offset = ((_x) + xo + ((_y) + yo)*pitch)*4; \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0x000000ff; \
- tmp |= ((d << 8) & 0xffffff00); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_DEPTH( d, _x, _y ) \
-do { \
- d = (*(GLuint *)(buf + ((_x) + xo + ((_y) + yo)*pitch)*4) & 0xffffff00) >> 8; \
-} while(0)
-
-#define TAG(x) radeon##x##_24_8_LINEAR
-#include "depthtmp.h"
-
-/* ================================================================
- * Stencil buffer
- */
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_STENCIL( _x, _y, d ) \
-do { \
- GLuint offset = (_x + xo + (_y + yo)*pitch)*4; \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xffffff00; \
- tmp |= (d) & 0xff; \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_STENCIL( d, _x, _y ) \
-do { \
- GLuint offset = (_x + xo + (_y + yo)*pitch)*4; \
- GLuint tmp = *(GLuint *)(buf + offset); \
- d = tmp & 0x000000ff; \
-} while (0)
-
-#define TAG(x) radeon##x##_24_8_LINEAR
-#include "stenciltmp.h"
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void radeonSetBuffer(GLcontext * ctx,
- GLframebuffer * colorBuffer, GLuint bufferBit)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- int buffer;
-
- switch (bufferBit) {
- case BUFFER_BIT_FRONT_LEFT:
- buffer = 0;
- break;
-
- case BUFFER_BIT_BACK_LEFT:
- buffer = 1;
- break;
-
- default:
- _mesa_problem(ctx, "Bad bufferBit in %s", __FUNCTION__);
- return;
- }
-
- if (radeon->doPageFlip && radeon->sarea->pfCurrentPage == 1)
- buffer ^= 1;
-
-#if 0
- fprintf(stderr, "%s: using %s buffer\n", __FUNCTION__,
- buffer ? "back" : "front");
-#endif
-
- if (buffer) {
- radeon->state.pixel.readOffset =
- radeon->radeonScreen->backOffset;
- radeon->state.pixel.readPitch =
- radeon->radeonScreen->backPitch;
- radeon->state.color.drawOffset =
- radeon->radeonScreen->backOffset;
- radeon->state.color.drawPitch =
- radeon->radeonScreen->backPitch;
- } else {
- radeon->state.pixel.readOffset =
- radeon->radeonScreen->frontOffset;
- radeon->state.pixel.readPitch =
- radeon->radeonScreen->frontPitch;
- radeon->state.color.drawOffset =
- radeon->radeonScreen->frontOffset;
- radeon->state.color.drawPitch =
- radeon->radeonScreen->frontPitch;
- }
-}
-
-/* Move locking out to get reasonable span performance (10x better
- * than doing this in HW_LOCK above). WaitForIdle() is the main
- * culprit.
- */
-
-static void radeonSpanRenderStart(GLcontext * ctx)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- if (IS_FAMILY_R200(radeon))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(ctx);
-
- LOCK_HARDWARE(radeon);
- radeonWaitForIdleLocked(radeon);
-
- /* Read & rewrite the first pixel in the frame buffer. This should
- * be a noop, right? In fact without this conform fails as reading
- * from the framebuffer sometimes produces old results -- the
- * on-card read cache gets mixed up and doesn't notice that the
- * framebuffer has been updated.
- *
- * In the worst case this is buggy too as p might get the wrong
- * value first time, so really need a hidden pixel somewhere for this.
- */
- {
- int p;
- volatile int *read_buf =
- (volatile int *)(radeon->dri.screen->pFB +
- radeon->state.pixel.readOffset);
- p = *read_buf;
- *read_buf = p;
- }
-}
-
-static void radeonSpanRenderFinish(GLcontext * ctx)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- _swrast_flush(ctx);
- UNLOCK_HARDWARE(radeon);
-}
-
-void radeonInitSpanFuncs(GLcontext * ctx)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = radeonSetBuffer;
-
- swdd->SpanRenderStart = radeonSpanRenderStart;
- swdd->SpanRenderFinish = radeonSpanRenderFinish;
-}
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void radeonSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = radeonReadRGBASpan_RGB565;
- drb->Base.GetValues = radeonReadRGBAPixels_RGB565;
- drb->Base.PutRow = radeonWriteRGBASpan_RGB565;
- drb->Base.PutRowRGB = radeonWriteRGBSpan_RGB565;
- drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_RGB565;
- drb->Base.PutValues = radeonWriteRGBAPixels_RGB565;
- drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_RGB565;
- }
- else {
- drb->Base.GetRow = radeonReadRGBASpan_ARGB8888;
- drb->Base.GetValues = radeonReadRGBAPixels_ARGB8888;
- drb->Base.PutRow = radeonWriteRGBASpan_ARGB8888;
- drb->Base.PutRowRGB = radeonWriteRGBSpan_ARGB8888;
- drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_ARGB8888;
- drb->Base.PutValues = radeonWriteRGBAPixels_ARGB8888;
- drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_ARGB8888;
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = radeonReadDepthSpan_16_LINEAR;
- drb->Base.GetValues = radeonReadDepthPixels_16_LINEAR;
- drb->Base.PutRow = radeonWriteDepthSpan_16_LINEAR;
- drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_16_LINEAR;
- drb->Base.PutValues = radeonWriteDepthPixels_16_LINEAR;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = radeonReadDepthSpan_24_8_LINEAR;
- drb->Base.GetValues = radeonReadDepthPixels_24_8_LINEAR;
- drb->Base.PutRow = radeonWriteDepthSpan_24_8_LINEAR;
- drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_24_8_LINEAR;
- drb->Base.PutValues = radeonWriteDepthPixels_24_8_LINEAR;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = radeonReadStencilSpan_24_8_LINEAR;
- drb->Base.GetValues = radeonReadStencilPixels_24_8_LINEAR;
- drb->Base.PutRow = radeonWriteStencilSpan_24_8_LINEAR;
- drb->Base.PutMonoRow = radeonWriteMonoStencilSpan_24_8_LINEAR;
- drb->Base.PutValues = radeonWriteStencilPixels_24_8_LINEAR;
- drb->Base.PutMonoValues = NULL;
- }
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.h
deleted file mode 100644
index c4280b1b6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_span.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_SPAN_H__
-#define __RADEON_SPAN_H__
-
-#ifdef GLX_DIRECT_RENDERING
-
-#include "drirenderbuffer.h"
-
-extern void radeonInitSpanFuncs(GLcontext * ctx);
-extern void radeonSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.c
deleted file mode 100644
index 0cacbb5eb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/**************************************************************************
-
-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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-#include "enums.h"
-#include "colormac.h"
-#include "light.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "r200_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "r200_state.h"
-#include "r300_ioctl.h"
-
-
-/* =============================================================
- * Scissoring
- */
-
-static GLboolean intersect_rect(drm_clip_rect_t * out,
- drm_clip_rect_t * a, drm_clip_rect_t * b)
-{
- *out = *a;
- if (b->x1 > out->x1)
- out->x1 = b->x1;
- if (b->y1 > out->y1)
- out->y1 = b->y1;
- if (b->x2 < out->x2)
- out->x2 = b->x2;
- if (b->y2 < out->y2)
- out->y2 = b->y2;
- if (out->x1 >= out->x2)
- return GL_FALSE;
- if (out->y1 >= out->y2)
- return GL_FALSE;
- return GL_TRUE;
-}
-
-void radeonRecalcScissorRects(radeonContextPtr radeon)
-{
- drm_clip_rect_t *out;
- int i;
-
- /* Grow cliprect store?
- */
- if (radeon->state.scissor.numAllocedClipRects < radeon->numClipRects) {
- while (radeon->state.scissor.numAllocedClipRects <
- radeon->numClipRects) {
- radeon->state.scissor.numAllocedClipRects += 1; /* zero case */
- radeon->state.scissor.numAllocedClipRects *= 2;
- }
-
- if (radeon->state.scissor.pClipRects)
- FREE(radeon->state.scissor.pClipRects);
-
- radeon->state.scissor.pClipRects =
- MALLOC(radeon->state.scissor.numAllocedClipRects *
- sizeof(drm_clip_rect_t));
-
- if (radeon->state.scissor.pClipRects == NULL) {
- radeon->state.scissor.numAllocedClipRects = 0;
- return;
- }
- }
-
- out = radeon->state.scissor.pClipRects;
- radeon->state.scissor.numClipRects = 0;
-
- for (i = 0; i < radeon->numClipRects; i++) {
- if (intersect_rect(out,
- &radeon->pClipRects[i],
- &radeon->state.scissor.rect)) {
- radeon->state.scissor.numClipRects++;
- out++;
- }
- }
-}
-
-void radeonUpdateScissor(GLcontext* ctx)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- assert(radeon->state.scissor.enabled == ctx->Scissor.Enabled);
-
- if (radeon->dri.drawable) {
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
- int x1 = dPriv->x + ctx->Scissor.X;
- int y1 = dPriv->y + dPriv->h - (ctx->Scissor.Y + ctx->Scissor.Height);
-
- radeon->state.scissor.rect.x1 = x1;
- radeon->state.scissor.rect.y1 = y1;
- radeon->state.scissor.rect.x2 = x1 + ctx->Scissor.Width - 1;
- radeon->state.scissor.rect.y2 = y1 + ctx->Scissor.Height - 1;
-
- radeonRecalcScissorRects(radeon);
- }
-}
-
-static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- if (ctx->Scissor.Enabled) {
- /* We don't pipeline cliprect changes */
- if (IS_FAMILY_R200(radeon))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(ctx);
-
- radeonUpdateScissor(ctx);
- }
-}
-
-
-/**
- * Update cliprects and scissors.
- */
-void radeonSetCliprects(radeonContextPtr radeon, GLenum mode)
-{
- __DRIdrawablePrivate *dPriv = radeon->dri.drawable;
-
- switch (mode) {
- case GL_FRONT_LEFT:
- radeon->numClipRects = dPriv->numClipRects;
- radeon->pClipRects = dPriv->pClipRects;
- break;
- case GL_BACK_LEFT:
- /* Can't ignore 2d windows if we are page flipping.
- */
- if (dPriv->numBackClipRects == 0 || radeon->doPageFlip) {
- radeon->numClipRects = dPriv->numClipRects;
- radeon->pClipRects = dPriv->pClipRects;
- } else {
- radeon->numClipRects = dPriv->numBackClipRects;
- radeon->pClipRects = dPriv->pBackClipRects;
- }
- break;
- default:
- fprintf(stderr, "bad mode in radeonSetCliprects\n");
- radeon->numClipRects = 0;
- radeon->pClipRects = 0;
- return;
- }
-
- if (radeon->state.scissor.enabled)
- radeonRecalcScissorRects(radeon);
-}
-
-
-/**
- * Handle common enable bits.
- * Called as a fallback by r200Enable/r300Enable.
- */
-void radeonEnable(GLcontext* ctx, GLenum cap, GLboolean state)
-{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- switch(cap) {
- case GL_SCISSOR_TEST:
- /* We don't pipeline cliprect & scissor changes */
- if (IS_FAMILY_R200(radeon))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(ctx);
-
- radeon->state.scissor.enabled = state;
- radeonUpdateScissor(ctx);
- break;
-
- default:
- return;
- }
-}
-
-
-/**
- * Initialize default state.
- * This function is called once at context init time from
- * r200InitState/r300InitState
- */
-void radeonInitState(radeonContextPtr radeon)
-{
- radeon->Fallback = 0;
-
- if (radeon->glCtx->Visual.doubleBufferMode && radeon->sarea->pfCurrentPage == 0) {
- radeon->state.color.drawOffset = radeon->radeonScreen->backOffset;
- radeon->state.color.drawPitch = radeon->radeonScreen->backPitch;
- } else {
- radeon->state.color.drawOffset = radeon->radeonScreen->frontOffset;
- radeon->state.color.drawPitch = radeon->radeonScreen->frontPitch;
- }
-
- radeon->state.pixel.readOffset = radeon->state.color.drawOffset;
- radeon->state.pixel.readPitch = radeon->state.color.drawPitch;
-}
-
-
-/**
- * Initialize common state functions.
- * Called by r200InitStateFuncs/r300InitStateFuncs
- */
-void radeonInitStateFuncs(struct dd_function_table *functions)
-{
- functions->Scissor = radeonScissor;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.h
deleted file mode 100644
index 636bf5d00..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/radeon_state.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-Copyright (C) 2004 Nicolai Haehnle. 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Nicolai Haehnle <prefect_@gmx.net>
- */
-
-#ifndef __RADEON_STATE_H__
-#define __RADEON_STATE_H__
-
-#include "radeon_context.h"
-
-extern void radeonRecalcScissorRects(radeonContextPtr radeon);
-extern void radeonSetCliprects(radeonContextPtr radeon, GLenum mode);
-extern void radeonUpdateScissor(GLcontext* ctx);
-
-extern void radeonEnable(GLcontext* ctx, GLenum cap, GLboolean state);
-
-extern void radeonInitState(radeonContextPtr radeon);
-extern void radeonInitStateFuncs(struct dd_function_table* functions);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/vertex_shader.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/vertex_shader.h
deleted file mode 100644
index 6293915bf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/r300/vertex_shader.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef __VERTEX_SHADER_H__
-#define __VERTEX_SHADER_H__
-
-#include "r300_reg.h"
-
-typedef struct {
- CARD32 op;
- CARD32 src1;
- CARD32 src2;
- CARD32 src3;
- } VERTEX_SHADER_INSTRUCTION;
-
-#define VSF_FLAG_X 1
-#define VSF_FLAG_Y 2
-#define VSF_FLAG_Z 4
-#define VSF_FLAG_W 8
-#define VSF_FLAG_XYZ (VSF_FLAG_X | VSF_FLAG_Y | VSF_FLAG_Z)
-#define VSF_FLAG_ALL 0xf
-#define VSF_FLAG_NONE 0
-
-#define VSF_OUT_CLASS_TMP 0
-#define VSF_OUT_CLASS_RESULT 2
-
-
-/* first CARD32 of an instruction */
-
-/* possible operations:
- DOT, MUL, ADD, MAD, FRC, MAX, MIN, SGE, SLT, EXP, LOG, LIT, POW, RCP, RSQ, EX2,
- LG2, MAD_2 */
-
-#define MAKE_VSF_OP(op, out_reg_index, out_reg_fields, class) \
- ((op) \
- | ((out_reg_index) << R300_VPI_OUT_REG_INDEX_SHIFT) \
- | ((out_reg_fields) << 20) \
- | ( (class) << 8 ) )
-
-#define EASY_VSF_OP(op, out_reg_index, out_reg_fields, class) \
- MAKE_VSF_OP(R300_VPI_OUT_OP_##op, out_reg_index, VSF_FLAG_##out_reg_fields, VSF_OUT_CLASS_##class) \
-
-/* according to Nikolai, the subsequent 3 CARD32 are sources, use same define for each */
-
-#define VSF_IN_CLASS_TMP 0
-#define VSF_IN_CLASS_ATTR 1
-#define VSF_IN_CLASS_PARAM 2
-#define VSF_IN_CLASS_NONE 9
-
-#define VSF_IN_COMPONENT_X 0
-#define VSF_IN_COMPONENT_Y 1
-#define VSF_IN_COMPONENT_Z 2
-#define VSF_IN_COMPONENT_W 3
-#define VSF_IN_COMPONENT_ZERO 4
-#define VSF_IN_COMPONENT_ONE 5
-
-#define MAKE_VSF_SOURCE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \
- ( ((in_reg_index)<<R300_VPI_IN_REG_INDEX_SHIFT) \
- | ((comp_x)<<R300_VPI_IN_X_SHIFT) \
- | ((comp_y)<<R300_VPI_IN_Y_SHIFT) \
- | ((comp_z)<<R300_VPI_IN_Z_SHIFT) \
- | ((comp_w)<<R300_VPI_IN_W_SHIFT) \
- | ((negate)<<25) | ((class)))
-
-#define EASY_VSF_SOURCE(in_reg_index, comp_x, comp_y, comp_z, comp_w, class, negate) \
- MAKE_VSF_SOURCE(in_reg_index, \
- VSF_IN_COMPONENT_##comp_x, \
- VSF_IN_COMPONENT_##comp_y, \
- VSF_IN_COMPONENT_##comp_z, \
- VSF_IN_COMPONENT_##comp_w, \
- VSF_IN_CLASS_##class, VSF_FLAG_##negate)
-
-/* special sources: */
-
-/* (1.0,1.0,1.0,1.0) vector (ATTR, plain ) */
-#define VSF_ATTR_UNITY(reg) EASY_VSF_SOURCE(reg, ONE, ONE, ONE, ONE, ATTR, NONE)
-#define VSF_UNITY(reg) EASY_VSF_SOURCE(reg, ONE, ONE, ONE, ONE, NONE, NONE)
-
-/* contents of unmodified register */
-#define VSF_REG(reg) EASY_VSF_SOURCE(reg, X, Y, Z, W, ATTR, NONE)
-
-/* contents of unmodified parameter */
-#define VSF_PARAM(reg) EASY_VSF_SOURCE(reg, X, Y, Z, W, PARAM, NONE)
-
-/* contents of unmodified temporary register */
-#define VSF_TMP(reg) EASY_VSF_SOURCE(reg, X, Y, Z, W, TMP, NONE)
-
-/* components of ATTR register */
-#define VSF_ATTR_X(reg) EASY_VSF_SOURCE(reg, X, X, X, X, ATTR, NONE)
-#define VSF_ATTR_Y(reg) EASY_VSF_SOURCE(reg, Y, Y, Y, Y, ATTR, NONE)
-#define VSF_ATTR_Z(reg) EASY_VSF_SOURCE(reg, Z, Z, Z, Z, ATTR, NONE)
-#define VSF_ATTR_W(reg) EASY_VSF_SOURCE(reg, W, W, W, W, ATTR, NONE)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/Makefile
deleted file mode 100644
index b0ef17299..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-# src/mesa/drivers/dri/radeon/Makefile
-# Note, this Makefile requires GNU make
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = radeon_dri.so
-
-MINIGLX_SOURCES = server/radeon_dri.c
-
-DRIVER_SOURCES = \
- radeon_context.c \
- radeon_ioctl.c \
- radeon_lock.c \
- radeon_screen.c \
- radeon_state.c \
- radeon_state_init.c \
- radeon_tex.c \
- radeon_texmem.c \
- radeon_texstate.c \
- radeon_tcl.c \
- radeon_swtcl.c \
- radeon_span.c \
- radeon_maos.c \
- radeon_sanity.c \
- radeon_compat.c \
- radeon_vtxfmt.c \
- radeon_vtxfmt_c.c \
- radeon_vtxfmt_sse.c \
- radeon_vtxfmt_x86.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-
-X86_SOURCES = \
- radeon_vtxtmp_x86.S
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_compat.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_compat.c
deleted file mode 100644
index 1cbe3407b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_compat.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Austin, 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
-on 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
-ATI, TUNGSTEN GRAPHICS 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-#include "imports.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-
-
-static struct {
- int start;
- int len;
- const char *name;
-} packet[RADEON_MAX_STATE_PACKETS] = {
- { RADEON_PP_MISC,7,"RADEON_PP_MISC" },
- { RADEON_PP_CNTL,3,"RADEON_PP_CNTL" },
- { RADEON_RB3D_COLORPITCH,1,"RADEON_RB3D_COLORPITCH" },
- { RADEON_RE_LINE_PATTERN,2,"RADEON_RE_LINE_PATTERN" },
- { RADEON_SE_LINE_WIDTH,1,"RADEON_SE_LINE_WIDTH" },
- { RADEON_PP_LUM_MATRIX,1,"RADEON_PP_LUM_MATRIX" },
- { RADEON_PP_ROT_MATRIX_0,2,"RADEON_PP_ROT_MATRIX_0" },
- { RADEON_RB3D_STENCILREFMASK,3,"RADEON_RB3D_STENCILREFMASK" },
- { RADEON_SE_VPORT_XSCALE,6,"RADEON_SE_VPORT_XSCALE" },
- { RADEON_SE_CNTL,2,"RADEON_SE_CNTL" },
- { RADEON_SE_CNTL_STATUS,1,"RADEON_SE_CNTL_STATUS" },
- { RADEON_RE_MISC,1,"RADEON_RE_MISC" },
- { RADEON_PP_TXFILTER_0,6,"RADEON_PP_TXFILTER_0" },
- { RADEON_PP_BORDER_COLOR_0,1,"RADEON_PP_BORDER_COLOR_0" },
- { RADEON_PP_TXFILTER_1,6,"RADEON_PP_TXFILTER_1" },
- { RADEON_PP_BORDER_COLOR_1,1,"RADEON_PP_BORDER_COLOR_1" },
- { RADEON_PP_TXFILTER_2,6,"RADEON_PP_TXFILTER_2" },
- { RADEON_PP_BORDER_COLOR_2,1,"RADEON_PP_BORDER_COLOR_2" },
- { RADEON_SE_ZBIAS_FACTOR,2,"RADEON_SE_ZBIAS_FACTOR" },
- { RADEON_SE_TCL_OUTPUT_VTX_FMT,11,"RADEON_SE_TCL_OUTPUT_VTX_FMT" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED,17,"RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED" },
-};
-
-
-static void radeonCompatEmitPacket( radeonContextPtr rmesa,
- struct radeon_state_atom *state )
-{
- drm_radeon_sarea_t *sarea = rmesa->sarea;
- drm_radeon_context_regs_t *ctx = &sarea->context_state;
- drm_radeon_texture_regs_t *tex0 = &sarea->tex_state[0];
- drm_radeon_texture_regs_t *tex1 = &sarea->tex_state[1];
- int i;
- int *buf = state->cmd;
-
- for ( i = 0 ; i < state->cmd_size ; ) {
- drm_radeon_cmd_header_t *header = (drm_radeon_cmd_header_t *)&buf[i++];
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d: %s\n", __FUNCTION__, header->packet.packet_id,
- packet[(int)header->packet.packet_id].name);
-
- switch (header->packet.packet_id) {
- case RADEON_EMIT_PP_MISC:
- ctx->pp_misc = buf[i++];
- ctx->pp_fog_color = buf[i++];
- ctx->re_solid_color = buf[i++];
- ctx->rb3d_blendcntl = buf[i++];
- ctx->rb3d_depthoffset = buf[i++];
- ctx->rb3d_depthpitch = buf[i++];
- ctx->rb3d_zstencilcntl = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_CONTEXT;
- break;
- case RADEON_EMIT_PP_CNTL:
- ctx->pp_cntl = buf[i++];
- ctx->rb3d_cntl = buf[i++];
- ctx->rb3d_coloroffset = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_CONTEXT;
- break;
- case RADEON_EMIT_RB3D_COLORPITCH:
- ctx->rb3d_colorpitch = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_CONTEXT;
- break;
- case RADEON_EMIT_RE_LINE_PATTERN:
- ctx->re_line_pattern = buf[i++];
- ctx->re_line_state = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_LINE;
- break;
- case RADEON_EMIT_SE_LINE_WIDTH:
- ctx->se_line_width = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_LINE;
- break;
- case RADEON_EMIT_PP_LUM_MATRIX:
- ctx->pp_lum_matrix = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_BUMPMAP;
- break;
- case RADEON_EMIT_PP_ROT_MATRIX_0:
- ctx->pp_rot_matrix_0 = buf[i++];
- ctx->pp_rot_matrix_1 = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_BUMPMAP;
- break;
- case RADEON_EMIT_RB3D_STENCILREFMASK:
- ctx->rb3d_stencilrefmask = buf[i++];
- ctx->rb3d_ropcntl = buf[i++];
- ctx->rb3d_planemask = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_MASKS;
- break;
- case RADEON_EMIT_SE_VPORT_XSCALE:
- ctx->se_vport_xscale = buf[i++];
- ctx->se_vport_xoffset = buf[i++];
- ctx->se_vport_yscale = buf[i++];
- ctx->se_vport_yoffset = buf[i++];
- ctx->se_vport_zscale = buf[i++];
- ctx->se_vport_zoffset = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_VIEWPORT;
- break;
- case RADEON_EMIT_SE_CNTL:
- ctx->se_cntl = buf[i++];
- ctx->se_coord_fmt = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_CONTEXT | RADEON_UPLOAD_VERTFMT;
- break;
- case RADEON_EMIT_SE_CNTL_STATUS:
- ctx->se_cntl_status = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_SETUP;
- break;
- case RADEON_EMIT_RE_MISC:
- ctx->re_misc = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_MISC;
- break;
- case RADEON_EMIT_PP_TXFILTER_0:
- tex0->pp_txfilter = buf[i++];
- tex0->pp_txformat = buf[i++];
- tex0->pp_txoffset = buf[i++];
- tex0->pp_txcblend = buf[i++];
- tex0->pp_txablend = buf[i++];
- tex0->pp_tfactor = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_TEX0;
- break;
- case RADEON_EMIT_PP_BORDER_COLOR_0:
- tex0->pp_border_color = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_TEX0;
- break;
- case RADEON_EMIT_PP_TXFILTER_1:
- tex1->pp_txfilter = buf[i++];
- tex1->pp_txformat = buf[i++];
- tex1->pp_txoffset = buf[i++];
- tex1->pp_txcblend = buf[i++];
- tex1->pp_txablend = buf[i++];
- tex1->pp_tfactor = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_TEX1;
- break;
- case RADEON_EMIT_PP_BORDER_COLOR_1:
- tex1->pp_border_color = buf[i++];
- sarea->dirty |= RADEON_UPLOAD_TEX1;
- break;
-
- case RADEON_EMIT_SE_ZBIAS_FACTOR:
- i++;
- i++;
- break;
-
- case RADEON_EMIT_PP_TXFILTER_2:
- case RADEON_EMIT_PP_BORDER_COLOR_2:
- case RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT:
- case RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED:
- default:
- /* These states aren't understood by radeon drm 1.1 */
- fprintf(stderr, "Tried to emit unsupported state\n");
- return;
- }
- }
-}
-
-
-
-static void radeonCompatEmitStateLocked( radeonContextPtr rmesa )
-{
- struct radeon_state_atom *atom;
-
- if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!rmesa->hw.is_dirty && !rmesa->hw.all_dirty)
- return;
-
- foreach(atom, &rmesa->hw.atomlist) {
- if (rmesa->hw.all_dirty)
- atom->dirty = GL_TRUE;
- if (atom->is_tcl)
- atom->dirty = GL_FALSE;
- if (atom->dirty)
- radeonCompatEmitPacket(rmesa, atom);
- }
-
- rmesa->hw.is_dirty = GL_FALSE;
- rmesa->hw.all_dirty = GL_FALSE;
-}
-
-
-static void radeonCompatEmitPrimitiveLocked( radeonContextPtr rmesa,
- GLuint hw_primitive,
- GLuint nverts,
- drm_clip_rect_t *pbox,
- GLuint nbox )
-{
- int i;
-
- for ( i = 0 ; i < nbox ; ) {
- int nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, nbox );
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- drm_radeon_vertex_t vtx;
-
- rmesa->sarea->dirty |= RADEON_UPLOAD_CLIPRECTS;
- rmesa->sarea->nbox = nr - i;
-
- for ( ; i < nr ; i++)
- *b++ = pbox[i];
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr,
- "RadeonFlushVertexBuffer: prim %x buf %d verts %d "
- "disc %d nbox %d\n",
- hw_primitive,
- rmesa->dma.current.buf->buf->idx,
- nverts,
- nr == nbox,
- rmesa->sarea->nbox );
-
- vtx.prim = hw_primitive;
- vtx.idx = rmesa->dma.current.buf->buf->idx;
- vtx.count = nverts;
- vtx.discard = (nr == nbox);
-
- drmCommandWrite( rmesa->dri.fd,
- DRM_RADEON_VERTEX,
- &vtx, sizeof(vtx));
- }
-}
-
-
-
-/* No 'start' for 1.1 vertices ioctl: only one vertex prim/buffer!
- */
-void radeonCompatEmitPrimitive( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint hw_primitive,
- GLuint nrverts )
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- LOCK_HARDWARE( rmesa );
-
- radeonCompatEmitStateLocked( rmesa );
- rmesa->sarea->vc_format = vertex_format;
-
- if (rmesa->state.scissor.enabled) {
- radeonCompatEmitPrimitiveLocked( rmesa,
- hw_primitive,
- nrverts,
- rmesa->state.scissor.pClipRects,
- rmesa->state.scissor.numClipRects );
- }
- else {
- radeonCompatEmitPrimitiveLocked( rmesa,
- hw_primitive,
- nrverts,
- rmesa->pClipRects,
- rmesa->numClipRects );
- }
-
-
- UNLOCK_HARDWARE( rmesa );
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c
deleted file mode 100644
index c96f38e0a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.c,v 1.9 2003/09/24 02:43:12 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#include "framebuffer.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_span.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_tcl.h"
-#include "radeon_vtxfmt.h"
-#include "radeon_maos.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_secondary_color
-#include "extension_helper.h"
-
-#define DRIVER_DATE "20050528"
-
-#include "vblank.h"
-#include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-#ifndef RADEON_DEBUG
-int RADEON_DEBUG = (0);
-#endif
-
-
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- LOCK_HARDWARE( rmesa );
- *width = rmesa->dri.drawable->w;
- *height = rmesa->dri.drawable->h;
- UNLOCK_HARDWARE( rmesa );
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- GLuint agp_mode = rmesa->radeonScreen->IsPCI ? 0 :
- rmesa->radeonScreen->AGPMode;
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Tungsten Graphics, Inc.";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer, "Radeon", DRIVER_DATE,
- agp_mode );
-
- sprintf( & buffer[ offset ], " %sTCL",
- !(rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)
- ? "" : "NO-" );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-
-/* Extension strings exported by the R100 driver.
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_texture_border_clamp", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_env_combine", NULL },
- { "GL_ARB_texture_env_crossbar", NULL },
- { "GL_ARB_texture_env_dot3", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_EXT_blend_logic_op", NULL },
- { "GL_EXT_blend_subtract", GL_EXT_blend_minmax_functions },
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_EXT_texture_env_combine", NULL },
- { "GL_EXT_texture_env_dot3", NULL },
- { "GL_EXT_texture_filter_anisotropic", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_EXT_texture_mirror_clamp", NULL },
- { "GL_ATI_texture_env_combine3", NULL },
- { "GL_ATI_texture_mirror_once", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
- { NULL, NULL }
-};
-
-extern const struct tnl_pipeline_stage _radeon_texrect_stage;
-extern const struct tnl_pipeline_stage _radeon_render_stage;
-extern const struct tnl_pipeline_stage _radeon_tcl_stage;
-
-static const struct tnl_pipeline_stage *radeon_pipeline[] = {
-
- /* Try and go straight to t&l
- */
- &_radeon_tcl_stage,
-
- /* Catch any t&l fallbacks
- */
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
-
- /* Scale texture rectangle to 0..1.
- */
- &_radeon_texrect_stage,
-
- &_radeon_render_stage,
- &_tnl_render_stage, /* FALLBACK: */
- NULL,
-};
-
-
-
-/* Initialize the driver's misc functions.
- */
-static void radeonInitDriverFuncs( struct dd_function_table *functions )
-{
- functions->GetBufferSize = radeonGetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = radeonGetString;
-}
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "code", DEBUG_CODEGEN },
- { "vfmt", DEBUG_VFMT },
- { "vtxf", DEBUG_VFMT },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { NULL, 0 }
-};
-
-
-/* Create the device specific context.
- */
-GLboolean
-radeonCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
- struct dd_function_table functions;
- radeonContextPtr rmesa;
- GLcontext *ctx, *shareCtx;
- int i;
- int tcl_mode, fthrottle_mode;
-
- assert(glVisual);
- assert(driContextPriv);
- assert(screen);
-
- /* Allocate the Radeon context */
- rmesa = (radeonContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
- return GL_FALSE;
-
- /* Parse configuration files.
- * Do this here so that initialMaxAnisotropy is set before we create
- * the default textures.
- */
- driParseConfigFiles (&rmesa->optionCache, &screen->optionCache,
- screen->driScreen->myNum, "radeon");
- rmesa->initialMaxAnisotropy = driQueryOptionf(&rmesa->optionCache,
- "def_max_anisotropy");
-
- if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) {
- if ( sPriv->drmMinor < 13 )
- fprintf( stderr, "DRM version 1.%d too old to support HyperZ, "
- "disabling.\n",sPriv->drmMinor );
- else
- rmesa->using_hyperz = GL_TRUE;
- }
-
- if ( sPriv->drmMinor >= 15 )
- rmesa->texmicrotile = GL_TRUE;
-
- /* Init default driver functions then plug in our Radeon-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions( &functions );
- radeonInitDriverFuncs( &functions );
- radeonInitTextureFuncs( &functions );
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((radeonContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- rmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
- &functions, (void *) rmesa);
- if (!rmesa->glCtx) {
- FREE(rmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = rmesa;
-
- /* Init radeon context data */
- rmesa->dri.context = driContextPriv;
- rmesa->dri.screen = sPriv;
- rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
- rmesa->dri.hwContext = driContextPriv->hHWContext;
- rmesa->dri.hwLock = &sPriv->pSAREA->lock;
- rmesa->dri.fd = sPriv->fd;
- rmesa->dri.drmMinor = sPriv->drmMinor;
-
- rmesa->radeonScreen = screen;
- rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA +
- screen->sarea_priv_offset);
-
-
- rmesa->dma.buf0_address = rmesa->radeonScreen->buffers->list[0].address;
-
- (void) memset( rmesa->texture_heaps, 0, sizeof( rmesa->texture_heaps ) );
- make_empty_list( & rmesa->swapped );
-
- rmesa->nr_heaps = screen->numTexHeaps;
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- rmesa->texture_heaps[i] = driCreateTextureHeap( i, rmesa,
- screen->texSize[i],
- 12,
- RADEON_NR_TEX_REGIONS,
- (drmTextureRegionPtr)rmesa->sarea->tex_list[i],
- & rmesa->sarea->tex_age[i],
- & rmesa->swapped,
- sizeof( radeonTexObj ),
- (destroy_texture_object_t *) radeonDestroyTexObj );
-
- driSetTextureSwapCounterLocation( rmesa->texture_heaps[i],
- & rmesa->c_textureSwaps );
- }
- rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache,
- "texture_depth");
- if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- rmesa->texture_depth = ( screen->cpp == 4 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->hw.all_dirty = GL_TRUE;
-
- /* Set the maximum texture size small enough that we can guarentee that
- * all texture units can bind a maximal texture and have them both in
- * texturable memory at once.
- */
-
- ctx = rmesa->glCtx;
- ctx->Const.MaxTextureUnits = 2;
- ctx->Const.MaxTextureImageUnits = 2;
- ctx->Const.MaxTextureCoordUnits = 2;
-
- driCalculateMaxTextureLevels( rmesa->texture_heaps,
- rmesa->nr_heaps,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported. */
- 0, /* cube textures unsupported. */
- 11, /* max rect texture size is 2048x2048. */
- 12,
- GL_FALSE );
-
- /* adjust max texture size a bit. Hack, but I really want to use larger textures
- which will work just fine in 99.999999% of all cases, especially with texture compression... */
- if (driQueryOptionb( &rmesa->optionCache, "texture_level_hack" ))
- {
- if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1;
- }
-
- ctx->Const.MaxTextureMaxAnisotropy = 16.0;
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 10.0;
- ctx->Const.MaxLineWidthAA = 10.0;
- ctx->Const.LineWidthGranularity = 0.0625;
-
- /* Set maxlocksize (and hence vb size) small enough to avoid
- * fallbacks in radeon_tcl.c. ie. guarentee that all vertices can
- * fit in a single dma buffer for indexed rendering of quad strips,
- * etc.
- */
- ctx->Const.MaxArrayLockSize =
- MIN2( ctx->Const.MaxArrayLockSize,
- RADEON_BUFFER_SIZE / RADEON_MAX_TCL_VERTSIZE );
-
- rmesa->boxes = 0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _ae_create_context( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, radeon_pipeline );
- ctx->Driver.FlushVertices = radeonFlushVertices;
-
- /* Try and keep materials and vertices separate:
- */
- _tnl_isolate_materials( ctx, GL_TRUE );
-
-/* _mesa_allow_light_in_model( ctx, GL_FALSE ); */
-
- /* Configure swrast and T&L 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 );
-
-
- _math_matrix_ctr( &rmesa->TexGenMatrix[0] );
- _math_matrix_ctr( &rmesa->TexGenMatrix[1] );
- _math_matrix_ctr( &rmesa->tmpmat );
- _math_matrix_set_identity( &rmesa->TexGenMatrix[0] );
- _math_matrix_set_identity( &rmesa->TexGenMatrix[1] );
- _math_matrix_set_identity( &rmesa->tmpmat );
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- if (rmesa->glCtx->Mesa_DXTn) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- _mesa_enable_extension( ctx, "GL_S3_s3tc" );
- }
- else if (driQueryOptionb (&rmesa->optionCache, "force_s3tc_enable")) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- }
-
- if (rmesa->dri.drmMinor >= 9)
- _mesa_enable_extension( ctx, "GL_NV_texture_rectangle");
-
- /* XXX these should really go right after _mesa_init_driver_functions() */
- radeonInitIoctlFuncs( ctx );
- radeonInitStateFuncs( ctx );
- radeonInitSpanFuncs( ctx );
- radeonInitState( rmesa );
- radeonInitSwtcl( ctx );
-
- _mesa_vector4f_alloc( &rmesa->tcl.ObjClean, 0,
- ctx->Const.MaxArrayLockSize, 32 );
-
- fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode");
- rmesa->iw.irq_seq = -1;
- rmesa->irqsEmitted = 0;
- rmesa->do_irqs = (rmesa->radeonScreen->irq != 0 &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS);
-
- rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
-
- rmesa->vblank_flags = (rmesa->radeonScreen->irq != 0)
- ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- (*dri_interface->getUST)( & rmesa->swap_ust );
-
-
-#if DO_DEBUG
- RADEON_DEBUG = driParseDebugString( getenv( "RADEON_DEBUG" ),
- debug_control );
-#endif
-
- tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (driQueryOptionb(&rmesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(rmesa, RADEON_FALLBACK_DISABLE, 1);
- } else if (tcl_mode == DRI_CONF_TCL_SW ||
- !(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)) {
- if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) {
- rmesa->radeonScreen->chipset &= ~RADEON_CHIPSET_TCL;
- fprintf(stderr, "Disabling HW TCL support\n");
- }
- TCL_FALLBACK(rmesa->glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
- }
-
- if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) {
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
- radeonVtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
-
- _tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
- }
- return GL_TRUE;
-}
-
-
-/* Destroy the device specific context.
- */
-/* Destroy the Mesa and driver specific context data.
- */
-void radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = (radeonContextPtr) driContextPriv->driverPrivate;
- radeonContextPtr current = ctx ? RADEON_CONTEXT(ctx) : NULL;
-
- /* check if we're deleting the currently bound context */
- if (rmesa == current) {
- RADEON_FIREVERTICES( rmesa );
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- /* Free radeon context resources */
- assert(rmesa); /* should never be null */
- if ( rmesa ) {
- GLboolean release_texture_heaps;
-
-
- release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
- _swsetup_DestroyContext( rmesa->glCtx );
- _tnl_DestroyContext( rmesa->glCtx );
- _ac_DestroyContext( rmesa->glCtx );
- _swrast_DestroyContext( rmesa->glCtx );
-
- radeonDestroySwtcl( rmesa->glCtx );
- radeonReleaseArrays( rmesa->glCtx, ~0 );
- if (rmesa->dma.current.buf) {
- radeonReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
- }
-
- if (!(rmesa->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)) {
- int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
- if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
- radeonVtxfmtDestroy( rmesa->glCtx );
- }
-
- /* free the Mesa context */
- rmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context( rmesa->glCtx );
-
- _mesa_vector4f_free( &rmesa->tcl.ObjClean );
-
- if (rmesa->state.scissor.pClipRects) {
- FREE(rmesa->state.scissor.pClipRects);
- rmesa->state.scissor.pClipRects = NULL;
- }
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- int i;
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- driDestroyTextureHeap( rmesa->texture_heaps[ i ] );
- rmesa->texture_heaps[ i ] = NULL;
- }
-
- assert( is_empty_list( & rmesa->swapped ) );
- }
-
- /* free the option cache */
- driDestroyOptionCache (&rmesa->optionCache);
-
- FREE( rmesa );
- }
-}
-
-
-
-
-void
-radeonSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
-
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- radeonContextPtr rmesa;
- GLcontext *ctx;
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = rmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
-
- if ( rmesa->doPageFlip ) {
- radeonPageFlip( dPriv );
- }
- else {
- radeonCopyBuffer( dPriv );
- }
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-GLboolean
-radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- radeonContextPtr newCtx =
- (radeonContextPtr) driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *) newCtx->glCtx);
-
- if ( newCtx->dri.drawable != driDrawPriv ) {
- driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
- newCtx->dri.drawable = driDrawPriv;
- radeonUpdateWindow( newCtx->glCtx );
- radeonUpdateViewportOffset( newCtx->glCtx );
- }
-
- _mesa_make_current( newCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if (newCtx->vb.enabled)
- radeonVtxfmtMakeCurrent( newCtx->glCtx );
-
- } else {
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "End %s\n", __FUNCTION__);
- return GL_TRUE;
-}
-
-/* Force the context `c' to be unbound from its buffer.
- */
-GLboolean
-radeonUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- radeonContextPtr rmesa = (radeonContextPtr) driContextPriv->driverPrivate;
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *) rmesa->glCtx);
-
- return GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.h
deleted file mode 100644
index 621a4c655..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.h
+++ /dev/null
@@ -1,868 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_context.h,v 1.6 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_CONTEXT_H__
-#define __RADEON_CONTEXT_H__
-
-#include "tnl/t_vertex.h"
-#include "dri_util.h"
-#include "drm.h"
-#include "radeon_drm.h"
-#include "texmem.h"
-
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-struct radeon_context;
-typedef struct radeon_context radeonContextRec;
-typedef struct radeon_context *radeonContextPtr;
-
-#include "radeon_lock.h"
-#include "radeon_screen.h"
-#include "mm.h"
-
-#include "math/m_vector.h"
-
-/* Flags for software fallback cases */
-/* See correponding strings in radeon_swtcl.c */
-#define RADEON_FALLBACK_TEXTURE 0x0001
-#define RADEON_FALLBACK_DRAW_BUFFER 0x0002
-#define RADEON_FALLBACK_STENCIL 0x0004
-#define RADEON_FALLBACK_RENDER_MODE 0x0008
-#define RADEON_FALLBACK_BLEND_EQ 0x0010
-#define RADEON_FALLBACK_BLEND_FUNC 0x0020
-#define RADEON_FALLBACK_DISABLE 0x0040
-#define RADEON_FALLBACK_BORDER_MODE 0x0080
-
-/* The blit width for texture uploads
- */
-#define BLIT_WIDTH_BYTES 1024
-
-/* Use the templated vertex format:
- */
-#define COLOR_IS_RGBA
-#define TAG(x) radeon##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*radeon_tri_func)( radeonContextPtr,
- radeonVertex *,
- radeonVertex *,
- radeonVertex * );
-
-typedef void (*radeon_line_func)( radeonContextPtr,
- radeonVertex *,
- radeonVertex * );
-
-typedef void (*radeon_point_func)( radeonContextPtr,
- radeonVertex * );
-
-
-struct radeon_colorbuffer_state {
- GLuint clear;
- GLint drawOffset, drawPitch;
- int roundEnable;
-};
-
-
-struct radeon_depthbuffer_state {
- GLuint clear;
- GLfloat scale;
-};
-
-struct radeon_pixel_state {
- GLint readOffset, readPitch;
-};
-
-struct radeon_scissor_state {
- drm_clip_rect_t rect;
- GLboolean enabled;
-
- GLuint numClipRects; /* Cliprects active */
- GLuint numAllocedClipRects; /* Cliprects available */
- drm_clip_rect_t *pClipRects;
-};
-
-struct radeon_stencilbuffer_state {
- GLboolean hwBuffer;
- GLuint clear; /* rb3d_stencilrefmask value */
-};
-
-struct radeon_stipple_state {
- GLuint mask[32];
-};
-
-
-
-#define TEX_0 0x1
-#define TEX_1 0x2
-#define TEX_ALL 0x3
-
-typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr;
-
-/* Texture object in locally shared texture space.
- */
-struct radeon_tex_obj {
- driTextureObject base;
-
- GLuint bufAddr; /* Offset to start of locally
- shared texture block */
-
- GLuint dirty_state; /* Flags (1 per texunit) for
- whether or not this texobj
- has dirty hardware state
- (pp_*) that needs to be
- brought into the
- texunit. */
-
- drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
- /* Six, for the cube faces */
-
- GLuint pp_txfilter; /* hardware register values */
- GLuint pp_txformat;
- GLuint pp_txoffset; /* Image location in texmem.
- All cube faces follow. */
- GLuint pp_txsize; /* npot only */
- GLuint pp_txpitch; /* npot only */
- GLuint pp_border_color;
- GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
-
- GLboolean border_fallback;
-
- GLuint tile_bits; /* hw texture tile bits used on this texture */
-};
-
-
-struct radeon_texture_env_state {
- radeonTexObjPtr texobj;
- GLenum format;
- GLenum envMode;
-};
-
-struct radeon_texture_state {
- struct radeon_texture_env_state unit[RADEON_MAX_TEXTURE_UNITS];
-};
-
-
-struct radeon_state_atom {
- struct radeon_state_atom *next, *prev;
- const char *name; /* for debug */
- int cmd_size; /* size in bytes */
- GLuint is_tcl;
- int *cmd; /* one or more cmd's */
- int *lastcmd; /* one or more cmd's */
- GLboolean dirty; /* dirty-mark in emit_state_list */
- GLboolean (*check)( GLcontext * ); /* is this state active? */
-};
-
-
-
-/* Trying to keep these relatively short as the variables are becoming
- * extravagently long. Drop the driver name prefix off the front of
- * everything - I think we know which driver we're in by now, and keep the
- * prefix to 3 letters unless absolutely impossible.
- */
-
-#define CTX_CMD_0 0
-#define CTX_PP_MISC 1
-#define CTX_PP_FOG_COLOR 2
-#define CTX_RE_SOLID_COLOR 3
-#define CTX_RB3D_BLENDCNTL 4
-#define CTX_RB3D_DEPTHOFFSET 5
-#define CTX_RB3D_DEPTHPITCH 6
-#define CTX_RB3D_ZSTENCILCNTL 7
-#define CTX_CMD_1 8
-#define CTX_PP_CNTL 9
-#define CTX_RB3D_CNTL 10
-#define CTX_RB3D_COLOROFFSET 11
-#define CTX_CMD_2 12
-#define CTX_RB3D_COLORPITCH 13
-#define CTX_STATE_SIZE 14
-
-#define SET_CMD_0 0
-#define SET_SE_CNTL 1
-#define SET_SE_COORDFMT 2
-#define SET_CMD_1 3
-#define SET_SE_CNTL_STATUS 4
-#define SET_STATE_SIZE 5
-
-#define LIN_CMD_0 0
-#define LIN_RE_LINE_PATTERN 1
-#define LIN_RE_LINE_STATE 2
-#define LIN_CMD_1 3
-#define LIN_SE_LINE_WIDTH 4
-#define LIN_STATE_SIZE 5
-
-#define MSK_CMD_0 0
-#define MSK_RB3D_STENCILREFMASK 1
-#define MSK_RB3D_ROPCNTL 2
-#define MSK_RB3D_PLANEMASK 3
-#define MSK_STATE_SIZE 4
-
-#define VPT_CMD_0 0
-#define VPT_SE_VPORT_XSCALE 1
-#define VPT_SE_VPORT_XOFFSET 2
-#define VPT_SE_VPORT_YSCALE 3
-#define VPT_SE_VPORT_YOFFSET 4
-#define VPT_SE_VPORT_ZSCALE 5
-#define VPT_SE_VPORT_ZOFFSET 6
-#define VPT_STATE_SIZE 7
-
-#define MSC_CMD_0 0
-#define MSC_RE_MISC 1
-#define MSC_STATE_SIZE 2
-
-#define TEX_CMD_0 0
-#define TEX_PP_TXFILTER 1
-#define TEX_PP_TXFORMAT 2
-#define TEX_PP_TXOFFSET 3
-#define TEX_PP_TXCBLEND 4
-#define TEX_PP_TXABLEND 5
-#define TEX_PP_TFACTOR 6
-#define TEX_CMD_1 7
-#define TEX_PP_BORDER_COLOR 8
-#define TEX_STATE_SIZE 9
-
-#define TXR_CMD_0 0 /* rectangle textures */
-#define TXR_PP_TEX_SIZE 1 /* 0x1d04, 0x1d0c for NPOT! */
-#define TXR_PP_TEX_PITCH 2 /* 0x1d08, 0x1d10 for NPOT! */
-#define TXR_STATE_SIZE 3
-
-#define ZBS_CMD_0 0
-#define ZBS_SE_ZBIAS_FACTOR 1
-#define ZBS_SE_ZBIAS_CONSTANT 2
-#define ZBS_STATE_SIZE 3
-
-#define TCL_CMD_0 0
-#define TCL_OUTPUT_VTXFMT 1
-#define TCL_OUTPUT_VTXSEL 2
-#define TCL_MATRIX_SELECT_0 3
-#define TCL_MATRIX_SELECT_1 4
-#define TCL_UCP_VERT_BLEND_CTL 5
-#define TCL_TEXTURE_PROC_CTL 6
-#define TCL_LIGHT_MODEL_CTL 7
-#define TCL_PER_LIGHT_CTL_0 8
-#define TCL_PER_LIGHT_CTL_1 9
-#define TCL_PER_LIGHT_CTL_2 10
-#define TCL_PER_LIGHT_CTL_3 11
-#define TCL_STATE_SIZE 12
-
-#define MTL_CMD_0 0
-#define MTL_EMMISSIVE_RED 1
-#define MTL_EMMISSIVE_GREEN 2
-#define MTL_EMMISSIVE_BLUE 3
-#define MTL_EMMISSIVE_ALPHA 4
-#define MTL_AMBIENT_RED 5
-#define MTL_AMBIENT_GREEN 6
-#define MTL_AMBIENT_BLUE 7
-#define MTL_AMBIENT_ALPHA 8
-#define MTL_DIFFUSE_RED 9
-#define MTL_DIFFUSE_GREEN 10
-#define MTL_DIFFUSE_BLUE 11
-#define MTL_DIFFUSE_ALPHA 12
-#define MTL_SPECULAR_RED 13
-#define MTL_SPECULAR_GREEN 14
-#define MTL_SPECULAR_BLUE 15
-#define MTL_SPECULAR_ALPHA 16
-#define MTL_SHININESS 17
-#define MTL_STATE_SIZE 18
-
-#define VTX_CMD_0 0
-#define VTX_SE_COORD_FMT 1
-#define VTX_STATE_SIZE 2
-
-#define MAT_CMD_0 0
-#define MAT_ELT_0 1
-#define MAT_STATE_SIZE 17
-
-#define GRD_CMD_0 0
-#define GRD_VERT_GUARD_CLIP_ADJ 1
-#define GRD_VERT_GUARD_DISCARD_ADJ 2
-#define GRD_HORZ_GUARD_CLIP_ADJ 3
-#define GRD_HORZ_GUARD_DISCARD_ADJ 4
-#define GRD_STATE_SIZE 5
-
-/* position changes frequently when lighting in modelpos - separate
- * out to new state item?
- */
-#define LIT_CMD_0 0
-#define LIT_AMBIENT_RED 1
-#define LIT_AMBIENT_GREEN 2
-#define LIT_AMBIENT_BLUE 3
-#define LIT_AMBIENT_ALPHA 4
-#define LIT_DIFFUSE_RED 5
-#define LIT_DIFFUSE_GREEN 6
-#define LIT_DIFFUSE_BLUE 7
-#define LIT_DIFFUSE_ALPHA 8
-#define LIT_SPECULAR_RED 9
-#define LIT_SPECULAR_GREEN 10
-#define LIT_SPECULAR_BLUE 11
-#define LIT_SPECULAR_ALPHA 12
-#define LIT_POSITION_X 13
-#define LIT_POSITION_Y 14
-#define LIT_POSITION_Z 15
-#define LIT_POSITION_W 16
-#define LIT_DIRECTION_X 17
-#define LIT_DIRECTION_Y 18
-#define LIT_DIRECTION_Z 19
-#define LIT_DIRECTION_W 20
-#define LIT_ATTEN_QUADRATIC 21
-#define LIT_ATTEN_LINEAR 22
-#define LIT_ATTEN_CONST 23
-#define LIT_ATTEN_XXX 24
-#define LIT_CMD_1 25
-#define LIT_SPOT_DCD 26
-#define LIT_SPOT_EXPONENT 27
-#define LIT_SPOT_CUTOFF 28
-#define LIT_SPECULAR_THRESH 29
-#define LIT_RANGE_CUTOFF 30 /* ? */
-#define LIT_ATTEN_CONST_INV 31
-#define LIT_STATE_SIZE 32
-
-/* Fog
- */
-#define FOG_CMD_0 0
-#define FOG_R 1
-#define FOG_C 2
-#define FOG_D 3
-#define FOG_PAD 4
-#define FOG_STATE_SIZE 5
-
-/* UCP
- */
-#define UCP_CMD_0 0
-#define UCP_X 1
-#define UCP_Y 2
-#define UCP_Z 3
-#define UCP_W 4
-#define UCP_STATE_SIZE 5
-
-/* GLT - Global ambient
- */
-#define GLT_CMD_0 0
-#define GLT_RED 1
-#define GLT_GREEN 2
-#define GLT_BLUE 3
-#define GLT_ALPHA 4
-#define GLT_STATE_SIZE 5
-
-/* EYE
- */
-#define EYE_CMD_0 0
-#define EYE_X 1
-#define EYE_Y 2
-#define EYE_Z 3
-#define EYE_RESCALE_FACTOR 4
-#define EYE_STATE_SIZE 5
-
-#define SHN_CMD_0 0
-#define SHN_SHININESS 1
-#define SHN_STATE_SIZE 2
-
-
-
-
-
-struct radeon_hw_state {
- /* Head of the linked list of state atoms. */
- struct radeon_state_atom atomlist;
-
- /* Hardware state, stored as cmdbuf commands:
- * -- Need to doublebuffer for
- * - eliding noop statechange loops? (except line stipple count)
- */
- struct radeon_state_atom ctx;
- struct radeon_state_atom set;
- struct radeon_state_atom lin;
- struct radeon_state_atom msk;
- struct radeon_state_atom vpt;
- struct radeon_state_atom tcl;
- struct radeon_state_atom msc;
- struct radeon_state_atom tex[2];
- struct radeon_state_atom zbs;
- struct radeon_state_atom mtl;
- struct radeon_state_atom mat[5];
- struct radeon_state_atom lit[8]; /* includes vec, scl commands */
- struct radeon_state_atom ucp[6];
- struct radeon_state_atom eye; /* eye pos */
- struct radeon_state_atom grd; /* guard band clipping */
- struct radeon_state_atom fog;
- struct radeon_state_atom glt;
- struct radeon_state_atom txr[2]; /* for NPOT */
-
- int max_state_size; /* Number of bytes necessary for a full state emit. */
- GLboolean is_dirty, all_dirty;
-};
-
-struct radeon_state {
- /* Derived state for internal purposes:
- */
- struct radeon_colorbuffer_state color;
- struct radeon_depthbuffer_state depth;
- struct radeon_pixel_state pixel;
- struct radeon_scissor_state scissor;
- struct radeon_stencilbuffer_state stencil;
- struct radeon_stipple_state stipple;
- struct radeon_texture_state texture;
-};
-
-
-/* Need refcounting on dma buffers:
- */
-struct radeon_dma_buffer {
- int refcount; /* the number of retained regions in buf */
- drmBufPtr buf;
-};
-
-#define GET_START(rvb) (rmesa->radeonScreen->gart_buffer_offset + \
- (rvb)->address - rmesa->dma.buf0_address + \
- (rvb)->start)
-
-/* A retained region, eg vertices for indexed vertices.
- */
-struct radeon_dma_region {
- struct radeon_dma_buffer *buf;
- char *address; /* == buf->address */
- int start, end, ptr; /* offsets from start of buf */
- int aos_start;
- int aos_stride;
- int aos_size;
-};
-
-
-struct radeon_dma {
- /* Active dma region. Allocations for vertices and retained
- * regions come from here. Also used for emitting random vertices,
- * these may be flushed by calling flush_current();
- */
- struct radeon_dma_region current;
-
- void (*flush)( radeonContextPtr );
-
- char *buf0_address; /* start of buf[0], for index calcs */
- GLuint nr_released_bufs; /* flush after so many buffers released */
-};
-
-struct radeon_dri_mirror {
- __DRIcontextPrivate *context; /* DRI context */
- __DRIscreenPrivate *screen; /* DRI screen */
- __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
-
- drm_context_t hwContext;
- drm_hw_lock_t *hwLock;
- int fd;
- int drmMinor;
-};
-
-
-#define RADEON_CMD_BUF_SZ (8*1024)
-
-struct radeon_store {
- GLuint statenr;
- GLuint primnr;
- char cmd_buf[RADEON_CMD_BUF_SZ];
- int cmd_used;
- int elts_start;
-};
-
-
-/* radeon_tcl.c
- */
-struct radeon_tcl_info {
- GLuint vertex_format;
- GLint last_offset;
- GLuint hw_primitive;
-
- /* Temporary for cases where incoming vertex data is incompatible
- * with maos code.
- */
- GLvector4f ObjClean;
-
- struct radeon_dma_region *aos_components[8];
- GLuint nr_aos_components;
-
- GLuint *Elts;
-
- struct radeon_dma_region indexed_verts;
- struct radeon_dma_region obj;
- struct radeon_dma_region rgba;
- struct radeon_dma_region spec;
- struct radeon_dma_region fog;
- struct radeon_dma_region tex[RADEON_MAX_TEXTURE_UNITS];
- struct radeon_dma_region norm;
-};
-
-
-/* radeon_swtcl.c
- */
-struct radeon_swtcl_info {
- GLuint RenderIndex;
- GLuint vertex_size;
- GLuint vertex_format;
-
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
-
- GLubyte *verts;
-
- /* Fallback rasterization functions
- */
- radeon_point_func draw_point;
- radeon_line_func draw_line;
- radeon_tri_func draw_tri;
-
- GLuint hw_primitive;
- GLenum render_primitive;
- GLuint numverts;
-
- /**
- * Offset of the 4UB color data within a hardware (swtcl) vertex.
- */
- GLuint coloroffset;
-
- /**
- * Offset of the 3UB specular color data within a hardware (swtcl) vertex.
- */
- GLuint specoffset;
-
- GLboolean needproj;
-
- struct radeon_dma_region indexed_verts;
-};
-
-
-struct radeon_ioctl {
- GLuint vertex_offset;
- GLuint vertex_size;
-};
-
-
-
-#define RADEON_MAX_PRIMS 64
-
-
-/* Want to keep a cache of these around. Each is parameterized by
- * only a single value which has only a small range. Only expect a
- * few, so just rescan the list each time?
- */
-struct dynfn {
- struct dynfn *next, *prev;
- int key;
- char *code;
-};
-
-struct dfn_lists {
- struct dynfn Vertex2f;
- struct dynfn Vertex2fv;
- struct dynfn Vertex3f;
- struct dynfn Vertex3fv;
- struct dynfn Color4ub;
- struct dynfn Color4ubv;
- struct dynfn Color3ub;
- struct dynfn Color3ubv;
- struct dynfn Color4f;
- struct dynfn Color4fv;
- struct dynfn Color3f;
- struct dynfn Color3fv;
- struct dynfn SecondaryColor3ubEXT;
- struct dynfn SecondaryColor3ubvEXT;
- struct dynfn SecondaryColor3fEXT;
- struct dynfn SecondaryColor3fvEXT;
- struct dynfn Normal3f;
- struct dynfn Normal3fv;
- struct dynfn TexCoord2f;
- struct dynfn TexCoord2fv;
- struct dynfn TexCoord1f;
- struct dynfn TexCoord1fv;
- struct dynfn MultiTexCoord2fARB;
- struct dynfn MultiTexCoord2fvARB;
- struct dynfn MultiTexCoord1fARB;
- struct dynfn MultiTexCoord1fvARB;
-};
-
-struct dfn_generators {
- struct dynfn *(*Vertex2f)( GLcontext *, int );
- struct dynfn *(*Vertex2fv)( GLcontext *, int );
- struct dynfn *(*Vertex3f)( GLcontext *, int );
- struct dynfn *(*Vertex3fv)( GLcontext *, int );
- struct dynfn *(*Color4ub)( GLcontext *, int );
- struct dynfn *(*Color4ubv)( GLcontext *, int );
- struct dynfn *(*Color3ub)( GLcontext *, int );
- struct dynfn *(*Color3ubv)( GLcontext *, int );
- struct dynfn *(*Color4f)( GLcontext *, int );
- struct dynfn *(*Color4fv)( GLcontext *, int );
- struct dynfn *(*Color3f)( GLcontext *, int );
- struct dynfn *(*Color3fv)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3ubEXT)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3ubvEXT)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3fEXT)( GLcontext *, int );
- struct dynfn *(*SecondaryColor3fvEXT)( GLcontext *, int );
- struct dynfn *(*Normal3f)( GLcontext *, int );
- struct dynfn *(*Normal3fv)( GLcontext *, int );
- struct dynfn *(*TexCoord2f)( GLcontext *, int );
- struct dynfn *(*TexCoord2fv)( GLcontext *, int );
- struct dynfn *(*TexCoord1f)( GLcontext *, int );
- struct dynfn *(*TexCoord1fv)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord2fARB)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord2fvARB)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord1fARB)( GLcontext *, int );
- struct dynfn *(*MultiTexCoord1fvARB)( GLcontext *, int );
-};
-
-
-
-struct radeon_prim {
- GLuint start;
- GLuint end;
- GLuint prim;
-};
-
-struct radeon_vbinfo {
- GLint counter, initial_counter;
- GLint *dmaptr;
- void (*notify)( void );
- GLint vertex_size;
-
- /* A maximum total of 15 elements per vertex: 3 floats for position, 3
- * floats for normal, 4 floats for color, 4 bytes for secondary color,
- * 2 floats for each texture unit (4 floats total).
- *
- * As soon as the 3rd TMU is supported or cube maps (or 3D textures) are
- * supported, this value will grow.
- *
- * The position data is never actually stored here, so 3 elements could be
- * trimmed out of the buffer.
- */
- union { float f; int i; radeon_color_t color; } vertex[15];
-
- GLfloat *normalptr;
- GLfloat *floatcolorptr;
- radeon_color_t *colorptr;
- GLfloat *floatspecptr;
- radeon_color_t *specptr;
- GLfloat *texcoordptr[2];
-
- GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */
- GLuint primflags;
- GLboolean enabled; /* *_NO_VTXFMT / *_NO_TCL env vars */
- GLboolean installed;
- GLboolean fell_back;
- GLboolean recheck;
- GLint nrverts;
- GLuint vertex_format;
-
- GLuint installed_vertex_format;
- GLuint installed_color_3f_sz;
-
- struct radeon_prim primlist[RADEON_MAX_PRIMS];
- int nrprims;
-
- struct dfn_lists dfn_cache;
- struct dfn_generators codegen;
- GLvertexformat vtxfmt;
-};
-
-
-
-
-struct radeon_context {
- GLcontext *glCtx; /* Mesa context */
-
- /* Driver and hardware state management
- */
- struct radeon_hw_state hw;
- struct radeon_state state;
-
- /* Texture object bookkeeping
- */
- unsigned nr_heaps;
- driTexHeap * texture_heaps[ RADEON_NR_TEX_HEAPS ];
- driTextureObject swapped;
- int texture_depth;
- float initialMaxAnisotropy;
-
- /* Rasterization and vertex state:
- */
- GLuint TclFallback;
- GLuint Fallback;
- GLuint NewGLState;
- GLuint tnl_index; /* index of bits for last tnl_install_attrs */
-
- /* Vertex buffers
- */
- struct radeon_ioctl ioctl;
- struct radeon_dma dma;
- struct radeon_store store;
- /* A full state emit as of the first state emit in the main store, in case
- * the context is lost.
- */
- struct radeon_store backup_store;
-
- /* Page flipping
- */
- GLuint doPageFlip;
-
- /* Busy waiting
- */
- GLuint do_usleeps;
- GLuint do_irqs;
- GLuint irqsEmitted;
- drm_radeon_irq_wait_t iw;
-
- /* Drawable, cliprect and scissor information
- */
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
- unsigned int lastStamp;
- GLboolean lost_context;
- GLboolean save_on_next_emit;
- radeonScreenPtr radeonScreen; /* Screen private DRI data */
- drm_radeon_sarea_t *sarea; /* Private SAREA data */
-
- /* TCL stuff
- */
- GLmatrix TexGenMatrix[RADEON_MAX_TEXTURE_UNITS];
- GLboolean recheck_texgen[RADEON_MAX_TEXTURE_UNITS];
- GLboolean TexGenNeedNormals[RADEON_MAX_TEXTURE_UNITS];
- GLuint TexMatEnabled;
- GLuint TexGenEnabled;
- GLmatrix tmpmat;
- GLuint last_ReallyEnabled;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- int64_t swap_ust;
- int64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
-
- /* radeon_tcl.c
- */
- struct radeon_tcl_info tcl;
-
- /* radeon_swtcl.c
- */
- struct radeon_swtcl_info swtcl;
-
- /* radeon_vtxfmt.c
- */
- struct radeon_vbinfo vb;
-
- /* Mirrors of some DRI state
- */
- struct radeon_dri_mirror dri;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-
- GLboolean using_hyperz;
- GLboolean texmicrotile;
-
- /* Performance counters
- */
- GLuint boxes; /* Draw performance boxes */
- GLuint hardwareWentIdle;
- GLuint c_clears;
- GLuint c_drawWaits;
- GLuint c_textureSwaps;
- GLuint c_textureBytes;
- GLuint c_vertexBuffers;
-};
-
-#define RADEON_CONTEXT(ctx) ((radeonContextPtr)(ctx->DriverCtx))
-
-
-static __inline GLuint radeonPackColor( 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 RADEON_OLD_PACKETS 1
-
-
-extern void radeonDestroyContext( __DRIcontextPrivate *driContextPriv );
-extern GLboolean radeonCreateContext(const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-extern void radeonSwapBuffers( __DRIdrawablePrivate *dPriv );
-extern GLboolean radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-extern GLboolean radeonUnbindContext( __DRIcontextPrivate *driContextPriv );
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-
-#if DO_DEBUG
-extern int RADEON_DEBUG;
-#else
-#define RADEON_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x001
-#define DEBUG_STATE 0x002
-#define DEBUG_IOCTL 0x004
-#define DEBUG_PRIMS 0x008
-#define DEBUG_VERTS 0x010
-#define DEBUG_FALLBACKS 0x020
-#define DEBUG_VFMT 0x040
-#define DEBUG_CODEGEN 0x080
-#define DEBUG_VERBOSE 0x100
-#define DEBUG_DRI 0x200
-#define DEBUG_DMA 0x400
-#define DEBUG_SANITY 0x800
-#define DEBUG_SYNC 0x1000
-
-#endif /* __RADEON_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.c
deleted file mode 100644
index 53c5d5ca5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.c
+++ /dev/null
@@ -1,1283 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.11 2003/01/29 22:04:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include <sched.h>
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "swrast/swrast.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tcl.h"
-#include "radeon_sanity.h"
-
-#define STANDALONE_MMIO
-#include "radeon_macros.h" /* for INREG() */
-
-#include "vblank.h"
-
-#define RADEON_TIMEOUT 512
-#define RADEON_IDLE_RETRY 16
-
-
-static void radeonWaitForIdle( radeonContextPtr rmesa );
-static int radeonFlushCmdBufLocked( radeonContextPtr rmesa,
- const char * caller );
-
-static void print_state_atom( struct radeon_state_atom *state )
-{
- int i;
-
- fprintf(stderr, "emit %s/%d\n", state->name, state->cmd_size);
-
- if (RADEON_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < state->cmd_size ; i++)
- fprintf(stderr, "\t%s[%d]: %x\n", state->name, i, state->cmd[i]);
-
-}
-
-static void radeonSaveHwState( radeonContextPtr rmesa )
-{
- struct radeon_state_atom *atom;
- char * dest = rmesa->backup_store.cmd_buf;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- rmesa->backup_store.cmd_used = 0;
-
- foreach( atom, &rmesa->hw.atomlist ) {
- if ( atom->check( rmesa->glCtx ) ) {
- int size = atom->cmd_size * 4;
- memcpy( dest, atom->cmd, size);
- dest += size;
- rmesa->backup_store.cmd_used += size;
- if (RADEON_DEBUG & DEBUG_STATE)
- print_state_atom( atom );
- }
- }
-
- assert( rmesa->backup_store.cmd_used <= RADEON_CMD_BUF_SZ );
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "Returning to radeonEmitState\n");
-}
-
-/* At this point we were in FlushCmdBufLocked but we had lost our context, so
- * we need to unwire our current cmdbuf, hook the one with the saved state in
- * it, flush it, and then put the current one back. This is so commands at the
- * start of a cmdbuf can rely on the state being kept from the previous one.
- */
-static void radeonBackUpAndEmitLostStateLocked( radeonContextPtr rmesa )
-{
- GLuint nr_released_bufs;
- struct radeon_store saved_store;
-
- if (rmesa->backup_store.cmd_used == 0)
- return;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "Emitting backup state on lost context\n");
-
- rmesa->lost_context = GL_FALSE;
-
- nr_released_bufs = rmesa->dma.nr_released_bufs;
- saved_store = rmesa->store;
- rmesa->dma.nr_released_bufs = 0;
- rmesa->store = rmesa->backup_store;
- radeonFlushCmdBufLocked( rmesa, __FUNCTION__ );
- rmesa->dma.nr_released_bufs = nr_released_bufs;
- rmesa->store = saved_store;
-}
-
-/* =============================================================
- * Kernel command buffer handling
- */
-
-/* The state atoms will be emitted in the order they appear in the atom list,
- * so this step is important.
- */
-void radeonSetUpAtomList( radeonContextPtr rmesa )
-{
- int i, mtu = rmesa->glCtx->Const.MaxTextureUnits;
-
- make_empty_list(&rmesa->hw.atomlist);
- rmesa->hw.atomlist.name = "atom-list";
-
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.ctx);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.set);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.lin);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.msk);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.vpt);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.tcl);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.msc);
- for (i = 0; i < mtu; ++i) {
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.tex[i]);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.txr[i]);
- }
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.zbs);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.mtl);
- for (i = 0; i < 3 + mtu; ++i)
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.mat[i]);
- for (i = 0; i < 8; ++i)
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.lit[i]);
- for (i = 0; i < 6; ++i)
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.ucp[i]);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.eye);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.grd);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.fog);
- insert_at_tail(&rmesa->hw.atomlist, &rmesa->hw.glt);
-}
-
-void radeonEmitState( radeonContextPtr rmesa )
-{
- struct radeon_state_atom *atom;
- char *dest;
-
- if (RADEON_DEBUG & (DEBUG_STATE|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->save_on_next_emit) {
- radeonSaveHwState(rmesa);
- rmesa->save_on_next_emit = GL_FALSE;
- }
-
- /* this code used to return here but now it emits zbs */
-
- /* To avoid going across the entire set of states multiple times, just check
- * for enough space for the case of emitting all state, and inline the
- * radeonAllocCmdBuf code here without all the checks.
- */
- radeonEnsureCmdBufSpace(rmesa, rmesa->hw.max_state_size);
- dest = rmesa->store.cmd_buf + rmesa->store.cmd_used;
-
- /* We always always emit zbs, this is due to a bug found by keithw in
- the hardware and rediscovered after Erics changes by me.
- if you ever touch this code make sure you emit zbs otherwise
- you get tcl lockups on at least M7/7500 class of chips - airlied */
- rmesa->hw.zbs.dirty=1;
-
- if (RADEON_DEBUG & DEBUG_STATE) {
- foreach(atom, &rmesa->hw.atomlist) {
- if (atom->dirty || rmesa->hw.all_dirty) {
- if (atom->check(rmesa->glCtx))
- print_state_atom(atom);
- else
- fprintf(stderr, "skip state %s\n", atom->name);
- }
- }
- }
-
- foreach(atom, &rmesa->hw.atomlist) {
- if (rmesa->hw.all_dirty)
- atom->dirty = GL_TRUE;
- if (!(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) &&
- atom->is_tcl)
- atom->dirty = GL_FALSE;
- if (atom->dirty) {
- if (atom->check(rmesa->glCtx)) {
- int size = atom->cmd_size * 4;
- memcpy(dest, atom->cmd, size);
- dest += size;
- rmesa->store.cmd_used += size;
- atom->dirty = GL_FALSE;
- }
- }
- }
-
- assert(rmesa->store.cmd_used <= RADEON_CMD_BUF_SZ);
-
- rmesa->hw.is_dirty = GL_FALSE;
- rmesa->hw.all_dirty = GL_FALSE;
-}
-
-/* Fire a section of the retained (indexed_verts) buffer as a regular
- * primtive.
- */
-extern void radeonEmitVbufPrim( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint vertex_nr )
-{
- drm_radeon_cmd_header_t *cmd;
-
-
- assert(!(primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND));
-
- radeonEmitState( rmesa );
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s cmd_used/4: %d\n", __FUNCTION__,
- rmesa->store.cmd_used/4);
-
- cmd = (drm_radeon_cmd_header_t *)radeonAllocCmdBuf( rmesa, VBUF_BUFSZ,
- __FUNCTION__ );
-#if RADEON_OLD_PACKETS
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM | (3 << 16);
- cmd[2].i = rmesa->ioctl.vertex_offset;
- cmd[3].i = vertex_nr;
- cmd[4].i = vertex_format;
- cmd[5].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_LIST |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
- (vertex_nr << RADEON_CP_VC_CNTL_NUM_SHIFT));
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x offt 0x%x vfmt 0x%x vfcntl %x \n",
- __FUNCTION__,
- cmd[1].i, cmd[2].i, cmd[4].i, cmd[5].i);
-#else
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_DRAW_VBUF | (1 << 16);
- cmd[2].i = vertex_format;
- cmd[3].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_LIST |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_MAOS_ENABLE |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
- (vertex_nr << RADEON_CP_VC_CNTL_NUM_SHIFT));
-
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x vfmt 0x%x vfcntl %x \n",
- __FUNCTION__,
- cmd[1].i, cmd[2].i, cmd[3].i);
-#endif
-}
-
-
-void radeonFlushElts( radeonContextPtr rmesa )
-{
- int *cmd = (int *)(rmesa->store.cmd_buf + rmesa->store.elts_start);
- int dwords;
-#if RADEON_OLD_PACKETS
- int nr = (rmesa->store.cmd_used - (rmesa->store.elts_start + 24)) / 2;
-#else
- int nr = (rmesa->store.cmd_used - (rmesa->store.elts_start + 16)) / 2;
-#endif
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert( rmesa->dma.flush == radeonFlushElts );
- rmesa->dma.flush = NULL;
-
- /* Cope with odd number of elts:
- */
- rmesa->store.cmd_used = (rmesa->store.cmd_used + 2) & ~2;
- dwords = (rmesa->store.cmd_used - rmesa->store.elts_start) / 4;
-
-#if RADEON_OLD_PACKETS
- cmd[1] |= (dwords - 3) << 16;
- cmd[5] |= nr << RADEON_CP_VC_CNTL_NUM_SHIFT;
-#else
- cmd[1] |= (dwords - 3) << 16;
- cmd[3] |= nr << RADEON_CP_VC_CNTL_NUM_SHIFT;
-#endif
-
- if (RADEON_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__);
- radeonFinish( rmesa->glCtx );
- }
-}
-
-
-GLushort *radeonAllocEltsOpenEnded( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint min_nr )
-{
- drm_radeon_cmd_header_t *cmd;
- GLushort *retval;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, min_nr);
-
- assert((primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND));
-
- radeonEmitState( rmesa );
-
- cmd = (drm_radeon_cmd_header_t *)radeonAllocCmdBuf( rmesa,
- ELTS_BUFSZ(min_nr),
- __FUNCTION__ );
-#if RADEON_OLD_PACKETS
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM;
- cmd[2].i = rmesa->ioctl.vertex_offset;
- cmd[3].i = 0xffff;
- cmd[4].i = vertex_format;
- cmd[5].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_IND |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE);
-
- retval = (GLushort *)(cmd+6);
-#else
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3_CLIP;
- cmd[1].i = RADEON_CP_PACKET3_3D_DRAW_INDX;
- cmd[2].i = vertex_format;
- cmd[3].i = (primitive |
- RADEON_CP_VC_CNTL_PRIM_WALK_IND |
- RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA |
- RADEON_CP_VC_CNTL_MAOS_ENABLE |
- RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE);
-
- retval = (GLushort *)(cmd+4);
-#endif
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: header 0x%x vfmt 0x%x prim %x \n",
- __FUNCTION__,
- cmd[1].i, vertex_format, primitive);
-
- assert(!rmesa->dma.flush);
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = radeonFlushElts;
-
- rmesa->store.elts_start = ((char *)cmd) - rmesa->store.cmd_buf;
-
- return retval;
-}
-
-
-
-void radeonEmitVertexAOS( radeonContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset )
-{
-#if RADEON_OLD_PACKETS
- rmesa->ioctl.vertex_size = vertex_size;
- rmesa->ioctl.vertex_offset = offset;
-#else
- drm_radeon_cmd_header_t *cmd;
-
- if (RADEON_DEBUG & (DEBUG_PRIMS|DEBUG_IOCTL))
- fprintf(stderr, "%s: vertex_size 0x%x offset 0x%x \n",
- __FUNCTION__, vertex_size, offset);
-
- cmd = (drm_radeon_cmd_header_t *)radeonAllocCmdBuf( rmesa, VERT_AOS_BUFSZ,
- __FUNCTION__ );
-
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = RADEON_CP_PACKET3_3D_LOAD_VBPNTR | (2 << 16);
- cmd[2].i = 1;
- cmd[3].i = vertex_size | (vertex_size << 8);
- cmd[4].i = offset;
-#endif
-}
-
-
-void radeonEmitAOS( radeonContextPtr rmesa,
- struct radeon_dma_region **component,
- GLuint nr,
- GLuint offset )
-{
-#if RADEON_OLD_PACKETS
- assert( nr == 1 );
- assert( component[0]->aos_size == component[0]->aos_stride );
- rmesa->ioctl.vertex_size = component[0]->aos_size;
- rmesa->ioctl.vertex_offset =
- (component[0]->aos_start + offset * component[0]->aos_stride * 4);
-#else
- drm_radeon_cmd_header_t *cmd;
- int sz = AOS_BUFSZ(nr);
- int i;
- int *tmp;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- cmd = (drm_radeon_cmd_header_t *)radeonAllocCmdBuf( rmesa, sz,
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = RADEON_CP_PACKET3_3D_LOAD_VBPNTR | (((sz / sizeof(int))-3) << 16);
- cmd[2].i = nr;
- tmp = &cmd[0].i;
- cmd += 3;
-
- for (i = 0 ; i < nr ; i++) {
- if (i & 1) {
- cmd[0].i |= ((component[i]->aos_stride << 24) |
- (component[i]->aos_size << 16));
- cmd[2].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- cmd += 3;
- }
- else {
- cmd[0].i = ((component[i]->aos_stride << 8) |
- (component[i]->aos_size << 0));
- cmd[1].i = (component[i]->aos_start +
- offset * component[i]->aos_stride * 4);
- }
- }
-
- if (RADEON_DEBUG & DEBUG_VERTS) {
- fprintf(stderr, "%s:\n", __FUNCTION__);
- for (i = 0 ; i < sz ; i++)
- fprintf(stderr, " %d: %x\n", i, tmp[i]);
- }
-#endif
-}
-
-/* using already shifted color_fmt! */
-void radeonEmitBlit( radeonContextPtr rmesa, /* FIXME: which drmMinor is required? */
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h )
-{
- drm_radeon_cmd_header_t *cmd;
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s src %x/%x %d,%d dst: %x/%x %d,%d sz: %dx%d\n",
- __FUNCTION__,
- src_pitch, src_offset, srcx, srcy,
- dst_pitch, dst_offset, dstx, dsty,
- w, h);
-
- assert( (src_pitch & 63) == 0 );
- assert( (dst_pitch & 63) == 0 );
- assert( (src_offset & 1023) == 0 );
- assert( (dst_offset & 1023) == 0 );
- assert( w < (1<<16) );
- assert( h < (1<<16) );
-
- cmd = (drm_radeon_cmd_header_t *)radeonAllocCmdBuf( rmesa, 8 * sizeof(int),
- __FUNCTION__ );
-
-
- cmd[0].i = 0;
- cmd[0].header.cmd_type = RADEON_CMD_PACKET3;
- cmd[1].i = RADEON_CP_PACKET3_CNTL_BITBLT_MULTI | (5 << 16);
- cmd[2].i = (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
- RADEON_GMC_DST_PITCH_OFFSET_CNTL |
- RADEON_GMC_BRUSH_NONE |
- color_fmt |
- RADEON_GMC_SRC_DATATYPE_COLOR |
- RADEON_ROP3_S |
- RADEON_DP_SRC_SOURCE_MEMORY |
- RADEON_GMC_CLR_CMP_CNTL_DIS |
- RADEON_GMC_WR_MSK_DIS );
-
- cmd[3].i = ((src_pitch/64)<<22) | (src_offset >> 10);
- cmd[4].i = ((dst_pitch/64)<<22) | (dst_offset >> 10);
- cmd[5].i = (srcx << 16) | srcy;
- cmd[6].i = (dstx << 16) | dsty; /* dst */
- cmd[7].i = (w << 16) | h;
-}
-
-
-void radeonEmitWait( radeonContextPtr rmesa, GLuint flags )
-{
- if (rmesa->dri.drmMinor >= 6) {
- drm_radeon_cmd_header_t *cmd;
-
- assert( !(flags & ~(RADEON_WAIT_2D|RADEON_WAIT_3D)) );
-
- cmd = (drm_radeon_cmd_header_t *)radeonAllocCmdBuf( rmesa, 1 * sizeof(int),
- __FUNCTION__ );
- cmd[0].i = 0;
- cmd[0].wait.cmd_type = RADEON_CMD_WAIT;
- cmd[0].wait.flags = flags;
- }
-}
-
-
-static int radeonFlushCmdBufLocked( radeonContextPtr rmesa,
- const char * caller )
-{
- int ret, i;
- drm_radeon_cmd_buffer_t cmd;
-
- if (rmesa->lost_context)
- radeonBackUpAndEmitLostStateLocked(rmesa);
-
- if (RADEON_DEBUG & DEBUG_IOCTL) {
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (RADEON_DEBUG & DEBUG_VERBOSE)
- for (i = 0 ; i < rmesa->store.cmd_used ; i += 4 )
- fprintf(stderr, "%d: %x\n", i/4,
- *(int *)(&rmesa->store.cmd_buf[i]));
- }
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "%s: Releasing %d buffers\n", __FUNCTION__,
- rmesa->dma.nr_released_bufs);
-
-
- if (RADEON_DEBUG & DEBUG_SANITY) {
- if (rmesa->state.scissor.enabled)
- ret = radeonSanityCmdBuffer( rmesa,
- rmesa->state.scissor.numClipRects,
- rmesa->state.scissor.pClipRects);
- else
- ret = radeonSanityCmdBuffer( rmesa,
- rmesa->numClipRects,
- rmesa->pClipRects);
- if (ret) {
- fprintf(stderr, "drmSanityCommandWrite: %d\n", ret);
- goto out;
- }
- }
-
-
- cmd.bufsz = rmesa->store.cmd_used;
- cmd.buf = rmesa->store.cmd_buf;
-
- if (rmesa->state.scissor.enabled) {
- cmd.nbox = rmesa->state.scissor.numClipRects;
- cmd.boxes = rmesa->state.scissor.pClipRects;
- } else {
- cmd.nbox = rmesa->numClipRects;
- cmd.boxes = rmesa->pClipRects;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd,
- DRM_RADEON_CMDBUF,
- &cmd, sizeof(cmd) );
-
- if (ret)
- fprintf(stderr, "drmCommandWrite: %d\n", ret);
-
- if (RADEON_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "\nSyncing in %s\n\n", __FUNCTION__);
- radeonWaitForIdleLocked( rmesa );
- }
-
- out:
- rmesa->store.primnr = 0;
- rmesa->store.statenr = 0;
- rmesa->store.cmd_used = 0;
- rmesa->dma.nr_released_bufs = 0;
- rmesa->save_on_next_emit = 1;
-
- return ret;
-}
-
-
-/* Note: does not emit any commands to avoid recursion on
- * radeonAllocCmdBuf.
- */
-void radeonFlushCmdBuf( radeonContextPtr rmesa, const char *caller )
-{
- int ret;
-
-
- LOCK_HARDWARE( rmesa );
-
- ret = radeonFlushCmdBufLocked( rmesa, caller );
-
- UNLOCK_HARDWARE( rmesa );
-
- if (ret) {
- fprintf(stderr, "drm_radeon_cmd_buffer_t: %d (exiting)\n", ret);
- exit(ret);
- }
-}
-
-/* =============================================================
- * Hardware vertex buffer handling
- */
-
-
-void radeonRefillCurrentDmaRegion( radeonContextPtr rmesa )
-{
- struct radeon_dma_buffer *dmabuf;
- int fd = rmesa->dri.fd;
- int index = 0;
- int size = 0;
- drmDMAReq dma;
- int ret;
-
- if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush) {
- rmesa->dma.flush( rmesa );
- }
-
- if (rmesa->dma.current.buf)
- radeonReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
-
- if (rmesa->dma.nr_released_bufs > 4)
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
-
- dma.context = rmesa->dri.hwContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = RADEON_BUFFER_SIZE;
- dma.request_list = &index;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
- LOCK_HARDWARE(rmesa); /* no need to validate */
-
- ret = drmDMA( fd, &dma );
-
- if (ret != 0) {
- /* Free some up this way?
- */
- if (rmesa->dma.nr_released_bufs) {
- radeonFlushCmdBufLocked( rmesa, __FUNCTION__ );
- }
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Waiting for buffers\n");
-
- radeonWaitForIdleLocked( rmesa );
- ret = drmDMA( fd, &dma );
-
- if ( ret != 0 ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Could not get dma buffer... exiting\n" );
- exit( -1 );
- }
- }
-
- UNLOCK_HARDWARE(rmesa);
-
- if (RADEON_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Allocated buffer %d\n", index);
-
- dmabuf = CALLOC_STRUCT( radeon_dma_buffer );
- dmabuf->buf = &rmesa->radeonScreen->buffers->list[index];
- dmabuf->refcount = 1;
-
- rmesa->dma.current.buf = dmabuf;
- rmesa->dma.current.address = dmabuf->buf->address;
- rmesa->dma.current.end = dmabuf->buf->total;
- rmesa->dma.current.start = 0;
- rmesa->dma.current.ptr = 0;
-
- rmesa->c_vertexBuffers++;
-}
-
-void radeonReleaseDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- const char *caller )
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (!region->buf)
- return;
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (--region->buf->refcount == 0) {
- drm_radeon_cmd_header_t *cmd;
-
- if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s -- DISCARD BUF %d\n", __FUNCTION__,
- region->buf->buf->idx);
-
- cmd = (drm_radeon_cmd_header_t *)radeonAllocCmdBuf( rmesa, sizeof(*cmd),
- __FUNCTION__ );
- cmd->dma.cmd_type = RADEON_CMD_DMA_DISCARD;
- cmd->dma.buf_idx = region->buf->buf->idx;
- FREE(region->buf);
- rmesa->dma.nr_released_bufs++;
- }
-
- region->buf = NULL;
- region->start = 0;
-}
-
-/* Allocates a region from rmesa->dma.current. If there isn't enough
- * space in current, grab a new buffer (and discard what was left of current)
- */
-void radeonAllocDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int bytes,
- int alignment )
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, bytes);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- if (region->buf)
- radeonReleaseDmaRegion( rmesa, region, __FUNCTION__ );
-
- alignment--;
- rmesa->dma.current.start = rmesa->dma.current.ptr =
- (rmesa->dma.current.ptr + alignment) & ~alignment;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- radeonRefillCurrentDmaRegion( rmesa );
-
- region->start = rmesa->dma.current.start;
- region->ptr = rmesa->dma.current.start;
- region->end = rmesa->dma.current.start + bytes;
- region->address = rmesa->dma.current.address;
- region->buf = rmesa->dma.current.buf;
- region->buf->refcount++;
-
- rmesa->dma.current.ptr += bytes; /* bug - if alignment > 7 */
- rmesa->dma.current.start =
- rmesa->dma.current.ptr = (rmesa->dma.current.ptr + 0x7) & ~0x7;
-}
-
-void radeonAllocDmaRegionVerts( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int numverts,
- int vertsize,
- int alignment )
-{
- radeonAllocDmaRegion( rmesa, region, vertsize * numverts, alignment );
-}
-
-/* ================================================================
- * SwapBuffers with client-side throttling
- */
-
-static u_int32_t radeonGetLastFrame (radeonContextPtr rmesa)
-{
- unsigned char *RADEONMMIO = rmesa->radeonScreen->mmio.map;
- int ret;
- u_int32_t frame;
-
- if (rmesa->dri.screen->drmMinor >= 4) {
- drm_radeon_getparam_t gp;
-
- gp.param = RADEON_PARAM_LAST_FRAME;
- gp.value = (int *)&frame;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp) );
- }
- else
- ret = -EINVAL;
-
- if ( ret == -EINVAL ) {
- frame = INREG( RADEON_LAST_FRAME_REG );
- ret = 0;
- }
- if ( ret ) {
- fprintf( stderr, "%s: drm_radeon_getparam_t: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- return frame;
-}
-
-static void radeonEmitIrqLocked( radeonContextPtr rmesa )
-{
- drm_radeon_irq_emit_t ie;
- int ret;
-
- ie.irq_seq = &rmesa->iw.irq_seq;
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_IRQ_EMIT,
- &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drm_radeon_irq_emit_t: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void radeonWaitIrq( radeonContextPtr rmesa )
-{
- int ret;
-
- do {
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_IRQ_WAIT,
- &rmesa->iw, sizeof(rmesa->iw) );
- } while (ret && (errno == EINTR || errno == EAGAIN));
-
- if ( ret ) {
- fprintf( stderr, "%s: drmRadeonIrqWait: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-static void radeonWaitForFrameCompletion( radeonContextPtr rmesa )
-{
- drm_radeon_sarea_t *sarea = rmesa->sarea;
-
- if (rmesa->do_irqs) {
- if (radeonGetLastFrame(rmesa) < sarea->last_frame) {
- if (!rmesa->irqsEmitted) {
- while (radeonGetLastFrame (rmesa) < sarea->last_frame)
- ;
- }
- else {
- UNLOCK_HARDWARE( rmesa );
- radeonWaitIrq( rmesa );
- LOCK_HARDWARE( rmesa );
- }
- rmesa->irqsEmitted = 10;
- }
-
- if (rmesa->irqsEmitted) {
- radeonEmitIrqLocked( rmesa );
- rmesa->irqsEmitted--;
- }
- }
- else {
- while (radeonGetLastFrame (rmesa) < sarea->last_frame) {
- UNLOCK_HARDWARE( rmesa );
- if (rmesa->do_usleeps)
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- radeonContextPtr rmesa;
- GLint nbox, i, ret;
- GLboolean missed_target;
- int64_t ust;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, (void *) rmesa->glCtx );
- }
-
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the frame rate -- only allow one pending swap buffers
- * request at a time.
- */
- radeonWaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- LOCK_HARDWARE( rmesa );
-
- nbox = dPriv->numClipRects; /* must be in locked region */
-
- for ( i = 0 ; i < nbox ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS , nbox );
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- rmesa->sarea->nbox = n;
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_SWAP_BUFFERS: return = %d\n", ret );
- UNLOCK_HARDWARE( rmesa );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
- rmesa->swap_count++;
- (*dri_interface->getUST)( & ust );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- rmesa->swap_missed_ust = ust - rmesa->swap_ust;
- }
-
- rmesa->swap_ust = ust;
- rmesa->hw.all_dirty = GL_TRUE;
-}
-
-void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
-{
- radeonContextPtr rmesa;
- GLint ret;
- GLboolean missed_target;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
-
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf(stderr, "%s: pfCurrentPage: %d\n", __FUNCTION__,
- rmesa->sarea->pfCurrentPage);
- }
-
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* Need to do this for the perf box placement:
- */
- if (dPriv->numClipRects)
- {
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- b[0] = box[0];
- rmesa->sarea->nbox = 1;
- }
-
- /* Throttle the frame rate -- only allow a few pending swap buffers
- * request at a time.
- */
- radeonWaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust );
- }
- LOCK_HARDWARE( rmesa );
-
- ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_FLIP );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_FLIP: return = %d\n", ret );
- exit( 1 );
- }
-
- rmesa->swap_count++;
- (void) (*dri_interface->getUST)( & rmesa->swap_ust );
-
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->radeonScreen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= RADEON_COLOR_TILE_ENABLE;
- }
-}
-
-
-/* ================================================================
- * Buffer clear
- */
-#define RADEON_MAX_CLEARS 256
-
-static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- drm_radeon_sarea_t *sarea = rmesa->sarea;
- unsigned char *RADEONMMIO = rmesa->radeonScreen->mmio.map;
- u_int32_t clear;
- GLuint flags = 0;
- GLuint color_mask = 0;
- GLint ret, i;
-
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
- }
-
- {
- LOCK_HARDWARE( rmesa );
- UNLOCK_HARDWARE( rmesa );
- if ( dPriv->numClipRects == 0 )
- return;
- }
-
- radeonFlush( ctx );
-
- if ( mask & BUFFER_BIT_FRONT_LEFT ) {
- flags |= RADEON_FRONT;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ( mask & BUFFER_BIT_BACK_LEFT ) {
- flags |= RADEON_BACK;
- color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ( mask & BUFFER_BIT_DEPTH ) {
- flags |= RADEON_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if ( (mask & BUFFER_BIT_STENCIL) && rmesa->state.stencil.hwBuffer ) {
- flags |= RADEON_STENCIL;
- mask &= ~BUFFER_BIT_STENCIL;
- }
-
- if ( mask ) {
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
- }
-
- if ( !flags )
- return;
-
- if (rmesa->using_hyperz) {
- flags |= RADEON_USE_COMP_ZBUF;
-/* if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)
- flags |= RADEON_USE_HIERZ; */
- if (!(rmesa->state.stencil.hwBuffer) ||
- ((flags & RADEON_DEPTH) && (flags & RADEON_STENCIL) &&
- ((rmesa->state.stencil.clear & RADEON_STENCIL_WRITE_MASK) == RADEON_STENCIL_WRITE_MASK))) {
- flags |= RADEON_CLEAR_FASTZ;
- }
- }
-
- /* Flip top to bottom */
- cx += dPriv->x;
- cy = dPriv->y + dPriv->h - cy - ch;
-
- LOCK_HARDWARE( rmesa );
-
- /* Throttle the number of clear ioctls we do.
- */
- while ( 1 ) {
- int ret;
-
- if (rmesa->dri.screen->drmMinor >= 4) {
- drm_radeon_getparam_t gp;
-
- gp.param = RADEON_PARAM_LAST_CLEAR;
- gp.value = (int *)&clear;
- ret = drmCommandWriteRead( rmesa->dri.fd,
- DRM_RADEON_GETPARAM, &gp, sizeof(gp) );
- } else
- ret = -EINVAL;
-
- if ( ret == -EINVAL ) {
- clear = INREG( RADEON_LAST_CLEAR_REG );
- ret = 0;
- }
- if ( ret ) {
- fprintf( stderr, "%s: drm_radeon_getparam_t: %d\n", __FUNCTION__, ret );
- exit(1);
- }
- if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s( %d )\n", __FUNCTION__, (int)clear );
- if ( ret ) fprintf( stderr, " ( RADEON_LAST_CLEAR register read directly )\n" );
- }
-
- if ( sarea->last_clear - clear <= RADEON_MAX_CLEARS ) {
- break;
- }
-
- if ( rmesa->do_usleeps ) {
- UNLOCK_HARDWARE( rmesa );
- DO_USLEEP( 1 );
- LOCK_HARDWARE( rmesa );
- }
- }
-
- /* Send current state to the hardware */
- radeonFlushCmdBufLocked( rmesa, __FUNCTION__ );
-
- for ( i = 0 ; i < dPriv->numClipRects ; ) {
- GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, dPriv->numClipRects );
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t *b = rmesa->sarea->boxes;
- drm_radeon_clear_t clear;
- drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- rmesa->sarea->nbox = n;
-
- clear.flags = flags;
- clear.clear_color = rmesa->state.color.clear;
- clear.clear_depth = rmesa->state.depth.clear;
- clear.color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
- clear.depth_mask = rmesa->state.stencil.clear;
- clear.depth_boxes = depth_boxes;
-
- n--;
- b = rmesa->sarea->boxes;
- for ( ; n >= 0 ; n-- ) {
- depth_boxes[n].f[CLEAR_X1] = (float)b[n].x1;
- depth_boxes[n].f[CLEAR_Y1] = (float)b[n].y1;
- depth_boxes[n].f[CLEAR_X2] = (float)b[n].x2;
- depth_boxes[n].f[CLEAR_Y2] = (float)b[n].y2;
- depth_boxes[n].f[CLEAR_DEPTH] =
- (float)rmesa->state.depth.clear;
- }
-
- ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_CLEAR,
- &clear, sizeof(drm_radeon_clear_t));
-
- if ( ret ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "DRM_RADEON_CLEAR: return = %d\n", ret );
- exit( 1 );
- }
- }
-
- UNLOCK_HARDWARE( rmesa );
- rmesa->hw.all_dirty = GL_TRUE;
-}
-
-
-void radeonWaitForIdleLocked( radeonContextPtr rmesa )
-{
- int fd = rmesa->dri.fd;
- int to = 0;
- int ret, i = 0;
-
- rmesa->c_drawWaits++;
-
- do {
- do {
- ret = drmCommandNone( fd, DRM_RADEON_CP_IDLE);
- } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY );
- } while ( ( ret == -EBUSY ) && ( to++ < RADEON_TIMEOUT ) );
-
- if ( ret < 0 ) {
- UNLOCK_HARDWARE( rmesa );
- fprintf( stderr, "Error: Radeon timed out... exiting\n" );
- exit( -1 );
- }
-}
-
-
-static void radeonWaitForIdle( radeonContextPtr rmesa )
-{
- LOCK_HARDWARE(rmesa);
- radeonWaitForIdleLocked( rmesa );
- UNLOCK_HARDWARE(rmesa);
-}
-
-
-void radeonFlush( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- radeonEmitState( rmesa );
-
- if (rmesa->store.cmd_used)
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-void radeonFinish( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeonFlush( ctx );
-
- if (rmesa->do_irqs) {
- LOCK_HARDWARE( rmesa );
- radeonEmitIrqLocked( rmesa );
- UNLOCK_HARDWARE( rmesa );
- radeonWaitIrq( rmesa );
- }
- else
- radeonWaitForIdle( rmesa );
-}
-
-
-void radeonInitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Clear = radeonClear;
- ctx->Driver.Finish = radeonFinish;
- ctx->Driver.Flush = radeonFlush;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.h
deleted file mode 100644
index 8b21920c5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_ioctl.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.h,v 1.6 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_IOCTL_H__
-#define __RADEON_IOCTL_H__
-
-#include "simple_list.h"
-#include "radeon_lock.h"
-
-
-extern void radeonEmitState( radeonContextPtr rmesa );
-extern void radeonEmitVertexAOS( radeonContextPtr rmesa,
- GLuint vertex_size,
- GLuint offset );
-
-extern void radeonEmitVbufPrim( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint vertex_nr );
-
-extern void radeonFlushElts( radeonContextPtr rmesa );
-
-extern GLushort *radeonAllocEltsOpenEnded( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint primitive,
- GLuint min_nr );
-
-extern void radeonEmitAOS( radeonContextPtr rmesa,
- struct radeon_dma_region **regions,
- GLuint n,
- GLuint offset );
-
-extern void radeonEmitBlit( radeonContextPtr rmesa,
- GLuint color_fmt,
- GLuint src_pitch,
- GLuint src_offset,
- GLuint dst_pitch,
- GLuint dst_offset,
- GLint srcx, GLint srcy,
- GLint dstx, GLint dsty,
- GLuint w, GLuint h );
-
-extern void radeonEmitWait( radeonContextPtr rmesa, GLuint flags );
-
-extern void radeonFlushCmdBuf( radeonContextPtr rmesa, const char * );
-extern void radeonRefillCurrentDmaRegion( radeonContextPtr rmesa );
-
-extern void radeonAllocDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int bytes,
- int alignment );
-
-extern void radeonAllocDmaRegionVerts( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- int numverts,
- int vertsize,
- int alignment );
-
-extern void radeonReleaseDmaRegion( radeonContextPtr rmesa,
- struct radeon_dma_region *region,
- const char *caller );
-
-extern void radeonCopyBuffer( const __DRIdrawablePrivate *drawable );
-extern void radeonPageFlip( const __DRIdrawablePrivate *drawable );
-extern void radeonFlush( GLcontext *ctx );
-extern void radeonFinish( GLcontext *ctx );
-extern void radeonWaitForIdleLocked( radeonContextPtr rmesa );
-extern void radeonWaitForVBlank( radeonContextPtr rmesa );
-extern void radeonInitIoctlFuncs( GLcontext *ctx );
-extern void radeonGetAllParams( radeonContextPtr rmesa );
-extern void radeonSetUpAtomList( radeonContextPtr rmesa );
-
-/* radeon_compat.c:
- */
-extern void radeonCompatEmitPrimitive( radeonContextPtr rmesa,
- GLuint vertex_format,
- GLuint hw_primitive,
- GLuint nrverts );
-
-/* ================================================================
- * Helper macros:
- */
-
-/* Close off the last primitive, if it exists.
- */
-#define RADEON_NEWPRIM( rmesa ) \
-do { \
- if ( rmesa->dma.flush ) \
- rmesa->dma.flush( rmesa ); \
-} while (0)
-
-/* Can accomodate several state changes and primitive changes without
- * actually firing the buffer.
- */
-#define RADEON_STATECHANGE( rmesa, ATOM ) \
-do { \
- RADEON_NEWPRIM( rmesa ); \
- rmesa->hw.ATOM.dirty = GL_TRUE; \
- rmesa->hw.is_dirty = GL_TRUE; \
-} while (0)
-
-#define RADEON_DB_STATE( ATOM ) \
- memcpy( rmesa->hw.ATOM.lastcmd, rmesa->hw.ATOM.cmd, \
- rmesa->hw.ATOM.cmd_size * 4)
-
-static __inline int RADEON_DB_STATECHANGE(
- radeonContextPtr rmesa,
- struct radeon_state_atom *atom )
-{
- if (memcmp(atom->cmd, atom->lastcmd, atom->cmd_size*4)) {
- int *tmp;
- RADEON_NEWPRIM( rmesa );
- atom->dirty = GL_TRUE;
- rmesa->hw.is_dirty = GL_TRUE;
- tmp = atom->cmd;
- atom->cmd = atom->lastcmd;
- atom->lastcmd = tmp;
- return 1;
- }
- else
- return 0;
-}
-
-
-/* Fire the buffered vertices no matter what.
- */
-#define RADEON_FIREVERTICES( rmesa ) \
-do { \
- if ( rmesa->store.cmd_used || rmesa->dma.flush ) { \
- radeonFlush( rmesa->glCtx ); \
- } \
-} while (0)
-
-/* Command lengths. Note that any time you ensure ELTS_BUFSZ or VBUF_BUFSZ
- * are available, you will also be adding an rmesa->state.max_state_size because
- * r200EmitState is called from within r200EmitVbufPrim and r200FlushElts.
- */
-#if RADEON_OLD_PACKETS
-#define AOS_BUFSZ(nr) ((3 + ((nr / 2) * 3) + ((nr & 1) * 2)) * sizeof(int))
-#define VERT_AOS_BUFSZ (0)
-#define ELTS_BUFSZ(nr) (24 + nr * 2)
-#define VBUF_BUFSZ (6 * sizeof(int))
-#else
-#define AOS_BUFSZ(nr) ((3 + ((nr / 2) * 3) + ((nr & 1) * 2)) * sizeof(int))
-#define VERT_AOS_BUFSZ (5 * sizeof(int))
-#define ELTS_BUFSZ(nr) (16 + nr * 2)
-#define VBUF_BUFSZ (4 * sizeof(int))
-#endif
-
-/* Ensure that a minimum amount of space is available in the command buffer.
- * This is used to ensure atomicity of state updates with the rendering requests
- * that rely on them.
- *
- * An alternative would be to implement a "soft lock" such that when the buffer
- * wraps at an inopportune time, we grab the lock, flush the current buffer,
- * and hang on to the lock until the critical section is finished and we flush
- * the buffer again and unlock.
- */
-static __inline void radeonEnsureCmdBufSpace( radeonContextPtr rmesa,
- int bytes )
-{
- if (rmesa->store.cmd_used + bytes > RADEON_CMD_BUF_SZ)
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
- assert( bytes <= RADEON_CMD_BUF_SZ );
-}
-
-/* Alloc space in the command buffer
- */
-static __inline char *radeonAllocCmdBuf( radeonContextPtr rmesa,
- int bytes, const char *where )
-{
- if (rmesa->store.cmd_used + bytes > RADEON_CMD_BUF_SZ)
- radeonFlushCmdBuf( rmesa, __FUNCTION__ );
-
- assert(rmesa->dri.drmMinor >= 3);
-
- {
- char *head = rmesa->store.cmd_buf + rmesa->store.cmd_used;
- rmesa->store.cmd_used += bytes;
- return head;
- }
-}
-
-#endif /* __RADEON_IOCTL_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lighting.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lighting.c
deleted file mode 100644
index 44e00af0e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lighting.c
+++ /dev/null
@@ -1,682 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v 1.5 2002/09/16 18:05:20 eich Exp $ */
-/*
- * Copyright 2000, 2001 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, 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
- * 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:
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-/* #include "mmath.h" */
-#include "enums.h"
-#include "colormac.h"
-
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_vtxfmt.h"
-
-
-
-/* =============================================================
- * Materials
- */
-
-
-/* Update on colormaterial, material emmissive/ambient,
- * lightmodel.globalambient
- */
-void update_global_ambient( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( glt );
-
- /* Need to do more if both emmissive & ambient are PREMULT:
- */
- if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &
- ((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT))) == 0)
- {
- COPY_3V( &fcmd[GLT_RED],
- ctx->Light.Material[0].Emission);
- ACC_SCALE_3V( &fcmd[GLT_RED],
- ctx->Light.Model.Ambient,
- ctx->Light.Material[0].Ambient);
- }
- else
- {
- COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient );
- }
-
- RADEON_DB_STATECHANGE(rmesa, &rmesa->hw.glt);
-}
-
-/* Update on change to
- * - light[p].colors
- * - light[p].enabled
- * - material,
- * - colormaterial enabled
- * - colormaterial bitmask
- */
-void update_light_colors( GLcontext *ctx, GLuint p )
-{
- struct gl_light *l = &ctx->Light.Light[p];
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (l->Enabled) {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( lit[p] );
- GLuint bitmask = ctx->Light.ColorMaterialBitmask;
- struct gl_material *mat = &ctx->Light.Material[0];
-
- COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient );
- COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse );
- COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular );
-
- if (!ctx->Light.ColorMaterialEnabled)
- bitmask = 0;
-
- if ((bitmask & FRONT_AMBIENT_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_AMBIENT_RED], mat->Ambient );
-
- if ((bitmask & FRONT_DIFFUSE_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_DIFFUSE_RED], mat->Diffuse );
-
- if ((bitmask & FRONT_SPECULAR_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_SPECULAR_RED], mat->Specular );
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
-}
-
-/* Also fallback for asym colormaterial mode in twoside lighting...
- */
-void check_twoside_fallback( GLcontext *ctx )
-{
- GLboolean fallback = GL_FALSE;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
- if (memcmp( &ctx->Light.Material[0],
- &ctx->Light.Material[1],
- sizeof(struct gl_material)) != 0)
- fallback = GL_TRUE;
- else if (ctx->Light.ColorMaterialEnabled &&
- (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) !=
- ((ctx->Light.ColorMaterialBitmask & FRONT_MATERIAL_BITS)<<1))
- fallback = GL_TRUE;
- }
-
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_LIGHT_TWOSIDE, fallback );
-}
-
-void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
-{
- if (ctx->Light.ColorMaterialEnabled) {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint light_model_ctl = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
- GLuint mask = ctx->Light.ColorMaterialBitmask;
-
- /* Default to PREMULT:
- */
- light_model_ctl &= ~((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT) |
- (3 << RADEON_DIFFUSE_SOURCE_SHIFT) |
- (3 << RADEON_SPECULAR_SOURCE_SHIFT));
-
- if (mask & FRONT_EMISSION_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_EMISSIVE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_AMBIENT_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_AMBIENT_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_DIFFUSE_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_DIFFUSE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_SPECULAR_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_SPECULAR_SOURCE_SHIFT);
- }
-
- if (light_model_ctl != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]) {
- GLuint p;
-
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = light_model_ctl;
-
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
- update_global_ambient( ctx );
- }
- }
-
- check_twoside_fallback( ctx );
-}
-
-void radeonUpdateMaterial( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( mtl );
- GLuint p;
- GLuint mask = ~0;
-
- if (ctx->Light.ColorMaterialEnabled)
- mask &= ~ctx->Light.ColorMaterialBitmask;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if (mask & FRONT_EMISSION_BIT) {
- fcmd[MTL_EMMISSIVE_RED] = ctx->Light.Material[0].Emission[0];
- fcmd[MTL_EMMISSIVE_GREEN] = ctx->Light.Material[0].Emission[1];
- fcmd[MTL_EMMISSIVE_BLUE] = ctx->Light.Material[0].Emission[2];
- fcmd[MTL_EMMISSIVE_ALPHA] = ctx->Light.Material[0].Emission[3];
- }
- if (mask & FRONT_AMBIENT_BIT) {
- fcmd[MTL_AMBIENT_RED] = ctx->Light.Material[0].Ambient[0];
- fcmd[MTL_AMBIENT_GREEN] = ctx->Light.Material[0].Ambient[1];
- fcmd[MTL_AMBIENT_BLUE] = ctx->Light.Material[0].Ambient[2];
- fcmd[MTL_AMBIENT_ALPHA] = ctx->Light.Material[0].Ambient[3];
- }
- if (mask & FRONT_DIFFUSE_BIT) {
- fcmd[MTL_DIFFUSE_RED] = ctx->Light.Material[0].Diffuse[0];
- fcmd[MTL_DIFFUSE_GREEN] = ctx->Light.Material[0].Diffuse[1];
- fcmd[MTL_DIFFUSE_BLUE] = ctx->Light.Material[0].Diffuse[2];
- fcmd[MTL_DIFFUSE_ALPHA] = ctx->Light.Material[0].Diffuse[3];
- }
- if (mask & FRONT_SPECULAR_BIT) {
- fcmd[MTL_SPECULAR_RED] = ctx->Light.Material[0].Specular[0];
- fcmd[MTL_SPECULAR_GREEN] = ctx->Light.Material[0].Specular[1];
- fcmd[MTL_SPECULAR_BLUE] = ctx->Light.Material[0].Specular[2];
- fcmd[MTL_SPECULAR_ALPHA] = ctx->Light.Material[0].Specular[3];
- }
- if (mask & FRONT_SHININESS_BIT) {
- fcmd[MTL_SHININESS] = ctx->Light.Material[0].Shininess;
- }
-
- if (RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mtl )) {
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
-
- check_twoside_fallback( ctx );
- update_global_ambient( ctx );
- }
- else if (RADEON_DEBUG & (DEBUG_PRIMS|DEBUG_STATE))
- fprintf(stderr, "%s: Elided noop material call\n", __FUNCTION__);
-}
-
-/* _NEW_LIGHT
- * _NEW_MODELVIEW
- * _MESA_NEW_NEED_EYE_COORDS
- *
- * Uses derived state from mesa:
- * _VP_inf_norm
- * _h_inf_norm
- * _Position
- * _NormDirection
- * _ModelViewInvScale
- * _NeedEyeCoords
- * _EyeZDir
- *
- * which are calculated in light.c and are correct for the current
- * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
- * and _MESA_NEW_NEED_EYE_COORDS.
- */
-void radeonUpdateLighting( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- /* Have to check these, or have an automatic shortcircuit mechanism
- * to remove noop statechanges. (Or just do a better job on the
- * front end).
- */
- {
- GLuint tmp = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
-
- if (ctx->_NeedEyeCoords)
- tmp &= ~RADEON_LIGHT_IN_MODELSPACE;
- else
- tmp |= RADEON_LIGHT_IN_MODELSPACE;
-
-
- /* Leave this test disabled: (unexplained q3 lockup) (even with
- new packets)
- */
- if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL])
- {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = tmp;
- }
- }
-
- {
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( eye );
- fcmd[EYE_X] = ctx->_EyeZDir[0];
- fcmd[EYE_Y] = ctx->_EyeZDir[1];
- fcmd[EYE_Z] = - ctx->_EyeZDir[2];
- fcmd[EYE_RESCALE_FACTOR] = ctx->_ModelViewInvScale;
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.eye );
- }
-
-
-/* RADEON_STATECHANGE( rmesa, glt ); */
-
- if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
- fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
- fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
- fcmd[LIT_DIRECTION_W] = 0;
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
- }
- }
-}
-
-
-void radeonLightfv( GLcontext *ctx, GLenum light,
- GLenum pname, const GLfloat *params )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLint p = light - GL_LIGHT0;
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd;
-
-
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- update_light_colors( ctx, p );
- break;
-
- case GL_SPOT_DIRECTION:
- /* picked up in update_light */
- break;
-
- case GL_POSITION: {
- /* positions picked up in update_light, but can do flag here */
- GLuint flag = (p&1)? RADEON_LIGHT_1_IS_LOCAL : RADEON_LIGHT_0_IS_LOCAL;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_SPOT_EXPONENT:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_EXPONENT] = params[0];
- break;
-
- case GL_SPOT_CUTOFF: {
- GLuint flag = (p&1) ? RADEON_LIGHT_1_IS_SPOT : RADEON_LIGHT_0_IS_SPOT;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_CUTOFF] = l->_CosCutoff;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->SpotCutoff != 180.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_CONSTANT_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_CONST] = params[0];
- break;
- case GL_LINEAR_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_LINEAR] = params[0];
- break;
- case GL_QUADRATIC_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_QUADRATIC] = params[0];
- break;
- default:
- return;
- }
-
-}
-
-
-
-
-void radeonLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- update_global_ambient( ctx );
- break;
-
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.LocalViewer)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LOCAL_VIEWER;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LOCAL_VIEWER;
- break;
-
- case GL_LIGHT_MODEL_TWO_SIDE:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.TwoSide)
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_LIGHT_TWOSIDE;
- else
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_LIGHT_TWOSIDE;
-
- check_twoside_fallback( ctx );
-
-#if _HAVE_SWTNL
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-#endif
- break;
-
- case GL_LIGHT_MODEL_COLOR_CONTROL:
- radeonUpdateSpecular(ctx);
-
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &=
- ~RADEON_DIFFUSE_SPECULAR_COMBINE;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |=
- RADEON_DIFFUSE_SPECULAR_COMBINE;
- break;
-
- default:
- break;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- union { int i; float f; } c, d;
- GLchan col[4];
-
- c.i = rmesa->hw.fog.cmd[FOG_C];
- d.i = rmesa->hw.fog.cmd[FOG_D];
-
- switch (pname) {
- case GL_FOG_MODE:
- if (!ctx->Fog.Enabled)
- return;
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_LINEAR;
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- }
- else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- break;
- case GL_EXP:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP;
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP2;
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- return;
- }
- break;
- case GL_FOG_DENSITY:
- switch (ctx->Fog.Mode) {
- case GL_EXP:
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- break;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- if (ctx->Fog.Mode == GL_LINEAR) {
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- } else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- }
- break;
- case GL_FOG_COLOR:
- RADEON_STATECHANGE( rmesa, ctx );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] =
- radeonPackColor( 4, col[0], col[1], col[2], 0 );
- break;
- case GL_FOG_COORDINATE_SOURCE_EXT:
- /* What to do?
- */
- break;
- default:
- return;
- }
-
- if (c.i != rmesa->hw.fog.cmd[FOG_C] || d.i != rmesa->hw.fog.cmd[FOG_D]) {
- RADEON_STATECHANGE( rmesa, fog );
- rmesa->hw.fog.cmd[FOG_C] = c.i;
- rmesa->hw.fog.cmd[FOG_D] = d.i;
- }
-}
-
-/* Examine lighting and texture state to determine if separate specular
- * should be enabled.
- */
-void radeonUpdateSpecular( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
-
- if (NEED_SECONDARY_COLOR(ctx)) {
- p |= RADEON_SPECULAR_ENABLE;
- } else {
- p &= ~RADEON_SPECULAR_ENABLE;
- }
-
- if ( rmesa->hw.ctx.cmd[CTX_PP_CNTL] != p ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = p;
- }
-
- /* Bizzare: have to leave lighting enabled to get fog.
- */
- RADEON_STATECHANGE( rmesa, tcl );
- if ((ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- }
- else if (ctx->Fog.Enabled) {
- if (ctx->Light.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- } else {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- }
- }
- else if (ctx->Light.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- } else if (ctx->Fog.ColorSumEnabled ) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
- } else {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
- }
-
-#if _HAVE_SWTNL
- /* Update vertex/render formats
- */
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-#endif
-}
-
-
-
-static void radeonLightingSpaceChange( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean tmp;
- RADEON_STATECHANGE( rmesa, tcl );
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d\n", __FUNCTION__, ctx->_NeedEyeCoords);
-
- if (ctx->_NeedEyeCoords)
- tmp = ctx->Transform.RescaleNormals;
- else
- tmp = !ctx->Transform.RescaleNormals;
-
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_RESCALE_NORMALS;
- }
-}
-
-void radeonInitLightStateFuncs( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- ctx->Driver.LightModelfv = radeonLightModelfv;
- ctx->Driver.Lightfv = radeonLightfv;
- ctx->Driver.Fogfv = radeonFogfv;
- ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange;
-
- for (i = 0 ; i < 8; i++) {
- struct gl_light *l = &ctx->Light.Light[i];
- GLenum p = GL_LIGHT0 + i;
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_RANGE_CUTOFF]) = FLT_MAX;
-
- ctx->Driver.Lightfv( ctx, p, GL_AMBIENT, l->Ambient );
- ctx->Driver.Lightfv( ctx, p, GL_DIFFUSE, l->Diffuse );
- ctx->Driver.Lightfv( ctx, p, GL_SPECULAR, l->Specular );
- ctx->Driver.Lightfv( ctx, p, GL_POSITION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_DIRECTION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_EXPONENT, &l->SpotExponent );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_CUTOFF, &l->SpotCutoff );
- ctx->Driver.Lightfv( ctx, p, GL_CONSTANT_ATTENUATION,
- &l->ConstantAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION,
- &l->LinearAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION,
- &l->QuadraticAttenuation );
- }
-
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
- ctx->Light.Model.Ambient );
-
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, 0 );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.c
deleted file mode 100644
index bb121fc58..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c,v 1.5 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#include "glheader.h"
-#include "radeon_context.h"
-#include "radeon_lock.h"
-#include "radeon_tex.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-
-#if DEBUG_LOCKING
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-#endif
-
-/* Turn on/off page flipping according to the flags in the sarea:
- */
-static void
-radeonUpdatePageFlipping( radeonContextPtr rmesa )
-{
- int use_back;
-
-
- rmesa->doPageFlip = rmesa->sarea->pfState;
-
- use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
- use_back ^= (rmesa->sarea->pfCurrentPage == 1);
-
- if ( RADEON_DEBUG & DEBUG_VERBOSE )
- fprintf(stderr, "%s allow %d current %d\n", __FUNCTION__,
- rmesa->doPageFlip,
- rmesa->sarea->pfCurrentPage );
-
- if ( use_back ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
- + rmesa->radeonScreen->fbLocation;
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
-}
-
-
-
-/* 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 radeonGetLock( radeonContextPtr rmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- __DRIscreenPrivate *sPriv = rmesa->dri.screen;
- drm_radeon_sarea_t *sarea = rmesa->sarea;
-
- drmGetLock( rmesa->dri.fd, rmesa->dri.hwContext, 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 ( rmesa->lastStamp != dPriv->lastStamp ) {
- radeonUpdatePageFlipping( rmesa );
- if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- radeonSetCliprects( rmesa, GL_BACK_LEFT );
- else
- radeonSetCliprects( rmesa, GL_FRONT_LEFT );
- radeonUpdateViewportOffset( rmesa->glCtx );
- rmesa->lastStamp = dPriv->lastStamp;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= RADEON_COLOR_TILE_ENABLE;
- }
- else rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] &= ~RADEON_COLOR_TILE_ENABLE;
-
- if ( sarea->ctx_owner != rmesa->dri.hwContext ) {
- int i;
- sarea->ctx_owner = rmesa->dri.hwContext;
-
- for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( rmesa->texture_heaps[ i ] );
- }
- }
-
- rmesa->lost_context = GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.h
deleted file mode 100644
index 4e8617eb8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_lock.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.h,v 1.3 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_LOCK_H__
-#define __RADEON_LOCK_H__
-
-extern void radeonGetLock( radeonContextPtr rmesa, 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( rmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( rmesa->dri.hwLock, rmesa->dri.hwContext, \
- (DRM_LOCK_HELD | rmesa->dri.hwContext), __ret ); \
- if ( __ret ) \
- radeonGetLock( rmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-#define UNLOCK_HARDWARE( rmesa ) \
- do { \
- DRM_UNLOCK( rmesa->dri.fd, \
- rmesa->dri.hwLock, \
- rmesa->dri.hwContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif /* __RADEON_LOCK_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.c
deleted file mode 100644
index c62edd715..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.c
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-/* If using new packets, can choose either verts or arrays.
- * Otherwise, must use verts.
- */
-#include "radeon_context.h"
-#define RADEON_MAOS_VERTS 1
-#if (RADEON_MAOS_VERTS) || (RADEON_OLD_PACKETS)
-#include "radeon_maos_verts.c"
-#else
-#include "radeon_maos_arrays.c"
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.h
deleted file mode 100644
index 09039d684..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos.h,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Grahpics Inc., Austin, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_MAOS_H__
-#define __RADEON_MAOS_H__
-
-#include "radeon_context.h"
-
-extern void radeonEmitArrays( GLcontext *ctx, GLuint inputs );
-extern void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
deleted file mode 100644
index 98f66898c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c
+++ /dev/null
@@ -1,604 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos_arrays.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "macros.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_swtcl.h"
-#include "radeon_maos.h"
-
-#if 0
-/* Usage:
- * - from radeon_tcl_render
- * - call radeonEmitArrays to ensure uptodate arrays in dma
- * - emit primitives (new type?) which reference the data
- * -- need to use elts for lineloop, quads, quadstrip/flat
- * -- other primitives are all well-formed (need tristrip-1,fake-poly)
- *
- */
-static void emit_ubyte_rgba3( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- radeon_color_t *out = (radeon_color_t *)(rvb->start + rvb->address);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p\n",
- __FUNCTION__, count, stride, (void *)out);
-
- for (i = 0; i < count; i++) {
- out->red = *data;
- out->green = *(data+1);
- out->blue = *(data+2);
- out->alpha = 0xFF;
- out++;
- data += stride;
- }
-}
-
-static void emit_ubyte_rgba4( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4)
- COPY_DWORDS( out, data, count );
- else
- for (i = 0; i < count; i++) {
- *out++ = LE32_TO_CPU(*(int *)data);
- data += stride;
- }
-}
-
-
-static void emit_ubyte_rgba( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- radeonAllocDmaRegion( rmesa, rvb, 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = 1;
- }
- else {
- radeonAllocDmaRegion( rmesa, rvb, 4 * count, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 1;
- rvb->aos_size = 1;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 3:
- emit_ubyte_rgba3( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_ubyte_rgba4( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-}
-#endif
-
-#if defined(USE_X86_ASM)
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (__tmp), "=D" (dst), "=S" (__tmp) \
- : "0" (nr), \
- "D" ((long)dst), \
- "S" ((long)src) ); \
-} while (0)
-#else
-#define COPY_DWORDS( dst, src, nr ) \
-do { \
- int j; \
- for ( j = 0 ; j < nr ; j++ ) \
- dst[j] = ((int *)src)[j]; \
- dst += nr; \
-} while (0)
-#endif
-
-
-static void emit_vec4( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 4)
- COPY_DWORDS( out, data, count );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out++;
- data += stride;
- }
-}
-
-
-static void emit_vec8( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 8)
- COPY_DWORDS( out, data, count*2 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out += 2;
- data += stride;
- }
-}
-
-static void emit_vec12( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d out %p data %p\n",
- __FUNCTION__, count, stride, (void *)out, (void *)data);
-
- if (stride == 12)
- COPY_DWORDS( out, data, count*3 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out += 3;
- data += stride;
- }
-}
-
-static void emit_vec16( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- if (stride == 16)
- COPY_DWORDS( out, data, count*4 );
- else
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+8);
- out[3] = *(int *)(data+12);
- out += 4;
- data += stride;
- }
-}
-
-
-static void emit_vector( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d size %d stride %d\n",
- __FUNCTION__, count, size, stride);
-
- assert (!rvb->buf);
-
- if (stride == 0) {
- radeonAllocDmaRegion( rmesa, rvb, size * 4, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = size;
- }
- else {
- radeonAllocDmaRegion( rmesa, rvb, size * count * 4, 4 ); /* alignment? */
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = size;
- rvb->aos_size = size;
- }
-
- /* Emit the data
- */
- switch (size) {
- case 1:
- emit_vec4( ctx, rvb, data, stride, count );
- break;
- case 2:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 3:
- emit_vec12( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_vec16( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-
-}
-
-
-
-static void emit_s0_vec( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = 0;
- out += 2;
- data += stride;
- }
-}
-
-static void emit_stq_vec( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int stride,
- int count )
-{
- int i;
- int *out = (int *)(rvb->address + rvb->start);
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s count %d stride %d\n",
- __FUNCTION__, count, stride);
-
- for (i = 0; i < count; i++) {
- out[0] = *(int *)data;
- out[1] = *(int *)(data+4);
- out[2] = *(int *)(data+12);
- out += 3;
- data += stride;
- }
-}
-
-
-
-
-static void emit_tex_vector( GLcontext *ctx,
- struct radeon_dma_region *rvb,
- char *data,
- int size,
- int stride,
- int count )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int emitsize;
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s %d/%d\n", __FUNCTION__, count, size);
-
- assert (!rvb->buf);
-
- switch (size) {
- case 4: emitsize = 3; break;
- default: emitsize = 2; break;
- }
-
-
- if (stride == 0) {
- radeonAllocDmaRegion( rmesa, rvb, 4 * emitsize, 4 );
- count = 1;
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = 0;
- rvb->aos_size = emitsize;
- }
- else {
- radeonAllocDmaRegion( rmesa, rvb, 4 * emitsize * count, 4 );
- rvb->aos_start = GET_START(rvb);
- rvb->aos_stride = emitsize;
- rvb->aos_size = emitsize;
- }
-
-
- /* Emit the data
- */
- switch (size) {
- case 1:
- emit_s0_vec( ctx, rvb, data, stride, count );
- break;
- case 2:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 3:
- emit_vec8( ctx, rvb, data, stride, count );
- break;
- case 4:
- emit_stq_vec( ctx, rvb, data, stride, count );
- break;
- default:
- assert(0);
- exit(1);
- break;
- }
-}
-
-
-
-
-/* Emit any changed arrays to new GART memory, re-emit a packet to
- * update the arrays.
- */
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
- struct radeon_dma_region **component = rmesa->tcl.aos_components;
- GLuint nr = 0;
- GLuint vfmt = 0;
- GLuint count = VB->Count;
- GLuint vtx;
-
-#if 0
- if (RADEON_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, inputs );
-#endif
-
- if (1) {
- if (!rmesa->tcl.obj.buf)
- emit_vector( ctx,
- &rmesa->tcl.obj,
- (char *)VB->ObjPtr->data,
- VB->ObjPtr->size,
- VB->ObjPtr->stride,
- count);
-
- switch( VB->ObjPtr->size ) {
- case 4: vfmt |= RADEON_CP_VC_FRMT_W0;
- case 3: vfmt |= RADEON_CP_VC_FRMT_Z;
- case 2: vfmt |= RADEON_CP_VC_FRMT_XY;
- default:
- break;
- }
- component[nr++] = &rmesa->tcl.obj;
- }
-
-
- if (inputs & VERT_BIT_NORMAL) {
- if (!rmesa->tcl.norm.buf)
- emit_vector( ctx,
- &(rmesa->tcl.norm),
- (char *)VB->NormalPtr->data,
- 3,
- VB->NormalPtr->stride,
- count);
-
- vfmt |= RADEON_CP_VC_FRMT_N0;
- component[nr++] = &rmesa->tcl.norm;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- int emitsize;
- if (VB->ColorPtr[0]->size == 4 &&
- (VB->ColorPtr[0]->stride != 0 ||
- VB->ColorPtr[0]->data[0][3] != 1.0)) {
- vfmt |= RADEON_CP_VC_FRMT_FPCOLOR | RADEON_CP_VC_FRMT_FPALPHA;
- emitsize = 4;
- }
-
- else {
- vfmt |= RADEON_CP_VC_FRMT_FPCOLOR;
- emitsize = 3;
- }
-
- if (!rmesa->tcl.rgba.buf)
- emit_vector( ctx,
- &(rmesa->tcl.rgba),
- (char *)VB->ColorPtr[0]->data,
- emitsize,
- VB->ColorPtr[0]->stride,
- count);
-
-
- component[nr++] = &rmesa->tcl.rgba;
- }
-
-
- if (inputs & VERT_BIT_COLOR1) {
- if (!rmesa->tcl.spec.buf) {
-
- emit_vector( ctx,
- &rmesa->tcl.spec,
- (char *)VB->SecondaryColorPtr[0]->data,
- 3,
- VB->SecondaryColorPtr[0]->stride,
- count);
- }
-
- vfmt |= RADEON_CP_VC_FRMT_FPSPEC;
- component[nr++] = &rmesa->tcl.spec;
- }
-
- vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &
- ~(RADEON_TCL_VTX_Q0|RADEON_TCL_VTX_Q1));
-
- if (inputs & VERT_BIT_TEX0) {
- if (!rmesa->tcl.tex[0].buf)
- emit_tex_vector( ctx,
- &(rmesa->tcl.tex[0]),
- (char *)VB->TexCoordPtr[0]->data,
- VB->TexCoordPtr[0]->size,
- VB->TexCoordPtr[0]->stride,
- count );
-
- switch( VB->TexCoordPtr[0]->size ) {
- case 4:
- vtx |= RADEON_TCL_VTX_Q0;
- vfmt |= RADEON_CP_VC_FRMT_Q0;
- default:
- vfmt |= RADEON_CP_VC_FRMT_ST0;
- }
- component[nr++] = &rmesa->tcl.tex[0];
- }
-
- if (inputs & VERT_BIT_TEX1) {
- if (!rmesa->tcl.tex[1].buf)
- emit_tex_vector( ctx,
- &(rmesa->tcl.tex[1]),
- (char *)VB->TexCoordPtr[1]->data,
- VB->TexCoordPtr[1]->size,
- VB->TexCoordPtr[1]->stride,
- count );
-
- switch( VB->TexCoordPtr[1]->size ) {
- case 4:
- vtx |= RADEON_TCL_VTX_Q1;
- vfmt |= RADEON_CP_VC_FRMT_Q1;
- default:
- vfmt |= RADEON_CP_VC_FRMT_ST1;
- }
- component[nr++] = &rmesa->tcl.tex[1];
- }
-
- if (vtx != rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT]) {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] = vtx;
- }
-
- rmesa->tcl.nr_aos_components = nr;
- rmesa->tcl.vertex_format = vfmt;
-}
-
-
-void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
-#if 0
- if (RADEON_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, newinputs );
-#endif
-
- if (newinputs & VERT_BIT_POS)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_NORMAL)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR0)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.rgba, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_COLOR1)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
-
- if (newinputs & VERT_BIT_TEX0)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ );
-
- if (newinputs & VERT_BIT_TEX1)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
deleted file mode 100644
index c16234a94..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h
+++ /dev/null
@@ -1,284 +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>
- */
-
-#ifndef LOCALVARS
-#define LOCALVARS
-#endif
-
-#undef TCL_DEBUG
-#ifndef TCL_DEBUG
-#define TCL_DEBUG 0
-#endif
-
-static void TAG(emit)( GLcontext *ctx,
- GLuint start, GLuint end,
- void *dest )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint (*tc0)[4], (*tc1)[4], (*tc2)[4];
- GLfloat (*col)[4], (*spec)[4];
- GLfloat (*fog)[4];
- GLuint (*norm)[4];
- GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
- GLuint tc2_stride, norm_stride;
- GLuint fill_tex = 0;
- GLuint (*coord)[4];
- GLuint coord_stride; /* object coordinates */
- GLubyte dummy[4];
- int i;
-
- union emit_union *v = (union emit_union *)dest;
-
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- coord = (GLuint (*)[4])VB->ObjPtr->data;
- coord_stride = VB->ObjPtr->stride;
-
- if (DO_TEX2) {
- if (VB->TexCoordPtr[2]) {
- const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
- fill_tex |= (1<<2);
- }
- } else {
- tc2 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX2];
- tc2_stride = 0;
- }
- }
-
- if (DO_TEX1) {
- if (VB->TexCoordPtr[1]) {
- const GLuint t1 = GET_TEXSOURCE(1);
- tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data;
- tc1_stride = VB->TexCoordPtr[t1]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) {
- fill_tex |= (1<<1);
- }
- } else {
- tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1];
- tc1_stride = 0;
- }
- }
-
- if (DO_TEX0) {
- if (VB->TexCoordPtr[0]) {
- const GLuint t0 = GET_TEXSOURCE(0);
- tc0_stride = VB->TexCoordPtr[t0]->stride;
- tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data;
- if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) {
- fill_tex |= (1<<0);
- }
- } else {
- tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- tc0_stride = 0;
- }
-
- }
-
- if (DO_NORM) {
- if (VB->NormalPtr) {
- norm_stride = VB->NormalPtr->stride;
- norm = (GLuint (*)[4])VB->NormalPtr->data;
- } else {
- norm_stride = 0;
- norm = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
- }
- }
-
- if (DO_RGBA) {
- if (VB->ColorPtr[0]) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
- } else {
- col = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- col_stride = 0;
- }
- }
-
- if (DO_SPEC) {
- if (VB->SecondaryColorPtr[0]) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
- } else {
- spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
- spec_stride = 0;
- }
- }
-
- if (DO_FOG) {
- if (VB->FogCoordPtr) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
- } else {
- fog = (GLfloat (*)[4])&dummy; fog[0][0] = 0.0F;
- fog_stride = 0;
- }
- }
-
-
- if (start) {
- coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride);
- if (DO_TEX0)
- tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (DO_TEX1)
- tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (DO_TEX2)
- tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride);
- if (DO_NORM)
- norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride);
- if (DO_RGBA)
- STRIDE_4F(col, start * col_stride);
- if (DO_SPEC)
- STRIDE_4F(spec, start * spec_stride);
- if (DO_FOG)
- STRIDE_4F(fog, start * fog_stride);
- }
-
-
- {
- for (i=start; i < end; i++) {
-
- v[0].ui = coord[0][0];
- v[1].ui = coord[0][1];
- v[2].ui = coord[0][2];
- if (DO_W) {
- v[3].ui = coord[0][3];
- v += 4;
- }
- else
- v += 3;
- coord = (GLuint (*)[4])((GLubyte *)coord + coord_stride);
-
- if (DO_NORM) {
- v[0].ui = norm[0][0];
- v[1].ui = norm[0][1];
- v[2].ui = norm[0][2];
- v += 3;
- norm = (GLuint (*)[4])((GLubyte *)norm + norm_stride);
- }
- if (DO_RGBA) {
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, col[0][0]);
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, col[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, col[0][2]);
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, col[0][3]);
- STRIDE_4F(col, col_stride);
- v++;
- }
- if (DO_SPEC || DO_FOG) {
- if (DO_SPEC) {
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, spec[0][0]);
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, spec[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, spec[0][2]);
- STRIDE_4F(spec, spec_stride);
- }
- if (DO_FOG) {
- UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, fog[0][0]);
- fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
- }
- if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
- v++;
- }
- if (DO_TEX0) {
- v[0].ui = tc0[0][0];
- v[1].ui = tc0[0][1];
- if (TCL_DEBUG) fprintf(stderr, "t0: %.2f %.2f ", v[0].f, v[1].f);
- if (DO_PTEX) {
- if (fill_tex & (1<<0))
- v[2].f = 1.0;
- else
- v[2].ui = tc0[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
- v += 3;
- }
- else
- v += 2;
- tc0 = (GLuint (*)[4])((GLubyte *)tc0 + tc0_stride);
- }
- if (DO_TEX1) {
- v[0].ui = tc1[0][0];
- v[1].ui = tc1[0][1];
- if (TCL_DEBUG) fprintf(stderr, "t1: %.2f %.2f ", v[0].f, v[1].f);
- if (DO_PTEX) {
- if (fill_tex & (1<<1))
- v[2].f = 1.0;
- else
- v[2].ui = tc1[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
- v += 3;
- }
- else
- v += 2;
- tc1 = (GLuint (*)[4])((GLubyte *)tc1 + tc1_stride);
- }
- if (DO_TEX2) {
- v[0].ui = tc2[0][0];
- v[1].ui = tc2[0][1];
- if (DO_PTEX) {
- if (fill_tex & (1<<2))
- v[2].f = 1.0;
- else
- v[2].ui = tc2[0][3];
- v += 3;
- }
- else
- v += 2;
- tc2 = (GLuint (*)[4])((GLubyte *)tc2 + tc2_stride);
- }
- if (TCL_DEBUG) fprintf(stderr, "\n");
- }
- }
-}
-
-
-
-static void TAG(init)( void )
-{
- int sz = 3;
- if (DO_W) sz++;
- if (DO_NORM) sz += 3;
- if (DO_RGBA) sz++;
- if (DO_SPEC || DO_FOG) sz++;
- if (DO_TEX0) sz += 2;
- if (DO_TEX0 && DO_PTEX) sz++;
- if (DO_TEX1) sz += 2;
- if (DO_TEX1 && DO_PTEX) sz++;
- if (DO_TEX2) sz += 2;
- if (DO_TEX2 && DO_PTEX) sz++;
-
- setup_tab[IDX].emit = TAG(emit);
- setup_tab[IDX].vertex_format = IND;
- setup_tab[IDX].vertex_size = sz;
-}
-
-
-#undef IND
-#undef TAG
-#undef IDX
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
deleted file mode 100644
index 8cb08a812..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_maos_verts.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Austin, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "array_cache/acache.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "math/m_translate.h"
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_swtcl.h"
-#include "radeon_maos.h"
-
-
-#define RADEON_TCL_MAX_SETUP 13
-
-union emit_union { float f; GLuint ui; radeon_color_t rgba; };
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void * );
- GLuint vertex_size;
- GLuint vertex_format;
-} setup_tab[RADEON_TCL_MAX_SETUP];
-
-#define DO_W (IND & RADEON_CP_VC_FRMT_W0)
-#define DO_RGBA (IND & RADEON_CP_VC_FRMT_PKCOLOR)
-#define DO_SPEC (IND & RADEON_CP_VC_FRMT_PKSPEC)
-#define DO_FOG (IND & RADEON_CP_VC_FRMT_PKSPEC)
-#define DO_TEX0 (IND & RADEON_CP_VC_FRMT_ST0)
-#define DO_TEX1 (IND & RADEON_CP_VC_FRMT_ST1)
-#define DO_PTEX (IND & RADEON_CP_VC_FRMT_Q0)
-#define DO_NORM (IND & RADEON_CP_VC_FRMT_N0)
-
-#define DO_TEX2 0
-#define DO_TEX3 0
-
-#define GET_TEXSOURCE(n) n
-
-/***********************************************************************
- * Generate vertex emit functions *
- ***********************************************************************/
-
-
-/* Defined in order of increasing vertex size:
- */
-#define IDX 0
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR)
-#define TAG(x) x##_rgba
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 1
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 2
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0)
-#define TAG(x) x##_rgba_st
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 3
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgba_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 4
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 5
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1)
-#define TAG(x) x##_rgba_st_st
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 6
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgba_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 7
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_PKSPEC| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1)
-#define TAG(x) x##_rgba_spec_st_st
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 8
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_st_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 9
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_PKSPEC| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_rgba_spec_st_st_n
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 10
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_Q0)
-#define TAG(x) x##_rgba_stq
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 11
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_Q1| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_Q0)
-#define TAG(x) x##_rgba_stq_stq
-#include "radeon_maos_vbtmp.h"
-
-#define IDX 12
-#define IND (RADEON_CP_VC_FRMT_XY| \
- RADEON_CP_VC_FRMT_Z| \
- RADEON_CP_VC_FRMT_W0| \
- RADEON_CP_VC_FRMT_PKCOLOR| \
- RADEON_CP_VC_FRMT_PKSPEC| \
- RADEON_CP_VC_FRMT_ST0| \
- RADEON_CP_VC_FRMT_Q0| \
- RADEON_CP_VC_FRMT_ST1| \
- RADEON_CP_VC_FRMT_Q1| \
- RADEON_CP_VC_FRMT_N0)
-#define TAG(x) x##_w_rgba_spec_stq_stq_n
-#include "radeon_maos_vbtmp.h"
-
-
-
-
-
-/***********************************************************************
- * Initialization
- ***********************************************************************/
-
-
-static void init_tcl_verts( void )
-{
- init_rgba();
- init_n();
- init_rgba_n();
- init_rgba_st();
- init_st_n();
- init_rgba_st_st();
- init_rgba_st_n();
- init_rgba_spec_st_st();
- init_st_st_n();
- init_rgba_spec_st_st_n();
- init_rgba_stq();
- init_rgba_stq_stq();
- init_w_rgba_spec_stq_stq_n();
-}
-
-
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint req = 0;
- GLuint vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &
- ~(RADEON_TCL_VTX_Q0|RADEON_TCL_VTX_Q1));
- int i;
- static int firsttime = 1;
-
- if (firsttime) {
- init_tcl_verts();
- firsttime = 0;
- }
-
- if (1) {
- req |= RADEON_CP_VC_FRMT_Z;
- if (VB->ObjPtr->size == 4) {
- req |= RADEON_CP_VC_FRMT_W0;
- }
- }
-
- if (inputs & VERT_BIT_NORMAL) {
- req |= RADEON_CP_VC_FRMT_N0;
- }
-
- if (inputs & VERT_BIT_COLOR0) {
- req |= RADEON_CP_VC_FRMT_PKCOLOR;
- }
-
- if (inputs & VERT_BIT_COLOR1) {
- req |= RADEON_CP_VC_FRMT_PKSPEC;
- }
-
- if (inputs & VERT_BIT_TEX0) {
- req |= RADEON_CP_VC_FRMT_ST0;
-
- if (VB->TexCoordPtr[0]->size == 4) {
- req |= RADEON_CP_VC_FRMT_Q0;
- vtx |= RADEON_TCL_VTX_Q0;
- }
- }
-
- if (inputs & VERT_BIT_TEX1) {
- req |= RADEON_CP_VC_FRMT_ST1;
-
- if (VB->TexCoordPtr[1]->size == 4) {
- req |= RADEON_CP_VC_FRMT_Q1;
- vtx |= RADEON_TCL_VTX_Q1;
- }
- }
-
- if (vtx != rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT]) {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] = vtx;
- }
-
- for (i = 0 ; i < RADEON_TCL_MAX_SETUP ; i++)
- if ((setup_tab[i].vertex_format & req) == req)
- break;
-
- if (rmesa->tcl.vertex_format == setup_tab[i].vertex_format &&
- rmesa->tcl.indexed_verts.buf)
- return;
-
- if (rmesa->tcl.indexed_verts.buf)
- radeonReleaseArrays( ctx, ~0 );
-
- radeonAllocDmaRegionVerts( rmesa,
- &rmesa->tcl.indexed_verts,
- VB->Count,
- setup_tab[i].vertex_size * 4,
- 4);
-
- /* The vertex code expects Obj to be clean to element 3. To fix
- * this, add more vertex code (for obj-2, obj-3) or preferably move
- * to maos.
- */
- if (VB->ObjPtr->size < 3 ||
- (VB->ObjPtr->size == 3 &&
- (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0))) {
-
- _math_trans_4f( rmesa->tcl.ObjClean.data,
- VB->ObjPtr->data,
- VB->ObjPtr->stride,
- GL_FLOAT,
- VB->ObjPtr->size,
- 0,
- VB->Count );
-
- switch (VB->ObjPtr->size) {
- case 1:
- _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 1);
- case 2:
- _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 2);
- case 3:
- if (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0) {
- _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 3);
- }
- case 4:
- default:
- break;
- }
-
- VB->ObjPtr = &rmesa->tcl.ObjClean;
- }
-
-
-
- setup_tab[i].emit( ctx, 0, VB->Count,
- rmesa->tcl.indexed_verts.address +
- rmesa->tcl.indexed_verts.start );
-
- rmesa->tcl.vertex_format = setup_tab[i].vertex_format;
- rmesa->tcl.indexed_verts.aos_start = GET_START( &rmesa->tcl.indexed_verts );
- rmesa->tcl.indexed_verts.aos_size = setup_tab[i].vertex_size;
- rmesa->tcl.indexed_verts.aos_stride = setup_tab[i].vertex_size;
-
- rmesa->tcl.aos_components[0] = &rmesa->tcl.indexed_verts;
- rmesa->tcl.nr_aos_components = 1;
-}
-
-
-
-void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
-#if 0
- if (RADEON_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, newinputs );
-#endif
-
- if (newinputs)
- radeonReleaseDmaRegion( rmesa, &rmesa->tcl.indexed_verts, __FUNCTION__ );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.c
deleted file mode 100644
index 84112464e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.c
+++ /dev/null
@@ -1,1070 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_sanity.c,v 1.1 2002/10/30 12:51:55 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc, Cedar Park, TX.
-
-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, 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
-ATI, TUNGSTEN GRAPHICS 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-#include <errno.h>
-
-#include "glheader.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_sanity.h"
-
-/* Set this '1' to get more verbiage.
- */
-#define MORE_VERBOSE 1
-
-#if MORE_VERBOSE
-#define VERBOSE (RADEON_DEBUG & DEBUG_VERBOSE)
-#define NORMAL (1)
-#else
-#define VERBOSE 0
-#define NORMAL (RADEON_DEBUG & DEBUG_VERBOSE)
-#endif
-
-
-/* New (1.3) state mechanism. 3 commands (packet, scalar, vector) in
- * 1.3 cmdbuffers allow all previous state to be updated as well as
- * the tcl scalar and vector areas.
- */
-static struct {
- int start;
- int len;
- const char *name;
-} packet[RADEON_MAX_STATE_PACKETS] = {
- { RADEON_PP_MISC,7,"RADEON_PP_MISC" },
- { RADEON_PP_CNTL,3,"RADEON_PP_CNTL" },
- { RADEON_RB3D_COLORPITCH,1,"RADEON_RB3D_COLORPITCH" },
- { RADEON_RE_LINE_PATTERN,2,"RADEON_RE_LINE_PATTERN" },
- { RADEON_SE_LINE_WIDTH,1,"RADEON_SE_LINE_WIDTH" },
- { RADEON_PP_LUM_MATRIX,1,"RADEON_PP_LUM_MATRIX" },
- { RADEON_PP_ROT_MATRIX_0,2,"RADEON_PP_ROT_MATRIX_0" },
- { RADEON_RB3D_STENCILREFMASK,3,"RADEON_RB3D_STENCILREFMASK" },
- { RADEON_SE_VPORT_XSCALE,6,"RADEON_SE_VPORT_XSCALE" },
- { RADEON_SE_CNTL,2,"RADEON_SE_CNTL" },
- { RADEON_SE_CNTL_STATUS,1,"RADEON_SE_CNTL_STATUS" },
- { RADEON_RE_MISC,1,"RADEON_RE_MISC" },
- { RADEON_PP_TXFILTER_0,6,"RADEON_PP_TXFILTER_0" },
- { RADEON_PP_BORDER_COLOR_0,1,"RADEON_PP_BORDER_COLOR_0" },
- { RADEON_PP_TXFILTER_1,6,"RADEON_PP_TXFILTER_1" },
- { RADEON_PP_BORDER_COLOR_1,1,"RADEON_PP_BORDER_COLOR_1" },
- { RADEON_PP_TXFILTER_2,6,"RADEON_PP_TXFILTER_2" },
- { RADEON_PP_BORDER_COLOR_2,1,"RADEON_PP_BORDER_COLOR_2" },
- { RADEON_SE_ZBIAS_FACTOR,2,"RADEON_SE_ZBIAS_FACTOR" },
- { RADEON_SE_TCL_OUTPUT_VTX_FMT,11,"RADEON_SE_TCL_OUTPUT_VTX_FMT" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED,17,"RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED" },
- { 0, 4, "R200_PP_TXCBLEND_0" },
- { 0, 4, "R200_PP_TXCBLEND_1" },
- { 0, 4, "R200_PP_TXCBLEND_2" },
- { 0, 4, "R200_PP_TXCBLEND_3" },
- { 0, 4, "R200_PP_TXCBLEND_4" },
- { 0, 4, "R200_PP_TXCBLEND_5" },
- { 0, 4, "R200_PP_TXCBLEND_6" },
- { 0, 4, "R200_PP_TXCBLEND_7" },
- { 0, 6, "R200_SE_TCL_LIGHT_MODEL_CTL_0" },
- { 0, 6, "R200_PP_TFACTOR_0" },
- { 0, 4, "R200_SE_VTX_FMT_0" },
- { 0, 1, "R200_SE_VAP_CNTL" },
- { 0, 5, "R200_SE_TCL_MATRIX_SEL_0" },
- { 0, 5, "R200_SE_TCL_TEX_PROC_CTL_2" },
- { 0, 1, "R200_SE_TCL_UCP_VERT_BLEND_CTL" },
- { 0, 6, "R200_PP_TXFILTER_0" },
- { 0, 6, "R200_PP_TXFILTER_1" },
- { 0, 6, "R200_PP_TXFILTER_2" },
- { 0, 6, "R200_PP_TXFILTER_3" },
- { 0, 6, "R200_PP_TXFILTER_4" },
- { 0, 6, "R200_PP_TXFILTER_5" },
- { 0, 1, "R200_PP_TXOFFSET_0" },
- { 0, 1, "R200_PP_TXOFFSET_1" },
- { 0, 1, "R200_PP_TXOFFSET_2" },
- { 0, 1, "R200_PP_TXOFFSET_3" },
- { 0, 1, "R200_PP_TXOFFSET_4" },
- { 0, 1, "R200_PP_TXOFFSET_5" },
- { 0, 1, "R200_SE_VTE_CNTL" },
- { 0, 1, "R200_SE_TCL_OUTPUT_VTX_COMP_SEL" },
- { 0, 1, "R200_PP_TAM_DEBUG3" },
- { 0, 1, "R200_PP_CNTL_X" },
- { 0, 1, "R200_RB3D_DEPTHXY_OFFSET" },
- { 0, 1, "R200_RE_AUX_SCISSOR_CNTL" },
- { 0, 2, "R200_RE_SCISSOR_TL_0" },
- { 0, 2, "R200_RE_SCISSOR_TL_1" },
- { 0, 2, "R200_RE_SCISSOR_TL_2" },
- { 0, 1, "R200_SE_VAP_CNTL_STATUS" },
- { 0, 1, "R200_SE_VTX_STATE_CNTL" },
- { 0, 1, "R200_RE_POINTSIZE" },
- { 0, 4, "R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0" },
- { 0, 1, "R200_PP_CUBIC_FACES_0" }, /* 61 */
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_0" }, /* 62 */
- { 0, 1, "R200_PP_CUBIC_FACES_1" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_1" },
- { 0, 1, "R200_PP_CUBIC_FACES_2" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_2" },
- { 0, 1, "R200_PP_CUBIC_FACES_3" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_3" },
- { 0, 1, "R200_PP_CUBIC_FACES_4" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_4" },
- { 0, 1, "R200_PP_CUBIC_FACES_5" },
- { 0, 5, "R200_PP_CUBIC_OFFSET_F1_5" },
- { RADEON_PP_TEX_SIZE_0, 2, "RADEON_PP_TEX_SIZE_0" },
- { RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" },
- { RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_2" },
- { 0, 3, "R200_RB3D_BLENDCOLOR" },
- { 0, 1, "R200_SE_TCL_POINT_SPRITE_CNTL" },
- { RADEON_PP_CUBIC_FACES_0, 1, "RADEON_PP_CUBIC_FACES_0" },
- { RADEON_PP_CUBIC_OFFSET_T0_0, 5, "RADEON_PP_CUBIC_OFFSET_T0_0" },
- { RADEON_PP_CUBIC_FACES_1, 1, "RADEON_PP_CUBIC_FACES_1" },
- { RADEON_PP_CUBIC_OFFSET_T1_0, 5, "RADEON_PP_CUBIC_OFFSET_T1_0" },
- { RADEON_PP_CUBIC_FACES_2, 1, "RADEON_PP_CUBIC_FACES_2" },
- { RADEON_PP_CUBIC_OFFSET_T2_0, 5, "RADEON_PP_CUBIC_OFFSET_T2_0" },
- { 0, 2, "R200_PP_TRI_PERF" },
-};
-
-struct reg_names {
- int idx;
- const char *name;
-};
-
-static struct reg_names reg_names[] = {
- { RADEON_PP_MISC, "RADEON_PP_MISC" },
- { RADEON_PP_FOG_COLOR, "RADEON_PP_FOG_COLOR" },
- { RADEON_RE_SOLID_COLOR, "RADEON_RE_SOLID_COLOR" },
- { RADEON_RB3D_BLENDCNTL, "RADEON_RB3D_BLENDCNTL" },
- { RADEON_RB3D_DEPTHOFFSET, "RADEON_RB3D_DEPTHOFFSET" },
- { RADEON_RB3D_DEPTHPITCH, "RADEON_RB3D_DEPTHPITCH" },
- { RADEON_RB3D_ZSTENCILCNTL, "RADEON_RB3D_ZSTENCILCNTL" },
- { RADEON_PP_CNTL, "RADEON_PP_CNTL" },
- { RADEON_RB3D_CNTL, "RADEON_RB3D_CNTL" },
- { RADEON_RB3D_COLOROFFSET, "RADEON_RB3D_COLOROFFSET" },
- { RADEON_RB3D_COLORPITCH, "RADEON_RB3D_COLORPITCH" },
- { RADEON_SE_CNTL, "RADEON_SE_CNTL" },
- { RADEON_SE_COORD_FMT, "RADEON_SE_COORDFMT" },
- { RADEON_SE_CNTL_STATUS, "RADEON_SE_CNTL_STATUS" },
- { RADEON_RE_LINE_PATTERN, "RADEON_RE_LINE_PATTERN" },
- { RADEON_RE_LINE_STATE, "RADEON_RE_LINE_STATE" },
- { RADEON_SE_LINE_WIDTH, "RADEON_SE_LINE_WIDTH" },
- { RADEON_RB3D_STENCILREFMASK, "RADEON_RB3D_STENCILREFMASK" },
- { RADEON_RB3D_ROPCNTL, "RADEON_RB3D_ROPCNTL" },
- { RADEON_RB3D_PLANEMASK, "RADEON_RB3D_PLANEMASK" },
- { RADEON_SE_VPORT_XSCALE, "RADEON_SE_VPORT_XSCALE" },
- { RADEON_SE_VPORT_XOFFSET, "RADEON_SE_VPORT_XOFFSET" },
- { RADEON_SE_VPORT_YSCALE, "RADEON_SE_VPORT_YSCALE" },
- { RADEON_SE_VPORT_YOFFSET, "RADEON_SE_VPORT_YOFFSET" },
- { RADEON_SE_VPORT_ZSCALE, "RADEON_SE_VPORT_ZSCALE" },
- { RADEON_SE_VPORT_ZOFFSET, "RADEON_SE_VPORT_ZOFFSET" },
- { RADEON_RE_MISC, "RADEON_RE_MISC" },
- { RADEON_PP_TXFILTER_0, "RADEON_PP_TXFILTER_0" },
- { RADEON_PP_TXFILTER_1, "RADEON_PP_TXFILTER_1" },
- { RADEON_PP_TXFILTER_2, "RADEON_PP_TXFILTER_2" },
- { RADEON_PP_TXFORMAT_0, "RADEON_PP_TXFORMAT_0" },
- { RADEON_PP_TXFORMAT_1, "RADEON_PP_TXFORMAT_1" },
- { RADEON_PP_TXFORMAT_2, "RADEON_PP_TXFORMAT_2" },
- { RADEON_PP_TXOFFSET_0, "RADEON_PP_TXOFFSET_0" },
- { RADEON_PP_TXOFFSET_1, "RADEON_PP_TXOFFSET_1" },
- { RADEON_PP_TXOFFSET_2, "RADEON_PP_TXOFFSET_2" },
- { RADEON_PP_TXCBLEND_0, "RADEON_PP_TXCBLEND_0" },
- { RADEON_PP_TXCBLEND_1, "RADEON_PP_TXCBLEND_1" },
- { RADEON_PP_TXCBLEND_2, "RADEON_PP_TXCBLEND_2" },
- { RADEON_PP_TXABLEND_0, "RADEON_PP_TXABLEND_0" },
- { RADEON_PP_TXABLEND_1, "RADEON_PP_TXABLEND_1" },
- { RADEON_PP_TXABLEND_2, "RADEON_PP_TXABLEND_2" },
- { RADEON_PP_TFACTOR_0, "RADEON_PP_TFACTOR_0" },
- { RADEON_PP_TFACTOR_1, "RADEON_PP_TFACTOR_1" },
- { RADEON_PP_TFACTOR_2, "RADEON_PP_TFACTOR_2" },
- { RADEON_PP_BORDER_COLOR_0, "RADEON_PP_BORDER_COLOR_0" },
- { RADEON_PP_BORDER_COLOR_1, "RADEON_PP_BORDER_COLOR_1" },
- { RADEON_PP_BORDER_COLOR_2, "RADEON_PP_BORDER_COLOR_2" },
- { RADEON_SE_ZBIAS_FACTOR, "RADEON_SE_ZBIAS_FACTOR" },
- { RADEON_SE_ZBIAS_CONSTANT, "RADEON_SE_ZBIAS_CONSTANT" },
- { RADEON_SE_TCL_OUTPUT_VTX_FMT, "RADEON_SE_TCL_OUTPUT_VTXFMT" },
- { RADEON_SE_TCL_OUTPUT_VTX_SEL, "RADEON_SE_TCL_OUTPUT_VTXSEL" },
- { RADEON_SE_TCL_MATRIX_SELECT_0, "RADEON_SE_TCL_MATRIX_SELECT_0" },
- { RADEON_SE_TCL_MATRIX_SELECT_1, "RADEON_SE_TCL_MATRIX_SELECT_1" },
- { RADEON_SE_TCL_UCP_VERT_BLEND_CTL, "RADEON_SE_TCL_UCP_VERT_BLEND_CTL" },
- { RADEON_SE_TCL_TEXTURE_PROC_CTL, "RADEON_SE_TCL_TEXTURE_PROC_CTL" },
- { RADEON_SE_TCL_LIGHT_MODEL_CTL, "RADEON_SE_TCL_LIGHT_MODEL_CTL" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_0, "RADEON_SE_TCL_PER_LIGHT_CTL_0" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_1, "RADEON_SE_TCL_PER_LIGHT_CTL_1" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_2, "RADEON_SE_TCL_PER_LIGHT_CTL_2" },
- { RADEON_SE_TCL_PER_LIGHT_CTL_3, "RADEON_SE_TCL_PER_LIGHT_CTL_3" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED, "RADEON_SE_TCL_EMMISSIVE_RED" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_GREEN, "RADEON_SE_TCL_EMMISSIVE_GREEN" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_BLUE, "RADEON_SE_TCL_EMMISSIVE_BLUE" },
- { RADEON_SE_TCL_MATERIAL_EMMISSIVE_ALPHA, "RADEON_SE_TCL_EMMISSIVE_ALPHA" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_RED, "RADEON_SE_TCL_AMBIENT_RED" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_GREEN, "RADEON_SE_TCL_AMBIENT_GREEN" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_BLUE, "RADEON_SE_TCL_AMBIENT_BLUE" },
- { RADEON_SE_TCL_MATERIAL_AMBIENT_ALPHA, "RADEON_SE_TCL_AMBIENT_ALPHA" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_RED, "RADEON_SE_TCL_DIFFUSE_RED" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_GREEN, "RADEON_SE_TCL_DIFFUSE_GREEN" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_BLUE, "RADEON_SE_TCL_DIFFUSE_BLUE" },
- { RADEON_SE_TCL_MATERIAL_DIFFUSE_ALPHA, "RADEON_SE_TCL_DIFFUSE_ALPHA" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_RED, "RADEON_SE_TCL_SPECULAR_RED" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_GREEN, "RADEON_SE_TCL_SPECULAR_GREEN" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_BLUE, "RADEON_SE_TCL_SPECULAR_BLUE" },
- { RADEON_SE_TCL_MATERIAL_SPECULAR_ALPHA, "RADEON_SE_TCL_SPECULAR_ALPHA" },
- { RADEON_SE_TCL_SHININESS, "RADEON_SE_TCL_SHININESS" },
- { RADEON_SE_COORD_FMT, "RADEON_SE_COORD_FMT" },
- { RADEON_PP_TEX_SIZE_0, "RADEON_PP_TEX_SIZE_0" },
- { RADEON_PP_TEX_SIZE_1, "RADEON_PP_TEX_SIZE_1" },
- { RADEON_PP_TEX_SIZE_2, "RADEON_PP_TEX_SIZE_2" },
- { RADEON_PP_TEX_SIZE_0+4, "RADEON_PP_TEX_PITCH_0" },
- { RADEON_PP_TEX_SIZE_1+4, "RADEON_PP_TEX_PITCH_1" },
- { RADEON_PP_TEX_SIZE_2+4, "RADEON_PP_TEX_PITCH_2" },
- { RADEON_PP_CUBIC_FACES_0, "RADEON_PP_CUBIC_FACES_0" },
- { RADEON_PP_CUBIC_FACES_1, "RADEON_PP_CUBIC_FACES_1" },
- { RADEON_PP_CUBIC_FACES_2, "RADEON_PP_CUBIC_FACES_2" },
- { RADEON_PP_CUBIC_OFFSET_T0_0, "RADEON_PP_CUBIC_OFFSET_T0_0" },
- { RADEON_PP_CUBIC_OFFSET_T0_1, "RADEON_PP_CUBIC_OFFSET_T0_1" },
- { RADEON_PP_CUBIC_OFFSET_T0_2, "RADEON_PP_CUBIC_OFFSET_T0_2" },
- { RADEON_PP_CUBIC_OFFSET_T0_3, "RADEON_PP_CUBIC_OFFSET_T0_3" },
- { RADEON_PP_CUBIC_OFFSET_T0_4, "RADEON_PP_CUBIC_OFFSET_T0_4" },
- { RADEON_PP_CUBIC_OFFSET_T1_0, "RADEON_PP_CUBIC_OFFSET_T1_0" },
- { RADEON_PP_CUBIC_OFFSET_T1_1, "RADEON_PP_CUBIC_OFFSET_T1_1" },
- { RADEON_PP_CUBIC_OFFSET_T1_2, "RADEON_PP_CUBIC_OFFSET_T1_2" },
- { RADEON_PP_CUBIC_OFFSET_T1_3, "RADEON_PP_CUBIC_OFFSET_T1_3" },
- { RADEON_PP_CUBIC_OFFSET_T1_4, "RADEON_PP_CUBIC_OFFSET_T1_4" },
- { RADEON_PP_CUBIC_OFFSET_T2_0, "RADEON_PP_CUBIC_OFFSET_T2_0" },
- { RADEON_PP_CUBIC_OFFSET_T2_1, "RADEON_PP_CUBIC_OFFSET_T2_1" },
- { RADEON_PP_CUBIC_OFFSET_T2_2, "RADEON_PP_CUBIC_OFFSET_T2_2" },
- { RADEON_PP_CUBIC_OFFSET_T2_3, "RADEON_PP_CUBIC_OFFSET_T2_3" },
- { RADEON_PP_CUBIC_OFFSET_T2_4, "RADEON_PP_CUBIC_OFFSET_T2_4" },
-};
-
-static struct reg_names scalar_names[] = {
- { RADEON_SS_LIGHT_DCD_ADDR, "LIGHT_DCD" },
- { RADEON_SS_LIGHT_SPOT_EXPONENT_ADDR, "LIGHT_SPOT_EXPONENT" },
- { RADEON_SS_LIGHT_SPOT_CUTOFF_ADDR, "LIGHT_SPOT_CUTOFF" },
- { RADEON_SS_LIGHT_SPECULAR_THRESH_ADDR, "LIGHT_SPECULAR_THRESH" },
- { RADEON_SS_LIGHT_RANGE_CUTOFF_ADDR, "LIGHT_RANGE_CUTOFF" },
- { RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR, "VERT_GUARD_CLIP" },
- { RADEON_SS_VERT_GUARD_DISCARD_ADJ_ADDR, "VERT_GUARD_DISCARD" },
- { RADEON_SS_HORZ_GUARD_CLIP_ADJ_ADDR, "HORZ_GUARD_CLIP" },
- { RADEON_SS_HORZ_GUARD_DISCARD_ADJ_ADDR, "HORZ_GUARD_DISCARD" },
- { RADEON_SS_SHININESS, "SHININESS" },
- { 1000, "" },
-};
-
-/* Puff these out to make them look like normal (dword) registers.
- */
-static struct reg_names vector_names[] = {
- { RADEON_VS_MATRIX_0_ADDR * 4, "MATRIX_0" },
- { RADEON_VS_MATRIX_1_ADDR * 4, "MATRIX_1" },
- { RADEON_VS_MATRIX_2_ADDR * 4, "MATRIX_2" },
- { RADEON_VS_MATRIX_3_ADDR * 4, "MATRIX_3" },
- { RADEON_VS_MATRIX_4_ADDR * 4, "MATRIX_4" },
- { RADEON_VS_MATRIX_5_ADDR * 4, "MATRIX_5" },
- { RADEON_VS_MATRIX_6_ADDR * 4, "MATRIX_6" },
- { RADEON_VS_MATRIX_7_ADDR * 4, "MATRIX_7" },
- { RADEON_VS_MATRIX_8_ADDR * 4, "MATRIX_8" },
- { RADEON_VS_MATRIX_9_ADDR * 4, "MATRIX_9" },
- { RADEON_VS_MATRIX_10_ADDR * 4, "MATRIX_10" },
- { RADEON_VS_MATRIX_11_ADDR * 4, "MATRIX_11" },
- { RADEON_VS_MATRIX_12_ADDR * 4, "MATRIX_12" },
- { RADEON_VS_MATRIX_13_ADDR * 4, "MATRIX_13" },
- { RADEON_VS_MATRIX_14_ADDR * 4, "MATRIX_14" },
- { RADEON_VS_MATRIX_15_ADDR * 4, "MATRIX_15" },
- { RADEON_VS_LIGHT_AMBIENT_ADDR * 4, "LIGHT_AMBIENT" },
- { RADEON_VS_LIGHT_DIFFUSE_ADDR * 4, "LIGHT_DIFFUSE" },
- { RADEON_VS_LIGHT_SPECULAR_ADDR * 4, "LIGHT_SPECULAR" },
- { RADEON_VS_LIGHT_DIRPOS_ADDR * 4, "LIGHT_DIRPOS" },
- { RADEON_VS_LIGHT_HWVSPOT_ADDR * 4, "LIGHT_HWVSPOT" },
- { RADEON_VS_LIGHT_ATTENUATION_ADDR * 4, "LIGHT_ATTENUATION" },
- { RADEON_VS_MATRIX_EYE2CLIP_ADDR * 4, "MATRIX_EYE2CLIP" },
- { RADEON_VS_UCP_ADDR * 4, "UCP" },
- { RADEON_VS_GLOBAL_AMBIENT_ADDR * 4, "GLOBAL_AMBIENT" },
- { RADEON_VS_FOG_PARAM_ADDR * 4, "FOG_PARAM" },
- { RADEON_VS_EYE_VECTOR_ADDR * 4, "EYE_VECTOR" },
- { 1000, "" },
-};
-
-union fi { float f; int i; };
-
-#define ISVEC 1
-#define ISFLOAT 2
-#define TOUCHED 4
-
-struct reg {
- int idx;
- struct reg_names *closest;
- int flags;
- union fi current;
- union fi *values;
- int nvalues;
- int nalloc;
- float vmin, vmax;
-};
-
-
-static struct reg regs[Elements(reg_names)+1];
-static struct reg scalars[512+1];
-static struct reg vectors[512*4+1];
-
-static int total, total_changed, bufs;
-
-static void init_regs( void )
-{
- struct reg_names *tmp;
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++) {
- regs[i].idx = reg_names[i].idx;
- regs[i].closest = &reg_names[i];
- regs[i].flags = 0;
- }
-
- for (i = 0, tmp = scalar_names ; i < Elements(scalars) ; i++) {
- if (tmp[1].idx == i) tmp++;
- scalars[i].idx = i;
- scalars[i].closest = tmp;
- scalars[i].flags = ISFLOAT;
- }
-
- for (i = 0, tmp = vector_names ; i < Elements(vectors) ; i++) {
- if (tmp[1].idx*4 == i) tmp++;
- vectors[i].idx = i;
- vectors[i].closest = tmp;
- vectors[i].flags = ISFLOAT|ISVEC;
- }
-
- regs[Elements(regs)-1].idx = -1;
- scalars[Elements(scalars)-1].idx = -1;
- vectors[Elements(vectors)-1].idx = -1;
-}
-
-static int find_or_add_value( struct reg *reg, int val )
-{
- int j;
-
- for ( j = 0 ; j < reg->nvalues ; j++)
- if ( val == reg->values[j].i )
- return 1;
-
- if (j == reg->nalloc) {
- reg->nalloc += 5;
- reg->nalloc *= 2;
- reg->values = (union fi *) realloc( reg->values,
- reg->nalloc * sizeof(union fi) );
- }
-
- reg->values[reg->nvalues++].i = val;
- return 0;
-}
-
-static struct reg *lookup_reg( struct reg *tab, int reg )
-{
- int i;
-
- for (i = 0 ; tab[i].idx != -1 ; i++) {
- if (tab[i].idx == reg)
- return &tab[i];
- }
-
- fprintf(stderr, "*** unknown reg 0x%x\n", reg);
- return NULL;
-}
-
-
-static const char *get_reg_name( struct reg *reg )
-{
- static char tmp[80];
-
- if (reg->idx == reg->closest->idx)
- return reg->closest->name;
-
-
- if (reg->flags & ISVEC) {
- if (reg->idx/4 != reg->closest->idx)
- sprintf(tmp, "%s+%d[%d]",
- reg->closest->name,
- (reg->idx/4) - reg->closest->idx,
- reg->idx%4);
- else
- sprintf(tmp, "%s[%d]", reg->closest->name, reg->idx%4);
- }
- else {
- if (reg->idx != reg->closest->idx)
- sprintf(tmp, "%s+%d", reg->closest->name, reg->idx - reg->closest->idx);
- else
- sprintf(tmp, "%s", reg->closest->name);
- }
-
- return tmp;
-}
-
-static int print_int_reg_assignment( struct reg *reg, int data )
-{
- int changed = (reg->current.i != data);
- int ever_seen = find_or_add_value( reg, data );
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, " %s <-- 0x%x", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (!ever_seen)
- fprintf(stderr, " *** BRAND NEW VALUE");
- else if (changed)
- fprintf(stderr, " *** CHANGED");
- }
-
- reg->current.i = data;
-
- if (VERBOSE || (NORMAL && (changed || !ever_seen)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-
-static int print_float_reg_assignment( struct reg *reg, float data )
-{
- int changed = (reg->current.f != data);
- int newmin = (data < reg->vmin);
- int newmax = (data > reg->vmax);
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, " %s <-- %.3f", get_reg_name(reg), data);
-
- if (NORMAL) {
- if (newmin) {
- fprintf(stderr, " *** NEW MIN (prev %.3f)", reg->vmin);
- reg->vmin = data;
- }
- else if (newmax) {
- fprintf(stderr, " *** NEW MAX (prev %.3f)", reg->vmax);
- reg->vmax = data;
- }
- else if (changed) {
- fprintf(stderr, " *** CHANGED");
- }
- }
-
- reg->current.f = data;
-
- if (VERBOSE || (NORMAL && (newmin || newmax || changed)))
- fprintf(stderr, "\n");
-
- return changed;
-}
-
-static int print_reg_assignment( struct reg *reg, int data )
-{
- reg->flags |= TOUCHED;
- if (reg->flags & ISFLOAT)
- return print_float_reg_assignment( reg, *(float *)&data );
- else
- return print_int_reg_assignment( reg, data );
-}
-
-static void print_reg( struct reg *reg )
-{
- if (reg->flags & TOUCHED) {
- if (reg->flags & ISFLOAT) {
- fprintf(stderr, " %s == %f\n", get_reg_name(reg), reg->current.f);
- } else {
- fprintf(stderr, " %s == 0x%x\n", get_reg_name(reg), reg->current.i);
- }
- }
-}
-
-
-static void dump_state( void )
-{
- int i;
-
- for (i = 0 ; i < Elements(regs) ; i++)
- print_reg( &regs[i] );
-
- for (i = 0 ; i < Elements(scalars) ; i++)
- print_reg( &scalars[i] );
-
- for (i = 0 ; i < Elements(vectors) ; i++)
- print_reg( &vectors[i] );
-}
-
-
-
-static int radeon_emit_packets(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int id = (int)header.packet.packet_id;
- int sz = packet[id].len;
- int *data = (int *)cmdbuf->buf;
- int i;
-
- if (sz * sizeof(int) > cmdbuf->bufsz) {
- fprintf(stderr, "Packet overflows cmdbuf\n");
- return -EINVAL;
- }
-
- if (!packet[id].name) {
- fprintf(stderr, "*** Unknown packet 0 nr %d\n", id );
- return -EINVAL;
- }
-
-
- if (VERBOSE)
- fprintf(stderr, "Packet 0 reg %s nr %d\n", packet[id].name, sz );
-
- for ( i = 0 ; i < sz ; i++) {
- struct reg *reg = lookup_reg( regs, packet[id].start + i*4 );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int radeon_emit_scalars2(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int sz = header.scalars.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.scalars.offset + 0x100;
- int stride = header.scalars.stride;
- int i;
-
- if (VERBOSE)
- fprintf(stderr, "emit scalars2, start %d stride %d nr %d (end %d)\n",
- start, stride, sz, start + stride * sz);
-
- if (start + stride * sz > 257) {
- fprintf(stderr, "emit scalars OVERFLOW %d/%d/%d\n", start, stride, sz);
- return -1;
- }
-
- for (i = 0 ; i < sz ; i++, start += stride) {
- struct reg *reg = lookup_reg( scalars, start );
- if (print_reg_assignment( reg, data[i] ))
- total_changed++;
- total++;
- }
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-/* Check: inf/nan/extreme-size?
- * Check: table start, end, nr, etc.
- */
-static int radeon_emit_vectors(
- drm_radeon_cmd_header_t header,
- drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int sz = header.vectors.count;
- int *data = (int *)cmdbuf->buf;
- int start = header.vectors.offset;
- int stride = header.vectors.stride;
- int i,j;
-
- if (VERBOSE)
- fprintf(stderr, "emit vectors, start %d stride %d nr %d (end %d) (0x%x)\n",
- start, stride, sz, start + stride * sz, header.i);
-
-/* if (start + stride * (sz/4) > 128) { */
-/* fprintf(stderr, "emit vectors OVERFLOW %d/%d/%d\n", start, stride, sz); */
-/* return -1; */
-/* } */
-
- for (i = 0 ; i < sz ; start += stride) {
- int changed = 0;
- for (j = 0 ; j < 4 ; i++,j++) {
- struct reg *reg = lookup_reg( vectors, start*4+j );
- if (print_reg_assignment( reg, data[i] ))
- changed = 1;
- }
- if (changed)
- total_changed += 4;
- total += 4;
- }
-
-
- cmdbuf->buf += sz * sizeof(int);
- cmdbuf->bufsz -= sz * sizeof(int);
- return 0;
-}
-
-
-static int print_vertex_format( int vfmt )
-{
- if (NORMAL) {
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- "vertex format",
- vfmt,
- "xy,",
- (vfmt & RADEON_CP_VC_FRMT_Z) ? "z," : "",
- (vfmt & RADEON_CP_VC_FRMT_W0) ? "w0," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPCOLOR) ? "fpcolor," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPALPHA) ? "fpalpha," : "",
- (vfmt & RADEON_CP_VC_FRMT_PKCOLOR) ? "pkcolor," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPSPEC) ? "fpspec," : "",
- (vfmt & RADEON_CP_VC_FRMT_FPFOG) ? "fpfog," : "",
- (vfmt & RADEON_CP_VC_FRMT_PKSPEC) ? "pkspec," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST0) ? "st0," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST1) ? "st1," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q1) ? "q1," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST2) ? "st2," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q2) ? "q2," : "",
- (vfmt & RADEON_CP_VC_FRMT_ST3) ? "st3," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q3) ? "q3," : "",
- (vfmt & RADEON_CP_VC_FRMT_Q0) ? "q0," : "",
- (vfmt & RADEON_CP_VC_FRMT_N0) ? "n0," : "",
- (vfmt & RADEON_CP_VC_FRMT_XY1) ? "xy1," : "",
- (vfmt & RADEON_CP_VC_FRMT_Z1) ? "z1," : "",
- (vfmt & RADEON_CP_VC_FRMT_W1) ? "w1," : "",
- (vfmt & RADEON_CP_VC_FRMT_N1) ? "n1," : "");
-
-
-/* if (!find_or_add_value( &others[V_VTXFMT], vfmt )) */
-/* fprintf(stderr, " *** NEW VALUE"); */
-
- fprintf(stderr, "\n");
- }
-
- return 0;
-}
-
-static char *primname[0xf] = {
- "NONE",
- "POINTS",
- "LINES",
- "LINE_STRIP",
- "TRIANGLES",
- "TRIANGLE_FAN",
- "TRIANGLE_STRIP",
- "TRI_TYPE_2",
- "RECT_LIST",
- "3VRT_POINTS",
- "3VRT_LINES",
-};
-
-static int print_prim_and_flags( int prim )
-{
- int numverts;
-
- if (NORMAL)
- fprintf(stderr, " %s(%x): %s%s%s%s%s%s%s\n",
- "prim flags",
- prim,
- ((prim & 0x30) == RADEON_CP_VC_CNTL_PRIM_WALK_IND) ? "IND," : "",
- ((prim & 0x30) == RADEON_CP_VC_CNTL_PRIM_WALK_LIST) ? "LIST," : "",
- ((prim & 0x30) == RADEON_CP_VC_CNTL_PRIM_WALK_RING) ? "RING," : "",
- (prim & RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA) ? "RGBA," : "BGRA, ",
- (prim & RADEON_CP_VC_CNTL_MAOS_ENABLE) ? "MAOS," : "",
- (prim & RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE) ? "RADEON," : "",
- (prim & RADEON_CP_VC_CNTL_TCL_ENABLE) ? "TCL," : "");
-
- if ((prim & 0xf) > RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST) {
- fprintf(stderr, " *** Bad primitive: %x\n", prim & 0xf);
- return -1;
- }
-
- numverts = prim>>16;
-
- if (NORMAL)
- fprintf(stderr, " prim: %s numverts %d\n", primname[prim&0xf], numverts);
-
- switch (prim & 0xf) {
- case RADEON_CP_VC_CNTL_PRIM_TYPE_NONE:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_POINT:
- if (numverts < 1) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_LINE:
- if ((numverts & 1) || numverts == 0) {
- fprintf(stderr, "Bad nr verts for line %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP:
- if (numverts < 2) {
- fprintf(stderr, "Bad nr verts for line_strip %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST:
- if (numverts % 3 || numverts == 0) {
- fprintf(stderr, "Bad nr verts for tri %d\n", numverts);
- return -1;
- }
- break;
- case RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN:
- case RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP:
- if (numverts < 3) {
- fprintf(stderr, "Bad nr verts for strip/fan %d\n", numverts);
- return -1;
- }
- break;
- default:
- fprintf(stderr, "Bad primitive\n");
- return -1;
- }
- return 0;
-}
-
-/* build in knowledge about each packet type
- */
-static int radeon_emit_packet3( drm_radeon_cmd_buffer_t *cmdbuf )
-{
- int cmdsz;
- int *cmd = (int *)cmdbuf->buf;
- int *tmp;
- int i, stride, size, start;
-
- cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16);
-
- if ((cmd[0] & RADEON_CP_PACKET_MASK) != RADEON_CP_PACKET3 ||
- cmdsz * 4 > cmdbuf->bufsz ||
- cmdsz > RADEON_CP_PACKET_MAX_DWORDS) {
- fprintf(stderr, "Bad packet\n");
- return -EINVAL;
- }
-
- switch( cmd[0] & ~RADEON_CP_PACKET_COUNT_MASK ) {
- case RADEON_CP_PACKET3_NOP:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NOP, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_NEXT_CHAR:
- if (NORMAL)
- fprintf(stderr, "PACKET3_NEXT_CHAR, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_PLY_NEXTSCAN:
- if (NORMAL)
- fprintf(stderr, "PACKET3_PLY_NEXTSCAN, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_SET_SCISSORS:
- if (NORMAL)
- fprintf(stderr, "PACKET3_SET_SCISSORS, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_RNDR_GEN_INDX_PRIM, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_LOAD_MICROCODE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_MICROCODE, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_WAIT_FOR_IDLE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_WAIT_FOR_IDLE, %d dwords\n", cmdsz);
- break;
-
- case RADEON_CP_PACKET3_3D_DRAW_VBUF:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_VBUF, %d dwords\n", cmdsz);
- print_vertex_format(cmd[1]);
- print_prim_and_flags(cmd[2]);
- break;
-
- case RADEON_CP_PACKET3_3D_DRAW_IMMD:
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_IMMD, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_3D_DRAW_INDX: {
- int neltdwords;
- if (NORMAL)
- fprintf(stderr, "PACKET3_3D_DRAW_INDX, %d dwords\n", cmdsz);
- print_vertex_format(cmd[1]);
- print_prim_and_flags(cmd[2]);
- neltdwords = cmd[2]>>16;
- neltdwords += neltdwords & 1;
- neltdwords /= 2;
- if (neltdwords + 3 != cmdsz)
- fprintf(stderr, "Mismatch in DRAW_INDX, %d vs cmdsz %d\n",
- neltdwords, cmdsz);
- break;
- }
- case RADEON_CP_PACKET3_LOAD_PALETTE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_LOAD_PALETTE, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_3D_LOAD_VBPNTR:
- if (NORMAL) {
- fprintf(stderr, "PACKET3_3D_LOAD_VBPNTR, %d dwords\n", cmdsz);
- fprintf(stderr, " nr arrays: %d\n", cmd[1]);
- }
-
- if (cmd[1]/2 + cmd[1]%2 != cmdsz - 3) {
- fprintf(stderr, " ****** MISMATCH %d/%d *******\n",
- cmd[1]/2 + cmd[1]%2 + 3, cmdsz);
- return -EINVAL;
- }
-
- if (NORMAL) {
- tmp = cmd+2;
- for (i = 0 ; i < cmd[1] ; i++) {
- if (i & 1) {
- stride = (tmp[0]>>24) & 0xff;
- size = (tmp[0]>>16) & 0xff;
- start = tmp[2];
- tmp += 3;
- }
- else {
- stride = (tmp[0]>>8) & 0xff;
- size = (tmp[0]) & 0xff;
- start = tmp[1];
- }
- fprintf(stderr, " array %d: start 0x%x vsize %d vstride %d\n",
- i, start, size, stride );
- }
- }
- break;
- case RADEON_CP_PACKET3_CNTL_PAINT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_SMALLTEXT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_SMALLTEXT, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_HOSTDATA_BLT, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_POLYLINE:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYLINE, %d dwords\n", cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_POLYSCANLINES:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_POLYSCANLINES, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_PAINT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_PAINT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_BITBLT_MULTI:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_BITBLT_MULTI, %d dwords\n",
- cmdsz);
- break;
- case RADEON_CP_PACKET3_CNTL_TRANS_BITBLT:
- if (NORMAL)
- fprintf(stderr, "PACKET3_CNTL_TRANS_BITBLT, %d dwords\n",
- cmdsz);
- break;
- default:
- fprintf(stderr, "UNKNOWN PACKET, %d dwords\n", cmdsz);
- break;
- }
-
- cmdbuf->buf += cmdsz * 4;
- cmdbuf->bufsz -= cmdsz * 4;
- return 0;
-}
-
-
-/* Check cliprects for bounds, then pass on to above:
- */
-static int radeon_emit_packet3_cliprect( drm_radeon_cmd_buffer_t *cmdbuf )
-{
- drm_clip_rect_t *boxes = cmdbuf->boxes;
- int i = 0;
-
- if (VERBOSE && total_changed) {
- dump_state();
- total_changed = 0;
- }
- else fprintf(stderr, "total_changed zero\n");
-
- if (NORMAL) {
- do {
- if ( i < cmdbuf->nbox ) {
- fprintf(stderr, "Emit box %d/%d %d,%d %d,%d\n",
- i, cmdbuf->nbox,
- boxes[i].x1, boxes[i].y1, boxes[i].x2, boxes[i].y2);
- }
- } while ( ++i < cmdbuf->nbox );
- }
-
- if (cmdbuf->nbox == 1)
- cmdbuf->nbox = 0;
-
- return radeon_emit_packet3( cmdbuf );
-}
-
-
-int radeonSanityCmdBuffer( radeonContextPtr rmesa,
- int nbox,
- drm_clip_rect_t *boxes )
-{
- int idx;
- drm_radeon_cmd_buffer_t cmdbuf;
- drm_radeon_cmd_header_t header;
- static int inited = 0;
-
- if (!inited) {
- init_regs();
- inited = 1;
- }
-
- cmdbuf.buf = rmesa->store.cmd_buf;
- cmdbuf.bufsz = rmesa->store.cmd_used;
- cmdbuf.boxes = boxes;
- cmdbuf.nbox = nbox;
-
- while ( cmdbuf.bufsz >= sizeof(header) ) {
-
- header.i = *(int *)cmdbuf.buf;
- cmdbuf.buf += sizeof(header);
- cmdbuf.bufsz -= sizeof(header);
-
- switch (header.header.cmd_type) {
- case RADEON_CMD_PACKET:
- if (radeon_emit_packets( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packets failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS:
- if (radeon_emit_scalars( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_SCALARS2:
- if (radeon_emit_scalars2( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_scalars failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_VECTORS:
- if (radeon_emit_vectors( header, &cmdbuf )) {
- fprintf(stderr,"radeon_emit_vectors failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_DMA_DISCARD:
- idx = header.dma.buf_idx;
- if (NORMAL)
- fprintf(stderr, "RADEON_CMD_DMA_DISCARD buf %d\n", idx);
- bufs++;
- break;
-
- case RADEON_CMD_PACKET3:
- if (radeon_emit_packet3( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3 failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_PACKET3_CLIP:
- if (radeon_emit_packet3_cliprect( &cmdbuf )) {
- fprintf(stderr,"radeon_emit_packet3_clip failed\n");
- return -EINVAL;
- }
- break;
-
- case RADEON_CMD_WAIT:
- break;
-
- default:
- fprintf(stderr,"bad cmd_type %d at %p\n",
- header.header.cmd_type,
- cmdbuf.buf - sizeof(header));
- return -EINVAL;
- }
- }
-
- if (0)
- {
- static int n = 0;
- n++;
- if (n == 10) {
- fprintf(stderr, "Bufs %d Total emitted %d real changes %d (%.2f%%)\n",
- bufs,
- total, total_changed,
- ((float)total_changed/(float)total*100.0));
- fprintf(stderr, "Total emitted per buf: %.2f\n",
- (float)total/(float)bufs);
- fprintf(stderr, "Real changes per buf: %.2f\n",
- (float)total_changed/(float)bufs);
-
- bufs = n = total = total_changed = 0;
- }
- }
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.h
deleted file mode 100644
index 1ec06bc58..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef RADEON_SANITY_H
-#define RADEON_SANITY_H
-
-extern int radeonSanityCmdBuffer( radeonContextPtr rmesa,
- int nbox,
- drm_clip_rect_t *boxes );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c
deleted file mode 100644
index 80710294c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c,v 1.7 2003/03/26 20:43:51 tsi Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/**
- * \file radeon_screen.c
- * Screen initialization functions for the Radeon driver.
- *
- * \author Kevin E. Martin <martin@valinux.com>
- * \author Gareth Hughes <gareth@valinux.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#define STANDALONE_MMIO
-#include "radeon_context.h"
-#include "radeon_screen.h"
-#include "radeon_macros.h"
-#include "radeon_span.h"
-
-#include "utils.h"
-#include "context.h"
-#include "vblank.h"
-#include "drirenderbuffer.h"
-
-#include "GL/internal/dri_interface.h"
-
-/* Radeon configuration
- */
-#include "xmlpool.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_HYPERZ(false)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0")
- DRI_CONF_NO_NEG_LOD_BIAS(false)
- DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
- DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_TEXTURE_LEVEL_HACK(false)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 13;
-
-extern const struct dri_extension card_extensions[];
-
-#if 1
-/* Including xf86PciInfo.h introduces a bunch of errors...
- */
-#define PCI_CHIP_RADEON_QD 0x5144
-#define PCI_CHIP_RADEON_QE 0x5145
-#define PCI_CHIP_RADEON_QF 0x5146
-#define PCI_CHIP_RADEON_QG 0x5147
-
-#define PCI_CHIP_RADEON_QY 0x5159
-#define PCI_CHIP_RADEON_QZ 0x515A
-
-#define PCI_CHIP_RN50_515E 0x515E
-#define PCI_CHIP_RN50_5969 0x5969
-
-#define PCI_CHIP_RADEON_LW 0x4C57 /* mobility 7 - has tcl */
-#define PCI_CHIP_RADEON_LX 0x4C58 /* mobility FireGL 7800 m7 */
-
-#define PCI_CHIP_RADEON_LY 0x4C59
-#define PCI_CHIP_RADEON_LZ 0x4C5A
-
-#define PCI_CHIP_RV200_QW 0x5157 /* Radeon 7500 - not an R200 at all */
-#define PCI_CHIP_RV200_QX 0x5158
-
-/* IGP Chipsets */
-#define PCI_CHIP_RS100_4136 0x4136
-#define PCI_CHIP_RS200_4137 0x4137
-#define PCI_CHIP_RS250_4237 0x4237
-#define PCI_CHIP_RS100_4336 0x4336
-#define PCI_CHIP_RS200_4337 0x4337
-#define PCI_CHIP_RS250_4437 0x4437
-#endif
-
-
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-static __GLcontextModes *
-radeonFillInModes( 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 */
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_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_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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;
-}
-
-
-/* Create the device specific screen private data struct.
- */
-radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv )
-{
- radeonScreenPtr screen;
- RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv;
- unsigned char *RADEONMMIO;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- screen = (radeonScreenPtr) CALLOC( sizeof(*screen) );
- if ( !screen ) {
- __driUtilMessage("%s: Could not allocate memory for screen structure",
- __FUNCTION__);
- return NULL;
- }
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- /* This is first since which regions we map depends on whether or
- * not we are using a PCI card.
- */
- screen->IsPCI = dri_priv->IsPCI;
-
- {
- int ret;
- drm_radeon_getparam_t gp;
-
- gp.param = RADEON_PARAM_GART_BUFFER_OFFSET;
- gp.value = &screen->gart_buffer_offset;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret);
- return NULL;
- }
-
- if (sPriv->drmMinor >= 6) {
- gp.param = RADEON_PARAM_IRQ_NR;
- gp.value = &screen->irq;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- FREE( screen );
- fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_IRQ_NR): %d\n", ret);
- return NULL;
- }
- }
- }
-
- screen->mmio.handle = dri_priv->registerHandle;
- screen->mmio.size = dri_priv->registerSize;
- if ( drmMap( sPriv->fd,
- screen->mmio.handle,
- screen->mmio.size,
- &screen->mmio.map ) ) {
- FREE( screen );
- __driUtilMessage("%s: drmMap failed\n", __FUNCTION__ );
- return NULL;
- }
-
- RADEONMMIO = screen->mmio.map;
-
- screen->status.handle = dri_priv->statusHandle;
- screen->status.size = dri_priv->statusSize;
- if ( drmMap( sPriv->fd,
- screen->status.handle,
- screen->status.size,
- &screen->status.map ) ) {
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__ );
- return NULL;
- }
- screen->scratch = (__volatile__ u_int32_t *)
- ((GLubyte *)screen->status.map + RADEON_SCRATCH_REG_OFFSET);
-
- screen->buffers = drmMapBufs( sPriv->fd );
- if ( !screen->buffers ) {
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__ );
- return NULL;
- }
-
- if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) {
- screen->gartTextures.handle = dri_priv->gartTexHandle;
- screen->gartTextures.size = dri_priv->gartTexMapSize;
- if ( drmMap( sPriv->fd,
- screen->gartTextures.handle,
- screen->gartTextures.size,
- (drmAddressPtr)&screen->gartTextures.map ) ) {
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
- FREE( screen );
- __driUtilMessage("%s: drmMap failed for GART texture area\n", __FUNCTION__);
- return NULL;
- }
-
- screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI
- ? INREG( RADEON_AIC_LO_ADDR )
- : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) );
- }
-
- screen->chipset = 0;
- switch ( dri_priv->deviceID ) {
- default:
- fprintf(stderr, "unknown chip id, assuming full radeon support\n");
- case PCI_CHIP_RADEON_QD:
- case PCI_CHIP_RADEON_QE:
- case PCI_CHIP_RADEON_QF:
- case PCI_CHIP_RADEON_QG:
- /* all original radeons (7200) presumably have a stencil op bug */
- screen->chipset |= RADEON_CHIPSET_BROKEN_STENCIL;
- case PCI_CHIP_RV200_QW:
- case PCI_CHIP_RV200_QX:
- case PCI_CHIP_RADEON_LW:
- case PCI_CHIP_RADEON_LX:
- screen->chipset |= RADEON_CHIPSET_TCL;
- case PCI_CHIP_RADEON_QY:
- case PCI_CHIP_RADEON_QZ:
- case PCI_CHIP_RN50_515E:
- case PCI_CHIP_RN50_5969:
- case PCI_CHIP_RADEON_LY:
- case PCI_CHIP_RADEON_LZ:
- case PCI_CHIP_RS100_4136: /* IGPs don't have TCL */
- case PCI_CHIP_RS200_4137:
- case PCI_CHIP_RS250_4237:
- case PCI_CHIP_RS100_4336:
- case PCI_CHIP_RS200_4337:
- case PCI_CHIP_RS250_4437:
- break;
- }
-
- screen->cpp = dri_priv->bpp / 8;
- screen->AGPMode = dri_priv->AGPMode;
-
- screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16;
-
- if ( sPriv->drmMinor >= 10 ) {
- drm_radeon_setparam_t sp;
-
- sp.param = RADEON_SETPARAM_FB_LOCATION;
- sp.value = screen->fbLocation;
-
- drmCommandWrite( sPriv->fd, DRM_RADEON_SETPARAM,
- &sp, sizeof( sp ) );
- }
-
- screen->frontOffset = dri_priv->frontOffset;
- screen->frontPitch = dri_priv->frontPitch;
- screen->backOffset = dri_priv->backOffset;
- screen->backPitch = dri_priv->backPitch;
- screen->depthOffset = dri_priv->depthOffset;
- screen->depthPitch = dri_priv->depthPitch;
-
- /* Check if ddx has set up a surface reg to cover depth buffer */
- screen->depthHasSurface = ((sPriv->ddxMajor > 4) &&
- (screen->chipset & RADEON_CHIPSET_TCL));
-
- if ( dri_priv->textureSize == 0 ) {
- screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset;
- screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] =
- dri_priv->log2GARTTexGran;
- } else {
- screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset
- + screen->fbLocation;
- screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize;
- screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] =
- dri_priv->log2TexGran;
- }
-
- if ( !screen->gartTextures.map || dri_priv->textureSize == 0
- || getenv( "RADEON_GARTTEXTURING_FORCE_DISABLE" ) ) {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1;
- screen->texOffset[RADEON_GART_TEX_HEAP] = 0;
- screen->texSize[RADEON_GART_TEX_HEAP] = 0;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] = 0;
- } else {
- screen->numTexHeaps = RADEON_NR_TEX_HEAPS;
- screen->texOffset[RADEON_GART_TEX_HEAP] = screen->gart_texture_offset;
- screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize;
- screen->logTexGranularity[RADEON_GART_TEX_HEAP] =
- dri_priv->log2GARTTexGran;
- }
-
- if ( glx_enable_extension != NULL ) {
- if ( screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- }
-
- screen->driScreen = sPriv;
- screen->sarea_priv_offset = dri_priv->sarea_priv_offset;
- return screen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-void radeonDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- radeonScreenPtr screen = (radeonScreenPtr)sPriv->private;
-
- if (!screen)
- return;
-
- if ( screen->gartTextures.map ) {
- drmUnmap( screen->gartTextures.map, screen->gartTextures.size );
- }
- drmUnmapBufs( screen->buffers );
- drmUnmap( screen->status.map, screen->status.size );
- drmUnmap( screen->mmio.map, screen->mmio.size );
-
- /* free all option information */
- driDestroyOptionInfo (&screen->optionCache);
-
- FREE( screen );
- sPriv->private = NULL;
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-radeonInitDriver( __DRIscreenPrivate *sPriv )
-{
- sPriv->private = (void *) radeonCreateScreen( sPriv );
- if ( !sPriv->private ) {
- radeonDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Create the Mesa framebuffer and renderbuffers for a given window/drawable.
- *
- * \todo This function (and its interface) will need to be updated to support
- * pbuffers.
- */
-static GLboolean
-radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- const GLboolean swDepth = GL_FALSE;
- const GLboolean swAlpha = GL_FALSE;
- const GLboolean swAccum = mesaVis->accumRedBits > 0;
- const GLboolean swStencil = mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24;
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- swDepth,
- swStencil,
- swAccum,
- swAlpha );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- radeonSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- radeonSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- radeonSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- radeonSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- radeonSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- swDepth,
- swStencil,
- swAccum,
- swAlpha,
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static struct __DriverAPIRec radeonAPI = {
- .InitDriver = radeonInitDriver,
- .DestroyScreen = radeonDestroyScreen,
- .CreateContext = radeonCreateContext,
- .DestroyContext = radeonDestroyContext,
- .CreateBuffer = radeonCreateBuffer,
- .DestroyBuffer = radeonDestroyBuffer,
- .SwapBuffers = radeonSwapBuffers,
- .MakeCurrent = radeonMakeCurrent,
- .UnbindContext = radeonUnbindContext,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-/**
- * 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIutilversion2 ddx_expected = { 4, 5, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 3, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions3( "Radeon",
- 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, &radeonAPI);
- if ( psp != NULL ) {
- RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
- *driver_modes = radeonFillInModes( dri_priv->bpp,
- (dri_priv->bpp == 16) ? 16 : 24,
- (dri_priv->bpp == 16) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- radeonContextPtr rmesa;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = rmesa->swap_count;
- sInfo->swap_ust = rmesa->swap_ust;
- sInfo->swap_missed_count = rmesa->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, rmesa->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.h
deleted file mode 100644
index b9cbeaac3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h,v 1.5 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_SCREEN_H__
-#define __RADEON_SCREEN_H__
-
-/*
- * IMPORTS: these headers contain all the DRI, X and kernel-related
- * definitions that we need.
- */
-/* #include "dri_util.h" */
-#include "radeon_dri.h"
-#include "radeon_reg.h"
-#include "drm_sarea.h"
-#include "xmlconfig.h"
-
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress map; /* Mapping of the DRM region */
-} radeonRegionRec, *radeonRegionPtr;
-
-/* chipset features */
-#define RADEON_CHIPSET_TCL (1 << 0)
-#define RADEON_CHIPSET_BROKEN_STENCIL (1 << 1)
-
-typedef struct {
-
- int chipset;
- int cpp;
- int IsPCI; /* Current card is a PCI card */
- int AGPMode;
- unsigned int irq; /* IRQ number (0 means none) */
-
- unsigned int fbLocation;
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
-
- unsigned int depthOffset;
- unsigned int depthPitch;
-
- /* Shared texture data */
- int numTexHeaps;
- int texOffset[RADEON_NR_TEX_HEAPS];
- int texSize[RADEON_NR_TEX_HEAPS];
- int logTexGranularity[RADEON_NR_TEX_HEAPS];
-
- radeonRegionRec mmio;
- radeonRegionRec status;
- radeonRegionRec gartTextures;
-
- drmBufMapPtr buffers;
-
- __volatile__ u_int32_t *scratch;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
- unsigned int gart_buffer_offset; /* offset in card memory space */
- unsigned int gart_texture_offset; /* offset in card memory space */
-
- GLboolean depthHasSurface;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} radeonScreenRec, *radeonScreenPtr;
-
-#endif /* __RADEON_SCREEN_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.c
deleted file mode 100644
index 2d15078d6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.c,v 1.6 2002/10/30 12:51:56 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "glheader.h"
-#include "swrast/swrast.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_span.h"
-#include "radeon_tex.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- radeonScreenPtr radeonScreen = rmesa->radeonScreen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint pitch = radeonScreen->frontPitch * radeonScreen->cpp; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- rmesa->state.color.drawOffset + \
- (dPriv->x * radeonScreen->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(sPriv->pFB + \
- rmesa->state.pixel.readOffset + \
- (dPriv->x * radeonScreen->cpp) + \
- (dPriv->y * pitch)); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- radeonScreenPtr radeonScreen = rmesa->radeonScreen; \
- __DRIscreenPrivate *sPriv = rmesa->dri.screen; \
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
- GLuint height = dPriv->h; \
- GLuint xo = dPriv->x; \
- GLuint yo = dPriv->y; \
- char *buf = (char *)(sPriv->pFB + radeonScreen->depthOffset); \
- (void) buf
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) radeon##x##_RGB565
-#define TAG2(x,y) radeon##x##_RGB565##y
-#include "spantmp2.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) radeon##x##_ARGB8888
-#define TAG2(x,y) radeon##x##_ARGB8888##y
-#include "spantmp2.h"
-
-
-/* ================================================================
- * Depth buffer
- */
-
-/* The Radeon family has depth tiling on all the time, so we have to convert
- * the x,y coordinates into the memory bus address (mba) in the same
- * manner as the engine. In each case, the linear block address (ba)
- * is calculated, and then wired with x and y to produce the final
- * memory address.
- * The chip will do address translation on its own if the surface registers
- * are set up correctly. It is not quite enough to get it working with hyperz too...
- */
-
-static GLuint radeon_mba_z32( radeonContextPtr rmesa,
- GLint x, GLint y )
-{
- GLuint pitch = rmesa->radeonScreen->frontPitch;
- if (rmesa->radeonScreen->depthHasSurface) {
- return 4*(x + y*pitch);
- }
- else {
- GLuint ba, address = 0; /* a[0..1] = 0 */
-
- ba = (y / 16) * (pitch / 16) + (x / 16);
-
- address |= (x & 0x7) << 2; /* a[2..4] = x[0..2] */
- address |= (y & 0x3) << 5; /* a[5..6] = y[0..1] */
- address |=
- (((x & 0x10) >> 2) ^ (y & 0x4)) << 5; /* a[7] = x[4] ^ y[2] */
- address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */
-
- address |= (y & 0x8) << 7; /* a[10] = y[3] */
- address |=
- (((x & 0x8) << 1) ^ (y & 0x10)) << 7; /* a[11] = x[3] ^ y[4] */
- address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */
-
- return address;
- }
-}
-
-static __inline GLuint radeon_mba_z16( radeonContextPtr rmesa, GLint x, GLint y )
-{
- GLuint pitch = rmesa->radeonScreen->frontPitch;
- if (rmesa->radeonScreen->depthHasSurface) {
- return 2*(x + y*pitch);
- }
- else {
- GLuint ba, address = 0; /* a[0] = 0 */
-
- ba = (y / 16) * (pitch / 32) + (x / 32);
-
- address |= (x & 0x7) << 1; /* a[1..3] = x[0..2] */
- address |= (y & 0x7) << 4; /* a[4..6] = y[0..2] */
- address |= (x & 0x8) << 4; /* a[7] = x[3] */
- address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */
- address |= (y & 0x8) << 7; /* a[10] = y[3] */
- address |= ((x & 0x10) ^ (y & 0x10)) << 7; /* a[11] = x[4] ^ y[4] */
- address |= (ba & ~0x3) << 10; /* a[12..] = ba[2..] */
-
- return address;
- }
-}
-
-
-/* 16-bit depth buffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + radeon_mba_z16( rmesa, _x + xo, _y + yo )) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + radeon_mba_z16( rmesa, _x + xo, _y + yo ));
-
-#define TAG(x) radeon##x##_16
-#include "depthtmp.h"
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
-do { \
- GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- tmp |= ((d) & 0x00ffffff); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + radeon_mba_z32( rmesa, _x + xo, \
- _y + yo )) & 0x00ffffff;
-
-#define TAG(x) radeon##x##_24_8
-#include "depthtmp.h"
-
-
-/* ================================================================
- * Stencil buffer
- */
-
-/* 24 bit depth, 8 bit stencil depthbuffer functions
- */
-#define WRITE_STENCIL( _x, _y, d ) \
-do { \
- GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0x00ffffff; \
- tmp |= (((d) & 0xff) << 24); \
- *(GLuint *)(buf + offset) = tmp; \
-} while (0)
-
-#define READ_STENCIL( d, _x, _y ) \
-do { \
- GLuint offset = radeon_mba_z32( rmesa, _x + xo, _y + yo ); \
- GLuint tmp = *(GLuint *)(buf + offset); \
- tmp &= 0xff000000; \
- d = tmp >> 24; \
-} while (0)
-
-#define TAG(x) radeon##x##_24_8
-#include "stenciltmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void radeonSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- }
- break;
- case BUFFER_BIT_BACK_LEFT:
- if ( rmesa->sarea->pfCurrentPage == 1 ) {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- } else {
- rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- }
- break;
- default:
- assert(0);
- break;
- }
-}
-
-/* Move locking out to get reasonable span performance (10x better
- * than doing this in HW_LOCK above). WaitForIdle() is the main
- * culprit.
- */
-
-static void radeonSpanRenderStart( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
- radeonWaitForIdleLocked( rmesa );
-}
-
-static void radeonSpanRenderFinish( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( rmesa );
-}
-
-void radeonInitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = radeonSetBuffer;
- swdd->SpanRenderStart = radeonSpanRenderStart;
- swdd->SpanRenderFinish = radeonSpanRenderFinish;
-}
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-radeonSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- radeonInitPointers_RGB565(&drb->Base);
- }
- else {
- radeonInitPointers_ARGB8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = radeonReadDepthSpan_16;
- drb->Base.GetValues = radeonReadDepthPixels_16;
- drb->Base.PutRow = radeonWriteDepthSpan_16;
- drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_16;
- drb->Base.PutValues = radeonWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = radeonReadDepthSpan_24_8;
- drb->Base.GetValues = radeonReadDepthPixels_24_8;
- drb->Base.PutRow = radeonWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = radeonWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = radeonReadStencilSpan_24_8;
- drb->Base.GetValues = radeonReadStencilPixels_24_8;
- drb->Base.PutRow = radeonWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = radeonWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = radeonWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.h
deleted file mode 100644
index 13b308e1c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_span.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.h,v 1.2 2002/02/22 21:45:01 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#ifndef __RADEON_SPAN_H__
-#define __RADEON_SPAN_H__
-
-#include "drirenderbuffer.h"
-
-extern void radeonInitSpanFuncs( GLcontext *ctx );
-
-extern void radeonSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.c
deleted file mode 100644
index 3a491f5de..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.c
+++ /dev/null
@@ -1,2295 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.c,v 1.8 2002/12/16 16:18:58 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-#include "enums.h"
-#include "colormac.h"
-#include "state.h"
-#include "buffers.h"
-#include "context.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "main/light.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-/* =============================================================
- * Alpha blending
- */
-
-static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
- GLubyte refByte;
-
- CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- RADEON_STATECHANGE( rmesa, ctx );
-
- pp_misc &= ~(RADEON_ALPHA_TEST_OP_MASK | RADEON_REF_ALPHA_MASK);
- pp_misc |= (refByte & RADEON_REF_ALPHA_MASK);
-
- switch ( func ) {
- case GL_NEVER:
- pp_misc |= RADEON_ALPHA_TEST_FAIL;
- break;
- case GL_LESS:
- pp_misc |= RADEON_ALPHA_TEST_LESS;
- break;
- case GL_EQUAL:
- pp_misc |= RADEON_ALPHA_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- pp_misc |= RADEON_ALPHA_TEST_LEQUAL;
- break;
- case GL_GREATER:
- pp_misc |= RADEON_ALPHA_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- pp_misc |= RADEON_ALPHA_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- pp_misc |= RADEON_ALPHA_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- pp_misc |= RADEON_ALPHA_TEST_PASS;
- break;
- }
-
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
-}
-
-static void radeonBlendEquationSeparate( GLcontext *ctx,
- GLenum modeRGB, GLenum modeA )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & ~RADEON_COMB_FCN_MASK;
- GLboolean fallback = GL_FALSE;
-
- assert( modeRGB == modeA );
-
- switch ( modeRGB ) {
- case GL_FUNC_ADD:
- case GL_LOGIC_OP:
- b |= RADEON_COMB_FCN_ADD_CLAMP;
- break;
-
- case GL_FUNC_SUBTRACT:
- b |= RADEON_COMB_FCN_SUB_CLAMP;
- break;
-
- default:
- if (ctx->Color.BlendEnabled)
- fallback = GL_TRUE;
- else
- b |= RADEON_COMB_FCN_ADD_CLAMP;
- break;
- }
-
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_EQ, fallback );
- if ( !fallback ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b;
- if ( ctx->Color._LogicOpEnabled ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE;
- }
- }
-}
-
-static void radeonBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] &
- ~(RADEON_SRC_BLEND_MASK | RADEON_DST_BLEND_MASK);
- GLboolean fallback = GL_FALSE;
-
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- b |= RADEON_SRC_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- b |= RADEON_SRC_BLEND_GL_ONE;
- break;
- case GL_DST_COLOR:
- b |= RADEON_SRC_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_COLOR:
- b |= RADEON_SRC_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- b |= RADEON_SRC_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- b |= RADEON_SRC_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- b |= RADEON_SRC_BLEND_GL_SRC_ALPHA_SATURATE;
- break;
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- if (ctx->Color.BlendEnabled)
- fallback = GL_TRUE;
- else
- b |= RADEON_SRC_BLEND_GL_ONE;
- break;
- default:
- break;
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- b |= RADEON_DST_BLEND_GL_ZERO;
- break;
- case GL_ONE:
- b |= RADEON_DST_BLEND_GL_ONE;
- break;
- case GL_SRC_COLOR:
- b |= RADEON_DST_BLEND_GL_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- b |= RADEON_DST_BLEND_GL_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_COLOR:
- b |= RADEON_DST_BLEND_GL_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_DST_COLOR;
- break;
- case GL_DST_ALPHA:
- b |= RADEON_DST_BLEND_GL_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- b |= RADEON_DST_BLEND_GL_ONE_MINUS_DST_ALPHA;
- break;
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- if (ctx->Color.BlendEnabled)
- fallback = GL_TRUE;
- else
- b |= RADEON_DST_BLEND_GL_ZERO;
- break;
- default:
- break;
- }
-
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, fallback );
- if ( !fallback ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b;
- }
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void radeonDepthFunc( GLcontext *ctx, GLenum func )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~RADEON_Z_TEST_MASK;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_TEST_ALWAYS;
- break;
- }
-}
-
-
-static void radeonDepthMask( GLcontext *ctx, GLboolean flag )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- RADEON_STATECHANGE( rmesa, ctx );
-
- if ( ctx->Depth.Mask ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_WRITE_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~RADEON_Z_WRITE_ENABLE;
- }
-}
-
-static void radeonClearDepth( GLcontext *ctx, GLclampd d )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &
- RADEON_DEPTH_FORMAT_MASK);
-
- switch ( format ) {
- case RADEON_DEPTH_FORMAT_16BIT_INT_Z:
- rmesa->state.depth.clear = d * 0x0000ffff;
- break;
- case RADEON_DEPTH_FORMAT_24BIT_INT_Z:
- rmesa->state.depth.clear = d * 0x00ffffff;
- break;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- union { int i; float f; } c, d;
- GLchan col[4];
-
- c.i = rmesa->hw.fog.cmd[FOG_C];
- d.i = rmesa->hw.fog.cmd[FOG_D];
-
- switch (pname) {
- case GL_FOG_MODE:
- if (!ctx->Fog.Enabled)
- return;
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_LINEAR;
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- }
- else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- break;
- case GL_EXP:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP;
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP2;
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- return;
- }
- break;
- case GL_FOG_DENSITY:
- switch (ctx->Fog.Mode) {
- case GL_EXP:
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- break;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- if (ctx->Fog.Mode == GL_LINEAR) {
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- } else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- }
- break;
- case GL_FOG_COLOR:
- RADEON_STATECHANGE( rmesa, ctx );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] =
- radeonPackColor( 4, col[0], col[1], col[2], 0 );
- break;
- case GL_FOG_COORDINATE_SOURCE_EXT:
- /* What to do?
- */
- break;
- default:
- return;
- }
-
- if (c.i != rmesa->hw.fog.cmd[FOG_C] || d.i != rmesa->hw.fog.cmd[FOG_D]) {
- RADEON_STATECHANGE( rmesa, fog );
- rmesa->hw.fog.cmd[FOG_C] = c.i;
- rmesa->hw.fog.cmd[FOG_D] = d.i;
- }
-}
-
-
-/* =============================================================
- * Scissoring
- */
-
-
-static GLboolean intersect_rect( drm_clip_rect_t *out,
- drm_clip_rect_t *a,
- drm_clip_rect_t *b )
-{
- *out = *a;
- if ( b->x1 > out->x1 ) out->x1 = b->x1;
- if ( b->y1 > out->y1 ) out->y1 = b->y1;
- if ( b->x2 < out->x2 ) out->x2 = b->x2;
- if ( b->y2 < out->y2 ) out->y2 = b->y2;
- if ( out->x1 >= out->x2 ) return GL_FALSE;
- if ( out->y1 >= out->y2 ) return GL_FALSE;
- return GL_TRUE;
-}
-
-
-void radeonRecalcScissorRects( radeonContextPtr rmesa )
-{
- drm_clip_rect_t *out;
- int i;
-
- /* Grow cliprect store?
- */
- if (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- while (rmesa->state.scissor.numAllocedClipRects < rmesa->numClipRects) {
- rmesa->state.scissor.numAllocedClipRects += 1; /* zero case */
- rmesa->state.scissor.numAllocedClipRects *= 2;
- }
-
- if (rmesa->state.scissor.pClipRects)
- FREE(rmesa->state.scissor.pClipRects);
-
- rmesa->state.scissor.pClipRects =
- MALLOC( rmesa->state.scissor.numAllocedClipRects *
- sizeof(drm_clip_rect_t) );
-
- if ( rmesa->state.scissor.pClipRects == NULL ) {
- rmesa->state.scissor.numAllocedClipRects = 0;
- return;
- }
- }
-
- out = rmesa->state.scissor.pClipRects;
- rmesa->state.scissor.numClipRects = 0;
-
- for ( i = 0 ; i < rmesa->numClipRects ; i++ ) {
- if ( intersect_rect( out,
- &rmesa->pClipRects[i],
- &rmesa->state.scissor.rect ) ) {
- rmesa->state.scissor.numClipRects++;
- out++;
- }
- }
-}
-
-
-static void radeonUpdateScissor( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if ( rmesa->dri.drawable ) {
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- int x = ctx->Scissor.X;
- int y = dPriv->h - ctx->Scissor.Y - ctx->Scissor.Height;
- int w = ctx->Scissor.X + ctx->Scissor.Width - 1;
- int h = dPriv->h - ctx->Scissor.Y - 1;
-
- rmesa->state.scissor.rect.x1 = x + dPriv->x;
- rmesa->state.scissor.rect.y1 = y + dPriv->y;
- rmesa->state.scissor.rect.x2 = w + dPriv->x + 1;
- rmesa->state.scissor.rect.y2 = h + dPriv->y + 1;
-
- radeonRecalcScissorRects( rmesa );
- }
-}
-
-
-static void radeonScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if ( ctx->Scissor.Enabled ) {
- RADEON_FIREVERTICES( rmesa ); /* don't pipeline cliprect changes */
- radeonUpdateScissor( ctx );
- }
-
-}
-
-
-/* =============================================================
- * Culling
- */
-
-static void radeonCullFace( GLcontext *ctx, GLenum unused )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
- GLuint t = rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL];
-
- s |= RADEON_FFACE_SOLID | RADEON_BFACE_SOLID;
- t &= ~(RADEON_CULL_FRONT | RADEON_CULL_BACK);
-
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- s &= ~RADEON_FFACE_SOLID;
- t |= RADEON_CULL_FRONT;
- break;
- case GL_BACK:
- s &= ~RADEON_BFACE_SOLID;
- t |= RADEON_CULL_BACK;
- break;
- case GL_FRONT_AND_BACK:
- s &= ~(RADEON_FFACE_SOLID | RADEON_BFACE_SOLID);
- t |= (RADEON_CULL_FRONT | RADEON_CULL_BACK);
- break;
- }
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- RADEON_STATECHANGE(rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-
- if ( rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] != t ) {
- RADEON_STATECHANGE(rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] = t;
- }
-}
-
-static void radeonFrontFace( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_FFACE_CULL_DIR_MASK;
-
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_CULL_FRONT_IS_CCW;
-
- switch ( mode ) {
- case GL_CW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_FFACE_CULL_CW;
- break;
- case GL_CCW:
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_FFACE_CULL_CCW;
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_CULL_FRONT_IS_CCW;
- break;
- }
-}
-
-
-/* =============================================================
- * Line state
- */
-static void radeonLineWidth( GLcontext *ctx, GLfloat widthf )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, lin );
- RADEON_STATECHANGE( rmesa, set );
-
- /* Line width is stored in U6.4 format.
- */
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] = (GLuint)(widthf * 16.0);
- if ( widthf > 1.0 ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_WIDELINE_ENABLE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_WIDELINE_ENABLE;
- }
-}
-
-static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, lin );
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] =
- ((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern));
-}
-
-
-/* =============================================================
- * Masks
- */
-static void radeonColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint mask = radeonPackColor( rmesa->radeonScreen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) {
- RADEON_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = mask;
- }
-}
-
-
-/* =============================================================
- * Polygon state
- */
-
-static void radeonPolygonOffset( GLcontext *ctx,
- GLfloat factor, GLfloat units )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat constant = units * rmesa->state.depth.scale;
-
- RADEON_STATECHANGE( rmesa, zbs );
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_FACTOR] = *(GLuint *)&factor;
- rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = *(GLuint *)&constant;
-}
-
-static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint i;
- drm_radeon_stipple_t stipple;
-
- /* Must flip pattern upside down.
- */
- for ( i = 0 ; i < 32 ; i++ ) {
- rmesa->state.stipple.mask[31 - i] = ((GLuint *) mask)[i];
- }
-
- /* TODO: push this into cmd mechanism
- */
- RADEON_FIREVERTICES( rmesa );
- LOCK_HARDWARE( rmesa );
-
- /* FIXME: Use window x,y offsets into stipple RAM.
- */
- stipple.mask = rmesa->state.stipple.mask;
- drmCommandWrite( rmesa->dri.fd, DRM_RADEON_STIPPLE,
- &stipple, sizeof(drm_radeon_stipple_t) );
- UNLOCK_HARDWARE( rmesa );
-}
-
-static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
-
- /* Can't generally do unfilled via tcl, but some good special
- * cases work.
- */
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_UNFILLED, flag);
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * 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.
- */
-
-/* Examine lighting and texture state to determine if separate specular
- * should be enabled.
- */
-static void radeonUpdateSpecular( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- u_int32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
-
- RADEON_STATECHANGE( rmesa, tcl );
-
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
-
- p &= ~RADEON_SPECULAR_ENABLE;
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_DIFFUSE_SPECULAR_COMBINE;
-
-
- if (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- p |= RADEON_SPECULAR_ENABLE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &=
- ~RADEON_DIFFUSE_SPECULAR_COMBINE;
- }
- else if (ctx->Light.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- } else if (ctx->Fog.ColorSumEnabled ) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- p |= RADEON_SPECULAR_ENABLE;
- } else {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- }
-
- if (ctx->Fog.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
-
- /* Bizzare: have to leave lighting enabled to get fog.
- */
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- }
-
- if (NEED_SECONDARY_COLOR(ctx)) {
- assert( (p & RADEON_SPECULAR_ENABLE) != 0 );
- } else {
- assert( (p & RADEON_SPECULAR_ENABLE) == 0 );
- }
-
- if ( rmesa->hw.ctx.cmd[CTX_PP_CNTL] != p ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = p;
- }
-
- /* Update vertex/render formats
- */
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-}
-
-
-/* =============================================================
- * Materials
- */
-
-
-/* Update on colormaterial, material emmissive/ambient,
- * lightmodel.globalambient
- */
-static void update_global_ambient( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( glt );
-
- /* Need to do more if both emmissive & ambient are PREMULT:
- * Hope this is not needed for MULT
- */
- if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &
- ((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT))) == 0)
- {
- COPY_3V( &fcmd[GLT_RED],
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION]);
- ACC_SCALE_3V( &fcmd[GLT_RED],
- ctx->Light.Model.Ambient,
- ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT]);
- }
- else
- {
- COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient );
- }
-
- RADEON_DB_STATECHANGE(rmesa, &rmesa->hw.glt);
-}
-
-/* Update on change to
- * - light[p].colors
- * - light[p].enabled
- */
-static void update_light_colors( GLcontext *ctx, GLuint p )
-{
- struct gl_light *l = &ctx->Light.Light[p];
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (l->Enabled) {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( lit[p] );
-
- COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient );
- COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse );
- COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular );
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
-}
-
-/* Also fallback for asym colormaterial mode in twoside lighting...
- */
-static void check_twoside_fallback( GLcontext *ctx )
-{
- GLboolean fallback = GL_FALSE;
- GLint i;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
- if (ctx->Light.ColorMaterialEnabled &&
- (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) !=
- ((ctx->Light.ColorMaterialBitmask & FRONT_MATERIAL_BITS)<<1))
- fallback = GL_TRUE;
- else {
- for (i = MAT_ATTRIB_FRONT_AMBIENT; i < MAT_ATTRIB_FRONT_INDEXES; i+=2)
- if (memcmp( ctx->Light.Material.Attrib[i],
- ctx->Light.Material.Attrib[i+1],
- sizeof(GLfloat)*4) != 0) {
- fallback = GL_TRUE;
- break;
- }
- }
- }
-
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_LIGHT_TWOSIDE, fallback );
-}
-
-
-static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
-
- light_model_ctl1 &= ~((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT) |
- (3 << RADEON_DIFFUSE_SOURCE_SHIFT) |
- (3 << RADEON_SPECULAR_SOURCE_SHIFT));
-
- if (ctx->Light.ColorMaterialEnabled) {
- GLuint mask = ctx->Light.ColorMaterialBitmask;
-
- if (mask & MAT_BIT_FRONT_EMISSION) {
- light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_EMISSIVE_SOURCE_SHIFT);
- }
- else {
- light_model_ctl1 |= (RADEON_LM_SOURCE_STATE_MULT <<
- RADEON_EMISSIVE_SOURCE_SHIFT);
- }
-
- if (mask & MAT_BIT_FRONT_AMBIENT) {
- light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_AMBIENT_SOURCE_SHIFT);
- }
- else {
- light_model_ctl1 |= (RADEON_LM_SOURCE_STATE_MULT <<
- RADEON_AMBIENT_SOURCE_SHIFT);
- }
-
- if (mask & MAT_BIT_FRONT_DIFFUSE) {
- light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_DIFFUSE_SOURCE_SHIFT);
- }
- else {
- light_model_ctl1 |= (RADEON_LM_SOURCE_STATE_MULT <<
- RADEON_DIFFUSE_SOURCE_SHIFT);
- }
-
- if (mask & MAT_BIT_FRONT_SPECULAR) {
- light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_SPECULAR_SOURCE_SHIFT);
- }
- else {
- light_model_ctl1 |= (RADEON_LM_SOURCE_STATE_MULT <<
- RADEON_SPECULAR_SOURCE_SHIFT);
- }
- }
- else {
- /* Default to MULT:
- */
- light_model_ctl1 |= (RADEON_LM_SOURCE_STATE_MULT << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_MULT << RADEON_AMBIENT_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_MULT << RADEON_DIFFUSE_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_MULT << RADEON_SPECULAR_SOURCE_SHIFT);
- }
-
- if (light_model_ctl1 != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]) {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = light_model_ctl1;
- }
-}
-
-void radeonUpdateMaterial( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( mtl );
- GLuint mask = ~0;
-
- if (ctx->Light.ColorMaterialEnabled)
- mask &= ~ctx->Light.ColorMaterialBitmask;
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if (mask & MAT_BIT_FRONT_EMISSION) {
- fcmd[MTL_EMMISSIVE_RED] = mat[MAT_ATTRIB_FRONT_EMISSION][0];
- fcmd[MTL_EMMISSIVE_GREEN] = mat[MAT_ATTRIB_FRONT_EMISSION][1];
- fcmd[MTL_EMMISSIVE_BLUE] = mat[MAT_ATTRIB_FRONT_EMISSION][2];
- fcmd[MTL_EMMISSIVE_ALPHA] = mat[MAT_ATTRIB_FRONT_EMISSION][3];
- }
- if (mask & MAT_BIT_FRONT_AMBIENT) {
- fcmd[MTL_AMBIENT_RED] = mat[MAT_ATTRIB_FRONT_AMBIENT][0];
- fcmd[MTL_AMBIENT_GREEN] = mat[MAT_ATTRIB_FRONT_AMBIENT][1];
- fcmd[MTL_AMBIENT_BLUE] = mat[MAT_ATTRIB_FRONT_AMBIENT][2];
- fcmd[MTL_AMBIENT_ALPHA] = mat[MAT_ATTRIB_FRONT_AMBIENT][3];
- }
- if (mask & MAT_BIT_FRONT_DIFFUSE) {
- fcmd[MTL_DIFFUSE_RED] = mat[MAT_ATTRIB_FRONT_DIFFUSE][0];
- fcmd[MTL_DIFFUSE_GREEN] = mat[MAT_ATTRIB_FRONT_DIFFUSE][1];
- fcmd[MTL_DIFFUSE_BLUE] = mat[MAT_ATTRIB_FRONT_DIFFUSE][2];
- fcmd[MTL_DIFFUSE_ALPHA] = mat[MAT_ATTRIB_FRONT_DIFFUSE][3];
- }
- if (mask & MAT_BIT_FRONT_SPECULAR) {
- fcmd[MTL_SPECULAR_RED] = mat[MAT_ATTRIB_FRONT_SPECULAR][0];
- fcmd[MTL_SPECULAR_GREEN] = mat[MAT_ATTRIB_FRONT_SPECULAR][1];
- fcmd[MTL_SPECULAR_BLUE] = mat[MAT_ATTRIB_FRONT_SPECULAR][2];
- fcmd[MTL_SPECULAR_ALPHA] = mat[MAT_ATTRIB_FRONT_SPECULAR][3];
- }
- if (mask & MAT_BIT_FRONT_SHININESS) {
- fcmd[MTL_SHININESS] = mat[MAT_ATTRIB_FRONT_SHININESS][0];
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mtl );
-
- check_twoside_fallback( ctx );
-/* update_global_ambient( ctx );*/
-}
-
-/* _NEW_LIGHT
- * _NEW_MODELVIEW
- * _MESA_NEW_NEED_EYE_COORDS
- *
- * Uses derived state from mesa:
- * _VP_inf_norm
- * _h_inf_norm
- * _Position
- * _NormDirection
- * _ModelViewInvScale
- * _NeedEyeCoords
- * _EyeZDir
- *
- * which are calculated in light.c and are correct for the current
- * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
- * and _MESA_NEW_NEED_EYE_COORDS.
- */
-static void update_light( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- /* Have to check these, or have an automatic shortcircuit mechanism
- * to remove noop statechanges. (Or just do a better job on the
- * front end).
- */
- {
- GLuint tmp = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
-
- if (ctx->_NeedEyeCoords)
- tmp &= ~RADEON_LIGHT_IN_MODELSPACE;
- else
- tmp |= RADEON_LIGHT_IN_MODELSPACE;
-
-
- /* Leave this test disabled: (unexplained q3 lockup) (even with
- new packets)
- */
- if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL])
- {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = tmp;
- }
- }
-
- {
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( eye );
- fcmd[EYE_X] = ctx->_EyeZDir[0];
- fcmd[EYE_Y] = ctx->_EyeZDir[1];
- fcmd[EYE_Z] = - ctx->_EyeZDir[2];
- fcmd[EYE_RESCALE_FACTOR] = ctx->_ModelViewInvScale;
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.eye );
- }
-
-
-
- if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
- fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
- fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
- fcmd[LIT_DIRECTION_W] = 0;
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
- }
- }
-}
-
-static void radeonLightfv( GLcontext *ctx, GLenum light,
- GLenum pname, const GLfloat *params )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLint p = light - GL_LIGHT0;
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd;
-
-
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- update_light_colors( ctx, p );
- break;
-
- case GL_SPOT_DIRECTION:
- /* picked up in update_light */
- break;
-
- case GL_POSITION: {
- /* positions picked up in update_light, but can do flag here */
- GLuint flag;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- /* FIXME: Set RANGE_ATTEN only when needed */
- if (p&1)
- flag = RADEON_LIGHT_1_IS_LOCAL;
- else
- flag = RADEON_LIGHT_0_IS_LOCAL;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_SPOT_EXPONENT:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_EXPONENT] = params[0];
- break;
-
- case GL_SPOT_CUTOFF: {
- GLuint flag = (p&1) ? RADEON_LIGHT_1_IS_SPOT : RADEON_LIGHT_0_IS_SPOT;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_CUTOFF] = l->_CosCutoff;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->SpotCutoff != 180.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
-
- break;
- }
-
- case GL_CONSTANT_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_CONST] = params[0];
- if ( params[0] == 0.0 )
- fcmd[LIT_ATTEN_CONST_INV] = FLT_MAX;
- else
- fcmd[LIT_ATTEN_CONST_INV] = 1.0 / params[0];
- break;
- case GL_LINEAR_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_LINEAR] = params[0];
- break;
- case GL_QUADRATIC_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_QUADRATIC] = params[0];
- break;
- default:
- return;
- }
-
- /* Set RANGE_ATTEN only when needed */
- switch (pname) {
- case GL_POSITION:
- case GL_CONSTANT_ATTENUATION:
- case GL_LINEAR_ATTENUATION:
- case GL_QUADRATIC_ATTENUATION:
- {
- GLuint *icmd = (GLuint *)RADEON_DB_STATE( tcl );
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
- GLuint atten_flag = ( p&1 ) ? RADEON_LIGHT_1_ENABLE_RANGE_ATTEN
- : RADEON_LIGHT_0_ENABLE_RANGE_ATTEN;
- GLuint atten_const_flag = ( p&1 ) ? RADEON_LIGHT_1_CONSTANT_RANGE_ATTEN
- : RADEON_LIGHT_0_CONSTANT_RANGE_ATTEN;
-
- if ( l->EyePosition[3] == 0.0F ||
- ( ( fcmd[LIT_ATTEN_CONST] == 0.0 || fcmd[LIT_ATTEN_CONST] == 1.0 ) &&
- fcmd[LIT_ATTEN_QUADRATIC] == 0.0 && fcmd[LIT_ATTEN_LINEAR] == 0.0 ) ) {
- /* Disable attenuation */
- icmd[idx] &= ~atten_flag;
- } else {
- if ( fcmd[LIT_ATTEN_QUADRATIC] == 0.0 && fcmd[LIT_ATTEN_LINEAR] == 0.0 ) {
- /* Enable only constant portion of attenuation calculation */
- icmd[idx] |= ( atten_flag | atten_const_flag );
- } else {
- /* Enable full attenuation calculation */
- icmd[idx] &= ~atten_const_flag;
- icmd[idx] |= atten_flag;
- }
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.tcl );
- break;
- }
- default:
- break;
- }
-}
-
-
-
-
-static void radeonLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- update_global_ambient( ctx );
- break;
-
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.LocalViewer)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LOCAL_VIEWER;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LOCAL_VIEWER;
- break;
-
- case GL_LIGHT_MODEL_TWO_SIDE:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.TwoSide)
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_LIGHT_TWOSIDE;
- else
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_LIGHT_TWOSIDE;
-
- check_twoside_fallback( ctx );
-
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
- break;
-
- case GL_LIGHT_MODEL_COLOR_CONTROL:
- radeonUpdateSpecular(ctx);
- break;
-
- default:
- break;
- }
-}
-
-static void radeonShadeModel( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
-
- s &= ~(RADEON_DIFFUSE_SHADE_MASK |
- RADEON_ALPHA_SHADE_MASK |
- RADEON_SPECULAR_SHADE_MASK |
- RADEON_FOG_SHADE_MASK);
-
- switch ( mode ) {
- case GL_FLAT:
- s |= (RADEON_DIFFUSE_SHADE_FLAT |
- RADEON_ALPHA_SHADE_FLAT |
- RADEON_SPECULAR_SHADE_FLAT |
- RADEON_FOG_SHADE_FLAT);
- break;
- case GL_SMOOTH:
- s |= (RADEON_DIFFUSE_SHADE_GOURAUD |
- RADEON_ALPHA_SHADE_GOURAUD |
- RADEON_SPECULAR_SHADE_GOURAUD |
- RADEON_FOG_SHADE_GOURAUD);
- break;
- default:
- return;
- }
-
- if ( rmesa->hw.set.cmd[SET_SE_CNTL] != s ) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = s;
- }
-}
-
-
-/* =============================================================
- * User clip planes
- */
-
-static void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
-{
- GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- RADEON_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
-}
-
-static void radeonUpdateClipPlanes( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint p;
-
- for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p];
-
- RADEON_STATECHANGE( rmesa, ucp[p] );
- rmesa->hw.ucp[p].cmd[UCP_X] = ip[0];
- rmesa->hw.ucp[p].cmd[UCP_Y] = ip[1];
- rmesa->hw.ucp[p].cmd[UCP_Z] = ip[2];
- rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
- }
- }
-}
-
-
-/* =============================================================
- * Stencil
- */
-
-static void radeonStencilFunc( GLcontext *ctx, GLenum func,
- GLint ref, GLuint mask )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint refmask = ((ctx->Stencil.Ref[0] << RADEON_STENCIL_REF_SHIFT) |
- (ctx->Stencil.ValueMask[0] << RADEON_STENCIL_MASK_SHIFT));
-
- RADEON_STATECHANGE( rmesa, ctx );
- RADEON_STATECHANGE( rmesa, msk );
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~RADEON_STENCIL_TEST_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~(RADEON_STENCIL_REF_MASK|
- RADEON_STENCIL_VALUE_MASK);
-
- switch ( ctx->Stencil.Function[0] ) {
- case GL_NEVER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_NEVER;
- break;
- case GL_LESS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_LESS;
- break;
- case GL_EQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_EQUAL;
- break;
- case GL_LEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_LEQUAL;
- break;
- case GL_GREATER:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_GREATER;
- break;
- case GL_NOTEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_NEQUAL;
- break;
- case GL_GEQUAL:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_GEQUAL;
- break;
- case GL_ALWAYS:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_TEST_ALWAYS;
- break;
- }
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |= refmask;
-}
-
-static void radeonStencilMask( GLcontext *ctx, GLuint mask )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- RADEON_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] &= ~RADEON_STENCIL_WRITE_MASK;
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] |=
- (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT);
-}
-
-static void radeonStencilOp( GLcontext *ctx, GLenum fail,
- GLenum zfail, GLenum zpass )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- /* radeon 7200 have stencil bug, DEC and INC_WRAP will actually both do DEC_WRAP,
- and DEC_WRAP (and INVERT) will do INVERT. No way to get correct INC_WRAP and DEC,
- but DEC_WRAP can be fixed by using DEC and INC_WRAP at least use INC. */
-
- GLuint tempRADEON_STENCIL_FAIL_DEC_WRAP;
- GLuint tempRADEON_STENCIL_FAIL_INC_WRAP;
- GLuint tempRADEON_STENCIL_ZFAIL_DEC_WRAP;
- GLuint tempRADEON_STENCIL_ZFAIL_INC_WRAP;
- GLuint tempRADEON_STENCIL_ZPASS_DEC_WRAP;
- GLuint tempRADEON_STENCIL_ZPASS_INC_WRAP;
-
- if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_BROKEN_STENCIL) {
- tempRADEON_STENCIL_FAIL_DEC_WRAP = RADEON_STENCIL_FAIL_DEC;
- tempRADEON_STENCIL_FAIL_INC_WRAP = RADEON_STENCIL_FAIL_INC;
- tempRADEON_STENCIL_ZFAIL_DEC_WRAP = RADEON_STENCIL_ZFAIL_DEC;
- tempRADEON_STENCIL_ZFAIL_INC_WRAP = RADEON_STENCIL_ZFAIL_INC;
- tempRADEON_STENCIL_ZPASS_DEC_WRAP = RADEON_STENCIL_ZPASS_DEC;
- tempRADEON_STENCIL_ZPASS_INC_WRAP = RADEON_STENCIL_ZPASS_INC;
- }
- else {
- tempRADEON_STENCIL_FAIL_DEC_WRAP = RADEON_STENCIL_FAIL_DEC_WRAP;
- tempRADEON_STENCIL_FAIL_INC_WRAP = RADEON_STENCIL_FAIL_INC_WRAP;
- tempRADEON_STENCIL_ZFAIL_DEC_WRAP = RADEON_STENCIL_ZFAIL_DEC_WRAP;
- tempRADEON_STENCIL_ZFAIL_INC_WRAP = RADEON_STENCIL_ZFAIL_INC_WRAP;
- tempRADEON_STENCIL_ZPASS_DEC_WRAP = RADEON_STENCIL_ZPASS_DEC_WRAP;
- tempRADEON_STENCIL_ZPASS_INC_WRAP = RADEON_STENCIL_ZPASS_INC_WRAP;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~(RADEON_STENCIL_FAIL_MASK |
- RADEON_STENCIL_ZFAIL_MASK |
- RADEON_STENCIL_ZPASS_MASK);
-
- switch ( ctx->Stencil.FailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_DEC;
- break;
- case GL_INCR_WRAP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= tempRADEON_STENCIL_FAIL_INC_WRAP;
- break;
- case GL_DECR_WRAP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= tempRADEON_STENCIL_FAIL_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_FAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZFailFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_DEC;
- break;
- case GL_INCR_WRAP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= tempRADEON_STENCIL_ZFAIL_INC_WRAP;
- break;
- case GL_DECR_WRAP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= tempRADEON_STENCIL_ZFAIL_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZFAIL_INVERT;
- break;
- }
-
- switch ( ctx->Stencil.ZPassFunc[0] ) {
- case GL_KEEP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_KEEP;
- break;
- case GL_ZERO:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_ZERO;
- break;
- case GL_REPLACE:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_REPLACE;
- break;
- case GL_INCR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_INC;
- break;
- case GL_DECR:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_DEC;
- break;
- case GL_INCR_WRAP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= tempRADEON_STENCIL_ZPASS_INC_WRAP;
- break;
- case GL_DECR_WRAP:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= tempRADEON_STENCIL_ZPASS_DEC_WRAP;
- break;
- case GL_INVERT:
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_STENCIL_ZPASS_INVERT;
- break;
- }
-}
-
-static void radeonClearStencil( GLcontext *ctx, GLint s )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- rmesa->state.stencil.clear =
- ((GLuint) ctx->Stencil.Clear |
- (0xff << RADEON_STENCIL_MASK_SHIFT) |
- (ctx->Stencil.WriteMask[0] << RADEON_STENCIL_WRITEMASK_SHIFT));
-}
-
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-/*
- * To correctly position primitives:
- */
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-void radeonUpdateWindow( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat sx = v[MAT_SX];
- GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
- GLfloat sy = - v[MAT_SY];
- GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
- GLfloat sz = v[MAT_SZ] * rmesa->state.depth.scale;
- GLfloat tz = v[MAT_TZ] * rmesa->state.depth.scale;
- RADEON_FIREVERTICES( rmesa );
- RADEON_STATECHANGE( rmesa, vpt );
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = *(GLuint *)&sx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = *(GLuint *)&sy;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = *(GLuint *)&sz;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = *(GLuint *)&tz;
-}
-
-
-
-static void radeonViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- /* Don't pipeline viewport changes, conflict with window offset
- * setting below. Could apply deltas to rescue pipelined viewport
- * values, or keep the originals hanging around.
- */
- RADEON_FIREVERTICES( RADEON_CONTEXT(ctx) );
- radeonUpdateWindow( ctx );
-}
-
-static void radeonDepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- radeonUpdateWindow( ctx );
-}
-
-void radeonUpdateViewportOffset( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h;
- const GLfloat *v = ctx->Viewport._WindowMap.m;
-
- GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
- GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
-
- if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != *(GLuint *)&tx ||
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != *(GLuint *)&ty )
- {
- /* Note: this should also modify whatever data the context reset
- * code uses...
- */
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = *(GLuint *)&tx;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = *(GLuint *)&ty;
-
- /* update polygon stipple x/y screen offset */
- {
- GLuint stx, sty;
- GLuint m = rmesa->hw.msc.cmd[MSC_RE_MISC];
-
- m &= ~(RADEON_STIPPLE_X_OFFSET_MASK |
- RADEON_STIPPLE_Y_OFFSET_MASK);
-
- /* add magic offsets, then invert */
- stx = 31 - ((rmesa->dri.drawable->x - 1) & RADEON_STIPPLE_COORD_MASK);
- sty = 31 - ((rmesa->dri.drawable->y + rmesa->dri.drawable->h - 1)
- & RADEON_STIPPLE_COORD_MASK);
-
- m |= ((stx << RADEON_STIPPLE_X_OFFSET_SHIFT) |
- (sty << RADEON_STIPPLE_Y_OFFSET_SHIFT));
-
- if ( rmesa->hw.msc.cmd[MSC_RE_MISC] != m ) {
- RADEON_STATECHANGE( rmesa, msc );
- rmesa->hw.msc.cmd[MSC_RE_MISC] = m;
- }
- }
- }
-
- radeonUpdateScissor( ctx );
-}
-
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] )
-{
- radeonContextPtr rmesa = RADEON_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]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
- rmesa->state.color.clear = radeonPackColor( rmesa->radeonScreen->cpp,
- c[0], c[1], c[2], c[3] );
-}
-
-
-static void radeonRenderMode( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- FALLBACK( rmesa, RADEON_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-static GLuint radeon_rop_tab[] = {
- RADEON_ROP_CLEAR,
- RADEON_ROP_AND,
- RADEON_ROP_AND_REVERSE,
- RADEON_ROP_COPY,
- RADEON_ROP_AND_INVERTED,
- RADEON_ROP_NOOP,
- RADEON_ROP_XOR,
- RADEON_ROP_OR,
- RADEON_ROP_NOR,
- RADEON_ROP_EQUIV,
- RADEON_ROP_INVERT,
- RADEON_ROP_OR_REVERSE,
- RADEON_ROP_COPY_INVERTED,
- RADEON_ROP_OR_INVERTED,
- RADEON_ROP_NAND,
- RADEON_ROP_SET,
-};
-
-static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint rop = (GLuint)opcode - GL_CLEAR;
-
- ASSERT( rop < 16 );
-
- RADEON_STATECHANGE( rmesa, msk );
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = radeon_rop_tab[rop];
-}
-
-
-void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode )
-{
- __DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = dPriv->pClipRects;
- break;
- case GL_BACK_LEFT:
- /* Can't ignore 2d windows if we are page flipping.
- */
- if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) {
- rmesa->numClipRects = dPriv->numClipRects;
- rmesa->pClipRects = dPriv->pClipRects;
- }
- else {
- rmesa->numClipRects = dPriv->numBackClipRects;
- rmesa->pClipRects = dPriv->pBackClipRects;
- }
- break;
- default:
- fprintf(stderr, "bad mode in radeonSetCliprects\n");
- return;
- }
-
- if (rmesa->state.scissor.enabled)
- radeonRecalcScissorRects( rmesa );
-}
-
-
-static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- RADEON_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
- radeonSetCliprects( rmesa, GL_FRONT_LEFT );
- break;
- case BUFFER_BIT_BACK_LEFT:
- FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
- radeonSetCliprects( rmesa, GL_BACK_LEFT );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->radeonScreen->fbLocation)
- & RADEON_COLOROFFSET_MASK);
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= RADEON_COLOR_TILE_ENABLE;
- }
-}
-
-static void radeonReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-
-/* =============================================================
- * State enable/disable
- */
-
-static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint p, flag;
-
- if ( RADEON_DEBUG & DEBUG_STATE )
- fprintf( stderr, "%s( %s = %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( cap ),
- state ? "GL_TRUE" : "GL_FALSE" );
-
- switch ( cap ) {
- /* Fast track this one...
- */
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- break;
-
- case GL_ALPHA_TEST:
- RADEON_STATECHANGE( rmesa, ctx );
- if (state) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_ALPHA_TEST_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_ALPHA_TEST_ENABLE;
- }
- break;
-
- case GL_BLEND:
- RADEON_STATECHANGE( rmesa, ctx );
- if (state) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ALPHA_BLEND_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ALPHA_BLEND_ENABLE;
- }
- if ( ctx->Color._LogicOpEnabled ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE;
- }
-
- /* Catch a possible fallback:
- */
- if (state) {
- ctx->Driver.BlendEquationSeparate( ctx,
- ctx->Color.BlendEquationRGB,
- ctx->Color.BlendEquationA );
- ctx->Driver.BlendFuncSeparate( ctx, ctx->Color.BlendSrcRGB,
- ctx->Color.BlendDstRGB,
- ctx->Color.BlendSrcA,
- ctx->Color.BlendDstA );
- }
- else {
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, GL_FALSE );
- FALLBACK( rmesa, RADEON_FALLBACK_BLEND_EQ, GL_FALSE );
- }
- break;
-
- case GL_CLIP_PLANE0:
- case GL_CLIP_PLANE1:
- case GL_CLIP_PLANE2:
- case GL_CLIP_PLANE3:
- case GL_CLIP_PLANE4:
- case GL_CLIP_PLANE5:
- p = cap-GL_CLIP_PLANE0;
- RADEON_STATECHANGE( rmesa, tcl );
- if (state) {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (RADEON_UCP_ENABLE_0<<p);
- radeonClipPlane( ctx, cap, NULL );
- }
- else {
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~(RADEON_UCP_ENABLE_0<<p);
- }
- break;
-
- case GL_COLOR_MATERIAL:
- radeonColorMaterial( ctx, 0, 0 );
- radeonUpdateMaterial( ctx );
- break;
-
- case GL_CULL_FACE:
- radeonCullFace( ctx, 0 );
- break;
-
- case GL_DEPTH_TEST:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_Z_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_Z_ENABLE;
- }
- break;
-
- case GL_DITHER:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~rmesa->state.color.roundEnable;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_DITHER_ENABLE;
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
- }
- break;
-
- case GL_FOG:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_FOG_ENABLE;
- radeonFogfv( ctx, GL_FOG_MODE, NULL );
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_FOG_ENABLE;
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
- }
- radeonUpdateSpecular( ctx ); /* for PK_SPEC */
- if (rmesa->TclFallback)
- radeonChooseVertexState( ctx );
- _mesa_allow_light_in_model( ctx, !state );
- break;
-
- case GL_LIGHT0:
- case GL_LIGHT1:
- case GL_LIGHT2:
- case GL_LIGHT3:
- case GL_LIGHT4:
- case GL_LIGHT5:
- case GL_LIGHT6:
- case GL_LIGHT7:
- RADEON_STATECHANGE(rmesa, tcl);
- p = cap - GL_LIGHT0;
- if (p&1)
- flag = (RADEON_LIGHT_1_ENABLE |
- RADEON_LIGHT_1_ENABLE_AMBIENT |
- RADEON_LIGHT_1_ENABLE_SPECULAR);
- else
- flag = (RADEON_LIGHT_0_ENABLE |
- RADEON_LIGHT_0_ENABLE_AMBIENT |
- RADEON_LIGHT_0_ENABLE_SPECULAR);
-
- if (state)
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] |= flag;
- else
- rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] &= ~flag;
-
- /*
- */
- update_light_colors( ctx, p );
- break;
-
- case GL_LIGHTING:
- RADEON_STATECHANGE(rmesa, tcl);
- radeonUpdateSpecular(ctx);
- check_twoside_fallback( ctx );
- break;
-
- case GL_LINE_SMOOTH:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_ANTI_ALIAS_LINE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_ANTI_ALIAS_LINE;
- }
- break;
-
- case GL_LINE_STIPPLE:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_PATTERN_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_PATTERN_ENABLE;
- }
- break;
-
- case GL_COLOR_LOGIC_OP:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( ctx->Color._LogicOpEnabled ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE;
- }
- break;
-
- case GL_NORMALIZE:
- RADEON_STATECHANGE( rmesa, tcl );
- if ( state ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_NORMALIZE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_NORMALIZE_NORMALS;
- }
- break;
-
- case GL_POLYGON_OFFSET_POINT:
- if (rmesa->dri.drmMinor == 1) {
- radeonChooseRenderState( ctx );
- }
- else {
- RADEON_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_ZBIAS_ENABLE_POINT;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_ZBIAS_ENABLE_POINT;
- }
- }
- break;
-
- case GL_POLYGON_OFFSET_LINE:
- if (rmesa->dri.drmMinor == 1) {
- radeonChooseRenderState( ctx );
- }
- else {
- RADEON_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_ZBIAS_ENABLE_LINE;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_ZBIAS_ENABLE_LINE;
- }
- }
- break;
-
- case GL_POLYGON_OFFSET_FILL:
- if (rmesa->dri.drmMinor == 1) {
- radeonChooseRenderState( ctx );
- }
- else {
- RADEON_STATECHANGE( rmesa, set );
- if ( state ) {
- rmesa->hw.set.cmd[SET_SE_CNTL] |= RADEON_ZBIAS_ENABLE_TRI;
- } else {
- rmesa->hw.set.cmd[SET_SE_CNTL] &= ~RADEON_ZBIAS_ENABLE_TRI;
- }
- }
- break;
-
- case GL_POLYGON_SMOOTH:
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_ANTI_ALIAS_POLY;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_ANTI_ALIAS_POLY;
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- RADEON_STATECHANGE(rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= RADEON_STIPPLE_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &= ~RADEON_STIPPLE_ENABLE;
- }
- break;
-
- case GL_RESCALE_NORMAL_EXT: {
- GLboolean tmp = ctx->_NeedEyeCoords ? state : !state;
- RADEON_STATECHANGE( rmesa, tcl );
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_RESCALE_NORMALS;
- }
- break;
- }
-
- case GL_SCISSOR_TEST:
- RADEON_FIREVERTICES( rmesa );
- rmesa->state.scissor.enabled = state;
- radeonUpdateScissor( ctx );
- break;
-
- case GL_STENCIL_TEST:
- if ( rmesa->state.stencil.hwBuffer ) {
- RADEON_STATECHANGE( rmesa, ctx );
- if ( state ) {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_STENCIL_ENABLE;
- } else {
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_STENCIL_ENABLE;
- }
- } else {
- FALLBACK( rmesa, RADEON_FALLBACK_STENCIL, state );
- }
- break;
-
- case GL_TEXTURE_GEN_Q:
- case GL_TEXTURE_GEN_R:
- case GL_TEXTURE_GEN_S:
- case GL_TEXTURE_GEN_T:
- /* Picked up in radeonUpdateTextureState.
- */
- rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE;
- break;
-
- case GL_COLOR_SUM_EXT:
- radeonUpdateSpecular ( ctx );
- break;
-
- default:
- return;
- }
-}
-
-
-static void radeonLightingSpaceChange( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean tmp;
- RADEON_STATECHANGE( rmesa, tcl );
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d BEFORE %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]);
-
- if (ctx->_NeedEyeCoords)
- tmp = ctx->Transform.RescaleNormals;
- else
- tmp = !ctx->Transform.RescaleNormals;
-
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_RESCALE_NORMALS;
- }
-
- if (RADEON_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d AFTER %x\n", __FUNCTION__, ctx->_NeedEyeCoords,
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]);
-}
-
-/* =============================================================
- * Deferred state management - matrices, textures, other?
- */
-
-
-
-
-static void upload_matrix( radeonContextPtr rmesa, GLfloat *src, int idx )
-{
- float *dest = ((float *)RADEON_DB_STATE( mat[idx] ))+MAT_ELT_0;
- int i;
-
-
- for (i = 0 ; i < 4 ; i++) {
- *dest++ = src[i];
- *dest++ = src[i+4];
- *dest++ = src[i+8];
- *dest++ = src[i+12];
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-static void upload_matrix_t( radeonContextPtr rmesa, GLfloat *src, int idx )
-{
- float *dest = ((float *)RADEON_DB_STATE( mat[idx] ))+MAT_ELT_0;
- memcpy(dest, src, 16*sizeof(float));
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mat[idx] );
-}
-
-
-static void update_texturematrix( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- GLuint tpc = rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL];
- GLuint vs = rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL];
- int unit;
-
- rmesa->TexMatEnabled = 0;
-
- for (unit = 0 ; unit < 2; unit++) {
- if (!ctx->Texture.Unit[unit]._ReallyEnabled) {
- }
- else if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) {
- GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
-
- rmesa->TexMatEnabled |= (RADEON_TEXGEN_TEXMAT_0_ENABLE|
- RADEON_TEXMAT_0_ENABLE) << unit;
-
- if (rmesa->TexGenEnabled & (RADEON_TEXMAT_0_ENABLE << unit)) {
- /* Need to preconcatenate any active texgen
- * obj/eyeplane matrices:
- */
- _math_matrix_mul_matrix( &rmesa->tmpmat,
- &rmesa->TexGenMatrix[unit],
- ctx->TextureMatrixStack[unit].Top );
- upload_matrix( rmesa, rmesa->tmpmat.m, TEXMAT_0+unit );
- }
- else {
- rmesa->TexMatEnabled |=
- (RADEON_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
- upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m,
- TEXMAT_0+unit );
- }
- }
- else if (rmesa->TexGenEnabled & (RADEON_TEXMAT_0_ENABLE << unit)) {
- upload_matrix( rmesa, rmesa->TexGenMatrix[unit].m,
- TEXMAT_0+unit );
- }
- }
-
-
- tpc = (rmesa->TexMatEnabled | rmesa->TexGenEnabled);
-
- vs &= ~((0xf << RADEON_TCL_TEX_0_OUTPUT_SHIFT) |
- (0xf << RADEON_TCL_TEX_1_OUTPUT_SHIFT));
-
- if (tpc & RADEON_TEXGEN_TEXMAT_0_ENABLE)
- vs |= RADEON_TCL_TEX_COMPUTED_TEX_0 << RADEON_TCL_TEX_0_OUTPUT_SHIFT;
- else
- vs |= RADEON_TCL_TEX_INPUT_TEX_0 << RADEON_TCL_TEX_0_OUTPUT_SHIFT;
-
- if (tpc & RADEON_TEXGEN_TEXMAT_1_ENABLE)
- vs |= RADEON_TCL_TEX_COMPUTED_TEX_1 << RADEON_TCL_TEX_1_OUTPUT_SHIFT;
- else
- vs |= RADEON_TCL_TEX_INPUT_TEX_1 << RADEON_TCL_TEX_1_OUTPUT_SHIFT;
-
- if (tpc != rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL] ||
- vs != rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL]) {
-
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL] = tpc;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] = vs;
- }
-}
-
-
-
-void radeonValidateState( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint new_state = rmesa->NewGLState;
-
- if (new_state & _NEW_TEXTURE) {
- radeonUpdateTextureState( ctx );
- new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */
- }
-
- /* Need an event driven matrix update?
- */
- if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
- upload_matrix( rmesa, ctx->_ModelProjectMatrix.m, MODEL_PROJ );
-
- /* Need these for lighting (shouldn't upload otherwise)
- */
- if (new_state & (_NEW_MODELVIEW)) {
- upload_matrix( rmesa, ctx->ModelviewMatrixStack.Top->m, MODEL );
- upload_matrix_t( rmesa, ctx->ModelviewMatrixStack.Top->inv, MODEL_IT );
- }
-
- /* Does this need to be triggered on eg. modelview for
- * texgen-derived objplane/eyeplane matrices?
- */
- if (new_state & _NEW_TEXTURE_MATRIX) {
- update_texturematrix( ctx );
- }
-
- if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW|_MESA_NEW_NEED_EYE_COORDS)) {
- update_light( ctx );
- }
-
- /* emit all active clip planes if projection matrix changes.
- */
- if (new_state & (_NEW_PROJECTION)) {
- if (ctx->Transform.ClipPlanesEnabled)
- radeonUpdateClipPlanes( ctx );
- }
-
-
- rmesa->NewGLState = 0;
-}
-
-
-static void radeonInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _ae_invalidate_state( ctx, new_state );
- RADEON_CONTEXT(ctx)->NewGLState |= new_state;
- radeonVtxfmtInvalidate( ctx );
-}
-
-
-/* A hack. Need a faster way to find this out.
- */
-static GLboolean check_material( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLint i;
-
- for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT;
- i < _TNL_ATTRIB_MAT_BACK_INDEXES;
- i++)
- if (tnl->vb.AttribPtr[i] &&
- tnl->vb.AttribPtr[i]->stride)
- return GL_TRUE;
-
- return GL_FALSE;
-}
-
-
-static void radeonWrapRunPipeline( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean has_material;
-
- if (0)
- fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState);
-
- /* Validate state:
- */
- if (rmesa->NewGLState)
- radeonValidateState( ctx );
-
- has_material = (ctx->Light.Enabled && check_material( ctx ));
-
- if (has_material) {
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_TRUE );
- }
-
- /* Run the pipeline.
- */
- _tnl_run_pipeline( ctx );
-
- if (has_material) {
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_FALSE );
- }
-}
-
-
-/* Initialize the driver's state functions.
- */
-void radeonInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = radeonInvalidateState;
- ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange;
-
- ctx->Driver.DrawBuffer = radeonDrawBuffer;
- ctx->Driver.ReadBuffer = radeonReadBuffer;
-
- ctx->Driver.AlphaFunc = radeonAlphaFunc;
- ctx->Driver.BlendEquationSeparate = radeonBlendEquationSeparate;
- 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;
- ctx->Driver.CullFace = radeonCullFace;
- ctx->Driver.DepthFunc = radeonDepthFunc;
- ctx->Driver.DepthMask = radeonDepthMask;
- ctx->Driver.DepthRange = radeonDepthRange;
- ctx->Driver.Enable = radeonEnable;
- 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;
- ctx->Driver.LineWidth = radeonLineWidth;
- ctx->Driver.LogicOpcode = radeonLogicOpCode;
- ctx->Driver.PolygonMode = radeonPolygonMode;
-
- if (RADEON_CONTEXT(ctx)->dri.drmMinor > 1)
- ctx->Driver.PolygonOffset = radeonPolygonOffset;
-
- ctx->Driver.PolygonStipple = radeonPolygonStipple;
- ctx->Driver.RenderMode = radeonRenderMode;
- ctx->Driver.Scissor = radeonScissor;
- ctx->Driver.ShadeModel = radeonShadeModel;
- ctx->Driver.StencilFunc = radeonStencilFunc;
- ctx->Driver.StencilMask = radeonStencilMask;
- ctx->Driver.StencilOp = radeonStencilOp;
- ctx->Driver.Viewport = radeonViewport;
-
- /* Pixel path fallbacks
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = radeonUpdateMaterial;
- TNL_CONTEXT(ctx)->Driver.RunPipeline = radeonWrapRunPipeline;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.h
deleted file mode 100644
index 07739be94..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state.h,v 1.5 2002/11/05 17:46:09 tsi Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __RADEON_STATE_H__
-#define __RADEON_STATE_H__
-
-#include "radeon_context.h"
-
-extern void radeonInitState( radeonContextPtr rmesa );
-extern void radeonInitStateFuncs( GLcontext *ctx );
-
-extern void radeonUpdateMaterial( GLcontext *ctx );
-
-extern void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode );
-extern void radeonRecalcScissorRects( radeonContextPtr rmesa );
-extern void radeonUpdateViewportOffset( GLcontext *ctx );
-extern void radeonUpdateWindow( GLcontext *ctx );
-
-extern void radeonValidateState( GLcontext *ctx );
-
-extern void radeonPrintDirty( radeonContextPtr rmesa,
- const char *msg );
-
-
-extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) do { \
- if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
- __FUNCTION__, bit, mode ); \
- radeonFallback( rmesa->glCtx, bit, mode ); \
-} while (0)
-
-
-#define MODEL_PROJ 0
-#define MODEL 1
-#define MODEL_IT 2
-#define TEXMAT_0 3
-#define TEXMAT_1 4
-#define TEXMAT_2 5
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state_init.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state_init.c
deleted file mode 100644
index 1caffe132..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_state_init.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_state_init.c,v 1.3 2003/02/22 06:21:11 dawes Exp $ */
-/*
- * Copyright 2000, 2001 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, 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
- * 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:
- * Gareth Hughes <gareth@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "api_arrayelt.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-#include "xmlpool.h"
-
-/* =============================================================
- * State initialization
- */
-
-void radeonPrintDirty( radeonContextPtr rmesa, const char *msg )
-{
- struct radeon_state_atom *l;
-
- fprintf(stderr, msg);
- fprintf(stderr, ": ");
-
- foreach(l, &rmesa->hw.atomlist) {
- if (l->dirty || rmesa->hw.all_dirty)
- fprintf(stderr, "%s, ", l->name);
- }
-
- fprintf(stderr, "\n");
-}
-
-static int cmdpkt( int id )
-{
- drm_radeon_cmd_header_t h;
- h.i = 0;
- h.packet.cmd_type = RADEON_CMD_PACKET;
- h.packet.packet_id = id;
- return h.i;
-}
-
-static int cmdvec( int offset, int stride, int count )
-{
- drm_radeon_cmd_header_t h;
- h.i = 0;
- h.vectors.cmd_type = RADEON_CMD_VECTORS;
- h.vectors.offset = offset;
- h.vectors.stride = stride;
- h.vectors.count = count;
- return h.i;
-}
-
-static int cmdscl( int offset, int stride, int count )
-{
- drm_radeon_cmd_header_t h;
- h.i = 0;
- h.scalars.cmd_type = RADEON_CMD_SCALARS;
- h.scalars.offset = offset;
- h.scalars.stride = stride;
- h.scalars.count = count;
- return h.i;
-}
-
-#define CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx ) \
-{ \
- return FLAG; \
-}
-
-#define TCL_CHECK( NM, FLAG ) \
-static GLboolean check_##NM( GLcontext *ctx ) \
-{ \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- return !rmesa->TclFallback && (FLAG); \
-}
-
-
-CHECK( always, GL_TRUE )
-CHECK( tex0, ctx->Texture.Unit[0]._ReallyEnabled )
-CHECK( tex1, ctx->Texture.Unit[1]._ReallyEnabled )
-CHECK( fog, ctx->Fog.Enabled )
-TCL_CHECK( tcl, GL_TRUE )
-TCL_CHECK( tcl_tex0, ctx->Texture.Unit[0]._ReallyEnabled )
-TCL_CHECK( tcl_tex1, ctx->Texture.Unit[1]._ReallyEnabled )
-TCL_CHECK( tcl_lighting, ctx->Light.Enabled )
-TCL_CHECK( tcl_eyespace_or_lighting, ctx->_NeedEyeCoords || ctx->Light.Enabled )
-TCL_CHECK( tcl_lit0, ctx->Light.Enabled && ctx->Light.Light[0].Enabled )
-TCL_CHECK( tcl_lit1, ctx->Light.Enabled && ctx->Light.Light[1].Enabled )
-TCL_CHECK( tcl_lit2, ctx->Light.Enabled && ctx->Light.Light[2].Enabled )
-TCL_CHECK( tcl_lit3, ctx->Light.Enabled && ctx->Light.Light[3].Enabled )
-TCL_CHECK( tcl_lit4, ctx->Light.Enabled && ctx->Light.Light[4].Enabled )
-TCL_CHECK( tcl_lit5, ctx->Light.Enabled && ctx->Light.Light[5].Enabled )
-TCL_CHECK( tcl_lit6, ctx->Light.Enabled && ctx->Light.Light[6].Enabled )
-TCL_CHECK( tcl_lit7, ctx->Light.Enabled && ctx->Light.Light[7].Enabled )
-TCL_CHECK( tcl_ucp0, (ctx->Transform.ClipPlanesEnabled & 0x1) )
-TCL_CHECK( tcl_ucp1, (ctx->Transform.ClipPlanesEnabled & 0x2) )
-TCL_CHECK( tcl_ucp2, (ctx->Transform.ClipPlanesEnabled & 0x4) )
-TCL_CHECK( tcl_ucp3, (ctx->Transform.ClipPlanesEnabled & 0x8) )
-TCL_CHECK( tcl_ucp4, (ctx->Transform.ClipPlanesEnabled & 0x10) )
-TCL_CHECK( tcl_ucp5, (ctx->Transform.ClipPlanesEnabled & 0x20) )
-TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords || ctx->Fog.Enabled )
-
-CHECK( txr0, (ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_RECT_BIT))
-CHECK( txr1, (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_RECT_BIT))
-
-
-
-/* Initialize the context's hardware state.
- */
-void radeonInitState( radeonContextPtr rmesa )
-{
- GLcontext *ctx = rmesa->glCtx;
- GLuint color_fmt, depth_fmt, i;
-
- switch ( rmesa->radeonScreen->cpp ) {
- case 2:
- color_fmt = RADEON_COLOR_FORMAT_RGB565;
- break;
- case 4:
- color_fmt = RADEON_COLOR_FORMAT_ARGB8888;
- break;
- default:
- fprintf( stderr, "Error: Unsupported pixel depth... exiting\n" );
- exit( -1 );
- }
-
- rmesa->state.color.clear = 0x00000000;
-
- switch ( ctx->Visual.depthBits ) {
- case 16:
- rmesa->state.depth.clear = 0x0000ffff;
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffff;
- depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z;
- rmesa->state.stencil.clear = 0x00000000;
- break;
- case 24:
- rmesa->state.depth.clear = 0x00ffffff;
- rmesa->state.depth.scale = 1.0 / (GLfloat)0xffffff;
- depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z;
- rmesa->state.stencil.clear = 0xffff0000;
- break;
- default:
- fprintf( stderr, "Error: Unsupported depth %d... exiting\n",
- ctx->Visual.depthBits );
- exit( -1 );
- }
-
- /* Only have hw stencil when depth buffer is 24 bits deep */
- rmesa->state.stencil.hwBuffer = ( ctx->Visual.stencilBits > 0 &&
- ctx->Visual.depthBits == 24 );
-
- rmesa->Fallback = 0;
-
- if ( ctx->Visual.doubleBufferMode && rmesa->sarea->pfCurrentPage == 0 ) {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->backOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->backPitch;
- } else {
- rmesa->state.color.drawOffset = rmesa->radeonScreen->frontOffset;
- rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
- }
- rmesa->state.pixel.readOffset = rmesa->state.color.drawOffset;
- rmesa->state.pixel.readPitch = rmesa->state.color.drawPitch;
-
- rmesa->hw.max_state_size = 0;
-
-#define ALLOC_STATE( ATOM, CHK, SZ, NM, FLAG ) \
- do { \
- rmesa->hw.ATOM.cmd_size = SZ; \
- rmesa->hw.ATOM.cmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.lastcmd = (int *)CALLOC(SZ * sizeof(int)); \
- rmesa->hw.ATOM.name = NM; \
- rmesa->hw.ATOM.is_tcl = FLAG; \
- rmesa->hw.ATOM.check = check_##CHK; \
- rmesa->hw.ATOM.dirty = GL_TRUE; \
- rmesa->hw.max_state_size += SZ * sizeof(int); \
- } while (0)
-
-
- /* Allocate state buffers:
- */
- ALLOC_STATE( ctx, always, CTX_STATE_SIZE, "CTX/context", 0 );
- ALLOC_STATE( lin, always, LIN_STATE_SIZE, "LIN/line", 0 );
- ALLOC_STATE( msk, always, MSK_STATE_SIZE, "MSK/mask", 0 );
- ALLOC_STATE( vpt, always, VPT_STATE_SIZE, "VPT/viewport", 0 );
- ALLOC_STATE( set, always, SET_STATE_SIZE, "SET/setup", 0 );
- ALLOC_STATE( msc, always, MSC_STATE_SIZE, "MSC/misc", 0 );
- ALLOC_STATE( zbs, always, ZBS_STATE_SIZE, "ZBS/zbias", 0 );
- ALLOC_STATE( tcl, always, TCL_STATE_SIZE, "TCL/tcl", 1 );
- ALLOC_STATE( mtl, tcl_lighting, MTL_STATE_SIZE, "MTL/material", 1 );
- ALLOC_STATE( grd, always, GRD_STATE_SIZE, "GRD/guard-band", 1 );
- ALLOC_STATE( fog, fog, FOG_STATE_SIZE, "FOG/fog", 1 );
- ALLOC_STATE( glt, tcl_lighting, GLT_STATE_SIZE, "GLT/light-global", 1 );
- ALLOC_STATE( eye, tcl_lighting, EYE_STATE_SIZE, "EYE/eye-vector", 1 );
- ALLOC_STATE( tex[0], tex0, TEX_STATE_SIZE, "TEX/tex-0", 0 );
- ALLOC_STATE( tex[1], tex1, TEX_STATE_SIZE, "TEX/tex-1", 0 );
- ALLOC_STATE( mat[0], tcl, MAT_STATE_SIZE, "MAT/modelproject", 1 );
- ALLOC_STATE( mat[1], tcl_eyespace_or_fog, MAT_STATE_SIZE, "MAT/modelview", 1 );
- ALLOC_STATE( mat[2], tcl_eyespace_or_lighting, MAT_STATE_SIZE, "MAT/it-modelview", 1 );
- ALLOC_STATE( mat[3], tcl_tex0, MAT_STATE_SIZE, "MAT/texmat0", 1 );
- ALLOC_STATE( mat[4], tcl_tex1, MAT_STATE_SIZE, "MAT/texmat1", 1 );
- ALLOC_STATE( ucp[0], tcl_ucp0, UCP_STATE_SIZE, "UCP/userclip-0", 1 );
- ALLOC_STATE( ucp[1], tcl_ucp1, UCP_STATE_SIZE, "UCP/userclip-1", 1 );
- ALLOC_STATE( ucp[2], tcl_ucp2, UCP_STATE_SIZE, "UCP/userclip-2", 1 );
- ALLOC_STATE( ucp[3], tcl_ucp3, UCP_STATE_SIZE, "UCP/userclip-3", 1 );
- ALLOC_STATE( ucp[4], tcl_ucp4, UCP_STATE_SIZE, "UCP/userclip-4", 1 );
- ALLOC_STATE( ucp[5], tcl_ucp5, UCP_STATE_SIZE, "UCP/userclip-5", 1 );
- ALLOC_STATE( lit[0], tcl_lit0, LIT_STATE_SIZE, "LIT/light-0", 1 );
- ALLOC_STATE( lit[1], tcl_lit1, LIT_STATE_SIZE, "LIT/light-1", 1 );
- ALLOC_STATE( lit[2], tcl_lit2, LIT_STATE_SIZE, "LIT/light-2", 1 );
- ALLOC_STATE( lit[3], tcl_lit3, LIT_STATE_SIZE, "LIT/light-3", 1 );
- ALLOC_STATE( lit[4], tcl_lit4, LIT_STATE_SIZE, "LIT/light-4", 1 );
- ALLOC_STATE( lit[5], tcl_lit5, LIT_STATE_SIZE, "LIT/light-5", 1 );
- ALLOC_STATE( lit[6], tcl_lit6, LIT_STATE_SIZE, "LIT/light-6", 1 );
- ALLOC_STATE( lit[7], tcl_lit7, LIT_STATE_SIZE, "LIT/light-7", 1 );
- ALLOC_STATE( txr[0], txr0, TXR_STATE_SIZE, "TXR/txr-0", 0 );
- ALLOC_STATE( txr[1], txr1, TXR_STATE_SIZE, "TXR/txr-1", 0 );
-
- radeonSetUpAtomList( rmesa );
-
- /* Fill in the packet headers:
- */
- rmesa->hw.ctx.cmd[CTX_CMD_0] = cmdpkt(RADEON_EMIT_PP_MISC);
- rmesa->hw.ctx.cmd[CTX_CMD_1] = cmdpkt(RADEON_EMIT_PP_CNTL);
- rmesa->hw.ctx.cmd[CTX_CMD_2] = cmdpkt(RADEON_EMIT_RB3D_COLORPITCH);
- rmesa->hw.lin.cmd[LIN_CMD_0] = cmdpkt(RADEON_EMIT_RE_LINE_PATTERN);
- rmesa->hw.lin.cmd[LIN_CMD_1] = cmdpkt(RADEON_EMIT_SE_LINE_WIDTH);
- rmesa->hw.msk.cmd[MSK_CMD_0] = cmdpkt(RADEON_EMIT_RB3D_STENCILREFMASK);
- rmesa->hw.vpt.cmd[VPT_CMD_0] = cmdpkt(RADEON_EMIT_SE_VPORT_XSCALE);
- rmesa->hw.set.cmd[SET_CMD_0] = cmdpkt(RADEON_EMIT_SE_CNTL);
- rmesa->hw.set.cmd[SET_CMD_1] = cmdpkt(RADEON_EMIT_SE_CNTL_STATUS);
- rmesa->hw.msc.cmd[MSC_CMD_0] = cmdpkt(RADEON_EMIT_RE_MISC);
- rmesa->hw.tex[0].cmd[TEX_CMD_0] = cmdpkt(RADEON_EMIT_PP_TXFILTER_0);
- rmesa->hw.tex[0].cmd[TEX_CMD_1] = cmdpkt(RADEON_EMIT_PP_BORDER_COLOR_0);
- rmesa->hw.tex[1].cmd[TEX_CMD_0] = cmdpkt(RADEON_EMIT_PP_TXFILTER_1);
- rmesa->hw.tex[1].cmd[TEX_CMD_1] = cmdpkt(RADEON_EMIT_PP_BORDER_COLOR_1);
- rmesa->hw.zbs.cmd[ZBS_CMD_0] = cmdpkt(RADEON_EMIT_SE_ZBIAS_FACTOR);
- rmesa->hw.tcl.cmd[TCL_CMD_0] = cmdpkt(RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT);
- rmesa->hw.mtl.cmd[MTL_CMD_0] =
- cmdpkt(RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED);
- rmesa->hw.txr[0].cmd[TXR_CMD_0] = cmdpkt(RADEON_EMIT_PP_TEX_SIZE_0);
- rmesa->hw.txr[1].cmd[TXR_CMD_0] = cmdpkt(RADEON_EMIT_PP_TEX_SIZE_1);
- rmesa->hw.grd.cmd[GRD_CMD_0] =
- cmdscl( RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR, 1, 4 );
- rmesa->hw.fog.cmd[FOG_CMD_0] =
- cmdvec( RADEON_VS_FOG_PARAM_ADDR, 1, 4 );
- rmesa->hw.glt.cmd[GLT_CMD_0] =
- cmdvec( RADEON_VS_GLOBAL_AMBIENT_ADDR, 1, 4 );
- rmesa->hw.eye.cmd[EYE_CMD_0] =
- cmdvec( RADEON_VS_EYE_VECTOR_ADDR, 1, 4 );
-
- for (i = 0 ; i < 5; i++) {
- rmesa->hw.mat[i].cmd[MAT_CMD_0] =
- cmdvec( RADEON_VS_MATRIX_0_ADDR + i*4, 1, 16);
- }
-
- for (i = 0 ; i < 8; i++) {
- rmesa->hw.lit[i].cmd[LIT_CMD_0] =
- cmdvec( RADEON_VS_LIGHT_AMBIENT_ADDR + i, 8, 24 );
- rmesa->hw.lit[i].cmd[LIT_CMD_1] =
- cmdscl( RADEON_SS_LIGHT_DCD_ADDR + i, 8, 6 );
- }
-
- for (i = 0 ; i < 6; i++) {
- rmesa->hw.ucp[i].cmd[UCP_CMD_0] =
- cmdvec( RADEON_VS_UCP_ADDR + i, 1, 4 );
- }
-
- rmesa->last_ReallyEnabled = -1;
-
- /* Initial Harware state:
- */
- rmesa->hw.ctx.cmd[CTX_PP_MISC] = (RADEON_ALPHA_TEST_PASS |
- RADEON_CHROMA_FUNC_FAIL |
- RADEON_CHROMA_KEY_NEAREST |
- RADEON_SHADOW_FUNC_EQUAL |
- RADEON_SHADOW_PASS_1 |
- RADEON_RIGHT_HAND_CUBE_OGL);
-
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] = (RADEON_FOG_VERTEX |
- RADEON_FOG_USE_DEPTH);
-
- rmesa->hw.ctx.cmd[CTX_RE_SOLID_COLOR] = 0x00000000;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = (RADEON_COMB_FCN_ADD_CLAMP |
- RADEON_SRC_BLEND_GL_ONE |
- RADEON_DST_BLEND_GL_ZERO );
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHOFFSET] =
- rmesa->radeonScreen->depthOffset + rmesa->radeonScreen->fbLocation;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHPITCH] =
- ((rmesa->radeonScreen->depthPitch &
- RADEON_DEPTHPITCH_MASK) |
- RADEON_DEPTH_ENDIAN_NO_SWAP);
-
- if (rmesa->using_hyperz)
- rmesa->hw.ctx.cmd[CTX_RB3D_DEPTHPITCH] |= RADEON_DEPTH_HYPERZ;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] = (depth_fmt |
- RADEON_Z_TEST_LESS |
- RADEON_STENCIL_TEST_ALWAYS |
- RADEON_STENCIL_FAIL_KEEP |
- RADEON_STENCIL_ZPASS_KEEP |
- RADEON_STENCIL_ZFAIL_KEEP |
- RADEON_Z_WRITE_ENABLE);
-
- if (rmesa->using_hyperz) {
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_COMPRESSION_ENABLE |
- RADEON_Z_DECOMPRESSION_ENABLE;
- if (rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL) {
- /* works for q3, but slight rendering errors with glxgears ? */
-/* rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_Z_HIERARCHY_ENABLE;*/
- /* need this otherwise get lots of lockups with q3 ??? */
- rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] |= RADEON_FORCE_Z_DIRTY;
- }
- }
-
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = (RADEON_SCISSOR_ENABLE |
- RADEON_ANTI_ALIAS_NONE);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = (RADEON_PLANE_MASK_ENABLE |
- color_fmt |
- RADEON_ZBLOCK16);
-
- switch ( driQueryOptioni( &rmesa->optionCache, "dither_mode" ) ) {
- case DRI_CONF_DITHER_XERRORDIFFRESET:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_DITHER_INIT;
- break;
- case DRI_CONF_DITHER_ORDERED:
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_SCALE_DITHER_ENABLE;
- break;
- }
- if ( driQueryOptioni( &rmesa->optionCache, "round_mode" ) ==
- DRI_CONF_ROUND_ROUND )
- rmesa->state.color.roundEnable = RADEON_ROUND_ENABLE;
- else
- rmesa->state.color.roundEnable = 0;
- if ( driQueryOptioni (&rmesa->optionCache, "color_reduction" ) ==
- DRI_CONF_COLOR_REDUCTION_DITHER )
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_DITHER_ENABLE;
- else
- rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= rmesa->state.color.roundEnable;
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = ((rmesa->state.color.drawOffset +
- rmesa->radeonScreen->fbLocation)
- & RADEON_COLOROFFSET_MASK);
-
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = ((rmesa->state.color.drawPitch &
- RADEON_COLORPITCH_MASK) |
- RADEON_COLOR_ENDIAN_NO_SWAP);
- /* (fixed size) sarea is initialized to zero afaics so can omit version check. Phew! */
- if (rmesa->sarea->tiling_enabled) {
- rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= RADEON_COLOR_TILE_ENABLE;
- }
-
- rmesa->hw.set.cmd[SET_SE_CNTL] = (RADEON_FFACE_CULL_CCW |
- RADEON_BFACE_SOLID |
- RADEON_FFACE_SOLID |
-/* RADEON_BADVTX_CULL_DISABLE | */
- RADEON_FLAT_SHADE_VTX_LAST |
- RADEON_DIFFUSE_SHADE_GOURAUD |
- RADEON_ALPHA_SHADE_GOURAUD |
- RADEON_SPECULAR_SHADE_GOURAUD |
- RADEON_FOG_SHADE_GOURAUD |
- RADEON_VPORT_XY_XFORM_ENABLE |
- RADEON_VPORT_Z_XFORM_ENABLE |
- RADEON_VTX_PIX_CENTER_OGL |
- RADEON_ROUND_MODE_TRUNC |
- RADEON_ROUND_PREC_8TH_PIX);
-
- rmesa->hw.set.cmd[SET_SE_CNTL_STATUS] =
-#ifdef MESA_BIG_ENDIAN
- RADEON_VC_32BIT_SWAP;
-#else
- RADEON_VC_NO_SWAP;
-#endif
-
- if (!(rmesa->radeonScreen->chipset & RADEON_CHIPSET_TCL)) {
- rmesa->hw.set.cmd[SET_SE_CNTL_STATUS] |= RADEON_TCL_BYPASS;
- }
-
- rmesa->hw.set.cmd[SET_SE_COORDFMT] = (
- RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
-
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = ((1 << 16) | 0xffff);
-
- rmesa->hw.lin.cmd[LIN_RE_LINE_STATE] =
- ((0 << RADEON_LINE_CURRENT_PTR_SHIFT) |
- (1 << RADEON_LINE_CURRENT_COUNT_SHIFT));
-
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] = (1 << 4);
-
- rmesa->hw.msk.cmd[MSK_RB3D_STENCILREFMASK] =
- ((0x00 << RADEON_STENCIL_REF_SHIFT) |
- (0xff << RADEON_STENCIL_MASK_SHIFT) |
- (0xff << RADEON_STENCIL_WRITEMASK_SHIFT));
-
- rmesa->hw.msk.cmd[MSK_RB3D_ROPCNTL] = RADEON_ROP_COPY;
- rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] = 0xffffffff;
-
- rmesa->hw.msc.cmd[MSC_RE_MISC] =
- ((0 << RADEON_STIPPLE_X_OFFSET_SHIFT) |
- (0 << RADEON_STIPPLE_Y_OFFSET_SHIFT) |
- RADEON_STIPPLE_BIG_BIT_ORDER);
-
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZSCALE] = 0x00000000;
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = 0x00000000;
-
- for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
- rmesa->hw.tex[i].cmd[TEX_PP_TXFILTER] = RADEON_BORDER_MODE_OGL;
- rmesa->hw.tex[i].cmd[TEX_PP_TXFORMAT] =
- (RADEON_TXFORMAT_ENDIAN_NO_SWAP |
- RADEON_TXFORMAT_PERSPECTIVE_ENABLE |
- (i << 24) | /* This is one of RADEON_TXFORMAT_ST_ROUTE_STQ[012] */
- (2 << RADEON_TXFORMAT_WIDTH_SHIFT) |
- (2 << RADEON_TXFORMAT_HEIGHT_SHIFT));
-
- /* Initialize the texture offset to the start of the card texture heap */
- rmesa->hw.tex[i].cmd[TEX_PP_TXOFFSET] =
- rmesa->radeonScreen->texOffset[RADEON_LOCAL_TEX_HEAP];
-
- rmesa->hw.tex[i].cmd[TEX_PP_BORDER_COLOR] = 0;
- rmesa->hw.tex[i].cmd[TEX_PP_TXCBLEND] =
- (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_COLOR_ARG_C_CURRENT_COLOR |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX);
- rmesa->hw.tex[i].cmd[TEX_PP_TXABLEND] =
- (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_ALPHA_ARG_C_CURRENT_ALPHA |
- RADEON_BLEND_CTL_ADD |
- RADEON_SCALE_1X |
- RADEON_CLAMP_TX);
- rmesa->hw.tex[i].cmd[TEX_PP_TFACTOR] = 0;
- }
-
- /* Can only add ST1 at the time of doing some multitex but can keep
- * it after that. Errors if DIFFUSE is missing.
- */
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] =
- (RADEON_TCL_VTX_Z0 |
- RADEON_TCL_VTX_W0 |
- RADEON_TCL_VTX_PK_DIFFUSE
- ); /* need to keep this uptodate */
-
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] =
- ( RADEON_TCL_COMPUTE_XYZW |
- (RADEON_TCL_TEX_INPUT_TEX_0 << RADEON_TCL_TEX_0_OUTPUT_SHIFT) |
- (RADEON_TCL_TEX_INPUT_TEX_1 << RADEON_TCL_TEX_1_OUTPUT_SHIFT) |
- (RADEON_TCL_TEX_INPUT_TEX_2 << RADEON_TCL_TEX_2_OUTPUT_SHIFT));
-
-
- /* XXX */
- rmesa->hw.tcl.cmd[TCL_MATRIX_SELECT_0] =
- ((MODEL << RADEON_MODELVIEW_0_SHIFT) |
- (MODEL_IT << RADEON_IT_MODELVIEW_0_SHIFT));
-
- rmesa->hw.tcl.cmd[TCL_MATRIX_SELECT_1] =
- ((MODEL_PROJ << RADEON_MODELPROJECT_0_SHIFT) |
- (TEXMAT_0 << RADEON_TEXMAT_0_SHIFT) |
- (TEXMAT_1 << RADEON_TEXMAT_1_SHIFT));
-
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] =
- (RADEON_UCP_IN_CLIP_SPACE |
- RADEON_CULL_FRONT_IS_CCW);
-
- rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL] = 0;
-
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] =
- (RADEON_SPECULAR_LIGHTS |
- RADEON_DIFFUSE_SPECULAR_COMBINE |
- RADEON_LOCAL_LIGHT_VEC_GL |
- (RADEON_LM_SOURCE_STATE_MULT << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_MULT << RADEON_AMBIENT_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_MULT << RADEON_DIFFUSE_SOURCE_SHIFT) |
- (RADEON_LM_SOURCE_STATE_MULT << RADEON_SPECULAR_SOURCE_SHIFT));
-
- for (i = 0 ; i < 8; i++) {
- struct gl_light *l = &ctx->Light.Light[i];
- GLenum p = GL_LIGHT0 + i;
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_RANGE_CUTOFF]) = FLT_MAX;
-
- ctx->Driver.Lightfv( ctx, p, GL_AMBIENT, l->Ambient );
- ctx->Driver.Lightfv( ctx, p, GL_DIFFUSE, l->Diffuse );
- ctx->Driver.Lightfv( ctx, p, GL_SPECULAR, l->Specular );
- ctx->Driver.Lightfv( ctx, p, GL_POSITION, NULL );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_DIRECTION, NULL );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_EXPONENT, &l->SpotExponent );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_CUTOFF, &l->SpotCutoff );
- ctx->Driver.Lightfv( ctx, p, GL_CONSTANT_ATTENUATION,
- &l->ConstantAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION,
- &l->LinearAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION,
- &l->QuadraticAttenuation );
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_ATTEN_XXX]) = 0.0;
- }
-
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
- ctx->Light.Model.Ambient );
-
- TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
-
- for (i = 0 ; i < 6; i++) {
- ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, NULL );
- }
-
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, NULL );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL );
-
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_VERT_GUARD_DISCARD_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_CLIP_ADJ] = IEEE_ONE;
- rmesa->hw.grd.cmd[GRD_HORZ_GUARD_DISCARD_ADJ] = IEEE_ONE;
-
- rmesa->hw.eye.cmd[EYE_X] = 0;
- rmesa->hw.eye.cmd[EYE_Y] = 0;
- rmesa->hw.eye.cmd[EYE_Z] = IEEE_ONE;
- rmesa->hw.eye.cmd[EYE_RESCALE_FACTOR] = IEEE_ONE;
-
- rmesa->hw.all_dirty = GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.c
deleted file mode 100644
index 924d4028d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ /dev/null
@@ -1,983 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_swtcl.c,v 1.6 2003/05/06 23:52:08 daenzer Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "enums.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vtx_api.h" /* for _tnl_FlushVertices */
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_swtcl.h"
-#include "radeon_tcl.h"
-
-
-static void flush_last_swtcl_prim( radeonContextPtr rmesa );
-
-/* R100: xyzw, c0, c1/fog, stq[0..2] = 4+1+1+3*3 = 15 right? */
-/* R200: xyzw, c0, c1/fog, strq[0..5] = 4+1+1+4*6 = 30 */
-#define RADEON_MAX_TNL_VERTEX_SIZE (15 * sizeof(GLfloat)) /* for mesa _tnl stage */
-
-/***********************************************************************
- * Initialization
- ***********************************************************************/
-
-#define EMIT_ATTR( ATTR, STYLE, F0 ) \
-do { \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = (ATTR); \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = (STYLE); \
- rmesa->swtcl.vertex_attr_count++; \
- fmt_0 |= F0; \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = 0; \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = EMIT_PAD; \
- rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].offset = (N); \
- rmesa->swtcl.vertex_attr_count++; \
-} while (0)
-
-static GLuint radeon_cp_vc_frmts[3][2] =
-{
- { RADEON_CP_VC_FRMT_ST0, RADEON_CP_VC_FRMT_ST0 | RADEON_CP_VC_FRMT_Q0 },
- { RADEON_CP_VC_FRMT_ST1, RADEON_CP_VC_FRMT_ST1 | RADEON_CP_VC_FRMT_Q1 },
- { RADEON_CP_VC_FRMT_ST2, RADEON_CP_VC_FRMT_ST2 | RADEON_CP_VC_FRMT_Q2 },
-};
-
-static void radeonSetVertexFormat( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- int fmt_0 = 0;
- int offset = 0;
-
-
- /* Important:
- */
- if ( VB->NdcPtr != NULL ) {
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- }
- else {
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr;
- }
-
- assert( VB->AttribPtr[VERT_ATTRIB_POS] != NULL );
- rmesa->swtcl.vertex_attr_count = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if ( !rmesa->swtcl.needproj ||
- (index & _TNL_BITS_TEX_ANY)) { /* for projtex */
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F,
- RADEON_CP_VC_FRMT_XY | RADEON_CP_VC_FRMT_Z | RADEON_CP_VC_FRMT_W0 );
- offset = 4;
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F,
- RADEON_CP_VC_FRMT_XY | RADEON_CP_VC_FRMT_Z );
- offset = 3;
- }
-
- rmesa->swtcl.coloroffset = offset;
-#if MESA_LITTLE_ENDIAN
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA,
- RADEON_CP_VC_FRMT_PKCOLOR );
-#else
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR,
- RADEON_CP_VC_FRMT_PKCOLOR );
-#endif
- offset += 1;
-
- rmesa->swtcl.specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
-
-#if MESA_LITTLE_ENDIAN
- if (index & _TNL_BIT_COLOR1) {
- rmesa->swtcl.specoffset = offset;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB,
- RADEON_CP_VC_FRMT_PKSPEC );
- }
- else {
- EMIT_PAD( 3 );
- }
-
- if (index & _TNL_BIT_FOG) {
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F,
- RADEON_CP_VC_FRMT_PKSPEC );
- }
- else {
- EMIT_PAD( 1 );
- }
-#else
- if (index & _TNL_BIT_FOG) {
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F,
- RADEON_CP_VC_FRMT_PKSPEC );
- }
- else {
- EMIT_PAD( 1 );
- }
-
- if (index & _TNL_BIT_COLOR1) {
- rmesa->swtcl.specoffset = offset;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR,
- RADEON_CP_VC_FRMT_PKSPEC );
- }
- else {
- EMIT_PAD( 3 );
- }
-#endif
- }
-
- if (index & _TNL_BITS_TEX_ANY) {
- int i;
-
- for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- GLuint sz = VB->TexCoordPtr[i]->size;
-
- switch (sz) {
- case 1:
- case 2:
- case 3:
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_2F,
- radeon_cp_vc_frmts[i][0] );
- break;
- case 4:
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_3F_XYW,
- radeon_cp_vc_frmts[i][1] );
- break;
- default:
- continue;
- };
- }
- }
- }
-
- if ( rmesa->tnl_index != index ||
- fmt_0 != rmesa->swtcl.vertex_format) {
- RADEON_NEWPRIM(rmesa);
- rmesa->swtcl.vertex_format = fmt_0;
- rmesa->swtcl.vertex_size =
- _tnl_install_attrs( ctx,
- rmesa->swtcl.vertex_attrs,
- rmesa->swtcl.vertex_attr_count,
- NULL, 0 );
- rmesa->swtcl.vertex_size /= 4;
- rmesa->tnl_index = index;
- if (RADEON_DEBUG & DEBUG_VERTS)
- fprintf( stderr, "%s: vertex_size= %d floats\n",
- __FUNCTION__, rmesa->swtcl.vertex_size);
- }
-}
-
-
-static void radeonRenderStart( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- radeonSetVertexFormat( ctx );
-
- if (rmesa->dma.flush != 0 &&
- rmesa->dma.flush != flush_last_swtcl_prim)
- rmesa->dma.flush( rmesa );
-}
-
-
-/**
- * Set vertex state for SW TCL. The primary purpose of this function is to
- * determine in advance whether or not the hardware can / should do the
- * projection divide or Mesa should do it.
- */
-void radeonChooseVertexState( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- GLuint se_coord_fmt;
-
- /* We must ensure that we don't do _tnl_need_projected_coords while in a
- * rasterization fallback. As this function will be called again when we
- * leave a rasterization fallback, we can just skip it for now.
- */
- if (rmesa->Fallback != 0)
- return;
-
- /* HW perspective divide is a win, but tiny vertex formats are a
- * bigger one.
- */
-
- if ( ((tnl->render_inputs & (_TNL_BITS_TEX_ANY|_TNL_BIT_COLOR1) ) == 0)
- || (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- rmesa->swtcl.needproj = GL_TRUE;
- se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
- RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
- }
- else {
- rmesa->swtcl.needproj = GL_FALSE;
- se_coord_fmt = (RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
- }
-
- _tnl_need_projected_coords( ctx, rmesa->swtcl.needproj );
-
- if ( se_coord_fmt != rmesa->hw.set.cmd[SET_SE_COORDFMT] ) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_COORDFMT] = se_coord_fmt;
- }
-}
-
-
-/* Flush vertices in the current dma region.
- */
-static void flush_last_swtcl_prim( radeonContextPtr rmesa )
-{
- if (RADEON_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- rmesa->dma.flush = NULL;
-
- if (rmesa->dma.current.buf) {
- struct radeon_dma_region *current = &rmesa->dma.current;
- GLuint current_offset = (rmesa->radeonScreen->gart_buffer_offset +
- current->buf->buf->idx * RADEON_BUFFER_SIZE +
- current->start);
-
- assert (!(rmesa->swtcl.hw_primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND));
-
- assert (current->start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- current->ptr);
-
- if (rmesa->dma.current.start != rmesa->dma.current.ptr) {
- radeonEnsureCmdBufSpace( rmesa, VERT_AOS_BUFSZ +
- rmesa->hw.max_state_size + VBUF_BUFSZ );
-
- radeonEmitVertexAOS( rmesa,
- rmesa->swtcl.vertex_size,
- current_offset);
-
- radeonEmitVbufPrim( rmesa,
- rmesa->swtcl.vertex_format,
- rmesa->swtcl.hw_primitive,
- rmesa->swtcl.numverts);
- }
-
- rmesa->swtcl.numverts = 0;
- current->start = current->ptr;
- }
-}
-
-
-/* Alloc space in the current dma region.
- */
-static __inline void *radeonAllocDmaLowVerts( radeonContextPtr rmesa,
- int nverts, int vsize )
-{
- GLuint bytes = vsize * nverts;
-
- if ( rmesa->dma.current.ptr + bytes > rmesa->dma.current.end )
- radeonRefillCurrentDmaRegion( rmesa );
-
- if (!rmesa->dma.flush) {
- rmesa->glCtx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- rmesa->dma.flush = flush_last_swtcl_prim;
- }
-
- assert( vsize == rmesa->swtcl.vertex_size * 4 );
- assert( rmesa->dma.flush == flush_last_swtcl_prim );
- assert (rmesa->dma.current.start +
- rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 ==
- rmesa->dma.current.ptr);
-
-
- {
- GLubyte *head = (GLubyte *)(rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->dma.current.ptr += bytes;
- rmesa->swtcl.numverts += nverts;
- return head;
- }
-
-}
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#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 0
-#define HAVE_QUAD_STRIPS 0
-#define HAVE_POLYGONS 0
-/* \todo: is it possible to make "ELTS" work with t_vertex code ? */
-#define HAVE_ELTS 0
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- 0,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN,
- 0,
- 0,
- 0
-};
-
-static __inline void radeonDmaPrimitive( radeonContextPtr rmesa, GLenum prim )
-{
- RADEON_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hw_prim[prim];
- assert(rmesa->dma.current.ptr == rmesa->dma.current.start);
-}
-
-#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx)
-#define INIT( prim ) radeonDmaPrimitive( rmesa, prim )
-#define FLUSH() RADEON_NEWPRIM( rmesa )
-#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)rmesa->dma.current.end - (int)rmesa->dma.current.ptr) / (rmesa->swtcl.vertex_size*4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- ((RADEON_BUFFER_SIZE) / (rmesa->swtcl.vertex_size*4))
-#define ALLOC_VERTS( nr ) \
- radeonAllocDmaLowVerts( rmesa, nr, rmesa->swtcl.vertex_size * 4 )
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf)
-
-#define TAG(x) radeon_dma_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean radeon_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab = TAG(render_tab_verts);
- GLuint i;
-
- if (rmesa->swtcl.indexed_verts.buf)
- RELEASE_ELT_VERTS();
-
- if (rmesa->swtcl.RenderIndex != 0 ||
- !radeon_dma_validate_render( ctx, VB ))
- return GL_TRUE;
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "radeon_render.c: prim %s %d..%d\n",
- _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK),
- start, start+length);
-
- if (length)
- 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 _radeon_render_stage =
-{
- "radeon render",
- NULL,
- NULL,
- NULL,
- NULL,
- radeon_run_render /* run */
-};
-
-
-/**************************************************************************/
-
-/* Radeon texture rectangle expects coords in 0..1 range, not 0..dimension
- * as in the extension spec. Need to translate here.
- *
- * Note that swrast expects 0..dimension, so if a fallback is active,
- * don't do anything. (Maybe need to configure swrast to match hw)
- */
-struct texrect_stage_data {
- GLvector4f texcoord[MAX_TEXTURE_UNITS];
-};
-
-#define TEXRECT_STAGE_DATA(stage) ((struct texrect_stage_data *)stage->privatePtr)
-
-
-static GLboolean run_texrect_stage( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- if (rmesa->Fallback)
- return GL_TRUE;
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_RECT_BIT) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[i].CurrentRect;
- struct gl_texture_image *texImage = texObj->Image[0][texObj->BaseLevel];
- const GLfloat iw = 1.0/texImage->Width;
- const GLfloat ih = 1.0/texImage->Height;
- GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data;
- GLint instride = VB->TexCoordPtr[i]->stride;
- GLfloat (*out)[4] = store->texcoord[i].data;
- GLint j;
-
- for (j = 0 ; j < VB->Count ; j++) {
- out[j][0] = in[0] * iw;
- out[j][1] = in[1] * ih;
- in = (GLfloat *)((GLubyte *)in + instride);
- }
-
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i];
- }
- }
-
- return GL_TRUE;
-}
-
-
-/* Called the first time stage->run() is invoked.
- */
-static GLboolean alloc_texrect_data( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- struct texrect_stage_data *store;
- GLuint i;
-
- stage->privatePtr = CALLOC(sizeof(*store));
- store = TEXRECT_STAGE_DATA(stage);
- if (!store)
- return GL_FALSE;
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
-
- return GL_TRUE;
-}
-
-static void free_texrect_data( struct tnl_pipeline_stage *stage )
-{
- struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
- GLuint i;
-
- if (store) {
- for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
- if (store->texcoord[i].data)
- _mesa_vector4f_free( &store->texcoord[i] );
- FREE( store );
- stage->privatePtr = NULL;
- }
-}
-
-const struct tnl_pipeline_stage _radeon_texrect_stage =
-{
- "radeon texrect stage", /* name */
- NULL,
- alloc_texrect_data,
- free_texrect_data,
- NULL,
- run_texrect_stage
-};
-
-
-/**************************************************************************/
-
-
-static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST
-};
-
-static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim );
-static void radeonResetLineStipple( GLcontext *ctx );
-
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#undef LOCAL_VARS
-#undef ALLOC_VERTS
-#define CTX_ARG radeonContextPtr rmesa
-#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
-#define ALLOC_VERTS( n, size ) radeonAllocDmaLowVerts( rmesa, n, (size) * 4 )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- const char *radeonverts = (char *)rmesa->swtcl.verts;
-#define VERT(x) (radeonVertex *)(radeonverts + ((x) * (vertsize) * sizeof(int)))
-#define VERTEX radeonVertex
-#undef TAG
-#define TAG(x) radeon_##x
-#include "tnl_dd/t_dd_triemit.h"
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define QUAD( a, b, c, d ) radeon_quad( rmesa, a, b, c, d )
-#define TRI( a, b, c ) radeon_triangle( rmesa, a, b, c )
-#define LINE( a, b ) radeon_line( rmesa, a, b )
-#define POINT( a ) radeon_point( rmesa, a )
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define RADEON_TWOSIDE_BIT 0x01
-#define RADEON_UNFILLED_BIT 0x02
-#define RADEON_MAX_TRIFUNC 0x08
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[RADEON_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK 0
-#define DO_OFFSET 0
-#define DO_UNFILLED (IND & RADEON_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & RADEON_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#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) (rmesa->swtcl.verts + ((e) * rmesa->swtcl.vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- radeon_color_t *color = (radeon_color_t *)&((v)->ui[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-
-#define VERT_SET_SPEC( v, c ) \
-do { \
- if (specoffset) { \
- radeon_color_t *spec = (radeon_color_t *)&((v)->ui[specoffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- if (specoffset) { \
- radeon_color_t *spec0 = (radeon_color_t *)&((v0)->ui[specoffset]); \
- radeon_color_t *spec1 = (radeon_color_t *)&((v1)->ui[specoffset]); \
- spec0->red = spec1->red; \
- spec0->green = spec1->green; \
- spec0->blue = spec1->blue; \
- } \
-} while (0)
-
-/* These don't need LE32_TO_CPU() as they used to save and restore
- * colors which are already in the correct format.
- */
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
-
-#undef LOCAL_VARS
-#undef TAG
-#undef INIT
-
-#define LOCAL_VARS(n) \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = rmesa->swtcl.coloroffset; \
- GLuint specoffset = rmesa->swtcl.specoffset; \
- (void) color; (void) spec; (void) coloroffset; (void) specoffset;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) radeonRasterPrimitive( ctx, reduced_hw_prim[x] )
-#define RENDER_PRIMITIVE rmesa->swtcl.render_primitive
-#undef TAG
-#define TAG(x) x
-#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 (RADEON_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (RADEON_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (RADEON_TWOSIDE_BIT|RADEON_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_twoside();
- init_unfilled();
- init_twoside_unfilled();
-}
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- radeon_point( rmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- radeon_line( rmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- radeon_triangle( rmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- radeon_quad( rmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#undef INIT
-#define INIT(x) do { \
- radeonRenderPrimitive( ctx, x ); \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- const GLuint vertsize = rmesa->swtcl.vertex_size; \
- const char *radeonverts = (char *)rmesa->swtcl.verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) elt; (void) stipple;
-#define RESET_STIPPLE if ( stipple ) radeonResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) radeon_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) radeon_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-void radeonChooseRenderState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint index = 0;
- GLuint flags = ctx->_TriangleCaps;
-
- if (!rmesa->TclFallback || rmesa->Fallback)
- return;
-
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= RADEON_TWOSIDE_BIT;
- if (flags & DD_TRI_UNFILLED) index |= RADEON_UNFILLED_BIT;
-
- if (index != rmesa->swtcl.RenderIndex) {
- 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 = radeon_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = radeon_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = radeon_fast_clipped_poly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- }
-
- rmesa->swtcl.RenderIndex = index;
- }
-}
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (rmesa->swtcl.hw_primitive != hwprim) {
- RADEON_NEWPRIM( rmesa );
- rmesa->swtcl.hw_primitive = hwprim;
- }
-}
-
-static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- rmesa->swtcl.render_primitive = prim;
- if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED))
- radeonRasterPrimitive( ctx, reduced_hw_prim[prim] );
-}
-
-static void radeonRenderFinish( GLcontext *ctx )
-{
-}
-
-static void radeonResetLineStipple( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- RADEON_STATECHANGE( rmesa, lin );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "glDrawBuffer(GL_FRONT_AND_BACK)",
- "glEnable(GL_STENCIL) without hw stencil buffer",
- "glRenderMode(selection or feedback)",
- "glBlendEquation",
- "glBlendFunc",
- "RADEON_NO_RAST",
- "Mixing GL_CLAMP_TO_BORDER and GL_CLAMP (or GL_MIRROR_CLAMP_ATI)"
-};
-
-
-static const char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = rmesa->Fallback;
-
- if (mode) {
- rmesa->Fallback |= bit;
- if (oldfallback == 0) {
- RADEON_FIREVERTICES( rmesa );
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_RASTER, GL_TRUE );
- _swsetup_Wakeup( ctx );
- rmesa->swtcl.RenderIndex = ~0;
- if (RADEON_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "Radeon begin rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- rmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = radeonRenderStart;
- tnl->Driver.Render.PrimitiveNotify = radeonRenderPrimitive;
- tnl->Driver.Render.Finish = radeonRenderFinish;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- tnl->Driver.Render.ResetLineStipple = radeonResetLineStipple;
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_RASTER, GL_FALSE );
- if (rmesa->TclFallback) {
- /* These are already done if rmesa->TclFallback goes to
- * zero above. But not if it doesn't (RADEON_NO_TCL for
- * example?)
- */
- radeonChooseVertexState( ctx );
- radeonChooseRenderState( ctx );
- }
- if (RADEON_DEBUG & DEBUG_FALLBACKS) {
- fprintf(stderr, "Radeon end rasterization fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-void radeonFlushVertices( GLcontext *ctx, GLuint flags )
-{
- _tnl_FlushVertices( ctx, flags );
-
- if (flags & FLUSH_STORED_VERTICES)
- RADEON_NEWPRIM( RADEON_CONTEXT( ctx ) );
-}
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void radeonInitSwtcl( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.Render.Start = radeonRenderStart;
- tnl->Driver.Render.Finish = radeonRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = radeonRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = radeonResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- RADEON_MAX_TNL_VERTEX_SIZE);
-
- rmesa->swtcl.verts = (GLubyte *)tnl->clipspace.vertex_buf;
- rmesa->swtcl.RenderIndex = ~0;
- rmesa->swtcl.render_primitive = GL_TRIANGLES;
- rmesa->swtcl.hw_primitive = 0;
-}
-
-
-void radeonDestroySwtcl( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (rmesa->swtcl.indexed_verts.buf)
- radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts,
- __FUNCTION__ );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.h
deleted file mode 100644
index f95a52c0b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_swtcl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
-ATI, 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:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef __RADEON_TRIS_H__
-#define __RADEON_TRIS_H__
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-#include "radeon_context.h"
-
-extern void radeonInitSwtcl( GLcontext *ctx );
-extern void radeonDestroySwtcl( GLcontext *ctx );
-
-extern void radeonFlushVertices( GLcontext *ctx, GLuint flags );
-extern void radeonChooseRenderState( GLcontext *ctx );
-extern void radeonChooseVertexState( GLcontext *ctx );
-
-extern void radeonCheckTexSizes( GLcontext *ctx );
-
-extern void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void radeonPrintSetupFlags(char *msg, GLuint flags );
-
-
-extern void radeon_emit_indexed_verts( GLcontext *ctx,
- GLuint start,
- GLuint count );
-
-extern void radeon_translate_vertex( GLcontext *ctx,
- const radeonVertex *src,
- SWvertex *dst );
-
-extern void radeon_print_vertex( GLcontext *ctx, const radeonVertex *v );
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c
deleted file mode 100644
index b13042d96..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Graphics Inc., Austin, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "light.h"
-#include "mtypes.h"
-#include "enums.h"
-
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_swtcl.h"
-#include "radeon_maos.h"
-
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_LOOP 0
-#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 0
-#define HAVE_QUAD_STRIPS 0
-#define HAVE_POLYGONS 1
-#define HAVE_ELTS 1
-
-
-#define HW_POINTS RADEON_CP_VC_CNTL_PRIM_TYPE_POINT
-#define HW_LINES RADEON_CP_VC_CNTL_PRIM_TYPE_LINE
-#define HW_LINE_LOOP 0
-#define HW_LINE_STRIP RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP
-#define HW_TRIANGLES RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST
-#define HW_TRIANGLE_STRIP_0 RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP
-#define HW_TRIANGLE_STRIP_1 0
-#define HW_TRIANGLE_FAN RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN
-#define HW_QUADS 0
-#define HW_QUAD_STRIP 0
-#define HW_POLYGON RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN
-
-
-static GLboolean discrete_prim[0x10] = {
- 0, /* 0 none */
- 1, /* 1 points */
- 1, /* 2 lines */
- 0, /* 3 line_strip */
- 1, /* 4 tri_list */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_type2 */
- 1, /* 7 rect list (unused) */
- 1, /* 8 3vert point */
- 1, /* 9 3vert line */
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-
-#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx)
-#define ELT_TYPE GLushort
-
-#define ELT_INIT(prim, hw_prim) \
- radeonTclPrimitive( ctx, prim, hw_prim | RADEON_CP_VC_CNTL_PRIM_WALK_IND )
-
-#define GET_MESA_ELTS() rmesa->tcl.Elts
-
-
-/* Don't really know how many elts will fit in what's left of cmdbuf,
- * as there is state to emit, etc:
- */
-
-/* Testing on isosurf shows a maximum around here. Don't know if it's
- * the card or driver or kernel module that is causing the behaviour.
- */
-#define GET_MAX_HW_ELTS() 300
-
-
-#define RESET_STIPPLE() do { \
- RADEON_STATECHANGE( rmesa, lin ); \
- radeonEmitState( rmesa ); \
-} while (0)
-
-#define AUTO_STIPPLE( mode ) do { \
- RADEON_STATECHANGE( rmesa, lin ); \
- if (mode) \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] |= \
- RADEON_LINE_PATTERN_AUTO_RESET; \
- else \
- rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] &= \
- ~RADEON_LINE_PATTERN_AUTO_RESET; \
- radeonEmitState( rmesa ); \
-} while (0)
-
-
-
-#define ALLOC_ELTS(nr) radeonAllocElts( rmesa, nr )
-
-static GLushort *radeonAllocElts( radeonContextPtr rmesa, GLuint nr )
-{
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
-
- radeonEnsureCmdBufSpace(rmesa, AOS_BUFSZ(rmesa->tcl.nr_aos_components) +
- rmesa->hw.max_state_size + ELTS_BUFSZ(nr));
-
- radeonEmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components, 0 );
-
- return radeonAllocEltsOpenEnded( rmesa,
- rmesa->tcl.vertex_format,
- rmesa->tcl.hw_primitive, nr );
-}
-
-#define CLOSE_ELTS() RADEON_NEWPRIM( rmesa )
-
-
-
-/* TODO: Try to extend existing primitive if both are identical,
- * discrete and there are no intervening state changes. (Somewhat
- * duplicates changes to DrawArrays code)
- */
-static void radeonEmitPrim( GLcontext *ctx,
- GLenum prim,
- GLuint hwprim,
- GLuint start,
- GLuint count)
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- radeonTclPrimitive( ctx, prim, hwprim );
-
- radeonEnsureCmdBufSpace( rmesa, AOS_BUFSZ(rmesa->tcl.nr_aos_components) +
- rmesa->hw.max_state_size + VBUF_BUFSZ );
-
- radeonEmitAOS( rmesa,
- rmesa->tcl.aos_components,
- rmesa->tcl.nr_aos_components,
- start );
-
- /* Why couldn't this packet have taken an offset param?
- */
- radeonEmitVbufPrim( rmesa,
- rmesa->tcl.vertex_format,
- rmesa->tcl.hw_primitive,
- count - start );
-}
-
-#define EMIT_PRIM( ctx, prim, hwprim, start, count ) do { \
- radeonEmitPrim( ctx, prim, hwprim, start, count ); \
- (void) rmesa; } while (0)
-
-/* Try & join small primitives
- */
-#if 0
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) 0
-#else
-#define PREFER_DISCRETE_ELT_PRIM( NR, PRIM ) \
- ((NR) < 20 || \
- ((NR) < 40 && \
- rmesa->tcl.hw_primitive == (PRIM| \
- RADEON_CP_VC_CNTL_PRIM_WALK_IND| \
- RADEON_CP_VC_CNTL_TCL_ENABLE)))
-#endif
-
-#ifdef MESA_BIG_ENDIAN
-/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
-#define EMIT_ELT(dest, offset, x) do { \
- int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
- GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
- (des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); \
- (void)rmesa; } while (0)
-#else
-#define EMIT_ELT(dest, offset, x) do { \
- (dest)[offset] = (GLushort) (x); \
- (void)rmesa; } while (0)
-#endif
-
-#define EMIT_TWO_ELTS(dest, offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
-
-
-
-#define TAG(x) tcl_##x
-#include "tnl_dd/t_dd_dmatmp2.h"
-
-/**********************************************************************/
-/* External entrypoints */
-/**********************************************************************/
-
-void radeonEmitPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void radeonEmitEltPrimitive( GLcontext *ctx,
- GLuint first,
- GLuint last,
- GLuint flags )
-{
- tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
-}
-
-void radeonTclPrimitive( GLcontext *ctx,
- GLenum prim,
- int hw_prim )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint se_cntl;
- GLuint newprim = hw_prim | RADEON_CP_VC_CNTL_TCL_ENABLE;
-
- if (newprim != rmesa->tcl.hw_primitive ||
- !discrete_prim[hw_prim&0xf]) {
- RADEON_NEWPRIM( rmesa );
- rmesa->tcl.hw_primitive = newprim;
- }
-
- se_cntl = rmesa->hw.set.cmd[SET_SE_CNTL];
- se_cntl &= ~RADEON_FLAT_SHADE_VTX_LAST;
-
- if (prim == GL_POLYGON && (ctx->_TriangleCaps & DD_FLATSHADE))
- se_cntl |= RADEON_FLAT_SHADE_VTX_0;
- else
- se_cntl |= RADEON_FLAT_SHADE_VTX_LAST;
-
- if (se_cntl != rmesa->hw.set.cmd[SET_SE_CNTL]) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = se_cntl;
- }
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-/* TCL render.
- */
-static GLboolean radeon_run_tcl_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
- GLuint i;
-
- /* TODO: separate this from the swtnl pipeline
- */
- if (rmesa->TclFallback)
- return GL_TRUE; /* fallback to software t&l */
-
- if (VB->Count == 0)
- return GL_FALSE;
-
- /* NOTE: inputs != tnl->render_inputs - these are the untransformed
- * inputs.
- */
- if (ctx->Light.Enabled) {
- inputs |= VERT_BIT_NORMAL;
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- inputs |= VERT_BIT_COLOR1;
- }
- }
-
- if ( ctx->Fog.FogCoordinateSource == GL_FOG_COORD ) {
- inputs |= VERT_BIT_FOG;
- }
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled) {
- if (rmesa->TexGenNeedNormals[i]) {
- inputs |= VERT_BIT_NORMAL;
- }
- inputs |= VERT_BIT_TEX(i);
- }
- }
-
- radeonReleaseArrays( ctx, ~0 );
- radeonEmitArrays( ctx, inputs );
-
- rmesa->tcl.Elts = VB->Elts;
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- if (rmesa->tcl.Elts)
- radeonEmitEltPrimitive( ctx, start, start+length, prim );
- else
- radeonEmitPrimitive( ctx, start, start+length, prim );
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-/* Initial state for tcl stage.
- */
-const struct tnl_pipeline_stage _radeon_tcl_stage =
-{
- "radeon render",
- NULL,
- NULL,
- NULL,
- NULL,
- radeon_run_tcl_render /* run */
-};
-
-
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-
-/*-----------------------------------------------------------------------
- * Manage TCL fallbacks
- */
-
-
-static void transition_to_swtnl( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint se_cntl;
-
- RADEON_NEWPRIM( rmesa );
- rmesa->swtcl.vertex_format = 0;
-
- radeonChooseVertexState( ctx );
- radeonChooseRenderState( ctx );
-
- _mesa_validate_all_lighting_tables( ctx );
-
- tnl->Driver.NotifyMaterialChange =
- _mesa_validate_all_lighting_tables;
-
- radeonReleaseArrays( ctx, ~0 );
-
- se_cntl = rmesa->hw.set.cmd[SET_SE_CNTL];
- se_cntl |= RADEON_FLAT_SHADE_VTX_LAST;
-
- if (se_cntl != rmesa->hw.set.cmd[SET_SE_CNTL]) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_CNTL] = se_cntl;
- }
-}
-
-
-static void transition_to_hwtnl( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint se_coord_fmt = (RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
- RADEON_TEX1_W_ROUTING_USE_Q1);
-
- if ( se_coord_fmt != rmesa->hw.set.cmd[SET_SE_COORDFMT] ) {
- RADEON_STATECHANGE( rmesa, set );
- rmesa->hw.set.cmd[SET_SE_COORDFMT] = se_coord_fmt;
- _tnl_need_projected_coords( ctx, GL_FALSE );
- }
-
- radeonUpdateMaterial( ctx );
-
- tnl->Driver.NotifyMaterialChange = radeonUpdateMaterial;
-
- if ( rmesa->dma.flush )
- rmesa->dma.flush( rmesa );
-
- rmesa->dma.flush = NULL;
- rmesa->swtcl.vertex_format = 0;
-
- if (rmesa->swtcl.indexed_verts.buf)
- radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts,
- __FUNCTION__ );
-
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "Radeon end tcl fallback\n");
-}
-
-static char *fallbackStrings[] = {
- "Rasterization fallback",
- "Unfilled triangles",
- "Twosided lighting, differing materials",
- "Materials in VB (maybe between begin/end)",
- "Texgen unit 0",
- "Texgen unit 1",
- "Texgen unit 2",
- "User disable",
- "texture rectangle unit 0",
- "texture rectangle unit 1",
- "texture rectangle unit 2"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-
-void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint oldfallback = rmesa->TclFallback;
-
- if (mode) {
- rmesa->TclFallback |= bit;
- if (oldfallback == 0) {
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "Radeon begin tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_swtnl( ctx );
- }
- }
- else {
- rmesa->TclFallback &= ~bit;
- if (oldfallback == bit) {
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "Radeon end tcl fallback %s\n",
- getFallbackString( bit ));
- transition_to_hwtnl( ctx );
- }
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.h
deleted file mode 100644
index e292d2303..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tcl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tcl.h,v 1.2 2003/02/08 21:26:45 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- Tungsten Grahpics Inc., Austin, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#ifndef __RADEON_TCL_H__
-#define __RADEON_TCL_H__
-
-#include "radeon_context.h"
-
-extern void radeonTclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim );
-extern void radeonEmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-extern void radeonEmitPrimitive( GLcontext *ctx, GLuint first, GLuint last,
- GLuint flags );
-
-extern void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-
-#define RADEON_TCL_FALLBACK_RASTER 0x1 /* rasterization */
-#define RADEON_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */
-#define RADEON_TCL_FALLBACK_LIGHT_TWOSIDE 0x4 /* twoside tris */
-#define RADEON_TCL_FALLBACK_MATERIAL 0x8 /* material in vb */
-#define RADEON_TCL_FALLBACK_TEXGEN_0 0x10 /* texgen, unit 0 */
-#define RADEON_TCL_FALLBACK_TEXGEN_1 0x20 /* texgen, unit 1 */
-#define RADEON_TCL_FALLBACK_TEXGEN_2 0x40 /* texgen, unit 2 */
-#define RADEON_TCL_FALLBACK_TCL_DISABLE 0x80 /* user disable */
-#define RADEON_TCL_FALLBACK_TEXRECT_0 0x100 /* texture rectangle */
-#define RADEON_TCL_FALLBACK_TEXRECT_1 0x200 /* texture rectangle */
-#define RADEON_TCL_FALLBACK_TEXRECT_2 0x400 /* texture rectangle */
-
-#define RADEON_MAX_TCL_VERTSIZE (15*4)
-
-#define TCL_FALLBACK( ctx, bit, mode ) radeonTclFallback( ctx, bit, mode )
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c
deleted file mode 100644
index c466af868..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ /dev/null
@@ -1,866 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.6 2002/09/16 18:05:20 eich Exp $ */
-/*
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-*/
-
-/*
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "image.h"
-#include "simple_list.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "texobj.h"
-
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_swtcl.h"
-#include "radeon_tex.h"
-
-#include "xmlpool.h"
-
-
-
-/**
- * Set the texture wrap modes.
- *
- * \param t Texture object whose wrap modes are to be set
- * \param swrap Wrap mode for the \a s texture coordinate
- * \param twrap Wrap mode for the \a t texture coordinate
- */
-
-static void radeonSetTexWrap( radeonTexObjPtr t, GLenum swrap, GLenum twrap )
-{
- GLboolean is_clamp = GL_FALSE;
- GLboolean is_clamp_to_border = GL_FALSE;
-
- t->pp_txfilter &= ~(RADEON_CLAMP_S_MASK | RADEON_CLAMP_T_MASK | RADEON_BORDER_MODE_D3D);
-
- switch ( swrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_S_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= RADEON_CLAMP_S_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_S_MIRROR;
- break;
- case GL_MIRROR_CLAMP_EXT:
- t->pp_txfilter |= RADEON_CLAMP_S_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- t->pp_txfilter |= RADEON_CLAMP_S_MIRROR_CLAMP_LAST;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- t->pp_txfilter |= RADEON_CLAMP_S_MIRROR_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__);
- }
-
- switch ( twrap ) {
- case GL_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_T_WRAP;
- break;
- case GL_CLAMP:
- t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_CLAMP_TO_EDGE:
- t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_LAST;
- break;
- case GL_CLAMP_TO_BORDER:
- t->pp_txfilter |= RADEON_CLAMP_T_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- case GL_MIRRORED_REPEAT:
- t->pp_txfilter |= RADEON_CLAMP_T_MIRROR;
- break;
- case GL_MIRROR_CLAMP_EXT:
- t->pp_txfilter |= RADEON_CLAMP_T_MIRROR_CLAMP_GL;
- is_clamp = GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- t->pp_txfilter |= RADEON_CLAMP_T_MIRROR_CLAMP_LAST;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- t->pp_txfilter |= RADEON_CLAMP_T_MIRROR_CLAMP_GL;
- is_clamp_to_border = GL_TRUE;
- break;
- default:
- _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__);
- }
-
- if ( is_clamp_to_border ) {
- t->pp_txfilter |= RADEON_BORDER_MODE_D3D;
- }
-
- t->border_fallback = (is_clamp && is_clamp_to_border);
-}
-
-static void radeonSetTexMaxAnisotropy( radeonTexObjPtr t, GLfloat max )
-{
- t->pp_txfilter &= ~RADEON_MAX_ANISO_MASK;
-
- if ( max == 1.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_1_TO_1;
- } else if ( max <= 2.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_2_TO_1;
- } else if ( max <= 4.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_4_TO_1;
- } else if ( max <= 8.0 ) {
- t->pp_txfilter |= RADEON_MAX_ANISO_8_TO_1;
- } else {
- t->pp_txfilter |= RADEON_MAX_ANISO_16_TO_1;
- }
-}
-
-/**
- * Set the texture magnification and minification modes.
- *
- * \param t Texture whose filter modes are to be set
- * \param minf Texture minification mode
- * \param magf Texture magnification mode
- */
-
-static void radeonSetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf )
-{
- GLuint anisotropy = (t->pp_txfilter & RADEON_MAX_ANISO_MASK);
-
- t->pp_txfilter &= ~(RADEON_MIN_FILTER_MASK | RADEON_MAG_FILTER_MASK);
-
- if ( anisotropy == RADEON_MAX_ANISO_1_TO_1 ) {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_NEAREST_MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_LINEAR_MIP_LINEAR;
- break;
- }
- } else {
- switch ( minf ) {
- case GL_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- t->pp_txfilter |= RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR;
- break;
- }
- }
-
- switch ( magf ) {
- case GL_NEAREST:
- t->pp_txfilter |= RADEON_MAG_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- t->pp_txfilter |= RADEON_MAG_FILTER_LINEAR;
- break;
- }
-}
-
-static void radeonSetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] )
-{
- t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
-}
-
-
-/**
- * Allocate space for and load the mesa images into the texture memory block.
- * This will happen before drawing with a new texture, or drawing with a
- * texture after it was swapped out or teximaged again.
- */
-
-static radeonTexObjPtr radeonAllocTexObj( struct gl_texture_object *texObj )
-{
- radeonTexObjPtr t;
-
- t = CALLOC_STRUCT( radeon_tex_obj );
- texObj->DriverData = t;
- if ( t != NULL ) {
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, (void *)texObj, (void *)t );
- }
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->border_fallback = GL_FALSE;
-
- t->pp_txfilter = RADEON_BORDER_MODE_OGL;
- t->pp_txformat = (RADEON_TXFORMAT_ENDIAN_NO_SWAP |
- RADEON_TXFORMAT_PERSPECTIVE_ENABLE);
-
- make_empty_list( & t->base );
-
- radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT );
- radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- radeonSetTexBorderColor( t, texObj->_BorderChan );
- }
-
- return t;
-}
-
-
-static const struct gl_texture_format *
-radeonChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- (void) format;
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch ( type ) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? _dri_texformat_argb8888 : _dri_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
- default:
- return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch ( type ) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return _dri_texformat_rgb565;
- default:
- return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- _dri_texformat_rgba8888 : _dri_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return _dri_texformat_argb4444;
-
- case GL_RGB5_A1:
- return _dri_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return _dri_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return _dri_texformat_a8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return _dri_texformat_l8;
-
- 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 _dri_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return _dri_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
- default:
- _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-
-static void radeonTexImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_teximage1d(ctx, target, level, internalFormat,
- width, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void radeonTexSubImage1D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- }
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[0] |= (1 << level);
-}
-
-
-static void radeonTexImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void radeonTexSubImage2D( 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 )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-static void radeonCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- if ( t != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- }
-
- /* Note, this will call ChooseTextureFormat */
- _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
- height, border, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-
-static void radeonCompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
- GLuint face;
-
-
- /* which cube face or ordinary 2D image */
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- ASSERT(face < 6);
- break;
- default:
- face = 0;
- }
-
- assert( t ); /* this _should_ be true */
- if ( t ) {
- driSwapOutTextureObject( t );
- }
- else {
- t = (driTextureObject *) radeonAllocTexObj( texObj );
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D");
- return;
- }
- }
-
- _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, imageSize, data, texObj, texImage);
-
- t->dirty_images[face] |= (1 << level);
-}
-
-#define SCALED_FLOAT_TO_BYTE( x, scale ) \
- (((GLuint)((255.0F / scale) * (x))) / 2)
-
-static void radeonTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if ( RADEON_DEBUG & DEBUG_STATE ) {
- fprintf( stderr, "%s( %s )\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr( pname ) );
- }
-
- switch ( pname ) {
- case GL_TEXTURE_ENV_COLOR: {
- GLubyte c[4];
- GLuint envColor;
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( c, texUnit->EnvColor );
- envColor = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
- if ( rmesa->hw.tex[unit].cmd[TEX_PP_TFACTOR] != envColor ) {
- RADEON_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TFACTOR] = envColor;
- }
- break;
- }
-
- case GL_TEXTURE_LOD_BIAS_EXT: {
- GLfloat bias, min;
- GLuint b;
-
- /* The Radeon's LOD bias is a signed 2's complement value with a
- * range of -1.0 <= bias < 4.0. We break this into two linear
- * functions, one mapping [-1.0,0.0] to [-128,0] and one mapping
- * [0.0,4.0] to [0,127].
- */
- min = driQueryOptionb (&rmesa->optionCache, "no_neg_lod_bias") ?
- 0.0 : -1.0;
- bias = CLAMP( *param, min, 4.0 );
- if ( bias == 0 ) {
- b = 0;
- } else if ( bias > 0 ) {
- b = ((GLuint)SCALED_FLOAT_TO_BYTE( bias, 4.0 )) << RADEON_LOD_BIAS_SHIFT;
- } else {
- b = ((GLuint)SCALED_FLOAT_TO_BYTE( bias, 1.0 )) << RADEON_LOD_BIAS_SHIFT;
- }
- if ( (rmesa->hw.tex[unit].cmd[TEX_PP_TXFILTER] & RADEON_LOD_BIAS_MASK) != b ) {
- RADEON_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFILTER] &= ~RADEON_LOD_BIAS_MASK;
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFILTER] |= (b & RADEON_LOD_BIAS_MASK);
- }
- break;
- }
-
- default:
- return;
- }
-}
-
-
-/**
- * Changes variables and flags for a state update, which will happen at the
- * next UpdateTextureState
- */
-
-static void radeonTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj,
- GLenum pname, const GLfloat *params )
-{
- radeonTexObjPtr t = (radeonTexObjPtr) texObj->DriverData;
-
- if ( RADEON_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( pname ) );
- }
-
- switch ( pname ) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy );
- radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- radeonSetTexBorderColor( t, texObj->_BorderChan );
- 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. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- driSwapOutTextureObject( (driTextureObject *) t );
- break;
-
- default:
- return;
- }
-
- /* Mark this texobj as dirty (one bit per tex unit)
- */
- t->dirty_state = TEX_ALL;
-}
-
-
-static void radeonBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- if ( RADEON_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, (void *)texObj,
- ctx->Texture.CurrentUnit );
- }
-
- assert( (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D &&
- target != GL_TEXTURE_RECTANGLE_NV) ||
- (texObj->DriverData != NULL) );
-}
-
-
-static void radeonDeleteTexture( GLcontext *ctx,
- struct gl_texture_object *texObj )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- driTextureObject * t = (driTextureObject *) texObj->DriverData;
-
- if ( RADEON_DEBUG & (DEBUG_STATE|DEBUG_TEXTURE) ) {
- fprintf( stderr, "%s( %p (target = %s) )\n", __FUNCTION__, (void *)texObj,
- _mesa_lookup_enum_by_nr( texObj->Target ) );
- }
-
- if ( t != NULL ) {
- if ( rmesa ) {
- RADEON_FIREVERTICES( rmesa );
- }
-
- driDestroyTextureObject( t );
- }
-
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, texObj);
-}
-
-/* Need:
- * - Same GEN_MODE for all active bits
- * - Same EyePlane/ObjPlane for all active bits when using Eye/Obj
- * - STRQ presumably all supported (matrix means incoming R values
- * can end up in STQ, this has implications for vertex support,
- * presumably ok if maos is used, though?)
- *
- * Basically impossible to do this on the fly - just collect some
- * basic info & do the checks from ValidateState().
- */
-static void radeonTexGen( GLcontext *ctx,
- GLenum coord,
- GLenum pname,
- const GLfloat *params )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint unit = ctx->Texture.CurrentUnit;
- rmesa->recheck_texgen[unit] = GL_TRUE;
-}
-
-/**
- * Allocate a new texture object.
- * Called via ctx->Driver.NewTextureObject.
- * 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 *
-radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- if (!obj)
- return NULL;
- obj->MaxAnisotropy = rmesa->initialMaxAnisotropy;
- radeonAllocTexObj( obj );
- return obj;
-}
-
-
-void radeonInitTextureFuncs( struct dd_function_table *functions )
-{
- functions->ChooseTextureFormat = radeonChooseTextureFormat;
- functions->TexImage1D = radeonTexImage1D;
- functions->TexImage2D = radeonTexImage2D;
- functions->TexSubImage1D = radeonTexSubImage1D;
- functions->TexSubImage2D = radeonTexSubImage2D;
-
- functions->NewTextureObject = radeonNewTextureObject;
- functions->BindTexture = radeonBindTexture;
- functions->DeleteTexture = radeonDeleteTexture;
- functions->IsTextureResident = driIsTextureResident;
-
- functions->TexEnv = radeonTexEnv;
- functions->TexParameter = radeonTexParameter;
- functions->TexGen = radeonTexGen;
-
- functions->CompressedTexImage2D = radeonCompressedTexImage2D;
- functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D;
-
- driInitTextureFormats();
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.h
deleted file mode 100644
index a806981ae..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.h,v 1.3 2002/02/22 21:45:01 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __RADEON_TEX_H__
-#define __RADEON_TEX_H__
-
-extern void radeonUpdateTextureState( GLcontext *ctx );
-
-extern int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t,
- GLuint face );
-
-extern void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t );
-
-extern void radeonInitTextureFuncs( struct dd_function_table *functions );
-
-#endif /* __RADEON_TEX_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c
deleted file mode 100644
index d492e190c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c,v 1.7 2002/12/16 16:18:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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 ATI, 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>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-#include <errno.h>
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-
-#include <unistd.h> /* for usleep() */
-
-
-/**
- * Destroy any device-dependent state associated with the texture. This may
- * include NULLing out hardware state that points to the texture.
- */
-void
-radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t )
-{
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p )\n", __FUNCTION__, (void *)t, (void *)t->base.tObj );
- }
-
- if ( rmesa != NULL ) {
- unsigned i;
-
-
- for ( i = 0 ; i < rmesa->glCtx->Const.MaxTextureUnits ; i++ ) {
- if ( t == rmesa->state.texture.unit[i].texobj ) {
- rmesa->state.texture.unit[i].texobj = NULL;
- rmesa->hw.tex[i].dirty = GL_FALSE;
- }
- }
- }
-}
-
-
-/* ------------------------------------------------------------
- * Texture image conversions
- */
-
-
-static void radeonUploadRectSubImage( radeonContextPtr rmesa,
- radeonTexObjPtr t,
- struct gl_texture_image *texImage,
- GLint x, GLint y,
- GLint width, GLint height )
-{
- const struct gl_texture_format *texFormat = texImage->TexFormat;
- int blit_format, dstPitch, done;
-
- switch ( texFormat->TexelBytes ) {
- case 1:
- blit_format = RADEON_GMC_DST_8BPP_CI;
- break;
- case 2:
- blit_format = RADEON_GMC_DST_16BPP;
- break;
- case 4:
- blit_format = RADEON_GMC_DST_32BPP;
- break;
- default:
- fprintf( stderr, "radeonUploadRectSubImage: unknown blit_format (texelbytes=%d)\n",
- texFormat->TexelBytes);
- return;
- }
-
- t->image[0][0].data = texImage->Data;
-
- /* Currently don't need to cope with small pitches.
- */
- width = texImage->Width;
- height = texImage->Height;
- dstPitch = t->pp_txpitch + 32;
-
- { /* FIXME: prefer GART-texturing if possible */
- /* Data not in GART memory, or bad pitch.
- */
- for (done = 0; done < height ; ) {
- struct radeon_dma_region region;
- int lines = MIN2( height - done, RADEON_BUFFER_SIZE / dstPitch );
- int src_pitch;
- char *tex;
-
- src_pitch = texImage->RowStride * texFormat->TexelBytes;
-
- tex = (char *)texImage->Data + done * src_pitch;
-
- memset(&region, 0, sizeof(region));
- radeonAllocDmaRegion( rmesa, &region, lines * dstPitch, 1024 );
-
- /* Copy texdata to dma:
- */
- if (0)
- fprintf(stderr, "%s: src_pitch %d dst_pitch %d\n",
- __FUNCTION__, src_pitch, dstPitch);
-
- if (src_pitch == dstPitch) {
- memcpy( region.address + region.start, tex, lines * src_pitch );
- }
- else {
- char *buf = region.address + region.start;
- int i;
- for (i = 0 ; i < lines ; i++) {
- memcpy( buf, tex, src_pitch );
- buf += dstPitch;
- tex += src_pitch;
- }
- }
-
- radeonEmitWait( rmesa, RADEON_WAIT_3D );
-
-
-
- /* Blit to framebuffer
- */
- radeonEmitBlit( rmesa,
- blit_format,
- dstPitch, GET_START( &region ),
- dstPitch, t->bufAddr,
- 0, 0,
- 0, done,
- width, lines );
-
- radeonEmitWait( rmesa, RADEON_WAIT_2D );
-
- radeonReleaseDmaRegion( rmesa, &region, __FUNCTION__ );
- done += lines;
- }
- }
-}
-
-
-/**
- * Upload the texture image associated with texture \a t at the specified
- * level at the address relative to \a start.
- */
-static void uploadSubImage( radeonContextPtr rmesa, radeonTexObjPtr t,
- GLint hwlevel,
- GLint x, GLint y, GLint width, GLint height,
- GLuint face )
-{
- struct gl_texture_image *texImage = NULL;
- GLuint offset;
- GLint imageWidth, imageHeight;
- GLint ret;
- drm_radeon_texture_t tex;
- drm_radeon_tex_image_t tmp;
- const int level = hwlevel + t->base.firstLevel;
-
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n",
- __FUNCTION__, (void *)t, (void *)t->base.tObj, level, width, height, face );
- }
-
- ASSERT(face < 6);
-
- /* Ensure we have a valid texture to upload */
- if ( ( hwlevel < 0 ) || ( hwlevel >= RADEON_MAX_TEXTURE_LEVELS ) ) {
- _mesa_problem(NULL, "bad texture level in %s", __FUNCTION__);
- return;
- }
-
- texImage = t->base.tObj->Image[face][level];
-
- if ( !texImage ) {
- if ( RADEON_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: texImage %d is NULL!\n", __FUNCTION__, level );
- return;
- }
- if ( !texImage->Data ) {
- if ( RADEON_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is NULL!\n", __FUNCTION__ );
- return;
- }
-
-
- if (t->base.tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- assert(level == 0);
- assert(hwlevel == 0);
- if ( RADEON_DEBUG & DEBUG_TEXTURE )
- fprintf( stderr, "%s: image data is rectangular\n", __FUNCTION__);
- radeonUploadRectSubImage( rmesa, t, texImage, x, y, width, height );
- return;
- }
-
- imageWidth = texImage->Width;
- imageHeight = texImage->Height;
-
- offset = t->bufAddr;
-
- if ( RADEON_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- GLint imageX = 0;
- GLint imageY = 0;
- GLint blitX = t->image[face][hwlevel].x;
- GLint blitY = t->image[face][hwlevel].y;
- GLint blitWidth = t->image[face][hwlevel].width;
- GLint blitHeight = t->image[face][hwlevel].height;
- fprintf( stderr, " upload image: %d,%d at %d,%d\n",
- imageWidth, imageHeight, imageX, imageY );
- fprintf( stderr, " upload blit: %d,%d at %d,%d\n",
- blitWidth, blitHeight, blitX, blitY );
- fprintf( stderr, " blit ofs: 0x%07x level: %d/%d\n",
- (GLuint)offset, hwlevel, level );
- }
-
- t->image[face][hwlevel].data = texImage->Data;
-
- /* Init the DRM_RADEON_TEXTURE command / drm_radeon_texture_t struct.
- * NOTE: we're always use a 1KB-wide blit and I8 texture format.
- * We used to use 1, 2 and 4-byte texels and used to use the texture
- * width to dictate the blit width - but that won't work for compressed
- * textures. (Brian)
- * NOTE: can't do that with texture tiling. (sroland)
- */
- tex.offset = offset;
- tex.image = &tmp;
- /* copy (x,y,width,height,data) */
- memcpy( &tmp, &t->image[face][hwlevel], sizeof(drm_radeon_tex_image_t) );
-
- if (texImage->TexFormat->TexelBytes) {
- /* use multi-byte upload scheme */
- tex.height = imageHeight;
- tex.width = imageWidth;
- tex.format = t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK;
- tex.pitch = MAX2((texImage->Width * texImage->TexFormat->TexelBytes) / 64, 1);
- tex.offset += tmp.x & ~1023;
- tmp.x = tmp.x % 1024;
- if (t->tile_bits & RADEON_TXO_MICRO_TILE_X2) {
- /* need something like "tiled coordinates" ? */
- tmp.y = tmp.x / (tex.pitch * 128) * 2;
- tmp.x = tmp.x % (tex.pitch * 128) / 2 / texImage->TexFormat->TexelBytes;
- tex.pitch |= RADEON_DST_TILE_MICRO >> 22;
- }
- else {
- tmp.x = tmp.x >> (texImage->TexFormat->TexelBytes >> 1);
- }
- if ((t->tile_bits & RADEON_TXO_MACRO_TILE) &&
- (texImage->Width * texImage->TexFormat->TexelBytes >= 256)) {
- /* radeon switches off macro tiling for small textures/mipmaps it seems */
- tex.pitch |= RADEON_DST_TILE_MACRO >> 22;
- }
- }
- else {
- /* In case of for instance 8x8 texture (2x2 dxt blocks), padding after the first two blocks is
- needed (only with dxt1 since 2 dxt3/dxt5 blocks already use 32 Byte). */
- /* set tex.height to 1/4 since 1 "macropixel" (dxt-block) has 4 real pixels. Needed
- so the kernel module reads the right amount of data. */
- tex.format = RADEON_TXFORMAT_I8; /* any 1-byte texel format */
- tex.pitch = (BLIT_WIDTH_BYTES / 64);
- tex.height = (imageHeight + 3) / 4;
- tex.width = (imageWidth + 3) / 4;
- switch (t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK) {
- case RADEON_TXFORMAT_DXT1:
- tex.width *= 8;
- break;
- case RADEON_TXFORMAT_DXT23:
- case RADEON_TXFORMAT_DXT45:
- tex.width *= 16;
- break;
- }
- }
-
- LOCK_HARDWARE( rmesa );
- do {
- ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_TEXTURE,
- &tex, sizeof(drm_radeon_texture_t) );
- } while ( ret && errno == EAGAIN );
-
- UNLOCK_HARDWARE( rmesa );
-
- if ( ret ) {
- fprintf( stderr, "DRM_RADEON_TEXTURE: return = %d\n", ret );
- fprintf( stderr, " offset=0x%08x\n",
- offset );
- fprintf( stderr, " image width=%d height=%d\n",
- imageWidth, imageHeight );
- fprintf( stderr, " blit width=%d height=%d data=%p\n",
- t->image[face][hwlevel].width, t->image[face][hwlevel].height,
- t->image[face][hwlevel].data );
- exit( 1 );
- }
-}
-
-
-/**
- * Upload the texture images associated with texture \a t. This might
- * require the allocation of texture memory.
- *
- * \param rmesa Context pointer
- * \param t Texture to be uploaded
- * \param face Cube map face to be uploaded. Zero for non-cube maps.
- */
-
-int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t, GLuint face )
-{
- const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- if ( RADEON_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) {
- fprintf( stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__,
- (void *)rmesa->glCtx, (void *)t->base.tObj, t->base.totalSize,
- t->base.firstLevel, t->base.lastLevel );
- }
-
- if ( !t || t->base.totalSize == 0 )
- return 0;
-
- if (RADEON_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__ );
- radeonFinish( rmesa->glCtx );
- }
-
- LOCK_HARDWARE( rmesa );
-
- if ( t->base.memBlock == NULL ) {
- int heap;
-
- heap = driAllocateTexture( rmesa->texture_heaps, rmesa->nr_heaps,
- (driTextureObject *) t );
- if ( heap == -1 ) {
- UNLOCK_HARDWARE( rmesa );
- return -1;
- }
-
- /* Set the base offset of the texture image */
- t->bufAddr = rmesa->radeonScreen->texOffset[heap]
- + t->base.memBlock->ofs;
- t->pp_txoffset = t->bufAddr;
-
- if (!(t->base.tObj->Image[0][0]->IsClientData)) {
- /* hope it's safe to add that here... */
- t->pp_txoffset |= t->tile_bits;
- }
-
- /* Mark this texobj as dirty on all units:
- */
- t->dirty_state = TEX_ALL;
- }
-
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( (driTextureObject *) t );
- UNLOCK_HARDWARE( rmesa );
-
-
- /* Upload any images that are new */
- if (t->base.dirty_images[face]) {
- int i;
- for ( i = 0 ; i < numLevels ; i++ ) {
- if ( (t->base.dirty_images[face] & (1 << (i+t->base.firstLevel))) != 0 ) {
- uploadSubImage( rmesa, t, i, 0, 0, t->image[face][i].width,
- t->image[face][i].height, face );
- }
- }
- t->base.dirty_images[face] = 0;
- }
-
- if (RADEON_DEBUG & DEBUG_SYNC) {
- fprintf(stderr, "%s: Syncing\n", __FUNCTION__ );
- radeonFinish( rmesa->glCtx );
- }
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c
deleted file mode 100644
index 43fe509fb..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ /dev/null
@@ -1,1171 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c,v 1.6 2002/12/16 16:18:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-#include "enums.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_swtcl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-
-
-#define RADEON_TXFORMAT_A8 RADEON_TXFORMAT_I8
-#define RADEON_TXFORMAT_L8 RADEON_TXFORMAT_I8
-#define RADEON_TXFORMAT_AL88 RADEON_TXFORMAT_AI88
-#define RADEON_TXFORMAT_YCBCR RADEON_TXFORMAT_YVYU422
-#define RADEON_TXFORMAT_YCBCR_REV RADEON_TXFORMAT_VYUY422
-#define RADEON_TXFORMAT_RGB_DXT1 RADEON_TXFORMAT_DXT1
-#define RADEON_TXFORMAT_RGBA_DXT1 RADEON_TXFORMAT_DXT1
-#define RADEON_TXFORMAT_RGBA_DXT3 RADEON_TXFORMAT_DXT23
-#define RADEON_TXFORMAT_RGBA_DXT5 RADEON_TXFORMAT_DXT45
-
-#define _COLOR(f) \
- [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, 0 }
-#define _COLOR_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { RADEON_TXFORMAT_ ## f, 0 }
-#define _ALPHA(f) \
- [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _ALPHA_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { RADEON_TXFORMAT_ ## f | RADEON_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _YUV(f) \
- [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, RADEON_YUV_TO_RGB }
-#define _INVALID(f) \
- [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \
- && (tx_table[f].format != 0xffffffff) )
-
-static const struct {
- GLuint format, filter;
-}
-tx_table[] =
-{
- _ALPHA(RGBA8888),
- _ALPHA_REV(RGBA8888),
- _ALPHA(ARGB8888),
- _ALPHA_REV(ARGB8888),
- _INVALID(RGB888),
- _COLOR(RGB565),
- _COLOR_REV(RGB565),
- _ALPHA(ARGB4444),
- _ALPHA_REV(ARGB4444),
- _ALPHA(ARGB1555),
- _ALPHA_REV(ARGB1555),
- _ALPHA(AL88),
- _ALPHA_REV(AL88),
- _ALPHA(A8),
- _COLOR(L8),
- _ALPHA(I8),
- _INVALID(CI8),
- _YUV(YCBCR),
- _YUV(YCBCR_REV),
- _INVALID(RGB_FXT1),
- _INVALID(RGBA_FXT1),
- _COLOR(RGB_DXT1),
- _ALPHA(RGBA_DXT1),
- _ALPHA(RGBA_DXT3),
- _ALPHA(RGBA_DXT5),
-};
-
-#undef _COLOR
-#undef _ALPHA
-#undef _INVALID
-
-/**
- * This function computes the number of bytes of storage needed for
- * the given texture object (all mipmap levels, all cube faces).
- * The \c image[face][level].x/y/width/height parameters for upload/blitting
- * are computed here. \c pp_txfilter, \c pp_txformat, etc. will be set here
- * too.
- *
- * \param rmesa Context pointer
- * \param tObj GL texture object whose images are to be posted to
- * hardware state.
- */
-static void radeonSetTexImages( radeonContextPtr rmesa,
- struct gl_texture_object *tObj )
-{
- radeonTexObjPtr t = (radeonTexObjPtr)tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint curOffset, blitWidth;
- GLint i, texelBytes;
- GLint numLevels;
- GLint log2Width, log2Height, log2Depth;
-
- /* Set the hardware texture format
- */
-
- t->pp_txformat &= ~(RADEON_TXFORMAT_FORMAT_MASK |
- RADEON_TXFORMAT_ALPHA_IN_MAP);
- t->pp_txfilter &= ~RADEON_YUV_TO_RGB;
-
- if ( VALID_FORMAT( baseImage->TexFormat->MesaFormat ) ) {
- t->pp_txformat |= tx_table[ baseImage->TexFormat->MesaFormat ].format;
- t->pp_txfilter |= tx_table[ baseImage->TexFormat->MesaFormat ].filter;
- }
- else {
- _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
- return;
- }
-
- texelBytes = baseImage->TexFormat->TexelBytes;
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
-
- driCalculateTextureFirstLastLevel( (driTextureObject *) t );
- log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2;
- log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2;
- log2Depth = tObj->Image[0][t->base.firstLevel]->DepthLog2;
-
- numLevels = t->base.lastLevel - t->base.firstLevel + 1;
-
- assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS);
-
- /* Calculate mipmap offsets and dimensions for blitting (uploading)
- * The idea is that we lay out the mipmap levels within a block of
- * memory organized as a rectangle of width BLIT_WIDTH_BYTES.
- */
- curOffset = 0;
- blitWidth = BLIT_WIDTH_BYTES;
- t->tile_bits = 0;
-
- /* figure out if this texture is suitable for tiling. */
- if (texelBytes && (tObj->Target != GL_TEXTURE_RECTANGLE_NV)) {
- if (rmesa->texmicrotile && (baseImage->Height > 1)) {
- /* allow 32 (bytes) x 1 mip (which will use two times the space
- the non-tiled version would use) max if base texture is large enough */
- if ((numLevels == 1) ||
- (((baseImage->Width * texelBytes / baseImage->Height) <= 32) &&
- (baseImage->Width * texelBytes > 64)) ||
- ((baseImage->Width * texelBytes / baseImage->Height) <= 16)) {
- /* R100 has two microtile bits (only the txoffset reg, not the blitter)
- weird: X2 + OPT: 32bit correct, 16bit completely hosed
- X2: 32bit correct, 16bit correct
- OPT: 32bit large mips correct, small mips hosed, 16bit completely hosed */
- t->tile_bits |= RADEON_TXO_MICRO_TILE_X2 /*| RADEON_TXO_MICRO_TILE_OPT*/;
- }
- }
- if ((baseImage->Width * texelBytes >= 256) && (baseImage->Height >= 16)) {
- /* R100 disables macro tiling only if mip width is smaller than 256 bytes, and not
- in the case if height is smaller than 16 (not 100% sure), as does the r200,
- so need to disable macro tiling in that case */
- if ((numLevels == 1) || ((baseImage->Width * texelBytes / baseImage->Height) <= 4)) {
- t->tile_bits |= RADEON_TXO_MACRO_TILE;
- }
- }
- }
-
- for (i = 0; i < numLevels; i++) {
- const struct gl_texture_image *texImage;
- GLuint size;
-
- texImage = tObj->Image[0][i + t->base.firstLevel];
- if ( !texImage )
- break;
-
- /* find image size in bytes */
- if (texImage->IsCompressed) {
- /* need to calculate the size AFTER padding even though the texture is
- submitted without padding.
- Only handle pot textures currently - don't know if npot is even possible,
- size calculation would certainly need (trivial) adjustments.
- Align (and later pad) to 32byte, not sure what that 64byte blit width is
- good for? */
- if ((t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK) == RADEON_TXFORMAT_DXT1) {
- /* RGB_DXT1/RGBA_DXT1, 8 bytes per block */
- if ((texImage->Width + 3) < 8) /* width one block */
- size = texImage->CompressedSize * 4;
- else if ((texImage->Width + 3) < 16)
- size = texImage->CompressedSize * 2;
- else size = texImage->CompressedSize;
- }
- else /* DXT3/5, 16 bytes per block */
- if ((texImage->Width + 3) < 8)
- size = texImage->CompressedSize * 2;
- else size = texImage->CompressedSize;
- }
- else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- size = ((texImage->Width * texelBytes + 63) & ~63) * texImage->Height;
- }
- else if (t->tile_bits & RADEON_TXO_MICRO_TILE_X2) {
- /* 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 */
- int w = (texImage->Width * texelBytes * 2 + 31) & ~31;
- size = (w * ((texImage->Height + 1) / 2)) * texImage->Depth;
- blitWidth = MAX2(texImage->Width, 64 / texelBytes);
- }
- else {
- int w = (texImage->Width * texelBytes + 31) & ~31;
- size = w * texImage->Height * texImage->Depth;
- blitWidth = MAX2(texImage->Width, 64 / texelBytes);
- }
- assert(size > 0);
-
- /* Align to 32-byte offset. It is faster to do this unconditionally
- * (no branch penalty).
- */
-
- curOffset = (curOffset + 0x1f) & ~0x1f;
-
- if (texelBytes) {
- t->image[0][i].x = curOffset; /* fix x and y coords up later together with offset */
- t->image[0][i].y = 0;
- t->image[0][i].width = MIN2(size / texelBytes, blitWidth);
- t->image[0][i].height = (size / texelBytes) / t->image[0][i].width;
- }
- else {
- t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES;
- t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES;
- t->image[0][i].width = MIN2(size, BLIT_WIDTH_BYTES);
- t->image[0][i].height = size / t->image[0][i].width;
- }
-
-#if 0
- /* for debugging only and only applicable to non-rectangle targets */
- assert(size % t->image[0][i].width == 0);
- assert(t->image[0][i].x == 0
- || (size < BLIT_WIDTH_BYTES && t->image[0][i].height == 1));
-#endif
-
- if (0)
- fprintf(stderr,
- "level %d: %dx%d x=%d y=%d w=%d h=%d size=%d at %d\n",
- i, texImage->Width, texImage->Height,
- t->image[0][i].x, t->image[0][i].y,
- t->image[0][i].width, t->image[0][i].height, size, curOffset);
-
- curOffset += size;
-
- }
-
- /* Align the total size of texture memory block.
- */
- t->base.totalSize = (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK;
-
- /* Hardware state:
- */
- t->pp_txfilter &= ~RADEON_MAX_MIP_LEVEL_MASK;
- t->pp_txfilter |= (numLevels - 1) << RADEON_MAX_MIP_LEVEL_SHIFT;
-
- t->pp_txformat &= ~(RADEON_TXFORMAT_WIDTH_MASK |
- RADEON_TXFORMAT_HEIGHT_MASK |
- RADEON_TXFORMAT_CUBIC_MAP_ENABLE);
- t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_WIDTH_SHIFT) |
- (log2Height << RADEON_TXFORMAT_HEIGHT_SHIFT));
-
- t->pp_txsize = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << 0) |
- ((tObj->Image[0][t->base.firstLevel]->Height - 1) << 16));
-
- /* Only need to round to nearest 32 for textures, but the blitter
- * requires 64-byte aligned pitches, and we may/may not need the
- * blitter. NPOT only!
- */
- if (baseImage->IsCompressed)
- t->pp_txpitch = (tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63);
- else
- t->pp_txpitch = ((tObj->Image[0][t->base.firstLevel]->Width * texelBytes) + 63) & ~(63);
- t->pp_txpitch -= 32;
-
- t->dirty_state = TEX_ALL;
-
- /* FYI: radeonUploadTexImages( rmesa, t ); used to be called here */
-}
-
-
-
-/* ================================================================
- * Texture combine functions
- */
-
-/* GL_ARB_texture_env_combine support
- */
-
-/* The color tables have combine functions for GL_SRC_COLOR,
- * GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint radeon_texture_color[][RADEON_MAX_TEXTURE_UNITS] =
-{
- {
- RADEON_COLOR_ARG_A_T0_COLOR,
- RADEON_COLOR_ARG_A_T1_COLOR,
- RADEON_COLOR_ARG_A_T2_COLOR
- },
- {
- RADEON_COLOR_ARG_A_T0_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T1_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T2_COLOR | RADEON_COMP_ARG_A
- },
- {
- RADEON_COLOR_ARG_A_T0_ALPHA,
- RADEON_COLOR_ARG_A_T1_ALPHA,
- RADEON_COLOR_ARG_A_T2_ALPHA
- },
- {
- RADEON_COLOR_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A
- },
-};
-
-static GLuint radeon_tfactor_color[] =
-{
- RADEON_COLOR_ARG_A_TFACTOR_COLOR,
- RADEON_COLOR_ARG_A_TFACTOR_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_TFACTOR_ALPHA,
- RADEON_COLOR_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_primary_color[] =
-{
- RADEON_COLOR_ARG_A_DIFFUSE_COLOR,
- RADEON_COLOR_ARG_A_DIFFUSE_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_DIFFUSE_ALPHA,
- RADEON_COLOR_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_previous_color[] =
-{
- RADEON_COLOR_ARG_A_CURRENT_COLOR,
- RADEON_COLOR_ARG_A_CURRENT_COLOR | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_CURRENT_ALPHA,
- RADEON_COLOR_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-3
- * GL_ONE table - indices 1-4
- */
-static GLuint radeon_zero_color[] =
-{
- RADEON_COLOR_ARG_A_ZERO,
- RADEON_COLOR_ARG_A_ZERO | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_ZERO,
- RADEON_COLOR_ARG_A_ZERO | RADEON_COMP_ARG_A,
- RADEON_COLOR_ARG_A_ZERO
-};
-
-
-/* The alpha tables only have GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA.
- */
-static GLuint radeon_texture_alpha[][RADEON_MAX_TEXTURE_UNITS] =
-{
- {
- RADEON_ALPHA_ARG_A_T0_ALPHA,
- RADEON_ALPHA_ARG_A_T1_ALPHA,
- RADEON_ALPHA_ARG_A_T2_ALPHA
- },
- {
- RADEON_ALPHA_ARG_A_T0_ALPHA | RADEON_COMP_ARG_A,
- RADEON_ALPHA_ARG_A_T1_ALPHA | RADEON_COMP_ARG_A,
- RADEON_ALPHA_ARG_A_T2_ALPHA | RADEON_COMP_ARG_A
- },
-};
-
-static GLuint radeon_tfactor_alpha[] =
-{
- RADEON_ALPHA_ARG_A_TFACTOR_ALPHA,
- RADEON_ALPHA_ARG_A_TFACTOR_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_primary_alpha[] =
-{
- RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA,
- RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA | RADEON_COMP_ARG_A
-};
-
-static GLuint radeon_previous_alpha[] =
-{
- RADEON_ALPHA_ARG_A_CURRENT_ALPHA,
- RADEON_ALPHA_ARG_A_CURRENT_ALPHA | RADEON_COMP_ARG_A
-};
-
-/* GL_ZERO table - indices 0-1
- * GL_ONE table - indices 1-2
- */
-static GLuint radeon_zero_alpha[] =
-{
- RADEON_ALPHA_ARG_A_ZERO,
- RADEON_ALPHA_ARG_A_ZERO | RADEON_COMP_ARG_A,
- RADEON_ALPHA_ARG_A_ZERO
-};
-
-
-/* Extract the arg from slot A, shift it into the correct argument slot
- * and set the corresponding complement bit.
- */
-#define RADEON_COLOR_ARG( n, arg ) \
-do { \
- color_combine |= \
- ((color_arg[n] & RADEON_COLOR_ARG_MASK) \
- << RADEON_COLOR_ARG_##arg##_SHIFT); \
- color_combine |= \
- ((color_arg[n] >> RADEON_COMP_ARG_SHIFT) \
- << RADEON_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-#define RADEON_ALPHA_ARG( n, arg ) \
-do { \
- alpha_combine |= \
- ((alpha_arg[n] & RADEON_ALPHA_ARG_MASK) \
- << RADEON_ALPHA_ARG_##arg##_SHIFT); \
- alpha_combine |= \
- ((alpha_arg[n] >> RADEON_COMP_ARG_SHIFT) \
- << RADEON_COMP_ARG_##arg##_SHIFT); \
-} while (0)
-
-
-/* ================================================================
- * Texture unit state management
- */
-
-static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint color_combine, alpha_combine;
- const GLuint color_combine0 = RADEON_COLOR_ARG_A_ZERO | RADEON_COLOR_ARG_B_ZERO
- | RADEON_COLOR_ARG_C_CURRENT_COLOR | RADEON_BLEND_CTL_ADD
- | RADEON_SCALE_1X | RADEON_CLAMP_TX;
- const GLuint alpha_combine0 = RADEON_ALPHA_ARG_A_ZERO | RADEON_ALPHA_ARG_B_ZERO
- | RADEON_ALPHA_ARG_C_CURRENT_ALPHA | RADEON_BLEND_CTL_ADD
- | RADEON_SCALE_1X | RADEON_CLAMP_TX;
-
-
- /* texUnit->_Current can be NULL if and only if the texture unit is
- * not actually enabled.
- */
- assert( (texUnit->_ReallyEnabled == 0)
- || (texUnit->_Current != NULL) );
-
- if ( RADEON_DEBUG & DEBUG_TEXTURE ) {
- fprintf( stderr, "%s( %p, %d )\n", __FUNCTION__, (void *)ctx, unit );
- }
-
- /* Set the texture environment state. Isn't this nice and clean?
- * The chip will automagically set the texture alpha to 0xff when
- * the texture format does not include an alpha component. This
- * reduces the amount of special-casing we have to do, alpha-only
- * textures being a notable exception.
- */
- /* Don't cache these results.
- */
- rmesa->state.texture.unit[unit].format = 0;
- rmesa->state.texture.unit[unit].envMode = 0;
-
- if ( !texUnit->_ReallyEnabled ) {
- color_combine = color_combine0;
- alpha_combine = alpha_combine0;
- }
- else {
- GLuint color_arg[3], alpha_arg[3];
- GLuint i;
- const GLuint numColorArgs = texUnit->_CurrentCombine->_NumArgsRGB;
- const GLuint numAlphaArgs = texUnit->_CurrentCombine->_NumArgsA;
- GLuint RGBshift = texUnit->_CurrentCombine->ScaleShiftRGB;
- GLuint Ashift = texUnit->_CurrentCombine->ScaleShiftA;
-
-
- /* Step 1:
- * Extract the color and alpha combine function arguments.
- */
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- const GLint op = texUnit->_CurrentCombine->OperandRGB[i] - GL_SRC_COLOR;
- const GLuint srcRGBi = texUnit->_CurrentCombine->SourceRGB[i];
- assert(op >= 0);
- assert(op <= 3);
- switch ( srcRGBi ) {
- case GL_TEXTURE:
- color_arg[i] = radeon_texture_color[op][unit];
- break;
- case GL_CONSTANT:
- color_arg[i] = radeon_tfactor_color[op];
- break;
- case GL_PRIMARY_COLOR:
- color_arg[i] = radeon_primary_color[op];
- break;
- case GL_PREVIOUS:
- color_arg[i] = radeon_previous_color[op];
- break;
- case GL_ZERO:
- color_arg[i] = radeon_zero_color[op];
- break;
- case GL_ONE:
- color_arg[i] = radeon_zero_color[op+1];
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- /* implement ogl 1.4/1.5 core spec here, not specification of
- * GL_ARB_texture_env_crossbar (which would require disabling blending
- * instead of undefined results when referencing not enabled texunit) */
- color_arg[i] = radeon_texture_color[op][srcRGBi - GL_TEXTURE0];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- const GLint op = texUnit->_CurrentCombine->OperandA[i] - GL_SRC_ALPHA;
- const GLuint srcAi = texUnit->_CurrentCombine->SourceA[i];
- assert(op >= 0);
- assert(op <= 1);
- switch ( srcAi ) {
- case GL_TEXTURE:
- alpha_arg[i] = radeon_texture_alpha[op][unit];
- break;
- case GL_CONSTANT:
- alpha_arg[i] = radeon_tfactor_alpha[op];
- break;
- case GL_PRIMARY_COLOR:
- alpha_arg[i] = radeon_primary_alpha[op];
- break;
- case GL_PREVIOUS:
- alpha_arg[i] = radeon_previous_alpha[op];
- break;
- case GL_ZERO:
- alpha_arg[i] = radeon_zero_alpha[op];
- break;
- case GL_ONE:
- alpha_arg[i] = radeon_zero_alpha[op+1];
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- alpha_arg[i] = radeon_texture_alpha[op][srcAi - GL_TEXTURE0];
- break;
- default:
- return GL_FALSE;
- }
- }
-
- /* Step 2:
- * Build up the color and alpha combine functions.
- */
- switch ( texUnit->_CurrentCombine->ModeRGB ) {
- case GL_REPLACE:
- color_combine = (RADEON_COLOR_ARG_A_ZERO |
- RADEON_COLOR_ARG_B_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, C );
- break;
- case GL_MODULATE:
- color_combine = (RADEON_COLOR_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, B );
- break;
- case GL_ADD:
- color_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- color_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- color_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- color_combine = (RADEON_BLEND_CTL_BLEND |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, B );
- RADEON_COLOR_ARG( 1, A );
- RADEON_COLOR_ARG( 2, C );
- break;
-
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- RGBshift = 0;
- /* FALLTHROUGH */
-
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- /* The R100 / RV200 only support a 1X multiplier in hardware
- * w/the ARB version.
- */
- if ( RGBshift != (RADEON_SCALE_1X >> RADEON_SCALE_SHIFT) ) {
- return GL_FALSE;
- }
-
- RGBshift += 2;
- if ( (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT)
- || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) ) {
- /* is it necessary to set this or will it be ignored anyway? */
- Ashift = RGBshift;
- }
-
- color_combine = (RADEON_COLOR_ARG_C_ZERO |
- RADEON_BLEND_CTL_DOT3 |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, B );
- break;
-
- case GL_MODULATE_ADD_ATI:
- color_combine = (RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- RADEON_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- color_combine = (RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- RADEON_COLOR_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- color_combine = (RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_COLOR_ARG( 0, A );
- RADEON_COLOR_ARG( 1, C );
- RADEON_COLOR_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- switch ( texUnit->_CurrentCombine->ModeA ) {
- case GL_REPLACE:
- alpha_combine = (RADEON_ALPHA_ARG_A_ZERO |
- RADEON_ALPHA_ARG_B_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, C );
- break;
- case GL_MODULATE:
- alpha_combine = (RADEON_ALPHA_ARG_C_ZERO |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, B );
- break;
- case GL_ADD:
- alpha_combine = (RADEON_ALPHA_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- break;
- case GL_ADD_SIGNED:
- alpha_combine = (RADEON_ALPHA_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- break;
- case GL_SUBTRACT:
- alpha_combine = (RADEON_COLOR_ARG_B_ZERO |
- RADEON_COMP_ARG_B |
- RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- break;
- case GL_INTERPOLATE:
- alpha_combine = (RADEON_BLEND_CTL_BLEND |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, B );
- RADEON_ALPHA_ARG( 1, A );
- RADEON_ALPHA_ARG( 2, C );
- break;
-
- case GL_MODULATE_ADD_ATI:
- alpha_combine = (RADEON_BLEND_CTL_ADD |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- RADEON_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SIGNED_ADD_ATI:
- alpha_combine = (RADEON_BLEND_CTL_ADDSIGNED |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- RADEON_ALPHA_ARG( 2, B );
- break;
- case GL_MODULATE_SUBTRACT_ATI:
- alpha_combine = (RADEON_BLEND_CTL_SUBTRACT |
- RADEON_CLAMP_TX);
- RADEON_ALPHA_ARG( 0, A );
- RADEON_ALPHA_ARG( 1, C );
- RADEON_ALPHA_ARG( 2, B );
- break;
- default:
- return GL_FALSE;
- }
-
- if ( (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGB_EXT)
- || (texUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGB) ) {
- alpha_combine |= RADEON_DOT_ALPHA_DONT_REPLICATE;
- }
-
- /* Step 3:
- * Apply the scale factor.
- */
- color_combine |= (RGBshift << RADEON_SCALE_SHIFT);
- alpha_combine |= (Ashift << RADEON_SCALE_SHIFT);
-
- /* All done!
- */
- }
-
- if ( rmesa->hw.tex[unit].cmd[TEX_PP_TXCBLEND] != color_combine ||
- rmesa->hw.tex[unit].cmd[TEX_PP_TXABLEND] != alpha_combine ) {
- RADEON_STATECHANGE( rmesa, tex[unit] );
- rmesa->hw.tex[unit].cmd[TEX_PP_TXCBLEND] = color_combine;
- rmesa->hw.tex[unit].cmd[TEX_PP_TXABLEND] = alpha_combine;
- }
-
- return GL_TRUE;
-}
-
-#define TEXOBJ_TXFILTER_MASK (RADEON_MAX_MIP_LEVEL_MASK | \
- RADEON_MIN_FILTER_MASK | \
- RADEON_MAG_FILTER_MASK | \
- RADEON_MAX_ANISO_MASK | \
- RADEON_YUV_TO_RGB | \
- RADEON_YUV_TEMPERATURE_MASK | \
- RADEON_CLAMP_S_MASK | \
- RADEON_CLAMP_T_MASK | \
- RADEON_BORDER_MODE_D3D )
-
-#define TEXOBJ_TXFORMAT_MASK (RADEON_TXFORMAT_WIDTH_MASK | \
- RADEON_TXFORMAT_HEIGHT_MASK | \
- RADEON_TXFORMAT_FORMAT_MASK | \
- RADEON_TXFORMAT_F5_WIDTH_MASK | \
- RADEON_TXFORMAT_F5_HEIGHT_MASK | \
- RADEON_TXFORMAT_ALPHA_IN_MAP | \
- RADEON_TXFORMAT_CUBIC_MAP_ENABLE | \
- RADEON_TXFORMAT_NON_POWER2)
-
-
-static void import_tex_obj_state( radeonContextPtr rmesa,
- int unit,
- radeonTexObjPtr texobj )
-{
- GLuint *cmd = RADEON_DB_STATE( tex[unit] );
-
- cmd[TEX_PP_TXFILTER] &= ~TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFILTER] |= texobj->pp_txfilter & TEXOBJ_TXFILTER_MASK;
- cmd[TEX_PP_TXFORMAT] &= ~TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXFORMAT] |= texobj->pp_txformat & TEXOBJ_TXFORMAT_MASK;
- cmd[TEX_PP_TXOFFSET] = texobj->pp_txoffset;
- cmd[TEX_PP_BORDER_COLOR] = texobj->pp_border_color;
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.tex[unit] );
-
- if (texobj->base.tObj->Target == GL_TEXTURE_RECTANGLE_NV) {
- GLuint *txr_cmd = RADEON_DB_STATE( txr[unit] );
- txr_cmd[TXR_PP_TEX_SIZE] = texobj->pp_txsize; /* NPOT only! */
- txr_cmd[TXR_PP_TEX_PITCH] = texobj->pp_txpitch; /* NPOT only! */
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.txr[unit] );
- }
-
- texobj->dirty_state &= ~(1<<unit);
-}
-
-
-
-
-static void set_texgen_matrix( radeonContextPtr rmesa,
- GLuint unit,
- const GLfloat *s_plane,
- const GLfloat *t_plane )
-{
- static const GLfloat scale_identity[4] = { 1,1,1,1 };
-
- if (!TEST_EQ_4V( s_plane, scale_identity) ||
- !TEST_EQ_4V( t_plane, scale_identity)) {
- rmesa->TexGenEnabled |= RADEON_TEXMAT_0_ENABLE<<unit;
- rmesa->TexGenMatrix[unit].m[0] = s_plane[0];
- rmesa->TexGenMatrix[unit].m[4] = s_plane[1];
- rmesa->TexGenMatrix[unit].m[8] = s_plane[2];
- rmesa->TexGenMatrix[unit].m[12] = s_plane[3];
-
- rmesa->TexGenMatrix[unit].m[1] = t_plane[0];
- rmesa->TexGenMatrix[unit].m[5] = t_plane[1];
- rmesa->TexGenMatrix[unit].m[9] = t_plane[2];
- rmesa->TexGenMatrix[unit].m[13] = t_plane[3];
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-}
-
-/* Ignoring the Q texcoord for now.
- *
- * Returns GL_FALSE if fallback required.
- */
-static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_INPUT_MASK<<inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
-
- if ((texUnit->TexGenEnabled & (S_BIT|T_BIT)) == 0) {
- /* Disabled, no fallback:
- */
- rmesa->TexGenEnabled |=
- (RADEON_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
- return GL_TRUE;
- }
- else if (texUnit->TexGenEnabled & Q_BIT) {
- /* Very easy to do this, in fact would remove a fallback case
- * elsewhere, but I haven't done it yet... Fallback:
- */
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "fallback Q_BIT\n");
- return GL_FALSE;
- }
- else if ((texUnit->TexGenEnabled & (S_BIT|T_BIT)) != (S_BIT|T_BIT) ||
- texUnit->GenModeS != texUnit->GenModeT) {
- /* Mixed modes, fallback:
- */
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "fallback mixed texgen\n");
- return GL_FALSE;
- }
- else
- rmesa->TexGenEnabled |= RADEON_TEXGEN_TEXMAT_0_ENABLE << unit;
-
- switch (texUnit->GenModeS) {
- case GL_OBJECT_LINEAR:
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_OBJ << inputshift;
- set_texgen_matrix( rmesa, unit,
- texUnit->ObjectPlaneS,
- texUnit->ObjectPlaneT);
- break;
-
- case GL_EYE_LINEAR:
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_EYE << inputshift;
- set_texgen_matrix( rmesa, unit,
- texUnit->EyePlaneS,
- texUnit->EyePlaneT);
- break;
-
- case GL_REFLECTION_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_EYE_REFLECT<<inputshift;
- break;
-
- case GL_NORMAL_MAP_NV:
- rmesa->TexGenNeedNormals[unit] = GL_TRUE;
- rmesa->TexGenEnabled |= RADEON_TEXGEN_INPUT_EYE_NORMAL<<inputshift;
- break;
-
- case GL_SPHERE_MAP:
- default:
- /* Unsupported mode, fallback:
- */
- if (RADEON_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "fallback GL_SPHERE_MAP\n");
- return GL_FALSE;
- }
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- return GL_TRUE;
-}
-
-
-static void disable_tex( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (RADEON_TEX_0_ENABLE<<unit)) {
- /* Texture unit disabled */
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &= ~(1UL << unit);
- rmesa->state.texture.unit[unit].texobj = NULL;
- }
-
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] &=
- ~((RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE) << unit);
-
- RADEON_STATECHANGE( rmesa, tcl );
- switch (unit) {
- case 0:
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~(RADEON_TCL_VTX_ST0 |
- RADEON_TCL_VTX_Q0);
- break;
- case 1:
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~(RADEON_TCL_VTX_ST1 |
- RADEON_TCL_VTX_Q1);
- break;
- default:
- break;
- }
-
-
- if (rmesa->TclFallback & (RADEON_TCL_FALLBACK_TEXGEN_0<<unit)) {
- TCL_FALLBACK( ctx, (RADEON_TCL_FALLBACK_TEXGEN_0<<unit), GL_FALSE);
- rmesa->recheck_texgen[unit] = GL_TRUE;
- }
-
-
-
- {
- GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
- GLuint tmp = rmesa->TexGenEnabled;
-
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXMAT_0_ENABLE<<unit);
- rmesa->TexGenEnabled &= ~(RADEON_TEXGEN_INPUT_MASK<<inputshift);
- rmesa->TexGenNeedNormals[unit] = 0;
- rmesa->TexGenEnabled |=
- (RADEON_TEXGEN_INPUT_TEXCOORD_0+unit) << inputshift;
-
- if (tmp != rmesa->TexGenEnabled) {
- rmesa->recheck_texgen[unit] = GL_TRUE;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
- }
- }
-}
-
-static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
-
- /* Need to load the 2d images associated with this unit.
- */
- if (t->pp_txformat & RADEON_TXFORMAT_NON_POWER2) {
- t->pp_txformat &= ~RADEON_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_1D);
-
- if ( t->base.dirty_images[0] ) {
- RADEON_FIREVERTICES( rmesa );
- radeonSetTexImages( rmesa, tObj );
- radeonUploadTexImages( rmesa, (radeonTexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock )
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean enable_tex_rect( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
-
- if (!(t->pp_txformat & RADEON_TXFORMAT_NON_POWER2)) {
- t->pp_txformat |= RADEON_TXFORMAT_NON_POWER2;
- t->base.dirty_images[0] = ~0;
- }
-
- ASSERT(tObj->Target == GL_TEXTURE_RECTANGLE_NV);
-
- if ( t->base.dirty_images[0] ) {
- RADEON_FIREVERTICES( rmesa );
- radeonSetTexImages( rmesa, tObj );
- radeonUploadTexImages( rmesa, (radeonTexObjPtr) tObj->DriverData, 0 );
- if ( !t->base.memBlock /* && !rmesa->prefer_gart_client_texturing FIXME */ ) {
- fprintf(stderr, "%s: upload failed\n", __FUNCTION__);
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *tObj = texUnit->_Current;
- radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
- GLenum format;
-
- /* Fallback if there's a texture border */
- if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) {
- fprintf(stderr, "%s: border\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
- if ( rmesa->state.texture.unit[unit].texobj != t ) {
- if ( rmesa->state.texture.unit[unit].texobj != NULL ) {
- /* The old texture is no longer bound to this texture unit.
- * Mark it as such.
- */
-
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1UL << unit);
- }
-
- rmesa->state.texture.unit[unit].texobj = t;
- t->base.bound |= (1UL << unit);
- t->dirty_state |= 1<<unit;
- driUpdateTextureLRU( (driTextureObject *) t ); /* XXX: should be locked! */
- }
-
-
- /* Newly enabled?
- */
- if ( !(rmesa->hw.ctx.cmd[CTX_PP_CNTL] & (RADEON_TEX_0_ENABLE<<unit))) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |=
- (RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE) << unit;
-
- RADEON_STATECHANGE( rmesa, tcl );
-
- if (unit == 0)
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_ST0;
- else
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_ST1;
-
- rmesa->recheck_texgen[unit] = GL_TRUE;
- }
-
- if (t->dirty_state & (1<<unit)) {
- import_tex_obj_state( rmesa, unit, t );
- }
-
- if (rmesa->recheck_texgen[unit]) {
- GLboolean fallback = !radeon_validate_texgen( ctx, unit );
- TCL_FALLBACK( ctx, (RADEON_TCL_FALLBACK_TEXGEN_0<<unit), fallback);
- rmesa->recheck_texgen[unit] = 0;
- rmesa->NewGLState |= _NEW_TEXTURE_MATRIX;
- }
-
- format = tObj->Image[0][tObj->BaseLevel]->Format;
- if ( rmesa->state.texture.unit[unit].format != format ||
- rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode ) {
- rmesa->state.texture.unit[unit].format = format;
- rmesa->state.texture.unit[unit].envMode = texUnit->EnvMode;
- if ( ! radeonUpdateTextureEnv( ctx, unit ) ) {
- return GL_FALSE;
- }
- }
-
- FALLBACK( rmesa, RADEON_FALLBACK_BORDER_MODE, t->border_fallback );
- return !t->border_fallback;
-}
-
-
-
-static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_TEXRECT_0 << unit, 0 );
-
- if ( texUnit->_ReallyEnabled & (TEXTURE_RECT_BIT) ) {
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_TEXRECT_0 << unit, 1 );
-
- return (enable_tex_rect( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ) {
- return (enable_tex_2d( ctx, unit ) &&
- update_tex_common( ctx, unit ));
- }
- else if ( texUnit->_ReallyEnabled ) {
- return GL_FALSE;
- }
- else {
- disable_tex( ctx, unit );
- return GL_TRUE;
- }
-}
-
-void radeonUpdateTextureState( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean ok;
-
- ok = (radeonUpdateTextureUnit( ctx, 0 ) &&
- radeonUpdateTextureUnit( ctx, 1 ));
-
- FALLBACK( rmesa, RADEON_FALLBACK_TEXTURE, !ok );
-
- if (rmesa->TclFallback)
- radeonChooseVertexState( ctx );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c
deleted file mode 100644
index 5a4cad8ba..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c
+++ /dev/null
@@ -1,1093 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.c,v 1.6 2003/05/06 23:52:08 daenzer Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#include "glheader.h"
-#include "imports.h"
-#include "api_noop.h"
-#include "api_arrayelt.h"
-#include "context.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "glapi.h"
-#include "colormac.h"
-#include "light.h"
-#include "state.h"
-#include "vtxfmt.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_array_api.h"
-
-#include "radeon_context.h"
-#include "radeon_state.h"
-#include "radeon_ioctl.h"
-#include "radeon_tex.h"
-#include "radeon_tcl.h"
-#include "radeon_swtcl.h"
-#include "radeon_vtxfmt.h"
-
-#include "dispatch.h"
-
-static void radeonVtxfmtFlushVertices( GLcontext *, GLuint );
-
-static void count_func( const char *name, struct dynfn *l )
-{
- int i = 0;
- struct dynfn *f;
- foreach (f, l) i++;
- if (i) fprintf(stderr, "%s: %d\n", name, i );
-}
-
-static void count_funcs( radeonContextPtr rmesa )
-{
- count_func( "Vertex2f", &rmesa->vb.dfn_cache.Vertex2f );
- count_func( "Vertex2fv", &rmesa->vb.dfn_cache.Vertex2fv );
- count_func( "Vertex3f", &rmesa->vb.dfn_cache.Vertex3f );
- count_func( "Vertex3fv", &rmesa->vb.dfn_cache.Vertex3fv );
- count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub );
- count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv );
- count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub );
- count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv );
- count_func( "Color4f", &rmesa->vb.dfn_cache.Color4f );
- count_func( "Color4fv", &rmesa->vb.dfn_cache.Color4fv );
- count_func( "Color3f", &rmesa->vb.dfn_cache.Color3f );
- count_func( "Color3fv", &rmesa->vb.dfn_cache.Color3fv );
- count_func( "SecondaryColor3f", &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- count_func( "SecondaryColor3fv", &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- count_func( "SecondaryColor3ub", &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- count_func( "SecondaryColor3ubv", &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- count_func( "Normal3f", &rmesa->vb.dfn_cache.Normal3f );
- count_func( "Normal3fv", &rmesa->vb.dfn_cache.Normal3fv );
- count_func( "TexCoord2f", &rmesa->vb.dfn_cache.TexCoord2f );
- count_func( "TexCoord2fv", &rmesa->vb.dfn_cache.TexCoord2fv );
- count_func( "TexCoord1f", &rmesa->vb.dfn_cache.TexCoord1f );
- count_func( "TexCoord1fv", &rmesa->vb.dfn_cache.TexCoord1fv );
- count_func( "MultiTexCoord2fARB", &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- count_func( "MultiTexCoord2fvARB", &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- count_func( "MultiTexCoord1fARB", &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- count_func( "MultiTexCoord1fvARB", &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-}
-
-
-void radeon_copy_to_current( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- assert(ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT);
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_N0) {
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0] = rmesa->vb.normalptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1] = rmesa->vb.normalptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2] = rmesa->vb.normalptr[2];
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_PKCOLOR) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->blue );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT( rmesa->vb.colorptr->alpha );
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_FPCOLOR) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] = rmesa->vb.floatcolorptr[0];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] = rmesa->vb.floatcolorptr[1];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] = rmesa->vb.floatcolorptr[2];
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_FPALPHA)
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = rmesa->vb.floatcolorptr[3];
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_PKSPEC) {
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] = UBYTE_TO_FLOAT( rmesa->vb.specptr->red );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] = UBYTE_TO_FLOAT( rmesa->vb.specptr->green );
- ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] = UBYTE_TO_FLOAT( rmesa->vb.specptr->blue );
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_ST0) {
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][0] = rmesa->vb.texcoordptr[0][0];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][1] = rmesa->vb.texcoordptr[0][1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] = 0.0F;
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] = 1.0F;
- }
-
- if (rmesa->vb.vertex_format & RADEON_CP_VC_FRMT_ST1) {
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][0] = rmesa->vb.texcoordptr[1][0];
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][1] = rmesa->vb.texcoordptr[1][1];
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] = 0.0F;
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] = 1.0F;
- }
-
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
-}
-
-static GLboolean discreet_gl_prim[GL_POLYGON+1] = {
- 1, /* 0 points */
- 1, /* 1 lines */
- 0, /* 2 line_strip */
- 0, /* 3 line_loop */
- 1, /* 4 tris */
- 0, /* 5 tri_fan */
- 0, /* 6 tri_strip */
- 1, /* 7 quads */
- 0, /* 8 quadstrip */
- 0, /* 9 poly */
-};
-
-static void flush_prims( radeonContextPtr rmesa )
-{
- int i,j;
- struct radeon_dma_region tmp = rmesa->dma.current;
-
- tmp.buf->refcount++;
- tmp.aos_size = rmesa->vb.vertex_size;
- tmp.aos_stride = rmesa->vb.vertex_size;
- tmp.aos_start = GET_START(&tmp);
-
- rmesa->dma.current.ptr = rmesa->dma.current.start +=
- (rmesa->vb.initial_counter - rmesa->vb.counter) * rmesa->vb.vertex_size * 4;
-
- rmesa->tcl.vertex_format = rmesa->vb.vertex_format;
- rmesa->tcl.aos_components[0] = &tmp;
- rmesa->tcl.nr_aos_components = 1;
- rmesa->dma.flush = NULL;
-
- /* Optimize the primitive list:
- */
- if (rmesa->vb.nrprims > 1) {
- for (j = 0, i = 1 ; i < rmesa->vb.nrprims; i++) {
- int pj = rmesa->vb.primlist[j].prim & 0xf;
- int pi = rmesa->vb.primlist[i].prim & 0xf;
-
- if (pj == pi && discreet_gl_prim[pj] &&
- rmesa->vb.primlist[i].start == rmesa->vb.primlist[j].end) {
- rmesa->vb.primlist[j].end = rmesa->vb.primlist[i].end;
- }
- else {
- j++;
- if (j != i) rmesa->vb.primlist[j] = rmesa->vb.primlist[i];
- }
- }
- rmesa->vb.nrprims = j+1;
- }
-
- for (i = 0 ; i < rmesa->vb.nrprims; i++) {
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "vtxfmt prim %d: %s %d..%d\n", i,
- _mesa_lookup_enum_by_nr( rmesa->vb.primlist[i].prim &
- PRIM_MODE_MASK ),
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end);
-
- radeonEmitPrimitive( rmesa->glCtx,
- rmesa->vb.primlist[i].start,
- rmesa->vb.primlist[i].end,
- rmesa->vb.primlist[i].prim );
- }
-
- rmesa->vb.nrprims = 0;
- radeonReleaseDmaRegion( rmesa, &tmp, __FUNCTION__ );
-}
-
-
-static void start_prim( radeonContextPtr rmesa, GLuint mode )
-{
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__, rmesa->vb.initial_counter - rmesa->vb.counter);
-
- rmesa->vb.primlist[rmesa->vb.nrprims].start = rmesa->vb.initial_counter - rmesa->vb.counter;
- rmesa->vb.primlist[rmesa->vb.nrprims].prim = mode;
-}
-
-static void note_last_prim( radeonContextPtr rmesa, GLuint flags )
-{
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d\n", __FUNCTION__, rmesa->vb.initial_counter - rmesa->vb.counter);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- rmesa->vb.primlist[rmesa->vb.nrprims].prim |= flags;
- rmesa->vb.primlist[rmesa->vb.nrprims].end = rmesa->vb.initial_counter - rmesa->vb.counter;
-
- if (++(rmesa->vb.nrprims) == RADEON_MAX_PRIMS)
- flush_prims( rmesa );
- }
-}
-
-
-static void copy_vertex( radeonContextPtr rmesa, GLuint n, GLfloat *dst )
-{
- GLuint i;
- GLfloat *src = (GLfloat *)(rmesa->dma.current.address +
- rmesa->dma.current.ptr +
- (rmesa->vb.primlist[rmesa->vb.nrprims].start + n) *
- rmesa->vb.vertex_size * 4);
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "copy_vertex %d\n", rmesa->vb.primlist[rmesa->vb.nrprims].start + n);
-
- for (i = 0 ; i < rmesa->vb.vertex_size; i++) {
- dst[i] = src[i];
- }
-}
-
-/* NOTE: This actually reads the copied vertices back from uncached
- * memory. Could also use the counter/notify mechanism to populate
- * tmp on the fly as vertices are generated.
- */
-static GLuint copy_dma_verts( radeonContextPtr rmesa, GLfloat (*tmp)[15] )
-{
- GLuint ovf, i;
- GLuint nr = (rmesa->vb.initial_counter - rmesa->vb.counter) - rmesa->vb.primlist[rmesa->vb.nrprims].start;
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s %d verts\n", __FUNCTION__, nr);
-
- switch( rmesa->vb.prim[0] )
- {
- case GL_POINTS:
- return 0;
- case GL_LINES:
- ovf = nr&1;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_TRIANGLES:
- ovf = nr%3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUADS:
- ovf = nr&3;
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_LINE_STRIP:
- if (nr == 0)
- return 0;
- copy_vertex( rmesa, nr-1, tmp[0] );
- return 1;
- case GL_LINE_LOOP:
- case GL_TRIANGLE_FAN:
- case GL_POLYGON:
- if (nr == 0)
- return 0;
- else if (nr == 1) {
- copy_vertex( rmesa, 0, tmp[0] );
- return 1;
- } else {
- copy_vertex( rmesa, 0, tmp[0] );
- copy_vertex( rmesa, nr-1, tmp[1] );
- return 2;
- }
- case GL_TRIANGLE_STRIP:
- ovf = MIN2(nr, 2);
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- case GL_QUAD_STRIP:
- switch (nr) {
- case 0: ovf = 0; break;
- case 1: ovf = 1; break;
- default: ovf = 2 + (nr&1); break;
- }
- for (i = 0 ; i < ovf ; i++)
- copy_vertex( rmesa, nr-ovf+i, tmp[i] );
- return i;
- default:
- assert(0);
- return 0;
- }
-}
-
-static void VFMT_FALLBACK_OUTSIDE_BEGIN_END( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (ctx->Driver.NeedFlush)
- radeonVtxfmtFlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (ctx->NewState)
- _mesa_update_state( ctx ); /* clear state so fell_back sticks */
-
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = radeonFlushVertices;
-
- assert( rmesa->dma.flush == 0 );
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
-}
-
-
-static void VFMT_FALLBACK( const char *caller )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat tmp[3][15];
- GLuint i, prim;
- GLuint ind = rmesa->vb.vertex_format;
- GLuint nrverts;
- GLfloat alpha = 1.0;
-
- if (RADEON_DEBUG & (DEBUG_FALLBACKS|DEBUG_VFMT))
- fprintf(stderr, "%s from %s\n", __FUNCTION__, caller);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- VFMT_FALLBACK_OUTSIDE_BEGIN_END( __FUNCTION__ );
- return;
- }
-
- /* Copy vertices out of dma:
- */
- nrverts = copy_dma_verts( rmesa, tmp );
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- flush_prims( rmesa );
-
- /* Update ctx->Driver.CurrentExecPrimitive and swap in swtnl.
- */
- prim = rmesa->vb.prim[0];
- ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1;
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = radeonFlushVertices;
-
- assert(rmesa->dma.flush == 0);
- rmesa->vb.fell_back = GL_TRUE;
- rmesa->vb.installed = GL_FALSE;
- CALL_Begin(GET_DISPATCH(), (prim));
-
- if (rmesa->vb.installed_color_3f_sz == 4)
- alpha = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
-
- /* Replay saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- GLuint offset = 3;
- if (ind & RADEON_CP_VC_FRMT_N0) {
- CALL_Normal3fv(GET_DISPATCH(), (&tmp[i][offset]));
- offset += 3;
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKCOLOR) {
- radeon_color_t *col = (radeon_color_t *)&tmp[i][offset];
- CALL_Color4ub(GET_DISPATCH(), (col->red, col->green, col->blue, col->alpha));
- offset++;
- }
- else if (ind & RADEON_CP_VC_FRMT_FPALPHA) {
- CALL_Color4fv(GET_DISPATCH(), (&tmp[i][offset]));
- offset+=4;
- }
- else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
- CALL_Color3fv(GET_DISPATCH(), (&tmp[i][offset]));
- offset+=3;
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKSPEC) {
- radeon_color_t *spec = (radeon_color_t *)&tmp[i][offset];
- CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (spec->red, spec->green, spec->blue));
- offset++;
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST0) {
- CALL_TexCoord2fv(GET_DISPATCH(), (&tmp[i][offset]));
- offset += 2;
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST1) {
- CALL_MultiTexCoord2fvARB(GET_DISPATCH(), (GL_TEXTURE1_ARB, &tmp[i][offset]));
- offset += 2;
- }
- CALL_Vertex3fv(GET_DISPATCH(), (&tmp[i][0]));
- }
-
- /* Replay current vertex
- */
- if (ind & RADEON_CP_VC_FRMT_N0)
- CALL_Normal3fv(GET_DISPATCH(), (rmesa->vb.normalptr));
-
- if (ind & RADEON_CP_VC_FRMT_PKCOLOR)
- CALL_Color4ub(GET_DISPATCH(), (rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha));
- else if (ind & RADEON_CP_VC_FRMT_FPALPHA)
- CALL_Color4fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr));
- else if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
- if (rmesa->vb.installed_color_3f_sz == 4 && alpha != 1.0)
- CALL_Color4f(GET_DISPATCH(), (rmesa->vb.floatcolorptr[0],
- rmesa->vb.floatcolorptr[1],
- rmesa->vb.floatcolorptr[2],
- alpha));
- else
- CALL_Color3fv(GET_DISPATCH(), (rmesa->vb.floatcolorptr));
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKSPEC)
- CALL_SecondaryColor3ubEXT(GET_DISPATCH(), (rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue));
-
- if (ind & RADEON_CP_VC_FRMT_ST0)
- CALL_TexCoord2fv(GET_DISPATCH(), (rmesa->vb.texcoordptr[0]));
-
- if (ind & RADEON_CP_VC_FRMT_ST1)
- CALL_MultiTexCoord2fvARB(GET_DISPATCH(), (GL_TEXTURE1_ARB, rmesa->vb.texcoordptr[1]));
-}
-
-
-
-static void wrap_buffer( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat tmp[3][15];
- GLuint i, nrverts;
-
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_PRIMS))
- fprintf(stderr, "%s %d\n", __FUNCTION__, rmesa->vb.initial_counter - rmesa->vb.counter);
-
- /* Don't deal with parity.
- */
- if ((((rmesa->vb.initial_counter - rmesa->vb.counter) -
- rmesa->vb.primlist[rmesa->vb.nrprims].start) & 1)) {
- rmesa->vb.counter++;
- rmesa->vb.initial_counter++;
- return;
- }
-
- /* Copy vertices out of dma:
- */
- if (rmesa->vb.prim[0] == GL_POLYGON+1)
- nrverts = 0;
- else {
- nrverts = copy_dma_verts( rmesa, tmp );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%d vertices to copy\n", nrverts);
-
- /* Finish the prim at this point:
- */
- note_last_prim( rmesa, 0 );
- }
-
- /* Fire any buffered primitives
- */
- flush_prims( rmesa );
-
- /* Get new buffer
- */
- radeonRefillCurrentDmaRegion( rmesa );
-
- /* Reset counter, dmaptr
- */
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.ptr + rmesa->dma.current.address);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
-
- rmesa->dma.flush = flush_prims;
-
- /* Restart wrapped primitive:
- */
- if (rmesa->vb.prim[0] != GL_POLYGON+1)
- start_prim( rmesa, rmesa->vb.prim[0] );
-
- /* Reemit saved vertices
- */
- for (i = 0 ; i < nrverts; i++) {
- if (RADEON_DEBUG & DEBUG_VERTS) {
- int j;
- fprintf(stderr, "re-emit vertex %d to %p\n", i, (void *)rmesa->vb.dmaptr);
- if (RADEON_DEBUG & DEBUG_VERBOSE)
- for (j = 0 ; j < rmesa->vb.vertex_size; j++)
- fprintf(stderr, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]);
- }
-
- memcpy( rmesa->vb.dmaptr, tmp[i], rmesa->vb.vertex_size * 4 );
- rmesa->vb.dmaptr += rmesa->vb.vertex_size;
- rmesa->vb.counter--;
- }
-}
-
-
-
-static GLboolean check_vtx_fmt( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint ind = RADEON_CP_VC_FRMT_Z;
-
- if (rmesa->TclFallback || rmesa->vb.fell_back || ctx->CompileFlag)
- return GL_FALSE;
-
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)
- ctx->Driver.FlushVertices( ctx, FLUSH_UPDATE_CURRENT );
-
- /* Make all this event-driven:
- */
- if (ctx->Light.Enabled) {
- ind |= RADEON_CP_VC_FRMT_N0;
-
- /* TODO: make this data driven: If we receive only ubytes, send
- * color as ubytes. Also check if converting (with free
- * checking for overflow) is cheaper than sending floats
- * directly.
- */
- if (ctx->Light.ColorMaterialEnabled) {
- ind |= (RADEON_CP_VC_FRMT_FPCOLOR |
- RADEON_CP_VC_FRMT_FPALPHA);
- }
- else
- ind |= RADEON_CP_VC_FRMT_PKCOLOR; /* for alpha? */
- }
- else {
- /* TODO: make this data driven?
- */
- ind |= RADEON_CP_VC_FRMT_PKCOLOR;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- ind |= RADEON_CP_VC_FRMT_PKSPEC;
- }
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- if (ctx->Texture.Unit[0].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[0]) {
- ind |= RADEON_CP_VC_FRMT_N0;
- }
- } else {
- if (ctx->Current.Attrib[VERT_ATTRIB_TEX0][2] != 0.0F ||
- ctx->Current.Attrib[VERT_ATTRIB_TEX0][3] != 1.0) {
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s: rq0\n", __FUNCTION__);
- return GL_FALSE;
- }
- ind |= RADEON_CP_VC_FRMT_ST0;
- }
- }
-
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- if (ctx->Texture.Unit[1].TexGenEnabled) {
- if (rmesa->TexGenNeedNormals[1]) {
- ind |= RADEON_CP_VC_FRMT_N0;
- }
- } else {
- if (ctx->Current.Attrib[VERT_ATTRIB_TEX1][2] != 0.0F ||
- ctx->Current.Attrib[VERT_ATTRIB_TEX1][3] != 1.0) {
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_FALLBACKS))
- fprintf(stderr, "%s: rq1\n", __FUNCTION__);
- return GL_FALSE;
- }
- ind |= RADEON_CP_VC_FRMT_ST1;
- }
- }
-
- if (RADEON_DEBUG & (DEBUG_VFMT|DEBUG_STATE))
- fprintf(stderr, "%s: format: 0x%x\n", __FUNCTION__, ind );
-
- RADEON_NEWPRIM(rmesa);
- rmesa->vb.vertex_format = ind;
- rmesa->vb.vertex_size = 3;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
-
- rmesa->vb.normalptr = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
- rmesa->vb.colorptr = NULL;
- rmesa->vb.floatcolorptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- rmesa->vb.specptr = NULL;
- rmesa->vb.floatspecptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
- rmesa->vb.texcoordptr[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
- rmesa->vb.texcoordptr[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1];
-
- /* Run through and initialize the vertex components in the order
- * the hardware understands:
- */
- if (ind & RADEON_CP_VC_FRMT_N0) {
- rmesa->vb.normalptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.normalptr[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
- rmesa->vb.normalptr[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
- rmesa->vb.normalptr[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKCOLOR) {
- rmesa->vb.colorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.colorptr->alpha, ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] );
- }
-
- if (ind & RADEON_CP_VC_FRMT_FPCOLOR) {
- assert(!(ind & RADEON_CP_VC_FRMT_PKCOLOR));
- rmesa->vb.floatcolorptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 3;
- rmesa->vb.floatcolorptr[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
- rmesa->vb.floatcolorptr[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
- rmesa->vb.floatcolorptr[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
-
- if (ind & RADEON_CP_VC_FRMT_FPALPHA) {
- rmesa->vb.vertex_size += 1;
- rmesa->vb.floatcolorptr[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
- }
- }
-
- if (ind & RADEON_CP_VC_FRMT_PKSPEC) {
- rmesa->vb.specptr = &rmesa->vb.vertex[rmesa->vb.vertex_size].color;
- rmesa->vb.vertex_size += 1;
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->red, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->green, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1] );
- UNCLAMPED_FLOAT_TO_CHAN( rmesa->vb.specptr->blue, ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2] );
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST0) {
- rmesa->vb.texcoordptr[0] = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 2;
- rmesa->vb.texcoordptr[0][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][0];
- rmesa->vb.texcoordptr[0][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0][1];
- }
-
- if (ind & RADEON_CP_VC_FRMT_ST1) {
- rmesa->vb.texcoordptr[1] = &rmesa->vb.vertex[rmesa->vb.vertex_size].f;
- rmesa->vb.vertex_size += 2;
- rmesa->vb.texcoordptr[1][0] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][0];
- rmesa->vb.texcoordptr[1][1] = ctx->Current.Attrib[VERT_ATTRIB_TEX1][1];
- }
-
- if (rmesa->vb.installed_vertex_format != rmesa->vb.vertex_format) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on vertex_format change\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- rmesa->vb.installed_vertex_format = rmesa->vb.vertex_format;
- }
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- success\n", __FUNCTION__);
-
- return GL_TRUE;
-}
-
-void radeonVtxfmtInvalidate( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- rmesa->vb.recheck = GL_TRUE;
- rmesa->vb.fell_back = GL_FALSE;
-}
-
-
-static void radeonVtxfmtValidate( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- rmesa->vb.recheck = GL_FALSE;
-
- if (check_vtx_fmt( ctx )) {
- if (!rmesa->vb.installed) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall (new install)\n");
-
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.FlushVertices = radeonVtxfmtFlushVertices;
- rmesa->vb.installed = GL_TRUE;
- }
- else if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: already installed", __FUNCTION__);
- }
- else {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- if (rmesa->vb.installed) {
- if (rmesa->dma.flush)
- rmesa->dma.flush( rmesa );
- _tnl_wakeup_exec( ctx );
- ctx->Driver.FlushVertices = radeonFlushVertices;
- rmesa->vb.installed = GL_FALSE;
- }
- }
-}
-
-
-
-/* Materials:
- */
-static void radeon_Materialfv( GLenum face, GLenum pname,
- const GLfloat *params )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- VFMT_FALLBACK( __FUNCTION__ );
- CALL_Materialfv(GET_DISPATCH(), (face, pname, params));
- return;
- }
- _mesa_noop_Materialfv( face, pname, params );
- radeonUpdateMaterial( ctx );
-}
-
-
-/* Begin/End
- */
-static void radeon_Begin( GLenum mode )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s( %s )\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr( mode ));
-
- if (mode > GL_POLYGON) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" );
- return;
- }
-
- if (rmesa->vb.prim[0] != GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" );
- return;
- }
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- radeonValidateState( ctx );
-
- if (rmesa->vb.recheck)
- radeonVtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- CALL_Begin(GET_DISPATCH(), (mode));
- return;
- }
-
-
- if (rmesa->dma.flush && rmesa->vb.counter < 12) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s: flush almost-empty buffers\n", __FUNCTION__);
- flush_prims( rmesa );
- }
-
- /* Need to arrange to save vertices here? Or always copy from dma (yuk)?
- */
- if (!rmesa->dma.flush) {
- if (rmesa->dma.current.ptr + 12*rmesa->vb.vertex_size*4 >
- rmesa->dma.current.end) {
- RADEON_NEWPRIM( rmesa );
- radeonRefillCurrentDmaRegion( rmesa );
- }
-
- rmesa->vb.dmaptr = (int *)(rmesa->dma.current.address + rmesa->dma.current.ptr);
- rmesa->vb.counter = (rmesa->dma.current.end - rmesa->dma.current.ptr) /
- (rmesa->vb.vertex_size * 4);
- rmesa->vb.counter--;
- rmesa->vb.initial_counter = rmesa->vb.counter;
- rmesa->vb.notify = wrap_buffer;
- rmesa->dma.flush = flush_prims;
- ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
- }
-
-
- rmesa->vb.prim[0] = mode;
- start_prim( rmesa, mode | PRIM_BEGIN );
-}
-
-
-
-static void radeon_End( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (rmesa->vb.prim[0] == GL_POLYGON+1) {
- _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
- return;
- }
-
- note_last_prim( rmesa, PRIM_END );
- rmesa->vb.prim[0] = GL_POLYGON+1;
-}
-
-
-/* Fallback on difficult entrypoints:
- */
-#define PRE_LOOPBACK( FUNC ) \
-do { \
- if (RADEON_DEBUG & DEBUG_VFMT) \
- fprintf(stderr, "%s\n", __FUNCTION__); \
- VFMT_FALLBACK( __FUNCTION__ ); \
-} while (0)
-#define TAG(x) radeon_fallback_##x
-#include "vtxfmt_tmp.h"
-
-
-
-static GLboolean radeonNotifyBegin( GLcontext *ctx, GLenum p )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(!rmesa->vb.installed);
-
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
- if (rmesa->NewGLState)
- radeonValidateState( ctx );
-
- if (ctx->Driver.NeedFlush)
- ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush );
-
- if (rmesa->vb.recheck)
- radeonVtxfmtValidate( ctx );
-
- if (!rmesa->vb.installed) {
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s -- failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- radeon_Begin( p );
- return GL_TRUE;
-}
-
-static void radeonVtxfmtFlushVertices( GLcontext *ctx, GLuint flags )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(rmesa->vb.installed);
-
- if (flags & FLUSH_UPDATE_CURRENT) {
- radeon_copy_to_current( ctx );
- if (RADEON_DEBUG & DEBUG_VFMT)
- fprintf(stderr, "reinstall on update_current\n");
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt );
- ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
- }
-
- if (flags & FLUSH_STORED_VERTICES) {
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- assert (rmesa->dma.flush == 0 ||
- rmesa->dma.flush == flush_prims);
- if (rmesa->dma.flush == flush_prims)
- flush_prims( RADEON_CONTEXT( ctx ) );
- ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES;
- }
-}
-
-
-
-/* At this point, don't expect very many versions of each function to
- * be generated, so not concerned about freeing them?
- */
-
-
-void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
- GLvertexformat *vfmt = &(rmesa->vb.vtxfmt);
-
- MEMSET( vfmt, 0, sizeof(GLvertexformat) );
-
- /* Hook in chooser functions for codegen, etc:
- */
- radeonVtxfmtInitChoosers( vfmt );
-
- /* Handled fully in supported states, but no codegen:
- */
- vfmt->Materialfv = radeon_Materialfv;
- vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
- vfmt->Rectf = _mesa_noop_Rectf; /* generic helper */
- vfmt->Begin = radeon_Begin;
- vfmt->End = radeon_End;
-
- /* Fallback for performance reasons: (Fix with cva/elt path here and
- * dmatmp2.h style primitive-merging)
- *
- * These should call NotifyBegin(), as should _tnl_EvalMesh, to allow
- * a driver-hook.
- */
- vfmt->DrawArrays = radeon_fallback_DrawArrays;
- vfmt->DrawElements = radeon_fallback_DrawElements;
- vfmt->DrawRangeElements = radeon_fallback_DrawRangeElements;
-
-
- /* Not active in supported states; just keep ctx->Current uptodate:
- */
- vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
- vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
- vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
- vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexf = _mesa_noop_Indexf;
- vfmt->Indexfv = _mesa_noop_Indexfv;
-
-
- /* Active but unsupported -- fallback if we receive these:
- */
- vfmt->CallList = radeon_fallback_CallList;
- vfmt->CallLists = radeon_fallback_CallLists;
- vfmt->EvalCoord1f = radeon_fallback_EvalCoord1f;
- vfmt->EvalCoord1fv = radeon_fallback_EvalCoord1fv;
- vfmt->EvalCoord2f = radeon_fallback_EvalCoord2f;
- vfmt->EvalCoord2fv = radeon_fallback_EvalCoord2fv;
- vfmt->EvalMesh1 = radeon_fallback_EvalMesh1;
- vfmt->EvalMesh2 = radeon_fallback_EvalMesh2;
- vfmt->EvalPoint1 = radeon_fallback_EvalPoint1;
- vfmt->EvalPoint2 = radeon_fallback_EvalPoint2;
- vfmt->TexCoord3f = radeon_fallback_TexCoord3f;
- vfmt->TexCoord3fv = radeon_fallback_TexCoord3fv;
- vfmt->TexCoord4f = radeon_fallback_TexCoord4f;
- vfmt->TexCoord4fv = radeon_fallback_TexCoord4fv;
- vfmt->MultiTexCoord3fARB = radeon_fallback_MultiTexCoord3fARB;
- vfmt->MultiTexCoord3fvARB = radeon_fallback_MultiTexCoord3fvARB;
- vfmt->MultiTexCoord4fARB = radeon_fallback_MultiTexCoord4fARB;
- vfmt->MultiTexCoord4fvARB = radeon_fallback_MultiTexCoord4fvARB;
- vfmt->Vertex4f = radeon_fallback_Vertex4f;
- vfmt->Vertex4fv = radeon_fallback_Vertex4fv;
- vfmt->VertexAttrib1fNV = radeon_fallback_VertexAttrib1fNV;
- vfmt->VertexAttrib1fvNV = radeon_fallback_VertexAttrib1fvNV;
- vfmt->VertexAttrib2fNV = radeon_fallback_VertexAttrib2fNV;
- vfmt->VertexAttrib2fvNV = radeon_fallback_VertexAttrib2fvNV;
- vfmt->VertexAttrib3fNV = radeon_fallback_VertexAttrib3fNV;
- vfmt->VertexAttrib3fvNV = radeon_fallback_VertexAttrib3fvNV;
- vfmt->VertexAttrib4fNV = radeon_fallback_VertexAttrib4fNV;
- vfmt->VertexAttrib4fvNV = radeon_fallback_VertexAttrib4fvNV;
-
- (void)radeon_fallback_vtxfmt;
-
- TNL_CONTEXT(ctx)->Driver.NotifyBegin = radeonNotifyBegin;
-
- rmesa->vb.enabled = 1;
- rmesa->vb.prim = &ctx->Driver.CurrentExecPrimitive;
- rmesa->vb.primflags = 0;
-
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex2fv );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3f );
- make_empty_list( &rmesa->vb.dfn_cache.Vertex3fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color4ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ub );
- make_empty_list( &rmesa->vb.dfn_cache.Color3ubv );
- make_empty_list( &rmesa->vb.dfn_cache.Color4f );
- make_empty_list( &rmesa->vb.dfn_cache.Color4fv );
- make_empty_list( &rmesa->vb.dfn_cache.Color3f );
- make_empty_list( &rmesa->vb.dfn_cache.Color3fv );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- make_empty_list( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3f );
- make_empty_list( &rmesa->vb.dfn_cache.Normal3fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord2fv );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1f );
- make_empty_list( &rmesa->vb.dfn_cache.TexCoord1fv );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-
- radeonInitCodegen( &rmesa->vb.codegen, useCodegen );
-}
-
-static void free_funcs( struct dynfn *l )
-{
- struct dynfn *f, *tmp;
- foreach_s (f, tmp, l) {
- remove_from_list( f );
- _mesa_exec_free( f->code );
- _mesa_free( f );
- }
-}
-
-
-
-void radeonVtxfmtMakeCurrent( GLcontext *ctx )
-{
-}
-
-
-void radeonVtxfmtDestroy( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
-
- count_funcs( rmesa );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex2fv );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3f );
- free_funcs( &rmesa->vb.dfn_cache.Vertex3fv );
- free_funcs( &rmesa->vb.dfn_cache.Color4ub );
- free_funcs( &rmesa->vb.dfn_cache.Color4ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color3ub );
- free_funcs( &rmesa->vb.dfn_cache.Color3ubv );
- free_funcs( &rmesa->vb.dfn_cache.Color4f );
- free_funcs( &rmesa->vb.dfn_cache.Color4fv );
- free_funcs( &rmesa->vb.dfn_cache.Color3f );
- free_funcs( &rmesa->vb.dfn_cache.Color3fv );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3ubvEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fEXT );
- free_funcs( &rmesa->vb.dfn_cache.SecondaryColor3fvEXT );
- free_funcs( &rmesa->vb.dfn_cache.Normal3f );
- free_funcs( &rmesa->vb.dfn_cache.Normal3fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord2fv );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1f );
- free_funcs( &rmesa->vb.dfn_cache.TexCoord1fv );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fARB );
- free_funcs( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB );
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h
deleted file mode 100644
index a656e49e4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt.h,v 1.3 2002/12/21 17:02:16 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __RADEON_VTXFMT_H__
-#define __RADEON_VTXFMT_H__
-
-#include "radeon_context.h"
-
-
-extern void radeonVtxfmtUpdate( GLcontext *ctx );
-extern void radeonVtxfmtInit( GLcontext *ctx, GLboolean useCodegen );
-extern void radeonVtxfmtInvalidate( GLcontext *ctx );
-extern void radeonVtxfmtDestroy( GLcontext *ctx );
-extern void radeonVtxfmtInitChoosers( GLvertexformat *vfmt );
-
-extern void radeonVtxfmtMakeCurrent( GLcontext *ctx );
-extern void radeonVtxfmtUnbindContext( GLcontext *ctx );
-
-extern void radeon_copy_to_current( GLcontext *ctx );
-
-#define DFN( FUNC, CACHE) \
-do { \
- char *start = (char *)&FUNC; \
- char *end = (char *)&FUNC##_end; \
- insert_at_head( &CACHE, dfn ); \
- dfn->key = key; \
- dfn->code = _mesa_exec_malloc( end - start ); \
- _mesa_memcpy(dfn->code, start, end - start); \
-} \
-while ( 0 )
-
-#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- int *icode = (int *)(CODE+OFFSET); \
- assert (*icode == CHECKVAL); \
- *icode = (int)NEWVAL; \
-} while (0)
-
-
-/* Useful for figuring out the offsets:
- */
-#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \
-do { \
- while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \
- fprintf(stderr, "%s/%d CVAL %x OFFSET %d VAL %x\n", __FUNCTION__, \
- __LINE__, CHECKVAL, OFFSET, (int)(NEWVAL)); \
- *(int *)(CODE+OFFSET) = (int)(NEWVAL); \
- OFFSET += 4; \
-} while (0)
-
-/*
- */
-void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen );
-void radeonInitX86Codegen( struct dfn_generators *gen );
-void radeonInitSSECodegen( struct dfn_generators *gen );
-
-
-
-/* Defined in radeon_vtxfmt_x86.c
- */
-struct dynfn *radeon_makeX86Vertex2f( GLcontext *, int );
-struct dynfn *radeon_makeX86Vertex2fv( GLcontext *, int );
-struct dynfn *radeon_makeX86Vertex3f( GLcontext *, int );
-struct dynfn *radeon_makeX86Vertex3fv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4ub( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4ubv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3ub( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3ubv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4f( GLcontext *, int );
-struct dynfn *radeon_makeX86Color4fv( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3f( GLcontext *, int );
-struct dynfn *radeon_makeX86Color3fv( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3ubEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3ubvEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3fEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86SecondaryColor3fvEXT( GLcontext *, int );
-struct dynfn *radeon_makeX86Normal3f( GLcontext *, int );
-struct dynfn *radeon_makeX86Normal3fv( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord2f( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord1f( GLcontext *, int );
-struct dynfn *radeon_makeX86TexCoord1fv( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord1fARB( GLcontext *, int );
-struct dynfn *radeon_makeX86MultiTexCoord1fvARB( GLcontext *, int );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c
deleted file mode 100644
index 342b0b39c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c
+++ /dev/null
@@ -1,922 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_c.c,v 1.2 2002/12/16 16:18:59 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2002 ATI Technologies Inc., Ontario, Canada, and
- 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "simple_list.h"
-#include "api_noop.h"
-#include "vtxfmt.h"
-
-#include "radeon_vtxfmt.h"
-
-#include "dispatch.h"
-
-/* Fallback versions of all the entrypoints for situations where
- * codegen isn't available. This is still a lot faster than the
- * vb/pipeline implementation in Mesa.
- */
-static void radeon_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = *(int *)&z;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void radeon_Vertex3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = *(int *)&v[2];
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void radeon_Vertex2f( GLfloat x, GLfloat y )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&x;
- *rmesa->vb.dmaptr++ = *(int *)&y;
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = *(int *)&rmesa->vb.vertex[i];
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-static void radeon_Vertex2fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- *rmesa->vb.dmaptr++ = *(int *)&v[0];
- *rmesa->vb.dmaptr++ = *(int *)&v[1];
- *rmesa->vb.dmaptr++ = 0;
-
- for (i = 3; i < rmesa->vb.vertex_size; i++)
- *rmesa->vb.dmaptr++ = rmesa->vb.vertex[i].i;
-
- if (--rmesa->vb.counter == 0)
- rmesa->vb.notify();
-}
-
-
-#if 0
-/* Color for ubyte (packed) color formats:
- */
-static void radeon_Color3ub_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void radeon_Color3ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-
-static void radeon_Color4ub_ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = a;
-}
-
-static void radeon_Color4ubv_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- *(GLuint *)rmesa->vb.colorptr = LE32_TO_CPU(*(GLuint *)v);
-}
-#endif /* 0 */
-
-static void radeon_Color3f_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void radeon_Color3fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-static void radeon_Color4f_ub( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, a );
-}
-
-static void radeon_Color4fv_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.colorptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->alpha, v[3] );
-}
-
-
-/* Color for float color+alpha formats:
- */
-#if 0
-static void radeon_Color3ub_4f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void radeon_Color3ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-
-static void radeon_Color4ub_4f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = UBYTE_TO_FLOAT(a);
-}
-
-static void radeon_Color4ubv_4f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = UBYTE_TO_FLOAT(v[3]);
-}
-#endif /* 0 */
-
-
-static void radeon_Color3f_4f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void radeon_Color3fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-static void radeon_Color4f_4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = a;
-}
-
-static void radeon_Color4fv_4f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = v[3];
-}
-
-
-/* Color for float color formats:
- */
-#if 0
-static void radeon_Color3ub_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
-}
-
-static void radeon_Color3ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
-}
-
-static void radeon_Color4ub_3f( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(a);
-}
-
-static void radeon_Color4ubv_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = UBYTE_TO_FLOAT(v[3]);
-}
-#endif /* 0 */
-
-
-static void radeon_Color3f_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
-}
-
-static void radeon_Color3fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-static void radeon_Color4f_3f( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = a;
-}
-
-static void radeon_Color4fv_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatcolorptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = v[3];
-}
-
-
-/* Secondary Color:
- */
-#if 0
-static void radeon_SecondaryColor3ubEXT_ub( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- dest->red = r;
- dest->green = g;
- dest->blue = b;
- dest->alpha = 0xff;
-}
-
-static void radeon_SecondaryColor3ubvEXT_ub( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- dest->red = v[0];
- dest->green = v[1];
- dest->blue = v[2];
- dest->alpha = 0xff;
-}
-#endif /* 0 */
-
-static void radeon_SecondaryColor3fEXT_ub( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, r );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, g );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, b );
- dest->alpha = 255;
-}
-
-static void radeon_SecondaryColor3fvEXT_ub( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- radeon_color_t *dest = rmesa->vb.specptr;
- UNCLAMPED_FLOAT_TO_UBYTE( dest->red, v[0] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->green, v[1] );
- UNCLAMPED_FLOAT_TO_UBYTE( dest->blue, v[2] );
- dest->alpha = 255;
-}
-
-#if 0
-static void radeon_SecondaryColor3ubEXT_3f( GLubyte r, GLubyte g, GLubyte b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(r);
- dest[1] = UBYTE_TO_FLOAT(g);
- dest[2] = UBYTE_TO_FLOAT(b);
- dest[3] = 1.0;
-}
-
-static void radeon_SecondaryColor3ubvEXT_3f( const GLubyte *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = UBYTE_TO_FLOAT(v[0]);
- dest[1] = UBYTE_TO_FLOAT(v[1]);
- dest[2] = UBYTE_TO_FLOAT(v[2]);
- dest[3] = 1.0;
-}
-#endif /* 0 */
-
-static void radeon_SecondaryColor3fEXT_3f( GLfloat r, GLfloat g, GLfloat b )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = r;
- dest[1] = g;
- dest[2] = b;
- dest[3] = 1.0;
-}
-
-static void radeon_SecondaryColor3fvEXT_3f( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.floatspecptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
- dest[3] = 1.0;
-}
-
-
-/* Normal
- */
-static void radeon_Normal3f( GLfloat n0, GLfloat n1, GLfloat n2 )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = n0;
- dest[1] = n1;
- dest[2] = n2;
-}
-
-static void radeon_Normal3fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.normalptr;
- dest[0] = v[0];
- dest[1] = v[1];
- dest[2] = v[2];
-}
-
-
-/* TexCoord
- */
-static void radeon_TexCoord1f( GLfloat s )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = s;
- dest[1] = 0;
-}
-
-static void radeon_TexCoord1fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = v[0];
- dest[1] = 0;
-}
-
-static void radeon_TexCoord2f( GLfloat s, GLfloat t )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = s;
- dest[1] = t;
-}
-
-static void radeon_TexCoord2fv( const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[0];
- dest[0] = v[0];
- dest[1] = v[1];
-}
-
-
-/* MultiTexcoord
- *
- * Technically speaking, these functions should subtract GL_TEXTURE0 from
- * \c target before masking and using it. The value of GL_TEXTURE0 is 0x84C0,
- * which has the low-order 5 bits 0. For all possible valid values of
- * \c target. Subtracting GL_TEXTURE0 has the net effect of masking \c target
- * with 0x1F. Masking with 0x1F and then masking with 0x01 is redundant, so
- * the subtraction has been omitted.
- */
-
-static void radeon_MultiTexCoord1fARB( GLenum target, GLfloat s )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = s;
- dest[1] = 0;
-}
-
-static void radeon_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = v[0];
- dest[1] = 0;
-}
-
-static void radeon_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = s;
- dest[1] = t;
-}
-
-static void radeon_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *dest = rmesa->vb.texcoordptr[target & 1];
- dest[0] = v[0];
- dest[1] = v[1];
-}
-
-static struct dynfn *lookup( struct dynfn *l, int key )
-{
- struct dynfn *f;
-
- foreach( f, l ) {
- if (f->key == key)
- return f;
- }
-
- return NULL;
-}
-
-/* Can't use the loopback template for this:
- */
-
-#define CHOOSE(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
- struct dynfn *dfn; \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \
- \
- if (dfn) \
- SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \
- else { \
- if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- SET_ ## FN (ctx->Exec, radeon_##FN); \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- CALL_ ## FN (ctx->Exec, ARGS2); \
-}
-
-
-
-/* For the _3f case, only allow one color function to be hooked in at
- * a time. Eventually, use a similar mechanism to allow selecting the
- * color component of the vertex format based on client behaviour.
- *
- * Note: Perform these actions even if there is a codegen or cached
- * codegen version of the chosen function.
- */
-#define CHOOSE_COLOR(FN, FNTYPE, NR, MASK, ACTIVE, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
- struct dynfn *dfn; \
- \
- if (rmesa->vb.vertex_format & ACTIVE_PKCOLOR) { \
- SET_ ## FN (ctx->Exec, radeon_##FN##_ub); \
- } \
- else if ((rmesa->vb.vertex_format & \
- (ACTIVE_FPCOLOR|ACTIVE_FPALPHA)) == ACTIVE_FPCOLOR) { \
- \
- if (rmesa->vb.installed_color_3f_sz != NR) { \
- rmesa->vb.installed_color_3f_sz = NR; \
- if (NR == 3) ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3] = 1.0; \
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) { \
- radeon_copy_to_current( ctx ); \
- _mesa_install_exec_vtxfmt( ctx, &rmesa->vb.vtxfmt ); \
- CALL_ ## FN (ctx->Exec, ARGS2); \
- return; \
- } \
- } \
- \
- SET_ ## FN (ctx->Exec, radeon_##FN##_3f); \
- } \
- else { \
- SET_ ## FN (ctx->Exec, radeon_##FN##_4f); \
- } \
- \
- \
- dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- if (!dfn) dfn = rmesa->vb.codegen.FN( ctx, key ); \
- \
- if (dfn) { \
- if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- codegen version\n", __FUNCTION__ ); \
- SET_ ## FN (ctx->Exec, (FNTYPE)dfn->code); \
- } \
- else if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- 'c' version\n", __FUNCTION__ ); \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- CALL_ ## FN (ctx->Exec, ARGS2); \
-}
-
-
-
-/* Right now there are both _ub and _3f versions of the secondary color
- * functions. Currently, we only set-up the hardware to use the _ub versions.
- * The _3f versions are needed for the cases where secondary color isn't used
- * in the vertex format, but it still needs to be stored in the context
- * state vector.
- */
-#define CHOOSE_SECONDARY_COLOR(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \
-static void choose_##FN ARGS1 \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
- int key = rmesa->vb.vertex_format & (MASK|ACTIVE); \
- struct dynfn *dfn = lookup( &rmesa->vb.dfn_cache.FN, key ); \
- \
- if (dfn == 0) \
- dfn = rmesa->vb.codegen.FN( ctx, key ); \
- else if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- cached version\n", __FUNCTION__ ); \
- \
- if (dfn) \
- SET_ ## FN (ctx->Exec, (FNTYPE)(dfn->code)); \
- else { \
- if (RADEON_DEBUG & DEBUG_CODEGEN) \
- fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \
- SET_ ## FN (ctx->Exec, ((rmesa->vb.vertex_format & ACTIVE_PKSPEC) != 0) \
- ? radeon_##FN##_ub : radeon_##FN##_3f); \
- } \
- \
- ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
- CALL_ ## FN (ctx->Exec, ARGS2); \
-}
-
-
-
-
-
-/* Shorthands
- */
-#define ACTIVE_XYZW (RADEON_CP_VC_FRMT_W0|RADEON_CP_VC_FRMT_Z)
-#define ACTIVE_NORM RADEON_CP_VC_FRMT_N0
-
-#define ACTIVE_PKCOLOR RADEON_CP_VC_FRMT_PKCOLOR
-#define ACTIVE_FPCOLOR RADEON_CP_VC_FRMT_FPCOLOR
-#define ACTIVE_FPALPHA RADEON_CP_VC_FRMT_FPALPHA
-#define ACTIVE_COLOR (ACTIVE_FPCOLOR|ACTIVE_PKCOLOR)
-
-#define ACTIVE_PKSPEC RADEON_CP_VC_FRMT_PKSPEC
-#define ACTIVE_FPSPEC RADEON_CP_VC_FRMT_FPSPEC
-#define ACTIVE_SPEC (ACTIVE_FPSPEC|ACTIVE_PKSPEC)
-
-#define ACTIVE_ST0 RADEON_CP_VC_FRMT_ST0
-#define ACTIVE_ST1 RADEON_CP_VC_FRMT_ST1
-#define ACTIVE_ST_ALL (RADEON_CP_VC_FRMT_ST1|RADEON_CP_VC_FRMT_ST0)
-
-/* Each codegen function should be able to be fully specified by a
- * subsetted version of rmesa->vb.vertex_format.
- */
-#define MASK_NORM (ACTIVE_XYZW)
-#define MASK_COLOR (MASK_NORM|ACTIVE_NORM)
-#define MASK_SPEC (MASK_COLOR|ACTIVE_COLOR)
-#define MASK_ST0 (MASK_SPEC|ACTIVE_SPEC)
-#define MASK_ST1 (MASK_ST0|ACTIVE_ST0)
-#define MASK_ST_ALL (MASK_ST1|ACTIVE_ST1)
-#define MASK_VERTEX (MASK_ST_ALL|ACTIVE_FPALPHA)
-
-
-typedef void (*p4f)( GLfloat, GLfloat, GLfloat, GLfloat );
-typedef void (*p3f)( GLfloat, GLfloat, GLfloat );
-typedef void (*p2f)( GLfloat, GLfloat );
-typedef void (*p1f)( GLfloat );
-typedef void (*pe2f)( GLenum, GLfloat, GLfloat );
-typedef void (*pe1f)( GLenum, GLfloat );
-typedef void (*p4ub)( GLubyte, GLubyte, GLubyte, GLubyte );
-typedef void (*p3ub)( GLubyte, GLubyte, GLubyte );
-typedef void (*pfv)( const GLfloat * );
-typedef void (*pefv)( GLenum, const GLfloat * );
-typedef void (*pubv)( const GLubyte * );
-
-
-CHOOSE(Normal3f, p3f, MASK_NORM, ACTIVE_NORM,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Normal3fv, pfv, MASK_NORM, ACTIVE_NORM,
- (const GLfloat *v), (v))
-
-#if 0
-CHOOSE_COLOR(Color4ub, p4ub, 4, MASK_COLOR, ACTIVE_COLOR,
- (GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d))
-CHOOSE_COLOR(Color4ubv, pubv, 4, MASK_COLOR, ACTIVE_COLOR,
- (const GLubyte *v), (v))
-CHOOSE_COLOR(Color3ub, p3ub, 3, MASK_COLOR, ACTIVE_COLOR,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_COLOR(Color3ubv, pubv, 3, MASK_COLOR, ACTIVE_COLOR,
- (const GLubyte *v), (v))
-#endif
-
-CHOOSE_COLOR(Color4f, p4f, 4, MASK_COLOR, ACTIVE_COLOR,
- (GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d))
-CHOOSE_COLOR(Color4fv, pfv, 4, MASK_COLOR, ACTIVE_COLOR,
- (const GLfloat *v), (v))
-CHOOSE_COLOR(Color3f, p3f, 3, MASK_COLOR, ACTIVE_COLOR,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_COLOR(Color3fv, pfv, 3, MASK_COLOR, ACTIVE_COLOR,
- (const GLfloat *v), (v))
-
-
-#if 0
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubEXT, p3ub, MASK_SPEC, ACTIVE_SPEC,
- (GLubyte a,GLubyte b, GLubyte c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3ubvEXT, pubv, MASK_SPEC, ACTIVE_SPEC,
- (const GLubyte *v), (v))
-#endif
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fEXT, p3f, MASK_SPEC, ACTIVE_SPEC,
- (GLfloat a,GLfloat b, GLfloat c), (a,b,c))
-CHOOSE_SECONDARY_COLOR(SecondaryColor3fvEXT, pfv, MASK_SPEC, ACTIVE_SPEC,
- (const GLfloat *v), (v))
-
-CHOOSE(TexCoord2f, p2f, MASK_ST0, ACTIVE_ST0,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(TexCoord2fv, pfv, MASK_ST0, ACTIVE_ST0,
- (const GLfloat *v), (v))
-CHOOSE(TexCoord1f, p1f, MASK_ST0, ACTIVE_ST0,
- (GLfloat a), (a))
-CHOOSE(TexCoord1fv, pfv, MASK_ST0, ACTIVE_ST0,
- (const GLfloat *v), (v))
-
-CHOOSE(MultiTexCoord2fARB, pe2f, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,GLfloat a,GLfloat b), (u,a,b))
-CHOOSE(MultiTexCoord2fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,const GLfloat *v), (u,v))
-CHOOSE(MultiTexCoord1fARB, pe1f, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,GLfloat a), (u,a))
-CHOOSE(MultiTexCoord1fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL,
- (GLenum u,const GLfloat *v), (u,v))
-
-CHOOSE(Vertex3f, p3f, MASK_VERTEX, MASK_VERTEX,
- (GLfloat a,GLfloat b,GLfloat c), (a,b,c))
-CHOOSE(Vertex3fv, pfv, MASK_VERTEX, MASK_VERTEX,
- (const GLfloat *v), (v))
-CHOOSE(Vertex2f, p2f, MASK_VERTEX, MASK_VERTEX,
- (GLfloat a,GLfloat b), (a,b))
-CHOOSE(Vertex2fv, pfv, MASK_VERTEX, MASK_VERTEX,
- (const GLfloat *v), (v))
-
-
-
-
-
-void radeonVtxfmtInitChoosers( GLvertexformat *vfmt )
-{
- vfmt->Color3f = choose_Color3f;
- vfmt->Color3fv = choose_Color3fv;
- vfmt->Color4f = choose_Color4f;
- vfmt->Color4fv = choose_Color4fv;
- vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
- vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
- vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB;
- vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB;
- vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB;
- vfmt->MultiTexCoord2fvARB = choose_MultiTexCoord2fvARB;
- vfmt->Normal3f = choose_Normal3f;
- vfmt->Normal3fv = choose_Normal3fv;
- vfmt->TexCoord1f = choose_TexCoord1f;
- vfmt->TexCoord1fv = choose_TexCoord1fv;
- vfmt->TexCoord2f = choose_TexCoord2f;
- vfmt->TexCoord2fv = choose_TexCoord2fv;
- vfmt->Vertex2f = choose_Vertex2f;
- vfmt->Vertex2fv = choose_Vertex2fv;
- vfmt->Vertex3f = choose_Vertex3f;
- vfmt->Vertex3fv = choose_Vertex3fv;
-
-#if 0
- vfmt->Color3ub = choose_Color3ub;
- vfmt->Color3ubv = choose_Color3ubv;
- vfmt->Color4ub = choose_Color4ub;
- vfmt->Color4ubv = choose_Color4ubv;
- vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
-#endif
-}
-
-
-static struct dynfn *codegen_noop( GLcontext *ctx, int key )
-{
- (void) ctx; (void) key;
- return NULL;
-}
-
-void radeonInitCodegen( struct dfn_generators *gen, GLboolean useCodegen )
-{
- gen->Vertex3f = codegen_noop;
- gen->Vertex3fv = codegen_noop;
- gen->Color4ub = codegen_noop;
- gen->Color4ubv = codegen_noop;
- gen->Normal3f = codegen_noop;
- gen->Normal3fv = codegen_noop;
- gen->TexCoord2f = codegen_noop;
- gen->TexCoord2fv = codegen_noop;
- gen->MultiTexCoord2fARB = codegen_noop;
- gen->MultiTexCoord2fvARB = codegen_noop;
- gen->Vertex2f = codegen_noop;
- gen->Vertex2fv = codegen_noop;
- gen->Color3ub = codegen_noop;
- gen->Color3ubv = codegen_noop;
- gen->Color4f = codegen_noop;
- gen->Color4fv = codegen_noop;
- gen->Color3f = codegen_noop;
- gen->Color3fv = codegen_noop;
- gen->SecondaryColor3fEXT = codegen_noop;
- gen->SecondaryColor3fvEXT = codegen_noop;
- gen->SecondaryColor3ubEXT = codegen_noop;
- gen->SecondaryColor3ubvEXT = codegen_noop;
- gen->TexCoord1f = codegen_noop;
- gen->TexCoord1fv = codegen_noop;
- gen->MultiTexCoord1fARB = codegen_noop;
- gen->MultiTexCoord1fvARB = codegen_noop;
-
- if (useCodegen) {
-#if defined(USE_X86_ASM)
- radeonInitX86Codegen( gen );
-#endif
-
-#if defined(USE_SSE_ASM)
- radeonInitSSECodegen( gen );
-#endif
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c
deleted file mode 100644
index cb5d84011..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_sse.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:58 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "radeon_vtxfmt.h"
-
-#if defined(USE_SSE_ASM)
-#include "x86/common_x86_asm.h"
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN( _sse_Attribute2fv );
-EXTERN( _sse_Attribute2f );
-EXTERN( _sse_Attribute3fv );
-EXTERN( _sse_Attribute3f );
-EXTERN( _sse_MultiTexCoord2fv );
-EXTERN( _sse_MultiTexCoord2f );
-EXTERN( _sse_MultiTexCoord2fv_2 );
-EXTERN( _sse_MultiTexCoord2f_2 );
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state.
- */
-
-static struct dynfn *radeon_makeSSEAttribute2fv( struct dynfn * cache, int key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 10, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEAttribute2f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute2f, (*cache) );
- FIXUP(dfn->code, 8, 0x0, (int)dest);
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEAttribute3fv( struct dynfn * cache, int key,
- const char * name, void * dest)
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 13, 0x0, (int)dest);
- FIXUP(dfn->code, 18, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEAttribute3f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _sse_Attribute3f, (*cache) );
- FIXUP(dfn->code, 12, 0x0, (int)dest);
- FIXUP(dfn->code, 17, 0x8, 8+(int)dest);
- return dfn;
-}
-
-static struct dynfn * radeon_makeSSENormal3fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *radeon_makeSSENormal3f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-static struct dynfn *radeon_makeSSEColor3fv( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return NULL;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-static struct dynfn *radeon_makeSSEColor3f( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return NULL;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-static struct dynfn *radeon_makeSSETexCoord2fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *radeon_makeSSETexCoord2f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeSSEAttribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-static struct dynfn *radeon_makeSSEMultiTexCoord2fv( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _sse_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 18, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-static struct dynfn *radeon_makeSSEMultiTexCoord2f( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _sse_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 16, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- } else {
- DFN ( _sse_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 15, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-void radeonInitSSECodegen( struct dfn_generators *gen )
-{
- if ( cpu_has_xmm ) {
- gen->Normal3fv = (void *) radeon_makeSSENormal3fv;
- gen->Normal3f = (void *) radeon_makeSSENormal3f;
- gen->Color3fv = (void *) radeon_makeSSEColor3fv;
- gen->Color3f = (void *) radeon_makeSSEColor3f;
- gen->TexCoord2fv = (void *) radeon_makeSSETexCoord2fv;
- gen->TexCoord2f = (void *) radeon_makeSSETexCoord2f;
- gen->MultiTexCoord2fvARB = (void *) radeon_makeSSEMultiTexCoord2fv;
- gen->MultiTexCoord2fARB = (void *) radeon_makeSSEMultiTexCoord2f;
- }
-}
-
-#else
-
-void radeonInitSSECodegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c
deleted file mode 100644
index d1cf1979f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxfmt_x86.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxfmt_x86.c,v 1.2 2002/12/21 17:02:16 dawes Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
- 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 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "radeon_vtxfmt.h"
-
-#if defined(USE_X86_ASM)
-
-#define EXTERN( FUNC ) \
-extern const char *FUNC; \
-extern const char *FUNC##_end
-
-EXTERN ( _x86_Attribute2fv );
-EXTERN ( _x86_Attribute2f );
-EXTERN ( _x86_Attribute3fv );
-EXTERN ( _x86_Attribute3f );
-EXTERN ( _x86_Vertex3fv_6 );
-EXTERN ( _x86_Vertex3fv_8 );
-EXTERN ( _x86_Vertex3fv );
-EXTERN ( _x86_Vertex3f_4 );
-EXTERN ( _x86_Vertex3f_6 );
-EXTERN ( _x86_Vertex3f );
-EXTERN ( _x86_Color4ubv_ub );
-EXTERN ( _x86_Color4ubv_4f );
-EXTERN ( _x86_Color4ub_ub );
-EXTERN ( _x86_MultiTexCoord2fv );
-EXTERN ( _x86_MultiTexCoord2fv_2 );
-EXTERN ( _x86_MultiTexCoord2f );
-EXTERN ( _x86_MultiTexCoord2f_2 );
-
-
-/* Build specialized versions of the immediate calls on the fly for
- * the current state. Generic x86 versions.
- */
-
-struct dynfn *radeon_makeX86Vertex3f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 4: {
-
- DFN ( _x86_Vertex3f_4, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 2, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 25, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 36, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 46, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 51, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 60, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- case 6: {
-
- DFN ( _x86_Vertex3f_6, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 28, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 34, 0x0, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 40, 0x0, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 57, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 63, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 70, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 79, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- default: {
-
- DFN ( _x86_Vertex3f, rmesa->vb.dfn_cache.Vertex3f );
- FIXUP(dfn->code, 3, 0x0, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 9, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 37, 0x0, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 44, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 50, 0x0, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 56, 0x0, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-
-
-struct dynfn *radeon_makeX86Vertex3fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x %d\n", __FUNCTION__, key, rmesa->vb.vertex_size );
-
- switch (rmesa->vb.vertex_size) {
- case 6: {
-
- DFN ( _x86_Vertex3fv_6, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x00000024, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 56, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 61, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 76, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
- case 8: {
-
- DFN ( _x86_Vertex3fv_8, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 1, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 27, 0x0000001c, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 33, 0x00000020, (int)&rmesa->vb.vertex[4]);
- FIXUP(dfn->code, 45, 0x0000001c, (int)&rmesa->vb.vertex[5]);
- FIXUP(dfn->code, 51, 0x00000020, (int)&rmesa->vb.vertex[6]);
- FIXUP(dfn->code, 63, 0x00000024, (int)&rmesa->vb.vertex[7]);
- FIXUP(dfn->code, 74, 0x00000000, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 79, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 85, 0x00000004, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 94, 0x00000008, (int)&rmesa->vb.notify);
- break;
- }
-
-
-
- default: {
-
- DFN ( _x86_Vertex3fv, rmesa->vb.dfn_cache.Vertex3fv );
- FIXUP(dfn->code, 8, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 32, 0x00000006, rmesa->vb.vertex_size-3);
- FIXUP(dfn->code, 37, 0x00000058, (int)&rmesa->vb.vertex[3]);
- FIXUP(dfn->code, 45, 0x01010101, (int)&rmesa->vb.dmaptr);
- FIXUP(dfn->code, 50, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 58, 0x02020202, (int)&rmesa->vb.counter);
- FIXUP(dfn->code, 67, 0x0, (int)&rmesa->vb.notify);
- break;
- }
- }
-
- return dfn;
-}
-
-static struct dynfn *
-radeon_makeX86Attribute2fv( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute2fv, (*cache) );
- FIXUP(dfn->code, 11, 0x0, (int)dest);
- FIXUP(dfn->code, 16, 0x4, 4+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-radeon_makeX86Attribute2f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute2f, (*cache) );
- FIXUP(dfn->code, 1, 0x0, (int)dest);
-
- return dfn;
-}
-
-
-static struct dynfn *
-radeon_makeX86Attribute3fv( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute3fv, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-static struct dynfn *
-radeon_makeX86Attribute3f( struct dynfn * cache, int key,
- const char * name, void * dest )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", name, key );
-
- DFN ( _x86_Attribute3f, (*cache) );
- FIXUP(dfn->code, 14, 0x0, (int)dest);
- FIXUP(dfn->code, 20, 0x4, 4+(int)dest);
- FIXUP(dfn->code, 25, 0x8, 8+(int)dest);
-
- return dfn;
-}
-
-struct dynfn *radeon_makeX86Normal3fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Normal3fv, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *radeon_makeX86Normal3f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Normal3f, key,
- __FUNCTION__, rmesa->vb.normalptr );
-}
-
-struct dynfn *radeon_makeX86Color4ubv( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
- DFN ( _x86_Color4ubv_ub, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 5, 0x12345678, (int)rmesa->vb.colorptr);
- return dfn;
- }
- else {
-
- DFN ( _x86_Color4ubv_4f, rmesa->vb.dfn_cache.Color4ubv);
- FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab);
- FIXUP(dfn->code, 27, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr);
- FIXUP(dfn->code, 33, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+4);
- FIXUP(dfn->code, 55, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+8);
- FIXUP(dfn->code, 61, 0xdeadbeaf, (int)rmesa->vb.floatcolorptr+12);
- return dfn;
- }
-}
-
-struct dynfn *radeon_makeX86Color4ub( GLcontext *ctx, int key )
-{
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if (key & RADEON_CP_VC_FRMT_PKCOLOR) {
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- DFN ( _x86_Color4ub_ub, rmesa->vb.dfn_cache.Color4ub );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.colorptr);
- FIXUP(dfn->code, 24, 0x0, (int)rmesa->vb.colorptr+1);
- FIXUP(dfn->code, 30, 0x0, (int)rmesa->vb.colorptr+2);
- FIXUP(dfn->code, 36, 0x0, (int)rmesa->vb.colorptr+3);
- return dfn;
- }
- else
- return NULL;
-}
-
-
-struct dynfn *radeon_makeX86Color3fv( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return NULL;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3fv( & rmesa->vb.dfn_cache.Color3fv, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-struct dynfn *radeon_makeX86Color3f( GLcontext *ctx, int key )
-{
- if (key & (RADEON_CP_VC_FRMT_PKCOLOR|RADEON_CP_VC_FRMT_FPALPHA))
- return NULL;
- else
- {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute3f( & rmesa->vb.dfn_cache.Color3f, key,
- __FUNCTION__, rmesa->vb.floatcolorptr );
- }
-}
-
-
-
-struct dynfn *radeon_makeX86TexCoord2fv( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute2fv( & rmesa->vb.dfn_cache.TexCoord2fv, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *radeon_makeX86TexCoord2f( GLcontext *ctx, int key )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- return radeon_makeX86Attribute2f( & rmesa->vb.dfn_cache.TexCoord2f, key,
- __FUNCTION__, rmesa->vb.texcoordptr[0] );
-}
-
-struct dynfn *radeon_makeX86MultiTexCoord2fvARB( GLcontext *ctx, int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _x86_MultiTexCoord2fv, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 21, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 27, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- } else {
- DFN ( _x86_MultiTexCoord2fv_2, rmesa->vb.dfn_cache.MultiTexCoord2fvARB );
- FIXUP(dfn->code, 14, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-struct dynfn *radeon_makeX86MultiTexCoord2fARB( GLcontext *ctx,
- int key )
-{
- struct dynfn *dfn = MALLOC_STRUCT( dynfn );
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- if (RADEON_DEBUG & DEBUG_CODEGEN)
- fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key );
-
- if ((key & (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) ==
- (RADEON_CP_VC_FRMT_ST0|RADEON_CP_VC_FRMT_ST1)) {
- DFN ( _x86_MultiTexCoord2f, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 20, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]);
- FIXUP(dfn->code, 26, 0xdeadbeef, (int)rmesa->vb.texcoordptr[0]+4);
- }
- else {
- /* Note: this might get generated multiple times, even though the
- * actual emitted code is the same.
- */
- DFN ( _x86_MultiTexCoord2f_2, rmesa->vb.dfn_cache.MultiTexCoord2fARB );
- FIXUP(dfn->code, 18, 0x0, (int)rmesa->vb.texcoordptr);
- }
- return dfn;
-}
-
-
-void radeonInitX86Codegen( struct dfn_generators *gen )
-{
- gen->Vertex3f = radeon_makeX86Vertex3f;
- gen->Vertex3fv = radeon_makeX86Vertex3fv;
- gen->Color4ub = radeon_makeX86Color4ub; /* PKCOLOR only */
- gen->Color4ubv = radeon_makeX86Color4ubv; /* PKCOLOR only */
- gen->Normal3f = radeon_makeX86Normal3f;
- gen->Normal3fv = radeon_makeX86Normal3fv;
- gen->TexCoord2f = radeon_makeX86TexCoord2f;
- gen->TexCoord2fv = radeon_makeX86TexCoord2fv;
- gen->MultiTexCoord2fARB = radeon_makeX86MultiTexCoord2fARB;
- gen->MultiTexCoord2fvARB = radeon_makeX86MultiTexCoord2fvARB;
- gen->Color3f = radeon_makeX86Color3f;
- gen->Color3fv = radeon_makeX86Color3fv;
-
- /* Not done:
- */
-/* gen->Vertex2f = radeon_makeX86Vertex2f; */
-/* gen->Vertex2fv = radeon_makeX86Vertex2fv; */
-/* gen->Color3ub = radeon_makeX86Color3ub; */
-/* gen->Color3ubv = radeon_makeX86Color3ubv; */
-/* gen->Color4f = radeon_makeX86Color4f; */
-/* gen->Color4fv = radeon_makeX86Color4fv; */
-/* gen->TexCoord1f = radeon_makeX86TexCoord1f; */
-/* gen->TexCoord1fv = radeon_makeX86TexCoord1fv; */
-/* gen->MultiTexCoord1fARB = radeon_makeX86MultiTexCoord1fARB; */
-/* gen->MultiTexCoord1fvARB = radeon_makeX86MultiTexCoord1fvARB; */
-}
-
-
-#else
-
-void radeonInitX86Codegen( struct dfn_generators *gen )
-{
- (void) gen;
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxtmp_x86.S b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxtmp_x86.S
deleted file mode 100644
index 569d3b9b4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_vtxtmp_x86.S
+++ /dev/null
@@ -1,494 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_vtxtmp_x86.S,v 1.1 2002/10/30 12:51:58 alanh Exp $ */
-/**************************************************************************
-
-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
-on 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
-ATI, TUNGSTEN GRAPHICS 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.
-
-**************************************************************************/
-
-#define GLOBL( x ) \
-.globl x; \
-x:
-
-.data
-.align 4
-
-/*
- vertex 3f vertex size 4
-*/
-
-GLOBL ( _x86_Vertex3f_4 )
- movl (0), %ecx
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl %eax, (%ecx)
- movl %edx, 4(%ecx)
- movl 12(%esp), %eax
- movl (0), %edx
- movl %eax, 8(%ecx)
- movl %edx, 12(%ecx)
- movl (0), %eax
- addl $16, %ecx
- dec %eax
- movl %ecx, (0)
- movl %eax, (0)
- je .1
- ret
-.1: jmp *0
-
-GLOBL ( _x86_Vertex3f_4_end )
-
-/*
- vertex 3f vertex size 6
-*/
-GLOBL ( _x86_Vertex3f_6 )
- push %edi
- movl (0), %edi
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- movl (0), %eax
- movl (0), %edx
- movl (0), %ecx
- movl %eax, 12(%edi)
- movl %edx, 16(%edi)
- movl %ecx, 20(%edi)
- addl $24, %edi
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- pop %edi
- movl %eax, (0)
- je .2
- ret
-.2: jmp *0
-GLOBL ( _x86_Vertex3f_6_end )
-/*
- vertex 3f generic size
-*/
-GLOBL ( _x86_Vertex3f )
- push %edi
- push %esi
- movl $0, %esi
- movl (0), %edi
- movl 12(%esp), %eax
- movl 16(%esp), %edx
- movl 20(%esp), %ecx
- movl %eax, (%edi)
- movl %edx, 4(%edi)
- movl %ecx, 8(%edi)
- addl $12, %edi
- movl $0, %ecx
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl (0), %eax
- movl %edi, (0)
- dec %eax
- movl %eax, (0)
- pop %esi
- pop %edi
- je .3
- ret
-.3: jmp *0
-
-GLOBL ( _x86_Vertex3f_end )
-
-/*
- Vertex 3fv vertex size 6
-*/
-GLOBL ( _x86_Vertex3fv_6 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx, (%eax)
- movl 4(%ecx), %edx
- movl 8(%ecx), %ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (36), %edx
- movl %edx, 20(%eax)
- addl $24, %eax
- movl %eax, 0
- movl 4, %eax
- dec %eax
- movl %eax, 4
- je .4
- ret
-.4: jmp *8
-
-GLOBL ( _x86_Vertex3fv_6_end )
-
-/*
- Vertex 3fv vertex size 8
-*/
-GLOBL ( _x86_Vertex3fv_8 )
- movl (0), %eax
- movl 4(%esp), %ecx
- movl (%ecx), %edx
- movl %edx ,(%eax)
- movl 4(%ecx) ,%edx
- movl 8(%ecx) ,%ecx
- movl %edx, 4(%eax)
- movl %ecx, 8(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 12(%eax)
- movl %ecx, 16(%eax)
- movl (28), %edx
- movl (32), %ecx
- movl %edx, 20(%eax)
- movl %ecx, 24(%eax)
- movl (36), %edx
- movl %edx, 28(%eax)
- addl $32, %eax
- movl %eax, (0)
- movl 4, %eax
- dec %eax
- movl %eax, (4)
- je .5
- ret
-.5: jmp *8
-
-GLOBL ( _x86_Vertex3fv_8_end )
-
-/*
- Vertex 3fv generic vertex size
-*/
-GLOBL ( _x86_Vertex3fv )
- movl 4(%esp), %edx
- push %edi
- push %esi
- movl (0x1010101), %edi
- movl (%edx), %eax
- movl 4(%edx), %ecx
- movl 8(%edx), %esi
- movl %eax, (%edi)
- movl %ecx, 4(%edi)
- movl %esi, 8(%edi)
- addl $12, %edi
- movl $6, %ecx
- movl $0x58, %esi
- repz
- movsl %ds:(%esi), %es:(%edi)
- movl %edi, (0x1010101)
- movl (0x2020202), %eax
- pop %esi
- pop %edi
- dec %eax
- movl %eax, (0x2020202)
- je .6
- ret
-.6: jmp *0
-GLOBL ( _x86_Vertex3fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL ( _x86_Attribute2f )
- movl $0x0, %edx
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- movl %eax, (%edx)
- movl %ecx, 4(%edx)
- ret
-GLOBL ( _x86_Attribute2f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _x86_Attribute2fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %eax /* load v[1] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %eax, 4 /* store v[1] to current vertex */
- ret
-GLOBL ( _x86_Attribute2fv_end )
-
-
-/**
- * Generic handler for 3 float format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL ( _x86_Attribute3f )
- movl 4(%esp), %ecx
- movl 8(%esp), %edx
- movl 12(%esp), %eax
- movl %ecx, 0
- movl %edx, 4
- movl %eax, 8
- ret
-GLOBL ( _x86_Attribute3f_end )
-
-/**
- * Generic handler for 3 float vector format data. This can be used for
- * Normal3f, Color3f (when the color target is also float), or
- * TexCoord3f.
- */
-
-GLOBL( _x86_Attribute3fv)
- movl 4(%esp), %eax /* load 'v' off stack */
- movl (%eax), %ecx /* load v[0] */
- movl 4(%eax), %edx /* load v[1] */
- movl 8(%eax), %eax /* load v[2] */
- movl %ecx, 0 /* store v[0] to current vertex */
- movl %edx, 4 /* store v[1] to current vertex */
- movl %eax, 8 /* store v[2] to current vertex */
- ret
-GLOBL ( _x86_Attribute3fv_end )
-
-
-/*
- Color 4ubv_ub
-*/
-GLOBL ( _x86_Color4ubv_ub )
- movl 4(%esp), %eax
- movl $0x12345678, %edx
- movl (%eax), %eax
- movl %eax, (%edx)
- ret
-GLOBL ( _x86_Color4ubv_ub_end )
-
-/*
- Color 4ubv 4f
-*/
-GLOBL ( _x86_Color4ubv_4f )
- push %ebx
- movl $0, %edx
- xor %eax, %eax
- xor %ecx, %ecx
- movl 8(%esp), %ebx
- movl (%ebx), %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4),%eax
- movl (%edx,%ecx,4),%ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- xor %eax, %eax
- xor %ecx, %ecx
- shr $16, %ebx
- mov %bl, %al
- mov %bh, %cl
- movl (%edx,%eax,4), %eax
- movl (%edx,%ecx,4), %ecx
- movl %eax, (0xdeadbeaf)
- movl %ecx, (0xdeadbeaf)
- pop %ebx
- ret
-GLOBL ( _x86_Color4ubv_4f_end )
-
-/*
-
- Color4ub_ub
-*/
-GLOBL( _x86_Color4ub_ub )
- push %ebx
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- movl 16(%esp), %ecx
- movl 20(%esp), %ebx
- mov %al, (0)
- mov %dl, (0)
- mov %cl, (0)
- mov %bl, (0)
- pop %ebx
- ret
-GLOBL( _x86_Color4ub_ub_end )
-
-
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $1, %eax
- movl (%ecx), %edx
- shl $3, %eax
- movl 4(%ecx), %ecx
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-
-GLOBL( _x86_MultiTexCoord2fv_2 )
- movl 4(%esp,1), %eax
- movl 8(%esp,1), %ecx
- and $0x1, %eax
- movl 0(,%eax,4), %edx
- movl (%ecx), %eax
- movl %eax, (%edx)
- movl 4(%ecx), %eax
- movl %eax, 4(%edx)
- ret
-GLOBL( _x86_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _x86_MultiTexCoord2f )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp), %ecx
- and $1, %eax
- shl $3, %eax
- movl %edx, 0xdeadbeef(%eax)
- movl %ecx, 0xdeadbeef(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _x86_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %edx
- movl 12(%esp,1), %ecx
- and $1,%eax
- movl 0(,%eax,4), %eax
- movl %edx, (%eax)
- movl %ecx, 4(%eax)
- ret
-GLOBL( _x86_MultiTexCoord2f_2_end )
-
-#if defined(USE_SSE_ASM)
-/**
- * This can be used as a template for either Color3fv (when the color
- * target is also a 3f) or Normal3fv.
- */
-
-GLOBL( _sse_Attribute3fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movl 8(%eax), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3fv_end )
-
-/**
- * This can be used as a template for either Color3f (when the color
- * target is also a 3f) or Normal3f.
- */
-
-GLOBL( _sse_Attribute3f )
- movlps 4(%esp), %xmm0
- movl 12(%esp), %eax
- movlps %xmm0, 0
- movl %eax, 8
- ret
-GLOBL( _sse_Attribute3f_end )
-
-
-/**
- * Generic handler for 2 float vector format data. This can be used for
- * TexCoord2fv and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2fv )
- movl 4(%esp), %eax
- movlps (%eax), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2fv_end )
-
-
-/**
- * Generic handler for 2 float format data. This can be used for
- * TexCoord2f and possibly other functions.
- */
-
-GLOBL( _sse_Attribute2f )
- movlps 4(%esp), %xmm0
- movlps %xmm0, 0
- ret
-GLOBL( _sse_Attribute2f_end )
-
-/*
- MultiTexCoord2fv st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2fv )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $1, %eax
- movlps (%ecx), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2fv_end )
-
-/*
- MultiTexCoord2fv
-*/
-GLOBL( _sse_MultiTexCoord2fv_2 )
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- and $0x1, %eax
- movl 0(,%eax,4), %edx
- movlps (%ecx), %xmm0
- movlps %xmm0, (%edx)
- ret
-GLOBL( _sse_MultiTexCoord2fv_2_end )
-
-/*
- MultiTexCoord2f st0/st1
-*/
-GLOBL( _sse_MultiTexCoord2f )
- movl 4(%esp), %eax
- and $1, %eax
- movlps 8(%esp), %xmm0
- movlps %xmm0, 0xdeadbeef(,%eax,8)
- ret
-GLOBL( _sse_MultiTexCoord2f_end )
-
-/*
- MultiTexCoord2f
-*/
-GLOBL( _sse_MultiTexCoord2f_2 )
- movl 4(%esp), %eax
- movlps 8(%esp), %xmm0
- and $1,%eax
- movl 0(,%eax,4), %eax
- movlps %xmm0, (%eax)
- ret
-GLOBL( _sse_MultiTexCoord2f_2_end )
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon.h
deleted file mode 100644
index 21db825c9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/**
- * \file server/radeon.h
- * \brief Radeon 2D driver data structures.
- */
-
-/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario, 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, 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.
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.29 2002/10/12 01:38:07 martin Exp $ */
-
-#ifndef _RADEON_H_
-#define _RADEON_H_
-
-#include "xf86drm.h" /* drm_handle_t, etc */
-
-# define RADEON_AGP_1X_MODE 0x01
-# define RADEON_AGP_2X_MODE 0x02
-# define RADEON_AGP_4X_MODE 0x04
-# define RADEON_AGP_FW_MODE 0x10
-# define RADEON_AGP_MODE_MASK 0x17
-#define RADEON_CP_CSQ_CNTL 0x0740
-# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0)
-# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28)
-# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28)
-# define RADEON_CSQ_PRIBM_INDDIS (2 << 28)
-# define RADEON_CSQ_PRIPIO_INDBM (3 << 28)
-# define RADEON_CSQ_PRIBM_INDBM (4 << 28)
-# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28)
-
-
-#define PCI_CHIP_R200_BB 0x4242
-#define PCI_CHIP_RV250_Id 0x4964
-#define PCI_CHIP_RV250_Ie 0x4965
-#define PCI_CHIP_RV250_If 0x4966
-#define PCI_CHIP_RV250_Ig 0x4967
-#define PCI_CHIP_RADEON_LW 0x4C57
-#define PCI_CHIP_RADEON_LX 0x4C58
-#define PCI_CHIP_RADEON_LY 0x4C59
-#define PCI_CHIP_RADEON_LZ 0x4C5A
-#define PCI_CHIP_RV250_Ld 0x4C64
-#define PCI_CHIP_RV250_Le 0x4C65
-#define PCI_CHIP_RV250_Lf 0x4C66
-#define PCI_CHIP_RV250_Lg 0x4C67
-#define PCI_CHIP_R300_ND 0x4E44
-#define PCI_CHIP_R300_NE 0x4E45
-#define PCI_CHIP_R300_NF 0x4E46
-#define PCI_CHIP_R300_NG 0x4E47
-#define PCI_CHIP_RADEON_QD 0x5144
-#define PCI_CHIP_RADEON_QE 0x5145
-#define PCI_CHIP_RADEON_QF 0x5146
-#define PCI_CHIP_RADEON_QG 0x5147
-#define PCI_CHIP_R200_QL 0x514C
-#define PCI_CHIP_R200_QN 0x514E
-#define PCI_CHIP_R200_QO 0x514F
-#define PCI_CHIP_RV200_QW 0x5157
-#define PCI_CHIP_RV200_QX 0x5158
-#define PCI_CHIP_RADEON_QY 0x5159
-#define PCI_CHIP_RADEON_QZ 0x515A
-#define PCI_CHIP_R200_Ql 0x516C
-#define PCI_CHIP_RV280_Y_ 0x5960
-#define PCI_CHIP_RV280_Ya 0x5961
-#define PCI_CHIP_RV280_Yb 0x5962
-#define PCI_CHIP_RV280_Yc 0x5963
-
-/**
- * \brief Chip families.
- */
-typedef enum {
- CHIP_FAMILY_UNKNOW,
- CHIP_FAMILY_LEGACY,
- CHIP_FAMILY_R128,
- CHIP_FAMILY_M3,
- CHIP_FAMILY_RADEON,
- CHIP_FAMILY_VE,
- CHIP_FAMILY_M6,
- CHIP_FAMILY_RV200,
- CHIP_FAMILY_M7,
- CHIP_FAMILY_R200,
- CHIP_FAMILY_RV250,
- CHIP_FAMILY_M9,
- CHIP_FAMILY_RV280,
- CHIP_FAMILY_R300
-} RADEONChipFamily;
-
-
-typedef unsigned long memType;
-
-
-/**
- * \brief Radeon DDX driver private data.
- */
-typedef struct {
- int Chipset; /**< \brief Chipset number */
- RADEONChipFamily ChipFamily; /**< \brief Chip family */
-
- unsigned long LinearAddr; /**< \brief Frame buffer physical address */
-
-
- drmSize registerSize; /**< \brief MMIO register map size */
- drm_handle_t registerHandle; /**< \brief MMIO register map handle */
-
- int IsPCI; /* Current card is a PCI card */
-
- /**
- * \name AGP
- */
- /*@{*/
- drmSize gartSize; /**< \brief AGP map size */
- drm_handle_t gartMemHandle; /**< \brief AGP map handle */
- unsigned long gartOffset; /**< \brief AGP offset */
- int gartMode; /**< \brief AGP mode */
- int gartFastWrite;
- /*@}*/
-
- /**
- * \name CP ring buffer data
- */
- /*@{*/
- unsigned long ringStart; /**< \brief Offset into AGP space */
- drm_handle_t ringHandle; /**< \brief Handle from drmAddMap() */
- drmSize ringMapSize; /**< \brief Size of map */
- int ringSize; /**< \brief Size of ring (in MB) */
-
- unsigned long ringReadOffset; /**< \brief Read offset into AGP space */
- drm_handle_t ringReadPtrHandle;/**< \brief Handle from drmAddMap() */
- drmSize ringReadMapSize; /**< \brief Size of map */
- /*@}*/
-
- /**
- * \name CP vertex/indirect buffer data
- */
- /*@{*/
- unsigned long bufStart; /**< \brief Offset into AGP space */
- drm_handle_t bufHandle; /**< \brief Handle from drmAddMap() */
- drmSize bufMapSize; /**< \brief Size of map */
- int bufSize; /**< \brief Size of buffers (in MB) */
- int bufNumBufs; /**< \brief Number of buffers */
- /*@}*/
-
- /**
- * \name CP AGP Texture data
- */
- /*@{*/
- unsigned long gartTexStart; /**< \brief Offset into AGP space */
- drm_handle_t gartTexHandle; /**< \brief Handle from drmAddMap() */
- drmSize gartTexMapSize; /**< \brief Size of map */
- int gartTexSize; /**< \brief Size of AGP tex space (in MB) */
- int log2GARTTexGran;
- /*@}*/
-
- int drmMinor; /**< \brief DRM device minor number */
-
- int frontOffset; /**< \brief Front color buffer offset */
- int frontPitch; /**< \brief Front color buffer pitch */
- int backOffset; /**< \brief Back color buffer offset */
- int backPitch; /**< \brief Back color buffer pitch */
- int depthOffset; /**< \brief Depth buffer offset */
- int depthPitch; /**< \brief Depth buffer pitch */
- int textureOffset; /**< \brief Texture area offset */
- int textureSize; /**< \brief Texture area size */
- int log2TexGran; /**< \brief Texture granularity in base 2 log */
-
- unsigned int frontPitchOffset;
- unsigned int backPitchOffset;
- unsigned int depthPitchOffset;
-
- int colorTiling; /**< \brief Enable color tiling */
-
- int irq; /**< \brief IRQ number */
- int page_flip_enable; /**< \brief Page Flip enable */
- unsigned int gen_int_cntl;
- unsigned int crtc_offset_cntl;
-
-} RADEONInfoRec, *RADEONInfoPtr;
-
-
-#endif /* _RADEON_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.c
deleted file mode 100644
index 7f83d868c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.c
+++ /dev/null
@@ -1,1336 +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;
- }
-
- 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.h
deleted file mode 100644
index ecd532333..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_dri.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * \file server/radeon_dri.h
- * \brief Radeon server-side structures.
- *
- * \author Kevin E. Martin <martin@xfree86.org>
- * \author Rickard E. Faith <faith@valinux.com>
- */
-
-/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario,
- * 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, 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.
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.3 2002/04/24 16:20:40 martin Exp $ */
-
-#ifndef _RADEON_DRI_
-#define _RADEON_DRI_
-
-#include "xf86drm.h"
-#include "drm.h"
-#include "radeon_drm.h"
-
-/* DRI Driver defaults */
-#define RADEON_DEFAULT_CP_PIO_MODE RADEON_CSQ_PRIPIO_INDPIO
-#define RADEON_DEFAULT_CP_BM_MODE RADEON_CSQ_PRIBM_INDBM
-#define RADEON_DEFAULT_AGP_MODE 1
-#define RADEON_DEFAULT_AGP_FAST_WRITE 0
-#define RADEON_DEFAULT_AGP_SIZE 8 /* MB (must be 2^n and > 4MB) */
-#define RADEON_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */
-#define RADEON_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */
-#define RADEON_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */
-#define RADEON_DEFAULT_CP_TIMEOUT 10000 /* usecs */
-#define RADEON_DEFAULT_PAGE_FLIP 0 /* page flipping diabled */
-#define RADEON_BUFFER_ALIGN 0x00000fff
-
-/**
- * \brief Radeon DRI driver private data.
- */
-typedef struct {
- /**
- * \name DRI screen private data
- */
- /*@{*/
- int deviceID; /**< \brief PCI device ID */
- int width; /**< \brief width in pixels of display */
- int height; /**< \brief height in scanlines of display */
- int depth; /**< \brief depth of display (8, 15, 16, 24) */
- int bpp; /**< \brief bit depth of display (8, 16, 24, 32) */
-
- int IsPCI; /**< \brief is current card a PCI card? */
- int AGPMode; /**< \brief AGP mode */
-
- int frontOffset; /**< \brief front buffer offset */
- int frontPitch; /**< \brief front buffer pitch */
- int backOffset; /**< \brief shared back buffer offset */
- int backPitch; /**< \brief shared back buffer pitch */
- int depthOffset; /**< \brief shared depth buffer offset */
- int depthPitch; /**< \brief shared depth buffer pitch */
- int textureOffset; /**< \brief start of texture data in frame buffer */
- int textureSize; /**< \brief size of texture date */
- int log2TexGran; /**< \brief log2 texture granularity */
- /*@}*/
-
- /**
- * \name MMIO register data
- */
- /*@{*/
- drm_handle_t registerHandle; /**< \brief MMIO register map size */
- drmSize registerSize; /**< \brief MMIO register map handle */
- /*@}*/
-
- /**
- * \name CP in-memory status information
- */
- /*@{*/
- drm_handle_t statusHandle; /**< \brief status map handle */
- drmSize statusSize; /**< \brief status map size */
- /*@}*/
-
- /**
- * \name CP AGP Texture data
- */
- /*@{*/
- drm_handle_t gartTexHandle; /**< \brief AGP texture area map handle */
- drmSize gartTexMapSize; /**< \brief AGP texture area map size */
- int log2GARTTexGran; /**< \brief AGP texture granularity in log base 2 */
- int gartTexOffset; /**< \brief AGP texture area offset in AGP space */
- /*@}*/
-
- unsigned int sarea_priv_offset; /**< \brief offset of the private SAREA data*/
-} RADEONDRIRec, *RADEONDRIPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_egl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_egl.c
deleted file mode 100644
index 736fed5b5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_egl.c
+++ /dev/null
@@ -1,978 +0,0 @@
-/*
- * EGL driver for radeon_dri.so
- */
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-#include "egldri.h"
-
-#include "mtypes.h"
-#include "memops.h"
-#include "drm.h"
-#include "drm_sarea.h"
-#include "radeon_drm.h"
-#include "radeon_dri.h"
-#include "radeon.h"
-
-static size_t radeon_drm_page_size;
-
-/**
- * radeon driver-specific driver class derived from _EGLDriver
- */
-typedef struct radeon_driver
-{
- _EGLDriver Base; /* base class/object */
- GLuint radeonStuff;
-} radeonDriver;
-
-static int RADEONCheckDRMVersion( driDisplay *disp,
- RADEONInfoPtr info )
-{
- drmVersionPtr version;
-
- version = drmGetVersion(disp->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;
-}
-
-
-/**
- * \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;
-}
-
-
-/* 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(driDisplay *disp, RADEONInfoPtr info)
-{
- int ret;
- int flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL;
- int s, l;
-
- ret = drmScatterGatherAlloc(disp->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%04lx\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(disp->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%08lx\n", info->ringHandle);
-
- if (drmAddMap(disp->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(disp->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(disp->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%08lx\n",
- info->gartTexHandle);
-
- return 1;
-}
-
-
-/**
- * \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( driDisplay *disp, RADEONInfoPtr info)
-{
- int mode, ret;
- int s, l;
- int agpmode = 1;
-
- if (drmAgpAcquire(disp->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
- mode = drmAgpGetMode(disp->drmFD); /* Default mode */
- /* Disable fast write entirely - too many lockups.
- */
- mode &= ~RADEON_AGP_MODE_MASK;
- switch (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(disp->drmFD, mode) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(disp->drmFD);
- return 0;
- }
-
-#if 0
- /* Workaround for some hardware bugs */
- if (info->ChipFamily < CHIP_FAMILY_R200)
- OUTREG(RADEON_AGP_CNTL, INREG(RADEON_AGP_CNTL) | 0x000e0000);
-#endif
- info->gartOffset = 0;
-
- if ((ret = drmAgpAlloc(disp->drmFD, info->gartSize*1024*1024, 0, NULL,
- &info->gartMemHandle)) < 0) {
- fprintf(stderr, "[gart] Out of memory (%d)\n", ret);
- drmAgpRelease(disp->drmFD);
- return 0;
- }
- fprintf(stderr,
- "[gart] %d kB allocated with handle 0x%08x\n",
- info->gartSize*1024, (unsigned)info->gartMemHandle);
-
- if (drmAgpBind(disp->drmFD,
- info->gartMemHandle, info->gartOffset) < 0) {
- fprintf(stderr, "[gart] Could not bind\n");
- drmAgpFree(disp->drmFD, info->gartMemHandle);
- drmAgpRelease(disp->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(disp->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%08lx\n", info->ringHandle);
-
-
- if (drmAddMap(disp->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(disp->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%08lx\n",
- info->bufHandle);
-
- if (drmAddMap(disp->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);
-
- return 1;
-}
-
-
-static int RADEONMemoryInit( driDisplay *disp, RADEONInfoPtr info )
-{
- int width_bytes = disp->virtualWidth * disp->cpp;
- int cpp = disp->cpp;
- int bufferSize = ((disp->virtualHeight * width_bytes
- + RADEON_BUFFER_ALIGN)
- & ~RADEON_BUFFER_ALIGN);
- int depthSize = ((((disp->virtualHeight+15) & ~15) * width_bytes
- + RADEON_BUFFER_ALIGN)
- & ~RADEON_BUFFER_ALIGN);
- int l;
-
- info->frontOffset = 0;
- info->frontPitch = disp->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 = disp->fbSize - 2 * bufferSize - depthSize;
-
- 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 */
- info->textureOffset = ((disp->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 = disp->virtualWidth;
-
- info->backOffset = ((info->depthOffset - bufferSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- info->backPitch = disp->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;
-}
-
-
-/**
- * \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( driDisplay *disp,
- RADEONInfoPtr info)
-{
- int cpp = disp->bpp / 8;
- drm_radeon_init_t drmInfo;
- int ret;
-
- memset(&drmInfo, 0, sizeof(drmInfo));
-
- 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.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 = disp->bpp;
- drmInfo.depth_bpp = disp->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.ring_offset = info->ringHandle;
- drmInfo.ring_rptr_offset = info->ringReadPtrHandle;
- drmInfo.buffers_offset = info->bufHandle;
- drmInfo.gart_textures_offset = info->gartTexHandle;
-
- ret = drmCommandWrite(disp->drmFD, DRM_RADEON_CP_INIT, &drmInfo,
- sizeof(drm_radeon_init_t));
-
- 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 RADEONDRIBufInit( driDisplay *disp, RADEONInfoPtr info )
-{
- /* Initialize vertex buffers */
- info->bufNumBufs = drmAddBufs(disp->drmFD,
- info->bufMapSize / RADEON_BUFFER_SIZE,
- RADEON_BUFFER_SIZE,
- disp->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 disp 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(driDisplay *disp, RADEONInfoPtr info)
-{
- if ((drmCtlInstHandler(disp->drmFD, 0)) != 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");
-}
-
-
-/**
- * \brief Initialize the AGP heap.
- *
- * \param disp 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(driDisplay *disp,
- 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(disp->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);
- }
-}
-
-
-/**
- * Called at the start of each server generation.
- *
- * \param disp 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( driDisplay *disp, RADEONInfoPtr info, RADEONDRIPtr pRADEONDRI)
-{
- int i, err;
-
- {
- int width_bytes = (disp->virtualWidth * disp->cpp);
- int maxy = disp->fbSize / width_bytes;
-
-
- if (maxy <= disp->virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (disp->virtualWidth * disp->virtualHeight *
- disp->cpp * 3 + 1023) / 1024,
- disp->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();
-
- /* Check the radeon DRM version */
- if (!RADEONCheckDRMVersion(disp, info)) {
- return 0;
- }
-
- if (disp->isPCI) {
- /* Initialize PCI */
- if (!RADEONDRIPciInit(disp, info))
- return 0;
- }
- else {
- /* Initialize AGP */
- if (!RADEONDRIAgpInit(disp, info))
- return 0;
- }
-
- /* Memory manager setup */
- if (!RADEONMemoryInit(disp, info)) {
- return 0;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(disp->drmFD, &disp->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(disp->drmFD, disp->pSAREA, disp->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!RADEONDRIKernelInit(disp, info)) {
- fprintf(stderr, "RADEONDRIKernelInit failed\n");
- DRM_UNLOCK(disp->drmFD, disp->pSAREA, disp->serverContext);
- return 0;
- }
-
- /* Initialize the vertex buffers list */
- if (!RADEONDRIBufInit(disp, info)) {
- fprintf(stderr, "RADEONDRIBufInit failed\n");
- DRM_UNLOCK(disp->drmFD, disp->pSAREA, disp->serverContext);
- return 0;
- }
-
- /* Initialize IRQ */
- RADEONDRIIrqInit(disp, info);
-
- /* Initialize kernel gart memory manager */
- RADEONDRIAgpHeapInit(disp, info);
-
- 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*)disp->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- pSAREAPriv->pfState = info->page_flip_enable;
- }
-
- for ( i = 0;; i++ ) {
- drmMapType type;
- drmMapFlags flags;
- drm_handle_t handle, offset;
- drmSize size;
- int rc, mtrr;
-
- if ( ( rc = drmGetMap( disp->drmFD, i, &offset, &size, &type, &flags, &handle, &mtrr ) ) != 0 )
- break;
- if ( type == DRM_REGISTERS ) {
- pRADEONDRI->registerHandle = offset;
- pRADEONDRI->registerSize = size;
- break;
- }
- }
- /* 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 *)disp->pFB + info->frontOffset,
- 0xEE,
- info->frontPitch * disp->cpp * disp->virtualHeight );
-
- drimemsetio((char *)disp->pFB + info->backOffset,
- 0x30,
- info->backPitch * disp->cpp * disp->virtualHeight );
-
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- pRADEONDRI->deviceID = info->Chipset;
- pRADEONDRI->width = disp->virtualWidth;
- pRADEONDRI->height = disp->virtualHeight;
- pRADEONDRI->depth = disp->bpp; /* XXX: depth */
- pRADEONDRI->bpp = disp->bpp;
- pRADEONDRI->IsPCI = disp->isPCI;
- 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->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 Initialize the framebuffer device mode
- *
- * \param disp display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p disp
- * and then calls RADEONScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int radeonInitFBDev( driDisplay *disp, RADEONDRIPtr pRADEONDRI )
-{
- int err;
- RADEONInfoPtr info = calloc(1, sizeof(*info));
-
- disp->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->Chipset = disp->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 = disp->virtualWidth;
-
- if (!RADEONScreenInit( disp, info, pRADEONDRI))
- return 0;
-
- /* Initialize and start the CP if required */
- if ((err = drmCommandNone(disp->drmFD, DRM_RADEON_CP_START)) != 0) {
- fprintf(stderr, "%s: CP start %d\n", __FUNCTION__, err);
- return 0;
- }
-
- return 1;
-}
-
-static EGLBoolean
-radeonFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer) {
- _EGLConfig *configs;
- _EGLConfig *c;
- unsigned int i, num_configs;
- unsigned int depth_buffer_factor;
- unsigned int 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 */
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_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_configs = depth_buffer_factor * back_buffer_factor * 2;
-
- 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;
- }
-
- configs = calloc(sizeof(*configs), num_configs);
- c = configs;
- if (!_eglFillInConfigs(c, 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 EGL_FALSE;
- }
-
- /* Mark the visual as slow if there are "fake" stencil bits.
- */
- for (i = 0, c = configs; i < num_configs; i++, c++) {
- int stencil = GET_CONFIG_ATTRIB(c, EGL_STENCIL_SIZE);
- if ((stencil != 0) && (stencil != stencil_bits)) {
- SET_CONFIG_ATTRIB(c, EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG);
- }
- }
-
- for (i = 0, c = configs; i < num_configs; i++, c++)
- _eglAddConfig(disp, c);
-
- free(configs);
-
- return EGL_TRUE;
-}
-
-/**
- * Show the given surface on the named screen.
- * If surface is EGL_NO_SURFACE, disable the screen's output.
- */
-static EGLBoolean
-radeonShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA m)
-{
- _eglDRIShowSurfaceMESA(drv, dpy, screen, surface, m);
- return EGL_FALSE;
-}
-
-static EGLBoolean
-radeonInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- __DRIframebuffer framebuffer;
- driDisplay *display;
-
- if (!_eglDRIInitialize(drv, dpy, major, minor))
- return EGL_FALSE;
-
- display = Lookup_driDisplay(dpy);
-
- framebuffer.dev_priv_size = sizeof(RADEONDRIRec);
- framebuffer.dev_priv = malloc(sizeof(RADEONDRIRec));
-
- display->virtualWidth = 1024;
- display->virtualHeight = 768;
- display->bpp = 32;
- display->cpp = 4;
-
- if (!_eglDRIGetDisplayInfo(display))
- return EGL_FALSE;
-
- framebuffer.base = display->pFB;
- radeonInitFBDev( display, framebuffer.dev_priv );
-
- if (!_eglDRICreateDisplay(display, &framebuffer))
- return EGL_FALSE;
-
- if (!_eglDRICreateScreen(display))
- return EGL_FALSE;
-
- radeonFillInConfigs(&display->Base, 32, 24, 8, 1);
- radeonFillInConfigs(&display->Base, 16, 16, 0, 1);
-
- drv->Initialized = EGL_TRUE;
- return EGL_TRUE;
-}
-
-
-/**
- * The bootstrap function. Return a new radeonDriver object and
- * plug in API functions.
- */
-_EGLDriver *
-_eglMain(_EGLDisplay *dpy)
-{
- radeonDriver *radeon;
-
- radeon = (radeonDriver *) calloc(1, sizeof(*radeon));
- if (!radeon) {
- return NULL;
- }
-
- /* First fill in the dispatch table with defaults */
- _eglDRIInitDriverFallbacks(&radeon->Base);
-
- /* then plug in our radeon-specific functions */
- radeon->Base.Initialize = radeonInitialize;
- radeon->Base.ShowSurfaceMESA = radeonShowSurfaceMESA;
-
- return &radeon->Base;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_macros.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_macros.h
deleted file mode 100644
index 60f0fa2d3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_macros.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * \file server/radeon_macros.h
- * \brief Macros for Radeon MMIO operation.
- *
- * \authors Kevin E. Martin <martin@xfree86.org>
- * \authors Rickard E. Faith <faith@valinux.com>
- * \authors Alan Hourihane <alanh@fairlite.demon.co.uk>
- */
-
-/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario, 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, 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.
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.20 2002/10/12 01:38:07 martin Exp $ */
-
-#ifndef _RADEON_MACROS_H_
-#define _RADEON_MACROS_H_
-
-#include <mmio.h>
-
-# define MMIO_IN8(base, offset) \
- *(volatile unsigned char *)(((unsigned char*)(base)) + (offset))
-# define MMIO_IN32(base, offset) \
- read_MMIO_LE32(base, offset)
-# define MMIO_OUT8(base, offset, val) \
- *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) = (val)
-# define MMIO_OUT32(base, offset, val) \
- *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) = CPU_TO_LE32(val)
-
-
- /* Memory mapped register access macros */
-#define INREG8(addr) MMIO_IN8(RADEONMMIO, addr)
-#define INREG(addr) MMIO_IN32(RADEONMMIO, addr)
-#define OUTREG8(addr, val) MMIO_OUT8(RADEONMMIO, addr, val)
-#define OUTREG(addr, val) MMIO_OUT32(RADEONMMIO, addr, val)
-
-#define ADDRREG(addr) ((volatile GLuint *)(pointer)(RADEONMMIO + (addr)))
-
-
-#define OUTREGP(addr, val, mask) \
-do { \
- GLuint tmp = INREG(addr); \
- tmp &= (mask); \
- tmp |= (val); \
- OUTREG(addr, tmp); \
-} while (0)
-
-#define INPLL(dpy, addr) RADEONINPLL(dpy, addr)
-
-#define OUTPLL(addr, val) \
-do { \
- OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x3f) | \
- RADEON_PLL_WR_EN)); \
- OUTREG(RADEON_CLOCK_CNTL_DATA, val); \
-} while (0)
-
-#define OUTPLLP(dpy, addr, val, mask) \
-do { \
- GLuint tmp = INPLL(dpy, addr); \
- tmp &= (mask); \
- tmp |= (val); \
- OUTPLL(addr, tmp); \
-} while (0)
-
-#define OUTPAL_START(idx) \
-do { \
- OUTREG8(RADEON_PALETTE_INDEX, (idx)); \
-} while (0)
-
-#define OUTPAL_NEXT(r, g, b) \
-do { \
- OUTREG(RADEON_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b)); \
-} while (0)
-
-#define OUTPAL_NEXT_CARD32(v) \
-do { \
- OUTREG(RADEON_PALETTE_DATA, (v & 0x00ffffff)); \
-} while (0)
-
-#define OUTPAL(idx, r, g, b) \
-do { \
- OUTPAL_START((idx)); \
- OUTPAL_NEXT((r), (g), (b)); \
-} while (0)
-
-#define INPAL_START(idx) \
-do { \
- OUTREG(RADEON_PALETTE_INDEX, (idx) << 16); \
-} while (0)
-
-#define INPAL_NEXT() INREG(RADEON_PALETTE_DATA)
-
-#define PAL_SELECT(idx) \
-do { \
- if (!idx) { \
- OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) & \
- (GLuint)~RADEON_DAC2_PALETTE_ACC_CTL); \
- } else { \
- OUTREG(RADEON_DAC_CNTL2, INREG(RADEON_DAC_CNTL2) | \
- RADEON_DAC2_PALETTE_ACC_CTL); \
- } \
-} while (0)
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_reg.h
deleted file mode 100644
index d290d43cf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/radeon/server/radeon_reg.h
+++ /dev/null
@@ -1,2142 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.30 2003/10/07 22:47:12 martin Exp $ */
-/*
- * Copyright 2000 ATI Technologies Inc., Markham, Ontario, 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, 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@xfree86.org>
- * Rickard E. Faith <faith@valinux.com>
- * Alan Hourihane <alanh@fairlite.demon.co.uk>
- *
- * References:
- *
- * !!!! FIXME !!!!
- * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
- * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
- * 1999.
- *
- * !!!! FIXME !!!!
- * RAGE 128 Software Development Manual (Technical Reference Manual P/N
- * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
- *
- */
-
-/* !!!! FIXME !!!! NOTE: THIS FILE HAS BEEN CONVERTED FROM r128_reg.h
- * AND CONTAINS REGISTERS AND REGISTER DEFINITIONS THAT ARE NOT CORRECT
- * ON THE RADEON. A FULL AUDIT OF THIS CODE IS NEEDED! */
-
-#ifndef _RADEON_REG_H_
-#define _RADEON_REG_H_
-
- /* Registers for 2D/Video/Overlay */
-#define RADEON_ADAPTER_ID 0x0f2c /* PCI */
-#define RADEON_AGP_BASE 0x0170
-#define RADEON_AGP_CNTL 0x0174
-# define RADEON_AGP_APER_SIZE_256MB (0x00 << 0)
-# define RADEON_AGP_APER_SIZE_128MB (0x20 << 0)
-# define RADEON_AGP_APER_SIZE_64MB (0x30 << 0)
-# define RADEON_AGP_APER_SIZE_32MB (0x38 << 0)
-# define RADEON_AGP_APER_SIZE_16MB (0x3c << 0)
-# define RADEON_AGP_APER_SIZE_8MB (0x3e << 0)
-# define RADEON_AGP_APER_SIZE_4MB (0x3f << 0)
-# define RADEON_AGP_APER_SIZE_MASK (0x3f << 0)
-#define RADEON_AGP_COMMAND 0x0f60 /* PCI */
-#define RADEON_AGP_COMMAND_PCI_CONFIG 0x0060 /* offset in PCI config*/
-# define RADEON_AGP_ENABLE (1<<8)
-#define RADEON_AGP_PLL_CNTL 0x000b /* PLL */
-#define RADEON_AGP_STATUS 0x0f5c /* PCI */
-# define RADEON_AGP_1X_MODE 0x01
-# define RADEON_AGP_2X_MODE 0x02
-# define RADEON_AGP_4X_MODE 0x04
-# define RADEON_AGP_FW_MODE 0x10
-# define RADEON_AGP_MODE_MASK 0x17
-#define RADEON_ATTRDR 0x03c1 /* VGA */
-#define RADEON_ATTRDW 0x03c0 /* VGA */
-#define RADEON_ATTRX 0x03c0 /* VGA */
-#define RADEON_AUX_SC_CNTL 0x1660
-# define RADEON_AUX1_SC_EN (1 << 0)
-# define RADEON_AUX1_SC_MODE_OR (0 << 1)
-# define RADEON_AUX1_SC_MODE_NAND (1 << 1)
-# define RADEON_AUX2_SC_EN (1 << 2)
-# define RADEON_AUX2_SC_MODE_OR (0 << 3)
-# define RADEON_AUX2_SC_MODE_NAND (1 << 3)
-# define RADEON_AUX3_SC_EN (1 << 4)
-# define RADEON_AUX3_SC_MODE_OR (0 << 5)
-# define RADEON_AUX3_SC_MODE_NAND (1 << 5)
-#define RADEON_AUX1_SC_BOTTOM 0x1670
-#define RADEON_AUX1_SC_LEFT 0x1664
-#define RADEON_AUX1_SC_RIGHT 0x1668
-#define RADEON_AUX1_SC_TOP 0x166c
-#define RADEON_AUX2_SC_BOTTOM 0x1680
-#define RADEON_AUX2_SC_LEFT 0x1674
-#define RADEON_AUX2_SC_RIGHT 0x1678
-#define RADEON_AUX2_SC_TOP 0x167c
-#define RADEON_AUX3_SC_BOTTOM 0x1690
-#define RADEON_AUX3_SC_LEFT 0x1684
-#define RADEON_AUX3_SC_RIGHT 0x1688
-#define RADEON_AUX3_SC_TOP 0x168c
-#define RADEON_AUX_WINDOW_HORZ_CNTL 0x02d8
-#define RADEON_AUX_WINDOW_VERT_CNTL 0x02dc
-
-#define RADEON_BASE_CODE 0x0f0b
-#define RADEON_BIOS_0_SCRATCH 0x0010
-#define RADEON_BIOS_1_SCRATCH 0x0014
-#define RADEON_BIOS_2_SCRATCH 0x0018
-#define RADEON_BIOS_3_SCRATCH 0x001c
-#define RADEON_BIOS_4_SCRATCH 0x0020
-#define RADEON_BIOS_5_SCRATCH 0x0024
-#define RADEON_BIOS_6_SCRATCH 0x0028
-#define RADEON_BIOS_7_SCRATCH 0x002c
-#define RADEON_BIOS_ROM 0x0f30 /* PCI */
-#define RADEON_BIST 0x0f0f /* PCI */
-#define RADEON_BRUSH_DATA0 0x1480
-#define RADEON_BRUSH_DATA1 0x1484
-#define RADEON_BRUSH_DATA10 0x14a8
-#define RADEON_BRUSH_DATA11 0x14ac
-#define RADEON_BRUSH_DATA12 0x14b0
-#define RADEON_BRUSH_DATA13 0x14b4
-#define RADEON_BRUSH_DATA14 0x14b8
-#define RADEON_BRUSH_DATA15 0x14bc
-#define RADEON_BRUSH_DATA16 0x14c0
-#define RADEON_BRUSH_DATA17 0x14c4
-#define RADEON_BRUSH_DATA18 0x14c8
-#define RADEON_BRUSH_DATA19 0x14cc
-#define RADEON_BRUSH_DATA2 0x1488
-#define RADEON_BRUSH_DATA20 0x14d0
-#define RADEON_BRUSH_DATA21 0x14d4
-#define RADEON_BRUSH_DATA22 0x14d8
-#define RADEON_BRUSH_DATA23 0x14dc
-#define RADEON_BRUSH_DATA24 0x14e0
-#define RADEON_BRUSH_DATA25 0x14e4
-#define RADEON_BRUSH_DATA26 0x14e8
-#define RADEON_BRUSH_DATA27 0x14ec
-#define RADEON_BRUSH_DATA28 0x14f0
-#define RADEON_BRUSH_DATA29 0x14f4
-#define RADEON_BRUSH_DATA3 0x148c
-#define RADEON_BRUSH_DATA30 0x14f8
-#define RADEON_BRUSH_DATA31 0x14fc
-#define RADEON_BRUSH_DATA32 0x1500
-#define RADEON_BRUSH_DATA33 0x1504
-#define RADEON_BRUSH_DATA34 0x1508
-#define RADEON_BRUSH_DATA35 0x150c
-#define RADEON_BRUSH_DATA36 0x1510
-#define RADEON_BRUSH_DATA37 0x1514
-#define RADEON_BRUSH_DATA38 0x1518
-#define RADEON_BRUSH_DATA39 0x151c
-#define RADEON_BRUSH_DATA4 0x1490
-#define RADEON_BRUSH_DATA40 0x1520
-#define RADEON_BRUSH_DATA41 0x1524
-#define RADEON_BRUSH_DATA42 0x1528
-#define RADEON_BRUSH_DATA43 0x152c
-#define RADEON_BRUSH_DATA44 0x1530
-#define RADEON_BRUSH_DATA45 0x1534
-#define RADEON_BRUSH_DATA46 0x1538
-#define RADEON_BRUSH_DATA47 0x153c
-#define RADEON_BRUSH_DATA48 0x1540
-#define RADEON_BRUSH_DATA49 0x1544
-#define RADEON_BRUSH_DATA5 0x1494
-#define RADEON_BRUSH_DATA50 0x1548
-#define RADEON_BRUSH_DATA51 0x154c
-#define RADEON_BRUSH_DATA52 0x1550
-#define RADEON_BRUSH_DATA53 0x1554
-#define RADEON_BRUSH_DATA54 0x1558
-#define RADEON_BRUSH_DATA55 0x155c
-#define RADEON_BRUSH_DATA56 0x1560
-#define RADEON_BRUSH_DATA57 0x1564
-#define RADEON_BRUSH_DATA58 0x1568
-#define RADEON_BRUSH_DATA59 0x156c
-#define RADEON_BRUSH_DATA6 0x1498
-#define RADEON_BRUSH_DATA60 0x1570
-#define RADEON_BRUSH_DATA61 0x1574
-#define RADEON_BRUSH_DATA62 0x1578
-#define RADEON_BRUSH_DATA63 0x157c
-#define RADEON_BRUSH_DATA7 0x149c
-#define RADEON_BRUSH_DATA8 0x14a0
-#define RADEON_BRUSH_DATA9 0x14a4
-#define RADEON_BRUSH_SCALE 0x1470
-#define RADEON_BRUSH_Y_X 0x1474
-#define RADEON_BUS_CNTL 0x0030
-# define RADEON_BUS_MASTER_DIS (1 << 6)
-# define RADEON_BUS_RD_DISCARD_EN (1 << 24)
-# define RADEON_BUS_RD_ABORT_EN (1 << 25)
-# define RADEON_BUS_MSTR_DISCONNECT_EN (1 << 28)
-# define RADEON_BUS_WRT_BURST (1 << 29)
-# define RADEON_BUS_READ_BURST (1 << 30)
-#define RADEON_BUS_CNTL1 0x0034
-# define RADEON_BUS_WAIT_ON_LOCK_EN (1 << 4)
-
-#define RADEON_CACHE_CNTL 0x1724
-#define RADEON_CACHE_LINE 0x0f0c /* PCI */
-#define RADEON_CAP0_TRIG_CNTL 0x0950 /* ? */
-#define RADEON_CAP1_TRIG_CNTL 0x09c0 /* ? */
-#define RADEON_CAPABILITIES_ID 0x0f50 /* PCI */
-#define RADEON_CAPABILITIES_PTR 0x0f34 /* PCI */
-#define RADEON_CLK_PIN_CNTL 0x0001 /* PLL */
-#define RADEON_CLOCK_CNTL_DATA 0x000c
-#define RADEON_CLOCK_CNTL_INDEX 0x0008
-# define RADEON_PLL_WR_EN (1 << 7)
-# define RADEON_PLL_DIV_SEL (3 << 8)
-# define RADEON_PLL2_DIV_SEL_MASK ~(3 << 8)
-#define RADEON_CLR_CMP_CLR_3D 0x1a24
-#define RADEON_CLR_CMP_CLR_DST 0x15c8
-#define RADEON_CLR_CMP_CLR_SRC 0x15c4
-#define RADEON_CLR_CMP_CNTL 0x15c0
-# define RADEON_SRC_CMP_EQ_COLOR (4 << 0)
-# define RADEON_SRC_CMP_NEQ_COLOR (5 << 0)
-# define RADEON_CLR_CMP_SRC_SOURCE (1 << 24)
-#define RADEON_CLR_CMP_MASK 0x15cc
-# define RADEON_CLR_CMP_MSK 0xffffffff
-#define RADEON_CLR_CMP_MASK_3D 0x1A28
-#define RADEON_COMMAND 0x0f04 /* PCI */
-#define RADEON_COMPOSITE_SHADOW_ID 0x1a0c
-#define RADEON_CONFIG_APER_0_BASE 0x0100
-#define RADEON_CONFIG_APER_1_BASE 0x0104
-#define RADEON_CONFIG_APER_SIZE 0x0108
-#define RADEON_CONFIG_BONDS 0x00e8
-#define RADEON_CONFIG_CNTL 0x00e0
-# define RADEON_CFG_ATI_REV_A11 (0 << 16)
-# define RADEON_CFG_ATI_REV_A12 (1 << 16)
-# define RADEON_CFG_ATI_REV_A13 (2 << 16)
-# define RADEON_CFG_ATI_REV_ID_MASK (0xf << 16)
-#define RADEON_CONFIG_MEMSIZE 0x00f8
-#define RADEON_CONFIG_MEMSIZE_EMBEDDED 0x0114
-#define RADEON_CONFIG_REG_1_BASE 0x010c
-#define RADEON_CONFIG_REG_APER_SIZE 0x0110
-#define RADEON_CONFIG_XSTRAP 0x00e4
-#define RADEON_CONSTANT_COLOR_C 0x1d34
-# define RADEON_CONSTANT_COLOR_MASK 0x00ffffff
-# define RADEON_CONSTANT_COLOR_ONE 0x00ffffff
-# define RADEON_CONSTANT_COLOR_ZERO 0x00000000
-#define RADEON_CRC_CMDFIFO_ADDR 0x0740
-#define RADEON_CRC_CMDFIFO_DOUT 0x0744
-#define RADEON_GRPH_BUFFER_CNTL 0x02f0
-# define RADEON_GRPH_START_REQ_MASK (0x7f)
-# define RADEON_GRPH_START_REQ_SHIFT 0
-# define RADEON_GRPH_STOP_REQ_MASK (0x7f<<8)
-# define RADEON_GRPH_STOP_REQ_SHIFT 8
-# define RADEON_GRPH_CRITICAL_POINT_MASK (0x7f<<16)
-# define RADEON_GRPH_CRITICAL_POINT_SHIFT 16
-# define RADEON_GRPH_CRITICAL_CNTL (1<<28)
-# define RADEON_GRPH_BUFFER_SIZE (1<<29)
-# define RADEON_GRPH_CRITICAL_AT_SOF (1<<30)
-# define RADEON_GRPH_STOP_CNTL (1<<31)
-#define RADEON_GRPH2_BUFFER_CNTL 0x03f0
-# define RADEON_GRPH2_START_REQ_MASK (0x7f)
-# define RADEON_GRPH2_START_REQ_SHIFT 0
-# define RADEON_GRPH2_STOP_REQ_MASK (0x7f<<8)
-# define RADEON_GRPH2_STOP_REQ_SHIFT 8
-# define RADEON_GRPH2_CRITICAL_POINT_MASK (0x7f<<16)
-# define RADEON_GRPH2_CRITICAL_POINT_SHIFT 16
-# define RADEON_GRPH2_CRITICAL_CNTL (1<<28)
-# define RADEON_GRPH2_BUFFER_SIZE (1<<29)
-# define RADEON_GRPH2_CRITICAL_AT_SOF (1<<30)
-# define RADEON_GRPH2_STOP_CNTL (1<<31)
-#define RADEON_CRTC_CRNT_FRAME 0x0214
-#define RADEON_CRTC_EXT_CNTL 0x0054
-# define RADEON_CRTC_VGA_XOVERSCAN (1 << 0)
-# define RADEON_VGA_ATI_LINEAR (1 << 3)
-# define RADEON_XCRT_CNT_EN (1 << 6)
-# define RADEON_CRTC_HSYNC_DIS (1 << 8)
-# define RADEON_CRTC_VSYNC_DIS (1 << 9)
-# define RADEON_CRTC_DISPLAY_DIS (1 << 10)
-# define RADEON_CRTC_SYNC_TRISTAT (1 << 11)
-# define RADEON_CRTC_CRT_ON (1 << 15)
-#define RADEON_CRTC_EXT_CNTL_DPMS_BYTE 0x0055
-# define RADEON_CRTC_HSYNC_DIS_BYTE (1 << 0)
-# define RADEON_CRTC_VSYNC_DIS_BYTE (1 << 1)
-# define RADEON_CRTC_DISPLAY_DIS_BYTE (1 << 2)
-#define RADEON_CRTC_GEN_CNTL 0x0050
-# define RADEON_CRTC_DBL_SCAN_EN (1 << 0)
-# define RADEON_CRTC_INTERLACE_EN (1 << 1)
-# define RADEON_CRTC_CSYNC_EN (1 << 4)
-# define RADEON_CRTC_CUR_EN (1 << 16)
-# define RADEON_CRTC_CUR_MODE_MASK (7 << 17)
-# define RADEON_CRTC_ICON_EN (1 << 20)
-# define RADEON_CRTC_EXT_DISP_EN (1 << 24)
-# define RADEON_CRTC_EN (1 << 25)
-# define RADEON_CRTC_DISP_REQ_EN_B (1 << 26)
-#define RADEON_CRTC2_GEN_CNTL 0x03f8
-# define RADEON_CRTC2_DBL_SCAN_EN (1 << 0)
-# define RADEON_CRTC2_INTERLACE_EN (1 << 1)
-# define RADEON_CRTC2_SYNC_TRISTAT (1 << 4)
-# define RADEON_CRTC2_HSYNC_TRISTAT (1 << 5)
-# define RADEON_CRTC2_VSYNC_TRISTAT (1 << 6)
-# define RADEON_CRTC2_CRT2_ON (1 << 7)
-# define RADEON_CRTC2_ICON_EN (1 << 15)
-# define RADEON_CRTC2_CUR_EN (1 << 16)
-# define RADEON_CRTC2_CUR_MODE_MASK (7 << 20)
-# define RADEON_CRTC2_DISP_DIS (1 << 23)
-# define RADEON_CRTC2_EN (1 << 25)
-# define RADEON_CRTC2_DISP_REQ_EN_B (1 << 26)
-# define RADEON_CRTC2_CSYNC_EN (1 << 27)
-# define RADEON_CRTC2_HSYNC_DIS (1 << 28)
-# define RADEON_CRTC2_VSYNC_DIS (1 << 29)
-#define RADEON_CRTC_MORE_CNTL 0x27c
-# define RADEON_CRTC_H_CUTOFF_ACTIVE_EN (1<<4)
-# define RADEON_CRTC_V_CUTOFF_ACTIVE_EN (1<<5)
-#define RADEON_CRTC_GUI_TRIG_VLINE 0x0218
-#define RADEON_CRTC_H_SYNC_STRT_WID 0x0204
-# define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0)
-# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x3ff << 3)
-# define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3
-# define RADEON_CRTC_H_SYNC_WID (0x3f << 16)
-# define RADEON_CRTC_H_SYNC_WID_SHIFT 16
-# define RADEON_CRTC_H_SYNC_POL (1 << 23)
-#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304
-# define RADEON_CRTC2_H_SYNC_STRT_PIX (0x07 << 0)
-# define RADEON_CRTC2_H_SYNC_STRT_CHAR (0x3ff << 3)
-# define RADEON_CRTC2_H_SYNC_STRT_CHAR_SHIFT 3
-# define RADEON_CRTC2_H_SYNC_WID (0x3f << 16)
-# define RADEON_CRTC2_H_SYNC_WID_SHIFT 16
-# define RADEON_CRTC2_H_SYNC_POL (1 << 23)
-#define RADEON_CRTC_H_TOTAL_DISP 0x0200
-# define RADEON_CRTC_H_TOTAL (0x03ff << 0)
-# define RADEON_CRTC_H_TOTAL_SHIFT 0
-# define RADEON_CRTC_H_DISP (0x01ff << 16)
-# define RADEON_CRTC_H_DISP_SHIFT 16
-#define RADEON_CRTC2_H_TOTAL_DISP 0x0300
-# define RADEON_CRTC2_H_TOTAL (0x03ff << 0)
-# define RADEON_CRTC2_H_TOTAL_SHIFT 0
-# define RADEON_CRTC2_H_DISP (0x01ff << 16)
-# define RADEON_CRTC2_H_DISP_SHIFT 16
-#define RADEON_CRTC_OFFSET 0x0224
-#define RADEON_CRTC2_OFFSET 0x0324
-#define RADEON_CRTC_OFFSET_CNTL 0x0228
-# define RADEON_CRTC_TILE_EN (1 << 15)
-#define RADEON_CRTC2_OFFSET_CNTL 0x0328
-# define RADEON_CRTC2_TILE_EN (1 << 15)
-#define RADEON_CRTC_PITCH 0x022c
-#define RADEON_CRTC2_PITCH 0x032c
-#define RADEON_CRTC_STATUS 0x005c
-# define RADEON_CRTC_VBLANK_SAVE (1 << 1)
-# define RADEON_CRTC_VBLANK_SAVE_CLEAR (1 << 1)
-#define RADEON_CRTC2_STATUS 0x03fc
-# define RADEON_CRTC2_VBLANK_SAVE (1 << 1)
-# define RADEON_CRTC2_VBLANK_SAVE_CLEAR (1 << 1)
-#define RADEON_CRTC_V_SYNC_STRT_WID 0x020c
-# define RADEON_CRTC_V_SYNC_STRT (0x7ff << 0)
-# define RADEON_CRTC_V_SYNC_STRT_SHIFT 0
-# define RADEON_CRTC_V_SYNC_WID (0x1f << 16)
-# define RADEON_CRTC_V_SYNC_WID_SHIFT 16
-# define RADEON_CRTC_V_SYNC_POL (1 << 23)
-#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c
-# define RADEON_CRTC2_V_SYNC_STRT (0x7ff << 0)
-# define RADEON_CRTC2_V_SYNC_STRT_SHIFT 0
-# define RADEON_CRTC2_V_SYNC_WID (0x1f << 16)
-# define RADEON_CRTC2_V_SYNC_WID_SHIFT 16
-# define RADEON_CRTC2_V_SYNC_POL (1 << 23)
-#define RADEON_CRTC_V_TOTAL_DISP 0x0208
-# define RADEON_CRTC_V_TOTAL (0x07ff << 0)
-# define RADEON_CRTC_V_TOTAL_SHIFT 0
-# define RADEON_CRTC_V_DISP (0x07ff << 16)
-# define RADEON_CRTC_V_DISP_SHIFT 16
-#define RADEON_CRTC2_V_TOTAL_DISP 0x0308
-# define RADEON_CRTC2_V_TOTAL (0x07ff << 0)
-# define RADEON_CRTC2_V_TOTAL_SHIFT 0
-# define RADEON_CRTC2_V_DISP (0x07ff << 16)
-# define RADEON_CRTC2_V_DISP_SHIFT 16
-#define RADEON_CRTC_VLINE_CRNT_VLINE 0x0210
-# define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16)
-#define RADEON_CRTC2_CRNT_FRAME 0x0314
-#define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318
-#define RADEON_CRTC2_STATUS 0x03fc
-#define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310
-#define RADEON_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */
-#define RADEON_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */
-#define RADEON_CUR_CLR0 0x026c
-#define RADEON_CUR_CLR1 0x0270
-#define RADEON_CUR_HORZ_VERT_OFF 0x0268
-#define RADEON_CUR_HORZ_VERT_POSN 0x0264
-#define RADEON_CUR_OFFSET 0x0260
-# define RADEON_CUR_LOCK (1 << 31)
-#define RADEON_CUR2_CLR0 0x036c
-#define RADEON_CUR2_CLR1 0x0370
-#define RADEON_CUR2_HORZ_VERT_OFF 0x0368
-#define RADEON_CUR2_HORZ_VERT_POSN 0x0364
-#define RADEON_CUR2_OFFSET 0x0360
-# define RADEON_CUR2_LOCK (1 << 31)
-
-#define RADEON_DAC_CNTL 0x0058
-# define RADEON_DAC_RANGE_CNTL (3 << 0)
-# define RADEON_DAC_RANGE_CNTL_MASK 0x03
-# define RADEON_DAC_BLANKING (1 << 2)
-# define RADEON_DAC_CMP_EN (1 << 3)
-# define RADEON_DAC_CMP_OUTPUT (1 << 7)
-# define RADEON_DAC_8BIT_EN (1 << 8)
-# define RADEON_DAC_VGA_ADR_EN (1 << 13)
-# define RADEON_DAC_PDWN (1 << 15)
-# define RADEON_DAC_MASK_ALL (0xff << 24)
-#define RADEON_DAC_CNTL2 0x007c
-# define RADEON_DAC2_DAC_CLK_SEL (1 << 0)
-# define RADEON_DAC2_DAC2_CLK_SEL (1 << 1)
-# define RADEON_DAC2_PALETTE_ACC_CTL (1 << 5)
-#define RADEON_DAC_EXT_CNTL 0x0280
-# define RADEON_DAC_FORCE_BLANK_OFF_EN (1 << 4)
-# define RADEON_DAC_FORCE_DATA_EN (1 << 5)
-# define RADEON_DAC_FORCE_DATA_SEL_MASK (3 << 6)
-# define RADEON_DAC_FORCE_DATA_MASK 0x0003ff00
-# define RADEON_DAC_FORCE_DATA_SHIFT 8
-#define RADEON_TV_DAC_CNTL 0x088c
-# define RADEON_TV_DAC_STD_MASK 0x0300
-# define RADEON_TV_DAC_RDACPD (1 << 24)
-# define RADEON_TV_DAC_GDACPD (1 << 25)
-# define RADEON_TV_DAC_BDACPD (1 << 26)
-#define RADEON_DISP_HW_DEBUG 0x0d14
-# define RADEON_CRT2_DISP1_SEL (1 << 5)
-#define RADEON_DISP_OUTPUT_CNTL 0x0d64
-# define RADEON_DISP_DAC_SOURCE_MASK 0x03
-# define RADEON_DISP_DAC2_SOURCE_MASK 0x0c
-# define RADEON_DISP_DAC_SOURCE_CRTC2 0x01
-# define RADEON_DISP_DAC2_SOURCE_CRTC2 0x04
-#define RADEON_DAC_CRC_SIG 0x02cc
-#define RADEON_DAC_DATA 0x03c9 /* VGA */
-#define RADEON_DAC_MASK 0x03c6 /* VGA */
-#define RADEON_DAC_R_INDEX 0x03c7 /* VGA */
-#define RADEON_DAC_W_INDEX 0x03c8 /* VGA */
-#define RADEON_DDA_CONFIG 0x02e0
-#define RADEON_DDA_ON_OFF 0x02e4
-#define RADEON_DEFAULT_OFFSET 0x16e0
-#define RADEON_DEFAULT_PITCH 0x16e4
-#define RADEON_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
-# define RADEON_DEFAULT_SC_RIGHT_MAX (0x1fff << 0)
-# define RADEON_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
-#define RADEON_DESTINATION_3D_CLR_CMP_VAL 0x1820
-#define RADEON_DESTINATION_3D_CLR_CMP_MSK 0x1824
-#define RADEON_DEVICE_ID 0x0f02 /* PCI */
-#define RADEON_DISP_MISC_CNTL 0x0d00
-# define RADEON_SOFT_RESET_GRPH_PP (1 << 0)
-#define RADEON_DISP_MERGE_CNTL 0x0d60
-# define RADEON_DISP_ALPHA_MODE_MASK 0x03
-# define RADEON_DISP_ALPHA_MODE_KEY 0
-# define RADEON_DISP_ALPHA_MODE_PER_PIXEL 1
-# define RADEON_DISP_ALPHA_MODE_GLOBAL 2
-# define RADEON_DISP_RGB_OFFSET_EN (1<<8)
-# define RADEON_DISP_GRPH_ALPHA_MASK (0xff << 16)
-# define RADEON_DISP_OV0_ALPHA_MASK (0xff << 24)
-# define RADEON_DISP_LIN_TRANS_BYPASS (0x01 << 9)
-#define RADEON_DISP2_MERGE_CNTL 0x0d68
-# define RADEON_DISP2_RGB_OFFSET_EN (1<<8)
-#define RADEON_DISP_LIN_TRANS_GRPH_A 0x0d80
-#define RADEON_DISP_LIN_TRANS_GRPH_B 0x0d84
-#define RADEON_DISP_LIN_TRANS_GRPH_C 0x0d88
-#define RADEON_DISP_LIN_TRANS_GRPH_D 0x0d8c
-#define RADEON_DISP_LIN_TRANS_GRPH_E 0x0d90
-#define RADEON_DISP_LIN_TRANS_GRPH_F 0x0d98
-#define RADEON_DP_BRUSH_BKGD_CLR 0x1478
-#define RADEON_DP_BRUSH_FRGD_CLR 0x147c
-#define RADEON_DP_CNTL 0x16c0
-# define RADEON_DST_X_LEFT_TO_RIGHT (1 << 0)
-# define RADEON_DST_Y_TOP_TO_BOTTOM (1 << 1)
-#define RADEON_DP_CNTL_XDIR_YDIR_YMAJOR 0x16d0
-# define RADEON_DST_Y_MAJOR (1 << 2)
-# define RADEON_DST_Y_DIR_TOP_TO_BOTTOM (1 << 15)
-# define RADEON_DST_X_DIR_LEFT_TO_RIGHT (1 << 31)
-#define RADEON_DP_DATATYPE 0x16c4
-# define RADEON_HOST_BIG_ENDIAN_EN (1 << 29)
-#define RADEON_DP_GUI_MASTER_CNTL 0x146c
-# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
-# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
-# define RADEON_GMC_SRC_CLIPPING (1 << 2)
-# define RADEON_GMC_DST_CLIPPING (1 << 3)
-# define RADEON_GMC_BRUSH_DATATYPE_MASK (0x0f << 4)
-# define RADEON_GMC_BRUSH_8X8_MONO_FG_BG (0 << 4)
-# define RADEON_GMC_BRUSH_8X8_MONO_FG_LA (1 << 4)
-# define RADEON_GMC_BRUSH_1X8_MONO_FG_BG (4 << 4)
-# define RADEON_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4)
-# define RADEON_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4)
-# define RADEON_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4)
-# define RADEON_GMC_BRUSH_32x32_MONO_FG_BG (8 << 4)
-# define RADEON_GMC_BRUSH_32x32_MONO_FG_LA (9 << 4)
-# define RADEON_GMC_BRUSH_8x8_COLOR (10 << 4)
-# define RADEON_GMC_BRUSH_1X8_COLOR (12 << 4)
-# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4)
-# define RADEON_GMC_BRUSH_NONE (15 << 4)
-# define RADEON_GMC_DST_8BPP_CI (2 << 8)
-# define RADEON_GMC_DST_15BPP (3 << 8)
-# define RADEON_GMC_DST_16BPP (4 << 8)
-# define RADEON_GMC_DST_24BPP (5 << 8)
-# define RADEON_GMC_DST_32BPP (6 << 8)
-# define RADEON_GMC_DST_8BPP_RGB (7 << 8)
-# define RADEON_GMC_DST_Y8 (8 << 8)
-# define RADEON_GMC_DST_RGB8 (9 << 8)
-# define RADEON_GMC_DST_VYUY (11 << 8)
-# define RADEON_GMC_DST_YVYU (12 << 8)
-# define RADEON_GMC_DST_AYUV444 (14 << 8)
-# define RADEON_GMC_DST_ARGB4444 (15 << 8)
-# define RADEON_GMC_DST_DATATYPE_MASK (0x0f << 8)
-# define RADEON_GMC_DST_DATATYPE_SHIFT 8
-# define RADEON_GMC_SRC_DATATYPE_MASK (3 << 12)
-# define RADEON_GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12)
-# define RADEON_GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12)
-# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12)
-# define RADEON_GMC_BYTE_PIX_ORDER (1 << 14)
-# define RADEON_GMC_BYTE_MSB_TO_LSB (0 << 14)
-# define RADEON_GMC_BYTE_LSB_TO_MSB (1 << 14)
-# define RADEON_GMC_CONVERSION_TEMP (1 << 15)
-# define RADEON_GMC_CONVERSION_TEMP_6500 (0 << 15)
-# define RADEON_GMC_CONVERSION_TEMP_9300 (1 << 15)
-# define RADEON_GMC_ROP3_MASK (0xff << 16)
-# define RADEON_DP_SRC_SOURCE_MASK (7 << 24)
-# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24)
-# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24)
-# define RADEON_GMC_3D_FCN_EN (1 << 27)
-# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28)
-# define RADEON_GMC_AUX_CLIP_DIS (1 << 29)
-# define RADEON_GMC_WR_MSK_DIS (1 << 30)
-# define RADEON_GMC_LD_BRUSH_Y_X (1 << 31)
-# define RADEON_ROP3_ZERO 0x00000000
-# define RADEON_ROP3_DSa 0x00880000
-# define RADEON_ROP3_SDna 0x00440000
-# define RADEON_ROP3_S 0x00cc0000
-# define RADEON_ROP3_DSna 0x00220000
-# define RADEON_ROP3_D 0x00aa0000
-# define RADEON_ROP3_DSx 0x00660000
-# define RADEON_ROP3_DSo 0x00ee0000
-# define RADEON_ROP3_DSon 0x00110000
-# define RADEON_ROP3_DSxn 0x00990000
-# define RADEON_ROP3_Dn 0x00550000
-# define RADEON_ROP3_SDno 0x00dd0000
-# define RADEON_ROP3_Sn 0x00330000
-# define RADEON_ROP3_DSno 0x00bb0000
-# define RADEON_ROP3_DSan 0x00770000
-# define RADEON_ROP3_ONE 0x00ff0000
-# define RADEON_ROP3_DPa 0x00a00000
-# define RADEON_ROP3_PDna 0x00500000
-# define RADEON_ROP3_P 0x00f00000
-# define RADEON_ROP3_DPna 0x000a0000
-# define RADEON_ROP3_D 0x00aa0000
-# define RADEON_ROP3_DPx 0x005a0000
-# define RADEON_ROP3_DPo 0x00fa0000
-# define RADEON_ROP3_DPon 0x00050000
-# define RADEON_ROP3_PDxn 0x00a50000
-# define RADEON_ROP3_PDno 0x00f50000
-# define RADEON_ROP3_Pn 0x000f0000
-# define RADEON_ROP3_DPno 0x00af0000
-# define RADEON_ROP3_DPan 0x005f0000
-#define RADEON_DP_GUI_MASTER_CNTL_C 0x1c84
-#define RADEON_DP_MIX 0x16c8
-#define RADEON_DP_SRC_BKGD_CLR 0x15dc
-#define RADEON_DP_SRC_FRGD_CLR 0x15d8
-#define RADEON_DP_WRITE_MASK 0x16cc
-#define RADEON_DST_BRES_DEC 0x1630
-#define RADEON_DST_BRES_ERR 0x1628
-#define RADEON_DST_BRES_INC 0x162c
-#define RADEON_DST_BRES_LNTH 0x1634
-#define RADEON_DST_BRES_LNTH_SUB 0x1638
-#define RADEON_DST_HEIGHT 0x1410
-#define RADEON_DST_HEIGHT_WIDTH 0x143c
-#define RADEON_DST_HEIGHT_WIDTH_8 0x158c
-#define RADEON_DST_HEIGHT_WIDTH_BW 0x15b4
-#define RADEON_DST_HEIGHT_Y 0x15a0
-#define RADEON_DST_LINE_START 0x1600
-#define RADEON_DST_LINE_END 0x1604
-#define RADEON_DST_LINE_PATCOUNT 0x1608
-# define RADEON_BRES_CNTL_SHIFT 8
-#define RADEON_DST_OFFSET 0x1404
-#define RADEON_DST_PITCH 0x1408
-#define RADEON_DST_PITCH_OFFSET 0x142c
-#define RADEON_DST_PITCH_OFFSET_C 0x1c80
-# define RADEON_PITCH_SHIFT 21
-# define RADEON_DST_TILE_LINEAR (0 << 30)
-# define RADEON_DST_TILE_MACRO (1 << 30)
-# define RADEON_DST_TILE_MICRO (2 << 30)
-# define RADEON_DST_TILE_BOTH (3 << 30)
-#define RADEON_DST_WIDTH 0x140c
-#define RADEON_DST_WIDTH_HEIGHT 0x1598
-#define RADEON_DST_WIDTH_X 0x1588
-#define RADEON_DST_WIDTH_X_INCY 0x159c
-#define RADEON_DST_X 0x141c
-#define RADEON_DST_X_SUB 0x15a4
-#define RADEON_DST_X_Y 0x1594
-#define RADEON_DST_Y 0x1420
-#define RADEON_DST_Y_SUB 0x15a8
-#define RADEON_DST_Y_X 0x1438
-
-#define RADEON_FCP_CNTL 0x0910
-# define RADEON_FCP0_SRC_PCICLK 0
-# define RADEON_FCP0_SRC_PCLK 1
-# define RADEON_FCP0_SRC_PCLKb 2
-# define RADEON_FCP0_SRC_HREF 3
-# define RADEON_FCP0_SRC_GND 4
-# define RADEON_FCP0_SRC_HREFb 5
-#define RADEON_FLUSH_1 0x1704
-#define RADEON_FLUSH_2 0x1708
-#define RADEON_FLUSH_3 0x170c
-#define RADEON_FLUSH_4 0x1710
-#define RADEON_FLUSH_5 0x1714
-#define RADEON_FLUSH_6 0x1718
-#define RADEON_FLUSH_7 0x171c
-#define RADEON_FOG_3D_TABLE_START 0x1810
-#define RADEON_FOG_3D_TABLE_END 0x1814
-#define RADEON_FOG_3D_TABLE_DENSITY 0x181c
-#define RADEON_FOG_TABLE_INDEX 0x1a14
-#define RADEON_FOG_TABLE_DATA 0x1a18
-#define RADEON_FP_CRTC_H_TOTAL_DISP 0x0250
-#define RADEON_FP_CRTC_V_TOTAL_DISP 0x0254
-#define RADEON_FP_CRTC2_H_TOTAL_DISP 0x0350
-#define RADEON_FP_CRTC2_V_TOTAL_DISP 0x0354
-# define RADEON_FP_CRTC_H_TOTAL_MASK 0x000003ff
-# define RADEON_FP_CRTC_H_DISP_MASK 0x01ff0000
-# define RADEON_FP_CRTC_V_TOTAL_MASK 0x00000fff
-# define RADEON_FP_CRTC_V_DISP_MASK 0x0fff0000
-# define RADEON_FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8
-# define RADEON_FP_H_SYNC_WID_MASK 0x003f0000
-# define RADEON_FP_V_SYNC_STRT_MASK 0x00000fff
-# define RADEON_FP_V_SYNC_WID_MASK 0x001f0000
-# define RADEON_FP_CRTC_H_TOTAL_SHIFT 0x00000000
-# define RADEON_FP_CRTC_H_DISP_SHIFT 0x00000010
-# define RADEON_FP_CRTC_V_TOTAL_SHIFT 0x00000000
-# define RADEON_FP_CRTC_V_DISP_SHIFT 0x00000010
-# define RADEON_FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003
-# define RADEON_FP_H_SYNC_WID_SHIFT 0x00000010
-# define RADEON_FP_V_SYNC_STRT_SHIFT 0x00000000
-# define RADEON_FP_V_SYNC_WID_SHIFT 0x00000010
-#define RADEON_FP_GEN_CNTL 0x0284
-# define RADEON_FP_FPON (1 << 0)
-# define RADEON_FP_TMDS_EN (1 << 2)
-# define RADEON_FP_PANEL_FORMAT (1 << 3)
-# define RADEON_FP_EN_TMDS (1 << 7)
-# define RADEON_FP_DETECT_SENSE (1 << 8)
-# define RADEON_FP_SEL_CRTC2 (1 << 13)
-# define RADEON_FP_CRTC_DONT_SHADOW_HPAR (1 << 15)
-# define RADEON_FP_CRTC_DONT_SHADOW_VPAR (1 << 16)
-# define RADEON_FP_CRTC_DONT_SHADOW_HEND (1 << 17)
-# define RADEON_FP_CRTC_USE_SHADOW_VEND (1 << 18)
-# define RADEON_FP_RMX_HVSYNC_CONTROL_EN (1 << 20)
-# define RADEON_FP_DFP_SYNC_SEL (1 << 21)
-# define RADEON_FP_CRTC_LOCK_8DOT (1 << 22)
-# define RADEON_FP_CRT_SYNC_SEL (1 << 23)
-# define RADEON_FP_USE_SHADOW_EN (1 << 24)
-# define RADEON_FP_CRT_SYNC_ALT (1 << 26)
-#define RADEON_FP2_GEN_CNTL 0x0288
-# define RADEON_FP2_BLANK_EN (1 << 1)
-# define RADEON_FP2_ON (1 << 2)
-# define RADEON_FP2_PANEL_FORMAT (1 << 3)
-# define RADEON_FP2_SOURCE_SEL_MASK (3 << 10)
-# define RADEON_FP2_SOURCE_SEL_CRTC2 (1 << 10)
-# define RADEON_FP2_SRC_SEL_MASK (3 << 13)
-# define RADEON_FP2_SRC_SEL_CRTC2 (1 << 13)
-# define RADEON_FP2_FP_POL (1 << 16)
-# define RADEON_FP2_LP_POL (1 << 17)
-# define RADEON_FP2_SCK_POL (1 << 18)
-# define RADEON_FP2_LCD_CNTL_MASK (7 << 19)
-# define RADEON_FP2_PAD_FLOP_EN (1 << 22)
-# define RADEON_FP2_CRC_EN (1 << 23)
-# define RADEON_FP2_CRC_READ_EN (1 << 24)
-# define RADEON_FP2_DV0_EN (1 << 25)
-# define RADEON_FP2_DV0_RATE_SEL_SDR (1 << 26)
-#define RADEON_FP_H_SYNC_STRT_WID 0x02c4
-#define RADEON_FP_H2_SYNC_STRT_WID 0x03c4
-#define RADEON_FP_HORZ_STRETCH 0x028c
-#define RADEON_FP_HORZ2_STRETCH 0x038c
-# define RADEON_HORZ_STRETCH_RATIO_MASK 0xffff
-# define RADEON_HORZ_STRETCH_RATIO_MAX 4096
-# define RADEON_HORZ_PANEL_SIZE (0x1ff << 16)
-# define RADEON_HORZ_PANEL_SHIFT 16
-# define RADEON_HORZ_STRETCH_PIXREP (0 << 25)
-# define RADEON_HORZ_STRETCH_BLEND (1 << 26)
-# define RADEON_HORZ_STRETCH_ENABLE (1 << 25)
-# define RADEON_HORZ_AUTO_RATIO (1 << 27)
-# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 28)
-# define RADEON_HORZ_AUTO_RATIO_INC (1 << 31)
-#define RADEON_FP_V_SYNC_STRT_WID 0x02c8
-#define RADEON_FP_VERT_STRETCH 0x0290
-#define RADEON_FP_V2_SYNC_STRT_WID 0x03c8
-#define RADEON_FP_VERT2_STRETCH 0x0390
-# define RADEON_VERT_PANEL_SIZE (0xfff << 12)
-# define RADEON_VERT_PANEL_SHIFT 12
-# define RADEON_VERT_STRETCH_RATIO_MASK 0xfff
-# define RADEON_VERT_STRETCH_RATIO_SHIFT 0
-# define RADEON_VERT_STRETCH_RATIO_MAX 4096
-# define RADEON_VERT_STRETCH_ENABLE (1 << 25)
-# define RADEON_VERT_STRETCH_LINEREP (0 << 26)
-# define RADEON_VERT_STRETCH_BLEND (1 << 26)
-# define RADEON_VERT_AUTO_RATIO_EN (1 << 27)
-# define RADEON_VERT_STRETCH_RESERVED 0xf1000000
-
-#define RADEON_GEN_INT_CNTL 0x0040
-#define RADEON_GEN_INT_STATUS 0x0044
-# define RADEON_VSYNC_INT_AK (1 << 2)
-# define RADEON_VSYNC_INT (1 << 2)
-# define RADEON_VSYNC2_INT_AK (1 << 6)
-# define RADEON_VSYNC2_INT (1 << 6)
-#define RADEON_GENENB 0x03c3 /* VGA */
-#define RADEON_GENFC_RD 0x03ca /* VGA */
-#define RADEON_GENFC_WT 0x03da /* VGA, 0x03ba */
-#define RADEON_GENMO_RD 0x03cc /* VGA */
-#define RADEON_GENMO_WT 0x03c2 /* VGA */
-#define RADEON_GENS0 0x03c2 /* VGA */
-#define RADEON_GENS1 0x03da /* VGA, 0x03ba */
-#define RADEON_GPIO_MONID 0x0068 /* DDC interface via I2C */
-#define RADEON_GPIO_MONIDB 0x006c
-#define RADEON_GPIO_CRT2_DDC 0x006c
-#define RADEON_GPIO_DVI_DDC 0x0064
-#define RADEON_GPIO_VGA_DDC 0x0060
-# define RADEON_GPIO_A_0 (1 << 0)
-# define RADEON_GPIO_A_1 (1 << 1)
-# define RADEON_GPIO_Y_0 (1 << 8)
-# define RADEON_GPIO_Y_1 (1 << 9)
-# define RADEON_GPIO_Y_SHIFT_0 8
-# define RADEON_GPIO_Y_SHIFT_1 9
-# define RADEON_GPIO_EN_0 (1 << 16)
-# define RADEON_GPIO_EN_1 (1 << 17)
-# define RADEON_GPIO_MASK_0 (1 << 24) /*??*/
-# define RADEON_GPIO_MASK_1 (1 << 25) /*??*/
-#define RADEON_GRPH8_DATA 0x03cf /* VGA */
-#define RADEON_GRPH8_IDX 0x03ce /* VGA */
-#define RADEON_GUI_SCRATCH_REG0 0x15e0
-#define RADEON_GUI_SCRATCH_REG1 0x15e4
-#define RADEON_GUI_SCRATCH_REG2 0x15e8
-#define RADEON_GUI_SCRATCH_REG3 0x15ec
-#define RADEON_GUI_SCRATCH_REG4 0x15f0
-#define RADEON_GUI_SCRATCH_REG5 0x15f4
-
-#define RADEON_HEADER 0x0f0e /* PCI */
-#define RADEON_HOST_DATA0 0x17c0
-#define RADEON_HOST_DATA1 0x17c4
-#define RADEON_HOST_DATA2 0x17c8
-#define RADEON_HOST_DATA3 0x17cc
-#define RADEON_HOST_DATA4 0x17d0
-#define RADEON_HOST_DATA5 0x17d4
-#define RADEON_HOST_DATA6 0x17d8
-#define RADEON_HOST_DATA7 0x17dc
-#define RADEON_HOST_DATA_LAST 0x17e0
-#define RADEON_HOST_PATH_CNTL 0x0130
-# define RADEON_HDP_SOFT_RESET (1 << 26)
-#define RADEON_HTOTAL_CNTL 0x0009 /* PLL */
-#define RADEON_HTOTAL2_CNTL 0x002e /* PLL */
-
-#define RADEON_I2C_CNTL_1 0x0094 /* ? */
-#define RADEON_DVI_I2C_CNTL_1 0x02e4 /* ? */
-#define RADEON_INTERRUPT_LINE 0x0f3c /* PCI */
-#define RADEON_INTERRUPT_PIN 0x0f3d /* PCI */
-#define RADEON_IO_BASE 0x0f14 /* PCI */
-
-#define RADEON_LATENCY 0x0f0d /* PCI */
-#define RADEON_LEAD_BRES_DEC 0x1608
-#define RADEON_LEAD_BRES_LNTH 0x161c
-#define RADEON_LEAD_BRES_LNTH_SUB 0x1624
-#define RADEON_LVDS_GEN_CNTL 0x02d0
-# define RADEON_LVDS_ON (1 << 0)
-# define RADEON_LVDS_DISPLAY_DIS (1 << 1)
-# define RADEON_LVDS_PANEL_TYPE (1 << 2)
-# define RADEON_LVDS_PANEL_FORMAT (1 << 3)
-# define RADEON_LVDS_EN (1 << 7)
-# define RADEON_LVDS_DIGON (1 << 18)
-# define RADEON_LVDS_BLON (1 << 19)
-# define RADEON_LVDS_SEL_CRTC2 (1 << 23)
-#define RADEON_LVDS_PLL_CNTL 0x02d4
-# define RADEON_HSYNC_DELAY_SHIFT 28
-# define RADEON_HSYNC_DELAY_MASK (0xf << 28)
-
-#define RADEON_MAX_LATENCY 0x0f3f /* PCI */
-#define RADEON_MC_AGP_LOCATION 0x014c
-#define RADEON_MC_FB_LOCATION 0x0148
-#define RADEON_DISPLAY_BASE_ADDR 0x23c
-#define RADEON_DISPLAY2_BASE_ADDR 0x33c
-#define RADEON_OV0_BASE_ADDR 0x43c
-#define RADEON_NB_TOM 0x15c
-#define RADEON_MCLK_CNTL 0x0012 /* PLL */
-# define RADEON_FORCEON_MCLKA (1 << 16)
-# define RADEON_FORCEON_MCLKB (1 << 17)
-# define RADEON_FORCEON_YCLKA (1 << 18)
-# define RADEON_FORCEON_YCLKB (1 << 19)
-# define RADEON_FORCEON_MC (1 << 20)
-# define RADEON_FORCEON_AIC (1 << 21)
-#define RADEON_MDGPIO_A_REG 0x01ac
-#define RADEON_MDGPIO_EN_REG 0x01b0
-#define RADEON_MDGPIO_MASK 0x0198
-#define RADEON_MDGPIO_Y_REG 0x01b4
-#define RADEON_MEM_ADDR_CONFIG 0x0148
-#define RADEON_MEM_BASE 0x0f10 /* PCI */
-#define RADEON_MEM_CNTL 0x0140
-# define RADEON_MEM_NUM_CHANNELS_MASK 0x01
-# define RADEON_MEM_USE_B_CH_ONLY (1<<1)
-# define RV100_HALF_MODE (1<<3)
-# define R300_MEM_NUM_CHANNELS_MASK 0x03
-# define R300_MEM_USE_CD_CH_ONLY (1<<2)
-#define RADEON_MEM_TIMING_CNTL 0x0144 /* EXT_MEM_CNTL */
-#define RADEON_MEM_INIT_LAT_TIMER 0x0154
-#define RADEON_MEM_INTF_CNTL 0x014c
-#define RADEON_MEM_SDRAM_MODE_REG 0x0158
-#define RADEON_MEM_STR_CNTL 0x0150
-#define RADEON_MEM_VGA_RP_SEL 0x003c
-#define RADEON_MEM_VGA_WP_SEL 0x0038
-#define RADEON_MIN_GRANT 0x0f3e /* PCI */
-#define RADEON_MM_DATA 0x0004
-#define RADEON_MM_INDEX 0x0000
-#define RADEON_MPLL_CNTL 0x000e /* PLL */
-#define RADEON_MPP_TB_CONFIG 0x01c0 /* ? */
-#define RADEON_MPP_GP_CONFIG 0x01c8 /* ? */
-#define R300_MC_IND_INDEX 0x01f8
-# define R300_MC_IND_ADDR_MASK 0x3f
-#define R300_MC_IND_DATA 0x01fc
-#define R300_MC_READ_CNTL_AB 0x017c
-# define R300_MEM_RBS_POSITION_A_MASK 0x03
-#define R300_MC_READ_CNTL_CD_mcind 0x24
-# define R300_MEM_RBS_POSITION_C_MASK 0x03
-
-#define RADEON_N_VIF_COUNT 0x0248
-
-#define RADEON_OV0_AUTO_FLIP_CNTL 0x0470
-#define RADEON_OV0_COLOUR_CNTL 0x04E0
-#define RADEON_OV0_DEINTERLACE_PATTERN 0x0474
-#define RADEON_OV0_EXCLUSIVE_HORZ 0x0408
-# define RADEON_EXCL_HORZ_START_MASK 0x000000ff
-# define RADEON_EXCL_HORZ_END_MASK 0x0000ff00
-# define RADEON_EXCL_HORZ_BACK_PORCH_MASK 0x00ff0000
-# define RADEON_EXCL_HORZ_EXCLUSIVE_EN 0x80000000
-#define RADEON_OV0_EXCLUSIVE_VERT 0x040C
-# define RADEON_EXCL_VERT_START_MASK 0x000003ff
-# define RADEON_EXCL_VERT_END_MASK 0x03ff0000
-#define RADEON_OV0_FILTER_CNTL 0x04A0
-#define RADEON_OV0_FOUR_TAP_COEF_0 0x04B0
-#define RADEON_OV0_FOUR_TAP_COEF_1 0x04B4
-#define RADEON_OV0_FOUR_TAP_COEF_2 0x04B8
-#define RADEON_OV0_FOUR_TAP_COEF_3 0x04BC
-#define RADEON_OV0_FOUR_TAP_COEF_4 0x04C0
-#define RADEON_OV0_GAMMA_000_00F 0x0d40
-#define RADEON_OV0_GAMMA_010_01F 0x0d44
-#define RADEON_OV0_GAMMA_020_03F 0x0d48
-#define RADEON_OV0_GAMMA_040_07F 0x0d4c
-#define RADEON_OV0_GAMMA_080_0BF 0x0e00
-#define RADEON_OV0_GAMMA_0C0_0FF 0x0e04
-#define RADEON_OV0_GAMMA_100_13F 0x0e08
-#define RADEON_OV0_GAMMA_140_17F 0x0e0c
-#define RADEON_OV0_GAMMA_180_1BF 0x0e10
-#define RADEON_OV0_GAMMA_1C0_1FF 0x0e14
-#define RADEON_OV0_GAMMA_200_23F 0x0e18
-#define RADEON_OV0_GAMMA_240_27F 0x0e1c
-#define RADEON_OV0_GAMMA_280_2BF 0x0e20
-#define RADEON_OV0_GAMMA_2C0_2FF 0x0e24
-#define RADEON_OV0_GAMMA_300_33F 0x0e28
-#define RADEON_OV0_GAMMA_340_37F 0x0e2c
-#define RADEON_OV0_GAMMA_380_3BF 0x0d50
-#define RADEON_OV0_GAMMA_3C0_3FF 0x0d54
-#define RADEON_OV0_GRAPHICS_KEY_CLR_LOW 0x04EC
-#define RADEON_OV0_GRAPHICS_KEY_CLR_HIGH 0x04F0
-#define RADEON_OV0_H_INC 0x0480
-#define RADEON_OV0_KEY_CNTL 0x04F4
-# define RADEON_VIDEO_KEY_FN_MASK 0x00000003L
-# define RADEON_VIDEO_KEY_FN_FALSE 0x00000000L
-# define RADEON_VIDEO_KEY_FN_TRUE 0x00000001L
-# define RADEON_VIDEO_KEY_FN_EQ 0x00000002L
-# define RADEON_VIDEO_KEY_FN_NE 0x00000003L
-# define RADEON_GRAPHIC_KEY_FN_MASK 0x00000030L
-# define RADEON_GRAPHIC_KEY_FN_FALSE 0x00000000L
-# define RADEON_GRAPHIC_KEY_FN_TRUE 0x00000010L
-# define RADEON_GRAPHIC_KEY_FN_EQ 0x00000020L
-# define RADEON_GRAPHIC_KEY_FN_NE 0x00000030L
-# define RADEON_CMP_MIX_MASK 0x00000100L
-# define RADEON_CMP_MIX_OR 0x00000000L
-# define RADEON_CMP_MIX_AND 0x00000100L
-#define RADEON_OV0_LIN_TRANS_A 0x0d20
-#define RADEON_OV0_LIN_TRANS_B 0x0d24
-#define RADEON_OV0_LIN_TRANS_C 0x0d28
-#define RADEON_OV0_LIN_TRANS_D 0x0d2c
-#define RADEON_OV0_LIN_TRANS_E 0x0d30
-#define RADEON_OV0_LIN_TRANS_F 0x0d34
-#define RADEON_OV0_P1_BLANK_LINES_AT_TOP 0x0430
-# define RADEON_P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL
-# define RADEON_P1_ACTIVE_LINES_M1 0x0fff0000L
-#define RADEON_OV0_P1_H_ACCUM_INIT 0x0488
-#define RADEON_OV0_P1_V_ACCUM_INIT 0x0428
-# define RADEON_OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L
-# define RADEON_OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L
-#define RADEON_OV0_P1_X_START_END 0x0494
-#define RADEON_OV0_P2_X_START_END 0x0498
-#define RADEON_OV0_P23_BLANK_LINES_AT_TOP 0x0434
-# define RADEON_P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL
-# define RADEON_P23_ACTIVE_LINES_M1 0x07ff0000L
-#define RADEON_OV0_P23_H_ACCUM_INIT 0x048C
-#define RADEON_OV0_P23_V_ACCUM_INIT 0x042C
-#define RADEON_OV0_P3_X_START_END 0x049C
-#define RADEON_OV0_REG_LOAD_CNTL 0x0410
-# define RADEON_REG_LD_CTL_LOCK 0x00000001L
-# define RADEON_REG_LD_CTL_VBLANK_DURING_LOCK 0x00000002L
-# define RADEON_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L
-# define RADEON_REG_LD_CTL_LOCK_READBACK 0x00000008L
-#define RADEON_OV0_SCALE_CNTL 0x0420
-# define RADEON_SCALER_HORZ_PICK_NEAREST 0x00000004L
-# define RADEON_SCALER_VERT_PICK_NEAREST 0x00000008L
-# define RADEON_SCALER_SIGNED_UV 0x00000010L
-# define RADEON_SCALER_GAMMA_SEL_MASK 0x00000060L
-# define RADEON_SCALER_GAMMA_SEL_BRIGHT 0x00000000L
-# define RADEON_SCALER_GAMMA_SEL_G22 0x00000020L
-# define RADEON_SCALER_GAMMA_SEL_G18 0x00000040L
-# define RADEON_SCALER_GAMMA_SEL_G14 0x00000060L
-# define RADEON_SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L
-# define RADEON_SCALER_SURFAC_FORMAT 0x00000f00L
-# define RADEON_SCALER_SOURCE_15BPP 0x00000300L
-# define RADEON_SCALER_SOURCE_16BPP 0x00000400L
-# define RADEON_SCALER_SOURCE_32BPP 0x00000600L
-# define RADEON_SCALER_SOURCE_YUV9 0x00000900L
-# define RADEON_SCALER_SOURCE_YUV12 0x00000A00L
-# define RADEON_SCALER_SOURCE_VYUY422 0x00000B00L
-# define RADEON_SCALER_SOURCE_YVYU422 0x00000C00L
-# define RADEON_SCALER_ADAPTIVE_DEINT 0x00001000L
-# define RADEON_SCALER_TEMPORAL_DEINT 0x00002000L
-# define RADEON_SCALER_SMART_SWITCH 0x00008000L
-# define RADEON_SCALER_BURST_PER_PLANE 0x007F0000L
-# define RADEON_SCALER_DOUBLE_BUFFER 0x01000000L
-# define RADEON_SCALER_DIS_LIMIT 0x08000000L
-# define RADEON_SCALER_INT_EMU 0x20000000L
-# define RADEON_SCALER_ENABLE 0x40000000L
-# define RADEON_SCALER_SOFT_RESET 0x80000000L
-# define RADEON_SCALER_ADAPTIVE_DEINT 0x00001000L
-#define RADEON_OV0_STEP_BY 0x0484
-#define RADEON_OV0_TEST 0x04F8
-#define RADEON_OV0_V_INC 0x0424
-#define RADEON_OV0_VID_BUF_PITCH0_VALUE 0x0460
-#define RADEON_OV0_VID_BUF_PITCH1_VALUE 0x0464
-#define RADEON_OV0_VID_BUF0_BASE_ADRS 0x0440
-# define RADEON_VIF_BUF0_PITCH_SEL 0x00000001L
-# define RADEON_VIF_BUF0_TILE_ADRS 0x00000002L
-# define RADEON_VIF_BUF0_BASE_ADRS_MASK 0x03fffff0L
-# define RADEON_VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L
-#define RADEON_OV0_VID_BUF1_BASE_ADRS 0x0444
-# define RADEON_VIF_BUF1_PITCH_SEL 0x00000001L
-# define RADEON_VIF_BUF1_TILE_ADRS 0x00000002L
-# define RADEON_VIF_BUF1_BASE_ADRS_MASK 0x03fffff0L
-# define RADEON_VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L
-#define RADEON_OV0_VID_BUF2_BASE_ADRS 0x0448
-# define RADEON_VIF_BUF2_PITCH_SEL 0x00000001L
-# define RADEON_VIF_BUF2_TILE_ADRS 0x00000002L
-# define RADEON_VIF_BUF2_BASE_ADRS_MASK 0x03fffff0L
-# define RADEON_VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L
-#define RADEON_OV0_VID_BUF3_BASE_ADRS 0x044C
-#define RADEON_OV0_VID_BUF4_BASE_ADRS 0x0450
-#define RADEON_OV0_VID_BUF5_BASE_ADRS 0x0454
-#define RADEON_OV0_VIDEO_KEY_CLR_HIGH 0x04E8
-#define RADEON_OV0_VIDEO_KEY_CLR_LOW 0x04E4
-#define RADEON_OV0_Y_X_START 0x0400
-#define RADEON_OV0_Y_X_END 0x0404
-#define RADEON_OV1_Y_X_START 0x0600
-#define RADEON_OV1_Y_X_END 0x0604
-#define RADEON_OVR_CLR 0x0230
-#define RADEON_OVR_WID_LEFT_RIGHT 0x0234
-#define RADEON_OVR_WID_TOP_BOTTOM 0x0238
-
-#define RADEON_P2PLL_CNTL 0x002a /* P2PLL */
-# define RADEON_P2PLL_RESET (1 << 0)
-# define RADEON_P2PLL_SLEEP (1 << 1)
-# define RADEON_P2PLL_ATOMIC_UPDATE_EN (1 << 16)
-# define RADEON_P2PLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
-# define RADEON_P2PLL_ATOMIC_UPDATE_VSYNC (1 << 18)
-#define RADEON_P2PLL_DIV_0 0x002c
-# define RADEON_P2PLL_FB0_DIV_MASK 0x07ff
-# define RADEON_P2PLL_POST0_DIV_MASK 0x00070000
-#define RADEON_P2PLL_REF_DIV 0x002B /* PLL */
-# define RADEON_P2PLL_REF_DIV_MASK 0x03ff
-# define RADEON_P2PLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */
-# define RADEON_P2PLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */
-# define R300_PPLL_REF_DIV_ACC_MASK (0x3ff << 18)
-# define R300_PPLL_REF_DIV_ACC_SHIFT 18
-#define RADEON_PALETTE_DATA 0x00b4
-#define RADEON_PALETTE_30_DATA 0x00b8
-#define RADEON_PALETTE_INDEX 0x00b0
-#define RADEON_PCI_GART_PAGE 0x017c
-#define RADEON_PIXCLKS_CNTL 0x002d
-# define RADEON_PIX2CLK_SRC_SEL_MASK 0x03
-# define RADEON_PIX2CLK_SRC_SEL_CPUCLK 0x00
-# define RADEON_PIX2CLK_SRC_SEL_PSCANCLK 0x01
-# define RADEON_PIX2CLK_SRC_SEL_BYTECLK 0x02
-# define RADEON_PIX2CLK_SRC_SEL_P2PLLCLK 0x03
-# define RADEON_PIX2CLK_ALWAYS_ONb (1<<6)
-# define RADEON_PIX2CLK_DAC_ALWAYS_ONb (1<<7)
-# define RADEON_PIXCLK_TV_SRC_SEL (1 << 8)
-# define RADEON_PIXCLK_LVDS_ALWAYS_ONb (1 << 14)
-# define RADEON_PIXCLK_TMDS_ALWAYS_ONb (1 << 15)
-#define RADEON_PLANE_3D_MASK_C 0x1d44
-#define RADEON_PLL_TEST_CNTL 0x0013 /* PLL */
-#define RADEON_PMI_CAP_ID 0x0f5c /* PCI */
-#define RADEON_PMI_DATA 0x0f63 /* PCI */
-#define RADEON_PMI_NXT_CAP_PTR 0x0f5d /* PCI */
-#define RADEON_PMI_PMC_REG 0x0f5e /* PCI */
-#define RADEON_PMI_PMCSR_REG 0x0f60 /* PCI */
-#define RADEON_PMI_REGISTER 0x0f5c /* PCI */
-#define RADEON_PPLL_CNTL 0x0002 /* PLL */
-# define RADEON_PPLL_RESET (1 << 0)
-# define RADEON_PPLL_SLEEP (1 << 1)
-# define RADEON_PPLL_ATOMIC_UPDATE_EN (1 << 16)
-# define RADEON_PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
-# define RADEON_PPLL_ATOMIC_UPDATE_VSYNC (1 << 18)
-#define RADEON_PPLL_DIV_0 0x0004 /* PLL */
-#define RADEON_PPLL_DIV_1 0x0005 /* PLL */
-#define RADEON_PPLL_DIV_2 0x0006 /* PLL */
-#define RADEON_PPLL_DIV_3 0x0007 /* PLL */
-# define RADEON_PPLL_FB3_DIV_MASK 0x07ff
-# define RADEON_PPLL_POST3_DIV_MASK 0x00070000
-#define RADEON_PPLL_REF_DIV 0x0003 /* PLL */
-# define RADEON_PPLL_REF_DIV_MASK 0x03ff
-# define RADEON_PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */
-# define RADEON_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */
-#define RADEON_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */
-
-#define RADEON_RBBM_GUICNTL 0x172c
-# define RADEON_HOST_DATA_SWAP_NONE (0 << 0)
-# define RADEON_HOST_DATA_SWAP_16BIT (1 << 0)
-# define RADEON_HOST_DATA_SWAP_32BIT (2 << 0)
-# define RADEON_HOST_DATA_SWAP_HDW (3 << 0)
-#define RADEON_RBBM_SOFT_RESET 0x00f0
-# define RADEON_SOFT_RESET_CP (1 << 0)
-# define RADEON_SOFT_RESET_HI (1 << 1)
-# define RADEON_SOFT_RESET_SE (1 << 2)
-# define RADEON_SOFT_RESET_RE (1 << 3)
-# define RADEON_SOFT_RESET_PP (1 << 4)
-# define RADEON_SOFT_RESET_E2 (1 << 5)
-# define RADEON_SOFT_RESET_RB (1 << 6)
-# define RADEON_SOFT_RESET_HDP (1 << 7)
-#define RADEON_RBBM_STATUS 0x0e40
-# define RADEON_RBBM_FIFOCNT_MASK 0x007f
-# define RADEON_RBBM_ACTIVE (1 << 31)
-#define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c
-# define RADEON_RB2D_DC_FLUSH (3 << 0)
-# define RADEON_RB2D_DC_FREE (3 << 2)
-# define RADEON_RB2D_DC_FLUSH_ALL 0xf
-# define RADEON_RB2D_DC_BUSY (1 << 31)
-#define RADEON_RB2D_DSTCACHE_MODE 0x3428
-#define RADEON_REG_BASE 0x0f18 /* PCI */
-#define RADEON_REGPROG_INF 0x0f09 /* PCI */
-#define RADEON_REVISION_ID 0x0f08 /* PCI */
-
-#define RADEON_SC_BOTTOM 0x164c
-#define RADEON_SC_BOTTOM_RIGHT 0x16f0
-#define RADEON_SC_BOTTOM_RIGHT_C 0x1c8c
-#define RADEON_SC_LEFT 0x1640
-#define RADEON_SC_RIGHT 0x1644
-#define RADEON_SC_TOP 0x1648
-#define RADEON_SC_TOP_LEFT 0x16ec
-#define RADEON_SC_TOP_LEFT_C 0x1c88
-# define RADEON_SC_SIGN_MASK_LO 0x8000
-# define RADEON_SC_SIGN_MASK_HI 0x80000000
-#define RADEON_SCLK_CNTL 0x000d /* PLL */
-# define RADEON_DYN_STOP_LAT_MASK 0x00007ff8
-# define RADEON_CP_MAX_DYN_STOP_LAT 0x0008
-# define RADEON_SCLK_FORCEON_MASK 0xffff8000
-#define RADEON_SCLK_MORE_CNTL 0x0035 /* PLL */
-# define RADEON_SCLK_MORE_FORCEON 0x0700
-#define RADEON_SDRAM_MODE_REG 0x0158
-#define RADEON_SEQ8_DATA 0x03c5 /* VGA */
-#define RADEON_SEQ8_IDX 0x03c4 /* VGA */
-#define RADEON_SNAPSHOT_F_COUNT 0x0244
-#define RADEON_SNAPSHOT_VH_COUNTS 0x0240
-#define RADEON_SNAPSHOT_VIF_COUNT 0x024c
-#define RADEON_SRC_OFFSET 0x15ac
-#define RADEON_SRC_PITCH 0x15b0
-#define RADEON_SRC_PITCH_OFFSET 0x1428
-#define RADEON_SRC_SC_BOTTOM 0x165c
-#define RADEON_SRC_SC_BOTTOM_RIGHT 0x16f4
-#define RADEON_SRC_SC_RIGHT 0x1654
-#define RADEON_SRC_X 0x1414
-#define RADEON_SRC_X_Y 0x1590
-#define RADEON_SRC_Y 0x1418
-#define RADEON_SRC_Y_X 0x1434
-#define RADEON_STATUS 0x0f06 /* PCI */
-#define RADEON_SUBPIC_CNTL 0x0540 /* ? */
-#define RADEON_SUB_CLASS 0x0f0a /* PCI */
-#define RADEON_SURFACE_CNTL 0x0b00
-# define RADEON_SURF_TRANSLATION_DIS (1 << 8)
-# define RADEON_NONSURF_AP0_SWP_16BPP (1 << 20)
-# define RADEON_NONSURF_AP0_SWP_32BPP (1 << 21)
-#define RADEON_SURFACE0_INFO 0x0b0c
-# define RADEON_SURF_TILE_COLOR_MACRO (0 << 16)
-# define RADEON_SURF_TILE_COLOR_BOTH (1 << 16)
-# define RADEON_SURF_TILE_DEPTH_32BPP (2 << 16)
-# define RADEON_SURF_TILE_DEPTH_16BPP (3 << 16)
-# define R200_SURF_TILE_NONE (0 << 16)
-# define R200_SURF_TILE_COLOR_MACRO (1 << 16)
-# define R200_SURF_TILE_COLOR_MICRO (2 << 16)
-# define R200_SURF_TILE_COLOR_BOTH (3 << 16)
-# define R200_SURF_TILE_DEPTH_32BPP (4 << 16)
-# define R200_SURF_TILE_DEPTH_16BPP (5 << 16)
-# define RADEON_SURF_AP0_SWP_16BPP (1 << 20)
-# define RADEON_SURF_AP0_SWP_32BPP (1 << 21)
-# define RADEON_SURF_AP1_SWP_16BPP (1 << 22)
-# define RADEON_SURF_AP1_SWP_32BPP (1 << 23)
-#define RADEON_SURFACE0_LOWER_BOUND 0x0b04
-#define RADEON_SURFACE0_UPPER_BOUND 0x0b08
-#define RADEON_SURFACE1_INFO 0x0b1c
-#define RADEON_SURFACE1_LOWER_BOUND 0x0b14
-#define RADEON_SURFACE1_UPPER_BOUND 0x0b18
-#define RADEON_SURFACE2_INFO 0x0b2c
-#define RADEON_SURFACE2_LOWER_BOUND 0x0b24
-#define RADEON_SURFACE2_UPPER_BOUND 0x0b28
-#define RADEON_SURFACE3_INFO 0x0b3c
-#define RADEON_SURFACE3_LOWER_BOUND 0x0b34
-#define RADEON_SURFACE3_UPPER_BOUND 0x0b38
-#define RADEON_SURFACE4_INFO 0x0b4c
-#define RADEON_SURFACE4_LOWER_BOUND 0x0b44
-#define RADEON_SURFACE4_UPPER_BOUND 0x0b48
-#define RADEON_SURFACE5_INFO 0x0b5c
-#define RADEON_SURFACE5_LOWER_BOUND 0x0b54
-#define RADEON_SURFACE5_UPPER_BOUND 0x0b58
-#define RADEON_SURFACE6_INFO 0x0b6c
-#define RADEON_SURFACE6_LOWER_BOUND 0x0b64
-#define RADEON_SURFACE6_UPPER_BOUND 0x0b68
-#define RADEON_SURFACE7_INFO 0x0b7c
-#define RADEON_SURFACE7_LOWER_BOUND 0x0b74
-#define RADEON_SURFACE7_UPPER_BOUND 0x0b78
-#define RADEON_SW_SEMAPHORE 0x013c
-
-#define RADEON_TEST_DEBUG_CNTL 0x0120
-#define RADEON_TEST_DEBUG_MUX 0x0124
-#define RADEON_TEST_DEBUG_OUT 0x012c
-#define RADEON_TMDS_PLL_CNTL 0x02a8
-#define RADEON_TMDS_TRANSMITTER_CNTL 0x02a4
-# define RADEON_TMDS_TRANSMITTER_PLLEN 1
-# define RADEON_TMDS_TRANSMITTER_PLLRST 2
-#define RADEON_TRAIL_BRES_DEC 0x1614
-#define RADEON_TRAIL_BRES_ERR 0x160c
-#define RADEON_TRAIL_BRES_INC 0x1610
-#define RADEON_TRAIL_X 0x1618
-#define RADEON_TRAIL_X_SUB 0x1620
-
-#define RADEON_VCLK_ECP_CNTL 0x0008 /* PLL */
-# define RADEON_VCLK_SRC_SEL_MASK 0x03
-# define RADEON_VCLK_SRC_SEL_CPUCLK 0x00
-# define RADEON_VCLK_SRC_SEL_PSCANCLK 0x01
-# define RADEON_VCLK_SRC_SEL_BYTECLK 0x02
-# define RADEON_VCLK_SRC_SEL_PPLLCLK 0x03
-# define RADEON_PIXCLK_ALWAYS_ONb (1<<6)
-# define RADEON_PIXCLK_DAC_ALWAYS_ONb (1<<7)
-
-#define RADEON_VENDOR_ID 0x0f00 /* PCI */
-#define RADEON_VGA_DDA_CONFIG 0x02e8
-#define RADEON_VGA_DDA_ON_OFF 0x02ec
-#define RADEON_VID_BUFFER_CONTROL 0x0900
-#define RADEON_VIDEOMUX_CNTL 0x0190
-#define RADEON_VIPH_CONTROL 0x0c40 /* ? */
-
-#define RADEON_WAIT_UNTIL 0x1720
-# define RADEON_WAIT_CRTC_PFLIP (1 << 0)
-# define RADEON_WAIT_2D_IDLECLEAN (1 << 16)
-# define RADEON_WAIT_3D_IDLECLEAN (1 << 17)
-# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18)
-
-#define RADEON_X_MPLL_REF_FB_DIV 0x000a /* PLL */
-#define RADEON_XCLK_CNTL 0x000d /* PLL */
-#define RADEON_XDLL_CNTL 0x000c /* PLL */
-#define RADEON_XPLL_CNTL 0x000b /* PLL */
-
-
-
- /* Registers for 3D/TCL */
-#define RADEON_PP_BORDER_COLOR_0 0x1d40
-#define RADEON_PP_BORDER_COLOR_1 0x1d44
-#define RADEON_PP_BORDER_COLOR_2 0x1d48
-#define RADEON_PP_CNTL 0x1c38
-# define RADEON_STIPPLE_ENABLE (1 << 0)
-# define RADEON_SCISSOR_ENABLE (1 << 1)
-# define RADEON_PATTERN_ENABLE (1 << 2)
-# define RADEON_SHADOW_ENABLE (1 << 3)
-# define RADEON_TEX_ENABLE_MASK (0xf << 4)
-# define RADEON_TEX_0_ENABLE (1 << 4)
-# define RADEON_TEX_1_ENABLE (1 << 5)
-# define RADEON_TEX_2_ENABLE (1 << 6)
-# define RADEON_TEX_3_ENABLE (1 << 7)
-# define RADEON_TEX_BLEND_ENABLE_MASK (0xf << 12)
-# define RADEON_TEX_BLEND_0_ENABLE (1 << 12)
-# define RADEON_TEX_BLEND_1_ENABLE (1 << 13)
-# define RADEON_TEX_BLEND_2_ENABLE (1 << 14)
-# define RADEON_TEX_BLEND_3_ENABLE (1 << 15)
-# define RADEON_PLANAR_YUV_ENABLE (1 << 20)
-# define RADEON_SPECULAR_ENABLE (1 << 21)
-# define RADEON_FOG_ENABLE (1 << 22)
-# define RADEON_ALPHA_TEST_ENABLE (1 << 23)
-# define RADEON_ANTI_ALIAS_NONE (0 << 24)
-# define RADEON_ANTI_ALIAS_LINE (1 << 24)
-# define RADEON_ANTI_ALIAS_POLY (2 << 24)
-# define RADEON_ANTI_ALIAS_LINE_POLY (3 << 24)
-# define RADEON_BUMP_MAP_ENABLE (1 << 26)
-# define RADEON_BUMPED_MAP_T0 (0 << 27)
-# define RADEON_BUMPED_MAP_T1 (1 << 27)
-# define RADEON_BUMPED_MAP_T2 (2 << 27)
-# define RADEON_TEX_3D_ENABLE_0 (1 << 29)
-# define RADEON_TEX_3D_ENABLE_1 (1 << 30)
-# define RADEON_MC_ENABLE (1 << 31)
-#define RADEON_PP_FOG_COLOR 0x1c18
-# define RADEON_FOG_COLOR_MASK 0x00ffffff
-# define RADEON_FOG_VERTEX (0 << 24)
-# define RADEON_FOG_TABLE (1 << 24)
-# define RADEON_FOG_USE_DEPTH (0 << 25)
-# define RADEON_FOG_USE_DIFFUSE_ALPHA (2 << 25)
-# define RADEON_FOG_USE_SPEC_ALPHA (3 << 25)
-#define RADEON_PP_LUM_MATRIX 0x1d00
-#define RADEON_PP_MISC 0x1c14
-# define RADEON_REF_ALPHA_MASK 0x000000ff
-# define RADEON_ALPHA_TEST_FAIL (0 << 8)
-# define RADEON_ALPHA_TEST_LESS (1 << 8)
-# define RADEON_ALPHA_TEST_LEQUAL (2 << 8)
-# define RADEON_ALPHA_TEST_EQUAL (3 << 8)
-# define RADEON_ALPHA_TEST_GEQUAL (4 << 8)
-# define RADEON_ALPHA_TEST_GREATER (5 << 8)
-# define RADEON_ALPHA_TEST_NEQUAL (6 << 8)
-# define RADEON_ALPHA_TEST_PASS (7 << 8)
-# define RADEON_ALPHA_TEST_OP_MASK (7 << 8)
-# define RADEON_CHROMA_FUNC_FAIL (0 << 16)
-# define RADEON_CHROMA_FUNC_PASS (1 << 16)
-# define RADEON_CHROMA_FUNC_NEQUAL (2 << 16)
-# define RADEON_CHROMA_FUNC_EQUAL (3 << 16)
-# define RADEON_CHROMA_KEY_NEAREST (0 << 18)
-# define RADEON_CHROMA_KEY_ZERO (1 << 18)
-# define RADEON_SHADOW_ID_AUTO_INC (1 << 20)
-# define RADEON_SHADOW_FUNC_EQUAL (0 << 21)
-# define RADEON_SHADOW_FUNC_NEQUAL (1 << 21)
-# define RADEON_SHADOW_PASS_1 (0 << 22)
-# define RADEON_SHADOW_PASS_2 (1 << 22)
-# define RADEON_RIGHT_HAND_CUBE_D3D (0 << 24)
-# define RADEON_RIGHT_HAND_CUBE_OGL (1 << 24)
-#define RADEON_PP_ROT_MATRIX_0 0x1d58
-#define RADEON_PP_ROT_MATRIX_1 0x1d5c
-#define RADEON_PP_TXFILTER_0 0x1c54
-#define RADEON_PP_TXFILTER_1 0x1c6c
-#define RADEON_PP_TXFILTER_2 0x1c84
-# define RADEON_MAG_FILTER_NEAREST (0 << 0)
-# define RADEON_MAG_FILTER_LINEAR (1 << 0)
-# define RADEON_MAG_FILTER_MASK (1 << 0)
-# define RADEON_MIN_FILTER_NEAREST (0 << 1)
-# define RADEON_MIN_FILTER_LINEAR (1 << 1)
-# define RADEON_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
-# define RADEON_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
-# define RADEON_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
-# define RADEON_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
-# define RADEON_MIN_FILTER_ANISO_NEAREST (8 << 1)
-# define RADEON_MIN_FILTER_ANISO_LINEAR (9 << 1)
-# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
-# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
-# define RADEON_MIN_FILTER_MASK (15 << 1)
-# define RADEON_MAX_ANISO_1_TO_1 (0 << 5)
-# define RADEON_MAX_ANISO_2_TO_1 (1 << 5)
-# define RADEON_MAX_ANISO_4_TO_1 (2 << 5)
-# define RADEON_MAX_ANISO_8_TO_1 (3 << 5)
-# define RADEON_MAX_ANISO_16_TO_1 (4 << 5)
-# define RADEON_MAX_ANISO_MASK (7 << 5)
-# define RADEON_LOD_BIAS_MASK (0xff << 8)
-# define RADEON_LOD_BIAS_SHIFT 8
-# define RADEON_MAX_MIP_LEVEL_MASK (0x0f << 16)
-# define RADEON_MAX_MIP_LEVEL_SHIFT 16
-# define RADEON_YUV_TO_RGB (1 << 20)
-# define RADEON_YUV_TEMPERATURE_COOL (0 << 21)
-# define RADEON_YUV_TEMPERATURE_HOT (1 << 21)
-# define RADEON_YUV_TEMPERATURE_MASK (1 << 21)
-# define RADEON_WRAPEN_S (1 << 22)
-# define RADEON_CLAMP_S_WRAP (0 << 23)
-# define RADEON_CLAMP_S_MIRROR (1 << 23)
-# define RADEON_CLAMP_S_CLAMP_LAST (2 << 23)
-# define RADEON_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
-# define RADEON_CLAMP_S_CLAMP_BORDER (4 << 23)
-# define RADEON_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
-# define RADEON_CLAMP_S_CLAMP_GL (6 << 23)
-# define RADEON_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
-# define RADEON_CLAMP_S_MASK (7 << 23)
-# define RADEON_WRAPEN_T (1 << 26)
-# define RADEON_CLAMP_T_WRAP (0 << 27)
-# define RADEON_CLAMP_T_MIRROR (1 << 27)
-# define RADEON_CLAMP_T_CLAMP_LAST (2 << 27)
-# define RADEON_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
-# define RADEON_CLAMP_T_CLAMP_BORDER (4 << 27)
-# define RADEON_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
-# define RADEON_CLAMP_T_CLAMP_GL (6 << 27)
-# define RADEON_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
-# define RADEON_CLAMP_T_MASK (7 << 27)
-# define RADEON_BORDER_MODE_OGL (0 << 31)
-# define RADEON_BORDER_MODE_D3D (1 << 31)
-#define RADEON_PP_TXFORMAT_0 0x1c58
-#define RADEON_PP_TXFORMAT_1 0x1c70
-#define RADEON_PP_TXFORMAT_2 0x1c88
-# define RADEON_TXFORMAT_I8 (0 << 0)
-# define RADEON_TXFORMAT_AI88 (1 << 0)
-# define RADEON_TXFORMAT_RGB332 (2 << 0)
-# define RADEON_TXFORMAT_ARGB1555 (3 << 0)
-# define RADEON_TXFORMAT_RGB565 (4 << 0)
-# define RADEON_TXFORMAT_ARGB4444 (5 << 0)
-# define RADEON_TXFORMAT_ARGB8888 (6 << 0)
-# define RADEON_TXFORMAT_RGBA8888 (7 << 0)
-# define RADEON_TXFORMAT_Y8 (8 << 0)
-# define RADEON_TXFORMAT_VYUY422 (10 << 0)
-# define RADEON_TXFORMAT_YVYU422 (11 << 0)
-# define RADEON_TXFORMAT_DXT1 (12 << 0)
-# define RADEON_TXFORMAT_DXT23 (14 << 0)
-# define RADEON_TXFORMAT_DXT45 (15 << 0)
-# define RADEON_TXFORMAT_SHADOW16 (16 << 0)
-# define RADEON_TXFORMAT_SHADOW32 (17 << 0)
-# define RADEON_TXFORMAT_DUDV88 (18 << 0)
-# define RADEON_TXFORMAT_LDUDV655 (19 << 0)
-# define RADEON_TXFORMAT_LDUDUV8888 (20 << 0)
-# define RADEON_TXFORMAT_FORMAT_MASK (31 << 0)
-# define RADEON_TXFORMAT_FORMAT_SHIFT 0
-# define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5)
-# define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6)
-# define RADEON_TXFORMAT_NON_POWER2 (1 << 7)
-# define RADEON_TXFORMAT_WIDTH_MASK (15 << 8)
-# define RADEON_TXFORMAT_WIDTH_SHIFT 8
-# define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12)
-# define RADEON_TXFORMAT_HEIGHT_SHIFT 12
-# define RADEON_TXFORMAT_F5_WIDTH_MASK (15 << 16)
-# define RADEON_TXFORMAT_F5_WIDTH_SHIFT 16
-# define RADEON_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
-# define RADEON_TXFORMAT_F5_HEIGHT_SHIFT 20
-# define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
-# define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24)
-# define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
-# define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
-# define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26)
-# define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26)
-# define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26)
-# define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26)
-# define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
-# define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
-# define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
-# define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31)
-#define RADEON_PP_CUBIC_FACES_0 0x1d24
-#define RADEON_PP_CUBIC_FACES_1 0x1d28
-#define RADEON_PP_CUBIC_FACES_2 0x1d2c
-# define RADEON_FACE_WIDTH_1_SHIFT 0
-# define RADEON_FACE_HEIGHT_1_SHIFT 4
-# define RADEON_FACE_WIDTH_1_MASK (0xf << 0)
-# define RADEON_FACE_HEIGHT_1_MASK (0xf << 4)
-# define RADEON_FACE_WIDTH_2_SHIFT 8
-# define RADEON_FACE_HEIGHT_2_SHIFT 12
-# define RADEON_FACE_WIDTH_2_MASK (0xf << 8)
-# define RADEON_FACE_HEIGHT_2_MASK (0xf << 12)
-# define RADEON_FACE_WIDTH_3_SHIFT 16
-# define RADEON_FACE_HEIGHT_3_SHIFT 20
-# define RADEON_FACE_WIDTH_3_MASK (0xf << 16)
-# define RADEON_FACE_HEIGHT_3_MASK (0xf << 20)
-# define RADEON_FACE_WIDTH_4_SHIFT 24
-# define RADEON_FACE_HEIGHT_4_SHIFT 28
-# define RADEON_FACE_WIDTH_4_MASK (0xf << 24)
-# define RADEON_FACE_HEIGHT_4_MASK (0xf << 28)
-
-#define RADEON_PP_TXOFFSET_0 0x1c5c
-#define RADEON_PP_TXOFFSET_1 0x1c74
-#define RADEON_PP_TXOFFSET_2 0x1c8c
-# define RADEON_TXO_ENDIAN_NO_SWAP (0 << 0)
-# define RADEON_TXO_ENDIAN_BYTE_SWAP (1 << 0)
-# define RADEON_TXO_ENDIAN_WORD_SWAP (2 << 0)
-# define RADEON_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
-# define RADEON_TXO_MACRO_LINEAR (0 << 2)
-# define RADEON_TXO_MACRO_TILE (1 << 2)
-# define RADEON_TXO_MICRO_LINEAR (0 << 3)
-# define RADEON_TXO_MICRO_TILE_X2 (1 << 3)
-# define RADEON_TXO_MICRO_TILE_OPT (2 << 3)
-# define RADEON_TXO_OFFSET_MASK 0xffffffe0
-# define RADEON_TXO_OFFSET_SHIFT 5
-
-#define RADEON_PP_CUBIC_OFFSET_T0_0 0x1dd0 /* bits [31:5] */
-#define RADEON_PP_CUBIC_OFFSET_T0_1 0x1dd4
-#define RADEON_PP_CUBIC_OFFSET_T0_2 0x1dd8
-#define RADEON_PP_CUBIC_OFFSET_T0_3 0x1ddc
-#define RADEON_PP_CUBIC_OFFSET_T0_4 0x1de0
-#define RADEON_PP_CUBIC_OFFSET_T1_0 0x1e00
-#define RADEON_PP_CUBIC_OFFSET_T1_1 0x1e04
-#define RADEON_PP_CUBIC_OFFSET_T1_2 0x1e08
-#define RADEON_PP_CUBIC_OFFSET_T1_3 0x1e0c
-#define RADEON_PP_CUBIC_OFFSET_T1_4 0x1e10
-#define RADEON_PP_CUBIC_OFFSET_T2_0 0x1e14
-#define RADEON_PP_CUBIC_OFFSET_T2_1 0x1e18
-#define RADEON_PP_CUBIC_OFFSET_T2_2 0x1e1c
-#define RADEON_PP_CUBIC_OFFSET_T2_3 0x1e20
-#define RADEON_PP_CUBIC_OFFSET_T2_4 0x1e24
-
-#define RADEON_PP_TEX_SIZE_0 0x1d04 /* NPOT */
-#define RADEON_PP_TEX_SIZE_1 0x1d0c
-#define RADEON_PP_TEX_SIZE_2 0x1d14
-# define RADEON_TEX_USIZE_MASK (0x7ff << 0)
-# define RADEON_TEX_USIZE_SHIFT 0
-# define RADEON_TEX_VSIZE_MASK (0x7ff << 16)
-# define RADEON_TEX_VSIZE_SHIFT 16
-# define RADEON_SIGNED_RGB_MASK (1 << 30)
-# define RADEON_SIGNED_RGB_SHIFT 30
-# define RADEON_SIGNED_ALPHA_MASK (1 << 31)
-# define RADEON_SIGNED_ALPHA_SHIFT 31
-#define RADEON_PP_TEX_PITCH_0 0x1d08 /* NPOT */
-#define RADEON_PP_TEX_PITCH_1 0x1d10 /* NPOT */
-#define RADEON_PP_TEX_PITCH_2 0x1d18 /* NPOT */
-/* note: bits 13-5: 32 byte aligned stride of texture map */
-
-#define RADEON_PP_TXCBLEND_0 0x1c60
-#define RADEON_PP_TXCBLEND_1 0x1c78
-#define RADEON_PP_TXCBLEND_2 0x1c90
-# define RADEON_COLOR_ARG_A_SHIFT 0
-# define RADEON_COLOR_ARG_A_MASK (0x1f << 0)
-# define RADEON_COLOR_ARG_A_ZERO (0 << 0)
-# define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0)
-# define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0)
-# define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0)
-# define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0)
-# define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0)
-# define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0)
-# define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0)
-# define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0)
-# define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0)
-# define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0)
-# define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0)
-# define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0)
-# define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0)
-# define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0)
-# define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0)
-# define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0)
-# define RADEON_COLOR_ARG_B_SHIFT 5
-# define RADEON_COLOR_ARG_B_MASK (0x1f << 5)
-# define RADEON_COLOR_ARG_B_ZERO (0 << 5)
-# define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5)
-# define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5)
-# define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5)
-# define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5)
-# define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5)
-# define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5)
-# define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5)
-# define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5)
-# define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5)
-# define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5)
-# define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5)
-# define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5)
-# define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5)
-# define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5)
-# define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5)
-# define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5)
-# define RADEON_COLOR_ARG_C_SHIFT 10
-# define RADEON_COLOR_ARG_C_MASK (0x1f << 10)
-# define RADEON_COLOR_ARG_C_ZERO (0 << 10)
-# define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10)
-# define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10)
-# define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10)
-# define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10)
-# define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10)
-# define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10)
-# define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10)
-# define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10)
-# define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10)
-# define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10)
-# define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10)
-# define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10)
-# define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10)
-# define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10)
-# define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10)
-# define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10)
-# define RADEON_COMP_ARG_A (1 << 15)
-# define RADEON_COMP_ARG_A_SHIFT 15
-# define RADEON_COMP_ARG_B (1 << 16)
-# define RADEON_COMP_ARG_B_SHIFT 16
-# define RADEON_COMP_ARG_C (1 << 17)
-# define RADEON_COMP_ARG_C_SHIFT 17
-# define RADEON_BLEND_CTL_MASK (7 << 18)
-# define RADEON_BLEND_CTL_ADD (0 << 18)
-# define RADEON_BLEND_CTL_SUBTRACT (1 << 18)
-# define RADEON_BLEND_CTL_ADDSIGNED (2 << 18)
-# define RADEON_BLEND_CTL_BLEND (3 << 18)
-# define RADEON_BLEND_CTL_DOT3 (4 << 18)
-# define RADEON_SCALE_SHIFT 21
-# define RADEON_SCALE_MASK (3 << 21)
-# define RADEON_SCALE_1X (0 << 21)
-# define RADEON_SCALE_2X (1 << 21)
-# define RADEON_SCALE_4X (2 << 21)
-# define RADEON_CLAMP_TX (1 << 23)
-# define RADEON_T0_EQ_TCUR (1 << 24)
-# define RADEON_T1_EQ_TCUR (1 << 25)
-# define RADEON_T2_EQ_TCUR (1 << 26)
-# define RADEON_T3_EQ_TCUR (1 << 27)
-# define RADEON_COLOR_ARG_MASK 0x1f
-# define RADEON_COMP_ARG_SHIFT 15
-#define RADEON_PP_TXABLEND_0 0x1c64
-#define RADEON_PP_TXABLEND_1 0x1c7c
-#define RADEON_PP_TXABLEND_2 0x1c94
-# define RADEON_ALPHA_ARG_A_SHIFT 0
-# define RADEON_ALPHA_ARG_A_MASK (0xf << 0)
-# define RADEON_ALPHA_ARG_A_ZERO (0 << 0)
-# define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0)
-# define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0)
-# define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0)
-# define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0)
-# define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0)
-# define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0)
-# define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0)
-# define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0)
-# define RADEON_ALPHA_ARG_B_SHIFT 4
-# define RADEON_ALPHA_ARG_B_MASK (0xf << 4)
-# define RADEON_ALPHA_ARG_B_ZERO (0 << 4)
-# define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4)
-# define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4)
-# define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4)
-# define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4)
-# define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4)
-# define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4)
-# define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4)
-# define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4)
-# define RADEON_ALPHA_ARG_C_SHIFT 8
-# define RADEON_ALPHA_ARG_C_MASK (0xf << 8)
-# define RADEON_ALPHA_ARG_C_ZERO (0 << 8)
-# define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8)
-# define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8)
-# define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8)
-# define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8)
-# define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8)
-# define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8)
-# define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8)
-# define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8)
-# define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9)
-# define RADEON_ALPHA_ARG_MASK 0xf
-
-#define RADEON_PP_TFACTOR_0 0x1c68
-#define RADEON_PP_TFACTOR_1 0x1c80
-#define RADEON_PP_TFACTOR_2 0x1c98
-
-#define RADEON_RB3D_BLENDCNTL 0x1c20
-# define RADEON_COMB_FCN_MASK (3 << 12)
-# define RADEON_COMB_FCN_ADD_CLAMP (0 << 12)
-# define RADEON_COMB_FCN_ADD_NOCLAMP (1 << 12)
-# define RADEON_COMB_FCN_SUB_CLAMP (2 << 12)
-# define RADEON_COMB_FCN_SUB_NOCLAMP (3 << 12)
-# define RADEON_SRC_BLEND_GL_ZERO (32 << 16)
-# define RADEON_SRC_BLEND_GL_ONE (33 << 16)
-# define RADEON_SRC_BLEND_GL_SRC_COLOR (34 << 16)
-# define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16)
-# define RADEON_SRC_BLEND_GL_DST_COLOR (36 << 16)
-# define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16)
-# define RADEON_SRC_BLEND_GL_SRC_ALPHA (38 << 16)
-# define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16)
-# define RADEON_SRC_BLEND_GL_DST_ALPHA (40 << 16)
-# define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16)
-# define RADEON_SRC_BLEND_GL_SRC_ALPHA_SATURATE (42 << 16)
-# define RADEON_SRC_BLEND_MASK (63 << 16)
-# define RADEON_DST_BLEND_GL_ZERO (32 << 24)
-# define RADEON_DST_BLEND_GL_ONE (33 << 24)
-# define RADEON_DST_BLEND_GL_SRC_COLOR (34 << 24)
-# define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24)
-# define RADEON_DST_BLEND_GL_DST_COLOR (36 << 24)
-# define RADEON_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24)
-# define RADEON_DST_BLEND_GL_SRC_ALPHA (38 << 24)
-# define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24)
-# define RADEON_DST_BLEND_GL_DST_ALPHA (40 << 24)
-# define RADEON_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24)
-# define RADEON_DST_BLEND_MASK (63 << 24)
-#define RADEON_RB3D_CNTL 0x1c3c
-# define RADEON_ALPHA_BLEND_ENABLE (1 << 0)
-# define RADEON_PLANE_MASK_ENABLE (1 << 1)
-# define RADEON_DITHER_ENABLE (1 << 2)
-# define RADEON_ROUND_ENABLE (1 << 3)
-# define RADEON_SCALE_DITHER_ENABLE (1 << 4)
-# define RADEON_DITHER_INIT (1 << 5)
-# define RADEON_ROP_ENABLE (1 << 6)
-# define RADEON_STENCIL_ENABLE (1 << 7)
-# define RADEON_Z_ENABLE (1 << 8)
-# define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9)
-# define RADEON_COLOR_FORMAT_ARGB1555 (3 << 10)
-# define RADEON_COLOR_FORMAT_RGB565 (4 << 10)
-# define RADEON_COLOR_FORMAT_ARGB8888 (6 << 10)
-# define RADEON_COLOR_FORMAT_RGB332 (7 << 10)
-# define RADEON_COLOR_FORMAT_Y8 (8 << 10)
-# define RADEON_COLOR_FORMAT_RGB8 (9 << 10)
-# define RADEON_COLOR_FORMAT_YUV422_VYUY (11 << 10)
-# define RADEON_COLOR_FORMAT_YUV422_YVYU (12 << 10)
-# define RADEON_COLOR_FORMAT_aYUV444 (14 << 10)
-# define RADEON_COLOR_FORMAT_ARGB4444 (15 << 10)
-# define RADEON_CLRCMP_FLIP_ENABLE (1 << 14)
-# define RADEON_ZBLOCK16 (1 << 15)
-#define RADEON_RB3D_COLOROFFSET 0x1c40
-# define RADEON_COLOROFFSET_MASK 0xfffffff0
-#define RADEON_RB3D_COLORPITCH 0x1c48
-# define RADEON_COLORPITCH_MASK 0x000001ff8
-# define RADEON_COLOR_TILE_ENABLE (1 << 16)
-# define RADEON_COLOR_MICROTILE_ENABLE (1 << 17)
-# define RADEON_COLOR_ENDIAN_NO_SWAP (0 << 18)
-# define RADEON_COLOR_ENDIAN_WORD_SWAP (1 << 18)
-# define RADEON_COLOR_ENDIAN_DWORD_SWAP (2 << 18)
-#define RADEON_RB3D_DEPTHOFFSET 0x1c24
-#define RADEON_RB3D_DEPTHPITCH 0x1c28
-# define RADEON_DEPTHPITCH_MASK 0x00001ff8
-# define RADEON_DEPTH_HYPERZ (3 << 16)
-# define RADEON_DEPTH_ENDIAN_NO_SWAP (0 << 18)
-# define RADEON_DEPTH_ENDIAN_WORD_SWAP (1 << 18)
-# define RADEON_DEPTH_ENDIAN_DWORD_SWAP (2 << 18)
-#define RADEON_RB3D_PLANEMASK 0x1d84
-#define RADEON_RB3D_ROPCNTL 0x1d80
-# define RADEON_ROP_MASK (15 << 8)
-# define RADEON_ROP_CLEAR (0 << 8)
-# define RADEON_ROP_NOR (1 << 8)
-# define RADEON_ROP_AND_INVERTED (2 << 8)
-# define RADEON_ROP_COPY_INVERTED (3 << 8)
-# define RADEON_ROP_AND_REVERSE (4 << 8)
-# define RADEON_ROP_INVERT (5 << 8)
-# define RADEON_ROP_XOR (6 << 8)
-# define RADEON_ROP_NAND (7 << 8)
-# define RADEON_ROP_AND (8 << 8)
-# define RADEON_ROP_EQUIV (9 << 8)
-# define RADEON_ROP_NOOP (10 << 8)
-# define RADEON_ROP_OR_INVERTED (11 << 8)
-# define RADEON_ROP_COPY (12 << 8)
-# define RADEON_ROP_OR_REVERSE (13 << 8)
-# define RADEON_ROP_OR (14 << 8)
-# define RADEON_ROP_SET (15 << 8)
-#define RADEON_RB3D_STENCILREFMASK 0x1d7c
-# define RADEON_STENCIL_REF_SHIFT 0
-# define RADEON_STENCIL_REF_MASK (0xff << 0)
-# define RADEON_STENCIL_MASK_SHIFT 16
-# define RADEON_STENCIL_VALUE_MASK (0xff << 16)
-# define RADEON_STENCIL_WRITEMASK_SHIFT 24
-# define RADEON_STENCIL_WRITE_MASK (0xff << 24)
-#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c
-# define RADEON_DEPTH_FORMAT_MASK (0xf << 0)
-# define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0)
-# define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0)
-# define RADEON_DEPTH_FORMAT_24BIT_FLOAT_Z (3 << 0)
-# define RADEON_DEPTH_FORMAT_32BIT_INT_Z (4 << 0)
-# define RADEON_DEPTH_FORMAT_32BIT_FLOAT_Z (5 << 0)
-# define RADEON_DEPTH_FORMAT_16BIT_FLOAT_W (7 << 0)
-# define RADEON_DEPTH_FORMAT_24BIT_FLOAT_W (9 << 0)
-# define RADEON_DEPTH_FORMAT_32BIT_FLOAT_W (11 << 0)
-# define RADEON_Z_TEST_NEVER (0 << 4)
-# define RADEON_Z_TEST_LESS (1 << 4)
-# define RADEON_Z_TEST_LEQUAL (2 << 4)
-# define RADEON_Z_TEST_EQUAL (3 << 4)
-# define RADEON_Z_TEST_GEQUAL (4 << 4)
-# define RADEON_Z_TEST_GREATER (5 << 4)
-# define RADEON_Z_TEST_NEQUAL (6 << 4)
-# define RADEON_Z_TEST_ALWAYS (7 << 4)
-# define RADEON_Z_TEST_MASK (7 << 4)
-# define RADEON_Z_HIERARCHY_ENABLE (1 << 8)
-# define RADEON_STENCIL_TEST_NEVER (0 << 12)
-# define RADEON_STENCIL_TEST_LESS (1 << 12)
-# define RADEON_STENCIL_TEST_LEQUAL (2 << 12)
-# define RADEON_STENCIL_TEST_EQUAL (3 << 12)
-# define RADEON_STENCIL_TEST_GEQUAL (4 << 12)
-# define RADEON_STENCIL_TEST_GREATER (5 << 12)
-# define RADEON_STENCIL_TEST_NEQUAL (6 << 12)
-# define RADEON_STENCIL_TEST_ALWAYS (7 << 12)
-# define RADEON_STENCIL_TEST_MASK (0x7 << 12)
-# define RADEON_STENCIL_FAIL_KEEP (0 << 16)
-# define RADEON_STENCIL_FAIL_ZERO (1 << 16)
-# define RADEON_STENCIL_FAIL_REPLACE (2 << 16)
-# define RADEON_STENCIL_FAIL_INC (3 << 16)
-# define RADEON_STENCIL_FAIL_DEC (4 << 16)
-# define RADEON_STENCIL_FAIL_INVERT (5 << 16)
-# define RADEON_STENCIL_FAIL_INC_WRAP (6 << 16)
-# define RADEON_STENCIL_FAIL_DEC_WRAP (7 << 16)
-# define RADEON_STENCIL_FAIL_MASK (0x7 << 16)
-# define RADEON_STENCIL_ZPASS_KEEP (0 << 20)
-# define RADEON_STENCIL_ZPASS_ZERO (1 << 20)
-# define RADEON_STENCIL_ZPASS_REPLACE (2 << 20)
-# define RADEON_STENCIL_ZPASS_INC (3 << 20)
-# define RADEON_STENCIL_ZPASS_DEC (4 << 20)
-# define RADEON_STENCIL_ZPASS_INVERT (5 << 20)
-# define RADEON_STENCIL_ZPASS_INC_WRAP (6 << 20)
-# define RADEON_STENCIL_ZPASS_DEC_WRAP (7 << 20)
-# define RADEON_STENCIL_ZPASS_MASK (0x7 << 20)
-# define RADEON_STENCIL_ZFAIL_KEEP (0 << 24)
-# define RADEON_STENCIL_ZFAIL_ZERO (1 << 24)
-# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 24)
-# define RADEON_STENCIL_ZFAIL_INC (3 << 24)
-# define RADEON_STENCIL_ZFAIL_DEC (4 << 24)
-# define RADEON_STENCIL_ZFAIL_INVERT (5 << 24)
-# define RADEON_STENCIL_ZFAIL_INC_WRAP (6 << 24)
-# define RADEON_STENCIL_ZFAIL_DEC_WRAP (7 << 24)
-# define RADEON_STENCIL_ZFAIL_MASK (0x7 << 24)
-# define RADEON_Z_COMPRESSION_ENABLE (1 << 28)
-# define RADEON_FORCE_Z_DIRTY (1 << 29)
-# define RADEON_Z_WRITE_ENABLE (1 << 30)
-# define RADEON_Z_DECOMPRESSION_ENABLE (1 << 31)
-#define RADEON_RE_LINE_PATTERN 0x1cd0
-# define RADEON_LINE_PATTERN_MASK 0x0000ffff
-# define RADEON_LINE_REPEAT_COUNT_SHIFT 16
-# define RADEON_LINE_PATTERN_START_SHIFT 24
-# define RADEON_LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28)
-# define RADEON_LINE_PATTERN_BIG_BIT_ORDER (1 << 28)
-# define RADEON_LINE_PATTERN_AUTO_RESET (1 << 29)
-#define RADEON_RE_LINE_STATE 0x1cd4
-# define RADEON_LINE_CURRENT_PTR_SHIFT 0
-# define RADEON_LINE_CURRENT_COUNT_SHIFT 8
-#define RADEON_RE_MISC 0x26c4
-# define RADEON_STIPPLE_COORD_MASK 0x1f
-# define RADEON_STIPPLE_X_OFFSET_SHIFT 0
-# define RADEON_STIPPLE_X_OFFSET_MASK (0x1f << 0)
-# define RADEON_STIPPLE_Y_OFFSET_SHIFT 8
-# define RADEON_STIPPLE_Y_OFFSET_MASK (0x1f << 8)
-# define RADEON_STIPPLE_LITTLE_BIT_ORDER (0 << 16)
-# define RADEON_STIPPLE_BIG_BIT_ORDER (1 << 16)
-#define RADEON_RE_SOLID_COLOR 0x1c1c
-#define RADEON_RE_TOP_LEFT 0x26c0
-# define RADEON_RE_LEFT_SHIFT 0
-# define RADEON_RE_TOP_SHIFT 16
-#define RADEON_RE_WIDTH_HEIGHT 0x1c44
-# define RADEON_RE_WIDTH_SHIFT 0
-# define RADEON_RE_HEIGHT_SHIFT 16
-
-#define RADEON_SE_CNTL 0x1c4c
-# define RADEON_FFACE_CULL_CW (0 << 0)
-# define RADEON_FFACE_CULL_CCW (1 << 0)
-# define RADEON_FFACE_CULL_DIR_MASK (1 << 0)
-# define RADEON_BFACE_CULL (0 << 1)
-# define RADEON_BFACE_SOLID (3 << 1)
-# define RADEON_FFACE_CULL (0 << 3)
-# define RADEON_FFACE_SOLID (3 << 3)
-# define RADEON_FFACE_CULL_MASK (3 << 3)
-# define RADEON_BADVTX_CULL_DISABLE (1 << 5)
-# define RADEON_FLAT_SHADE_VTX_0 (0 << 6)
-# define RADEON_FLAT_SHADE_VTX_1 (1 << 6)
-# define RADEON_FLAT_SHADE_VTX_2 (2 << 6)
-# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6)
-# define RADEON_DIFFUSE_SHADE_SOLID (0 << 8)
-# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8)
-# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8)
-# define RADEON_DIFFUSE_SHADE_MASK (3 << 8)
-# define RADEON_ALPHA_SHADE_SOLID (0 << 10)
-# define RADEON_ALPHA_SHADE_FLAT (1 << 10)
-# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10)
-# define RADEON_ALPHA_SHADE_MASK (3 << 10)
-# define RADEON_SPECULAR_SHADE_SOLID (0 << 12)
-# define RADEON_SPECULAR_SHADE_FLAT (1 << 12)
-# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12)
-# define RADEON_SPECULAR_SHADE_MASK (3 << 12)
-# define RADEON_FOG_SHADE_SOLID (0 << 14)
-# define RADEON_FOG_SHADE_FLAT (1 << 14)
-# define RADEON_FOG_SHADE_GOURAUD (2 << 14)
-# define RADEON_FOG_SHADE_MASK (3 << 14)
-# define RADEON_ZBIAS_ENABLE_POINT (1 << 16)
-# define RADEON_ZBIAS_ENABLE_LINE (1 << 17)
-# define RADEON_ZBIAS_ENABLE_TRI (1 << 18)
-# define RADEON_WIDELINE_ENABLE (1 << 20)
-# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24)
-# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25)
-# define RADEON_VTX_PIX_CENTER_D3D (0 << 27)
-# define RADEON_VTX_PIX_CENTER_OGL (1 << 27)
-# define RADEON_ROUND_MODE_TRUNC (0 << 28)
-# define RADEON_ROUND_MODE_ROUND (1 << 28)
-# define RADEON_ROUND_MODE_ROUND_EVEN (2 << 28)
-# define RADEON_ROUND_MODE_ROUND_ODD (3 << 28)
-# define RADEON_ROUND_PREC_16TH_PIX (0 << 30)
-# define RADEON_ROUND_PREC_8TH_PIX (1 << 30)
-# define RADEON_ROUND_PREC_4TH_PIX (2 << 30)
-# define RADEON_ROUND_PREC_HALF_PIX (3 << 30)
-#define RADEON_SE_CNTL_STATUS 0x2140
-# define RADEON_VC_NO_SWAP (0 << 0)
-# define RADEON_VC_16BIT_SWAP (1 << 0)
-# define RADEON_VC_32BIT_SWAP (2 << 0)
-# define RADEON_VC_HALF_DWORD_SWAP (3 << 0)
-# define RADEON_TCL_BYPASS (1 << 8)
-#define RADEON_SE_COORD_FMT 0x1c50
-# define RADEON_VTX_XY_PRE_MULT_1_OVER_W0 (1 << 0)
-# define RADEON_VTX_Z_PRE_MULT_1_OVER_W0 (1 << 1)
-# define RADEON_VTX_ST0_NONPARAMETRIC (1 << 8)
-# define RADEON_VTX_ST1_NONPARAMETRIC (1 << 9)
-# define RADEON_VTX_ST2_NONPARAMETRIC (1 << 10)
-# define RADEON_VTX_ST3_NONPARAMETRIC (1 << 11)
-# define RADEON_VTX_W0_NORMALIZE (1 << 12)
-# define RADEON_VTX_W0_IS_NOT_1_OVER_W0 (1 << 16)
-# define RADEON_VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17)
-# define RADEON_VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19)
-# define RADEON_VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21)
-# define RADEON_VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23)
-# define RADEON_TEX1_W_ROUTING_USE_W0 (0 << 26)
-# define RADEON_TEX1_W_ROUTING_USE_Q1 (1 << 26)
-#define RADEON_SE_LINE_WIDTH 0x1db8
-#define RADEON_SE_TCL_LIGHT_MODEL_CTL 0x226c
-# define RADEON_LIGHTING_ENABLE (1 << 0)
-# define RADEON_LIGHT_IN_MODELSPACE (1 << 1)
-# define RADEON_LOCAL_VIEWER (1 << 2)
-# define RADEON_NORMALIZE_NORMALS (1 << 3)
-# define RADEON_RESCALE_NORMALS (1 << 4)
-# define RADEON_SPECULAR_LIGHTS (1 << 5)
-# define RADEON_DIFFUSE_SPECULAR_COMBINE (1 << 6)
-# define RADEON_LIGHT_ALPHA (1 << 7)
-# define RADEON_LOCAL_LIGHT_VEC_GL (1 << 8)
-# define RADEON_LIGHT_NO_NORMAL_AMBIENT_ONLY (1 << 9)
-# define RADEON_LM_SOURCE_STATE_PREMULT 0
-# define RADEON_LM_SOURCE_STATE_MULT 1
-# define RADEON_LM_SOURCE_VERTEX_DIFFUSE 2
-# define RADEON_LM_SOURCE_VERTEX_SPECULAR 3
-# define RADEON_EMISSIVE_SOURCE_SHIFT 16
-# define RADEON_AMBIENT_SOURCE_SHIFT 18
-# define RADEON_DIFFUSE_SOURCE_SHIFT 20
-# define RADEON_SPECULAR_SOURCE_SHIFT 22
-#define RADEON_SE_TCL_MATERIAL_AMBIENT_RED 0x2220
-#define RADEON_SE_TCL_MATERIAL_AMBIENT_GREEN 0x2224
-#define RADEON_SE_TCL_MATERIAL_AMBIENT_BLUE 0x2228
-#define RADEON_SE_TCL_MATERIAL_AMBIENT_ALPHA 0x222c
-#define RADEON_SE_TCL_MATERIAL_DIFFUSE_RED 0x2230
-#define RADEON_SE_TCL_MATERIAL_DIFFUSE_GREEN 0x2234
-#define RADEON_SE_TCL_MATERIAL_DIFFUSE_BLUE 0x2238
-#define RADEON_SE_TCL_MATERIAL_DIFFUSE_ALPHA 0x223c
-#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED 0x2210
-#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_GREEN 0x2214
-#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_BLUE 0x2218
-#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_ALPHA 0x221c
-#define RADEON_SE_TCL_MATERIAL_SPECULAR_RED 0x2240
-#define RADEON_SE_TCL_MATERIAL_SPECULAR_GREEN 0x2244
-#define RADEON_SE_TCL_MATERIAL_SPECULAR_BLUE 0x2248
-#define RADEON_SE_TCL_MATERIAL_SPECULAR_ALPHA 0x224c
-#define RADEON_SE_TCL_MATRIX_SELECT_0 0x225c
-# define RADEON_MODELVIEW_0_SHIFT 0
-# define RADEON_MODELVIEW_1_SHIFT 4
-# define RADEON_MODELVIEW_2_SHIFT 8
-# define RADEON_MODELVIEW_3_SHIFT 12
-# define RADEON_IT_MODELVIEW_0_SHIFT 16
-# define RADEON_IT_MODELVIEW_1_SHIFT 20
-# define RADEON_IT_MODELVIEW_2_SHIFT 24
-# define RADEON_IT_MODELVIEW_3_SHIFT 28
-#define RADEON_SE_TCL_MATRIX_SELECT_1 0x2260
-# define RADEON_MODELPROJECT_0_SHIFT 0
-# define RADEON_MODELPROJECT_1_SHIFT 4
-# define RADEON_MODELPROJECT_2_SHIFT 8
-# define RADEON_MODELPROJECT_3_SHIFT 12
-# define RADEON_TEXMAT_0_SHIFT 16
-# define RADEON_TEXMAT_1_SHIFT 20
-# define RADEON_TEXMAT_2_SHIFT 24
-# define RADEON_TEXMAT_3_SHIFT 28
-
-
-#define RADEON_SE_TCL_OUTPUT_VTX_FMT 0x2254
-# define RADEON_TCL_VTX_W0 (1 << 0)
-# define RADEON_TCL_VTX_FP_DIFFUSE (1 << 1)
-# define RADEON_TCL_VTX_FP_ALPHA (1 << 2)
-# define RADEON_TCL_VTX_PK_DIFFUSE (1 << 3)
-# define RADEON_TCL_VTX_FP_SPEC (1 << 4)
-# define RADEON_TCL_VTX_FP_FOG (1 << 5)
-# define RADEON_TCL_VTX_PK_SPEC (1 << 6)
-# define RADEON_TCL_VTX_ST0 (1 << 7)
-# define RADEON_TCL_VTX_ST1 (1 << 8)
-# define RADEON_TCL_VTX_Q1 (1 << 9)
-# define RADEON_TCL_VTX_ST2 (1 << 10)
-# define RADEON_TCL_VTX_Q2 (1 << 11)
-# define RADEON_TCL_VTX_ST3 (1 << 12)
-# define RADEON_TCL_VTX_Q3 (1 << 13)
-# define RADEON_TCL_VTX_Q0 (1 << 14)
-# define RADEON_TCL_VTX_WEIGHT_COUNT_SHIFT 15
-# define RADEON_TCL_VTX_NORM0 (1 << 18)
-# define RADEON_TCL_VTX_XY1 (1 << 27)
-# define RADEON_TCL_VTX_Z1 (1 << 28)
-# define RADEON_TCL_VTX_W1 (1 << 29)
-# define RADEON_TCL_VTX_NORM1 (1 << 30)
-# define RADEON_TCL_VTX_Z0 (1 << 31)
-
-#define RADEON_SE_TCL_OUTPUT_VTX_SEL 0x2258
-# define RADEON_TCL_COMPUTE_XYZW (1 << 0)
-# define RADEON_TCL_COMPUTE_DIFFUSE (1 << 1)
-# define RADEON_TCL_COMPUTE_SPECULAR (1 << 2)
-# define RADEON_TCL_FORCE_NAN_IF_COLOR_NAN (1 << 3)
-# define RADEON_TCL_FORCE_INORDER_PROC (1 << 4)
-# define RADEON_TCL_TEX_INPUT_TEX_0 0
-# define RADEON_TCL_TEX_INPUT_TEX_1 1
-# define RADEON_TCL_TEX_INPUT_TEX_2 2
-# define RADEON_TCL_TEX_INPUT_TEX_3 3
-# define RADEON_TCL_TEX_COMPUTED_TEX_0 8
-# define RADEON_TCL_TEX_COMPUTED_TEX_1 9
-# define RADEON_TCL_TEX_COMPUTED_TEX_2 10
-# define RADEON_TCL_TEX_COMPUTED_TEX_3 11
-# define RADEON_TCL_TEX_0_OUTPUT_SHIFT 16
-# define RADEON_TCL_TEX_1_OUTPUT_SHIFT 20
-# define RADEON_TCL_TEX_2_OUTPUT_SHIFT 24
-# define RADEON_TCL_TEX_3_OUTPUT_SHIFT 28
-
-#define RADEON_SE_TCL_PER_LIGHT_CTL_0 0x2270
-# define RADEON_LIGHT_0_ENABLE (1 << 0)
-# define RADEON_LIGHT_0_ENABLE_AMBIENT (1 << 1)
-# define RADEON_LIGHT_0_ENABLE_SPECULAR (1 << 2)
-# define RADEON_LIGHT_0_IS_LOCAL (1 << 3)
-# define RADEON_LIGHT_0_IS_SPOT (1 << 4)
-# define RADEON_LIGHT_0_DUAL_CONE (1 << 5)
-# define RADEON_LIGHT_0_ENABLE_RANGE_ATTEN (1 << 6)
-# define RADEON_LIGHT_0_CONSTANT_RANGE_ATTEN (1 << 7)
-# define RADEON_LIGHT_0_SHIFT 0
-# define RADEON_LIGHT_1_ENABLE (1 << 16)
-# define RADEON_LIGHT_1_ENABLE_AMBIENT (1 << 17)
-# define RADEON_LIGHT_1_ENABLE_SPECULAR (1 << 18)
-# define RADEON_LIGHT_1_IS_LOCAL (1 << 19)
-# define RADEON_LIGHT_1_IS_SPOT (1 << 20)
-# define RADEON_LIGHT_1_DUAL_CONE (1 << 21)
-# define RADEON_LIGHT_1_ENABLE_RANGE_ATTEN (1 << 22)
-# define RADEON_LIGHT_1_CONSTANT_RANGE_ATTEN (1 << 23)
-# define RADEON_LIGHT_1_SHIFT 16
-#define RADEON_SE_TCL_PER_LIGHT_CTL_1 0x2274
-# define RADEON_LIGHT_2_SHIFT 0
-# define RADEON_LIGHT_3_SHIFT 16
-#define RADEON_SE_TCL_PER_LIGHT_CTL_2 0x2278
-# define RADEON_LIGHT_4_SHIFT 0
-# define RADEON_LIGHT_5_SHIFT 16
-#define RADEON_SE_TCL_PER_LIGHT_CTL_3 0x227c
-# define RADEON_LIGHT_6_SHIFT 0
-# define RADEON_LIGHT_7_SHIFT 16
-
-#define RADEON_SE_TCL_SHININESS 0x2250
-
-#define RADEON_SE_TCL_TEXTURE_PROC_CTL 0x2268
-# define RADEON_TEXGEN_TEXMAT_0_ENABLE (1 << 0)
-# define RADEON_TEXGEN_TEXMAT_1_ENABLE (1 << 1)
-# define RADEON_TEXGEN_TEXMAT_2_ENABLE (1 << 2)
-# define RADEON_TEXGEN_TEXMAT_3_ENABLE (1 << 3)
-# define RADEON_TEXMAT_0_ENABLE (1 << 4)
-# define RADEON_TEXMAT_1_ENABLE (1 << 5)
-# define RADEON_TEXMAT_2_ENABLE (1 << 6)
-# define RADEON_TEXMAT_3_ENABLE (1 << 7)
-# define RADEON_TEXGEN_INPUT_MASK 0xf
-# define RADEON_TEXGEN_INPUT_TEXCOORD_0 0
-# define RADEON_TEXGEN_INPUT_TEXCOORD_1 1
-# define RADEON_TEXGEN_INPUT_TEXCOORD_2 2
-# define RADEON_TEXGEN_INPUT_TEXCOORD_3 3
-# define RADEON_TEXGEN_INPUT_OBJ 4
-# define RADEON_TEXGEN_INPUT_EYE 5
-# define RADEON_TEXGEN_INPUT_EYE_NORMAL 6
-# define RADEON_TEXGEN_INPUT_EYE_REFLECT 7
-# define RADEON_TEXGEN_INPUT_EYE_NORMALIZED 8
-# define RADEON_TEXGEN_0_INPUT_SHIFT 16
-# define RADEON_TEXGEN_1_INPUT_SHIFT 20
-# define RADEON_TEXGEN_2_INPUT_SHIFT 24
-# define RADEON_TEXGEN_3_INPUT_SHIFT 28
-
-#define RADEON_SE_TCL_UCP_VERT_BLEND_CTL 0x2264
-# define RADEON_UCP_IN_CLIP_SPACE (1 << 0)
-# define RADEON_UCP_IN_MODEL_SPACE (1 << 1)
-# define RADEON_UCP_ENABLE_0 (1 << 2)
-# define RADEON_UCP_ENABLE_1 (1 << 3)
-# define RADEON_UCP_ENABLE_2 (1 << 4)
-# define RADEON_UCP_ENABLE_3 (1 << 5)
-# define RADEON_UCP_ENABLE_4 (1 << 6)
-# define RADEON_UCP_ENABLE_5 (1 << 7)
-# define RADEON_TCL_FOG_MASK (3 << 8)
-# define RADEON_TCL_FOG_DISABLE (0 << 8)
-# define RADEON_TCL_FOG_EXP (1 << 8)
-# define RADEON_TCL_FOG_EXP2 (2 << 8)
-# define RADEON_TCL_FOG_LINEAR (3 << 8)
-# define RADEON_RNG_BASED_FOG (1 << 10)
-# define RADEON_LIGHT_TWOSIDE (1 << 11)
-# define RADEON_BLEND_OP_COUNT_MASK (7 << 12)
-# define RADEON_BLEND_OP_COUNT_SHIFT 12
-# define RADEON_POSITION_BLEND_OP_ENABLE (1 << 16)
-# define RADEON_NORMAL_BLEND_OP_ENABLE (1 << 17)
-# define RADEON_VERTEX_BLEND_SRC_0_PRIMARY (1 << 18)
-# define RADEON_VERTEX_BLEND_SRC_0_SECONDARY (1 << 18)
-# define RADEON_VERTEX_BLEND_SRC_1_PRIMARY (1 << 19)
-# define RADEON_VERTEX_BLEND_SRC_1_SECONDARY (1 << 19)
-# define RADEON_VERTEX_BLEND_SRC_2_PRIMARY (1 << 20)
-# define RADEON_VERTEX_BLEND_SRC_2_SECONDARY (1 << 20)
-# define RADEON_VERTEX_BLEND_SRC_3_PRIMARY (1 << 21)
-# define RADEON_VERTEX_BLEND_SRC_3_SECONDARY (1 << 21)
-# define RADEON_VERTEX_BLEND_WGT_MINUS_ONE (1 << 22)
-# define RADEON_CULL_FRONT_IS_CW (0 << 28)
-# define RADEON_CULL_FRONT_IS_CCW (1 << 28)
-# define RADEON_CULL_FRONT (1 << 29)
-# define RADEON_CULL_BACK (1 << 30)
-# define RADEON_FORCE_W_TO_ONE (1 << 31)
-
-#define RADEON_SE_VPORT_XSCALE 0x1d98
-#define RADEON_SE_VPORT_XOFFSET 0x1d9c
-#define RADEON_SE_VPORT_YSCALE 0x1da0
-#define RADEON_SE_VPORT_YOFFSET 0x1da4
-#define RADEON_SE_VPORT_ZSCALE 0x1da8
-#define RADEON_SE_VPORT_ZOFFSET 0x1dac
-#define RADEON_SE_ZBIAS_FACTOR 0x1db0
-#define RADEON_SE_ZBIAS_CONSTANT 0x1db4
-
-
-
- /* Registers for CP and Microcode Engine */
-#define RADEON_CP_ME_RAM_ADDR 0x07d4
-#define RADEON_CP_ME_RAM_RADDR 0x07d8
-#define RADEON_CP_ME_RAM_DATAH 0x07dc
-#define RADEON_CP_ME_RAM_DATAL 0x07e0
-
-#define RADEON_CP_RB_BASE 0x0700
-#define RADEON_CP_RB_CNTL 0x0704
-#define RADEON_CP_RB_RPTR_ADDR 0x070c
-#define RADEON_CP_RB_RPTR 0x0710
-#define RADEON_CP_RB_WPTR 0x0714
-
-#define RADEON_CP_IB_BASE 0x0738
-#define RADEON_CP_IB_BUFSZ 0x073c
-
-#define RADEON_CP_CSQ_CNTL 0x0740
-# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0)
-# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28)
-# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28)
-# define RADEON_CSQ_PRIBM_INDDIS (2 << 28)
-# define RADEON_CSQ_PRIPIO_INDBM (3 << 28)
-# define RADEON_CSQ_PRIBM_INDBM (4 << 28)
-# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28)
-#define RADEON_CP_CSQ_STAT 0x07f8
-# define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0)
-# define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8)
-# define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16)
-# define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24)
-#define RADEON_CP_CSQ_ADDR 0x07f0
-#define RADEON_CP_CSQ_DATA 0x07f4
-#define RADEON_CP_CSQ_APER_PRIMARY 0x1000
-#define RADEON_CP_CSQ_APER_INDIRECT 0x1300
-
-#define RADEON_CP_RB_WPTR_DELAY 0x0718
-# define RADEON_PRE_WRITE_TIMER_SHIFT 0
-# define RADEON_PRE_WRITE_LIMIT_SHIFT 23
-
-#define RADEON_AIC_CNTL 0x01d0
-# define RADEON_PCIGART_TRANSLATE_EN (1 << 0)
-#define RADEON_AIC_LO_ADDR 0x01dc
-
-
-
- /* Constants */
-#define RADEON_LAST_FRAME_REG RADEON_GUI_SCRATCH_REG0
-#define RADEON_LAST_CLEAR_REG RADEON_GUI_SCRATCH_REG2
-
-
-
- /* CP packet types */
-#define RADEON_CP_PACKET0 0x00000000
-#define RADEON_CP_PACKET1 0x40000000
-#define RADEON_CP_PACKET2 0x80000000
-#define RADEON_CP_PACKET3 0xC0000000
-# define RADEON_CP_PACKET_MASK 0xC0000000
-# define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000
-# define RADEON_CP_PACKET_MAX_DWORDS (1 << 12)
-# define RADEON_CP_PACKET0_REG_MASK 0x000007ff
-# define RADEON_CP_PACKET1_REG0_MASK 0x000007ff
-# define RADEON_CP_PACKET1_REG1_MASK 0x003ff800
-
-#define RADEON_CP_PACKET0_ONE_REG_WR 0x00008000
-
-#define RADEON_CP_PACKET3_NOP 0xC0001000
-#define RADEON_CP_PACKET3_NEXT_CHAR 0xC0001900
-#define RADEON_CP_PACKET3_PLY_NEXTSCAN 0xC0001D00
-#define RADEON_CP_PACKET3_SET_SCISSORS 0xC0001E00
-#define RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300
-#define RADEON_CP_PACKET3_LOAD_MICROCODE 0xC0002400
-#define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xC0002600
-#define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xC0002800
-#define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xC0002900
-#define RADEON_CP_PACKET3_3D_DRAW_INDX 0xC0002A00
-#define RADEON_CP_PACKET3_LOAD_PALETTE 0xC0002C00
-#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xC0002F00
-#define RADEON_CP_PACKET3_CNTL_PAINT 0xC0009100
-#define RADEON_CP_PACKET3_CNTL_BITBLT 0xC0009200
-#define RADEON_CP_PACKET3_CNTL_SMALLTEXT 0xC0009300
-#define RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400
-#define RADEON_CP_PACKET3_CNTL_POLYLINE 0xC0009500
-#define RADEON_CP_PACKET3_CNTL_POLYSCANLINES 0xC0009800
-#define RADEON_CP_PACKET3_CNTL_PAINT_MULTI 0xC0009A00
-#define RADEON_CP_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00
-#define RADEON_CP_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00
-
-
-#define RADEON_CP_VC_FRMT_XY 0x00000000
-#define RADEON_CP_VC_FRMT_W0 0x00000001
-#define RADEON_CP_VC_FRMT_FPCOLOR 0x00000002
-#define RADEON_CP_VC_FRMT_FPALPHA 0x00000004
-#define RADEON_CP_VC_FRMT_PKCOLOR 0x00000008
-#define RADEON_CP_VC_FRMT_FPSPEC 0x00000010
-#define RADEON_CP_VC_FRMT_FPFOG 0x00000020
-#define RADEON_CP_VC_FRMT_PKSPEC 0x00000040
-#define RADEON_CP_VC_FRMT_ST0 0x00000080
-#define RADEON_CP_VC_FRMT_ST1 0x00000100
-#define RADEON_CP_VC_FRMT_Q1 0x00000200
-#define RADEON_CP_VC_FRMT_ST2 0x00000400
-#define RADEON_CP_VC_FRMT_Q2 0x00000800
-#define RADEON_CP_VC_FRMT_ST3 0x00001000
-#define RADEON_CP_VC_FRMT_Q3 0x00002000
-#define RADEON_CP_VC_FRMT_Q0 0x00004000
-#define RADEON_CP_VC_FRMT_BLND_WEIGHT_CNT_MASK 0x00038000
-#define RADEON_CP_VC_FRMT_N0 0x00040000
-#define RADEON_CP_VC_FRMT_XY1 0x08000000
-#define RADEON_CP_VC_FRMT_Z1 0x10000000
-#define RADEON_CP_VC_FRMT_W1 0x20000000
-#define RADEON_CP_VC_FRMT_N1 0x40000000
-#define RADEON_CP_VC_FRMT_Z 0x80000000
-
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_NONE 0x00000000
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_POINT 0x00000001
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE 0x00000002
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP 0x00000003
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE_2 0x00000007
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST 0x00000008
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009
-#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST 0x0000000a
-#define RADEON_CP_VC_CNTL_PRIM_WALK_IND 0x00000010
-#define RADEON_CP_VC_CNTL_PRIM_WALK_LIST 0x00000020
-#define RADEON_CP_VC_CNTL_PRIM_WALK_RING 0x00000030
-#define RADEON_CP_VC_CNTL_COLOR_ORDER_BGRA 0x00000000
-#define RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA 0x00000040
-#define RADEON_CP_VC_CNTL_MAOS_ENABLE 0x00000080
-#define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE 0x00000000
-#define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE 0x00000100
-#define RADEON_CP_VC_CNTL_TCL_DISABLE 0x00000000
-#define RADEON_CP_VC_CNTL_TCL_ENABLE 0x00000200
-#define RADEON_CP_VC_CNTL_NUM_SHIFT 16
-
-#define RADEON_VS_MATRIX_0_ADDR 0
-#define RADEON_VS_MATRIX_1_ADDR 4
-#define RADEON_VS_MATRIX_2_ADDR 8
-#define RADEON_VS_MATRIX_3_ADDR 12
-#define RADEON_VS_MATRIX_4_ADDR 16
-#define RADEON_VS_MATRIX_5_ADDR 20
-#define RADEON_VS_MATRIX_6_ADDR 24
-#define RADEON_VS_MATRIX_7_ADDR 28
-#define RADEON_VS_MATRIX_8_ADDR 32
-#define RADEON_VS_MATRIX_9_ADDR 36
-#define RADEON_VS_MATRIX_10_ADDR 40
-#define RADEON_VS_MATRIX_11_ADDR 44
-#define RADEON_VS_MATRIX_12_ADDR 48
-#define RADEON_VS_MATRIX_13_ADDR 52
-#define RADEON_VS_MATRIX_14_ADDR 56
-#define RADEON_VS_MATRIX_15_ADDR 60
-#define RADEON_VS_LIGHT_AMBIENT_ADDR 64
-#define RADEON_VS_LIGHT_DIFFUSE_ADDR 72
-#define RADEON_VS_LIGHT_SPECULAR_ADDR 80
-#define RADEON_VS_LIGHT_DIRPOS_ADDR 88
-#define RADEON_VS_LIGHT_HWVSPOT_ADDR 96
-#define RADEON_VS_LIGHT_ATTENUATION_ADDR 104
-#define RADEON_VS_MATRIX_EYE2CLIP_ADDR 112
-#define RADEON_VS_UCP_ADDR 116
-#define RADEON_VS_GLOBAL_AMBIENT_ADDR 122
-#define RADEON_VS_FOG_PARAM_ADDR 123
-#define RADEON_VS_EYE_VECTOR_ADDR 124
-
-#define RADEON_SS_LIGHT_DCD_ADDR 0
-#define RADEON_SS_LIGHT_SPOT_EXPONENT_ADDR 8
-#define RADEON_SS_LIGHT_SPOT_CUTOFF_ADDR 16
-#define RADEON_SS_LIGHT_SPECULAR_THRESH_ADDR 24
-#define RADEON_SS_LIGHT_RANGE_CUTOFF_ADDR 32
-#define RADEON_SS_VERT_GUARD_CLIP_ADJ_ADDR 48
-#define RADEON_SS_VERT_GUARD_DISCARD_ADJ_ADDR 49
-#define RADEON_SS_HORZ_GUARD_CLIP_ADJ_ADDR 50
-#define RADEON_SS_HORZ_GUARD_DISCARD_ADJ_ADDR 51
-#define RADEON_SS_SHININESS 60
-
-#define RADEON_TV_MASTER_CNTL 0x0800
-# define RADEON_TVCLK_ALWAYS_ONb (1 << 30)
-#define RADEON_TV_DAC_CNTL 0x088c
-# define RADEON_TV_DAC_CMPOUT (1 << 5)
-#define RADEON_TV_PRE_DAC_MUX_CNTL 0x0888
-# define RADEON_Y_RED_EN (1 << 0)
-# define RADEON_C_GRN_EN (1 << 1)
-# define RADEON_CMP_BLU_EN (1 << 2)
-# define RADEON_RED_MX_FORCE_DAC_DATA (6 << 4)
-# define RADEON_GRN_MX_FORCE_DAC_DATA (6 << 8)
-# define RADEON_BLU_MX_FORCE_DAC_DATA (6 << 12)
-# define RADEON_TV_FORCE_DAC_DATA_SHIFT 16
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/Makefile
deleted file mode 100644
index 9bd797315..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# src/mesa/drivers/dri/s3v/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = s3v_dri.so
-
-# Doesn't exist yet.
-#MINIGLX_SOURCES = server/savage_dri.c
-
-DRIVER_SOURCES = \
- s3v_context.c \
- s3v_dd.c \
- s3v_inithw.c \
- s3v_lock.c \
- s3v_render.c \
- s3v_screen.c \
- s3v_span.c \
- s3v_state.c \
- s3v_tex.c \
- s3v_texmem.c \
- s3v_texstate.c \
- s3v_tris.c \
- s3v_vb.c \
- s3v_xmesa.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_common.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_common.h
deleted file mode 100644
index b66cdf1df..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_common.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-/* WARNING: If you change any of these defines, make sure to change
- * the kernel include file as well (s3v_drm.h)
- */
-
-#ifndef _XF86DRI_S3V_H_
-#define _XF86DRI_S3V_H_
-
-#ifndef _S3V_DEFINES_
-#define _S3V_DEFINES_
-#define S3V_USE_BATCH 1
-
-/* #define S3V_BUF_4K 1 */
-
-#ifdef S3V_BUF_4K
-#define S3V_DMA_BUF_ORDER 12
-#define S3V_DMA_BUF_NR 256
-#else
-#define S3V_DMA_BUF_ORDER 16 /* -much- better */
-#define S3V_DMA_BUF_NR 16
-#endif
-/* on s3virge you can only choose between *
- * 4k (2^12) and 64k (2^16) dma bufs */
-#define S3V_DMA_BUF_SZ (1<<S3V_DMA_BUF_ORDER)
-
-#define S3V_NR_SAREA_CLIPRECTS 8
-
-/* Each region is a minimum of 16k (64*64@4bpp)
- * and there are at most 40 of them.
- */
-#define S3V_NR_TEX_REGIONS 64 /* was 40 */
-#define S3V_LOG_TEX_GRANULARITY 16 /* was 4 */
-/* 40 * (2 ^ 4) = 640k, that's all we have for tex on 4mb gfx card */
-/* FIXME: will it work with card with less than 4mb? */
-/* FIXME: we should set this at run time */
-
-#endif /* _S3V_DEFINES */
-
-/*
- * 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_S3V_INIT_DMA 0x00
-#define DRM_S3V_CLEANUP_DMA 0x01
-
-typedef struct _drmS3VInit {
- enum {
- S3V_INIT_DMA = 0x01,
- S3V_CLEANUP_DMA = 0x02
- } func;
-
- unsigned int pcimode; /* bool: 1=pci 0=agp */
-
- unsigned int mmio_offset;
- unsigned int buffers_offset;
- unsigned int sarea_priv_offset;
-
- unsigned int front_offset;
- unsigned int front_width;
- unsigned int front_height;
- unsigned int front_pitch;
-
- unsigned int back_offset;
- unsigned int back_width;
- unsigned int back_height;
- unsigned int back_pitch;
-
- unsigned int depth_offset;
- unsigned int depth_width;
- unsigned int depth_height;
- unsigned int depth_pitch;
-
- unsigned int texture_offset;
-} drmS3VInit;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.c
deleted file mode 100644
index 7b0aa0dae..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "context.h"
-#include "simple_list.h"
-#include "matrix.h"
-#include "extensions.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-#include "simple_list.h"
-#include "mm.h"
-
-#include "drivers/common/driverfuncs.h"
-#include "s3v_vb.h"
-#include "s3v_tris.h"
-
-#if 0
-extern const struct tnl_pipeline_stage _s3v_render_stage;
-
-static const struct tnl_pipeline_stage *s3v_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
- &_s3v_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-#endif
-
-GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- s3vContextPtr vmesa;
- s3vScreenPtr s3vScrn;
- S3VSAREAPtr saPriv=(S3VSAREAPtr)(((char*)sPriv->pSAREA) +
- sizeof(drm_sarea_t));
- struct dd_function_table functions;
-
- DEBUG_WHERE(("*** s3vCreateContext ***\n"));
-
- vmesa = (s3vContextPtr) CALLOC( sizeof(*vmesa) );
- if ( !vmesa ) return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((s3vContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- _mesa_init_driver_functions(&functions);
-
- vmesa->glCtx = _mesa_create_context(glVisual, shareCtx, &functions,
- (void *)vmesa);
- if (!vmesa->glCtx) {
- FREE(vmesa);
- return GL_FALSE;
- }
-
- vmesa->driContext = driContextPriv;
- vmesa->driScreen = sPriv;
- vmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
-
- vmesa->hHWContext = driContextPriv->hHWContext;
- vmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock;
- vmesa->driFd = sPriv->fd;
- vmesa->sarea = saPriv;
-
- s3vScrn = vmesa->s3vScreen = (s3vScreenPtr)(sPriv->private);
-
- ctx = vmesa->glCtx;
-
- ctx->Const.MaxTextureLevels = 11; /* it is (11-1) -> 1024 * 1024 FIXME */
-
- ctx->Const.MaxTextureUnits = 1; /* FIXME: or 2 ? */
-
- /* No wide points.
- */
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
- /* No wide lines.
- */
- 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;
-
- vmesa->texHeap = mmInit( 0, vmesa->s3vScreen->textureSize );
- DEBUG(("vmesa->s3vScreen->textureSize = 0x%x\n",
- vmesa->s3vScreen->textureSize));
-
- /* NOTE */
- /* mmInit(offset, size); */
-
- /* allocates a structure like this:
-
- struct mem_block_t {
- struct mem_block_t *next;
- struct mem_block_t *heap;
- int ofs,size;
- int align;
- int free:1;
- int reserved:1;
- };
-
- */
-
- make_empty_list(&vmesa->TexObjList);
- make_empty_list(&vmesa->SwappedOut);
-
- vmesa->CurrentTexObj[0] = 0;
- vmesa->CurrentTexObj[1] = 0; /* FIXME */
-
- vmesa->RenderIndex = ~0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
-#if 0
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, s3v_pipeline );
-#endif
- /* Configure swrast to match hardware characteristics:
- */
-#if 0
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-#endif
- vmesa->_3d_mode = 0;
-
- /* 3D lines / gouraud tris */
- vmesa->CMD = ( AUTO_EXEC_ON | HW_CLIP_ON | DEST_COL_1555
- | FOG_OFF | ALPHA_OFF | Z_OFF | Z_UPDATE_OFF
- | Z_LESS | TEX_WRAP_ON | TEX_MODULATE | LINEAR
- | TEX_COL_ARGB1555 | CMD_3D );
-
- vmesa->_alpha[0] = vmesa->_alpha[1] = ALPHA_OFF;
- vmesa->alpha_cmd = vmesa->_alpha[0];
- vmesa->_tri[0] = DO_GOURAUD_TRI;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
- vmesa->prim_cmd = vmesa->_tri[0];
-
- /* printf("first vmesa->CMD = 0x%x\n", vmesa->CMD); */
-
- vmesa->TexOffset = vmesa->s3vScreen->texOffset;
-
- s3vInitVB( ctx );
- s3vInitExtensions( ctx );
- s3vInitDriverFuncs( ctx );
- s3vInitStateFuncs( ctx );
- s3vInitSpanFuncs( ctx );
- s3vInitTextureFuncs( ctx );
- s3vInitTriFuncs( ctx );
- s3vInitState( vmesa );
-
- driContextPriv->driverPrivate = (void *)vmesa;
-
- /* HACK */
- vmesa->bufSize = S3V_DMA_BUF_SZ;
-
- DEBUG(("vmesa->bufSize = %i\n", vmesa->bufSize));
- DEBUG(("vmesa->bufCount = %i\n", vmesa->bufCount));
-
-
- /* dma init */
- DEBUG_BUFS(("GET_FIRST_DMA\n"));
-
- vmesa->_bufNum = 0;
-
- GET_FIRST_DMA(vmesa->driFd, vmesa->hHWContext,
- 1, &(vmesa->bufIndex[0]), &(vmesa->bufSize),
- &vmesa->_buf[0], &vmesa->bufCount, s3vScrn);
-
- GET_FIRST_DMA(vmesa->driFd, vmesa->hHWContext,
- 1, &(vmesa->bufIndex[1]), &(vmesa->bufSize),
- &vmesa->_buf[1], &vmesa->bufCount, s3vScrn);
-
- vmesa->buf = vmesa->_buf[vmesa->_bufNum];
-
-/*
- vmesa->CMD = (AUTO_EXEC_ON | HW_CLIP_ON | DEST_COL_1555
- | FOG_OFF | ALPHA_OFF | Z_OFF | Z_UPDATE_OFF
- | DO_GOURAUD_TRI | CMD_3D);
-
- vmesa->TexOffset = vmesa->s3vScreen->texOffset;
-*/
-
-/* ... but we should support only 15 bit in virge (out of 8/15/24)... */
-
- DEBUG(("glVisual->depthBits = %i\n", glVisual->depthBits));
-
- switch (glVisual->depthBits) {
- case 8:
- break;
-
- case 15:
- case 16:
- vmesa->depth_scale = 1.0f / 0xffff;
- break;
- case 24:
- vmesa->depth_scale = 1.0f / 0xffffff;
- break;
- default:
- break;
- }
-
- vmesa->cull_zero = 0.0f;
-
- vmesa->DepthSize = glVisual->depthBits;
- vmesa->Flags = S3V_FRONT_BUFFER;
- vmesa->Flags |= (glVisual->doubleBufferMode ? S3V_BACK_BUFFER : 0);
- vmesa->Flags |= (vmesa->DepthSize > 0 ? S3V_DEPTH_BUFFER : 0);
-
- vmesa->EnabledFlags = S3V_FRONT_BUFFER;
- vmesa->EnabledFlags |= (glVisual->doubleBufferMode ? S3V_BACK_BUFFER : 0);
-
-
- if (vmesa->Flags & S3V_BACK_BUFFER) {
- vmesa->readOffset = vmesa->drawOffset = vmesa->s3vScreen->backOffset;
- } else {
- vmesa->readOffset = vmesa->drawOffset = 0;
- }
-
- s3vInitHW( vmesa );
-
- driContextPriv->driverPrivate = (void *)vmesa;
-
- return GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.h
deleted file mode 100644
index b94fee6a8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_context.h
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_CONTEXT_H_
-#define _S3V_CONTEXT_H_
-
-#include "dri_util.h"
-
-#include "s3v_dri.h"
-#include "s3v_regs.h"
-#include "s3v_macros.h"
-#include "s3v_screen.h"
-#include "colormac.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "drm.h"
-#include "mm.h"
-#include "drirenderbuffer.h"
-
-/* Flags for context */
-#define S3V_FRONT_BUFFER 0x00000001
-#define S3V_BACK_BUFFER 0x00000002
-#define S3V_DEPTH_BUFFER 0x00000004
-
- /* FIXME: check */
-#define S3V_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 s3vDDUpdateHWState(GLcontext *ctx);
-extern s3vScreenPtr s3vCreateScreen(__DRIscreenPrivate *sPriv);
-extern void s3vDestroyScreen(__DRIscreenPrivate *sPriv);
-extern GLboolean s3vCreateContext(const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-#define S3V_UPLOAD_ALL 0xffffffff
-/* #define S3V_UPLOAD_CLIPRECTS 0x00000002 */
-#define S3V_UPLOAD_ALPHA 0x00000004
-#define S3V_UPLOAD_BLEND 0x00000008
-#define S3V_UPLOAD_DEPTH 0x00000010
-#define S3V_UPLOAD_VIEWPORT 0x00000020
-#define S3V_UPLOAD_SHADE 0x00000040
-#define S3V_UPLOAD_CLIP 0x00000080
-#define S3V_UPLOAD_MASKS 0x00000100
-#define S3V_UPLOAD_WINDOW 0x00000200 /* defunct */
-#define S3V_UPLOAD_GEOMETRY 0x00000400
-#define S3V_UPLOAD_POLYGON 0x00000800
-#define S3V_UPLOAD_DITHER 0x00001000
-#define S3V_UPLOAD_LOGICOP 0x00002000
-#define S3V_UPLOAD_FOG 0x00004000
-#define S3V_UPLOAD_LIGHT 0x00008000
-#define S3V_UPLOAD_CONTEXT 0x00010000
-#define S3V_UPLOAD_TEX0 0x00020000
-#define S3V_UPLOAD_STIPPLE 0x00040000
-#define S3V_UPLOAD_TRANSFORM 0x00080000
-#define S3V_UPLOAD_LINEMODE 0x00100000
-#define S3V_UPLOAD_POINTMODE 0x00200000
-#define S3V_UPLOAD_TRIMODE 0x00400000
-
-#define S3V_NEW_CLIP 0x00000001
-#define S3V_NEW_WINDOW 0x00000002
-#define S3V_NEW_CONTEXT 0x00000004
-#define S3V_NEW_TEXTURE 0x00000008 /* defunct */
-#define S3V_NEW_ALPHA 0x00000010
-#define S3V_NEW_DEPTH 0x00000020
-#define S3V_NEW_MASKS 0x00000040
-#define S3V_NEW_POLYGON 0x00000080
-#define S3V_NEW_CULL 0x00000100
-#define S3V_NEW_LOGICOP 0x00000200
-#define S3V_NEW_FOG 0x00000400
-#define S3V_NEW_LIGHT 0x00000800
-#define S3V_NEW_STIPPLE 0x00001000
-#define S3V_NEW_ALL 0xffffffff
-
-#define S3V_FALLBACK_TRI 0x00000001
-#define S3V_FALLBACK_TEXTURE 0x00000002
-
-struct s3v_context;
-typedef struct s3v_context s3vContextRec;
-typedef struct s3v_context *s3vContextPtr;
-typedef struct s3v_texture_object_t *s3vTextureObjectPtr;
-
-#define VALID_S3V_TEXTURE_OBJECT(tobj) (tobj)
-
-#define S3V_TEX_MAXLEVELS 12
-
-/* 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 s3v_texture_object_t {
- struct s3v_texture_object_t *next, *prev;
-
- GLuint age;
- struct gl_texture_object *globj;
-
- int Pitch;
- int Height;
- int WidthLog2;
- int texelBytes;
- int totalSize;
- int bound;
-
- PMemBlock MemBlock;
- GLuint BufAddr;
-
- GLuint min_level;
- GLuint max_level;
- GLuint dirty_images;
-
- GLint firstLevel, lastLevel; /* upload tObj->Image[first .. lastLevel] */
-
- struct {
- const struct gl_texture_image *image;
- int offset; /* into BufAddr */
- int height;
- int internalFormat;
- } image[S3V_TEX_MAXLEVELS];
-
- GLuint TextureCMD;
-
- GLuint TextureColorMode;
- GLuint TextureFilterMode;
- GLuint TextureBorderColor;
- GLuint TextureWrap;
- GLuint TextureMipSize;
-
- GLuint TextureBaseAddr[S3V_TEX_MAXLEVELS];
- GLuint TextureFormat;
- GLuint TextureReadMode;
-};
-
-#define S3V_NO_PALETTE 0x0
-#define S3V_USE_PALETTE 0x1
-#define S3V_UPDATE_PALETTE 0x2
-#define S3V_FALLBACK_PALETTE 0x4
-
-void s3vUpdateTextureState( GLcontext *ctx );
-
-void s3vDestroyTexObj( s3vContextPtr vmesa, s3vTextureObjectPtr t);
-void s3vUploadTexImages( s3vContextPtr vmesa, s3vTextureObjectPtr t );
-
-void s3vResetGlobalLRU( s3vContextPtr vmesa );
-void s3vTexturesGone( s3vContextPtr vmesa,
- GLuint start, GLuint end,
- GLuint in_use );
-
-void s3vEmitHwState( s3vContextPtr vmesa );
-void s3vGetLock( s3vContextPtr vmesa, GLuint flags );
-void s3vInitExtensions( GLcontext *ctx );
-void s3vInitDriverFuncs( GLcontext *ctx );
-void s3vInitSpanFuncs( GLcontext *ctx );
-void s3vSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-void s3vInitState( s3vContextPtr vmesa );
-void s3vInitHW( s3vContextPtr vmesa );
-void s3vInitStateFuncs( GLcontext *ctx );
-void s3vInitTextureFuncs( GLcontext *ctx );
-void s3vInitTriFuncs( GLcontext *ctx );
-
-void s3vUpdateWindow( GLcontext *ctx );
-void s3vUpdateViewportOffset( GLcontext *ctx );
-
-void s3vPrintLocalLRU( s3vContextPtr vmesa );
-void s3vPrintGlobalLRU( s3vContextPtr vmesa );
-
-extern void s3vFallback( s3vContextPtr vmesa, GLuint bit, GLboolean mode );
-#define FALLBACK( imesa, bit, mode ) s3vFallback( imesa, bit, mode )
-
-/* Use the templated vertex formats. Only one of these is used in s3v.
- */
-#define TAG(x) s3v##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*s3v_quad_func)( s3vContextPtr,
- const s3vVertex *,
- const s3vVertex *,
- const s3vVertex *,
- const s3vVertex * );
-typedef void (*s3v_tri_func)( s3vContextPtr,
- const s3vVertex *,
- const s3vVertex *,
- const s3vVertex * );
-typedef void (*s3v_line_func)( s3vContextPtr,
- const s3vVertex *,
- const s3vVertex * );
-typedef void (*s3v_point_func)( s3vContextPtr,
- const s3vVertex * );
-
-
-/* static void s3v_lines_emit(GLcontext *ctx, GLuint start, GLuint end); */
-typedef void (*emit_func)( GLcontext *, GLuint, GLuint);
-
-struct s3v_context {
- GLcontext *glCtx; /* Mesa context */
-
- __DRIcontextPrivate *driContext;
- __DRIscreenPrivate *driScreen;
- __DRIdrawablePrivate *driDrawable;
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
- S3VSAREAPtr sarea;
-
- /* Temporaries for translating away float colors
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Mirrors of some DRI state
- */
-
- drm_context_t hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
-
- GLuint* buf; /* FIXME */
- GLuint* _buf[2];
- int _bufNum;
- int bufIndex[2];
- int bufSize;
- int bufCount;
-
- s3vScreenPtr s3vScreen; /* Screen private DRI data */
-
- int drawOffset;
- int readOffset;
-
- s3v_point_func draw_point;
- s3v_line_func draw_line;
- s3v_tri_func draw_tri;
- s3v_quad_func draw_quad;
-
- GLuint Fallback;
- GLuint RenderIndex;
- GLuint SetupNewInputs;
- GLuint SetupIndex;
-
- GLuint vertex_format;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- char *verts;
-
- GLfloat hw_viewport[16];
- GLuint hw_primitive;
- GLenum render_primitive;
-
- GLfloat depth_scale;
-
- s3vTextureObjectPtr CurrentTexObj[2];
- struct s3v_texture_object_t TexObjList;
- struct s3v_texture_object_t SwappedOut;
- GLenum TexEnvImageFmt[2];
-
- memHeap_t *texHeap;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- int lastStamp;
-
- /* max was here: don't touch */
-
- unsigned int S3V_REG[S3V_REGS_NUM];
-
- GLuint texMode;
- GLuint alphaMode;
- GLuint lightMode;
-
- GLuint SrcBase;
- GLuint DestBase;
- GLuint DestBlit;
- GLuint ScissorLR;
- GLuint ScissorTB;
- GLuint ScissorWH; /* SubScissorWH */ /* RectWH */
- GLuint FrontStride;
- GLuint BackStride;
- GLuint SrcStride;
- GLuint DestStride;
- GLuint SrcXY;
- GLuint DestXY;
-
- GLuint ClearColor;
- GLuint Color;
- GLuint DitherMode;
- GLuint ClearDepth;
-
- GLuint TextureBorderColor;
- GLuint TexOffset;
- GLuint TexStride;
-
- GLuint CMD;
- GLuint prim_cmd;
- GLuint _tri[2]; /* 0 = gouraud; 1 = tex (lit or unlit) */
- GLuint alpha_cmd; /* actual alpha cmd */
- GLuint _alpha[2];
- GLuint _alpha_tex; /* tex alpha type */
- /* (3d_mode) 0 = 3d line/gourad tri; 1 = 3d tex tri */
- GLuint _3d_mode;
-
- GLfloat backface_sign;
- GLfloat cull_zero;
-
- int restore_primitive;
-
-/* *** 2check *** */
-
- GLuint FogMode;
- GLuint AreaStippleMode;
- GLuint LBReadFormat;
- GLuint LBWriteFormat;
- GLuint LineMode;
- GLuint PointMode;
- GLuint TriangleMode;
- GLuint 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;
-};
-
-#define S3VIRGEPACKCOLOR555( r, g, b, a ) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define S3VIRGEPACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define S3VIRGEPACKCOLOR888( r, g, b ) \
- (((r) << 16) | ((g) << 8) | (b))
-
-#define S3VIRGEPACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define S3VIRGEPACKCOLOR4444( r, g, b, a ) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-static __inline GLuint s3vPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- unsigned int ret;
- DEBUG(("cpp = %i, r=0x%x, g=0x%x, b=0x%x, a=0x%x\n", cpp, r, g, b, a));
-
- switch ( cpp ) {
- case 2:
- ret = S3VIRGEPACKCOLOR555( r, g, b, a );
- DEBUG(("ret = 0x%x\n", ret));
- return ret;
- case 4:
- return PACK_COLOR_8888( a, r, g, b );
- default:
- return 0;
- }
-}
-
-#define S3V_CONTEXT(ctx) ((s3vContextPtr)(ctx->DriverCtx))
-
-#endif /* _S3V_CONTEXT_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dd.c
deleted file mode 100644
index 2c8e230f3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dd.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_lock.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-#include "context.h"
-#include "framebuffer.h"
-#include "swrast/swrast.h"
-
-#define S3V_DATE "20020207"
-
-
-/* Return the width and height of the current color buffer.
- */
-static void s3vDDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
-/* S3VHW_LOCK( vmesa ); */
- *width = vmesa->driDrawable->w;
- *height = vmesa->driDrawable->h;
-/* S3VHW_UNLOCK( vmesa ); */
-}
-
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *s3vDDGetString( GLcontext *ctx, GLenum name )
-{
- static char buffer[128];
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Max Lingua (ladybug)";
-
- case GL_RENDERER:
- sprintf( buffer, "Mesa DRI S3 Virge " S3V_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 s3vInitExtensions( GLcontext *ctx )
-{
- /* None... */
-}
-
-/* Initialize the driver's misc functions.
- */
-void s3vInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = s3vDDGetBufferSize;
- ctx->Driver.GetString = s3vDDGetString;
-
- ctx->Driver.Error = NULL;
-
- /* Pixel path fallbacks
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dri.h
deleted file mode 100644
index 339c579f7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_dri.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_DRI
-#define _S3V_DRI
-
-#include "s3v_common.h"
-
-#define S3V_MAX_DRAWABLES (S3V_DMA_BUF_NR/2) /* 32 */ /* 256 */ /* FIXME */
-
-typedef struct
-{
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int bitsPerPixel;
-
- int fbOffset;
- int fbStride;
-
- int logTextureGranularity;
- int textureOffset;
-
- drm_handle_t regs;
- drmSize regsSize;
-
- unsigned int sarea_priv_offset;
-/*
- drmAddress regsMap;
-
- drmSize textureSize;
- drm_handle_t textures;
-*/
-
-#if 0
- drm_handle_t agp_buffers;
- drmSize agp_buf_size;
-#endif
-
-/*
- drmBufMapPtr drmBufs;
- int irq;
- unsigned int sarea_priv_offset;
-*/
-
-/* FIXME: cleanup ! */
-
- drmSize registerSize; /* == S3V_MMIO_REGSIZE */
- drm_handle_t registerHandle;
-
- drmSize pciSize;
- drm_handle_t pciMemHandle;
-
- drmSize frontSize; /* == videoRambytes */
-/* drm_handle_t frontHandle; */
- unsigned long frontOffset; /* == fbOffset */
- int frontPitch;
-/* unsigned char *front; */
-
- unsigned int bufferSize; /* size of depth/back buffer */
-
- drmSize backSize;
-/* drm_handle_t backHandle; */
- unsigned long backOffset;
- int backPitch;
-/* unsigned char *back; */
-
- drmSize depthSize;
-/* drm_handle_t depthHandle; */
- unsigned long depthOffset;
- int depthPitch;
-/* unsigned char *depth; */
-
- drmSize texSize;
-/* drm_handle_t texHandle; */
- unsigned long texOffset;
- int texPitch;
-/* unsigned char *tex; */
-
- drmSize dmaBufSize; /* Size of buffers (in bytes) */
- drm_handle_t dmaBufHandle; /* Handle from drmAddMap */
- unsigned long dmaBufOffset; /* Offset/Start */
- int dmaBufPitch; /* Pitch */
- unsigned char *dmaBuf; /* Map */
- int bufNumBufs; /* Number of buffers */
- drmBufMapPtr buffers; /* Buffer map */
-
-} S3VDRIRec, *S3VDRIPtr;
-
-/* WARNING: Do not change the SAREA structure without changing the kernel
- * as well */
-
-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 */
-} S3VTexRegionRec, *S3VTexRegionPtr;
-
-typedef struct {
- unsigned int nbox;
- drm_clip_rect_t boxes[S3V_NR_SAREA_CLIPRECTS];
-
- /* 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.
- */
- S3VTexRegionRec texList[S3V_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 */
-} S3VSAREARec, *S3VSAREAPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} S3VConfigPrivRec, *S3VConfigPrivPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} S3VDRIContextRec, *S3VDRIContextPtr;
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_inithw.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_inithw.c
deleted file mode 100644
index bdc9effb7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_inithw.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <sys/ioctl.h>
-
-#include "s3v_context.h"
-
-void s3vInitHW( s3vContextPtr vmesa )
-{
- int i;
- static short _reset = 1;
-
- DEBUG(("vmesa->driDrawable = %p\n", vmesa->driDrawable));
- DEBUG(("stride = %i\n",
- vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp));
- DEBUG(("frontOffset = 0x%x\n", vmesa->s3vScreen->frontOffset));
- DEBUG(("backOffset = 0x%x\n", vmesa->s3vScreen->backOffset));
- DEBUG(("depthOffset = 0x%x\n", vmesa->s3vScreen->depthOffset));
- DEBUG(("textureOffset = 0x%x\n", vmesa->s3vScreen->texOffset));
-
-/* if (_reset) { */
-/* ioctl(vmesa->driFd, 0x4a); */
- ioctl(vmesa->driFd, 0x41); /* reset */
- _reset = 0;
-/* ioctl(vmesa->driFd, 0x4c); */
-/* } */
-
- /* FIXME */
- switch (vmesa->s3vScreen->cpp) {
- case 2:
- break;
- case 4:
- break;
- }
-
- /* FIXME for stencil, gid, etc */
- switch (vmesa->DepthSize) {
- case 15:
- case 16:
- break;
- case 24:
- break;
- case 32:
- break;
- }
-
- vmesa->FogMode = 1;
- vmesa->ClearDepth = 0xffff;
- vmesa->x = 0;
- vmesa->y = 0;
- vmesa->w = 0;
- vmesa->h = 0;
- vmesa->FrameCount = 0;
- vmesa->MatrixMode = GL_MODELVIEW;
- vmesa->ModelViewCount = 0;
- vmesa->ProjCount = 0;
- vmesa->TextureCount = 0;
-
-
- /* FIXME: do we need the following? */
-
- for (i = 0; i < 16; i++)
- if (i % 5 == 0)
- vmesa->ModelView[i] =
- vmesa->Proj[i] =
- vmesa->ModelViewProj[i] =
- vmesa->Texture[i] = 1.0;
- else
- vmesa->ModelView[i] =
- vmesa->Proj[i] =
- vmesa->ModelViewProj[i] =
- vmesa->Texture[i] = 0.0;
-
- vmesa->LBWindowBase = vmesa->driScreen->fbWidth *
- (vmesa->driScreen->fbHeight - 1);
- vmesa->FBWindowBase = vmesa->driScreen->fbWidth *
- (vmesa->driScreen->fbHeight - 1);
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.c
deleted file mode 100644
index 52bb87ece..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-
-#if 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 s3vGetLock( s3vContextPtr vmesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-/* __DRIscreenPrivate *sPriv = vmesa->driScreen; */
-
- printf("s3vGetLock <- ***\n");
-
- drmGetLock( vmesa->driFd, vmesa->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( vmesa->display, sPriv, dPriv ); */
-
- if ( vmesa->lastStamp != dPriv->lastStamp ) {
- vmesa->lastStamp = dPriv->lastStamp;
- vmesa->new_state |= S3V_NEW_WINDOW | S3V_NEW_CLIP;
- }
-
- vmesa->numClipRects = dPriv->numClipRects;
- vmesa->pClipRects = dPriv->pClipRects;
-
-#if 0
- vmesa->dirty = ~0;
-
- if ( sarea->ctxOwner != vmesa->hHWContext ) {
- sarea->ctxOwner = vmesa->hHWContext;
- vmesa->dirty = S3V_UPLOAD_ALL;
- }
-
- for ( i = 0 ; i < vmesa->lastTexHeap ; i++ ) {
- if ( sarea->texAge[i] != vmesa->lastTexAge[i] ) {
- s3vAgeTextures( vmesa, i );
- }
- }
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.h
deleted file mode 100644
index c39d24a38..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_lock.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef __S3V_LOCK_H__
-#define __S3V_LOCK_H__
-
-#include <sys/ioctl.h>
-
-extern void s3vGetLock( s3vContextPtr vmesa, 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( vmesa ) \
- do { \
- char __ret = 0; \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( vmesa->driHwLock, vmesa->hHWContext, \
- (DRM_LOCK_HELD | vmesa->hHWContext), __ret ); \
- if ( __ret ) \
- s3vGetLock( vmesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware.
- */
-#define UNLOCK_HARDWARE( vmesa ) \
- do { \
- DRM_UNLOCK( vmesa->driFd, \
- vmesa->driHwLock, \
- vmesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-#define S3VHW_LOCK( vmesa ) \
- DRM_UNLOCK(vmesa->driFd, vmesa->driHwLock, vmesa->hHWContext); \
- DRM_SPINLOCK(&vmesa->driScreen->pSAREA->drawable_lock, \
- vmesa->driScreen->drawLockID); \
- /* VALIDATE_DRAWABLE_INFO_NO_LOCK(vmesa); */
-
-#define S3VHW_UNLOCK( vmesa ) \
- DRM_SPINUNLOCK(&vmesa->driScreen->pSAREA->drawable_lock, \
- vmesa->driScreen->drawLockID); \
- /* VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(vmesa); */
-
-#define S3V_SIMPLE_LOCK( vmesa ) \
- ioctl(vmesa->driFd, 0x4a)
-
-#define S3V_SIMPLE_FLUSH_LOCK( vmesa ) \
- ioctl(vmesa->driFd, 0x4b)
-
-#define S3V_SIMPLE_UNLOCK( vmesa ) \
- ioctl(vmesa->driFd, 0x4c)
-
-#endif /* __S3V_LOCK_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_macros.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_macros.h
deleted file mode 100644
index 3bc871b7e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_macros.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_MACROS_H_
-#define _S3V_MACROS_H_
-
-/**************/
-/* DRI macros */
-/**************/
-
-#define GENERIC_DEBUG 0
-#define FLOW_DEBUG 0
-#define DMABUFS_DEBUG 0
-
-/* Note: The argument to DEBUG*() _must_ be enclosed in parenthesis */
-
-#if (GENERIC_DEBUG || FLOW_DEBUG || DMABUFS_DEBUG)
-#include <stdio.h>
-#endif
-
-#if GENERIC_DEBUG
-#define DEBUG(str) printf str
-#else
-#define DEBUG(str)
-#endif
-
-#if FLOW_DEBUG
-#define DEBUG_WHERE(str) printf str
-#else
-#define DEBUG_WHERE(str)
-#endif
-
-#if DMABUFS_DEBUG
-#define DEBUG_BUFS(str) printf str
-#else
-#define DEBUG_BUFS(str)
-#endif
-
-
-#if 0
-#define S3V_DMA_SEND_FLAGS DRM_DMA_PRIORITY
-#define S3V_DMA_SEND_FLAGS DRM_DMA_BLOCK
-#else
-#define S3V_DMA_SEND_FLAGS 0
-#endif
-
-#if 0
-#define S3V_DMA_GET_FLAGS \
- (DRM_DMA_SMALLER_OK | DRM_DMA_LARGER_OK | DRM_DMA_WAIT)
-#else
-#define S3V_DMA_GET_FLAGS DRM_DMA_WAIT
-#endif
-
-
-#define DMAOUT_CHECK(reg,len) \
-do { \
- DEBUG(("DMAOUT_CHECK: reg = 0x%x\n", S3V_##reg##_REG)); \
- DEBUG_BUFS(("DMAOUT_CHECK (was): ")); \
- DEBUG_BUFS(("vmesa->bufCount=%i of vmesa->bufSize=%i\n", \
- vmesa->bufCount, vmesa->bufSize)); \
- /* FIXME: > or >= */ \
- if (vmesa->bufCount+(len+1) >= vmesa->bufSize) \
- DMAFLUSH(); \
-\
- vmesa->bufCount += (len+1); \
- DEBUG_BUFS(("DMAOUT_CHECK (is): vmesa->bufCount=%i len=%i, reg=%x\n", \
- vmesa->bufCount, len, S3V_##reg##_REG)); \
- DMAOUT( ((len & 0xffff) | ((S3V_##reg##_REG & 0xfffc) << 14)) ); \
-} while (0)
-
-#define DMAOUT(val) \
-do { \
- *(vmesa->buf++)=val; \
- DEBUG_BUFS(("DMAOUT: val=0x%x\n", (unsigned int)val)); \
-} while(0)
-
-#define DMAFINISH() \
-do { \
- /* NOTE: it does nothing - it just prints some summary infos */ \
- DEBUG(("DMAFINISH: vmesa->bufCount=%i\n", vmesa->bufCount)); \
- DEBUG(("buf: index=%i; addr=%p\n", vmesa->bufIndex[vmesa->_bufNum], \
- vmesa->s3vScreen->bufs->list[vmesa->bufIndex[vmesa->_bufNum]].address)); \
-} while(0)
-
-#define DMAFLUSH() \
-do { \
- if (vmesa->bufCount) { \
- SEND_DMA(vmesa->driFd, vmesa->hHWContext, 1, \
- &vmesa->bufIndex[vmesa->_bufNum], &vmesa->bufCount); \
-/*
- GET_DMA(vmesa->driFd, vmesa->hHWContext, 1, \
- &vmesa->bufIndex, &vmesa->bufSize); \
-*/ \
- vmesa->_bufNum = !(vmesa->_bufNum); \
- vmesa->buf = vmesa->_buf[vmesa->_bufNum]; \
-/*
- vmesa->buf = \
- vmesa->s3vScreen->bufs->list[vmesa->bufIndex].address; \
-*/ \
- vmesa->bufCount = 0; \
- } \
-} while (0)
-
-#define CMDCHANGE() \
-do { \
- DMAOUT_CHECK(3DTRI_CMDSET, 1); /* FIXME: TRI/LINE */ \
- DMAOUT(vmesa->CMD); \
- DMAFINISH(); \
-} 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; \
-\
- DEBUG(("GET_DMA: ")); \
- DEBUG(("req_count=%i; req_list[#0]=%i; req_size[#0]=%i\n", \
- n, (idx)[n-1], (size)[n-1])); \
-\
- dma.context = (hHWCtx); \
- dma.send_count = 0; \
- dma.send_list = NULL; \
- dma.send_sizes = NULL; \
- dma.flags = S3V_DMA_GET_FLAGS; \
- dma.request_count = (n); \
- dma.request_size = S3V_DMA_BUF_SZ; \
- dma.request_list = (idx); \
- dma.request_sizes = (size); \
-\
- do { \
- if ((retcode = drmDMA((fd), &dma))) { \
- DEBUG_BUFS(("drmDMA (get) returned %d\n", retcode)); \
- } \
-} while (!(dma).granted_count); \
-\
- for (i = 0; i < (n); i++) { \
- DEBUG(("Got buffer %i (index #%i)\n", (idx)[i], i)); \
- DEBUG(("of %i bytes (%i words) size\n", \
- (size)[i], (size)[i] >>2)); \
- /* Convert from bytes to words */ \
- (size)[i] >>= 2; \
- } \
-} while (0)
-
-#define SEND_DMA(fd, hHWCtx, n, idx, cnt) \
-do { \
- drmDMAReq dma; \
- int retcode, i; \
-\
- DEBUG(("SEND_DMA: ")); \
- DEBUG(("send_count=%i; send_list[#0]=%i; send_sizes[#0]=%i\n", \
- n, (idx)[n-1], (cnt)[n-1])); \
-\
- for (i = 0; i < (n); i++) { \
- /* Convert from words to bytes */ \
- (cnt)[i] <<= 2; \
- } \
-\
- dma.context = (hHWCtx); \
- dma.send_count = (n); \
- dma.send_list = (idx); \
- dma.send_sizes = (cnt); \
- dma.flags = S3V_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_BUFS(("drmDMA (send) returned %d\n", retcode)); \
- } \
-\
- for (i = 0; i < (n); i++) { \
- DEBUG(("Sent buffer %i (index #%i)\n", (idx)[i], i)); \
- DEBUG(("of %i bytes (%i words) size\n", \
- (cnt)[i], (cnt)[i] >>2)); \
- (cnt)[i] = 0; \
- } \
-} while (0)
-#endif /* DONT_SEND_DMA */
-
-#define GET_FIRST_DMA(fd, hHWCtx, n, idx, size, buf, cnt, vPriv) \
-do { \
- int i; \
- DEBUG_BUFS(("GET_FIRST_DMA\n")); \
- DEBUG_BUFS(("n=%i idx=%i size=%i\n", n, *idx, *size)); \
- DEBUG_BUFS(("going to GET_DMA\n")); \
- GET_DMA(fd, hHWCtx, n, idx, size); \
- DEBUG_BUFS(("coming from GET_DMA\n")); \
- DEBUG_BUFS(("n=%i idx=%i size=%i\n", n, (idx)[0], (size)[0])); \
- for (i = 0; i < (n); i++) { \
- DEBUG_BUFS(("buf #%i @%p\n", \
- i, (vPriv)->bufs->list[(idx)[i]].address)); \
- (buf)[i] = (vPriv)->bufs->list[(idx)[i]].address; \
- (cnt)[i] = 0; \
- } \
- DEBUG(("GOING HOME\n")); \
-} while (0)
-
-/**************************/
-/* generic, global macros */
-/**************************/
-
-#define CALC_LOG2(l2,s) \
-do { \
- int __s = s; \
- l2 = 0; \
- while (__s > 1) { ++l2; __s >>= 1; } \
-} while (0)
-
-#define PrimType_Null 0x00000000
-#define PrimType_Points 0x10000000
-#define PrimType_Lines 0x20000000
-#define PrimType_LineLoop 0x30000000
-#define PrimType_LineStrip 0x40000000
-#define PrimType_Triangles 0x50000000
-#define PrimType_TriangleStrip 0x60000000
-#define PrimType_TriangleFan 0x70000000
-#define PrimType_Quads 0x80000000
-#define PrimType_QuadStrip 0x90000000
-#define PrimType_Polygon 0xa0000000
-#define PrimType_Mask 0xf0000000
-
-#endif /* _S3V_MACROS_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_regs.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_regs.h
deleted file mode 100644
index 26a7c54af..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_regs.h
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_REG_H
-#define _S3V_REG_H
-
-#define S3V_REGS_NUM 256
-
-/************
- * DMA REGS *
- ************/
-
-#define S3V_DMA_ID 0
-#define S3V_DMA_REG 0x8590
-#define S3V_DMA_WRITEP_ID 1
-#define S3V_DMA_WRITEP_REG 0x8594
-#define S3V_DMA_READP_ID 2
-#define S3V_DMA_READP_REG 0x8598
-#define S3V_DMA_ENABLE_ID 3
-#define S3V_DMA_ENABLE_REG 0x859C
-#define S3V_DMA_UPDATE_ID 4
-#define S3V_DMA_UPDATE_REG 0x10000
-
-/***************
- * STATUS REGS *
- ***************/
-
-#define S3V_STAT_ID 10
-#define S3V_STAT_REG 0x8504
-#define S3V_STAT_VSYNC_ID 11
-#define S3V_STAT_VSYNC_REG 0x8505
-#define S3V_STAT_3D_DONE_ID 12
-#define S3V_STAT_3D_DONE_REG 0x8506
-#define S3V_STAT_FIFO_OVER_ID 13
-#define S3V_STAT_FIFO_OVER_REG 0x8508
-#define S3V_STAT_FIFO_EMPTY_ID 14
-#define S3V_STAT_FIFO_EMPTY_REG 0x850C
-#define S3V_STAT_HDMA_DONE_ID 15
-#define S3V_STAT_HDMA_DONE_REG 0x8514
-#define S3V_STAT_CDMA_DONE_ID 16
-#define S3V_STAT_CDMA_DONE_REG 0x8524
-#define S3V_STAT_3D_FIFO_EMPTY_ID 17
-#define S3V_STAT_3D_FIFO_EMPTY_REG 0x8544
-#define S3V_STAT_LPB_ID 18
-#define S3V_STAT_LPB_REG 0x8584
-#define S3V_STAT_3D_BUSY_ID 19
-#define S3V_STAT_3D_BUSY_REG 0x8704
-
-/***********
- * 2D REGS *
- ***********/
-
-#define S3V_BITBLT_ID 30
-#define S3V_BITBLT_REG 0xA400
-#define S3V_BITBLT_SRC_BASE_ID 31
-#define S3V_BITBLT_SRC_BASE_REG 0xA4D4
-#define S3V_BITBLT_DEST_BASE_ID 32
-#define S3V_BITBLT_DEST_BASE_REG 0xA4D8
-#define S3V_BITBLT_CLIP_L_R_ID 33
-#define S3V_BITBLT_CLIP_L_R_REG 0xA4DC
-#define S3V_BITBLT_CLIP_T_B_ID 34
-#define S3V_BITBLT_CLIP_T_B_REG 0xA4E0
-#define S3V_BITBLT_DEST_SRC_STRIDE_ID 35
-#define S3V_BITBLT_DEST_SRC_STRIDE_REG 0xA4E4
-#define S3V_BITBLT_MONO_PAT0_ID 36
-#define S3V_BITBLT_MONO_PAT0_REG 0xA4E8
-#define S3V_BITBLT_MONO_PAT1_ID 37
-#define S3V_BITBLT_MONO_PAT1_REG 0xA4EC
-#define S3V_BITBLT_PAT_BG_COLOR_ID 38
-#define S3V_BITBLT_PAT_BG_COLOR_REG 0xA4F0
-#define S3V_BITBLT_PAT_FG_COLOR_ID 39
-#define S3V_BITBLT_PAT_FG_COLOR_REG 0xA4F4
-#define S3V_BITBLT_CMDSET_ID 40
-#define S3V_BITBLT_CMDSET_REG 0xA500
-#define S3V_BITBLT_WIDTH_HEIGHT_ID 41
-#define S3V_BITBLT_WIDTH_HEIGHT_REG 0xA504
-#define S3V_BITBLT_SRC_X_Y_ID 42
-#define S3V_BITBLT_SRC_X_Y_REG 0xA508
-#define S3V_BITBLT_DEST_X_Y_ID 43
-#define S3V_BITBLT_DEST_X_Y_REG 0xA50C
-#define S3V_2DLINE_ID 44
-#define S3V_2DLINE_REG 0xA800
-#define S3V_2DPOLY_ID 45
-#define S3V_2DPOLY_REG 0xAC00
-
-/***************
- * 3DLINE REGS *
- ***************/
-/* base regs */
-#define S3V_3DLINE_ID 50
-#define S3V_3DLINE_REG 0xB000
-#define S3V_3DLINE_Z_BASE_ID 51
-#define S3V_3DLINE_Z_BASE_REG 0xB0D4
-#define S3V_3DLINE_SRC_BASE_ID 52 /* it is the same reg */
-#define S3V_3DLINE_SRC_BASE_REG 0xB0D4
-#define S3V_3DLINE_DEST_BASE_ID 53
-#define S3V_3DLINE_DEST_BASE_REG 0xB0D8
-#define S3V_3DLINE_CLIP_L_R_ID 54
-#define S3V_3DLINE_CLIP_L_R_REG 0xB0DC
-#define S3V_3DLINE_CLIP_T_B_ID 55
-#define S3V_3DLINE_CLIP_T_B_REG 0xB0E0
-#define S3V_3DLINE_DEST_SRC_STRIDE_ID 56
-#define S3V_3DLINE_DEST_SRC_STRIDE_REG 0xB0E4
-#define S3V_3DLINE_Z_STRIDE_ID 57
-#define S3V_3DLINE_Z_STRIDE_REG 0xB0E8
-#define S3V_3DLINE_TEX_BASE_ID 58
-#define S3V_3DLINE_TEX_BASE_REG 0xB0EC
-#define S3V_3DLINE_TEX_B_COLOR_ID 59
-#define S3V_3DLINE_TEX_B_COLOR_REG 0xB0F0
-#define S3V_3DLINE_FOG_COLOR_ID 60
-#define S3V_3DLINE_FOG_COLOR_REG 0xB0F4
-#define S3V_3DLINE_COLOR0_ID 61
-#define S3V_3DLINE_COLOR0_REG 0xB0F8
-#define S3V_3DLINE_COLOR1_ID 62
-#define S3V_3DLINE_COLOR1_REG 0xB0FC
-#define S3V_3DLINE_CMDSET_ID 63
-#define S3V_3DLINE_CMDSET_REG 0xB100 /* special */
-/* tex regs */
-/* FIXME: shouldn't it be a 1D tex for lines? */
-#define S3V_3DLINE_BASEV_ID 64
-#define S3V_3DLINE_BASEV_REG 0xB104
-#define S3V_3DLINE_BASEU_ID 65
-#define S3V_3DLINE_BASEU_REG 0xB108
-#define S3V_3DLINE_WXD_ID 66
-#define S3V_3DLINE_WXD_REG 0xB10C
-#define S3V_3DLINE_WYD_ID 67
-#define S3V_3DLINE_WYD_REG 0xB110
-#define S3V_3DLINE_WSTART_ID 68
-#define S3V_3DLINE_WSTART_REG 0xB114
-#define S3V_3DLINE_DXD_ID 69
-#define S3V_3DLINE_DXD_REG 0xB118
-#define S3V_3DLINE_VXD_ID 70
-#define S3V_3DLINE_VXD_REG 0xB11C
-#define S3V_3DLINE_UXD_ID 71
-#define S3V_3DLINE_UXD_REG 0xB120
-#define S3V_3DLINE_DYD_ID 72
-#define S3V_3DLINE_DYD_REG 0xB124
-#define S3V_3DLINE_VYD_ID 73
-#define S3V_3DLINE_VYD_REG 0xB128
-#define S3V_3DLINE_UYD_ID 74
-#define S3V_3DLINE_UYD_REG 0xB12C
-#define S3V_3DLINE_DSTART_ID 75
-#define S3V_3DLINE_DSTART_REG 0xB130
-#define S3V_3DLINE_VSTART_ID 76
-#define S3V_3DLINE_VSTART_REG 0xB134
-#define S3V_3DLINE_USTART_ID 77
-#define S3V_3DLINE_USTART_REG 0xB138
-/* gourad regs */
-#define S3V_3DLINE_GBD_ID 78
-#define S3V_3DLINE_GBD_REG 0xB144
-#define S3V_3DLINE_ARD_ID 79
-#define S3V_3DLINE_ARD_REG 0xB148
-#define S3V_3DLINE_GS_BS_ID 80
-#define S3V_3DLINE_GS_BS_REG 0xB14C
-#define S3V_3DLINE_AS_RS_ID 81
-#define S3V_3DLINE_AS_RS_REG 0xB150
-/* vertex regs */
-#define S3V_3DLINE_DZ_ID 82
-#define S3V_3DLINE_DZ_REG 0xB158
-#define S3V_3DLINE_ZSTART_ID 83
-#define S3V_3DLINE_ZSTART_REG 0xB15C
-#define S3V_3DLINE_XEND0_END1_ID 84
-#define S3V_3DLINE_XEND0_END1_REG 0xB16C
-#define S3V_3DLINE_DX_ID 85
-#define S3V_3DLINE_DX_REG 0xB170
-#define S3V_3DLINE_XSTART_ID 86
-#define S3V_3DLINE_XSTART_REG 0xB174
-#define S3V_3DLINE_YSTART_ID 87
-#define S3V_3DLINE_YSTART_REG 0xB178
-#define S3V_3DLINE_YCNT_ID 88
-#define S3V_3DLINE_YCNT_REG 0xB17C
-
-/**************
- * 3DTRI REGS *
- **************/
-/* base regs */
-#define S3V_3DTRI_ID 100
-#define S3V_3DTRI_REG 0xB400
-#define S3V_3DTRI_Z_BASE_ID 101
-#define S3V_3DTRI_Z_BASE_REG 0xB4D4
-#define S3V_3DTRI_SRC_BASE_ID 102 /* it is the same reg */
-#define S3V_3DTRI_SRC_BASE_REG 0xB4D4
-#define S3V_3DTRI_DEST_BASE_ID 103
-#define S3V_3DTRI_DEST_BASE_REG 0xB4D8
-#define S3V_3DTRI_CLIP_L_R_ID 104
-#define S3V_3DTRI_CLIP_L_R_REG 0xB4DC
-#define S3V_3DTRI_CLIP_T_B_ID 105
-#define S3V_3DTRI_CLIP_T_B_REG 0xB4E0
-#define S3V_3DTRI_DEST_SRC_STRIDE_ID 106
-#define S3V_3DTRI_DEST_SRC_STRIDE_REG 0xB4E4
-#define S3V_3DTRI_Z_STRIDE_ID 107
-#define S3V_3DTRI_Z_STRIDE_REG 0xB4E8
-#define S3V_3DTRI_TEX_BASE_ID 108
-#define S3V_3DTRI_TEX_BASE_REG 0xB4EC
-#define S3V_3DTRI_TEX_B_COLOR_ID 109
-#define S3V_3DTRI_TEX_B_COLOR_REG 0xB4F0
-#define S3V_3DTRI_FOG_COLOR_ID 110
-#define S3V_3DTRI_FOG_COLOR_REG 0xB4F4
-#define S3V_3DTRI_COLOR0_ID 111
-#define S3V_3DTRI_COLOR0_REG 0xB4F8
-#define S3V_3DTRI_COLOR1_ID 112
-#define S3V_3DTRI_COLOR1_REG 0xB4FC
-#define S3V_3DTRI_CMDSET_ID 113 /* special */
-#define S3V_3DTRI_CMDSET_REG 0xB500
-/* tex regs */
-#define S3V_3DTRI_BASEV_ID 114
-#define S3V_3DTRI_BASEV_REG 0xB504
-#define S3V_3DTRI_BASEU_ID 115
-#define S3V_3DTRI_BASEU_REG 0xB508
-#define S3V_3DTRI_WXD_ID 116
-#define S3V_3DTRI_WXD_REG 0xB50C
-#define S3V_3DTRI_WYD_ID 117
-#define S3V_3DTRI_WYD_REG 0xB510
-#define S3V_3DTRI_WSTART_ID 118
-#define S3V_3DTRI_WSTART_REG 0xB514
-#define S3V_3DTRI_DXD_ID 119
-#define S3V_3DTRI_DXD_REG 0xB518
-#define S3V_3DTRI_VXD_ID 120
-#define S3V_3DTRI_VXD_REG 0xB51C
-#define S3V_3DTRI_UXD_ID 121
-#define S3V_3DTRI_UXD_REG 0xB520
-#define S3V_3DTRI_DYD_ID 122
-#define S3V_3DTRI_DYD_REG 0xB524
-#define S3V_3DTRI_VYD_ID 123
-#define S3V_3DTRI_VYD_REG 0xB528
-#define S3V_3DTRI_UYD_ID 124
-#define S3V_3DTRI_UYD_REG 0xB52C
-#define S3V_3DTRI_DSTART_ID 125
-#define S3V_3DTRI_DSTART_REG 0xB530
-#define S3V_3DTRI_VSTART_ID 126
-#define S3V_3DTRI_VSTART_REG 0xB534
-#define S3V_3DTRI_USTART_ID 127
-#define S3V_3DTRI_USTART_REG 0xB538
-/* gourad regs */
-#define S3V_3DTRI_GBX_ID 128
-#define S3V_3DTRI_GBX_REG 0xB53C
-#define S3V_3DTRI_ARX_ID 129
-#define S3V_3DTRI_ARX_REG 0xB540
-#define S3V_3DTRI_GBY_ID 130
-#define S3V_3DTRI_GBY_REG 0xB544
-#define S3V_3DTRI_ARY_ID 131
-#define S3V_3DTRI_ARY_REG 0xB548
-#define S3V_3DTRI_GS_BS_ID 132
-#define S3V_3DTRI_GS_BS_REG 0xB54C
-#define S3V_3DTRI_AS_RS_ID 133
-#define S3V_3DTRI_AS_RS_REG 0xB550
-/* vertex regs */
-#define S3V_3DTRI_ZXD_ID 134
-#define S3V_3DTRI_ZXD_REG 0xB554
-#define S3V_3DTRI_ZYD_ID 135
-#define S3V_3DTRI_ZYD_REG 0xB558
-#define S3V_3DTRI_ZSTART_ID 136
-#define S3V_3DTRI_ZSTART_REG 0xB55C
-#define S3V_3DTRI_TXDELTA12_ID 137
-#define S3V_3DTRI_TXDELTA12_REG 0xB560
-#define S3V_3DTRI_TXEND12_ID 138
-#define S3V_3DTRI_TXEND12_REG 0xB564
-#define S3V_3DTRI_TXDELTA01_ID 139
-#define S3V_3DTRI_TXDELTA01_REG 0xB568
-#define S3V_3DTRI_TXEND01_ID 140
-#define S3V_3DTRI_TXEND01_REG 0xB56C
-#define S3V_3DTRI_TXDELTA02_ID 141
-#define S3V_3DTRI_TXDELTA02_REG 0xB570
-#define S3V_3DTRI_TXSTART02_ID 142
-#define S3V_3DTRI_TXSTART02_REG 0xB574
-#define S3V_3DTRI_TYS_ID 143
-#define S3V_3DTRI_TYS_REG 0xB578
-#define S3V_3DTRI_TY01_Y12_ID 144
-#define S3V_3DTRI_TY01_Y12_REG 0xB57C
-
-/* COMMANDS (to 0xB100 [lines] or 0xB500 [tris]) */
-
-/* Auto execute */
-#define AUTO_EXEC_MASK 0x00000001
-#define AUTO_EXEC_OFF (0x0)
-#define AUTO_EXEC_ON (0x1)
-/* HW clipping */
-#define HW_CLIP_MASK 0x00000002
-#define HW_CLIP_OFF (0x0 << 1)
-#define HW_CLIP_ON (0x1 << 1)
-/* Destination color */
-#define DEST_COL_MASK 0x0000001c
-#define DEST_COL_PAL (0x0 << 2) /* 8 bpp - palettized */
-#define DEST_COL_1555 (0x1 << 2) /* 16 bpp - ZRGB */
-#define DEST_COL_888 (0x2 << 2) /* 24 bpp - RGB */
-/* Texture color */
-#define TEX_COL_MASK 0x000000e0
-#define TEX_COL_ARGB8888 (0x0 << 5) /* 32 bpp - ARGB */
-#define TEX_COL_ARGB4444 (0x1 << 5) /* 16 bpp - ARGB */
-#define TEX_COL_ARGB1555 (0x2 << 5) /* 16 bpp - ARGB */
-#define TEX_COL_ALPHA4 (0x3 << 5) /* 8 bpp - ALPHA4 */
-#define TEX_COL_BLEND4_LOW (0x4 << 5) /* 4 bpp - BLEND4 low nibble */
-#define TEX_COL_BLEND4_HIGH (0x5 << 5) /* 4 bpp - BLEND4 high nibble */
-#define TEX_COL_PAL (0x6 << 5) /* 8 bpp - palettized */
-#define TEX_COL_YUV (0x7 << 5) /* 16 bpp - YUV */
-/* Mipmap level */
-#define MIP_MASK 0x00000f00
-#define MIPMAP_LEVEL(s) (s << 8) /* 8 -> 11 bits */
-/* Texture filtering */
-#define TEX_FILTER_MASK 0x00007000
-#define MIP_NEAREST (0x0 << 12)
-#define LINEAR_MIP_NEAREST (0x1 << 12)
-#define MIP_LINEAR (0x2 << 12)
-#define LINEAR_MIP_LINEAR (0x3 << 12)
-#define NEAREST (0x4 << 12)
-#define FAST_BILINEAR (0x5 << 12)
-#define LINEAR (0x6 << 12)
-/* Texture blending */
-#define TEX_BLEND_MAKS 0x00018000
-#define TEX_REFLECT (0x0 << 15)
-#define TEX_MODULATE (0x1 << 15)
-#define TEX_DECAL (0x2 << 15)
-/* Fog */
-#define FOG_MASK 0x00020000
-#define FOG_OFF (0x0 << 17)
-#define FOG_ON (0x1 << 17)
-/* Alpha blending */
-#define ALPHA_BLEND_MASK 0x000c0000
-#define ALPHA_OFF (0x0 << 18) | (0x0 << 19)
-#define ALPHA_TEX (0x2 << 18)
-#define ALPHA_SRC (0x3 << 18)
-/* Depth compare mode */
-#define Z_MODE_MASK 0x00700000
-#define Z_NEVER (0x0 << 20)
-#define Z_GREATER (0x1 << 20)
-#define Z_EQUAL (0x2 << 20)
-#define Z_GEQUAL (0x3 << 20)
-#define Z_LESS (0x4 << 20)
-#define Z_NOTEQUAL (0x5 << 20)
-#define Z_LEQUAL (0x6 << 20)
-#define Z_ALWAYS (0x7 << 20)
-/* Depth update */
-#define Z_UPDATE_MASK 0x00800000
-#define Z_UPDATE_OFF (0x0 << 23) /* disable z update */
-#define Z_UPDATE_ON (0x1 << 23)
-/* Depth buffering mode */
-#define Z_BUFFER_MASK 0x03000000
-#define Z_BUFFER (0x0 << 24) | (0x0 << 25)
-#define Z_MUX_BUF (0x1 << 24) | (0x0 << 25)
-#define Z_MUX_DRAW (0x2 << 24)
-#define Z_OFF (0x3 << 24) /* no z buffering */
-/* Texture wrapping */
-#define TEX_WRAP_MASK 0x04000000
-#define TEX_WRAP_OFF (0x0 << 26)
-#define TEX_WRAP_ON (0x1 << 26)
-/* 3d command */
-#define DO_MASK 0x78000000
-#define DO_GOURAUD_TRI (0x0 << 27)
-#define DO_TEX_LIT_TRI_OLD (0x1 << 27)
-#define DO_TEX_UNLIT_TRI_OLD (0x2 << 27)
-#define DO_TEX_LIT_TRI (0x5 << 27)
-#define DO_TEX_UNLIT_TRI (0x6 << 27)
-#define DO_3D_LINE (0x8 << 27)
-#define DO_NOP (0xf << 27) /* turn on autoexec */
-/* status */
-#define CMD_MASK 0x80000000
-#define CMD_2D (0x0 << 31) /* execute a 2d cmd */
-#define CMD_3D (0x1 << 31) /* execute a 3d cmd */
-
-/* global masks */
-#define TEX_MASK ( TEX_COL_MASK | TEX_WRAP_MASK | MIP_MASK \
- | TEX_FILTER_MASK | TEX_BLEND_MAKS \
- | TEX_WRAP_MASK )
-#define Z_MASK ( Z_MODE_MASK | Z_UPDATE_MASK | Z_BUFFER_MASK )
-
-#endif /* _S3V_REG_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c
deleted file mode 100644
index 6aaa94976..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_render.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "s3v_context.h"
-#include "s3v_tris.h"
-#include "s3v_vb.h"
-
-
-#define HAVE_POINTS 0
-#define HAVE_LINES 0
-#define HAVE_LINE_STRIPS 0
-#define HAVE_TRIANGLES 0
-#define HAVE_TRI_STRIPS 0
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 0
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-#define HAVE_POLYGONS 0
-
-#define HAVE_ELTS 0
-
-#if 0
-static void VERT_FALLBACK( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
- int _flags;
-
- DEBUG(("VERT_FALLBACK: flags & PRIM_MODE_MASK = %i\n",
- flags & PRIM_MODE_MASK));
- DEBUG(("VERT_FALLBACK: flags=%i PRIM_MODE_MASK=%i\n",
- flags, PRIM_MODE_MASK));
-#if 0
- tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
-#endif
- tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
-
- _flags = flags & PRIM_MODE_MASK;
-
- tnl->Driver.Render.PrimTabVerts[_flags]( ctx, start, count, flags );
- S3V_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
-}
-#endif
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PrimType_Points,
- PrimType_Lines,
- PrimType_LineLoop,
- PrimType_LineStrip,
- PrimType_Triangles,
- PrimType_TriangleStrip,
- PrimType_TriangleFan,
- PrimType_Quads,
- PrimType_QuadStrip,
- PrimType_Polygon
-};
-
-static __inline void s3vStartPrimitive( s3vContextPtr vmesa, GLenum prim )
-{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- int _hw_prim = hw_prim[prim];
-
- DEBUG(("s3vStartPrimitive (new #%i) ", prim));
-
- if (_hw_prim != vmesa->restore_primitive) {
-
- if (prim == 4) { /* TRI */
- DEBUG(("switching to tri\n"));
- vmesa->prim_cmd = vmesa->_tri[vmesa->_3d_mode];
- vmesa->alpha_cmd = vmesa->_alpha[vmesa->_3d_mode];
- DMAOUT_CHECK(3DTRI_Z_BASE, 12);
- } else if (prim == 1) { /* LINE */
- DEBUG(("switching to line\n"));
- vmesa->prim_cmd = DO_3D_LINE;
- vmesa->alpha_cmd = vmesa->_alpha[0];
- DMAOUT_CHECK(3DLINE_Z_BASE, 12);
- } else {
- DEBUG(("Never mind the bollocks!\n"));
- }
-
- DMAOUT(vmesa->s3vScreen->depthOffset & 0x003FFFF8);
- DMAOUT(vmesa->DestBase);
- /* DMAOUT(vmesa->ScissorLR); */
- /* DMAOUT(vmesa->ScissorTB); */
- DMAOUT( (0 << 16) | (dPriv->w-1) );
- DMAOUT( (0 << 16) | (dPriv->h-1) );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->TexStride );
- DMAOUT(vmesa->SrcStride);
- DMAOUT(vmesa->TexOffset);
- DMAOUT(vmesa->TextureBorderColor);
- DMAOUT(0); /* FOG */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT(vmesa->CMD | vmesa->prim_cmd | vmesa->alpha_cmd);
- DMAFINISH();
- }
-
- vmesa->restore_primitive = _hw_prim;
-}
-
-static __inline void s3vEndPrimitive( s3vContextPtr vmesa )
-{
-/* GLcontext *ctx = vmesa->glCtx; */
- DEBUG(("s3vEndPrimitive\n"));
-}
-
-#define LOCAL_VARS s3vContextPtr vmesa = S3V_CONTEXT(ctx)
-#define INIT( prim ) s3vStartPrimitive( vmesa, prim )
-#define FINISH s3vEndPrimitive( vmesa )
-#define NEW_PRIMITIVE() (void) vmesa
-#define NEW_BUFFER() (void) vmesa
-#define FIRE_VERTICES() (void) vmesa
-#define GET_CURRENT_VB_MAX_VERTS() \
- (vmesa->bufSize - vmesa->bufCount) / 2
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- S3V_DMA_BUF_SZ / 2
-/* XXX */
-#define ALLOC_VERTS(nr) NULL
-#define EMIT_VERTS(ctx, start, count, buf) NULL
-#define FLUSH() s3vEndPrimitive( vmesa )
-
-#define TAG(x) s3v_##x
-
-#include "tnl_dd/t_dd_dmatmp.h"
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-static GLboolean s3v_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
- tnl_render_func *tab;
-
- DEBUG(("s3v_run_render\n"));
-
- /* FIXME: hw clip */
- if (VB->ClipOrMask || vmesa->RenderIndex != 0) {
- DEBUG(("*** CLIPPED in render ***\n"));
-#if 1
- return GL_TRUE; /* don't handle clipping here */
-#endif
- }
-
-
- /* We don't do elts */
- if (VB->Elts)
- return GL_TRUE;
-
- tab = TAG(render_tab_verts);
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++ )
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- DEBUG(("s3v_run_render (loop=%i) (lenght=%i)\n", i, length));
-
- if (length) {
- tnl->Driver.Render.BuildVertices( ctx, start,
- start+length, ~0 /*stage->inputs*/); /* XXX */
- tnl->Driver.Render.PrimTabVerts[prim & PRIM_MODE_MASK]
- ( ctx, start, start + length, prim );
- vmesa->SetupNewInputs = VERT_BIT_POS;
- }
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-
-const struct tnl_pipeline_stage _s3v_render_stage =
-{
- "s3v render",
- NULL,
- NULL,
- NULL,
- NULL,
- s3v_run_render /* run */
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.c
deleted file mode 100644
index f1810597e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_dri.h"
-
-s3vScreenPtr s3vCreateScreen( __DRIscreenPrivate *sPriv )
-{
- s3vScreenPtr s3vScreen;
- S3VDRIPtr vDRIPriv = (S3VDRIPtr)sPriv->pDevPriv;
-
-/* int i; */
-
- DEBUG(("s3vCreateScreen\n"));
- DEBUG(("sPriv->pDevPriv at %p\n", sPriv->pDevPriv));
- DEBUG(("size = %i\n", sizeof(*vDRIPriv)));
-
- if (sPriv->devPrivSize != sizeof(S3VDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(S3VDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- s3vScreen = (s3vScreenPtr) CALLOC( sizeof(*s3vScreen) );
- if ( !s3vScreen ) return NULL;
-
- s3vScreen->regionCount = 4; /* Magic number. Can we fix this? */
-
- s3vScreen->regions = _mesa_malloc(s3vScreen->regionCount *
- sizeof(s3vRegion));
- DEBUG(("sPriv->fd = %i\nvDRIPriv->dmaBufHandle = %x\n",
- sPriv->fd, vDRIPriv->dmaBufHandle));
-
- DEBUG(("vDRIPriv->dmaBufSize=%i\nvDRIPriv->dmaBuf=%p\n",
- vDRIPriv->dmaBufSize, vDRIPriv->dmaBuf));
-
-
- /* Get the list of dma buffers */
- s3vScreen->bufs = drmMapBufs(sPriv->fd);
-
- if (!s3vScreen->bufs) {
- DEBUG(("Helter/skelter with drmMapBufs\n"));
- return GL_FALSE;
- }
-
- s3vScreen->textureSize = vDRIPriv->texSize;
- s3vScreen->logTextureGranularity = vDRIPriv->logTextureGranularity;
- s3vScreen->cpp = vDRIPriv->cpp;
- s3vScreen->frontOffset = vDRIPriv->frontOffset;
- s3vScreen->frontPitch = vDRIPriv->frontPitch;
- s3vScreen->backOffset = vDRIPriv->backOffset;
- s3vScreen->backPitch = vDRIPriv->frontPitch; /* FIXME: check */
- s3vScreen->depthOffset = vDRIPriv->depthOffset;
- s3vScreen->depthPitch = vDRIPriv->frontPitch;
- s3vScreen->texOffset = vDRIPriv->texOffset;
-
- s3vScreen->driScreen = sPriv;
-
- DEBUG(("vDRIPriv->width =%i; vDRIPriv->deviceID =%x\n", vDRIPriv->width,
- vDRIPriv->deviceID));
- DEBUG(("vDRIPriv->mem =%i\n", vDRIPriv->mem));
- DEBUG(("vDRIPriv->fbOffset =%i\n", vDRIPriv->fbOffset));
- DEBUG((" ps3vDRI->fbStride =%i\n", vDRIPriv->fbStride));
- DEBUG(("s3vScreen->cpp = %i\n", s3vScreen->cpp));
- DEBUG(("s3vScreen->backOffset = %x\n", s3vScreen->backOffset));
- DEBUG(("s3vScreen->depthOffset = %x\n", s3vScreen->depthOffset));
- DEBUG(("s3vScreen->texOffset = %x\n", s3vScreen->texOffset));
- DEBUG(("I will return from s3vCreateScreen now\n"));
-
- DEBUG(("s3vScreen->bufs = 0x%x\n", s3vScreen->bufs));
- return s3vScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-void s3vDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- s3vScreenPtr s3vScreen = (s3vScreenPtr)sPriv->private;
-
- DEBUG(("s3vDestroyScreen\n"));
-
- /* First, unmap the dma buffers */
-/*
- drmUnmapBufs( s3vScreen->bufs );
-*/
- /* Next, unmap all the regions */
-/* while (s3vScreen->regionCount > 0) {
-
- (void)drmUnmap(s3vScreen->regions[s3vScreen->regionCount].map,
- s3vScreen->regions[s3vScreen->regionCount].size);
- s3vScreen->regionCount--;
-
- }
- FREE(s3vScreen->regions); */
- if (s3vScreen)
- FREE(s3vScreen);
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.h
deleted file mode 100644
index 0c4f69efa..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_screen.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "mtypes.h"
-
-typedef struct _s3vRegion {
- drm_handle_t handle;
- drmSize size;
- drmAddress map;
-} s3vRegion, *s3vRegionPtr;
-
-typedef struct {
-
- int regionCount; /* Count of register regions */
- s3vRegion *regions; /* Vector of mapped region info */
-
- drmBufMapPtr bufs; /* Map of DMA buffers */
-
- __DRIscreenPrivate *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 texOffset;
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-} s3vScreenRec, *s3vScreenPtr;
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_span.c
deleted file mode 100644
index 49135a9c3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_span.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_lock.h"
-
-#include "swrast/swrast.h"
-
-#define _SPANLOCK 1
-#define DBG 0
-
-#define LOCAL_VARS \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- s3vScreenPtr s3vscrn = vmesa->s3vScreen; \
- __DRIscreenPrivate *sPriv = vmesa->driScreen; \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- GLuint pitch = ( (vmesa->Flags & S3V_BACK_BUFFER) ? \
- ((dPriv->w+31)&~31) * s3vscrn->cpp \
- : sPriv->fbWidth * s3vscrn->cpp); \
- GLuint height = dPriv->h; \
- char *buf = ( (vmesa->Flags & S3V_BACK_BUFFER) ? \
- (char *)(sPriv->pFB + vmesa->drawOffset) \
- : (char *)(sPriv->pFB + vmesa->drawOffset \
- + dPriv->x * s3vscrn->cpp + dPriv->y * pitch) ); \
- char *read_buf = ( (vmesa->Flags & S3V_BACK_BUFFER) ? \
- (char *)(sPriv->pFB + vmesa->drawOffset) \
- : (char *)(sPriv->pFB + vmesa->drawOffset \
- + dPriv->x * s3vscrn->cpp + dPriv->y * pitch) ); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p; (void) pitch
-
-/* FIXME! Depth/Stencil read/writes don't work ! */
-#define LOCAL_DEPTH_VARS \
- s3vScreenPtr s3vscrn = vmesa->s3vScreen; \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- __DRIscreenPrivate *sPriv = vmesa->driScreen; \
- GLuint pitch = s3vscrn->depthPitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(sPriv->pFB + \
- s3vscrn->depthOffset); /* + \
- dPriv->x * s3vscrn->cpp + \
- dPriv->y * pitch)*/ \
- (void) pitch
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP( _y ) (height - _y - 1)
-
-#if _SPANLOCK /* OK, we lock */
-
-#define HW_LOCK() \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- (void) vmesa; \
- DMAFLUSH(); \
- S3V_SIMPLE_FLUSH_LOCK(vmesa);
-#define HW_UNLOCK() S3V_SIMPLE_UNLOCK(vmesa);
-
-#else /* plz, don't lock */
-
-#define HW_LOCK() \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- (void) vmesa; \
- DMAFLUSH();
-#define HW_UNLOCK()
-
-#endif
-
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define INIT_MONO_PIXEL(p, color) \
- p = S3VIRGEPACKCOLOR555( color[0], color[1], color[2], color[3] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
-do { \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 7) | \
- (((int)g & 0xf8) << 2) | \
- (((int)b & 0xf8) >> 3)); \
- DEBUG(("buf=0x%x drawOffset=0x%x dPriv->x=%i s3vscrn->cpp=%i dPriv->y=%i pitch=%i\n", \
- sPriv->pFB, vmesa->drawOffset, dPriv->x, s3vscrn->cpp, dPriv->y, pitch)); \
- DEBUG(("dPriv->w = %i\n", dPriv->w)); \
-} while(0)
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 7) & 0xf8; \
- rgba[1] = (p >> 2) & 0xf8; \
- 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) s3v##x##_RGB555
-#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 *)(read_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) s3v##x##_ARGB8888
-#include "spantmp.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + _x*2 + _y*dPriv->w*2) = d
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + _x*2 + _y*dPriv->w*2);
-
-#define TAG(x) s3v##x##_16
-#include "depthtmp.h"
-
-
-
-
-/* 32 bit depthbuffer functions.
- */
-#if 0
-#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) s3v##x##_32
-#include "depthtmp.h"
-#endif
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#if 0
-#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) s3v##x##_24_8
-#include "depthtmp.h"
-
-#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) s3v##x##_24_8
-#include "stenciltmp.h"
-
-#endif
-
-static void s3vSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- vmesa->drawOffset = vmesa->readOffset = 0;
- break;
- case BUFFER_BIT_BACK_LEFT:
- vmesa->drawOffset = vmesa->readOffset = vmesa->driScreen->fbHeight *
- vmesa->driScreen->fbWidth *
- vmesa->s3vScreen->cpp;
- break;
- }
-}
-
-
-void s3vInitSpanFuncs( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = s3vSetBuffer;
-
-#if 0
- switch ( vmesa->s3vScreen->cpp ) {
- case 2:
- swdd->WriteRGBASpan = s3vWriteRGBASpan_RGB555;
- swdd->WriteRGBSpan = s3vWriteRGBSpan_RGB555;
- swdd->WriteMonoRGBASpan = s3vWriteMonoRGBASpan_RGB555;
- swdd->WriteRGBAPixels = s3vWriteRGBAPixels_RGB555;
- swdd->WriteMonoRGBAPixels = s3vWriteMonoRGBAPixels_RGB555;
- swdd->ReadRGBASpan = s3vReadRGBASpan_RGB555;
- swdd->ReadRGBAPixels = s3vReadRGBAPixels_RGB555;
- break;
-
- case 4:
- swdd->WriteRGBASpan = s3vWriteRGBASpan_ARGB8888;
- swdd->WriteRGBSpan = s3vWriteRGBSpan_ARGB8888;
- swdd->WriteMonoRGBASpan = s3vWriteMonoRGBASpan_ARGB8888;
- swdd->WriteRGBAPixels = s3vWriteRGBAPixels_ARGB8888;
- swdd->WriteMonoRGBAPixels = s3vWriteMonoRGBAPixels_ARGB8888;
-#if 1
- swdd->ReadRGBASpan = s3vReadRGBASpan_ARGB8888;
-#else
- swdd->ReadRGBASpan = s3vReadRGBASpan8888;
-#endif
- swdd->ReadRGBAPixels = s3vReadRGBAPixels_ARGB8888;
- break;
-
- default:
- break;
- }
-#endif
-
- switch ( vmesa->glCtx->Visual.depthBits ) {
- case 15:
- case 16:
-#if 0
- swdd->ReadDepthSpan = s3vReadDepthSpan_16;
- swdd->WriteDepthSpan = s3vWriteDepthSpan_16;
- swdd->ReadDepthPixels = s3vReadDepthPixels_16;
- swdd->WriteDepthPixels = s3vWriteDepthPixels_16;
-#endif
- break;
-
-#if 0
- case 24:
- swdd->ReadDepthSpan = s3vReadDepthSpan_24_8;
- swdd->WriteDepthSpan = s3vWriteDepthSpan_24_8;
- swdd->ReadDepthPixels = s3vReadDepthPixels_24_8;
- swdd->WriteDepthPixels = s3vWriteDepthPixels_24_8;
-
- swdd->ReadStencilSpan = s3vReadStencilSpan_24_8;
- swdd->WriteStencilSpan = s3vWriteStencilSpan_24_8;
- swdd->ReadStencilPixels = s3vReadStencilPixels_24_8;
- swdd->WriteStencilPixels = s3vWriteStencilPixels_24_8;
- break;
-#endif
-
- default:
- break;
- }
-}
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = s3vReadRGBASpan_RGB555;
- drb->Base.GetValues = s3vReadRGBAPixels_RGB555;
- drb->Base.PutRow = s3vWriteRGBASpan_RGB555;
- drb->Base.PutRowRGB = s3vWriteRGBSpan_RGB555;
- drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_RGB555;
- drb->Base.PutValues = s3vWriteRGBAPixels_RGB555;
- drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_RGB555;
- }
- else {
- drb->Base.GetRow = s3vReadRGBASpan_ARGB8888;
- drb->Base.GetValues = s3vReadRGBAPixels_ARGB8888;
- drb->Base.PutRow = s3vWriteRGBASpan_ARGB8888;
- drb->Base.PutRowRGB = s3vWriteRGBSpan_ARGB8888;
- drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_ARGB8888;
- drb->Base.PutValues = s3vWriteRGBAPixels_ARGB8888;
- drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_ARGB8888;
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = s3vReadDepthSpan_16;
- drb->Base.GetValues = s3vReadDepthPixels_16;
- drb->Base.PutRow = s3vWriteDepthSpan_16;
- drb->Base.PutMonoRow = s3vWriteMonoDepthSpan_16;
- drb->Base.PutValues = s3vWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_state.c
deleted file mode 100644
index 84aaf4c5b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_state.c
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <X11/Xlibint.h>
-#include "s3v_context.h"
-#include "s3v_macros.h"
-#include "macros.h"
-#include "s3v_dri.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-
-/* #define DEBUG(str) printf str */
-#define ENABLELIGHTING 0
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void s3vUpdateAlphaMode( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- CARD32 cmd = vmesa->CMD;
- cmd &= ~ALPHA_BLEND_MASK;
-
- if ( ctx->Color.BlendEnabled ) {
- DEBUG(("ctx->Color.AlphaEnabled = 1"));
- vmesa->_alpha[0] = ALPHA_SRC;
- vmesa->_alpha[1] = vmesa->_alpha_tex; /* FIXME: not all tex modes
- support alpha */
- } else {
- DEBUG(("ctx->Color.AlphaEnabled = 0"));
- vmesa->_alpha[0] = vmesa->_alpha[1] = ALPHA_OFF;
- }
-#if 1
- if ((cmd & DO_MASK) & DO_3D_LINE) { /* we are drawing 3d lines */
- /* which don't support tex */
- cmd |= vmesa->_alpha[0];
- } else {
- cmd |= vmesa->_alpha[vmesa->_3d_mode];
- }
-
- vmesa->CMD = cmd; /* FIXME: enough? */
-#else
- vmesa->restore_primitive = -1;
-#endif
-
-}
-
-static void s3vDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("s3vDDAlphaFunc\n"));
-
- vmesa->new_state |= S3V_NEW_ALPHA;
-}
-
-static void s3vDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("s3vDDBlendFunc\n"));
-
- vmesa->new_state |= S3V_NEW_ALPHA;
-}
-
-/* ================================================================
- * Buffer clear
- */
-
-static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- unsigned int _stride;
-
- vmesa->restore_primitive = -1;
-
- /* Update and emit any new state. We need to do this here to catch
- * changes to the masks.
- * FIXME: Just update the masks?
- */
-
- if ( vmesa->new_state )
- s3vDDUpdateHWState( ctx );
-
-/* s3vUpdateMasks( ctx ); */
-/* s3vUpdateClipping( ctx ); */
-/* s3vEmitHwState( vmesa ); */
-
-
-#if 1 /* soft (0)/hw (1)*/
-
- DEBUG(("*** s3vDDClear ***\n"));
-
- DMAOUT_CHECK(BITBLT_SRC_BASE, 15);
- DMAOUT(vmesa->SrcBase);
- DMAOUT(vmesa->DestBlit);
- DMAOUT( vmesa->ScissorLR );
- DMAOUT( vmesa->ScissorTB );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->SrcStride ); /* FIXME: unify */
- DMAOUT( (~(0)) ); /* masks */
- DMAOUT( (~(0)) );
- DMAOUT(0);
- DMAOUT(vmesa->ClearColor);
- DMAOUT(0);
- DMAOUT(0);
- /* FIXME */
- DMAOUT(0x16000122 | 0x5 | (0xF0 << 17)); /* black magic to me */
- DMAOUT(vmesa->ScissorWH);
- DMAOUT(vmesa->SrcXY);
- DMAOUT(vmesa->DestXY);
- DMAFINISH();
-
- if (mask & BUFFER_BIT_DEPTH) { /* depth */
- DEBUG(("BUFFER_BIT_DEPTH\n"));
-
- _stride = ((cw+31)&~31) * 2;
-
- DMAOUT_CHECK(BITBLT_SRC_BASE, 15);
- DMAOUT(0);
- DMAOUT(vmesa->s3vScreen->depthOffset);
- DMAOUT( (0 << 16) | cw );
- DMAOUT( (0 << 16) | ch );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->DestStride );
- DMAOUT( (~(0)) ); /* masks */
- DMAOUT( (~(0)) );
- DMAOUT(0);
- DMAOUT(vmesa->ClearDepth); /* 0x7FFF */
- /* FIXME */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT(0x16000122 | 0x5 | (0xF0 << 17));
- DMAOUT( ((cw-1) << 16) | (ch-1) );
- DMAOUT(0);
- DMAOUT( (0 << 16) | 0 );
- DMAFINISH();
-
- DEBUG(("vmesa->ClearDepth = 0x%x\n", vmesa->ClearDepth));
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if (!vmesa->NotClipped) {
- DEBUG(("vmesa->NotClipped\n")); /* yes */
- }
-
- if (!(vmesa->EnabledFlags & S3V_BACK_BUFFER)) {
- DEBUG(("!S3V_BACK_BUFFER -> flush\n"));
- DMAFLUSH();
- }
-/*
- if ( mask )
- DEBUG(("still masked ;3(\n")); */ /* yes */
-#else
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-#endif
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void s3vUpdateZMode( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- CARD32 cmd = vmesa->CMD;
-
- DEBUG(("Depth.Test = %i\n", ctx->Depth.Test));
- DEBUG(("CMD was = 0x%x ", cmd));
-
-/* printf("depth --- CMD was = 0x%x \n", cmd); */
-
- cmd &= ~Z_MASK; /* 0xfc0fffff; */
- /* Z_BUFFER */ /* 000 mode */ /* Z_UPDATE_OFF */
-
- if (!ctx->Depth.Test)
- cmd |= Z_OFF;
-
- if ( ctx->Depth.Mask )
- cmd |= Z_UPDATE_ON;
-
- switch ( ctx->Depth.Func ) {
- case GL_NEVER:
- cmd |= Z_NEVER;
- break;
- case GL_ALWAYS:
- cmd |= Z_ALWAYS;
- break;
- case GL_LESS:
- cmd |= Z_LESS;
- break;
- case GL_LEQUAL:
- cmd |= Z_LEQUAL;
- break;
- case GL_EQUAL:
- cmd |= Z_EQUAL;
- break;
- case GL_GEQUAL:
- cmd |= Z_GEQUAL;
- break;
- case GL_GREATER:
- cmd |= Z_GREATER;
- break;
- case GL_NOTEQUAL:
- cmd |= Z_NOTEQUAL;
- break;
- }
-
- DEBUG(("CMD is 0x%x\n", cmd));
-
- vmesa->dirty |= S3V_UPLOAD_DEPTH;
- vmesa->CMD = cmd;
-}
-
-static void s3vDDDepthFunc( GLcontext *ctx, GLenum func )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
-/* FLUSH_BATCH( vmesa ); */
- DEBUG(("s3vDDDepthFunc\n"));
- vmesa->new_state |= S3V_NEW_DEPTH;
-}
-
-static void s3vDDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- /* FLUSH_BATCH( vmesa ); */
- DEBUG(("s3vDDDepthMask\n"));
- vmesa->new_state |= S3V_NEW_DEPTH;
-}
-
-static void s3vDDClearDepth( GLcontext *ctx, GLclampd d )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- switch ( vmesa->DepthSize ) {
- case 15:
- case 16:
- vmesa->ClearDepth = d * 0x0000ffff; /* 65536 */
- DEBUG(("GLclampd d = %f\n", d));
- DEBUG(("ctx->Depth.Clear = %f\n", ctx->Depth.Clear));
- DEBUG(("(They should be the same)\n"));
- break;
- case 24:
- vmesa->ClearDepth = d * 0x00ffffff;
- break;
- case 32:
- vmesa->ClearDepth = d * 0xffffffff;
- break;
- }
-}
-
-static void s3vDDFinish( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- DMAFLUSH();
-}
-
-static void s3vDDFlush( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- DMAFLUSH();
-}
-
-/* =============================================================
- * Fog
- */
-
-static void s3vUpdateFogAttrib( GLcontext *ctx )
-{
-/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
-
- if (ctx->Fog.Enabled) {
- } else {
- }
-
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- break;
- case GL_EXP:
- break;
- case GL_EXP2:
- break;
- }
-}
-
-static void s3vDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- vmesa->new_state |= S3V_NEW_FOG;
-}
-
-/* =============================================================
- * Lines
- */
-static void s3vDDLineWidth( GLcontext *ctx, GLfloat width )
-{
- /* FIXME: on virge you only have one size of 3d lines *
- * if we wanted more, we should start using tris instead *
- * but virge has problem with some tris when all of the *
- * vertices stay on a line */
-}
-
-/* =============================================================
- * Points
- */
-static void s3vDDPointSize( GLcontext *ctx, GLfloat size )
-{
- /* FIXME: we use 3d line to fake points. So same limitations
- * as above apply */
-}
-
-/* =============================================================
- * Polygon
- */
-
-static void s3vUpdatePolygon( GLcontext *ctx )
-{
- /* FIXME: I don't think we could do much here */
-
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- vmesa->dirty |= S3V_UPLOAD_POLYGON;
-}
-
-/* =============================================================
- * Clipping
- */
-
-static void s3vUpdateClipping( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- int x0,y0,x1,y1;
-
- DEBUG((">>> s3vUpdateClipping <<<\n"));
-/*
- if ( vmesa->driDrawable ) {
- DEBUG(("s3vUpdateClipping\n"));
-*/
- if (vmesa->EnabledFlags & S3V_BACK_BUFFER) {
- DEBUG(("S3V_BACK_BUFFER\n"));
-
- x0 = 0;
- y0 = 0;
- x1 = dPriv->w - 1;
- y1 = dPriv->h - 1;
-
- vmesa->SrcBase = 0;
- vmesa->DestBase = vmesa->s3vScreen->backOffset;
- vmesa->DestBlit = vmesa->DestBase;
- vmesa->ScissorLR = ( (0 << 16) | (dPriv->w-1) );
- vmesa->ScissorTB = ( (0 << 16) | (dPriv->h-1) );
-/*
- vmesa->ScissorLR = ( (x0 << 16) | x1 );
- vmesa->ScissorTB = ( (y0 << 16) | y1 );
-*/
- vmesa->SrcStride = ( ((dPriv->w+31)&~31) * vmesa->s3vScreen->cpp );
- vmesa->DestStride = vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp;
- vmesa->ScissorWH = ( (dPriv->w << 16) | dPriv->h );
- vmesa->SrcXY = 0;
-/* vmesa->DestXY = ( (dPriv->x << 16) | dPriv->y ); */
- vmesa->DestXY = ( (0 << 16) | 0 );
- } else {
- DEBUG(("S3V_FRONT_BUFFER\n"));
-
- x0 = dPriv->x;
- y0 = dPriv->y;
- x1 = x0 + dPriv->w - 1;
- y1 = y0 + dPriv->h - 1;
-
- vmesa->SrcBase = 0;
- vmesa->DestBase = 0;
- vmesa->ScissorLR = ( (x0 << 16) | x1 );
- vmesa->ScissorTB = ( (y0 << 16) | y1 );
- vmesa->DestStride = vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp;
- vmesa->SrcStride = vmesa->DestStride;
- vmesa->DestBase = (y0 * vmesa->DestStride)
- + x0*vmesa->s3vScreen->cpp;
- vmesa->DestBlit = 0;
- vmesa->ScissorWH = ( (x1 << 16) | y1 );
- vmesa->SrcXY = 0;
- vmesa->DestXY = ( (0 << 16) | 0 );
-/* vmesa->DestXY = ( (dPriv->x << 16) | dPriv->y ); */
- }
-
- DEBUG(("x0=%i y0=%i x1=%i y1=%i\n", x0, y0, x1, y1));
- DEBUG(("stride=%i rectWH=0x%x\n\n", vmesa->DestStride, vmesa->ScissorWH));
-
- /* FIXME: how could we use the following info? */
- /* if (ctx->Scissor.Enabled) {} */
-
- vmesa->dirty |= S3V_UPLOAD_CLIP;
-/* } */
-}
-
-static void s3vDDScissor( GLcontext *ctx,
- GLint x, GLint y, GLsizei w, GLsizei h )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG((">>> s3vDDScissor <<<"));
- /* FLUSH_BATCH( vmesa ); */
- vmesa->new_state |= S3V_NEW_CLIP;
-}
-
-/* =============================================================
- * Culling
- */
-
-static void s3vUpdateCull( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- GLfloat backface_sign = 1;
-
- DEBUG(("s3vUpdateCull\n"));
- /* FIXME: GL_FRONT_AND_BACK */
-
- 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;
- }
-
- vmesa->backface_sign = backface_sign;
- vmesa->dirty |= S3V_UPLOAD_GEOMETRY;
-}
-
-
-static void s3vDDCullFace( GLcontext *ctx, GLenum mode )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- /* FLUSH_BATCH( vmesa ); */
- vmesa->new_state |= S3V_NEW_CULL;
-}
-
-static void s3vDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- /* FLUSH_BATCH( vmesa ); */
- vmesa->new_state |= S3V_NEW_CULL;
-}
-
-/* =============================================================
- * Masks
- */
-
-static void s3vUpdateMasks( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- GLuint mask = s3vPackColor( vmesa->s3vScreen->cpp,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] );
-
- if (vmesa->s3vScreen->cpp == 2) mask |= mask << 16;
-
- /* FIXME: can we do something in virge? */
-}
-/*
-static void s3vDDColorMask( GLcontext *ctx, GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- FLUSH_BATCH( vmesa );
- vmesa->new_state |= S3V_NEW_MASKS;
-}
-*/
-/* =============================================================
- * Rendering attributes
- */
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void s3vDDClearColor( GLcontext *ctx, const GLfloat color[4])
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("*** s3vDDClearColor\n"));
-
- vmesa->ClearColor = s3vPackColor( 2, /* vmesa->s3vScreen->cpp, */
- color[0], color[1], color[2], color[3] );
-
-#if 0
- if (vmesa->s3vScreen->cpp == 2) vmesa->ClearColor |= vmesa->ClearColor<<16;
-#endif
-}
-
-static void s3vDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- int found = GL_TRUE;
-
- DEBUG(("*** s3vDDSetDrawBuffer ***\n"));
-
- /* FLUSH_BATCH( vmesa ); */
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- vmesa->drawOffset = vmesa->s3vScreen->frontOffset;
- break;
- case GL_BACK_LEFT:
- vmesa->drawOffset = vmesa->s3vScreen->backOffset;
- /* vmesa->driScreen->fbHeight *
- * vmesa->driScreen->fbWidth *
- * vmesa->s3vScreen->cpp; */
- break;
- default:
- found = GL_FALSE;
- break;
- }
-
- DEBUG(("vmesa->drawOffset = 0x%x\n", vmesa->drawOffset));
-/* return GL_TRUE; */
-}
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-void s3vUpdateWindow( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset =
- vmesa->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] * vmesa->depth_scale;
- GLfloat tz = v[MAT_TZ] * vmesa->depth_scale;
-
- vmesa->dirty |= S3V_UPLOAD_VIEWPORT;
-
- vmesa->ViewportScaleX = sx;
- vmesa->ViewportScaleY = sy;
- vmesa->ViewportScaleZ = sz;
- vmesa->ViewportOffsetX = tx;
- vmesa->ViewportOffsetY = ty;
- vmesa->ViewportOffsetZ = tz;
-}
-
-
-/*
-static void s3vDDViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- s3vUpdateWindow( ctx );
-}
-
-static void s3vDDDepthRange( GLcontext *ctx, GLclampd nearval,
- GLclampd farval )
-{
- s3vUpdateWindow( ctx );
-}
-*/
-void s3vUpdateViewportOffset( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLfloat xoffset = (GLfloat)dPriv->x;
- GLfloat yoffset =
- vmesa->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;
-
- DEBUG(("*** s3vUpdateViewportOffset ***\n"));
-
- if ( vmesa->ViewportOffsetX != tx ||
- vmesa->ViewportOffsetY != ty )
- {
- vmesa->ViewportOffsetX = tx;
- vmesa->ViewportOffsetY = ty;
-
- vmesa->new_state |= S3V_NEW_WINDOW;
- }
-
-/* vmesa->new_state |= S3V_NEW_CLIP; */
-}
-
-/* =============================================================
- * State enable/disable
- */
-
-static void s3vDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- case GL_BLEND:
- vmesa->new_state |= S3V_NEW_ALPHA;
- DEBUG(("s3vDDEnable: GL_BLEND\n"));
- break;
-
- case GL_CULL_FACE:
- vmesa->new_state |= S3V_NEW_CULL;
- DEBUG(("s3vDDEnable: GL_CULL_FACE\n"));
- break;
-
- case GL_DEPTH_TEST:
- vmesa->new_state |= S3V_NEW_DEPTH;
- DEBUG(("s3vDDEnable: GL_DEPTH\n"));
- break;
-#if 0
- case GL_FOG:
- vmesa->new_state |= S3V_NEW_FOG;
- break;
-#endif
-
- case GL_SCISSOR_TEST:
- vmesa->new_state |= S3V_NEW_CLIP;
- break;
-
- case GL_TEXTURE_2D:
- DEBUG(("*** GL_TEXTURE_2D: %i\n", state));
- vmesa->_3d_mode = state;
- vmesa->restore_primitive = -1;
- 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 s3vEmitHwState( s3vContextPtr vmesa )
-{
- if (!vmesa->driDrawable) return;
- if (!vmesa->dirty) return;
-
- DEBUG(("**********************\n"));
- DEBUG(("*** s3vEmitHwState ***\n"));
- DEBUG(("**********************\n"));
-
- if (vmesa->dirty & S3V_UPLOAD_VIEWPORT) {
- vmesa->dirty &= ~S3V_UPLOAD_VIEWPORT;
- DEBUG(("S3V_UPLOAD_VIEWPORT\n"));
- }
-
- if ( (vmesa->dirty & S3V_UPLOAD_POINTMODE) ||
- (vmesa->dirty & S3V_UPLOAD_LINEMODE) ||
- (vmesa->dirty & S3V_UPLOAD_TRIMODE) ) {
-
- }
-
- if (vmesa->dirty & S3V_UPLOAD_POINTMODE) {
- vmesa->dirty &= ~S3V_UPLOAD_POINTMODE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_LINEMODE) {
- vmesa->dirty &= ~S3V_UPLOAD_LINEMODE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_TRIMODE) {
- vmesa->dirty &= ~S3V_UPLOAD_TRIMODE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_FOG) {
- GLchan c[3], col;
- UNCLAMPED_FLOAT_TO_RGB_CHAN( c, vmesa->glCtx->Fog.Color );
- DEBUG(("uploading ** FOG **\n"));
- col = s3vPackColor(2, c[0], c[1], c[2], 0);
- vmesa->dirty &= ~S3V_UPLOAD_FOG;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_DITHER) {
- vmesa->dirty &= ~S3V_UPLOAD_DITHER;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_LOGICOP) {
- vmesa->dirty &= ~S3V_UPLOAD_LOGICOP;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_CLIP) {
- vmesa->dirty &= ~S3V_UPLOAD_CLIP;
- DEBUG(("S3V_UPLOAD_CLIP\n"));
- DEBUG(("vmesa->ScissorLR: %i\n", vmesa->ScissorLR));
- DEBUG(("vmesa->ScissorTB: %i\n", vmesa->ScissorTB));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_MASKS) {
- vmesa->dirty &= ~S3V_UPLOAD_MASKS;
- DEBUG(("S3V_UPLOAD_BLEND\n"));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_ALPHA) {
- vmesa->dirty &= ~S3V_UPLOAD_ALPHA;
- DEBUG(("S3V_UPLOAD_ALPHA\n"));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_SHADE) {
- vmesa->dirty &= ~S3V_UPLOAD_SHADE;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_POLYGON) {
- vmesa->dirty &= ~S3V_UPLOAD_POLYGON;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_DEPTH) {
- vmesa->dirty &= ~S3V_UPLOAD_DEPTH;
- DEBUG(("S3V_UPLOAD_DEPTH: DepthMode = 0x%x08\n", vmesa->DepthMode));
- }
-
- if (vmesa->dirty & S3V_UPLOAD_GEOMETRY) {
- vmesa->dirty &= ~S3V_UPLOAD_GEOMETRY;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_TRANSFORM) {
- vmesa->dirty &= ~S3V_UPLOAD_TRANSFORM;
- }
-
- if (vmesa->dirty & S3V_UPLOAD_TEX0) {
- s3vTextureObjectPtr curTex = vmesa->CurrentTexObj[0];
- vmesa->dirty &= ~S3V_UPLOAD_TEX0;
- DEBUG(("S3V_UPLOAD_TEX0\n"));
- if (curTex) {
- DEBUG(("S3V_UPLOAD_TEX0: curTex\n"));
- } else {
- DEBUG(("S3V_UPLOAD_TEX0: !curTex\n"));
- }
- }
-}
-
-void s3vDDUpdateHWState( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- int new_state = vmesa->new_state;
-
- /* s3vUpdateClipping( ctx ); */
-
- if ( new_state )
- {
-
- vmesa->new_state = 0;
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & S3V_NEW_ALPHA )
- s3vUpdateAlphaMode( ctx );
-
- if ( new_state & S3V_NEW_DEPTH )
- s3vUpdateZMode( ctx );
-
- if ( new_state & S3V_NEW_FOG )
- s3vUpdateFogAttrib( ctx );
-
- if ( new_state & S3V_NEW_CLIP )
- {
- DEBUG(("---> going to s3vUpdateClipping\n"));
- s3vUpdateClipping( ctx );
- }
-
- if ( new_state & S3V_NEW_POLYGON )
- s3vUpdatePolygon( ctx );
-
- if ( new_state & S3V_NEW_CULL )
- s3vUpdateCull( ctx );
-
- if ( new_state & S3V_NEW_MASKS )
- s3vUpdateMasks( ctx );
-
- if ( new_state & S3V_NEW_WINDOW )
- s3vUpdateWindow( ctx );
-/*
- if ( new_state & S3_NEW_TEXTURE )
- s3vUpdateTextureState( ctx );
-*/
- CMDCHANGE();
- }
-
- /* HACK ! */
- s3vEmitHwState( vmesa );
-}
-
-
-static void s3vDDUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- S3V_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-/* Initialize the context's hardware state.
- */
-void s3vInitState( s3vContextPtr vmesa )
-{
- vmesa->new_state = 0;
-}
-
-/* Initialize the driver's state functions.
- */
-void s3vInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = s3vDDUpdateState;
-
- ctx->Driver.Clear = s3vDDClear;
- ctx->Driver.ClearIndex = NULL;
- ctx->Driver.ClearColor = s3vDDClearColor;
- ctx->Driver.DrawBuffer = s3vDDSetDrawBuffer;
- ctx->Driver.ReadBuffer = NULL; /* XXX */
-
- ctx->Driver.IndexMask = NULL;
- ctx->Driver.ColorMask = NULL; /* s3vDDColorMask; */ /* FIXME */
-
- ctx->Driver.AlphaFunc = s3vDDAlphaFunc; /* FIXME */
-#if 0
- ctx->Driver.BlendEquation = NULL; /* s3vDDBlendEquation; */
- ctx->Driver.BlendFunc = s3vDDBlendFunc; /* FIXME */
-#endif
- ctx->Driver.BlendFuncSeparate = NULL; /* s3vDDBlendFuncSeparate; */
- ctx->Driver.ClearDepth = s3vDDClearDepth;
- ctx->Driver.CullFace = s3vDDCullFace;
- ctx->Driver.FrontFace = s3vDDFrontFace;
- ctx->Driver.DepthFunc = s3vDDDepthFunc; /* FIXME */
- ctx->Driver.DepthMask = s3vDDDepthMask; /* FIXME */
- ctx->Driver.DepthRange = NULL; /* s3vDDDepthRange; */
- ctx->Driver.Enable = s3vDDEnable; /* FIXME */
- ctx->Driver.Finish = s3vDDFinish;
- ctx->Driver.Flush = s3vDDFlush;
-#if 1
- ctx->Driver.Fogfv = NULL; /* s3vDDFogfv; */
-#endif
- ctx->Driver.Hint = NULL;
- ctx->Driver.LineWidth = NULL; /* s3vDDLineWidth; */
- ctx->Driver.LineStipple = NULL; /* s3vDDLineStipple; */
-#if ENABLELIGHTING
- ctx->Driver.Lightfv = NULL; /* s3vDDLightfv; */
-
- ctx->Driver.LightModelfv = NULL; /* s3vDDLightModelfv; */
-#endif
- ctx->Driver.LogicOpcode = NULL; /* s3vDDLogicalOpcode; */
- ctx->Driver.PointSize = NULL; /* s3vDDPointSize; */
- ctx->Driver.PolygonMode = NULL; /* s3vDDPolygonMode; */
- ctx->Driver.PolygonStipple = NULL; /* s3vDDPolygonStipple; */
- ctx->Driver.Scissor = s3vDDScissor; /* ScissorLR / ScissorTB */
- ctx->Driver.ShadeModel = NULL; /* s3vDDShadeModel; */
- ctx->Driver.ClearStencil = NULL;
- ctx->Driver.StencilFunc = NULL;
- ctx->Driver.StencilMask = NULL;
- ctx->Driver.StencilOp = NULL;
- ctx->Driver.Viewport = NULL; /* s3vDDViewport; */
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.c
deleted file mode 100644
index 5bee051b0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.c
+++ /dev/null
@@ -1,554 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-#include "s3v_context.h"
-#include "s3v_tex.h"
-
-
-extern void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t);
-extern void s3vDestroyTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t);
-
-/*
-static GLuint s3vComputeLodBias(GLfloat bias)
-{
-#if TEX_DEBUG_ON
- DEBUG_TEX(("*** s3vComputeLodBias ***\n"));
-#endif
- return bias;
-}
-*/
-
-static void s3vSetTexWrapping(s3vContextPtr vmesa,
- s3vTextureObjectPtr t,
- GLenum wraps, GLenum wrapt)
-{
- GLuint t0 = t->TextureCMD;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexWrapping: #%i ***\n", ++times));
-#endif
-
-
- t0 &= ~TEX_WRAP_MASK;
- cmd &= ~TEX_WRAP_MASK;
-
- if ((wraps != GL_CLAMP) || (wrapt != GL_CLAMP)) {
- DEBUG(("TEX_WRAP_ON\n"));
- t0 |= TEX_WRAP_ON;
- cmd |= TEX_WRAP_ON;
- }
-
- cmd |= TEX_WRAP_ON; /* FIXME: broken if off */
- t->TextureCMD = t0;
- vmesa->CMD = cmd;
-}
-
-
-static void s3vSetTexFilter(s3vContextPtr vmesa,
- s3vTextureObjectPtr t,
- GLenum minf, GLenum magf)
-{
- GLuint t0 = t->TextureCMD;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexFilter: #%i ***\n", ++times));
-#endif
-
- t0 &= ~TEX_FILTER_MASK;
- cmd &= ~TEX_FILTER_MASK;
-
- switch (minf) {
- case GL_NEAREST:
- DEBUG(("GL_NEAREST\n"));
- t0 |= NEAREST;
- cmd |= NEAREST;
- break;
- case GL_LINEAR:
- DEBUG(("GL_LINEAR\n"));
- t0 |= LINEAR;
- cmd |= LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- DEBUG(("GL_MIPMAP_NEAREST\n"));
- t0 |= MIP_NEAREST;
- cmd |= MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- DEBUG(("GL_LINEAR_MIPMAP_NEAREST\n"));
- t0 |= LINEAR_MIP_NEAREST;
- cmd |= LINEAR_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- DEBUG(("GL_NEAREST_MIPMAP_LINEAR\n"));
- t0 |= MIP_LINEAR;
- cmd |= MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- DEBUG(("GL_LINEAR_MIPMAP_LINEAR\n"));
- t0 |= LINEAR_MIP_LINEAR;
- cmd |= LINEAR_MIP_LINEAR;
- break;
- default:
- break;
- }
- /* FIXME: bilinear? */
-
-#if 0
- switch (magf) {
- case GL_NEAREST:
- break;
- case GL_LINEAR:
- break;
- default:
- break;
- }
-#endif
-
- t->TextureCMD = t0;
-
- DEBUG(("CMD was = 0x%x\n", vmesa->CMD));
- DEBUG(("CMD is = 0x%x\n", cmd));
-
- vmesa->CMD = cmd;
- /* CMDCHANGE(); */
-}
-
-
-static void s3vSetTexBorderColor(s3vContextPtr vmesa,
- s3vTextureObjectPtr t,
- GLubyte color[4])
-{
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexBorderColor: #%i ***\n", ++times));
-#endif
-
- /*FIXME: it should depend on tex col format */
- /* switch(t0 ... t->TextureColorMode) */
-
- /* case TEX_COL_ARGB1555: */
- t->TextureBorderColor =
- S3VIRGEPACKCOLOR555(color[0], color[1], color[2], color[3]);
-
- DEBUG(("TextureBorderColor = 0x%x\n", t->TextureBorderColor));
-
- vmesa->TextureBorderColor = t->TextureBorderColor;
-}
-
-static void s3vTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexParameter: #%i ***\n", ++times));
-#endif
-
- if (!t) return;
-
- /* Can't do the update now as we don't know whether to flush
- * vertices or not. Setting vmesa->new_state means that
- * s3vUpdateTextureState() 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:
- s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter );
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT );
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- s3vSetTexBorderColor( vmesa, t, tObj->_BorderChan );
- 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 Virge. Since there's no LOD clamping,
- * we just have to rely on loading the right subset of mipmap levels
- * to simulate a clamped LOD.
- */
- s3vSwapOutTexObj( vmesa, t );
- break;
-
- default:
- return;
- }
-
- if (t == vmesa->CurrentTexObj[0])
- vmesa->dirty |= S3V_UPLOAD_TEX0;
-
-#if 0
- if (t == vmesa->CurrentTexObj[1]) {
- vmesa->dirty |= S3V_UPLOAD_TEX1;
- }
-#endif
-}
-
-
-static void s3vTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexEnv: #%i ***\n", ++times));
-#endif
-
- /* 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:
- vmesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
- break;
- case GL_TEXTURE_LOD_BIAS_EXT: {
-/*
- struct gl_texture_object *tObj =
- ctx->Texture.Unit[unit]._Current;
-
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
-*/
- break;
- }
- default:
- break;
- }
-}
-
-static void s3vTexImage1D( 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 )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexImage1D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, pack, texObj, texImage );
-}
-
-static void s3vTexSubImage1D( 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 )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexSubImage1D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, pack, texObj,
- texImage);
-}
-
-static void s3vTexImage2D( 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 )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexImage2D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
-}
-
-static void s3vTexSubImage2D( 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 )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexSubImage2D: #%i ***\n", ++times));
-#endif
-
-#if 1
- if (t) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSwapOutTexObj( vmesa, t );
-/*
- s3vDestroyTexObj( vmesa, t );
- texObj->DriverData = 0;
-*/
- }
-#endif
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-}
-
-
-static void s3vBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vBindTexture: #%i ***\n", ++times));
-#endif
-
- if (!t) {
-/*
- GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias;
-*/
- t = CALLOC_STRUCT(s3v_texture_object_t);
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->globj = tObj;
-#if 0
- if (target == GL_TEXTURE_2D) {
- } else
- if (target == GL_TEXTURE_1D) {
- }
-
-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- t->TextureFormat = (TF_LittleEndian |
-#else
- t->TextureFormat = (TF_BigEndian |
-#endif
-#endif
- t->dirty_images = ~0;
-
- tObj->DriverData = t;
- make_empty_list( t );
-#if 0
- s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT );
- s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter );
- s3vSetTexBorderColor( vmesa, t, tObj->BorderColor );
-#endif
- }
-
- cmd = vmesa->CMD & ~MIP_MASK;
- vmesa->dirty |= S3V_UPLOAD_TEX0;
- vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel];
- vmesa->TexStride = t->Pitch;
- cmd |= MIPMAP_LEVEL(t->WidthLog2);
- vmesa->CMD = cmd;
- vmesa->restore_primitive = -1;
-#if 0
- printf("t->TextureBaseAddr[0] = 0x%x\n", t->TextureBaseAddr[0]);
- printf("t->TextureBaseAddr[1] = 0x%x\n", t->TextureBaseAddr[1]);
- printf("t->TextureBaseAddr[2] = 0x%x\n", t->TextureBaseAddr[2]);
-#endif
-}
-
-
-static void s3vDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vDeleteTexture: #%i ***\n", ++times));
-#endif
-
- if (t) {
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
-
-#if _TEXFLUSH
- if (vmesa) {
- DMAFLUSH();
- }
-#endif
-
- s3vDestroyTexObj( vmesa, t );
- tObj->DriverData = 0;
-
- }
-}
-
-static GLboolean s3vIsTextureResident( GLcontext *ctx,
- struct gl_texture_object *tObj )
-{
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vIsTextureResident: #%i ***\n", ++times));
-#endif
-
- return (t && t->MemBlock);
-}
-
-static void s3vInitTextureObjects( GLcontext *ctx )
-{
- /* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
- struct gl_texture_object *texObj;
- GLuint tmp = ctx->Texture.CurrentUnit;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vInitTextureObjects: #%i ***\n", ++times));
-#endif
-
-#if 1
- ctx->Texture.CurrentUnit = 0;
-
- texObj = ctx->Texture.Unit[0].Current1D;
- s3vBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[0].Current2D;
- s3vBindTexture( ctx, GL_TEXTURE_2D, texObj );
-#endif
-
-#if 0
- ctx->Texture.CurrentUnit = 1;
-
- texObj = ctx->Texture.Unit[1].Current1D;
- s3vBindTexture( ctx, GL_TEXTURE_1D, texObj );
-
- texObj = ctx->Texture.Unit[1].Current2D;
- s3vBindTexture( ctx, GL_TEXTURE_2D, texObj );
-#endif
-
- ctx->Texture.CurrentUnit = tmp;
-}
-
-
-void s3vInitTextureFuncs( GLcontext *ctx )
-{
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vInitTextureFuncs: #%i ***\n", ++times));
-#endif
-
- ctx->Driver.TexEnv = s3vTexEnv;
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = s3vTexImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = s3vTexSubImage2D;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.BindTexture = s3vBindTexture;
- ctx->Driver.DeleteTexture = s3vDeleteTexture;
- ctx->Driver.TexParameter = s3vTexParameter;
- ctx->Driver.UpdateTexturePalette = 0;
- ctx->Driver.IsTextureResident = s3vIsTextureResident;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- s3vInitTextureObjects( ctx );
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.h
deleted file mode 100644
index a823fe245..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tex.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_TEX_H
-#define _S3V_TEX_H
-
-#define TEX_DEBUG_ON 0
-
-extern void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t );
-
-#if TEX_DEBUG_ON
-#define DEBUG_TEX(str) printf str
-#else
-#define DEBUG_TEX(str) /* str */
-#endif
-
-#define _TEXFLUSH 1 /* flush before uploading */
-#define _TEXLOCK 1 /* lock before writing new texures to card mem */
- /* if you turn it on you will gain stability and image
- quality, but you will loose performance (~10%) */
-#define _TEXFALLBACK 0 /* fallback to software for -big- textures (slow) */
- /* turning this off, you will lose some tex (e.g. mountains
- on tuxracer) but you will increase average playability */
-
-#define _TEXALIGN 0x00000007
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texmem.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texmem.c
deleted file mode 100644
index 0ce3ff5fc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texmem.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-#include "s3v_context.h"
-#include "s3v_lock.h"
-#include "s3v_tex.h"
-
-void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t);
-void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t );
-
-
-void s3vDestroyTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t)
-{
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vDestroyTexObj: #%i ***\n", ++times));
-#endif
-
- if (!t) return;
-
-/* FIXME: useful? */
-#if _TEXFLUSH
- if (vmesa)
- DMAFLUSH();
-#endif
-
- /* 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 (vmesa && t->age > vmesa->dirtyAge)
- vmesa->dirtyAge = t->age;
- }
-
- if (t->globj)
- t->globj->DriverData = NULL;
-
- if (vmesa) {
- if (vmesa->CurrentTexObj[0] == t) {
- vmesa->CurrentTexObj[0] = 0;
- vmesa->dirty &= ~S3V_UPLOAD_TEX0;
- }
-
-#if 0
- if (vmesa->CurrentTexObj[1] == t) {
- vmesa->CurrentTexObj[1] = 0;
- vmesa->dirty &= ~S3V_UPLOAD_TEX1;
- }
-#endif
- }
-
- remove_from_list(t);
- FREE(t);
-}
-
-
-void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t)
-{
-/* int i; */
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSwapOutTexObj: #%i ***\n", ++times));
-#endif
-
- if (t->MemBlock) {
-
- mmFreeMem(t->MemBlock);
- t->MemBlock = 0;
-
- if (t->age > vmesa->dirtyAge)
- vmesa->dirtyAge = t->age;
-
- t->dirty_images = ~0;
- move_to_tail(&(vmesa->SwappedOut), t);
- }
-}
-
-
-/* Upload an image from mesa's internal copy.
- */
-
-static void s3vUploadTexLevel( s3vContextPtr vmesa, s3vTextureObjectPtr t,
- int level )
-{
- __DRIscreenPrivate *sPriv = vmesa->driScreen;
- const struct gl_texture_image *image = t->image[level].image;
- int i,j;
- int l2d;
- /* int offset = 0; */
- int words;
- GLuint* dest;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
-#endif
- if ( !image ) return;
- if (image->Data == 0) return;
-
- DEBUG_TEX(("*** s3vUploadTexLevel: #%i ***\n", ++times));
- DEBUG_TEX(("level = %i\n", level));
-
- l2d = 5; /* 32bits per texel == 1<<5 */
-/*
- if (level == 0)
- ;
-*/
- DEBUG_TEX(("t->image[%i].offset = 0x%x\n",
- level, t->image[level].offset));
-
- t->TextureBaseAddr[level] = (GLuint)(t->BufAddr + t->image[level].offset
- + _TEXALIGN) & (GLuint)(~_TEXALIGN);
- dest = (GLuint*)(sPriv->pFB + t->TextureBaseAddr[level]);
-
- DEBUG_TEX(("sPriv->pFB = 0x%x\n", sPriv->pFB));
- DEBUG_TEX(("dest = 0x%x\n", dest));
- DEBUG_TEX(("dest - sPriv->pFB = 0x%x\n", ((int)dest - (int)sPriv->pFB)));
-
- /* NOTE: we implicitly suppose t->texelBytes == 2 */
-
- words = (image->Width * image->Height) >> 1;
-
- DEBUG_TEX(("\n\n"));
-
- switch (t->image[level].internalFormat) {
- case GL_RGB:
- case 3:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_RGB:\n"));
-/*
- if (level == 0)
- ;
-*/
- /* The UGLY way, and SLOW : use DMA FIXME ! */
-
- for (i = 0; i < words; i++) {
- unsigned int data;
- /* data = PACK_COLOR_565(src[0],src[1],src[2]); */
- data = S3VIRGEPACKCOLOR555(src[0],src[1],src[2],255)
- |(S3VIRGEPACKCOLOR555(src[3],src[4],src[5],255)<<16);
-
- *dest++ = data;
- /* src += 3; */
- src +=6;
- }
- }
- break;
-
- case GL_RGBA:
- case 4:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_RGBA:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(src[0],src[1],src[2],src[3]); */
- data = S3VIRGEPACKCOLOR4444(src[0], src[1],src[2], src[3])
- | (S3VIRGEPACKCOLOR4444(src[4], src[5], src[6], src[7]) << 16);
-
- *dest++ = data;
- /* src += 4; */
- src += 8;
- }
- }
- break;
-
- case GL_LUMINANCE:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_LUMINANCE:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_888(src[0],src[0],src[0]); */
- data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[0])
- | (S3VIRGEPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16);
-
- *dest++ = data;
- /* src ++; */
- src +=2;
- }
- }
- break;
-
- case GL_INTENSITY:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_INTENSITY:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(src[0],src[0],src[0],src[0]); */
- data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[0])
- | (S3VIRGEPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16);
-
- *dest++ = data;
- /* src ++; */
- src += 2;
- }
- }
- break;
-
- case GL_LUMINANCE_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_LUMINANCE_ALPHA:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(src[0],src[0],src[0],src[1]); */
- data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[1])
- | (S3VIRGEPACKCOLOR4444(src[2],src[2],src[2],src[3]) << 16);
-
- *dest++ = data;
- /* src += 2; */
- src += 4;
- }
- }
- break;
-
- case GL_ALPHA:
- {
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_ALPHA:\n"));
-/*
- if (level == 0)
- ;
-*/
- for (i = 0; i < words; i++) {
- unsigned int data;
-
- /* data = PACK_COLOR_8888(255,255,255,src[0]); */
- data = S3VIRGEPACKCOLOR4444(255,255,255,src[0])
- | (S3VIRGEPACKCOLOR4444(255,255,255,src[1]) << 16);
-
- *dest++ = data;
- /* src += 1; */
- src += 2;
- }
- }
- break;
-
- /* TODO: Translate color indices *now*:
- */
- case GL_COLOR_INDEX:
- {
-
- GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[level].offset);
- GLubyte *src = (GLubyte *)image->Data;
-
- DEBUG_TEX(("GL_COLOR_INDEX:\n"));
-
- 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));
- }
-
- DEBUG_TEX(("words = %i\n\n", words));
-}
-
-void s3vPrintLocalLRU( s3vContextPtr vmesa )
-{
- s3vTextureObjectPtr t;
- int sz = 1 << (vmesa->s3vScreen->logTextureGranularity);
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vPrintLocalLRU: #%i ***\n", ++times));
-#endif
-
- foreach( t, &vmesa->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 s3vPrintGlobalLRU( s3vContextPtr vmesa )
-{
- int i, j;
- S3VTexRegionPtr list = vmesa->sarea->texList;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vPrintGlobalLRU: #%i ***\n", ++times));
-#endif
-
- for (i = 0, j = S3V_NR_TEX_REGIONS ; i < S3V_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 == S3V_NR_TEX_REGIONS) break;
- }
-
- if (j != S3V_NR_TEX_REGIONS)
- fprintf(stderr, "Loop detected in global LRU\n");
-}
-
-
-void s3vResetGlobalLRU( s3vContextPtr vmesa )
-{
- S3VTexRegionPtr list = vmesa->sarea->texList;
- int sz = 1 << vmesa->s3vScreen->logTextureGranularity;
- int i;
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vResetGlobalLRU: #%i ***\n", ++times));
-#endif
-
- /* (Re)initialize the global circular LRU list. The last element
- * in the array (S3V_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 <= vmesa->s3vScreen->textureSize ; i++) {
- list[i].prev = i-1;
- list[i].next = i+1;
- list[i].age = 0;
- }
-
- i--;
- list[0].prev = S3V_NR_TEX_REGIONS;
- list[i].prev = i-1;
- list[i].next = S3V_NR_TEX_REGIONS;
- list[S3V_NR_TEX_REGIONS].prev = i;
- list[S3V_NR_TEX_REGIONS].next = 0;
- vmesa->sarea->texAge = 0;
-}
-
-
-void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t )
-{
-/*
- int i;
- int logsz = vmesa->s3vScreen->logTextureGranularity;
- int start = t->MemBlock->ofs >> logsz;
- int end = (t->MemBlock->ofs + t->MemBlock->size - 1) >> logsz;
- S3VTexRegionPtr list = vmesa->sarea->texList;
-*/
-
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTexLRU: #%i ***\n", ++times));
-#endif
-
- vmesa->texAge = ++vmesa->sarea->texAge;
-
- /* Update our local LRU
- */
- move_to_head( &(vmesa->TexObjList), t );
-
- /* Update the global LRU
- */
-#if 0
- for (i = start ; i <= end ; i++) {
-
- list[i].in_use = 1;
- list[i].age = vmesa->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 = S3V_NR_TEX_REGIONS;
- list[i].next = list[S3V_NR_TEX_REGIONS].next;
- list[(unsigned)list[S3V_NR_TEX_REGIONS].next].prev = i;
- list[S3V_NR_TEX_REGIONS].next = i;
- }
-#endif
-}
-
-
-/* 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 s3vTexturesGone( s3vContextPtr vmesa,
- GLuint offset,
- GLuint size,
- GLuint in_use )
-{
- s3vTextureObjectPtr t, tmp;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vTexturesGone: #%i ***\n", ++times));
-#endif
-
- foreach_s ( t, tmp, &vmesa->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.
- */
- s3vSwapOutTexObj( vmesa, t );
- }
-
- if (in_use) {
- t = (s3vTextureObjectPtr) calloc(1,sizeof(*t));
- if (!t) return;
-
- t->MemBlock = mmAllocMem( vmesa->texHeap, size, 0, offset);
- insert_at_head( &vmesa->TexObjList, t );
- }
-
- /* Reload any lost textures referenced by current vertex buffer.
- */
-#if 0
- if (vmesa->vertex_buffer) {
- int i, j;
-
- fprintf(stderr, "\n\nreload tex\n");
-
- for (i = 0 ; i < vmesa->statenr ; i++) {
- for (j = 0 ; j < 2 ; j++) {
- s3vTextureObjectPtr t = vmesa->state_tex[j][i];
- if (t) {
- if (t->MemBlock == 0)
- s3vUploadTexImages( vmesa, t );
- }
- }
- }
-
- /* Hard to do this with the lock held:
- */
- /* S3V_FIREVERTICES( vmesa ); */
- }
-#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 s3vUploadTexImages( s3vContextPtr vmesa, s3vTextureObjectPtr t )
-{
- int i;
- int ofs;
- int numLevels;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- static unsigned int try=0;
-
- DEBUG_TEX(("*** s3vUploadTexImages: #%i ***\n", ++times));
- DEBUG_TEX(("vmesa->texHeap = 0x%x; t->totalSize = %i\n",
- (unsigned int)vmesa->texHeap, t->totalSize));
-#endif
-
- /* Do we need to eject LRU texture objects?
- */
- if (!t->MemBlock) {
-
- while (1)
- {
- /* int try = 0; */
- DEBUG_TEX(("trying to alloc mem for tex (try %i)\n", ++try));
-
- t->MemBlock = mmAllocMem( vmesa->texHeap, t->totalSize, 12, 0 );
-
- if (t->MemBlock)
- break;
-
- if (vmesa->TexObjList.prev == vmesa->CurrentTexObj[0]) {
-/* || vmesa->TexObjList.prev == vmesa->CurrentTexObj[1]) {
- fprintf(stderr, "Hit bound texture in upload\n");
- s3vPrintLocalLRU( vmesa ); */
- return;
- }
-
- if (vmesa->TexObjList.prev == &(vmesa->TexObjList)) {
-/* fprintf(stderr, "Failed to upload texture, sz %d\n",
- t->totalSize);
- mmDumpMemInfo( vmesa->texHeap ); */
- return;
- }
-
- DEBUG_TEX(("swapping out: %p\n", vmesa->TexObjList.prev));
- s3vSwapOutTexObj( vmesa, vmesa->TexObjList.prev );
- }
-
- ofs = t->MemBlock->ofs;
-
- t->BufAddr = vmesa->s3vScreen->texOffset + ofs;
-
- DEBUG_TEX(("ofs = 0x%x\n", ofs));
- DEBUG_TEX(("t->BufAddr = 0x%x\n", t->BufAddr));
-
-/* FIXME: check if we need it */
-#if 0
- if (t == vmesa->CurrentTexObj[0]) {
- vmesa->dirty |= S3V_UPLOAD_TEX0;
- vmesa->restore_primitive = -1;
- }
-#endif
-
-#if 0
- if (t == vmesa->CurrentTexObj[1])
- vmesa->dirty |= S3V_UPLOAD_TEX1;
-#endif
-
- s3vUpdateTexLRU( vmesa, t );
- }
-
-#if 0
- if (vmesa->dirtyAge >= GET_DISPATCH_AGE(vmesa))
- s3vWaitAgeLocked( vmesa, vmesa->dirtyAge );
-#endif
-
-#if _TEXLOCK
- S3V_SIMPLE_FLUSH_LOCK(vmesa);
-#endif
- numLevels = t->lastLevel - t->firstLevel + 1;
- for (i = 0 ; i < numLevels ; i++)
- if (t->dirty_images & (1<<i))
- s3vUploadTexLevel( vmesa, t, i );
-
- t->dirty_images = 0;
-#if _TEXLOCK
- S3V_SIMPLE_UNLOCK(vmesa);
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texstate.c
deleted file mode 100644
index b136c9d37..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_texstate.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-
-#include "mm.h"
-#include "s3v_context.h"
-#include "s3v_tex.h"
-
-
-static void s3vSetTexImages( s3vContextPtr vmesa,
- struct gl_texture_object *tObj )
-{
- GLuint height, width, pitch, i, /*textureFormat,*/ log_pitch;
- s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData;
- const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
- GLint firstLevel, lastLevel, numLevels;
- GLint log2Width, log2Height;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vSetTexImages: #%i ***\n", ++times));
-#endif
-
- t->texelBytes = 2; /* FIXME: always 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] = (t->BufAddr + t->image[i].offset +
- _TEXALIGN) & (GLuint)(~_TEXALIGN);
- }
-
- t->Pitch = pitch;
- t->WidthLog2 = log2Width;
- t->totalSize = height*pitch;
- t->max_level = i-1;
- vmesa->dirty |= S3V_UPLOAD_TEX0 /* | S3V_UPLOAD_TEX1*/;
- vmesa->restore_primitive = -1;
- DEBUG(("<><>pitch = TexStride = %i\n", pitch));
- DEBUG(("log2Width = %i\n", log2Width));
-
- s3vUploadTexImages( vmesa, t );
-}
-
-static void s3vUpdateTexEnv( GLcontext *ctx, GLuint unit )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- 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;
-/*
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
- GLuint tc;
-*/
- GLuint alpha = 0;
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTexEnv: %i ***\n", ++times));
-#endif
-
- cmd &= ~TEX_COL_MASK;
- cmd &= ~TEX_BLEND_MAKS;
-/* cmd &= ~ALPHA_BLEND_MASK; */
-
- DEBUG(("format = "));
-
- switch (format) {
- case GL_RGB:
- DEBUG_TEX(("GL_RGB\n"));
- cmd |= TEX_COL_ARGB1555;
- break;
- case GL_LUMINANCE:
- DEBUG_TEX(("GL_LUMINANCE\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1; /* FIXME: check */
- break;
- case GL_ALPHA:
- DEBUG_TEX(("GL_ALPHA\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- DEBUG_TEX(("GL_LUMINANCE_ALPHA\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_INTENSITY:
- DEBUG_TEX(("GL_INTENSITY\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_RGBA:
- DEBUG_TEX(("GL_RGBA\n"));
- cmd |= TEX_COL_ARGB4444;
- alpha = 1;
- break;
- case GL_COLOR_INDEX:
- DEBUG_TEX(("GL_COLOR_INDEX\n"));
- cmd |= TEX_COL_PAL;
- break;
- }
-
- DEBUG_TEX(("EnvMode = "));
-
- switch (texUnit->EnvMode) {
- case GL_REPLACE:
- DEBUG_TEX(("GL_REPLACE\n"));
- cmd |= TEX_REFLECT; /* FIXME */
- vmesa->_tri[1] = DO_TEX_UNLIT_TRI; /* FIXME: white tri hack */
- vmesa->_alpha_tex = ALPHA_TEX /* * alpha */;
- break;
- case GL_MODULATE:
- DEBUG_TEX(("GL_MODULATE\n"));
- cmd |= TEX_MODULATE;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
-#if 0
- if (alpha)
- vmesa->_alpha_tex = ALPHA_TEX /* * alpha */;
- else
- vmesa->_alpha_tex = ALPHA_SRC /* * alpha */;
-#else
- vmesa->_alpha_tex = ALPHA_TEX ;
-#endif
- break;
- case GL_ADD:
- DEBUG_TEX(("DEBUG_TEX\n"));
- /* do nothing ???*/
- break;
- case GL_DECAL:
- DEBUG_TEX(("GL_DECAL\n"));
- cmd |= TEX_DECAL;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
- vmesa->_alpha_tex = ALPHA_OFF;
- break;
- case GL_BLEND:
- DEBUG_TEX(("GL_BLEND\n"));
- cmd |= TEX_DECAL;
- vmesa->_tri[1] = DO_TEX_LIT_TRI;
- vmesa->_alpha_tex = ALPHA_OFF; /* FIXME: sure? */
- break;
- default:
- fprintf(stderr, "unknown tex env mode");
- return;
- }
-
- DEBUG_TEX(("\n\n vmesa->CMD was 0x%x\n", vmesa->CMD));
- DEBUG_TEX(( " vmesa->CMD is 0x%x\n\n", cmd ));
-
- vmesa->_alpha[1] = vmesa->_alpha_tex;
- vmesa->CMD = cmd; /* | MIPMAP_LEVEL(8); */
- vmesa->restore_primitive = -1;
-}
-
-static void s3vUpdateTexUnit( GLcontext *ctx, GLuint unit )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- GLuint cmd = vmesa->CMD;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTexUnit: %i ***\n", ++times));
- DEBUG_TEX(("and vmesa->CMD was 0x%x\n", vmesa->CMD));
-#endif
-
- if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT)
- {
- struct gl_texture_object *tObj = texUnit->_Current;
- s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData;
-
- /* Upload teximages (not pipelined)
- */
- if (t->dirty_images) {
-#if _TEXFLUSH
- DMAFLUSH();
-#endif
- s3vSetTexImages( vmesa, tObj );
- if (!t->MemBlock) {
-#if _TEXFALLBACK
- FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_TRUE );
-#endif
- return;
- }
- }
-
- /* Update state if this is a different texture object to last
- * time.
- */
-#if 1
- if (vmesa->CurrentTexObj[unit] != t) {
- vmesa->dirty |= S3V_UPLOAD_TEX0 /* << unit */;
- vmesa->CurrentTexObj[unit] = t;
- s3vUpdateTexLRU( vmesa, t ); /* done too often */
- }
-#endif
-
- /* Update texture environment if texture object image format or
- * texture environment state has changed.
- */
- if (tObj->Image[0][tObj->BaseLevel]->Format !=
- vmesa->TexEnvImageFmt[unit]) {
- vmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format;
- s3vUpdateTexEnv( ctx, unit );
- }
-#if 1
- cmd = vmesa->CMD & ~MIP_MASK;
- vmesa->dirty |= S3V_UPLOAD_TEX0 /* << unit */;
- vmesa->CurrentTexObj[unit] = t;
- vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel];
- vmesa->TexStride = t->Pitch;
- cmd |= MIPMAP_LEVEL(t->WidthLog2);
-
- DEBUG_TEX(("\n\n>> vmesa->CMD was 0x%x\n", vmesa->CMD));
- DEBUG_TEX(( ">> vmesa->CMD is 0x%x\n\n", cmd ));
- DEBUG_TEX(("t->WidthLog2 = %i\n", t->WidthLog2));
- DEBUG_TEX(("MIPMAP_LEVEL(t->WidthLog2) = 0x%x\n", MIPMAP_LEVEL(t->WidthLog2)));
-
- vmesa->CMD = cmd;
- vmesa->restore_primitive = -1;
-#endif
- }
- else if (texUnit->_ReallyEnabled) { /* _ReallyEnabled but != TEXTURE0_2D */
-#if _TEXFALLBACK
- FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_TRUE );
-#endif
- }
- else /*if (vmesa->CurrentTexObj[unit])*/ { /* !_ReallyEnabled */
- vmesa->CurrentTexObj[unit] = 0;
- vmesa->TexEnvImageFmt[unit] = 0;
- vmesa->dirty &= ~(S3V_UPLOAD_TEX0<<unit);
- }
-}
-
-
-void s3vUpdateTextureState( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- (void) vmesa;
-#if TEX_DEBUG_ON
- static unsigned int times=0;
- DEBUG_TEX(("*** s3vUpdateTextureState: #%i ***\n", ++times));
-#endif
-
-#if _TEXFALLBACK
- FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_FALSE );
-#endif
- s3vUpdateTexUnit( ctx, 0 );
-#if 0
- s3vUpdateTexUnit( ctx, 1 );
-#endif
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.c
deleted file mode 100644
index d6cceddd4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <sys/ioctl.h>
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_tris.h"
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.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"
-
-
-/***********************************************************************
- * Build hardware rasterization functions *
- ***********************************************************************/
-
-#define DO_TRI 1
-#define HAVE_RGBA 1
-#define HAVE_SPEC 0
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX s3vVertex
-#define TAB rast_tab
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- UNCLAMPED_FLOAT_TO_RGBA_CHAN( v->ub4[4], c); \
-/* *(v->ub4[4]) = c; \ */ \
-} while (0)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-/*
-#define VERT_COPY_RGBA1( 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 S3V_OFFSET_BIT 0x01
-#define S3V_TWOSIDE_BIT 0x02
-#define S3V_UNFILLED_BIT 0x04
-#define S3V_FALLBACK_BIT 0x08
-#define S3V_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[S3V_MAX_TRIFUNC];
-
-#define S3V_RAST_CULL_BIT 0x01
-#define S3V_RAST_FLAT_BIT 0x02
-#define S3V_RAST_TEX_BIT 0x04
-
-static s3v_point_func s3v_point_tab[0x8];
-static s3v_line_func s3v_line_tab[0x8];
-static s3v_tri_func s3v_tri_tab[0x8];
-static s3v_quad_func s3v_quad_tab[0x8];
-
-#define IND (0)
-#define TAG(x) x
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT)
-#define TAG(x) x##_cull
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT|S3V_RAST_FLAT_BIT)
-#define TAG(x) x##_cull_flat
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_TEX_BIT)
-#define TAG(x) x##_tex
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT|S3V_RAST_TEX_BIT)
-#define TAG(x) x##_cull_tex
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_FLAT_BIT|S3V_RAST_TEX_BIT)
-#define TAG(x) x##_flat_tex
-#include "s3v_tritmp.h"
-
-#define IND (S3V_RAST_CULL_BIT|S3V_RAST_FLAT_BIT|S3V_RAST_TEX_BIT)
-#define TAG(x) x##_cull_flat_tex
-#include "s3v_tritmp.h"
-
-static void init_rast_tab( void )
-{
- DEBUG(("*** init_rast_tab ***\n"));
-
- s3v_init();
- s3v_init_cull();
- s3v_init_flat();
- s3v_init_cull_flat();
- s3v_init_tex();
- s3v_init_cull_tex();
- s3v_init_flat_tex();
- s3v_init_cull_flat_tex();
-}
-
-/***********************************************************************
- * 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.
- */
-
-#if 0
-static void
-s3v_fallback_quad( s3vContextPtr vmesa,
- const s3vVertex *v0,
- const s3vVertex *v1,
- const s3vVertex *v2,
- const s3vVertex *v3 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[4];
- s3v_translate_vertex( ctx, v0, &v[0] );
- s3v_translate_vertex( ctx, v1, &v[1] );
- s3v_translate_vertex( ctx, v2, &v[2] );
- s3v_translate_vertex( ctx, v3, &v[3] );
- DEBUG(("s3v_fallback_quad\n"));
-/* _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] ); */
-}
-
-static void
-s3v_fallback_tri( s3vContextPtr vmesa,
- const s3vVertex *v0,
- const s3vVertex *v1,
- const s3vVertex *v2 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[3];
- s3v_translate_vertex( ctx, v0, &v[0] );
- s3v_translate_vertex( ctx, v1, &v[1] );
- s3v_translate_vertex( ctx, v2, &v[2] );
- DEBUG(("s3v_fallback_tri\n"));
-/* _swrast_Triangle( ctx, &v[0], &v[1], &v[2] ); */
-}
-
-static void
-s3v_fallback_line( s3vContextPtr vmesa,
- const s3vVertex *v0,
- const s3vVertex *v1 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[2];
- s3v_translate_vertex( ctx, v0, &v[0] );
- s3v_translate_vertex( ctx, v1, &v[1] );
- DEBUG(("s3v_fallback_line\n"));
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-/*
-static void
-s3v_fallback_point( s3vContextPtr vmesa,
- const s3vVertex *v0 )
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[1];
- s3v_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-*/
-#endif
-
-/***********************************************************************
- * Choose rasterization functions *
- ***********************************************************************/
-
-#define _S3V_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 s3v_nodraw_triangle(GLcontext *ctx, s3vVertex *v0,
- s3vVertex *v1, s3vVertex *v2)
-{
- (void) (ctx && v0 && v1 && v2);
-}
-
-static void s3v_nodraw_quad(GLcontext *ctx,
- s3vVertex *v0, s3vVertex *v1,
- s3vVertex *v2, s3vVertex *v3)
-{
- (void) (ctx && v0 && v1 && v2 && v3);
-}
-
-void s3vChooseRasterState(GLcontext *ctx);
-
-void s3vChooseRasterState(GLcontext *ctx)
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint ind = 0;
-
- DEBUG(("*** s3vChooseRasterState ***\n"));
-
- if (ctx->Polygon.CullFlag) {
- if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) {
- vmesa->draw_tri = (s3v_tri_func)s3v_nodraw_triangle;
- vmesa->draw_quad = (s3v_quad_func)s3v_nodraw_quad;
- return;
- }
- ind |= S3V_RAST_CULL_BIT;
- /* s3v_update_cullsign(ctx); */
- } /* else vmesa->backface_sign = 0; */
-
- if ( flags & DD_FLATSHADE )
- ind |= S3V_RAST_FLAT_BIT;
-
- if ( ctx->Texture.Unit[0]._ReallyEnabled ) {
- ind |= S3V_RAST_TEX_BIT;
- }
-
- DEBUG(("ind = %i\n", ind));
-
- vmesa->draw_line = s3v_line_tab[ind];
- vmesa->draw_tri = s3v_tri_tab[ind];
- vmesa->draw_quad = s3v_quad_tab[ind];
- vmesa->draw_point = s3v_point_tab[ind];
-
-#if 0
- /* Hook in fallbacks for specific primitives. CURRENTLY DISABLED
- */
-
- if (flags & LINE_FALLBACK)
- vmesa->draw_line = s3v_fallback_line;
-
- if (flags & TRI_FALLBACK) {
- DEBUG(("TRI_FALLBACK\n"));
- vmesa->draw_tri = s3v_fallback_tri;
- vmesa->draw_quad = s3v_fallback_quad;
- }
-#endif
-}
-
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( v0, v1, v2 ) \
-do { \
- /*
- if (DO_FALLBACK) \
- vmesa->draw_tri( vmesa, v0, v1, v2 ); \
- else */ \
- DEBUG(("TRI: max was here\n")); /* \
- s3v_draw_tex_triangle( vmesa, v0, v1, v2 ); */ \
- vmesa->draw_tri( vmesa, v0, v1, v2 ); \
-} while (0)
-
-#define QUAD( v0, v1, v2, v3 ) \
-do { \
- DEBUG(("QUAD: max was here\n")); \
- vmesa->draw_quad( vmesa, v0, v1, v2, v3 ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- DEBUG(("LINE: max was here\n")); \
- vmesa->draw_line( vmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- vmesa->draw_point( vmesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-/*
-#define S3V_OFFSET_BIT 0x01
-#define S3V_TWOSIDE_BIT 0x02
-#define S3V_UNFILLED_BIT 0x04
-#define S3V_FALLBACK_BIT 0x08
-#define S3V_MAX_TRIFUNC 0x10
-
-
-static struct {
- points_func points;
- line_func line;
- triangle_func triangle;
- quad_func quad;
-} rast_tab[S3V_MAX_TRIFUNC];
-*/
-
-#define DO_FALLBACK (IND & S3V_FALLBACK_BIT)
-#define DO_OFFSET (IND & S3V_OFFSET_BIT)
-#define DO_UNFILLED (IND & S3V_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & S3V_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 s3vVertex
-#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) (vmesa->verts + (e<<vmesa->vertex_stride_shift))
-
-#if 0
-#define VERT_SET_RGBA( v, c ) \
-do { \
-/* UNCLAMPED_FLOAT_TO_RGBA_CHAN( v->ub4[4], c) */ \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4]
-/*
-#define VERT_COPY_RGBA1( 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]
-#endif
-
-#define LOCAL_VARS(n) \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- GLuint color[n]; \
- (void) color;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PrimType_Points,
- PrimType_Lines,
- PrimType_Lines,
- PrimType_Lines,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles,
- PrimType_Triangles
-};
-
-static void s3vResetLineStipple( GLcontext *ctx );
-static void s3vRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void s3vRenderPrimitive( GLcontext *ctx, GLenum prim );
-/*
-extern static void s3v_lines_emit(GLcontext *ctx, GLuint start, GLuint end);
-extern static void s3v_tris_emit(GLcontext *ctx, GLuint start, GLuint end);
-*/
-#define RASTERIZE(x) if (vmesa->hw_primitive != hw_prim[x]) \
- s3vRasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE vmesa->render_primitive
-#define TAG(x) x
-#define IND S3V_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 (S3V_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT|S3V_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_OFFSET_BIT|S3V_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT|S3V_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (S3V_TWOSIDE_BIT|S3V_OFFSET_BIT|S3V_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_render_tab( void )
-{
- DEBUG(("*** init_render_tab ***\n"));
-
- 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) (s3vVertex *)(s3vverts + (x << shift))
-
-#define RENDER_POINTS( start, count ) \
- DEBUG(("RENDER_POINTS...(ok)\n")); \
- for ( ; start < count ; start++) \
- vmesa->draw_line( vmesa, VERT(start), VERT(start) )
- /* vmesa->draw_point( vmesa, VERT(start) ) */
-
-#define RENDER_LINE( v0, v1 ) \
- /* DEBUG(("RENDER_LINE...(ok)\n")); \ */ \
- vmesa->draw_line( vmesa, VERT(v0), VERT(v1) ); \
- DEBUG(("RENDER_LINE...(ok)\n"))
-
-#define RENDER_TRI( v0, v1, v2 ) \
- DEBUG(("RENDER_TRI...(ok)\n")); \
- vmesa->draw_tri( vmesa, VERT(v0), VERT(v1), VERT(v2) )
-
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- DEBUG(("RENDER_QUAD...(ok)\n")); \
- /* s3v_draw_quad( vmesa, VERT(v0), VERT(v1), VERT(v2),VERT(v3) ) */\
- /* s3v_draw_triangle( vmesa, VERT(v0), VERT(v1), VERT(v2) ); \
- s3v_draw_triangle( vmesa, VERT(v0), VERT(v2), VERT(v3) ) */ \
- vmesa->draw_quad( vmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-
-#define INIT(x) s3vRenderPrimitive( ctx, x );
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- s3vContextPtr vmesa = S3V_CONTEXT(ctx); \
- const GLuint shift = vmesa->vertex_stride_shift; \
- const char *s3vverts = (char *)vmesa->verts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) stipple;
-#define RESET_STIPPLE if ( stipple ) s3vResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) s3v_##x##_verts
-#include "tnl_dd/t_dd_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void s3vRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint prim = vmesa->render_primitive;
-
- DEBUG(("I AM in: s3vRenderClippedPoly\n"));
-
- /* Render the new vertices as an unclipped polygon.
- */
- if (1)
- {
- 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 1
- if (prim != GL_POLYGON) {
- DEBUG(("and prim != GL_POLYGON\n"));
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
- }
-
-#endif
-}
-
-static void s3vRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- /*tnl->Driver.LineFunc = s3v_line_tab[2];*/ /* _swsetup_Line; */
-
- DEBUG(("I AM in: s3vRenderClippedLine\n"));
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-#define _S3V_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 s3vChooseRenderState(GLcontext *ctx)
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- DEBUG(("s3vChooseRenderState\n"));
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= S3V_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= S3V_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= S3V_UNFILLED_BIT;
- }
-
- DEBUG(("vmesa->RenderIndex = %i\n", vmesa->RenderIndex));
- DEBUG(("index = %i\n", index));
-
- if (vmesa->RenderIndex != index) {
- vmesa->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 (vmesa->RenderIndex == 0)
- tnl->Driver.Render.PrimTabVerts = s3v_render_tab_verts;
- else
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = s3vRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = s3vRenderClippedPoly;
- }
-}
-
-
-/**********************************************************************/
-/* 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 s3v_render.c.
- */
-
-static void s3vRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-/* __DRIdrawablePrivate *dPriv = vmesa->driDrawable; */
- GLuint cmd = vmesa->CMD;
-
- unsigned int _hw_prim = hwprim;
-
- DEBUG(("s3vRasterPrimitive: hwprim = 0x%x ", _hw_prim));
-
-/* printf("* vmesa->CMD = 0x%x\n", vmesa->CMD); */
-
- if (vmesa->hw_primitive != _hw_prim)
- {
- DEBUG(("(new one) ***\n"));
- cmd &= ~DO_MASK;
- cmd &= ~ALPHA_BLEND_MASK;
- vmesa->hw_primitive = _hw_prim;
-
- if (_hw_prim == PrimType_Triangles) {
- /* TRI */
- DEBUG(("->switching to tri\n"));
- cmd |= (vmesa->_tri[vmesa->_3d_mode] | vmesa->_alpha[vmesa->_3d_mode]);
- } else if (_hw_prim == PrimType_Lines
- || _hw_prim == PrimType_Points) {
- /* LINE */
- DEBUG(("->switching to line\n"));
- cmd |= (DO_3D_LINE | vmesa->_alpha[0]);
- } else {
- /* ugh? */
- DEBUG(("->switching to your sis'ass\n"));
- }
-
- DEBUG(("\n"));
-
- vmesa->restore_primitive = _hw_prim;
- /* 0xacc16827: good value -> lightened newave!!! */
- vmesa->CMD = cmd;
- CMDCHANGE();
- }
-}
-
-static void s3vRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLuint cmd = vmesa->CMD;
-
- unsigned int _hw_prim = hw_prim[prim];
-
- vmesa->render_primitive = prim;
- vmesa->hw_primitive = _hw_prim;
-
- DEBUG(("s3vRenderPrimitive #%i ", prim));
- DEBUG(("_hw_prim = 0x%x\n", _hw_prim));
-
-/* printf(" vmesa->CMD = 0x%x\n", vmesa->CMD); */
-
- if (_hw_prim != vmesa->restore_primitive) {
- DEBUG(("_hw_prim != vmesa->restore_primitive (was 0x%x)\n",
- vmesa->restore_primitive));
-#if 1
- cmd &= ~DO_MASK;
- cmd &= ~ALPHA_BLEND_MASK;
-/*
- printf(" cmd = 0x%x\n", cmd);
- printf(" vmesa->_3d_mode=%i; vmesa->_tri[vmesa->_3d_mode]=0x%x\n",
- vmesa->_3d_mode, vmesa->_tri[vmesa->_3d_mode]);
- printf("vmesa->alpha[0] = 0x%x; vmesa->alpha[1] = 0x%x\n",
- vmesa->_alpha[0], vmesa->_alpha[1]);
-*/
- if (_hw_prim == PrimType_Triangles) { /* TRI */
- DEBUG(("->switching to tri\n"));
- cmd |= (vmesa->_tri[vmesa->_3d_mode] | vmesa->_alpha[vmesa->_3d_mode]);
- DEBUG(("vmesa->TexStride = %i\n", vmesa->TexStride));
- DEBUG(("vmesa->TexOffset = %i\n", vmesa->TexOffset));
- DMAOUT_CHECK(3DTRI_Z_BASE, 12);
- } else { /* LINE */
- DEBUG(("->switching to line\n"));
- cmd |= (DO_3D_LINE | vmesa->_alpha[0]);
- DMAOUT_CHECK(3DLINE_Z_BASE, 12);
- }
-
- DMAOUT(vmesa->s3vScreen->depthOffset & 0x003FFFF8);
- DMAOUT(vmesa->DestBase);
- /* DMAOUT(vmesa->ScissorLR); */
- /* DMAOUT(vmesa->ScissorTB); */
-
- /* NOTE: we need to restore all these values since we
- * are coming back from a vmesa->restore_primitive */
- DMAOUT( (0 << 16) | (dPriv->w-1) );
- DMAOUT( (0 << 16) | (dPriv->h-1) );
- DMAOUT( (vmesa->SrcStride << 16) | vmesa->TexStride );
- DMAOUT(vmesa->SrcStride);
- DMAOUT(vmesa->TexOffset);
- DMAOUT(vmesa->TextureBorderColor);
- DMAOUT(0); /* FOG */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT(cmd);
- /* 0xacc16827: good value -> lightened newave!!! */
- DMAFINISH();
-
- vmesa->CMD = cmd;
-#endif
- }
-
- DEBUG(("\n"));
-
- vmesa->restore_primitive = _hw_prim;
-}
-
-static void s3vRunPipeline( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
-
- DEBUG(("*** s3vRunPipeline ***\n"));
-
- if ( vmesa->new_state )
- s3vDDUpdateHWState( ctx );
-
- if (vmesa->new_gl_state) {
-
- if (vmesa->new_gl_state & _NEW_TEXTURE) {
- s3vUpdateTextureState( ctx );
- }
-
- if (!vmesa->Fallback) {
- if (vmesa->new_gl_state & _S3V_NEW_VERTEX)
- s3vChooseVertexState( ctx );
-
- if (vmesa->new_gl_state & _S3V_NEW_RASTER_STATE)
- s3vChooseRasterState( ctx );
-
- if (vmesa->new_gl_state & _S3V_NEW_RENDERSTATE)
- s3vChooseRenderState( ctx );
- }
-
- vmesa->new_gl_state = 0;
-
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void s3vRenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
-
- DEBUG(("s3vRenderStart\n"));
- /* s3vCheckTexSizes( ctx ); */
-}
-
-static void s3vRenderFinish( GLcontext *ctx )
-{
- if (0)
- _swrast_flush( ctx ); /* never needed */
-}
-
-static void s3vResetLineStipple( GLcontext *ctx )
-{
-/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
-
- /* Reset the hardware stipple counter.
- */
-/*
- CHECK_DMA_BUFFER(vmesa, 1);
- WRITE(vmesa->buf, UpdateLineStippleCounters, 0);
-*/
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-
-void s3vFallback( s3vContextPtr vmesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = vmesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = vmesa->Fallback;
-
- DEBUG(("*** s3vFallback: "));
-
- if (mode) {
- vmesa->Fallback |= bit;
- if (oldfallback == 0) {
- DEBUG(("oldfallback == 0 ***\n"));
- _swsetup_Wakeup( ctx );
- _tnl_need_projected_coords( ctx, GL_TRUE );
- vmesa->RenderIndex = ~0;
- }
- }
- else {
- DEBUG(("***\n"));
- vmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = s3vRenderStart;
- tnl->Driver.Render.PrimitiveNotify = s3vRenderPrimitive;
- tnl->Driver.Render.Finish = s3vRenderFinish;
- tnl->Driver.Render.BuildVertices = s3vBuildVertices;
- tnl->Driver.Render.ResetLineStipple = s3vResetLineStipple;
- vmesa->new_gl_state |= (_S3V_NEW_RENDERSTATE|
- _S3V_NEW_RASTER_STATE|
- _S3V_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void s3vInitTriFuncs( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- init_render_tab();
- firsttime = 0;
- }
-
- vmesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = s3vRunPipeline;
- tnl->Driver.Render.Start = s3vRenderStart;
- tnl->Driver.Render.Finish = s3vRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = s3vRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = s3vResetLineStipple;
-/*
- tnl->Driver.RenderInterp = _swsetup_RenderInterp;
- tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
-*/
- tnl->Driver.Render.BuildVertices = s3vBuildVertices;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.h
deleted file mode 100644
index 0010a7fe0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tris.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef _S3V_TRIS_H
-#define _S3V_TRIS_H
-
-extern void s3vDDTrifuncInit(void);
-extern void s3vDDChooseTriRenderState(GLcontext *);
-
-#endif /* !(_S3V_TRIS_H) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tritmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tritmp.h
deleted file mode 100644
index 16318f4c4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_tritmp.h
+++ /dev/null
@@ -1,958 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-/**** MACROS start ****/
-
-/* point/line macros */
-
-#define LINE_VERT_VARS \
- SWvertex v[3]; \
- s3vVertex* vvv[2]; \
- int x[3], y[3], z[3]; \
- int idx[3]; \
- int dx01, dy01; \
- int delt02; \
- int deltzy, zstart; \
- int start02, end01; \
- int ystart, y01y12; \
- int i, tmp, tmp2, tmp3; \
- GLfloat ydiff, fy[3]
-#define LINE_VERT_VARS_VOIDS \
- (void) v; (void) vvv; (void) x; (void) y; (void) z; (void) idx; \
- (void) dx01; (void) dy01; (void) delt02; (void) deltzy; \
- (void) zstart; (void) start02; (void) ystart; (void) y01y12; \
- (void) i; (void) tmp; (void) tmp2; (void) tmp3; (void) ydiff; (void) fy
-
-#define LINE_FLAT_VARS \
- int arstart, gbstart; \
- int deltarx, deltgbx, deltary, deltgby; \
- GLubyte *(col)[3]
-#define LINE_FLAT_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
- (void) deltary; (void) deltgby; (void) col
-
-#define LINE_GOURAUD_VARS \
- int arstart, gbstart; \
- int deltary, deltgby; \
- int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *(col)[3]
-#define LINE_GOURAUD_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltary; (void) deltgby; \
- (void) ctmp; (void) ctmp2; (void) ctmp3; (void) ctmp4; (void) col
-
-#define SORT_LINE_VERT() \
-do { \
- if(v[0].win[1] <= v[1].win[1]) { \
-\
- idx[0] = 0; \
- idx[1] = 1; \
-\
- } else if (v[0].win[1] > v[1].win[1]) { \
-\
- idx[0] = 1; \
- idx[1] = 0; \
-\
- } \
-} while(0)
-
-#define SET_LINE_VERT() \
-do { \
- x[0] = (v[idx[0]].win[0] * 1024.0f * 1024.0f); /* 0x100000 */ \
- y[0] = fy[0] = dPriv->h - v[idx[0]].win[1]; \
- z[0] = (v[idx[0]].win[2]) * 1024.0f * 32.0f; /* 0x8000; */ \
-\
- x[1] = (v[idx[1]].win[0] * 1024.0f * 1024.0f); /* 0x100000 */ \
- y[1] = dPriv->h - v[idx[1]].win[1]; \
- z[1] = (v[idx[1]].win[2]) * 1024.0f * 32.0f; /* 0x8000 */ \
-} while(0)
-
-#define SET_LINE_XY() \
-do { \
- tmp = v[idx[0]].win[0]; \
- tmp2 = v[idx[1]].win[0]; \
-\
- dx01 = x[0] - x[1]; \
- dy01 = y[0] - y[1]; \
-\
- ydiff = fy[0] - (float)y[0]; \
- ystart = y[0]; \
- y01y12 = dy01 + 1; \
-} while (0)
-
-#define SET_LINE_DIR() \
-do { \
- if (tmp2 > tmp) { \
- y01y12 |= 0x80000000; \
- tmp3 = tmp2-tmp; \
- } else { \
- tmp3 = tmp-tmp2; \
- } \
-\
- end01 = ((tmp << 16) | tmp2); \
-\
- if (dy01) \
- delt02 = -(dx01/dy01); \
- else \
- delt02 = 0; \
-\
- if (dy01 > tmp3) { /* Y MAJ */ \
- /* NOTE: tmp3 always >=0 */ \
- start02 = x[0]; \
- } else if (delt02 >= 0){ /* X MAJ - positive delta */ \
- start02 = x[0] + delt02/2; \
- dy01 = tmp3; /* could be 0 */ \
- } else { /* X MAJ - negative delta */ \
- start02 = x[0] + delt02/2 + ((1 << 20) - 1); \
- dy01 = tmp3; /* could be 0 */ \
- } \
-} while(0)
-
-#define SET_LINE_Z() \
-do { \
- zstart = z[0]; \
-\
- if (dy01) { \
- deltzy = (z[1] - z[0])/dy01; \
- } else { \
- deltzy = 0; /* dy01 = tmp3 = 0 (it's a point)*/ \
- } \
-} while (0)
-
-#define SET_LINE_FLAT_COL() \
-do { \
- col[0] = &(v[idx[0]].color[0]); \
- deltarx = deltary = deltgbx = deltgby = 0; \
- gbstart = (((col[0][1]) << 23) | ((col[0][2]) << 7)); \
- arstart = (((col[0][3]) << 23) | ((col[0][0]) << 7)); \
-} while(0)
-
-#define SET_LINE_GOURAUD_COL() \
-do { \
- col[0] = &(v[idx[0]].color[0]); \
- col[1] = &(v[idx[1]].color[0]); \
-\
- vvv[0] = _v0; \
- vvv[1] = _v1; \
-\
- for (i=0; i<2; i++) { \
- /* FIXME: swapped ! */ \
- col[i][0] = vvv[!idx[i]]->v.color.red; \
- col[i][1] = vvv[!idx[i]]->v.color.green; \
- col[i][2] = vvv[!idx[i]]->v.color.blue; \
- col[i][3] = vvv[!idx[i]]->v.color.alpha; \
- } \
-\
- if (dy01) { \
-\
- ctmp = ((col[0][1] - col[1][1]) << 7) / dy01; \
- ctmp2 = ((col[0][2] - col[1][2]) << 7) / dy01; \
- deltgby = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
-\
- ctmp3 = ((col[0][3] - col[1][3]) << 7) / dy01; \
- ctmp4 = ((col[0][0] - col[1][0]) << 7) / dy01; \
- deltary = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- } else { \
- ctmp = ((col[1][1] - col[0][1]) << 7); \
- ctmp2 = ((col[1][2] - col[0][2]) << 7); \
- deltgby = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
-\
- ctmp3 = ((col[1][3] - col[0][3]) << 7); \
- ctmp4 = ((col[1][0] - col[0][0]) << 7); \
- deltary = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- deltgby = deltary = 0; \
- } \
-\
- idx[0] = 1; /* FIXME: swapped */ \
-\
- gbstart = \
- (((int)((ydiff * ctmp) + (col[idx[0]][1] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp2) + (col[idx[0]][2] << 7)) & 0x7FFF); \
- arstart = \
- (((int)((ydiff * ctmp3) + (col[idx[0]][3] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp4) + (col[idx[0]][0] << 7)) & 0x7FFF); \
-} while(0)
-
-#define SEND_LINE_COL() \
-do { \
- DMAOUT(deltgby); \
- DMAOUT(deltary); \
- DMAOUT(gbstart); \
- DMAOUT(arstart); \
-} while (0)
-
-#define SEND_LINE_VERT() \
-do { \
- DMAOUT(deltzy); \
- DMAOUT(zstart); \
- DMAOUT(0); \
- DMAOUT(0); \
- DMAOUT(0); \
- DMAOUT(end01); \
- DMAOUT(delt02); \
- DMAOUT(start02); \
- DMAOUT(ystart); \
- DMAOUT(y01y12); \
-} while (0)
-
-
-/* tri macros (mostly stolen from utah-glx...) */
-
-#define VERT_VARS \
- SWvertex v[3]; \
- int x[3], y[3], z[3]; \
- int idx[3]; \
- int dx01, dy01; \
- int dx02, dy02; \
- int dx12, dy12; \
- int delt01, delt02, delt12; \
- int deltzx, deltzy, zstart; \
- int start02, end01, end12; \
- int ystart, y01y12; \
- int i, tmp, lr; \
- GLfloat ydiff, fy[3]
-#define VERT_VARS_VOIDS \
- (void) v; (void) x; (void) y; (void) z; (void) idx; (void) dx01; \
- (void) dy01; (void) dx02; (void) dy02; (void) dx12; (void) dy12; \
- (void) delt01; (void) delt02; (void) delt12; (void) deltzx; \
- (void) deltzy; (void) zstart; (void) start02; (void) end01; \
- (void) end12; (void) ystart; (void) y01y12; (void) i; (void) tmp; \
- (void) lr; (void) ydiff; (void) fy
-
-#define GOURAUD_VARS \
- int arstart, gbstart; \
- int deltarx, deltgbx, deltary, deltgby; \
- int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *(col)[3]
-#define GOURAUD_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
- (void) deltary; (void) deltgby; (void) ctmp; (void) ctmp2; \
- (void) ctmp3; (void) ctmp4; (void) col
-
-#define FLAT_VARS \
- int arstart, gbstart; \
- int deltarx, deltgbx, deltary, deltgby; \
- GLubyte *(col)[3]
-#define FLAT_VARS_VOIDS \
- (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \
- (void) deltary; (void) deltgby; (void) col
-
-#define TEX_VARS \
- int u0, u1, u2; \
- GLfloat ru0, ru1, ru2; \
- int v0, v1, v2; \
- GLfloat rv0, rv1, rv2; \
- GLfloat w0, w1, w2; \
- GLfloat rw0, rw1, rw2; \
- int baseu, basev; \
- int d0, d1, d2; \
- int deltdx, deltvx, deltux, deltdy, deltvy, deltuy; \
- int deltwx, deltwy; \
- int rbaseu, rbasev; \
- int dstart, ustart, wstart, vstart; \
- static int stmp = 0; \
- s3vTextureObjectPtr t
-#define TEX_VARS_VOIDS \
- (void) u0; (void) u1; (void) u2; (void) ru0; (void) ru1; (void) ru2; \
- (void) v0; (void) v1; (void) v2; (void) rv0; (void) rv1; (void) rv2; \
- (void) w0; (void) w1; (void) w2; (void) rw0; (void) rw1; (void) rw2; \
- (void) baseu; (void) basev; (void) d0; (void) d1; (void) d2; \
- (void) deltdx; (void) deltvx; (void) deltux; (void) deltdy; \
- (void) deltuy; (void) deltwx; (void) deltwy; (void) rbaseu; \
- (void) rbasev; (void) dstart; (void) ustart; (void) wstart; \
- (void) vstart; (void) stmp; (void) t
-
-#define SORT_VERT() \
-do { \
- for (i=0; i<3; i++) \
- fy[i] = v[i].win[1]; \
-\
- if (fy[1] > fy[0]) { /* (fy[1] > fy[0]) */ \
-\
- if (fy[2] > fy[0]) { \
- idx[0] = 0; \
- if (fy[1] > fy[2]) { \
- idx[1] = 2; \
- idx[2] = 1; \
- } else { \
- idx[1] = 1; \
- idx[2] = 2; \
- } \
- } else { \
- idx[0] = 2; \
- idx[1] = 0; \
- idx[2] = 1; \
- } \
- } else { /* (fy[1] < y[0]) */ \
- if (fy[2] > fy[0]) { \
- idx[0] = 1; \
- idx[1] = 0; \
- idx[2] = 2; \
- } else { \
- idx[2] = 0; \
- if (fy[2] > fy[1]) { \
- idx[0] = 1; \
- idx[1] = 2; \
- } else { \
- idx[0] = 2; \
- idx[1] = 1; \
- } \
- } \
- } \
-} while(0)
-
-#define SET_VERT() \
-do { \
- for (i=0; i<3; i++) \
- { \
- x[i] = ((v[idx[i]].win[0]) * /* 0x100000*/ 1024.0 * 1024.0); \
- y[i] = fy[i] = (dPriv->h - v[idx[i]].win[1]); \
- z[i] = ((v[idx[i]].win[2]) * /* 0x8000 */ 1024.0 * 32.0); \
- } \
-\
- ydiff = fy[0] - (float)y[0]; \
-\
- ystart = y[0]; \
-\
- dx12 = x[2] - x[1]; \
- dy12 = y[1] - y[2]; \
- dx01 = x[1] - x[0]; \
- dy01 = y[0] - y[1]; \
- dx02 = x[2] - x[0]; \
- dy02 = y[0] - y[2]; \
-\
- delt01 = delt02 = delt12 = 0; \
-} while (0)
-
-
-#define SET_XY() \
-do { \
- if (dy01) delt01 = dx01 / dy01; \
- if (dy12) delt12 = dx12 / dy12; \
- delt02 = dx02 / dy02; \
-\
- start02 = x[0] + (ydiff * delt02); \
- end01 = x[0] + (ydiff * delt01); \
- end12 = x[1] + ((fy[1] - (GLfloat)y[1]) * delt12); \
-} while (0)
-
-#define SET_DIR() \
-do { \
- tmp = x[1] - (dy01 * delt02 + x[0]); \
- if (tmp > 0) { \
- lr = 0x80000000; \
- } else { \
- tmp *= -1; \
- lr = 0; \
- } \
- tmp >>= 20; \
-\
- y01y12 = ((((y[0] - y[1]) & 0x7FF) << 16) \
- | ((y[1] - y[2]) & 0x7FF) | lr); \
-} while (0)
-
-#define SET_Z() \
-do { \
- deltzy = (z[2] - z[0]) / dy02; \
- if (tmp) { \
- deltzx = (z[1] - (dy01 * deltzy + z[0])) / tmp; \
- } else { \
- deltzx = 0; \
- } \
- zstart = (deltzy * ydiff) + z[0]; \
-} while (0)
-
-#define SET_FLAT_COL() \
-do { \
- col[0] = &(v[0].color[0]); \
- deltarx = deltary = deltgbx = deltgby = 0; \
- gbstart = (((col[0][1]) << 23) | ((col[0][2]) << 7)); \
- arstart = (((col[0][3]) << 23) | ((col[0][0]) << 7)); \
-} while(0)
-
-#define SET_GOURAUD_COL() \
-do { \
- col[0] = &(v[idx[0]].color[0]); \
- col[1] = &(v[idx[1]].color[0]); \
- col[2] = &(v[idx[2]].color[0]); \
-\
- ctmp = ((col[2][3] - col[0][3]) << 7) / dy02; \
- ctmp2 = ((col[2][0] - col[0][0]) << 7) / dy02; \
- deltary = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
- ctmp3 = ((col[2][1] - col[0][1]) << 7) / dy02; \
- ctmp4 = ((col[2][2] - col[0][2]) << 7) / dy02; \
- deltgby = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- gbstart = \
- (((int)((ydiff * ctmp3) + (col[0][1] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp4) + (col[0][2] << 7)) & 0x7FFF); \
- arstart = \
- (((int)((ydiff * ctmp) + (col[0][3] << 7)) << 16) & 0x7FFF0000) \
- | ((int)((ydiff * ctmp2) + (col[0][0] << 7)) & 0x7FFF); \
- if (tmp) { \
- int ax, rx, gx, bx; \
- ax = ((col[1][3] << 7) - (dy01 * ctmp + (col[0][3] << 7))) / tmp; \
- rx = ((col[1][0] << 7) - (dy01 * ctmp2 + (col[0][0] << 7))) / tmp; \
- gx = ((col[1][1] << 7) - (dy01 * ctmp3 + (col[0][1] << 7))) / tmp; \
- bx = ((col[1][2] << 7) - (dy01 * ctmp4 + (col[0][2] << 7))) / tmp; \
- deltarx = ((ax << 16) & 0xFFFF0000) | (rx & 0xFFFF); \
- deltgbx = ((gx << 16) & 0xFFFF0000) | (bx & 0xFFFF); \
- } else { \
- deltgbx = deltarx = 0; \
- } \
-} while (0)
-
-#define SET_TEX_VERT() \
-do { \
- t = ((s3vTextureObjectPtr) \
- ctx->Texture.Unit[0]._Current->DriverData); \
- deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \
-\
- u0 = (v[idx[0]].texcoord[0][0] \
- * (GLfloat)(t->image[0].image->Width) * 256.0); \
- u1 = (v[idx[1]].texcoord[0][0] \
- * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
- u2 = (v[idx[2]].texcoord[0][0] \
- * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
- v0 = (v[idx[0]].texcoord[0][1] \
- * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
- v1 = (v[idx[1]].texcoord[0][1] \
- * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
- v2 = (v[idx[2]].texcoord[0][1] \
- * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
-\
- w0 = (v[idx[0]].win[3]); \
- w1 = (v[idx[1]].win[3]); \
- w2 = (v[idx[2]].win[3]); \
-} while (0)
-
-#define SET_BASEUV() \
-do { \
- if (u0 < u1) { \
- if (u0 < u2) { \
- baseu = u0; \
- } else { \
- baseu = u2; \
- } \
- } else { \
- if (u1 < u2) { \
- baseu = u1; \
- } else { \
- baseu = u2; \
- } \
- } \
-\
- if (v0 < v1) { \
- if (v0 < v2) { \
- basev = v0; \
- } else { \
- basev = v2; \
- } \
- } else { \
- if (v1 < v2) { \
- basev = v1; \
- } else { \
- basev = v2; \
- } \
- } \
-} while (0)
-
-
-#define SET_RW() \
-do { \
- /* GLfloat minW; \
-\
- if (w0 < w1) { \
- if (w0 < w2) { \
- minW = w0; \
- } else { \
- minW = w2; \
- } \
- } else { \
- if (w1 < w2) { \
- minW = w1; \
- } else { \
- minW = w2; \
- } \
- } */ \
-\
- rw0 = (512.0 * w0); \
- rw1 = (512.0 * w1); \
- rw2 = (512.0 * w2); \
-} while (0)
-
-#define SET_D() \
-do { \
- GLfloat sxy, suv; \
- int lev; \
-\
- suv = (v[idx[0]].texcoord[0][0] - \
- v[idx[2]].texcoord[0][0]) * \
- (v[idx[1]].texcoord[0][1] - \
- v[idx[2]].texcoord[0][1]) - \
- (v[idx[1]].texcoord[0][0] - \
- v[idx[2]].texcoord[0][0]) * \
- (v[idx[0]].texcoord[0][1] - \
- v[idx[2]].texcoord[0][2]); \
-\
- sxy = (v[idx[0]].texcoord[0][0] - \
- v[idx[2]].texcoord[0][0]) * \
- (v[idx[1]].texcoord[0][1] - \
- v[idx[2]].texcoord[0][1]) - \
- (v[idx[1]].texcoord[0][0] - \
- v[idx[2]].texcoord[0][0]) * \
- (v[idx[0]].texcoord[0][1] - \
- v[idx[2]].texcoord[0][2]); \
-\
- if (sxy < 0) sxy *= -1.0; \
- if (suv < 0) suv *= -1.0; \
-\
- lev = *(int*)&suv - *(int *)&sxy; \
- if (lev < 0) \
- lev = 0; \
- else \
- lev >>=23; \
- dstart = (lev << 27); \
-} while (0)
-
-#define SET_UVWD() \
-do { \
- SET_BASEUV(); \
- SET_RW(); \
- SET_D(); \
- ru0 = (((u0 - baseu) * rw0)); \
- ru1 = (((u1 - baseu) * rw1)); \
- ru2 = (((u2 - baseu) * rw2)); \
- rv0 = (((v0 - basev) * rw0)); \
- rv1 = (((v1 - basev) * rw1)); \
- rv2 = (((v2 - basev) * rw2)); \
-\
- while (baseu < 0) { baseu += (t->globj->Image[0][0]->Width << 8); } \
- while (basev < 0) { basev += (t->globj->Image[0][0]->Height << 8); } \
-\
- if (!(baseu & 0xFF)) \
- { baseu = (baseu >> 8); } \
- else \
- { baseu = (baseu >> 8) + 1; } \
-\
- if ((basev & 0x80) || !(basev & 0xFF)) \
- { basev = (basev >> 8); } \
- else \
- { basev = (basev >> 8) - 1; } \
-\
- rbaseu = (baseu) << (16 - t->globj->Image[0][0]->WidthLog2); \
- rbasev = (basev) << (16 - t->globj->Image[0][0]->WidthLog2); \
- deltuy = (((ru2 - ru0) / dy02)); \
- deltvy = (((rv2 - rv0) / dy02)); \
- rw0 *= (1024.0 * 512.0); \
- rw1 *= (1024.0 * 512.0); \
- rw2 *= (1024.0 * 512.0); \
- deltwy = ((rw2 - rw0) / dy02); \
- if (tmp) { \
- deltux = ((ru1 - (dy01 * deltuy + ru0)) / tmp); \
- deltvx = ((rv1 - (dy01 * deltvy + rv0)) / tmp); \
- deltwx = ((rw1 - (dy01 * deltwy + rw0)) / tmp); \
- } else { deltux = deltvx = deltwx = 0; } \
- ustart = (deltuy * ydiff) + (ru0); \
- vstart = (deltvy * ydiff) + (rv0); \
- wstart = (deltwy * ydiff) + (rw0); \
-} while (0)
-
-#define SEND_UVWD() \
-do { \
- DMAOUT((rbasev & 0xFFFF)); \
- DMAOUT((0xa0000000 | (rbaseu & 0xFFFF))); \
- DMAOUT(deltwx); \
- DMAOUT(deltwy); \
- DMAOUT(wstart); \
- DMAOUT(deltdx); \
- DMAOUT(deltvx); \
- DMAOUT(deltux); \
- DMAOUT(deltdy); \
- DMAOUT(deltvy); \
- DMAOUT(deltuy); \
- DMAOUT(dstart); \
- DMAOUT(vstart); \
- DMAOUT(ustart); \
-} while (0)
-
-#define SEND_VERT() \
-do { \
- DMAOUT(deltzx); \
- DMAOUT(deltzy); \
- DMAOUT(zstart); \
- DMAOUT(delt12); \
- DMAOUT(end12); \
- DMAOUT(delt01); \
- DMAOUT(end01); \
- DMAOUT(delt02); \
- DMAOUT(start02); \
- DMAOUT(ystart); \
- DMAOUT(y01y12); \
-} while (0)
-
-#define SEND_COL() \
-do { \
- DMAOUT(deltgbx); \
- DMAOUT(deltarx); \
- DMAOUT(deltgby); \
- DMAOUT(deltary); \
- DMAOUT(gbstart); \
- DMAOUT(arstart); \
-} while (0)
-
-/**** MACROS end ****/
-
-
-
-
-static void TAG(s3v_point)( s3vContextPtr vmesa,
- const s3vVertex *_v0 )
-{
-}
-
-static void TAG(s3v_line)( s3vContextPtr vmesa,
- const s3vVertex *_v0,
- const s3vVertex *_v1 )
-{
- GLcontext *ctx = vmesa->glCtx;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- LINE_VERT_VARS;
-#if (IND & S3V_RAST_FLAT_BIT)
- LINE_FLAT_VARS;
-#else
- LINE_GOURAUD_VARS;
-#endif
-#if (IND & S3V_RAST_CULL_BIT)
- GLfloat cull;
- (void) cull;
-#endif
- LINE_VERT_VARS_VOIDS;
-#if (IND & S3V_RAST_FLAT_BIT)
- LINE_FLAT_VARS_VOIDS;
-#else
- LINE_GOURAUD_VARS_VOIDS;
-#endif
-
- DEBUG(("*** s3v_line: "));
-#if (IND & S3V_RAST_CULL_BIT)
- DEBUG(("cull "));
-#endif
-#if (IND & S3V_RAST_FLAT_BIT)
- DEBUG(("flat "));
-#endif
-
- DEBUG(("***\n"));
-
-#if 0
- s3v_print_vertex(ctx, _v0);
- s3v_print_vertex(ctx, _v1);
-#endif
-
- s3v_translate_vertex( ctx, _v0, &v[0] );
- s3v_translate_vertex( ctx, _v1, &v[1] );
-
-#if (IND & S3V_RAST_CULL_BIT)
- /* FIXME: should we cull lines too? */
-#endif
- (void)v; /* v[0]; v[1]; */
-
- SORT_LINE_VERT();
- SET_LINE_VERT();
-
- SET_LINE_XY();
- SET_LINE_DIR();
- SET_LINE_Z();
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_LINE_FLAT_COL();
-#else
- SET_LINE_GOURAUD_COL();
-#endif
-
- DMAOUT_CHECK(3DLINE_GBD, 15);
- SEND_LINE_COL();
- DMAOUT(0);
- SEND_LINE_VERT();
- DMAFINISH();
-}
-
-static void TAG(s3v_triangle)( s3vContextPtr vmesa,
- const s3vVertex *_v0,
- const s3vVertex *_v1,
- const s3vVertex *_v2 )
-{
- GLcontext *ctx = vmesa->glCtx;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- VERT_VARS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS;
-#else
- GOURAUD_VARS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS;
-#endif
-#if (IND & S3V_RAST_CULL_BIT)
- GLfloat cull;
-#endif
- VERT_VARS_VOIDS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS_VOIDS;
-#else
- GOURAUD_VARS_VOIDS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS_VOIDS;
-#endif
-
- DEBUG(("*** s3v_triangle: "));
-#if (IND & S3V_RAST_CULL_BIT)
- DEBUG(("cull "));
-#endif
-#if (IND & S3V_RAST_FLAT_BIT)
- DEBUG(("flat "));
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- DEBUG(("tex "));
-#endif
-
-DEBUG(("***\n"));
-
-#if 0
- s3v_print_vertex(ctx, _v0);
- s3v_print_vertex(ctx, _v1);
- s3v_print_vertex(ctx, _v2);
-#endif
-
- s3v_translate_vertex( ctx, _v0, &v[0] );
- s3v_translate_vertex( ctx, _v1, &v[1] );
- s3v_translate_vertex( ctx, _v2, &v[2] );
-
-#if (IND & S3V_RAST_CULL_BIT)
- cull = vmesa->backface_sign *
- ((v[1].win[0] - v[0].win[0]) * (v[0].win[1] - v[2].win[1]) +
- (v[1].win[1] - v[0].win[1]) * (v[2].win[0] - v[0].win[0]));
-
- if (cull < vmesa->cull_zero /* -0.02f */) return;
-#endif
-
- (void)v; /* v[0]; v[1]; v[2]; */
-
- SORT_VERT();
- SET_VERT();
-
- if (dy02 == 0) return;
-
- SET_XY();
- SET_DIR();
- SET_Z();
-
-#if (IND & S3V_RAST_TEX_BIT)
- SET_TEX_VERT();
- SET_UVWD();
-#endif
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_FLAT_COL();
-#else
- SET_GOURAUD_COL();
-#endif
-
-#if (IND & S3V_RAST_TEX_BIT)
- DMAOUT_CHECK(3DTRI_BASEV, 31);
- SEND_UVWD();
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#else
- DMAOUT_CHECK(3DTRI_GBX, 17);
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#endif
-}
-
-static void TAG(s3v_quad)( s3vContextPtr vmesa,
- const s3vVertex *_v0,
- const s3vVertex *_v1,
- const s3vVertex *_v2,
- const s3vVertex *_v3 )
-{
- GLcontext *ctx = vmesa->glCtx;
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-
- SWvertex temp_v[4];
- VERT_VARS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS;
-#else
- GOURAUD_VARS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS;
-#endif
-#if (IND & S3V_RAST_CULL_BIT)
- GLfloat cull;
-#endif
- VERT_VARS_VOIDS;
-#if (IND & S3v_RAST_FLAT_BIT)
- FLAT_VARS_VOIDS;
-#else
- GOURAUD_VARS_VOIDS;
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- TEX_VARS_VOIDS;
-#endif
-
- DEBUG(("*** s3v_quad: "));
-#if (IND & S3V_RAST_CULL_BIT)
- DEBUG(("cull "));
- /* printf(""); */ /* speed trick */
-#endif
-#if (IND & S3V_RAST_FLAT_BIT)
- DEBUG(("flat "));
-#endif
-#if (IND & S3V_RAST_TEX_BIT)
- DEBUG(("tex "));
-#endif
-
- DEBUG(("***\n"));
-
-#if 0
- s3v_print_vertex(ctx, _v0);
- s3v_print_vertex(ctx, _v1);
- s3v_print_vertex(ctx, _v2);
- s3v_print_vertex(ctx, _v3);
-#endif
- s3v_translate_vertex( ctx, _v0, &temp_v[0] );
- s3v_translate_vertex( ctx, _v1, &temp_v[1] );
- s3v_translate_vertex( ctx, _v2, &temp_v[2] );
- s3v_translate_vertex( ctx, _v3, &temp_v[3] );
-
- /* FIRST TRI (0,1,2) */
-
- /* ROMEO */
- /* printf(""); */ /* speed trick (a) [turn on if (a) is return]*/
-
- v[0] = temp_v[0];
- v[1] = temp_v[1];
- v[2] = temp_v[2];
-
-#if (IND & S3V_RAST_CULL_BIT)
- cull = vmesa->backface_sign *
- ((v[1].win[0] - v[0].win[0]) * (v[0].win[1] - v[2].win[1]) +
- (v[1].win[1] - v[0].win[1]) * (v[2].win[0] - v[0].win[0]));
-
- if (cull < vmesa->cull_zero /* -0.02f */) goto second; /* return; */ /* (a) */
-#endif
-
-#if 0
- v[0] = temp_v[0];
- v[1] = temp_v[1];
- v[2] = temp_v[2];
-#else
- (void) v;
-#endif
- SORT_VERT();
- SET_VERT();
-
- if (dy02 == 0) goto second;
-
- SET_XY();
- SET_DIR();
- SET_Z();
-
-#if (IND & S3V_RAST_TEX_BIT)
- SET_TEX_VERT();
- SET_UVWD();
-#endif
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_FLAT_COL();
-#else
- SET_GOURAUD_COL();
-#endif
-
-#if (IND & S3V_RAST_TEX_BIT)
- DMAOUT_CHECK(3DTRI_BASEV, 31);
- SEND_UVWD();
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#else
- DMAOUT_CHECK(3DTRI_GBX, 17);
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#endif
-
- /* SECOND TRI (0,2,3) */
-
-second:
- v[0] = temp_v[0];
- v[1] = temp_v[2];
- v[2] = temp_v[3];
-
-#if (IND & S3V_RAST_CULL_BIT)
- cull = vmesa->backface_sign *
- ((v[1].win[0] - v[0].win[0]) * (v[0].win[1] - v[2].win[1]) +
- (v[1].win[1] - v[0].win[1]) * (v[2].win[0] - v[0].win[0]));
-
- if (cull < /* -0.02f */ vmesa->cull_zero) return;
-#endif
-
-/* second: */
-
- /* ROMEO */
- /* printf(""); */ /* speed trick */
-
- v[0] = temp_v[0];
- v[1] = temp_v[2];
- v[2] = temp_v[3];
-
- SORT_VERT();
- SET_VERT();
-
- if (dy02 == 0) return;
-
- SET_XY();
- SET_DIR();
- SET_Z();
-
-#if (IND & S3V_RAST_TEX_BIT)
- SET_TEX_VERT();
- SET_UVWD();
-#endif
-
-#if (IND & S3V_RAST_FLAT_BIT)
- SET_FLAT_COL();
-#else
- SET_GOURAUD_COL();
-#endif
-
-#if (IND & S3V_RAST_TEX_BIT)
- DMAOUT_CHECK(3DTRI_BASEV, 31);
- SEND_UVWD();
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#else
- DMAOUT_CHECK(3DTRI_GBX, 17);
- SEND_COL();
- SEND_VERT();
- DMAFINISH();
-#endif
-}
-
-static void TAG(s3v_init)(void)
-{
- s3v_point_tab[IND] = TAG(s3v_point);
- s3v_line_tab[IND] = TAG(s3v_line);
- s3v_tri_tab[IND] = TAG(s3v_triangle);
- s3v_quad_tab[IND] = TAG(s3v_quad);
-}
-
-#undef IND
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.c
deleted file mode 100644
index dadf2b489..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/tnl.h"
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "s3v_tris.h"
-
-#define S3V_XYZW_BIT 0x1
-#define S3V_RGBA_BIT 0x2
-#define S3V_TEX0_BIT 0x4
-#define S3V_PTEX_BIT 0x8
-#define S3V_FOG_BIT 0x10
-#define S3V_MAX_SETUP 0x20
-
-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_stride_shift;
- GLuint vertex_format;
-} setup_tab[S3V_MAX_SETUP];
-
-
-/* Only one vertex format, atm, so no need to give them names:
- */
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 0
-#define TEX0_VERTEX_FORMAT 0
-#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 & S3V_XYZW_BIT)
-#define DO_RGBA (IND & S3V_RGBA_BIT)
-#define DO_SPEC 0
-#define DO_FOG (IND & S3V_FOG_BIT)
-#define DO_TEX0 (IND & S3V_TEX0_BIT)
-#define DO_TEX1 0
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & S3V_PTEX_BIT)
-
-#define VERTEX s3vVertex
-#define LOCALVARS /* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */
-#define GET_VIEWPORT_MAT() 0 /* vmesa->hw_viewport */
-#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() 0
-#define GET_VERTEX_SIZE() S3V_CONTEXT(ctx)->vertex_size * sizeof(GLuint)
-#define GET_VERTEX_STORE() S3V_CONTEXT(ctx)->verts
-#define GET_VERTEX_STRIDE_SHIFT() S3V_CONTEXT(ctx)->vertex_stride_shift
-#define INVALIDATE_STORED_VERTICES()
-#define GET_UBYTE_COLOR_STORE() &S3V_CONTEXT(ctx)->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &S3V_CONTEXT(ctx)->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 1 /* FIXME */
-#define HAVE_HW_DIVIDE 1
-#define HAVE_RGBA_COLOR 0 /* we're BGRA */
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 0
-#define HAVE_TEX0_VERTICES 0
-#define HAVE_TEX1_VERTICES 0
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 1
-
-/*
-#define SUBPIXEL_X -.5
-#define SUBPIXEL_Y -.5
-#define UNVIEWPORT_VARS GLfloat h = S3V_CONTEXT(ctx)->driDrawable->h
-#define UNVIEWPORT_X(x) x - SUBPIXEL_X
-#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y
-#define UNVIEWPORT_Z(z) z / vmesa->depth_scale
-*/
-
-#define PTEX_FALLBACK() /* never needed */
-
-#define IMPORT_QUALIFIER
-#define IMPORT_FLOAT_COLORS s3v_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS s3v_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[S3V_CONTEXT(ctx)->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[S3V_CONTEXT(ctx)->SetupIndex].copy_pv
-
-
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) s3v_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_TEX0_BIT|S3V_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT|S3V_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT|S3V_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT|S3V_TEX0_BIT|S3V_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT | S3V_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (S3V_RGBA_BIT | S3V_FOG_BIT | S3V_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_wg(); /* pos + col */
- init_wgt0(); /* pos + col + tex0 */
- init_wgpt0(); /* pos + col + p-tex0 (?) */
- init_t0(); /* tex0 */
- init_g(); /* col */
- init_gt0(); /* col + tex */
- init_wgf();
- init_wgft0();
- init_wgfpt0();
- init_f();
- init_gf();
- init_gft0();
-}
-
-
-#if 0
-void s3vPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & S3V_XYZW_BIT) ? " xyzw," : "",
- (flags & S3V_RGBA_BIT) ? " rgba," : "",
- (flags & S3V_SPEC_BIT) ? " spec," : "",
- (flags & S3V_FOG_BIT) ? " fog," : "",
- (flags & S3V_TEX0_BIT) ? " tex-0," : "",
- (flags & S3V_TEX1_BIT) ? " tex-1," : "");
-}
-#endif
-
-
-void s3vCheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
-
- if (!setup_tab[vmesa->SetupIndex].check_tex_sizes(ctx)) {
-
- vmesa->SetupIndex |= (S3V_PTEX_BIT|S3V_RGBA_BIT);
-
- if (1 || !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[vmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[vmesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void s3vBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)vmesa->verts +
- (start<<vmesa->vertex_stride_shift));
- GLuint stride = 1<<vmesa->vertex_stride_shift;
-
- DEBUG(("*** s3vBuildVertices ***\n"));
- DEBUG(("vmesa->SetupNewInputs = 0x%x\n", vmesa->SetupNewInputs));
- DEBUG(("vmesa->SetupIndex = 0x%x\n", vmesa->SetupIndex));
-
-#if 1
- setup_tab[vmesa->SetupIndex].emit( ctx, start, count, v, stride );
-#else
- newinputs |= vmesa->SetupNewInputs;
- vmesa->SetupNewInputs = 0;
-
- DEBUG(("newinputs is 0x%x\n", newinputs));
-
- if (!newinputs) {
- DEBUG(("!newinputs\n"));
- return;
- }
-
- if (newinputs & VERT_CLIP) {
- setup_tab[vmesa->SetupIndex].emit( ctx, start, count, v, stride );
- DEBUG(("newinputs & VERT_CLIP\n"));
- return;
- } /* else { */
-/* GLuint ind = 0; */
-
- if (newinputs & VERT_RGBA) {
- DEBUG(("newinputs & VERT_RGBA\n"));
- ind |= S3V_RGBA_BIT;
- }
-
- if (newinputs & VERT_TEX0) {
- DEBUG(("newinputs & VERT_TEX0\n"));
- ind |= S3V_TEX0_BIT;
- }
-
- if (newinputs & VERT_FOG_COORD)
- ind |= S3V_FOG_BIT;
-
- if (vmesa->SetupIndex & S3V_PTEX_BIT)
- ind = ~0;
-
- ind &= vmesa->SetupIndex;
-
- DEBUG(("vmesa->SetupIndex = 0x%x\n", vmesa->SetupIndex));
- DEBUG(("ind = 0x%x\n", ind));
- DEBUG(("ind & vmesa->SetupIndex = 0x%x\n", (ind & vmesa->SetupIndex)));
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
-#endif
-}
-
-void s3vChooseVertexState( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- GLuint ind = S3V_XYZW_BIT | S3V_RGBA_BIT;
-
- /* FIXME: will segv in tnl_dd/t_dd_vbtmp.h (line 196) on some demos */
-/*
- if (ctx->Fog.Enabled)
- ind |= S3V_FOG_BIT;
-*/
-
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- _tnl_need_projected_coords( ctx, GL_FALSE );
- ind |= S3V_TEX0_BIT;
- } else {
- _tnl_need_projected_coords( ctx, GL_TRUE );
- }
-
- vmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = s3v_interp_extras;
- tnl->Driver.Render.CopyPV = s3v_copy_pv_extras;
- } else {
- tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
- }
-}
-
-
-void s3vInitVB( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- vmesa->verts = (char *)ALIGN_MALLOC(size * 4 * 16, 32);
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- vmesa->vertex_stride_shift = 6 /* 4 */; /* FIXME - only one vertex setup */
- }
- }
-}
-
-
-void s3vFreeVB( GLcontext *ctx )
-{
- s3vContextPtr vmesa = S3V_CONTEXT(ctx);
- if (vmesa->verts) {
- ALIGN_FREE(vmesa->verts);
- vmesa->verts = 0;
- }
-
- if (vmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE((void *)vmesa->UbyteSecondaryColor.Ptr);
- vmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (vmesa->UbyteColor.Ptr) {
- ALIGN_FREE((void *)vmesa->UbyteColor.Ptr);
- vmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.h
deleted file mode 100644
index b35d804e6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_vb.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#ifndef S3VVB_INC
-#define S3VVB_INC
-
-#include "mtypes.h"
-#include "swrast/swrast.h"
-
-#define _S3V_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE)
-
-
-extern void s3vChooseVertexState( GLcontext *ctx );
-extern void s3vCheckTexSizes( GLcontext *ctx );
-extern void s3vBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-
-
-extern void s3v_import_float_colors( GLcontext *ctx );
-extern void s3v_import_float_spec_colors( GLcontext *ctx );
-
-extern void s3v_translate_vertex( GLcontext *ctx,
- const s3vVertex *src,
- SWvertex *dst );
-
-extern void s3vInitVB( GLcontext *ctx );
-extern void s3vFreeVB( GLcontext *ctx );
-
-extern void s3v_print_vertex( GLcontext *ctx, const s3vVertex *v );
-#if 0
-extern void s3vPrintSetupFlags(char *msg, GLuint flags );
-#endif
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_xmesa.c
deleted file mode 100644
index 4cdda1b58..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3v_xmesa.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#include "s3v_context.h"
-#include "s3v_vb.h"
-#include "context.h"
-#include "matrix.h"
-#include "s3v_dri.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-/* #define DEBUG(str) printf str */
-
-static GLboolean
-s3vInitDriver(__DRIscreenPrivate *sPriv)
-{
- sPriv->private = (void *) s3vCreateScreen( sPriv );
-
- if (!sPriv->private) {
- s3vDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static void
-s3vDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- s3vContextPtr vmesa = (s3vContextPtr)driContextPriv->driverPrivate;
-
- if (vmesa) {
- _swsetup_DestroyContext( vmesa->glCtx );
- _tnl_DestroyContext( vmesa->glCtx );
- _ac_DestroyContext( vmesa->glCtx );
- _swrast_DestroyContext( vmesa->glCtx );
-
- s3vFreeVB( vmesa->glCtx );
-
- /* free the Mesa context */
- vmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(vmesa->glCtx);
-
- _mesa_free(vmesa);
- driContextPriv->driverPrivate = NULL;
- }
-}
-
-
-static GLboolean
-s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- s3vScreenPtr screen = (s3vScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0
- );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- s3vSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- s3vSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- s3vSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- s3vSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- /* no h/w stencil yet?
- if (mesaVis->stencilBits > 0) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
- s3vSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
- */
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static void
-s3vSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
- __DRIscreenPrivate *sPriv;
- GLcontext *ctx;
- s3vContextPtr vmesa;
- s3vScreenPtr s3vscrn;
-
- vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate;
- sPriv = vmesa->driScreen;
- s3vscrn = vmesa->s3vScreen;
- ctx = vmesa->glCtx;
-
- DEBUG(("*** s3vSwapBuffers ***\n"));
-
-/* DMAFLUSH(); */
-
- _mesa_notifySwapBuffers( ctx );
-
- vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate;
-/* driScrnPriv = vmesa->driScreen; */
-
-/* if (vmesa->EnabledFlags & S3V_BACK_BUFFER) */
-
-/* _mesa_notifySwapBuffers( ctx ); */
-#if 1
-{
- int x0, y0, x1, y1;
-/*
- int nRect = dPriv->numClipRects;
- XF86DRIClipRectPtr pRect = dPriv->pClipRects;
-
- __DRIscreenPrivate *driScrnPriv = vmesa->driScreen;
-*/
-
-/*
- DEBUG(("s3vSwapBuffers: S3V_BACK_BUFFER = 1 - nClip = %i\n", nRect));
-*/
-/* vmesa->drawOffset=vmesa->s3vScreen->backOffset; */
-
- x0 = dPriv->x;
- y0 = dPriv->y;
-
- x1 = x0 + dPriv->w - 1;
- y1 = y0 + dPriv->h - 1;
-
- DMAOUT_CHECK(BITBLT_SRC_BASE, 15);
- DMAOUT(vmesa->s3vScreen->backOffset);
- DMAOUT(0); /* 0xc0000000 */
- DMAOUT( ((x0 << 16) | x1) );
- DMAOUT( ((y0 << 16) | y1) );
- DMAOUT( (vmesa->DestStride << 16) | vmesa->SrcStride );
- DMAOUT( (~(0)) );
- DMAOUT( (~(0)) );
- DMAOUT(0);
- DMAOUT(0);
- /* FIXME */
- DMAOUT(0);
- DMAOUT(0);
- DMAOUT( (0x01 | /* Autoexecute */
- 0x02 | /* clip */
- 0x04 | /* 16 bit */
- 0x20 | /* draw */
- 0x400 | /* word alignment (bit 10=1) */
- (0x2 << 11) | /* offset = 1 byte */
- (0xCC << 17) | /* rop #204 */
- (0x3 << 25)) ); /* l-r, t-b */
- DMAOUT(vmesa->ScissorWH);
- DMAOUT( /* 0 */ vmesa->SrcXY );
- DMAOUT( (dPriv->x << 16) | dPriv->y );
- DMAFINISH();
-
- DMAFLUSH();
-
- vmesa->restore_primitive = -1;
-
-}
-#endif
-}
-
-static GLboolean
-s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- int x1,x2,y1,y2;
- int cx, cy, cw, ch;
- unsigned int src_stride, dest_stride;
- int cl;
-
- s3vContextPtr vmesa;
- __DRIdrawablePrivate *dPriv = driDrawPriv;
- vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate;
-
- DEBUG(("s3vMakeCurrent\n"));
-
- DEBUG(("dPriv->x=%i y=%i w=%i h=%i\n", dPriv->x, dPriv->y,
- dPriv->w, dPriv->h));
-
- if (driContextPriv) {
- GET_CURRENT_CONTEXT(ctx);
- s3vContextPtr oldVirgeCtx = ctx ? S3V_CONTEXT(ctx) : NULL;
- s3vContextPtr newVirgeCtx = (s3vContextPtr) driContextPriv->driverPrivate;
-
- if ( newVirgeCtx != oldVirgeCtx ) {
-
- newVirgeCtx->dirty = ~0;
- cl = 1;
- DEBUG(("newVirgeCtx != oldVirgeCtx\n"));
-/* s3vUpdateClipping(newVirgeCtx->glCtx ); */
- }
-
- if (newVirgeCtx->driDrawable != driDrawPriv) {
- newVirgeCtx->driDrawable = driDrawPriv;
- DEBUG(("driDrawable != driDrawPriv\n"));
- s3vUpdateWindow ( newVirgeCtx->glCtx );
- s3vUpdateViewportOffset( newVirgeCtx->glCtx );
-/* s3vUpdateClipping(newVirgeCtx->glCtx ); */
- }
-/*
- s3vUpdateWindow ( newVirgeCtx->glCtx );
- s3vUpdateViewportOffset( newVirgeCtx->glCtx );
-*/
-
-/*
- _mesa_make_current( newVirgeCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0,
- newVirgeCtx->driDrawable->w,
- newVirgeCtx->driDrawable->h);
-*/
-
-#if 0
- newVirgeCtx->Window &= ~W_GIDMask;
- newVirgeCtx->Window |= (driDrawPriv->index << 5);
- CHECK_DMA_BUFFER(newVirgeCtx,1);
- WRITE(newVirgeCtx->buf, S3VWindow, newVirgeCtx->Window);
-#endif
-
- newVirgeCtx->new_state |= S3V_NEW_WINDOW; /* FIXME */
-
- _mesa_make_current( newVirgeCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if (!newVirgeCtx->glCtx->Viewport.Width) {
- _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
-
-/* s3vUpdateClipping(newVirgeCtx->glCtx ); */
- }
-
-/*
- if (cl) {
- s3vUpdateClipping(newVirgeCtx->glCtx );
- cl =0;
- }
-*/
-
- newVirgeCtx->new_state |= S3V_NEW_CLIP;
-
- if (1) {
- cx = dPriv->x;
- cw = dPriv->w;
- cy = dPriv->y;
- ch = dPriv->h;
- }
-
- x1 = y1 = 0;
- x2 = cw-1;
- y2 = ch-1;
-
- /* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp;
- dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */
- src_stride = vmesa->driScreen->fbWidth * 2;
- dest_stride = ((x2+31)&~31) * 2;
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-s3vUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-
-static struct __DriverAPIRec s3vAPI = {
- s3vInitDriver,
- s3vDestroyScreen,
- s3vCreateContext,
- s3vDestroyContext,
- s3vCreateBuffer,
- s3vDestroyBuffer,
- s3vSwapBuffers,
- s3vMakeCurrent,
- s3vUnbindContext,
-};
-
-
-#if 0
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp=NULL;
-
- DEBUG(("__driCreateScreen: psp = %p\n", psp));
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &s3vAPI);
- DEBUG(("__driCreateScreen: psp = %p\n", psp));
- return (void *) psp;
-}
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3virgetri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3virgetri.h
deleted file mode 100644
index 5519cfd74..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/s3v/s3virgetri.h
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Author: Max Lingua <sunmax@libero.it>
- */
-
-#define LOCAL_VARS \
- int vert0, vert1, vert2; \
- GLfloat y0, y1, y2, ydiff; \
- int iy0, iy1, iy2; \
- int x0, x1, x2, z0, z1, z2; \
- int dy01, dy02, dy12, dx01, dx02, dx12; \
- int delt02, delt01, delt12, end01, end12, start02; \
- int zstart, arstart, gbstart; \
- int deltzy, deltzx, deltarx, deltgbx, deltary, deltgby; \
- GLubyte (*colours)[4]; \
- GLubyte (*scolours)[4]; \
- static int tp = 0; \
- int tmp, lr
-
-#define LOCAL_TEX_VARS \
- int u0, u1, u2; \
- GLfloat ru0, ru1, ru2; \
- int v0, v1, v2; \
- GLfloat rv0, rv1, rv2; \
- GLfloat w0, w1, w2; \
- GLfloat rw0, rw1, rw2; \
- int baseu, basev; \
- int d0, d1, d2; \
- int deltdx, deltvx, deltux, deltdy, deltvy, deltuy; \
- int deltwx, deltwy; \
- int rbaseu, rbasev; \
- int dstart, ustart, wstart, vstart; \
- static int stmp = 0; \
- s3virgeTextureObject_t *t
-
-#define CULL_BACKFACE() \
- do { \
- GLfloat *w0 = VB->Win.data[e0]; \
- GLfloat *w1 = VB->Win.data[e1]; \
- GLfloat *w2 = VB->Win.data[e2]; \
- float cull; \
- cull = ctx->backface_sign * ((w1[0] - w0[0]) * (w0[1] - w2[1]) + \
- (w1[1] - w0[1]) * (w2[0] - w0[0])); \
- if (cull < 0) \
- return; \
- } while (0)
-
-#define SORT_VERTICES() \
- do { \
- y0 = VB->Win.data[e0][1]; \
- y1 = VB->Win.data[e1][1]; \
- y2 = VB->Win.data[e2][1]; \
- if (y1 > y0) { \
- if (y2 > y0) { \
- vert0 = e0; \
- if (y1 > y2) { vert2 = e1; vert1 = e2; } else { vert2 = e2; vert1 = e1; } \
- } else { vert0 = e2; vert1 = e0; vert2 = e1; } \
- } else { \
- if (y2 > y0) { vert0 = e1; vert1 = e0; vert2 = e2; } else { \
- vert2 = e0; \
- if (y2 > y1) { vert0 = e1; vert1 = e2; } else { vert0 = e2; vert1 = e1; } \
- } \
- } \
- } while (0)
-
-#define SET_VARIABLES() \
- do { \
- iy0 = y0 = ((s3virgeDB->height - (VB->Win.data[vert0][1]))); \
- iy1 = y1 = ((s3virgeDB->height - (VB->Win.data[vert1][1]))); \
- iy2 = y2 = ((s3virgeDB->height - (VB->Win.data[vert2][1]))); \
- if (iy0 == iy2) { return; } \
- ydiff = y0 - (float)iy0; \
- x0 = ((VB->Win.data[vert0][0]) * 1024.0 * 1024.0); \
- x1 = ((VB->Win.data[vert1][0]) * 1024.0 * 1024.0); \
- x2 = ((VB->Win.data[vert2][0]) * 1024.0 * 1024.0); \
- z0 = (VB->Win.data[vert0][2] * 1024.0 * 32.0); \
- z1 = (VB->Win.data[vert1][2] * 1024.0 * 32.0); \
- z2 = (VB->Win.data[vert2][2] * 1024.0 * 32.0); \
- dx12 = x2 - x1; \
- dy12 = iy1 - iy2; \
- dx01 = x1 - x0; \
- dy01 = iy0 - iy1; \
- dx02 = x2 - x0; \
- dy02 = iy0 - iy2; \
- delt12 = delt02 = delt01 = 0; \
- } while (0)
-
-#define SET_TEX_VARIABLES() \
- do { \
- t = ((s3virgeTextureObject_t *)ctx->Texture.Unit[0].Current->DriverData); \
- deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \
- u0 = (VB->TexCoordPtr[0]->data[vert0][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \
- u1 = (VB->TexCoordPtr[0]->data[vert1][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \
- u2 = (VB->TexCoordPtr[0]->data[vert2][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \
- v0 = (VB->TexCoordPtr[0]->data[vert0][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \
- v1 = (VB->TexCoordPtr[0]->data[vert1][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \
- v2 = (VB->TexCoordPtr[0]->data[vert2][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \
- w0 = (VB->Win.data[vert0][3]); \
- w1 = (VB->Win.data[vert1][3]); \
- w2 = (VB->Win.data[vert2][3]); \
- } while (0)
-
-#define FLATSHADE_COLORS() \
- do { \
- GLubyte *col = &(colours[pv][0]); \
- deltarx = deltary = deltgbx = deltgby = 0; \
- gbstart = (((col[1]) << 23) | ((col[2]) << 7)); \
- arstart = (((col[3]) << 23) | ((col[0]) << 7)); \
- } while (0)
-
-#define GOURAUD_COLORS() \
- do { \
- int ctmp, ctmp2, ctmp3, ctmp4; \
- GLubyte *col0, *col1, *col2; \
- col0 = &(colours[vert0][0]); \
- col1 = &(colours[vert1][0]); \
- col2 = &(colours[vert2][0]); \
- ctmp = ((col2[3] - col0[3]) << 7) / dy02; \
- ctmp2 = ((col2[0] - col0[0]) << 7) / dy02; \
- deltary = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \
- ctmp3 = ((col2[1] - col0[1]) << 7) / dy02; \
- ctmp4 = ((col2[2] - col0[2]) << 7) / dy02; \
- deltgby = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \
- gbstart = (((int)((ydiff * ctmp3) + (col0[1] << 7)) << 16) & 0x7FFF0000) | \
- ((int)((ydiff * ctmp4) + (col0[2] << 7)) & 0x7FFF); \
- arstart = (((int)((ydiff * ctmp) + (col0[3] << 7)) << 16) & 0x7FFF0000) | \
- ((int)((ydiff * ctmp2) + (col0[0] << 7)) & 0x7FFF); \
- if (tmp) { \
- int ax, rx, gx, bx; \
- ax = ((col1[3] << 7) - (dy01 * ctmp + (col0[3] << 7))) / tmp; \
- rx = ((col1[0] << 7) - (dy01 * ctmp2 + (col0[0] << 7))) / tmp; \
- gx = ((col1[1] << 7) - (dy01 * ctmp3 + (col0[1] << 7))) / tmp; \
- bx = ((col1[2] << 7) - (dy01 * ctmp4 + (col0[2] << 7))) / tmp; \
- deltarx = ((ax << 16) & 0xFFFF0000) | (rx & 0xFFFF); \
- deltgbx = ((gx << 16) & 0xFFFF0000) | (bx & 0xFFFF); \
- } else { \
- deltgbx = deltarx = 0; \
- } \
- } while (0)
-
-#define SET_XY() \
- do { \
- delt02 = dx02 / dy02; \
- if (dy12) delt12 = dx12 / dy12; \
- if (dy01) delt01 = dx01 / dy01; \
- start02 = (ydiff * delt02) + x0; \
- end01 = (ydiff * delt01) + x0; \
- end12 = ((y1 - (GLfloat)iy1) * delt12) + x1; \
- } while (0)
-
-#define SET_DIR() \
- do { \
- tmp = x1 - (dy01 * delt02 + x0); \
- if (tmp > 0) { \
- lr = 0x80000000; \
- } else { \
- tmp *= -1; \
- lr = 0; \
- } \
- tmp >>= 20; \
- } while (0)
-
-#define SET_Z() \
- do { \
- deltzy = (z2 - z0) / dy02; \
- if (tmp) { \
- deltzx = (z1 - (dy01 * deltzy + z0)) / tmp; \
- } else { deltzx = 0; } \
- zstart = (deltzy * ydiff) + z0; \
- } while (0)
-
-#define SET_BASEUV() \
- do { \
- if (u0 < u1) { \
- if (u0 < u2) { \
- baseu = u0; \
- } else { \
- baseu = u2; \
- } \
- } else { \
- if (u1 < u2) { \
- baseu = u1; \
- } else { \
- baseu = u2; \
- } \
- } \
- if (v0 < v1) { \
- if (v0 < v2) { \
- basev = v0; \
- } else { \
- basev = v2; \
- } \
- } else { \
- if (v1 < v2) { \
- basev = v1; \
- } else { \
- basev = v2; \
- } \
- } \
- } while (0)
-
-#define SET_RW() \
- do { \
- /* GLfloat minW; \
- if (w0 < w1) { \
- if (w0 < w2) { \
- minW = w0; \
- } else { \
- minW = w2; \
- } \
- } else { \
- if (w1 < w2) { \
- minW = w1; \
- } else { \
- minW = w2; \
- } \
- } */ \
- rw0 = (512.0 * w0); \
- rw1 = (512.0 * w1); \
- rw2 = (512.0 * w2); \
- } while (0)
-
-
-#define SET_D() \
- do { \
- GLfloat sxy, suv; \
- int lev; \
- suv = (VB->TexCoordPtr[0]->data[vert0][0] - \
- VB->TexCoordPtr[0]->data[vert2][0]) * \
- (VB->TexCoordPtr[0]->data[vert1][1] - \
- VB->TexCoordPtr[0]->data[vert2][1]) - \
- (VB->TexCoordPtr[0]->data[vert1][0] - \
- VB->TexCoordPtr[0]->data[vert2][0]) * \
- (VB->TexCoordPtr[0]->data[vert0][1] - \
- VB->TexCoordPtr[0]->data[vert2][2]); \
- sxy = (VB->Win.data[vert0][0] - \
- VB->Win.data[vert2][0]) * \
- (VB->Win.data[vert1][1] - \
- VB->Win.data[vert2][1]) - \
- (VB->Win.data[vert1][0] - \
- VB->Win.data[vert2][0]) * \
- (VB->Win.data[vert0][1] - \
- VB->Win.data[vert2][2]); \
- if (sxy < 0) sxy *= -1.0; \
- if (suv < 0) suv *= -1.0; \
- lev = *(int*)&suv - *(int *)&sxy; \
- if (lev < 0) \
- lev = 0; \
- else \
- lev >>=23; \
- dstart = (lev << 27); \
- } while (0)
-
-
-
-#define SET_UVWD() \
- do { \
- SET_BASEUV(); \
- SET_RW(); \
- SET_D(); \
- ru0 = (((u0 - baseu) * rw0)); \
- ru1 = (((u1 - baseu) * rw1)); \
- ru2 = (((u2 - baseu) * rw2)); \
- rv0 = (((v0 - basev) * rw0)); \
- rv1 = (((v1 - basev) * rw1)); \
- rv2 = (((v2 - basev) * rw2)); \
- while (baseu < 0) { baseu += (t->tObj->Image[0]->Width << 8); } \
- while (basev < 0) { basev += (t->tObj->Image[0]->Height << 8); } \
- if (!(baseu & 0xFF)) { baseu = (baseu >> 8); } else { baseu = (baseu >> 8) + 1; } \
- if ((basev & 0x80) || !(basev & 0xFF)) { basev = (basev >> 8); } else { basev = (basev >> 8) - 1; } \
- rbaseu = (baseu) << (16 - t->widthLog2); \
- rbasev = (basev) << (16 - t->widthLog2); \
- deltuy = (((ru2 - ru0) / dy02)); \
- deltvy = (((rv2 - rv0) / dy02)); \
- rw0 *= (1024.0 * 512.0); \
- rw1 *= (1024.0 * 512.0); \
- rw2 *= (1024.0 * 512.0); \
- deltwy = ((rw2 - rw0) / dy02); \
- if (tmp) { \
- deltux = ((ru1 - (dy01 * deltuy + ru0)) / tmp); \
- deltvx = ((rv1 - (dy01 * deltvy + rv0)) / tmp); \
- deltwx = ((rw1 - (dy01 * deltwy + rw0)) / tmp); \
- } else { deltux = deltvx = deltwx = 0; } \
- ustart = (deltuy * ydiff) + (ru0); \
- vstart = (deltvy * ydiff) + (rv0); \
- wstart = (deltwy * ydiff) + (rw0); \
- } while (0)
-
-
-#define SEND_COLORS() \
- do { \
- WAITFIFOEMPTY(6); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GBX), deltgbx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ARX), deltarx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GBY), deltgby); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ARY), deltary); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GS_BS), gbstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_AS_RS), arstart); \
- } while (0)
-
-#define SEND_VERTICES() \
- do { \
- WAITFIFOEMPTY(6); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZSTART), zstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZXD), deltzx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZYD), deltzy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA12), delt12); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXEND12), end12); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA01), delt01); \
- WAITFIFOEMPTY(5); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXEND01), end01); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA02), delt02); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXSTART02), start02); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TYS), iy0); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TY01_Y12), \
- ((((iy0 - iy1) & 0x7FF) << 16) | \
- ((iy1 - iy2) & 0x7FF) | lr)); \
- } while (0)
-
-#define SEND_UVWD() \
- do { \
- WAITFIFOEMPTY(7); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_BASEV), (rbasev & 0xFFFF)); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_BASEU), (0xa0000000 | (rbaseu & 0xFFFF))); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WXD), deltwx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WYD), deltwy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WSTART), wstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DXD), deltdx); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VXD), deltvx); \
- WAITFIFOEMPTY(7); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_UXD), deltux); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DYD), deltdy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VYD), deltvy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_UYD), deltuy); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DSTART), dstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VSTART), vstart); \
- OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_USTART), ustart); \
- } while (0)
-
-#define DMA_SEND_UVWD() \
- do { \
- DMAOUT((rbasev & 0xFFFF)); \
- DMAOUT((0xa0000000 | (rbaseu & 0xFFFF))); \
- DMAOUT(deltwx); \
- DMAOUT(deltwy); \
- DMAOUT(wstart); \
- DMAOUT(deltdx); \
- DMAOUT(deltvx); \
- DMAOUT(deltux); \
- DMAOUT(deltdy); \
- DMAOUT(deltvy); \
- DMAOUT(deltuy); \
- DMAOUT(dstart); \
- DMAOUT(vstart); \
- DMAOUT(ustart); \
- } while (0)
-
-
-#define DMA_SEND_COLORS() \
- do { \
- DMAOUT(deltgbx); \
- DMAOUT(deltarx); \
- DMAOUT(deltgby); \
- DMAOUT(deltary); \
- DMAOUT(gbstart); \
- DMAOUT(arstart); \
- } while (0)
-
-#define DMA_SEND_VERTICES() \
- do { \
- DMAOUT(deltzx); \
- DMAOUT(deltzy); \
- DMAOUT(zstart); \
- DMAOUT(delt12); \
- DMAOUT(end12); \
- DMAOUT(delt01); \
- DMAOUT(end01); \
- DMAOUT(delt02); \
- DMAOUT(start02); \
- DMAOUT(iy0); \
- DMAOUT(((((iy0 - iy1) & 0x7FF) << 16) | \
- ((iy1 - iy2) & 0x7FF) | lr)); \
- } while (0)
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/Makefile
deleted file mode 100644
index 018482f66..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-# src/mesa/drivers/dri/r128/Makefile
-
-TOP = ../../../../..
-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 \
- savagestate.c \
- savagetex.c \
- savagetris.c \
- savagerender.c \
- savageioctl.c \
- savagespan.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_3d_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_3d_reg.h
deleted file mode 100644
index b7d1c3960..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_3d_reg.h
+++ /dev/null
@@ -1,699 +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.
- */
-
-
-#ifndef SAVAGE_3D_REG_H
-#define SAVAGE_3D_REG_H
-
-#define VIDEO_MEM_ADR 0x02
-#define SYSTEM_MEM_ADR 0x01
-#define AGP_MEM_ADR 0x03
-
-/***********************************************************
-
- ----------- 3D ENGINE UNIT Registers -------------
-
- *********************************************************/
-
-typedef union
-{
- struct
- {
- unsigned reserved : 4;
- unsigned ofs : 28;
- }ni;
- u_int32_t ui;
-} savageRegZPixelOffset;
-
-/* This reg exists only on Savage4. */
-typedef union
-{
- struct
- {
- unsigned cmpFunc : 3;
- unsigned stencilEn : 1;
- unsigned readMask : 8;
- unsigned writeMask : 8;
- unsigned failOp : 3;
- unsigned passZfailOp : 3;
- unsigned passZpassOp : 3;
- unsigned reserved : 3;
- }ni;
- u_int32_t ui;
-} savageRegStencilCtrl;
-
-/**************************
- Texture Registers
-**************************/
-/* The layout of this reg differs between Savage4 and Savage3D. */
-typedef union
-{
- struct
- {
- unsigned tex0Width : 4;
- unsigned tex0Height : 4;
- unsigned tex0Fmt : 4;
- unsigned tex1Width : 4;
- unsigned tex1Height : 4;
- unsigned tex1Fmt : 4;
- unsigned texBLoopEn : 1;
- unsigned tex0En : 1;
- unsigned tex1En : 1;
- unsigned orthProjEn : 1;
- unsigned reserved : 1;
- unsigned palSize : 2;
- unsigned newPal : 1;
- }ni;
- u_int32_t ui;
-} savageRegTexDescr_s4;
-typedef union
-{
- struct
- {
- unsigned texWidth : 4;
- unsigned reserved1 : 4;
- unsigned texHeight : 4;
- unsigned reserved2 : 4;
- /* Savage3D supports only the first 8 texture formats defined in
- enum TexFmt in savge_bci.h. */
- unsigned texFmt : 3;
- unsigned palSize : 2;
- unsigned reserved3 : 10;
- unsigned newPal : 1;
- }ni;
- u_int32_t ui;
-} savageRegTexDescr_s3d;
-
-/* The layout of this reg is the same on Savage4 and Savage3D,
- but the Savage4 has two of them, Savage3D has only one. */
-typedef union
-{
- struct
- {
- unsigned inSysTex : 1;
- unsigned inAGPTex : 1;
- unsigned reserved : 1;
- unsigned addr : 29;
- }ni;
- u_int32_t ui;
-} savageRegTexAddr;
-
-/* The layout of this reg is the same on Savage4 and Savage3D. */
-typedef union
-{
- struct
- {
- unsigned reserved : 3;
- unsigned addr : 29;
- }ni;
- u_int32_t ui;
-} savageRegTexPalAddr;
-
-/* The layout of this reg on Savage4 and Savage3D are very similar. */
-typedef union
-{
- struct
- {
- unsigned xprClr0 : 16;
- unsigned xprClr1 : 16; /* this is reserved on Savage3D */
- }ni;
- u_int32_t ui;
-} savageRegTexXprClr; /* transparency color in RGB565 format*/
-
-/* The layout of this reg differs between Savage4 and Savage3D.
- * Savage4 has two of them, Savage3D has only one. */
-typedef union
-{
- struct
- {
- unsigned filterMode : 2;
- unsigned mipmapEnable : 1;
- unsigned dBias : 9;
- unsigned dMax : 4;
- unsigned uMode : 2;
- unsigned vMode : 2;
- unsigned useDFraction : 1;
- unsigned texXprEn : 1;
- unsigned clrBlendAlphaSel : 2;
- unsigned clrArg1CopyAlpha : 1;
- unsigned clrArg2CopyAlpha : 1;
- unsigned clrArg1Invert : 1;
- unsigned clrArg2Invert : 1;
- unsigned alphaBlendAlphaSel : 2;
- unsigned alphaArg1Invert : 1;
- unsigned alphaArg2Invert : 1;
- }ni;
- u_int32_t ui;
-} savageRegTexCtrl_s4;
-typedef union
-{
- struct
- {
- unsigned filterMode : 2;
- unsigned mipmapDisable : 1;
- unsigned dBias : 9;
- unsigned uWrapEn : 1;
- unsigned vWrapEn : 1;
- unsigned wrapMode : 2;
- unsigned texEn : 1;
- unsigned useDFraction : 1;
- unsigned reserved1 : 1;
- /* Color Compare Alpha Blend Control
- 0 - reduce dest alpha to 0 or 1
- 1 - blend with destination
- The Utah-Driver doesn't know how to use it and sets it to 0. */
- unsigned CCA : 1;
- unsigned texXprEn : 1;
- unsigned reserved2 : 11;
- }ni;
- u_int32_t ui;
-} savageRegTexCtrl_s3d;
-
-/* This reg exists only on Savage4. */
-typedef union
-{
- struct
- {
- unsigned colorArg1Sel : 2;
- unsigned colorArg2Sel : 3;
- unsigned colorInvAlphaEn : 1;
- unsigned colorInvArg2En : 1;
- unsigned colorPremodSel : 1;
- unsigned colorMod1Sel : 1;
- unsigned colorMod2Sel : 2;
- unsigned colorAddSel : 2;
- unsigned colorDoBlend : 1;
- unsigned colorDo2sCompl : 1;
- unsigned colorAddBiasEn : 1;
- unsigned alphaArg1Sel : 2;
- unsigned alphaArg2Sel : 3;
- unsigned alphaMod1Sel : 1;
- unsigned alphaMod2Sel : 2;
- unsigned alphaAdd0Sel : 1;
- unsigned alphaDoBlend : 1;
- unsigned alphaDo2sCompl : 1;
- unsigned colorStageClamp : 1;
- unsigned alphaStageClamp : 1;
- unsigned colorDoDiffMul : 1;
- unsigned LeftShiftVal : 2;
- }ni;
- u_int32_t ui;
-} savageRegTexBlendCtrl;
-
-/* This reg exists only on Savage4. */
-typedef union
-{
- struct
- {
- unsigned blue : 8;
- unsigned green : 8;
- unsigned red : 8;
- unsigned alpha : 8;
- }ni;
- u_int32_t ui;
-} savageRegTexBlendColor;
-
-/********************************
- Tiled Surface Registers
-**********************************/
-
-typedef union
-{
- struct
- {
- unsigned frmBufOffset : 13;
- unsigned reserved : 12;
- unsigned widthInTile : 6;
- unsigned bitPerPixel : 1;
- }ni;
- u_int32_t ui;
-} savageRegTiledSurface;
-
-/********************************
- Draw/Shading Control Registers
-**********************************/
-
-/* This reg exists only on Savage4. */
-typedef union
-{
- struct
- {
- unsigned scissorXStart : 11;
- unsigned dPerfAccelEn : 1;
- unsigned scissorYStart : 12;
- unsigned alphaRefVal : 8;
- }ni;
- u_int32_t ui;
-} savageRegDrawCtrl0;
-
-/* This reg exists only on Savage4. */
-typedef union
-{
- struct
- {
- unsigned scissorXEnd : 11;
- unsigned xyOffsetEn : 1;
- unsigned scissorYEnd : 12;
- unsigned ditherEn : 1;
- unsigned nonNormTexCoord : 1;
- unsigned cullMode : 2;
- unsigned alphaTestCmpFunc : 3;
- unsigned alphaTestEn : 1;
- }ni;
- u_int32_t ui;
-} savageRegDrawCtrl1;
-
-/* This reg exists only on Savage4. */
-typedef union
-{
- struct
- {
- unsigned dstAlphaMode : 3;
- unsigned dstMinusSrc : 1;
- unsigned srcAlphaMode : 3;
- unsigned binaryFinalAlpha : 1;
- unsigned dstAlphaModeHighBit : 1;
- unsigned srcAlphaModeHighBit : 1;
- unsigned reserved1 : 15;
- unsigned wrZafterAlphaTst : 1;
- unsigned drawUpdateEn : 1;
- unsigned zUpdateEn : 1;
- unsigned flatShadeEn : 1;
- unsigned specShadeEn : 1;
- unsigned flushPdDestWrites : 1;
- unsigned flushPdZbufWrites : 1;
- }ni;
- u_int32_t ui;
-} savageRegDrawLocalCtrl;
-
-/* This reg exists only on Savage3D. */
-typedef union
-{
- struct
- {
- unsigned ditherEn : 1;
- unsigned xyOffsetEn : 1;
- unsigned cullMode : 2;
- unsigned vertexCountReset : 1;
- unsigned flatShadeEn : 1;
- unsigned specShadeEn : 1;
- unsigned dstAlphaMode : 3;
- unsigned srcAlphaMode : 3;
- unsigned reserved1 : 1;
- unsigned alphaTestCmpFunc : 3;
- unsigned alphaTestEn : 1;
- unsigned alphaRefVal : 8;
- unsigned texBlendCtrl : 3;
- unsigned flushPdDestWrites : 1;
- unsigned flushPdZbufWrites : 1;
- /* havn't found an equivalent for Savage4. Utah-driver sets it to 0. */
- unsigned interpMode : 1;
- }ni;
- u_int32_t ui;
-} savageRegDrawCtrl;
-
-#define SAVAGETBC_DECAL_S3D 0
-#define SAVAGETBC_MODULATE_S3D 1
-#define SAVAGETBC_DECALALPHA_S3D 2
-#define SAVAGETBC_MODULATEALPHA_S3D 3
-#define SAVAGETBC_4_S3D 4
-#define SAVAGETBC_5_S3D 5
-#define SAVAGETBC_COPY_S3D 6
-#define SAVAGETBC_7_S3D 7
-
-/* This reg exists only on Savage3D. */
-typedef union
-{
- struct
- {
- unsigned scissorXStart : 11;
- unsigned reserved1 : 5;
- unsigned scissorYStart : 11;
- unsigned reserved2 : 5;
- } ni;
- u_int32_t ui;
-} savageRegScissorsStart;
-
-/* This reg exists only on Savage3D. */
-typedef union
-{
- struct
- {
- unsigned scissorXEnd : 11;
- unsigned reserved1 : 5;
- unsigned scissorYEnd : 11;
- unsigned reserved2 : 5;
- } ni;
- u_int32_t ui;
-} savageRegScissorsEnd;
-
-/********************************
- Address Registers
-**********************************/
-
-/* I havn't found a Savage3D equivalent of this reg in the Utah-driver.
- * But Tim Roberts claims that the Savage3D supports DMA vertex and
- * command buffers. */
-typedef union
-{
- struct
- {
- unsigned isSys : 1;
- unsigned isAGP : 1;
- unsigned reserved : 1;
- unsigned addr : 29; /*quad word aligned*/
- }ni;
- u_int32_t ui;
-} savageRegVertBufAddr;
-
-/* I havn't found a Savage3D equivalent of this reg in the Utah-driver.
- * But Tim Roberts claims that the Savage3D supports DMA vertex and
- * command buffers. */
-typedef union
-{
- struct
- {
- unsigned isSys : 1;
- unsigned isAGP : 1;
- unsigned reserved : 1;
- unsigned addr : 29; /*4-quad word aligned*/
- }ni;
- u_int32_t ui;
-} savageRegDMABufAddr;
-
-/********************************
- H/W Debug Registers
-**********************************/
-/* The layout of this reg is the same on Savage4 and Savage3D. */
-typedef union
-{
- struct
- {
- unsigned y01 : 1;
- unsigned y12 : 1;
- unsigned y20 : 1;
- unsigned u01 : 1;
- unsigned u12 : 1;
- unsigned u20 : 1;
- unsigned v01 : 1;
- unsigned v12 : 1;
- unsigned v20 : 1;
- unsigned cullEn : 1;
- unsigned cullOrient : 1;
- unsigned loadNewTex : 1;
- unsigned loadNewPal : 1;
- unsigned doDSetup : 1;
- unsigned reserved : 17;
- unsigned kickOff : 1;
- }ni;
- u_int32_t ui;
-} savageRegFlag;
-
-/********************************
- Z Buffer Registers -- Global
-**********************************/
-
-/* The layout of this reg differs between Savage4 and Savage3D. */
-typedef union
-{
- struct
- {
- unsigned zCmpFunc : 3;
- unsigned reserved1 : 2;
- unsigned zBufEn : 1;
- unsigned reserved2 : 1;
- unsigned zExpOffset : 8;
- unsigned reserved3 : 1;
- unsigned stencilRefVal : 8;
- unsigned autoZEnable : 1;
- unsigned frameID : 1;
- unsigned reserved4 : 4;
- unsigned floatZEn : 1;
- unsigned wToZEn : 1;
- }ni;
- u_int32_t ui;
-} savageRegZBufCtrl_s4;
-typedef union
-{
- struct {
- unsigned zCmpFunc : 3;
- unsigned drawUpdateEn : 1;
- unsigned zUpdateEn : 1;
- unsigned zBufEn : 1;
-
- /**
- * We suspect that, in conjunction with
- * \c savageRegZBufOffset::zDepthSelect, these 2 bits are actually
- * \c stencilUpdateEn and \c stencilBufEn. If not, then some of
- * the bits in \c reserved2 may fulfill that purpose.
- */
- unsigned reserved1 : 2;
-
- unsigned zExpOffset : 8;
- unsigned wrZafterAlphaTst : 1;
- unsigned reserved2 : 15;
- }ni;
- u_int32_t ui;
-} savageRegZBufCtrl_s3d;
-
-/* The layout of this reg on Savage4 and Savage3D is very similar. */
-typedef union
-{
- struct
- {
- /* In the Utah-Driver the offset is defined as 13-bit, 2k-aligned. */
- unsigned offset : 14;
- unsigned reserved : 11; /* 12-bits in Utah-driver */
- unsigned zBufWidthInTiles : 6;
-
- /**
- * 0 selects 16-bit depth buffer. On Savage4 hardware, 1 selects
- * 24-bit depth buffer (with 8-bits for stencil). Though it has never
- * been tried, we suspect that on Savage3D hardware, 1 selects 15-bit
- * depth buffer (with 1-bit for stencil).
- */
- unsigned zDepthSelect : 1;
- }ni;
- u_int32_t ui;
-} savageRegZBufOffset;
-
-/* The layout of this reg is the same on Savage4 and Savage3D. */
-typedef union
-{
- struct
- {
- unsigned rLow : 6;
- unsigned reserved1 : 2;
- unsigned rHigh : 6;
- unsigned reserved2 : 2;
- unsigned wLow : 6;
- unsigned reserved3 : 2;
- unsigned wHigh : 6;
- unsigned reserved4 : 2;
- }ni;
- u_int32_t ui;
-} savageRegZWatermarks;
-
-/********************************
- Fog Registers -- Global
-**********************************/
-/* The layout of this reg is the same on Savage4 and Savage3D. */
-typedef union
-{
- struct
- {
- unsigned fogClr : 24;
- unsigned expShift : 3;
- unsigned reserved : 1;
- unsigned fogEn : 1;
- unsigned fogMode : 1;
- unsigned fogEndShift : 2;
- }ni;
- u_int32_t ui;
-} savageRegFogCtrl;
-
-/*not in spec, but tempo for pp and driver*/
-typedef union
-{
- struct
- {
- unsigned fogDensity : 16;
- unsigned fogStart : 16;
- }ni;
- u_int32_t ui;
-} savageRegFogParam;
-
-/**************************************
- Destination Buffer Registers -- Global
-***************************************/
-
-/* The layout of this reg on Savage4 and Savage3D are very similar. */
-typedef union
-{
- struct
- {
- unsigned dstWidthInTile : 7;
- unsigned reserved : 1;
- /* In the Utah-Driver the offset is defined as 13-bit, 2k-aligned. */
- unsigned offset : 14;
- unsigned reserved1 : 7;
- /* antiAliasMode does not exist in the Utah-driver. But it includes the
- * high bit of this in the destPixFmt. However, only values 0 and 2
- * are used as dstPixFmt, so antiAliasMode is effectively always 0
- * in the Utah-driver. In other words, treat as reserved on Savage3D.*/
- unsigned antiAliasMode : 2;
- unsigned dstPixFmt : 1;
- }ni;
- u_int32_t ui;
-} savageRegDestCtrl;
-
-/* The layout of this reg on Savage4 and Savage3D are very similar. */
-typedef union
-{
- struct
- {
- unsigned destReadLow : 6;
- unsigned destReadHigh : 6;
- unsigned destWriteLow : 6;
- unsigned destWriteHigh : 6;
- unsigned texRead : 4;
- unsigned reserved4 : 2;
- /* The Utah-driver calls this pixel FIFO length:
- * 00 - 240, 01 - 180, 10 - 120, 11 - 60
- * However, it is not used in either driver. */
- unsigned destFlush : 2;
- }ni;
- u_int32_t ui;
-} savageRegDestTexWatermarks;
-
-/* Savage4/Twister/ProSavage register BCI addresses */
-#define SAVAGE_DRAWLOCALCTRL_S4 0x1e
-#define SAVAGE_TEXPALADDR_S4 0x1f
-#define SAVAGE_TEXCTRL0_S4 0x20
-#define SAVAGE_TEXCTRL1_S4 0x21
-#define SAVAGE_TEXADDR0_S4 0x22
-#define SAVAGE_TEXADDR1_S4 0x23
-#define SAVAGE_TEXBLEND0_S4 0x24
-#define SAVAGE_TEXBLEND1_S4 0x25
-#define SAVAGE_TEXXPRCLR_S4 0x26 /* never used */
-#define SAVAGE_TEXDESCR_S4 0x27
-#define SAVAGE_FOGTABLE_S4 0x28
-#define SAVAGE_FOGCTRL_S4 0x30
-#define SAVAGE_STENCILCTRL_S4 0x31
-#define SAVAGE_ZBUFCTRL_S4 0x32
-#define SAVAGE_ZBUFOFF_S4 0x33
-#define SAVAGE_DESTCTRL_S4 0x34
-#define SAVAGE_DRAWCTRLGLOBAL0_S4 0x35
-#define SAVAGE_DRAWCTRLGLOBAL1_S4 0x36
-#define SAVAGE_ZWATERMARK_S4 0x37
-#define SAVAGE_DESTTEXRWWATERMARK_S4 0x38
-#define SAVAGE_TEXBLENDCOLOR_S4 0x39
-/* Savage3D/MX/IC register BCI addresses */
-#define SAVAGE_TEXPALADDR_S3D 0x18
-#define SAVAGE_TEXXPRCLR_S3D 0x19 /* never used */
-#define SAVAGE_TEXADDR_S3D 0x1A
-#define SAVAGE_TEXDESCR_S3D 0x1B
-#define SAVAGE_TEXCTRL_S3D 0x1C
-#define SAVAGE_FOGTABLE_S3D 0x20
-#define SAVAGE_FOGCTRL_S3D 0x30
-#define SAVAGE_DRAWCTRL_S3D 0x31
-#define SAVAGE_ZBUFCTRL_S3D 0x32
-#define SAVAGE_ZBUFOFF_S3D 0x33
-#define SAVAGE_DESTCTRL_S3D 0x34
-#define SAVAGE_SCSTART_S3D 0x35
-#define SAVAGE_SCEND_S3D 0x36
-#define SAVAGE_ZWATERMARK_S3D 0x37
-#define SAVAGE_DESTTEXRWWATERMARK_S3D 0x38
-
-#define SAVAGE_FIRST_REG 0x18
-#define SAVAGE_NR_REGS 34
-typedef struct savage_registers_s4_t {
- u_int32_t unused1[6]; /* 0x18-0x1d */
- savageRegDrawLocalCtrl drawLocalCtrl; /* 0x1e */
- savageRegTexPalAddr texPalAddr; /* 0x1f */
- savageRegTexCtrl_s4 texCtrl[2]; /* 0x20, 0x21 */
- savageRegTexAddr texAddr[2]; /* 0x22, 0x23 */
- savageRegTexBlendCtrl texBlendCtrl[2]; /* 0x24, 0x25 */
- savageRegTexXprClr texXprClr; /* 0x26 */
- savageRegTexDescr_s4 texDescr; /* 0x27 */
- u_int8_t fogTable[32]; /* 0x28-0x2f (8dwords) */
- savageRegFogCtrl fogCtrl; /* 0x30 */
- savageRegStencilCtrl stencilCtrl; /* 0x31 */
- savageRegZBufCtrl_s4 zBufCtrl; /* 0x32 */
- savageRegZBufOffset zBufOffset; /* 0x33 */
- savageRegDestCtrl destCtrl; /* 0x34 */
- savageRegDrawCtrl0 drawCtrl0; /* 0x35 */
- savageRegDrawCtrl1 drawCtrl1; /* 0x36 */
- savageRegZWatermarks zWatermarks; /* 0x37 */
- savageRegDestTexWatermarks destTexWatermarks; /* 0x38 */
- savageRegTexBlendColor texBlendColor; /* 0x39 */
-} savageRegistersS4;
-typedef struct savage_registers_s3d_t {
- savageRegTexPalAddr texPalAddr; /* 0x18 */
- savageRegTexXprClr texXprClr; /* 0x19 */
- savageRegTexAddr texAddr; /* 0x1a */
- savageRegTexDescr_s3d texDescr; /* 0x1b */
- savageRegTexCtrl_s3d texCtrl; /* 0x1c */
- u_int32_t unused1[3]; /* 0x1d-0x1f */
- u_int8_t fogTable[64]; /* 0x20-0x2f (16dwords) */
- savageRegFogCtrl fogCtrl; /* 0x30 */
- savageRegDrawCtrl drawCtrl; /* 0x31 */
- savageRegZBufCtrl_s3d zBufCtrl; /* 0x32 */
- savageRegZBufOffset zBufOffset; /* 0x33 */
- savageRegDestCtrl destCtrl; /* 0x34 */
- savageRegScissorsStart scissorsStart; /* 0x35 */
- savageRegScissorsEnd scissorsEnd; /* 0x36 */
- savageRegZWatermarks zWatermarks; /* 0x37 */
- savageRegDestTexWatermarks destTexWatermarks; /* 0x38 */
- u_int32_t unused2; /* 0x39 */
-} savageRegistersS3D;
-typedef union savage_registers_t {
- savageRegistersS4 s4;
- savageRegistersS3D s3d;
- u_int32_t ui[SAVAGE_NR_REGS];
-} savageRegisters;
-
-
-#define DV_PF_555 (0x1<<8)
-#define DV_PF_565 (0x2<<8)
-#define DV_PF_8888 (0x4<<8)
-
-#define SAVAGEPACKCOLORA4L4(l,a) \
- ((l >> 4) | (a & 0xf0))
-
-#define SAVAGEPACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define SAVAGEPACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define SAVAGEPACKCOLOR8888(r,g,b,a) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define SAVAGEPACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_bci.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_bci.h
deleted file mode 100644
index 33cfac32c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_bci.h
+++ /dev/null
@@ -1,612 +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.
- */
-
-
-#ifndef SAVAGE_BCI_H
-#define SAVAGE_BCI_H
-/***********************
- 3D and 2D command
-************************/
-
-typedef enum {
- AMO_BurstCmdData= 0x01010000,
- AMO_3DReg= 0x01048500,
- AMO_MotionCompReg= 0x01048900,
- AMO_VideoEngUnit= 0x01048A00,
- AMO_CmdBufAddr= 0x01048c14,
- AMO_TiledSurfReg0= 0x01048C40,
- AMO_TiledSurfReg1= 0x01048C44,
- AMO_TiledSurfReg2= 0x01048C48,
- AMO_TiledSurfReg3= 0x01048C4C,
- AMO_TiledSurfReg4= 0x01048C50,
- AMO_TiledSurfReg5= 0x01048C54,
- AMO_TiledSurfReg6= 0x01048C58,
- AMO_TiledSurfReg7= 0x01048C5C,
- AMO_LPBModeReg= 0x0100FF00,
- AMO_LPBFifoSat= 0x0100FF04,
- AMO_LPBIntFlag= 0x0100FF08,
- AMO_LPBFmBufA0= 0x0100FF0C,
- AMO_LPBFmBufA1= 0x0100FF10,
- AMO_LPBRdWtAdr= 0x0100FF14,
- AMO_LPBRdWtDat= 0x0100FF18,
- AMO_LPBIOPort = 0x0100FF1C,
- AMO_LPBSerPort= 0x0100FF20,
- AMO_LPBVidInWinSz= 0x0100FF24,
- AMO_LPBVidDatOffs= 0x0100FF28,
- AMO_LPBHorScalCtrl= 0x0100FF2C,
- AMO_LPBVerDeciCtrl= 0x0100FF30,
- AMO_LPBLnStride= 0x0100FF34,
- AMO_LPBFmBufAddr2= 0x0100FF38,
- AMO_LPBVidCapVDCtrl=0x0100FF3C,
-
- AMO_LPBVidCapFdStAd=0x0100FF60,
- AMO_LPBVidCapFdMdAd=0x0100FF64,
- AMO_LPBVidCapFdBtAd=0x0100FF68,
- AMO_LPBVidCapFdSize=0x0100FF6C,
- AMO_LPBBilinDecim1= 0x0100FF70,
- AMO_LPBBilinDecim2= 0x0100FF74,
- AMO_LPBBilinDecim3= 0x0100FF78,
- AMO_LPBDspVEUHorSRR=0x0100FF7C,
- AMO_LPBDspVEUVerSRR=0x0100FF80,
- AMO_LPBDspVeuDnScDR=0x0100FF84,
- AMO_LPB_VEUERPReg= 0x0100FF88,
- AMO_LPB_VBISelReg= 0x0100FF8C,
- AMO_LPB_VBIBasAdReg=0x0100FF90,
- AMO_LPB_DatOffsReg= 0x0100FF94,
- AMO_LPB_VBIVerDcReg=0x0100FF98,
- AMO_LPB_VBICtrlReg= 0x0100FF9C,
- AMO_LPB_VIPXferCtrl=0x0100FFA0,
- AMO_LPB_FIFOWtMark= 0x0100FFA4,
- AMO_LPB_FIFOCount= 0x0100FFA8,
- AMO_LPBFdSkipPat= 0x0100FFAC,
- AMO_LPBCapVEUHorSRR=0x0100FFB0,
- AMO_LPBCapVEUVerSRR=0x0100FFB4,
- AMO_LPBCapVeuDnScDR=0x0100FFB8
-
-}AddressMapOffset;
-/*more to add*/
-
-
-typedef enum {
- CMD_DrawPrim=0x10, /*10000*/
- CMD_DrawIdxPrim=0x11, /*10001*/
- CMD_SetRegister=0x12, /*10010*/
- CMD_UpdateShadowStat=0x13 , /*10011*/
- CMD_PageFlip=0x14, /* 10100*/
- CMD_BusMasterImgXfer=0x15, /* 10101*/
- CMD_ScaledImgXfer=0x16, /* 10110*/
- CMD_Macroblock=0x17, /*10111*/
- CMD_Wait= 0x18, /*11000*/
- CMD_2D_NOP=0x08, /* 01000*/
- CMD_2D_RCT=0x09, /*01001 rectangular fill*/
- CMD_2D_SCNL=0x0a, /* 01010 scan line*/
- CMD_2D_LIN=0x0b, /*01011 line*/
- CMD_2D_SMTXT=0x0c, /*01100*/
- CMD_2D_BPTXT=0x0d, /*01101*/
- CMD_InitFlag=0x1f /*11111, for S/W initialization control*/
-}Command;
-
-
-typedef enum {
- VRR_List,
- VRR_Strip,
- VRR_Fan,
- VRR_QuadList
-}VertexReplaceRule;
-
-/***********************
- Destination
-************************/
-
-typedef enum {
- DFT_RGB565 = 0,
- DFT_XRGB8888
-}DestinationFmt;
-
-
-/*************************
- Z Buffer / Alpha test
-*************************/
-
-typedef enum {
- CF_Never,
- CF_Less,
- CF_Equal,
- CF_LessEqual,
- CF_Greater,
- CF_NotEqual,
- CF_GreaterEqual,
- CF_Always
-}ZCmpFunc; /* same for Alpha test and Stencil test compare function */
-
-typedef ZCmpFunc ACmpFunc;
-
-typedef enum {
- ZDS_16i, /* .16 fixed*/
- ZDS_32f /* 1.8.15 float*/
-}ZDepthSelect;
-
-
-/**********************************
- BCI Register Addressing Index
-***********************************/
-typedef enum {
-
- CRI_VTX0_X = 0x00,
- CRI_VTX0_Y = 0x01,
- CRI_VTX0_W = 0x02,
- CRI_VTX0_DIFFU= 0x03,
- CRI_VTX0_SPECU= 0x04,
- CRI_VTX0_U = 0x05,
- CRI_VTX0_V = 0x06,
- CRI_VTX0_U2 = 0x07,
- CRI_VTX0_V2 = 0x08,
- CRI_VTX1_X = 0x09,
- CRI_VTX1_Y = 0x0a,
- CRI_VTX1_W = 0x0b,
- CRI_VTX1_DIFFU= 0x0c,
- CRI_VTX1_SPECU= 0x0d,
- CRI_VTX1_U = 0x0e,
- CRI_VTX1_V = 0x0f,
- CRI_VTX1_U2 = 0x10,
- CRI_VTX1_V2 = 0x11,
- CRI_VTX2_X = 0x12,
- CRI_VTX2_Y = 0x13,
- CRI_VTX2_W = 0x14,
- CRI_VTX2_DIFFU= 0x15,
- CRI_VTX2_SPECU= 0x16,
- CRI_VTX2_U = 0x17,
- CRI_VTX2_V = 0x18,
- CRI_VTX2_U2 = 0x19,
- CRI_VTX2_V2 = 0x1a,
-
- CRI_ZPixelOffset = 0x1d,
- CRI_DrawCtrlLocal = 0x1e,
- CRI_TexPalAddr = 0x1f,
- CRI_TexCtrl0 = 0x20,
- CRI_TexCtrl1 = 0x21,
- CRI_TexAddr0 = 0x22,
- CRI_TexAddr1 = 0x23,
- CRI_TexBlendCtrl0 = 0x24,
- CRI_TexBlendCtrl1 = 0x25,
- CRI_TexXprClr = 0x26,
- CRI_TexDescr = 0x27,
-
- CRI_FogTable00= 0x28,
- CRI_FogTable04= 0x29,
- CRI_FogTable08= 0x2a,
- CRI_FogTable12= 0x2b,
- CRI_FogTable16= 0x2c,
- CRI_FogTable20= 0x2d,
- CRI_FogTable24= 0x2e,
- CRI_FogTable28= 0x2f,
- CRI_FogCtrl= 0x30,
- CRI_StencilCtrl= 0x31,
- CRI_ZBufCtrl= 0x32,
- CRI_ZBufOffset= 0x33,
- CRI_DstCtrl= 0x34,
- CRI_DrawCtrlGlobal0= 0x35,
- CRI_DrawCtrlGlobal1= 0x36,
- CRI_ZRW_WTMK = 0x37,
- CRI_DST_WTMK = 0x38,
- CRI_TexBlendColor= 0x39,
-
- CRI_VertBufAddr= 0x3e,
- /* new in ms1*/
- CRI_MauFrameAddr0 = 0x40,
- CRI_MauFrameAddr1 = 0x41,
- CRI_MauFrameAddr2 = 0x42,
- CRI_MauFrameAddr3 = 0x43,
- CRI_FrameDesc = 0x44,
- CRI_IDCT9bitEn = 0x45,
- CRI_MV0 = 0x46,
- CRI_MV1 = 0x47,
- CRI_MV2 = 0x48,
- CRI_MV3 = 0x49,
- CRI_MacroDescr = 0x4a, /*kickoff?*/
-
- CRI_MeuCtrl = 0x50,
- CRI_SrcYAddr = 0x51,
- CRI_DestAddr = 0x52,
- CRI_FmtrSrcDimen = 0x53,
- CRI_FmtrDestDimen = 0x54,
- CRI_SrcCbAddr = 0x55,
- CRI_SrcCrAddr = 0x56,
- CRI_SrcCrCbStride = 0x57,
-
- CRI_BCI_Power= 0x5f,
-
- CRI_PSCtrl=0xA0,
- CRI_SSClrKeyCtrl=0xA1,
- CRI_SSCtrl=0xA4,
- CRI_SSChromUpBound=0xA5,
- CRI_SSHoriScaleCtrl=0xA6,
- CRI_SSClrAdj=0xA7,
- CRI_SSBlendCtrl=0xA8,
- CRI_PSFBAddr0=0xB0,
- CRI_PSFBAddr1=0xB1,
- CRI_PSStride=0xB2,
- CRI_DB_LPB_Support=0xB3,
- CRI_SSFBAddr0=0xB4,
- CRI_SSFBAddr1=0xB5,
- CRI_SSStride=0xB6,
- CRI_SSOpaqueCtrl=0xB7,
- CRI_SSVertScaleCtrl=0xB8,
- CRI_SSVertInitValue=0xB9,
- CRI_SSSrcLineCnt=0xBA,
- CRI_FIFO_RAS_Ctrl=0xBB,
- CRI_PSWinStartCoord=0xBC,
- CRI_PSWinSize=0xBD,
- CRI_SSWinStartCoord=0xBE,
- CRI_SSWinSize=0xBF,
- CRI_PSFIFOMon0=0xC0,
- CRI_SSFIFOMon0=0xC1,
- CRI_PSFIFOMon1=0xC2,
- CRI_SSFIFOMon1=0xC3,
- CRI_PSFBSize=0xC4,
- CRI_SSFBSize=0xC5,
- CRI_SSFBAddr2=0xC6,
- /* 2D register starts at D0*/
- CRI_CurrXY=0xD0,
- CRI_DstXYorStep=0xD1 ,
- CRI_LineErr=0xD2 ,
- CRI_DrawCmd=0xD3, /*kick off for image xfer*/
- CRI_ShortStrkVecXfer=0xD4,
- CRI_BackClr=0xD5,
- CRI_ForeClr=0xD6,
- CRI_BitPlaneWtMask=0xD7,
- CRI_BitPlaneRdMask=0xD8,
- CRI_ClrCmp=0xD9 ,
- CRI_BackAndForeMix=0xDA ,
- CRI_TopLeftSciss=0xDB ,
- CRI_BotRightSciss=0xDC ,
- CRI_PixOrMultiCtrl=0xDD ,
- CRI_MultiCtrlOrRdSelct=0xDE ,
- CRI_MinorOrMajorAxisCnt=0xDF ,
- CRI_GlobalBmpDesc1=0xE0 ,
- CRI_GlobalBmpDesc2=0xE1 ,
- CRI_BurstPriBmpDesc1=0xE2 ,
- CRI_BurstPriBmpDesc2=0xE3 ,
- CRI_BurstSecBmpDesc1=0xE4 ,
- CRI_BurstSecBmpDesc2=0xE5,
- CRI_ImageDataPort=0xF8
-
-}CtrlRegIdx;
-
-/***********************
- Fog Mode
-************************/
-typedef enum
-{
- FGM_Z_FOG, /*Table*/
- FGM_V_FOG /*Vertex*/
-} FogMode;
-
-/***********************
- Texture
-************************/
-typedef enum
-{
- TAM_Wrap,
- TAM_Clamp,
- TAM_Mirror
-} TexAddressModel;
-
-typedef enum
-{
- TFT_S3TC4Bit,
- TFT_Pal8Bit565,
- TFT_Pal8Bit1555,
- TFT_ARGB8888,
- TFT_ARGB1555,
- TFT_ARGB4444,
- TFT_RGB565,
- TFT_Pal8Bit4444,
- TFT_S3TC4A4Bit, /*like S3TC4Bit but with 4 bit alpha*/
- TFT_S3TC4CA4Bit, /*like S3TC4Bit, but with 4 bit compressed alpha*/
- TFT_S3TCL4,
- TFT_S3TCA4L4,
- TFT_L8,
- TFT_A4L4,
- TFT_I8,
- TFT_A8
-} TexFmt;
-
-typedef enum
-{
- TPS_64,
- TPS_128,
- TPS_192,
- TPS_256
-} TexPaletteSize;
-
-#define MAX_MIPMAP_LOD_BIAS 255
-#define MIN_MIPMAP_LOD_BIAS -255
-
-typedef enum
-{
- TFM_Point, /*1 TPP*/
- TFM_Bilin, /*2 TPP*/
- TFM_Reserved,
- TFM_Trilin /*16 TPP*/
-} TexFilterMode;
-
-
-#define TBC_Decal 0x00850410
-#define TBC_Modul 0x00850011
-#define TBC_DecalAlpha 0x00852A04
-#define TBC_ModulAlpha 0x00110011
-#define TBC_Copy 0x00840410
-#define TBC_CopyAlpha 0x00900405
-#define TBC_NoTexMap 0x00850405
-#define TBC_Blend0 0x00810004
-#define TBC_Blend1 0x00870e02
-#define TBC_BlendAlpha0 0x00040004
-#define TBC_BlendAlpha1 TBC_Blend1
-#define TBC_BlendInt0 0x00040004
-#define TBC_BlendInt1 0x01c20e02
-#define TBC_AddAlpha 0x19910c11
-#define TBC_Add 0x18110c11
-
-#define TBC_Decal1 0x00870410
-#define TBC_Modul1 0x00870013
-#define TBC_DecalAlpha1 0x00832A00
-#define TBC_ModulAlpha1 0x00130013
-#define TBC_NoTexMap1 0x00870407
-#define TBC_Copy1 0x00870400
-#define TBC_CopyAlpha1 0x00900400
-#define TBC_AddAlpha1 0x19930c13
-#define TBC_Add1 0x18130c13
-
-/*
- * derived from TexBlendCtrl
- */
-
-typedef enum
-{
- TBC_UseSrc,
- TBC_UseTex,
- TBC_TexTimesSrc,
- TBC_BlendTexWithSrc
-} TexBlendCtrlMode;
-
-/***********************
- Draw Control
-************************/
-typedef enum
-{
- BCM_Reserved,
- BCM_None,
- BCM_CW,
- BCM_CCW
-} BackfaceCullingMode;
-
-typedef enum
-{
- SAM_Zero,
- SAM_One,
- SAM_DstClr,
- SAM_1DstClr,
- SAM_SrcAlpha,
- SAM_1SrcAlpha,
- SAM_DstAlpha,
- SAM_1DstAlpha
-} SrcAlphaBlendMode;
-
-/* -1 from state*/
-typedef enum
-{
- DAM_Zero,
- DAM_One,
- DAM_SrcClr,
- DAM_1SrcClr,
- DAM_SrcAlpha,
- DAM_1SrcAlpha,
- DAM_DstAlpha,
- DAM_1DstAlpha
-} DstAlphaBlendMode;
-
-/*
- * stencil control
- */
-
-typedef enum
-{
- STENCIL_Keep,
- STENCIL_Zero,
- STENCIL_Equal,
- STENCIL_IncClamp,
- STENCIL_DecClamp,
- STENCIL_Invert,
- STENCIL_Inc,
- STENCIL_Dec
-} StencilOp;
-
-/***************************************************************
-*** Bitfield Structures for Programming Interface **************
-***************************************************************/
-
-/**************************
- Command Header Entry
-**************************/
-
-typedef struct { /*for DrawIndexPrimitive command, vert0Idx is meaningful.*/
- unsigned int vert0Idx:16;
- unsigned int vertCnt:8;
- unsigned int cont:1;
- unsigned int type:2; /*00=list, 01=strip, 10=fan, 11=reserved*/
- unsigned int cmd:5;
-}Reg_DrawIndexPrimitive;
-
-typedef struct { /*for DrawIndexPrimitive command, vert0Idx is meaningful.*/
- unsigned int noW:1;
- unsigned int noCd:1;
- unsigned int noCs:1;
- unsigned int noU:1;
- unsigned int noV:1;
- unsigned int noU2:1;
- unsigned int noV2:1;
-
- unsigned int reserved:9;
- unsigned int vertCnt:8;
- unsigned int cont:1;
- unsigned int type:2; /* 00=list, 01=strip, 10=fan, 11=reserved*/
- unsigned int cmd:5;
-}Reg_DrawPrimitive;
-
-
-typedef struct {
- unsigned int startRegIdx:8;
- unsigned int reserved:8;
- unsigned int regCnt:8;
- unsigned int resvered1:1;
- unsigned int lowEn:1;
- unsigned int highEn:1;
- unsigned int cmd:5;
-}Reg_SetRegister;
-
-typedef struct {
- unsigned int reserved1:22;
- unsigned int isPrimary:1;
- unsigned int MIU_SYNC:1;
- unsigned int reserved2:3;
- unsigned int cmd:5;
-}Reg_QueuedPageFlip;
-
-typedef struct {
- unsigned int reserved1:22;
- unsigned int DIR:1;
- unsigned int CTG:1; /*set to 0*/
- unsigned int BPP:1;
- unsigned int reserved2:1;
- unsigned int cmd:5;
-}Reg_MasterImgXfer;
-
-typedef struct {
- unsigned int PD:4; /*PM=mono, PS=descriptor specified*/
- unsigned int PT:1;
- unsigned int SD:4;
- unsigned int ST:1;
- unsigned int DD:3;
- unsigned int DC:2; /*DC=destination clip*/
- unsigned int CS:1; /*cs=color specified*/
- unsigned int MIX3:8;
- unsigned int XP:1;
- unsigned int YP:1;
- unsigned int LP:1;
- unsigned int cmd:5;
-}Reg_2D;
-
-typedef struct {
- unsigned int CodedBlkPattern:6;
- unsigned int DCT_Type:1;
- unsigned int MB_Type:2;
- unsigned int MotionType:2;
- unsigned int MB_Row:6;
- unsigned int MB_Column:6;
- unsigned int mv3:1;
- unsigned int mv2:1;
- unsigned int mv1:1;
- unsigned int mv0:1;
- unsigned int cmd:5;
-}Reg_MacroBlock;
-
-typedef struct {
- unsigned int scanLnCnt:11;
- unsigned int clkCnt:5;
- unsigned int e3d:1;
- unsigned int e2d:1;
- unsigned int mau:1;
- unsigned int veu:1;
- unsigned int meuMit:1;
- unsigned int meuSit:1;
- unsigned int meuVx:1;
- unsigned int meuMau:1;
- unsigned int pageFlip:1;
- unsigned int scanLn:1;
- unsigned int clk:1;
- unsigned int cmd:5;
-}Reg_Wait;
-
-typedef struct{
- unsigned int reserved:27;
- unsigned int cmd:5;
-}Reg_ScaledImgXfer ;
-
-typedef struct{
- unsigned int eventTag:16;
- unsigned int reserved2:6;
- unsigned int ET:1;
- unsigned int INT:1;
- unsigned int reserved1:3;
- unsigned int cmd:5;
-}Reg_UpdtShadowStat;
-
-typedef union {
- Reg_DrawPrimitive vert;
- Reg_DrawIndexPrimitive vertIdx;
- Reg_SetRegister set;
- Reg_QueuedPageFlip pageFlip;
- Reg_MasterImgXfer masterImgXfer;
- Reg_ScaledImgXfer scaledImgXfer;
- Reg_UpdtShadowStat updtShadow;
- Reg_MacroBlock macroBlk;
- Reg_2D cmd2D;
- Reg_Wait wait;
-}CmdHeaderUnion;
-
-
-/*frank 2001/11/14 add BCI write macros*/
-/* Registers not used in the X server
- */
-
-#define SAVAGE_NOP_ID 0x2094
-#define SAVAGE_NOP_ID_MASK ((1<<22)-1)
-
-
-/* 3D instructions
- */
-
-/* Draw Primitive Control */
-
-
-#define SAVAGE_HW_NO_Z (1<<0)
-#define SAVAGE_HW_NO_W (1<<1)
-#define SAVAGE_HW_NO_CD (1<<2)
-#define SAVAGE_HW_NO_CS (1<<3)
-#define SAVAGE_HW_NO_U0 (1<<4)
-#define SAVAGE_HW_NO_V0 (1<<5)
-#define SAVAGE_HW_NO_UV0 ((1<<4) | (1<<5))
-#define SAVAGE_HW_NO_U1 (1<<6)
-#define SAVAGE_HW_NO_V1 (1<<7)
-#define SAVAGE_HW_NO_UV1 ((1<<6) | (1<<7))
-#define SAVAGE_HW_SKIPFLAGS 0x000000ff
-
-#endif
-
-
-
-
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_init.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_init.h
deleted file mode 100644
index 0dec397b7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_init.h
+++ /dev/null
@@ -1,168 +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.
- */
-
-
-#ifndef _SAVAGE_INIT_H_
-#define _SAVAGE_INIT_H_
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "mtypes.h"
-
-#include "xmlconfig.h"
-
-typedef struct {
- drm_handle_t handle;
- drmSize size;
- char *map;
-} savageRegion, *savageRegionPtr;
-
-typedef struct {
- int chipset;
- int width;
- int height;
- int mem;
-
- int cpp; /* for front and back buffers */
- int zpp;
-
- int agpMode;
-
- unsigned int bufferSize;
-
-#if 0
- int bitsPerPixel;
-#endif
- unsigned int frontFormat;
- unsigned int frontOffset;
- unsigned int backOffset;
- unsigned int depthOffset;
-
- unsigned int aperturePitch;
-
- unsigned int textureOffset[SAVAGE_NR_TEX_HEAPS];
- unsigned int textureSize[SAVAGE_NR_TEX_HEAPS];
- unsigned int logTextureGranularity[SAVAGE_NR_TEX_HEAPS];
- drmAddress texVirtual[SAVAGE_NR_TEX_HEAPS];
-
- __DRIscreenPrivate *driScrnPriv;
-
- savageRegion aperture;
- savageRegion agpTextures;
-
- drmBufMapPtr bufs;
-
- unsigned int sarea_priv_offset;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} savageScreenPrivate;
-
-
-/**
- * savageRenderbuffer, derived from Mesa's gl_renderbuffer
- */
-typedef struct {
- struct gl_renderbuffer Base;
- /* XXX per-window info should go here */
- int foo, bar;
-} savageRenderbuffer;
-
-
-#include "savagecontext.h"
-
-extern void savageGetLock( savageContextPtr imesa, GLuint flags );
-extern void savageXMesaSetBackClipRects( savageContextPtr imesa );
-extern void savageXMesaSetFrontClipRects( savageContextPtr imesa );
-
-
-#define GET_DISPATCH_AGE( imesa ) imesa->sarea->last_dispatch
-#define GET_ENQUEUE_AGE( imesa ) imesa->sarea->last_enqueue
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( imesa ) \
- do { \
- char __ret=0; \
- DRM_CAS(imesa->driHwLock, imesa->hHWContext, \
- (DRM_LOCK_HELD|imesa->hHWContext), __ret); \
- if (__ret) \
- savageGetLock( imesa, 0 ); \
- } while (0)
-
-
-
-/* Unlock the hardware using the global current context
- */
-#define UNLOCK_HARDWARE(imesa) \
- DRM_UNLOCK(imesa->driFd, imesa->driHwLock, imesa->hHWContext);
-
-
-/* This is the wrong way to do it, I'm sure. Otherwise the drm
- * bitches that I've already got the heavyweight lock. At worst,
- * this is 3 ioctls. The best solution probably only gets me down
- * to 2 ioctls in the worst case.
- */
-#define LOCK_HARDWARE_QUIESCENT( imesa ) do { \
- LOCK_HARDWARE( imesa ); \
- savageRegetLockQuiescent( imesa ); \
-} while(0)
-
-/* The following definitions are copied from savage_regs.h in the XFree86
- * driver. They are unlikely to change. If they do we need to keep them in
- * sync. */
-
-#define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
-
-#define S3_SAVAGE4_SERIES(chip) ((chip==S3_SAVAGE4) \
- || (chip==S3_PROSAVAGE) \
- || (chip==S3_TWISTER) \
- || (chip==S3_PROSAVAGEDDR))
-
-#define S3_SAVAGE_MOBILE_SERIES(chip) ((chip==S3_SAVAGE_MX) || (chip==S3_SUPERSAVAGE))
-
-#define S3_SAVAGE_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000))
-
-#define S3_MOBILE_TWISTER_SERIES(chip) ((chip==S3_TWISTER) \
- ||(chip==S3_PROSAVAGEDDR))
-
-/* Chip tags. These are used to group the adapters into
- * related families.
- */
-
-enum S3CHIPTAGS {
- S3_UNKNOWN = 0,
- S3_SAVAGE3D,
- S3_SAVAGE_MX,
- S3_SAVAGE4,
- S3_PROSAVAGE,
- S3_TWISTER,
- S3_PROSAVAGEDDR,
- S3_SUPERSAVAGE,
- S3_SAVAGE2000,
- S3_LAST
-};
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_xmesa.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_xmesa.c
deleted file mode 100644
index 0c2fc4767..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ /dev/null
@@ -1,1056 +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 <X11/Xlibint.h>
-#include <stdio.h>
-
-#include "savagecontext.h"
-#include "context.h"
-#include "matrix.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "simple_list.h"
-
-#include "utils.h"
-
-#include "extensions.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "savagedd.h"
-#include "savagestate.h"
-#include "savagetex.h"
-#include "savagespan.h"
-#include "savagetris.h"
-#include "savageioctl.h"
-#include "savage_bci.h"
-
-#include "savage_dri.h"
-
-#include "texmem.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_texture_compression
-#include "extension_helper.h"
-
-#include "xmlpool.h"
-
-/* Driver-specific options
- */
-#define SAVAGE_ENABLE_VDMA(def) \
-DRI_CONF_OPT_BEGIN(enable_vdma,bool,def) \
- DRI_CONF_DESC(en,"Use DMA for vertex transfers") \
- DRI_CONF_DESC(de,"Benutze DMA für Vertextransfers") \
-DRI_CONF_OPT_END
-#define SAVAGE_ENABLE_FASTPATH(def) \
-DRI_CONF_OPT_BEGIN(enable_fastpath,bool,def) \
- DRI_CONF_DESC(en,"Use fast path for unclipped primitives") \
- DRI_CONF_DESC(de,"Schneller Codepfad für ungeschnittene Polygone") \
-DRI_CONF_OPT_END
-#define SAVAGE_SYNC_FRAMES(def) \
-DRI_CONF_OPT_BEGIN(sync_frames,bool,def) \
- DRI_CONF_DESC(en,"Synchronize with graphics hardware after each frame") \
- DRI_CONF_DESC(de,"Synchronisiere nach jedem Frame mit Grafikhardware") \
-DRI_CONF_OPT_END
-
-/* Configuration
- */
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
- DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
- DRI_CONF_FLOAT_DEPTH(false)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_PERFORMANCE
- SAVAGE_ENABLE_VDMA(true)
- SAVAGE_ENABLE_FASTPATH(true)
- SAVAGE_SYNC_FRAMES(false)
- DRI_CONF_MAX_TEXTURE_UNITS(2,1,2)
- DRI_CONF_TEXTURE_HEAPS(DRI_CONF_TEXTURE_HEAPS_ALL)
- DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 10;
-
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "api", DEBUG_VERBOSE_API },
- { "tex", DEBUG_VERBOSE_TEX },
- { "verb", DEBUG_VERBOSE_MSG },
- { "dma", DEBUG_DMA },
- { "state", DEBUG_STATE },
- { NULL, 0 }
-};
-#ifndef SAVAGE_DEBUG
-int SAVAGE_DEBUG = 0;
-#endif
-
-
-/*For time caculating test*/
-#if defined(DEBUG_TIME) && DEBUG_TIME
-struct timeval tv_s,tv_f;
-unsigned long time_sum=0;
-struct timeval tv_s1,tv_f1;
-#endif
-
-static const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { NULL, NULL }
-};
-
-static const struct dri_extension s4_extensions[] =
-{
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { NULL, NULL }
-};
-
-extern struct tnl_pipeline_stage _savage_texnorm_stage;
-extern struct tnl_pipeline_stage _savage_render_stage;
-
-static const struct tnl_pipeline_stage *savage_pipeline[] = {
-
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_savage_texnorm_stage,
- &_savage_render_stage,
- &_tnl_render_stage,
- 0,
-};
-
-
-/* this is first function called in dirver*/
-
-static GLboolean
-savageInitDriver(__DRIscreenPrivate *sPriv)
-{
- savageScreenPrivate *savageScreen;
- SAVAGEDRIPtr gDRIPriv = (SAVAGEDRIPtr)sPriv->pDevPriv;
-
- if (sPriv->devPrivSize != sizeof(SAVAGEDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(SAVAGEDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- savageScreen = (savageScreenPrivate *)Xmalloc(sizeof(savageScreenPrivate));
- if (!savageScreen)
- return GL_FALSE;
-
- savageScreen->driScrnPriv = sPriv;
- sPriv->private = (void *)savageScreen;
-
- savageScreen->chipset=gDRIPriv->chipset;
- savageScreen->width=gDRIPriv->width;
- savageScreen->height=gDRIPriv->height;
- savageScreen->mem=gDRIPriv->mem;
- savageScreen->cpp=gDRIPriv->cpp;
- savageScreen->zpp=gDRIPriv->zpp;
-
- savageScreen->agpMode=gDRIPriv->agpMode;
-
- savageScreen->bufferSize=gDRIPriv->bufferSize;
-
- if (gDRIPriv->cpp == 4)
- savageScreen->frontFormat = DV_PF_8888;
- else
- savageScreen->frontFormat = DV_PF_565;
- savageScreen->frontOffset=gDRIPriv->frontOffset;
- savageScreen->backOffset = gDRIPriv->backOffset;
- savageScreen->depthOffset=gDRIPriv->depthOffset;
-
- savageScreen->textureOffset[SAVAGE_CARD_HEAP] =
- gDRIPriv->textureOffset;
- savageScreen->textureSize[SAVAGE_CARD_HEAP] =
- gDRIPriv->textureSize;
- savageScreen->logTextureGranularity[SAVAGE_CARD_HEAP] =
- gDRIPriv->logTextureGranularity;
-
- savageScreen->textureOffset[SAVAGE_AGP_HEAP] =
- gDRIPriv->agpTextureHandle;
- savageScreen->textureSize[SAVAGE_AGP_HEAP] =
- gDRIPriv->agpTextureSize;
- savageScreen->logTextureGranularity[SAVAGE_AGP_HEAP] =
- gDRIPriv->logAgpTextureGranularity;
-
- savageScreen->agpTextures.handle = gDRIPriv->agpTextureHandle;
- savageScreen->agpTextures.size = gDRIPriv->agpTextureSize;
- if (gDRIPriv->agpTextureSize) {
- if (drmMap(sPriv->fd,
- savageScreen->agpTextures.handle,
- savageScreen->agpTextures.size,
- (drmAddress *)&(savageScreen->agpTextures.map)) != 0) {
- Xfree(savageScreen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
- } else
- savageScreen->agpTextures.map = NULL;
-
- savageScreen->texVirtual[SAVAGE_CARD_HEAP] =
- (drmAddress)(((GLubyte *)sPriv->pFB)+gDRIPriv->textureOffset);
- savageScreen->texVirtual[SAVAGE_AGP_HEAP] =
- (drmAddress)(savageScreen->agpTextures.map);
-
- savageScreen->aperture.handle = gDRIPriv->apertureHandle;
- savageScreen->aperture.size = gDRIPriv->apertureSize;
- savageScreen->aperturePitch = gDRIPriv->aperturePitch;
- if (drmMap(sPriv->fd,
- savageScreen->aperture.handle,
- savageScreen->aperture.size,
- (drmAddress *)&savageScreen->aperture.map) != 0)
- {
- Xfree(savageScreen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
- savageScreen->bufs = drmMapBufs(sPriv->fd);
-
- savageScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&savageScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
-#if 0
- savageDDFastPathInit();
- savageDDTrifuncInit();
- savageDDSetupInit();
-#endif
- return GL_TRUE;
-}
-
-/* Accessed by dlsym from dri_mesa_init.c
- */
-static void
-savageDestroyScreen(__DRIscreenPrivate *sPriv)
-{
- savageScreenPrivate *savageScreen = (savageScreenPrivate *)sPriv->private;
-
- if (savageScreen->bufs)
- drmUnmapBufs(savageScreen->bufs);
-
- /* free all option information */
- driDestroyOptionInfo (&savageScreen->optionCache);
-
- Xfree(savageScreen);
- sPriv->private = NULL;
-}
-
-#if 0
-GLvisual *XMesaCreateVisual(Display *dpy,
- __DRIscreenPrivate *driScrnPriv,
- const XVisualInfo *visinfo,
- const __GLXvisualConfig *config)
-{
- /* Drivers may change the args to _mesa_create_visual() in order to
- * setup special visuals.
- */
- return _mesa_create_visual( config->rgba,
- config->doubleBuffer,
- config->stereo,
- _mesa_bitcount(visinfo->red_mask),
- _mesa_bitcount(visinfo->green_mask),
- _mesa_bitcount(visinfo->blue_mask),
- config->alphaSize,
- 0, /* index bits */
- config->depthSize,
- config->stencilSize,
- config->accumRedSize,
- config->accumGreenSize,
- config->accumBlueSize,
- config->accumAlphaSize,
- 0 /* num samples */ );
-}
-#endif
-
-
-static GLboolean
-savageCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- savageContextPtr imesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- struct dd_function_table functions;
- savageScreenPrivate *savageScreen = (savageScreenPrivate *)sPriv->private;
- drm_savage_sarea_t *saPriv=(drm_savage_sarea_t *)(((char*)sPriv->pSAREA)+
- savageScreen->sarea_priv_offset);
- int textureSize[SAVAGE_NR_TEX_HEAPS];
- int i;
- imesa = (savageContextPtr)Xcalloc(sizeof(savageContext), 1);
- if (!imesa) {
- return GL_FALSE;
- }
-
- /* Init default driver functions then plug in savage-specific texture
- * functions that are needed as early as during context creation. */
- _mesa_init_driver_functions( &functions );
- savageDDInitTextureFuncs( &functions );
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((savageContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- ctx = _mesa_create_context(mesaVis, shareCtx, &functions, imesa);
- if (!ctx) {
- Xfree(imesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = imesa;
-
- imesa->cmdBuf.size = SAVAGE_CMDBUF_SIZE;
- imesa->cmdBuf.base = imesa->cmdBuf.write =
- malloc(SAVAGE_CMDBUF_SIZE * sizeof(drm_savage_cmd_header_t));
- if (!imesa->cmdBuf.base)
- return GL_FALSE;
-
- /* Parse configuration files */
- driParseConfigFiles (&imesa->optionCache, &savageScreen->optionCache,
- sPriv->myNum, "savage");
-
- imesa->float_depth = driQueryOptionb(&imesa->optionCache, "float_depth") &&
- savageScreen->chipset >= S3_SAVAGE4;
- imesa->no_rast = driQueryOptionb(&imesa->optionCache, "no_rast");
-
-#if 0
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 3.0;
- ctx->Const.MaxLineWidthAA = 3.0;
- ctx->Const.LineWidthGranularity = 1.0;
-#endif
-
- /* Dri stuff
- */
- imesa->hHWContext = driContextPriv->hHWContext;
- imesa->driFd = sPriv->fd;
- imesa->driHwLock = &sPriv->pSAREA->lock;
-
- imesa->savageScreen = savageScreen;
- imesa->driScreen = sPriv;
- imesa->sarea = saPriv;
- imesa->glBuffer = NULL;
-
- /* DMA buffer */
-
- for(i=0;i<5;i++)
- {
- imesa->apertureBase[i] = (GLubyte *)savageScreen->aperture.map +
- 0x01000000 * i;
- }
-
- imesa->aperturePitch = savageScreen->aperturePitch;
-
- /* change texHeap initialize to support two kind of texture heap*/
- /* here is some parts of initialization, others in InitDriver() */
-
- (void) memset( imesa->textureHeaps, 0, sizeof( imesa->textureHeaps ) );
- make_empty_list( & imesa->swapped );
-
- textureSize[SAVAGE_CARD_HEAP] = savageScreen->textureSize[SAVAGE_CARD_HEAP];
- textureSize[SAVAGE_AGP_HEAP] = savageScreen->textureSize[SAVAGE_AGP_HEAP];
- imesa->lastTexHeap = savageScreen->texVirtual[SAVAGE_AGP_HEAP] ? 2 : 1;
- switch(driQueryOptioni (&imesa->optionCache, "texture_heaps")) {
- case DRI_CONF_TEXTURE_HEAPS_CARD: /* only use card memory, if available */
- if (textureSize[SAVAGE_CARD_HEAP])
- imesa->lastTexHeap = 1;
- break;
- case DRI_CONF_TEXTURE_HEAPS_GART: /* only use gart memory, if available */
- if (imesa->lastTexHeap == 2 && textureSize[SAVAGE_AGP_HEAP])
- textureSize[SAVAGE_CARD_HEAP] = 0;
- break;
- /*default: Nothing to do, use all available memory. */
- }
-
- for (i = 0; i < imesa->lastTexHeap; i++) {
- imesa->textureHeaps[i] = driCreateTextureHeap(
- i, imesa,
- textureSize[i],
- 11, /* 2^11 = 2k alignment */
- SAVAGE_NR_TEX_REGIONS,
- (drmTextureRegionPtr)imesa->sarea->texList[i],
- &imesa->sarea->texAge[i],
- &imesa->swapped,
- sizeof( savageTexObj ),
- (destroy_texture_object_t *) savageDestroyTexObj );
- /* If textureSize[i] == 0 textureHeaps[i] is NULL. This can happen
- * if there is not enough card memory for a card texture heap. */
- if (imesa->textureHeaps[i])
- driSetTextureSwapCounterLocation( imesa->textureHeaps[i],
- & imesa->c_textureSwaps );
- }
- imesa->texture_depth = driQueryOptioni (&imesa->optionCache,
- "texture_depth");
- if (imesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- imesa->texture_depth = ( savageScreen->cpp == 4 ) ?
- DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
-
- if (savageScreen->chipset >= S3_SAVAGE4)
- ctx->Const.MaxTextureUnits = 2;
- else
- ctx->Const.MaxTextureUnits = 1;
- if (driQueryOptioni(&imesa->optionCache, "texture_units") <
- ctx->Const.MaxTextureUnits)
- ctx->Const.MaxTextureUnits =
- driQueryOptioni(&imesa->optionCache, "texture_units");
- ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
- ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
-
- driCalculateMaxTextureLevels( imesa->textureHeaps,
- imesa->lastTexHeap,
- & ctx->Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 0, /* 3D textures unsupported. */
- 0, /* cube textures unsupported. */
- 0, /* texture rectangles unsupported. */
- 12,
- GL_FALSE );
- if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/
- __driUtilMessage("Not enough texture memory. "
- "Falling back to indirect rendering.");
- Xfree(imesa);
- return GL_FALSE;
- }
-
- imesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
- imesa->depth_scale = (imesa->savageScreen->zpp == 2) ?
- (1.0F/0xffff):(1.0F/0xffffff);
-
- imesa->bufferSize = savageScreen->bufferSize;
- imesa->dmaVtxBuf.total = 0;
- imesa->dmaVtxBuf.used = 0;
- imesa->dmaVtxBuf.flushed = 0;
-
- imesa->clientVtxBuf.total = imesa->bufferSize / 4;
- imesa->clientVtxBuf.used = 0;
- imesa->clientVtxBuf.flushed = 0;
- imesa->clientVtxBuf.buf = (u_int32_t *)malloc(imesa->bufferSize);
-
- imesa->vtxBuf = &imesa->clientVtxBuf;
-
- imesa->firstElt = -1;
-
- /* Uninitialized vertex format. Force setting the vertex state in
- * savageRenderStart.
- */
- imesa->vertex_size = 0;
-
- /* Utah stuff
- */
- imesa->new_state = ~0;
- imesa->new_gl_state = ~0;
- imesa->RenderIndex = ~0;
- imesa->dirty = ~0;
- imesa->lostContext = GL_TRUE;
- imesa->CurrentTexObj[0] = 0;
- imesa->CurrentTexObj[1] = 0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
-
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, savage_pipeline );
-
- imesa->enable_fastpath = driQueryOptionb(&imesa->optionCache,
- "enable_fastpath");
- /* DRM versions before 2.1.3 would only render triangle lists. ELTS
- * support was added in 2.2.0. */
- if (imesa->enable_fastpath && sPriv->drmMinor < 2) {
- fprintf (stderr,
- "*** Disabling fast path because your DRM version is buggy "
- "or doesn't\n*** support ELTS. You need at least Savage DRM "
- "version 2.2.\n");
- imesa->enable_fastpath = GL_FALSE;
- }
-
- if (!savageScreen->bufs || savageScreen->chipset == S3_SUPERSAVAGE)
- imesa->enable_vdma = GL_FALSE;
- else
- imesa->enable_vdma = driQueryOptionb(&imesa->optionCache, "enable_vdma");
-
- imesa->sync_frames = driQueryOptionb(&imesa->optionCache, "sync_frames");
-
- /* Configure swrast to match hardware characteristics:
- */
- _tnl_allow_pixel_fog( ctx, GL_FALSE );
- _tnl_allow_vertex_fog( ctx, GL_TRUE );
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- ctx->DriverCtx = (void *) imesa;
- imesa->glCtx = ctx;
-
-#ifndef SAVAGE_DEBUG
- SAVAGE_DEBUG = driParseDebugString( getenv( "SAVAGE_DEBUG" ),
- debug_control );
-#endif
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- if (savageScreen->chipset >= S3_SAVAGE4)
- driInitExtensions( ctx, s4_extensions, GL_FALSE );
- if (ctx->Mesa_DXTn ||
- driQueryOptionb (&imesa->optionCache, "force_s3tc_enable")) {
- _mesa_enable_extension( ctx, "GL_S3_s3tc" );
- if (savageScreen->chipset >= S3_SAVAGE4)
- /* This extension needs DXT3 and DTX5 support in hardware.
- * Not available on Savage3D/MX/IX. */
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- }
-
- savageDDInitStateFuncs( ctx );
- savageDDInitSpanFuncs( ctx );
- savageDDInitDriverFuncs( ctx );
- savageDDInitIoctlFuncs( ctx );
- savageInitTriFuncs( ctx );
-
- savageDDInitState( imesa );
-
- driContextPriv->driverPrivate = (void *) imesa;
-
- return GL_TRUE;
-}
-
-static void
-savageDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate;
- GLuint i;
-
- assert (imesa); /* should never be NULL */
- if (imesa) {
- savageFlushVertices(imesa);
- savageReleaseIndexedVerts(imesa);
- savageFlushCmdBuf(imesa, GL_TRUE); /* release DMA buffer */
- WAIT_IDLE_EMPTY(imesa);
-
- for (i = 0; i < imesa->lastTexHeap; i++)
- driDestroyTextureHeap(imesa->textureHeaps[i]);
-
- free(imesa->cmdBuf.base);
- free(imesa->clientVtxBuf.buf);
-
- _swsetup_DestroyContext(imesa->glCtx );
- _tnl_DestroyContext( imesa->glCtx );
- _ac_DestroyContext( imesa->glCtx );
- _swrast_DestroyContext( imesa->glCtx );
-
- /* free the Mesa context */
- imesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(imesa->glCtx);
-
- /* no longer use vertex_dma_buf*/
- Xfree(imesa);
- }
-}
-
-
-static GLboolean
-savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap)
-{
- savageScreenPrivate *screen = (savageScreenPrivate *) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
- GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24;
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
- /*
- * XXX: this value needs to be set according to the config file
- * setting. But we don't get that until we create a rendering
- * context!!!!
- */
- GLboolean float_depth = GL_FALSE;
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->aperturePitch);
- savageSetSpanFunctions(frontRb, mesaVis, float_depth);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->aperturePitch);
- savageSetSpanFunctions(backRb, mesaVis, float_depth);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->aperturePitch);
- savageSetSpanFunctions(depthRb, mesaVis, float_depth);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->aperturePitch);
- savageSetSpanFunctions(depthRb, mesaVis, float_depth);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->aperturePitch);
- savageSetSpanFunctions(stencilRb, mesaVis, float_depth);
- _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;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-static void
-savageDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-#if 0
-void XMesaSwapBuffers(__DRIdrawablePrivate *driDrawPriv)
-{
- /* XXX should do swap according to the buffer, not the context! */
- savageContextPtr imesa = savageCtx;
-
- FLUSH_VB( imesa->glCtx, "swap buffers" );
- savageSwapBuffers(imesa);
-}
-#endif
-
-void savageXMesaSetFrontClipRects( savageContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
-
- savageCalcViewport( imesa->glCtx );
-}
-
-
-void savageXMesaSetBackClipRects( savageContextPtr imesa )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- if (dPriv->numBackClipRects == 0)
- {
-
-
- imesa->numClipRects = dPriv->numClipRects;
- imesa->pClipRects = dPriv->pClipRects;
- imesa->drawX = dPriv->x;
- imesa->drawY = dPriv->y;
- } else {
-
-
- imesa->numClipRects = dPriv->numBackClipRects;
- imesa->pClipRects = dPriv->pBackClipRects;
- imesa->drawX = dPriv->backX;
- imesa->drawY = dPriv->backY;
- }
-
- savageCalcViewport( imesa->glCtx );
-}
-
-
-static void savageXMesaWindowMoved( savageContextPtr imesa )
-{
- if (0)
- fprintf(stderr, "savageXMesaWindowMoved\n\n");
-
- switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- savageXMesaSetFrontClipRects( imesa );
- break;
- case BUFFER_BIT_BACK_LEFT:
- savageXMesaSetBackClipRects( imesa );
- break;
- default:
- break;
- }
-}
-
-
-static GLboolean
-savageUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- savageContextPtr savage = (savageContextPtr) driContextPriv->driverPrivate;
- if (savage)
- savage->dirty = ~0;
-
- return GL_TRUE;
-}
-
-#if 0
-static GLboolean
-savageOpenFullScreen(__DRIcontextPrivate *driContextPriv)
-{
-
-
-
- if (driContextPriv) {
- savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate;
- imesa->IsFullScreen = GL_TRUE;
- imesa->backup_frontOffset = imesa->savageScreen->frontOffset;
- imesa->backup_backOffset = imesa->savageScreen->backOffset;
- imesa->backup_frontBitmapDesc = imesa->savageScreen->frontBitmapDesc;
- imesa->savageScreen->frontBitmapDesc = imesa->savageScreen->backBitmapDesc;
- imesa->toggle = TARGET_BACK;
- }
-
- return GL_TRUE;
-}
-
-static GLboolean
-savageCloseFullScreen(__DRIcontextPrivate *driContextPriv)
-{
-
- if (driContextPriv) {
- savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate;
- WAIT_IDLE_EMPTY(imesa);
- imesa->IsFullScreen = GL_FALSE;
- imesa->savageScreen->frontOffset = imesa->backup_frontOffset;
- imesa->savageScreen->backOffset = imesa->backup_backOffset;
- imesa->savageScreen->frontBitmapDesc = imesa->backup_frontBitmapDesc;
- }
- return GL_TRUE;
-}
-#endif
-
-static GLboolean
-savageMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- savageContextPtr imesa = (savageContextPtr) driContextPriv->driverPrivate;
-
- imesa->driReadable = driReadPriv;
- imesa->driDrawable = driDrawPriv;
- imesa->mesa_drawable = driDrawPriv;
- imesa->dirty = ~0;
-
- _mesa_make_current(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
-
- savageXMesaWindowMoved( imesa );
- }
- else
- {
- _mesa_make_current(NULL, NULL, NULL);
- }
- return GL_TRUE;
-}
-
-
-void savageGetLock( savageContextPtr imesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
- __DRIscreenPrivate *sPriv = imesa->driScreen;
- drm_savage_sarea_t *sarea = imesa->sarea;
- int me = imesa->hHWContext;
- int stamp = dPriv->lastStamp;
- int heap;
- unsigned int timestamp = 0;
-
-
-
- /* We know there has been contention.
- */
- drmGetLock(imesa->driFd, imesa->hHWContext, flags);
-
-
- /* Note contention for throttling hint
- */
- imesa->any_contend = 1;
-
- /* If the window moved, may need to set a new cliprect now.
- *
- * NOTE: This releases and regains the hw lock, so all state
- * checking must be done *after* this call:
- */
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
-
-
-
- /* If we lost context, need to dump all registers to hardware.
- * Note that we don't care about 2d contexts, even if they perform
- * accelerated commands, so the DRI locking in the X server is even
- * more broken than usual.
- */
- if (sarea->ctxOwner != me) {
- imesa->dirty |= (SAVAGE_UPLOAD_LOCAL |
- SAVAGE_UPLOAD_GLOBAL |
- SAVAGE_UPLOAD_FOGTBL |
- SAVAGE_UPLOAD_TEX0 |
- SAVAGE_UPLOAD_TEX1 |
- SAVAGE_UPLOAD_TEXGLOBAL);
- imesa->lostContext = GL_TRUE;
- sarea->ctxOwner = me;
- }
-
- for (heap = 0; heap < imesa->lastTexHeap; ++heap) {
- /* If a heap was changed, update its timestamp. Do this before
- * DRI_AGE_TEXTURES updates the local_age. */
- if (imesa->textureHeaps[heap] &&
- imesa->textureHeaps[heap]->global_age[0] >
- imesa->textureHeaps[heap]->local_age) {
- if (timestamp == 0)
- timestamp = savageEmitEventLocked(imesa, 0);
- imesa->textureHeaps[heap]->timestamp = timestamp;
- }
- DRI_AGE_TEXTURES( imesa->textureHeaps[heap] );
- }
-
- if (dPriv->lastStamp != stamp)
- savageXMesaWindowMoved( imesa );
-
-
-
-}
-
-
-
-static const struct __DriverAPIRec savageAPI = {
- savageInitDriver,
- savageDestroyScreen,
- savageCreateContext,
- savageDestroyContext,
- savageCreateBuffer,
- savageDestroyBuffer,
- savageSwapBuffers,
- savageMakeCurrent,
- savageUnbindContext
-};
-
-
-static __GLcontextModes *
-savageFillInModes( 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.
- *
- * FK: What about drivers that don't use page flipping? Could they
- * just expose GLX_SWAP_COPY_OML?
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
- };
-
- u_int8_t depth_bits_array[2];
- u_int8_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_BGR;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 2, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 2, 1, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "Savage",
- 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, &savageAPI);
- if ( psp != NULL ) {
- SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv;
- *driver_modes = savageFillInModes( dri_priv->cpp*8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagecontext.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagecontext.h
deleted file mode 100644
index 4c0959968..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagecontext.h
+++ /dev/null
@@ -1,331 +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.
- */
-
-
-
-#ifndef SAVAGECONTEXT_INC
-#define SAVAGECONTEXT_INC
-
-typedef struct savage_context_t savageContext;
-typedef struct savage_context_t *savageContextPtr;
-typedef struct savage_texture_object_t *savageTextureObjectPtr;
-
-#include <X11/Xlibint.h>
-#include "dri_util.h"
-#include "mtypes.h"
-#include "xf86drm.h"
-#include "drm.h"
-#include "savage_drm.h"
-#include "savage_init.h"
-#include "savage_3d_reg.h"
-#include "mm.h"
-#include "tnl/t_vertex.h"
-
-#include "texmem.h"
-
-#include "xmlconfig.h"
-
-/* Reasons to fallback on all primitives.
- */
-#define SAVAGE_FALLBACK_TEXTURE 0x1
-#define SAVAGE_FALLBACK_DRAW_BUFFER 0x2
-#define SAVAGE_FALLBACK_READ_BUFFER 0x4
-#define SAVAGE_FALLBACK_COLORMASK 0x8
-#define SAVAGE_FALLBACK_SPECULAR 0x10
-#define SAVAGE_FALLBACK_LOGICOP 0x20
-/*frank 2001/11/12 add the stencil fallbak*/
-#define SAVAGE_FALLBACK_STENCIL 0x40
-#define SAVAGE_FALLBACK_RENDERMODE 0x80
-#define SAVAGE_FALLBACK_BLEND_EQ 0x100
-#define SAVAGE_FALLBACK_NORAST 0x200
-#define SAVAGE_FALLBACK_PROJ_TEXTURE 0x400
-
-
-#define HW_CULL 1
-
-/* for savagectx.new_state - manage GL->driver state changes
- */
-#define SAVAGE_NEW_TEXTURE 0x1
-#define SAVAGE_NEW_CULL 0x2
-
-/* What needs to be changed for the current vertex dma buffer?
- * This will go away!
- */
-#define SAVAGE_UPLOAD_LOCAL 0x1 /* DrawLocalCtrl (S4) or
- DrawCtrl and ZBufCtrl (S3D) */
-#define SAVAGE_UPLOAD_TEX0 0x2 /* texture unit 0 */
-#define SAVAGE_UPLOAD_TEX1 0x4 /* texture unit 1 (S4 only) */
-#define SAVAGE_UPLOAD_FOGTBL 0x8 /* fog table */
-#define SAVAGE_UPLOAD_GLOBAL 0x10 /* most global regs */
-#define SAVAGE_UPLOAD_TEXGLOBAL 0x20 /* TexBlendColor (S4 only) */
-
-/*define the max numer of vertex in vertex buf*/
-#define SAVAGE_MAX_VERTEXS 0x10000
-
-/* Don't make it too big. We don't want to buffer up a whole frame
- * that would force the application to wait later. */
-#define SAVAGE_CMDBUF_SIZE 1024
-
-/* Use the templated vertex formats:
- */
-#define TAG(x) savage##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*savage_tri_func)( savageContextPtr, savageVertex *,
- savageVertex *, savageVertex * );
-typedef void (*savage_line_func)( savageContextPtr,
- savageVertex *, savageVertex * );
-typedef void (*savage_point_func)( savageContextPtr, savageVertex * );
-
-
-/**************************************************************
- **************** enums for chip IDs ************************
- **************************************************************/
-
-#define CHIP_S3GX3MS1NB 0x8A25
-#define CHIP_S3GX3MS1NBK 0x8A26
-#define CHIP_S3TWISTER 0x8D01
-#define CHIP_S3TWISTERK 0x8D02
-#define CHIP_S3TWISTER_P4M 0x8D04
-#define CHIP_S3PARAMOUNT128 0x8C22 /*SuperSavage 128/MX*/
-#define CHIP_S3TRISTAR128SDR 0x8C2A /*SuperSavage 128/IX*/
-#define CHIP_S3TRISTAR64SDRM7 0x8C2C /*SuperSavage/IX M7 Package*/
-#define CHIP_S3TRISTAR64SDR 0x8C2E /*SuperSavage/IX*/
-#define CHIP_S3TRISTAR64CDDR 0x8C2F /*SuperSavage/IXC DDR*/
-
-#define IS_SAVAGE(imesa) (imesa->savageScreen->deviceID == CHIP_S3GX3MS1NB || \
- imesa->savageScreen->deviceID == CHIP_S3GX3MS1NBK || \
- imesa->savageScreen->deviceID == CHIP_S3TWISTER || \
- imesa->savageScreen->deviceID == CHIP_S3TWISTERK || \
- imesa->savageScreen->deviceID == CHIP_S3TWISTER_P4M || \
- imesa->savageScreen->deviceID == CHIP_S3PARAMOUNT128 || \
- imesa->savageScreen->deviceID == CHIP_S3TRISTAR128SDR || \
- imesa->savageScreen->deviceID == CHIP_S3TRISTAR64SDRM7 || \
- imesa->savageScreen->deviceID == CHIP_S3TRISTAR64SDR || \
- imesa->savageScreen->deviceID == CHIP_S3TRISTAR64CDDR )
-
-
-struct savage_vtxbuf_t {
- GLuint total, used, flushed; /* in 32 bit units */
- GLuint idx; /* for DMA buffers */
- u_int32_t *buf;
-};
-
-struct savage_cmdbuf_t {
- GLuint size; /* size in qwords */
- drm_savage_cmd_header_t *base; /* initial state starts here */
- drm_savage_cmd_header_t *start; /* drawing/state commands start here */
- drm_savage_cmd_header_t *write; /* append stuff here */
-};
-
-struct savage_elt_t {
- GLuint n; /* number of elts currently allocated */
- drm_savage_cmd_header_t *cmd; /* the indexed drawing command */
-};
-
-
-struct savage_context_t {
- GLint refcount;
-
- GLcontext *glCtx;
-
- int lastTexHeap;
- driTexHeap *textureHeaps[SAVAGE_NR_TEX_HEAPS];
- driTextureObject swapped;
-
- driTextureObject *CurrentTexObj[2];
-
- /* Hardware state
- */
-
- savageRegisters regs, oldRegs, globalRegMask;
-
- /* Manage our own state */
- GLuint new_state;
- GLuint new_gl_state;
- GLboolean ptexHack;
-
- /* Command buffer */
- struct savage_cmdbuf_t cmdBuf;
-
- /* Elt book-keeping */
- struct savage_elt_t elts;
- GLint firstElt;
-
- /* Vertex buffers */
- struct savage_vtxbuf_t dmaVtxBuf, clientVtxBuf;
- struct savage_vtxbuf_t *vtxBuf;
-
- /* aperture base */
- GLubyte *apertureBase[5];
- GLuint aperturePitch;
- /* Manage hardware state */
- GLuint dirty;
- GLboolean lostContext;
- GLuint bTexEn1;
- /* One of the few bits of hardware state that can't be calculated
- * completely on the fly:
- */
- GLuint LcsCullMode;
- GLuint texEnvColor;
-
- /* Vertex state
- */
- GLuint vertex_size;
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
- char *verts; /* points to tnl->clipspace.vertex_buf */
-
- /* Rasterization state
- */
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLuint RenderIndex;
-
- GLuint hw_primitive;
- GLenum raster_primitive;
- GLenum render_primitive;
-
- GLuint skip;
- GLubyte HwPrim;
- GLuint HwVertexSize;
-
- /* Fallback rasterization functions
- */
- savage_point_func draw_point;
- savage_line_func draw_line;
- savage_tri_func draw_tri;
-
- /* Funny mesa mirrors
- */
- GLuint MonoColor;
- GLuint ClearColor;
- GLfloat depth_scale;
- GLfloat hw_viewport[16];
- /* DRI stuff */
- GLuint bufferSize;
-
- GLframebuffer *glBuffer;
-
- /* Two flags to keep track of fallbacks. */
- GLuint Fallback;
-
- GLuint needClip;
-
- /* These refer to the current draw (front vs. back) buffer:
- */
- GLubyte *drawMap; /* draw buffer address in virtual mem */
- GLubyte *readMap;
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- GLuint numClipRects; /* cliprects for that buffer */
- GLint currentClip;
- drm_clip_rect_t *pClipRects;
-
- /* use this bit to support single/double buffer */
- GLuint IsDouble;
- /* use this to indicate Fullscreen mode */
- GLuint IsFullScreen; /* FIXME - open/close fullscreen is gone, is this needed? */
- GLuint backup_frontOffset;
- GLuint backup_backOffset;
- GLuint backup_frontBitmapDesc;
- GLuint toggle;
- GLuint backup_streamFIFO;
- GLuint NotFirstFrame;
-
- GLboolean inSwap;
- GLuint lastSwap;
- GLuint ctxAge;
- GLuint dirtyAge;
- GLuint any_contend; /* throttle me harder */
-
- /* Scissor state needs to be mirrored so buffered commands can be
- * emitted with the old scissor state when scissor state changes.
- */
- struct {
- GLboolean enabled;
- GLint x, y;
- GLsizei w, h;
- } scissor;
-
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- GLuint driFd;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIdrawablePrivate *driReadable;
-
- /**
- * Drawable used by Mesa for software fallbacks for reading and
- * writing. It is set by Mesa's \c SetBuffer callback, and will always be
- * either \c mga_context_t::driDrawable or \c mga_context_t::driReadable.
- */
- __DRIdrawablePrivate *mesa_drawable;
-
- __DRIscreenPrivate *driScreen;
- savageScreenPrivate *savageScreen;
- drm_savage_sarea_t *sarea;
-
- GLboolean hw_stencil;
-
- /* Performance counters
- */
- GLuint c_textureSwaps;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
- GLint texture_depth;
- GLboolean no_rast;
- GLboolean float_depth;
- GLboolean enable_fastpath;
- GLboolean enable_vdma;
- GLboolean sync_frames;
-};
-
-#define SAVAGE_CONTEXT(ctx) ((savageContextPtr)(ctx->DriverCtx))
-
-/* To remove all debugging, make sure SAVAGE_DEBUG is defined as a
- * preprocessor symbol, and equal to zero.
- */
-#ifndef SAVAGE_DEBUG
-extern int SAVAGE_DEBUG;
-#endif
-
-#define DEBUG_FALLBACKS 0x001
-#define DEBUG_VERBOSE_API 0x002
-#define DEBUG_VERBOSE_TEX 0x004
-#define DEBUG_VERBOSE_MSG 0x008
-#define DEBUG_DMA 0x010
-#define DEBUG_STATE 0x020
-
-#define TARGET_FRONT 0x0
-#define TARGET_BACK 0x1
-#define TARGET_DEPTH 0x2
-
-#define SUBPIXEL_X -0.5
-#define SUBPIXEL_Y -0.375
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.c
deleted file mode 100644
index ced44e562..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.c
+++ /dev/null
@@ -1,119 +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 "mtypes.h"
-#include "framebuffer.h"
-
-#include <stdio.h>
-
-#include "mm.h"
-#include "swrast/swrast.h"
-
-#include "savagedd.h"
-#include "savagestate.h"
-#include "savagespan.h"
-#include "savagetex.h"
-#include "savagetris.h"
-#include "savagecontext.h"
-#include "extensions.h"
-
-#include "utils.h"
-
-
-#define DRIVER_DATE "20050829"
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-
-static const GLubyte *savageDDGetString( GLcontext *ctx, GLenum name )
-{
- static char *cardNames[S3_LAST] = {
- "Unknown",
- "Savage3D",
- "Savage/MX/IX",
- "Savage4",
- "ProSavage",
- "Twister",
- "ProSavageDDR",
- "SuperSavage",
- "Savage2000"
- };
- static char buffer[128];
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- savageScreenPrivate *screen = imesa->savageScreen;
- enum S3CHIPTAGS chipset = screen->chipset;
- unsigned offset;
-
- if (chipset < S3_SAVAGE3D || chipset >= S3_LAST)
- chipset = S3_UNKNOWN; /* should not happen */
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *)"S3 Graphics Inc.";
- case GL_RENDERER:
- offset = driGetRendererString( buffer, cardNames[chipset], DRIVER_DATE,
- screen->agpMode );
- return (GLubyte *)buffer;
- default:
- return 0;
- }
-}
-#if 0
-static GLint savageGetParameteri(const GLcontext *ctx, GLint param)
-{
- switch (param) {
- case DD_HAVE_HARDWARE_FOG:
- return 1;
- default:
- return 0;
- }
-}
-#endif
-
-
-static void savageBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- LOCK_HARDWARE(imesa);
- *width = imesa->driDrawable->w;
- *height = imesa->driDrawable->h;
- UNLOCK_HARDWARE(imesa);
-}
-
-
-void savageDDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = savageBufferSize;
- ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
- ctx->Driver.GetString = savageDDGetString;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.h
deleted file mode 100644
index ae167be70..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagedd.h
+++ /dev/null
@@ -1,32 +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.
- */
-
-
-#ifndef SAVAGEDD_INC
-#define SAVAGEDD_INC
-
-#include "context.h"
-
-void savageDDInitDriverFuncs( GLcontext *ctx );
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.c
deleted file mode 100644
index f759034e4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.c
+++ /dev/null
@@ -1,657 +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 <unistd.h>
-#include <sys/mman.h>
-
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "context.h"
-#include "swrast/swrast.h"
-#include "colormac.h"
-
-#include "mm.h"
-#include "savagecontext.h"
-#include "savageioctl.h"
-#include "savage_bci.h"
-#include "savagestate.h"
-#include "savagespan.h"
-
-#include "drm.h"
-#include <sys/ioctl.h>
-#include <sys/timeb.h>
-
-#define DEPTH_SCALE_16 ((1<<16)-1)
-#define DEPTH_SCALE_24 ((1<<24)-1)
-
-
-void savageGetDMABuffer( savageContextPtr imesa )
-{
- int idx = 0;
- int size = 0;
- drmDMAReq dma;
- int retcode;
- drmBufPtr buf;
-
- assert (imesa->savageScreen->bufs);
-
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf(stderr, "Getting dma buffer\n");
-
- dma.context = imesa->hHWContext;
- dma.send_count = 0;
- dma.send_list = NULL;
- dma.send_sizes = NULL;
- dma.flags = 0;
- dma.request_count = 1;
- dma.request_size = imesa->bufferSize;
- dma.request_list = &idx;
- dma.request_sizes = &size;
- dma.granted_count = 0;
-
-
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf(stderr, "drmDMA (get) ctx %d count %d size 0x%x\n",
- dma.context, dma.request_count,
- dma.request_size);
-
- while (1) {
- retcode = drmDMA(imesa->driFd, &dma);
-
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf(stderr, "retcode %d sz %d idx %d count %d\n",
- retcode,
- dma.request_sizes[0],
- dma.request_list[0],
- dma.granted_count);
-
- if (retcode == 0 &&
- dma.request_sizes[0] &&
- dma.granted_count)
- break;
-
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf(stderr, "\n\nflush");
- }
-
- buf = &(imesa->savageScreen->bufs->list[idx]);
-
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf(stderr,
- "drmDMA (get) returns size[0] 0x%x idx[0] %d\n"
- "dma_buffer now: buf idx: %d size: %d used: %d addr %p\n",
- dma.request_sizes[0], dma.request_list[0],
- buf->idx, buf->total,
- buf->used, buf->address);
-
- imesa->dmaVtxBuf.total = buf->total / 4;
- imesa->dmaVtxBuf.used = 0;
- imesa->dmaVtxBuf.flushed = 0;
- imesa->dmaVtxBuf.idx = buf->idx;
- imesa->dmaVtxBuf.buf = (u_int32_t *)buf->address;
-
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf(stderr, "finished getbuffer\n");
-}
-
-#if 0
-/* Still keeping this around because it demonstrates page flipping and
- * automatic z-clear. */
-static void savage_BCI_clear(GLcontext *ctx, drm_savage_clear_t *pclear)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- int nbox = imesa->sarea->nbox;
- drm_clip_rect_t *pbox = imesa->sarea->boxes;
- int i;
-
-
- if (nbox > SAVAGE_NR_SAREA_CLIPRECTS)
- nbox = SAVAGE_NR_SAREA_CLIPRECTS;
-
- for (i = 0 ; i < nbox ; i++, pbox++) {
- unsigned int x = pbox->x1;
- unsigned int y = pbox->y1;
- unsigned int width = pbox->x2 - x;
- unsigned int height = pbox->y2 - y;
- u_int32_t *bciptr;
-
- if (pbox->x1 > pbox->x2 ||
- pbox->y1 > pbox->y2 ||
- pbox->x2 > imesa->savageScreen->width ||
- pbox->y2 > imesa->savageScreen->height)
- continue;
-
- if ( pclear->flags & SAVAGE_FRONT ) {
- bciptr = savageDMAAlloc (imesa, 8);
- WRITE_CMD((bciptr) , 0x4BCC8C00,u_int32_t);
- WRITE_CMD((bciptr) , imesa->savageScreen->frontOffset,u_int32_t);
- WRITE_CMD((bciptr) , imesa->savageScreen->frontBitmapDesc,u_int32_t);
- WRITE_CMD((bciptr) , pclear->clear_color,u_int32_t);
- WRITE_CMD((bciptr) , (y <<16) | x,u_int32_t);
- WRITE_CMD((bciptr) , (height << 16) | width,u_int32_t);
- savageDMACommit (imesa, bciptr);
- }
- if ( pclear->flags & SAVAGE_BACK ) {
- bciptr = savageDMAAlloc (imesa, 8);
- WRITE_CMD((bciptr) , 0x4BCC8C00,u_int32_t);
- WRITE_CMD((bciptr) , imesa->savageScreen->backOffset,u_int32_t);
- WRITE_CMD((bciptr) , imesa->savageScreen->backBitmapDesc,u_int32_t);
- WRITE_CMD((bciptr) , pclear->clear_color,u_int32_t);
- WRITE_CMD((bciptr) , (y <<16) | x,u_int32_t);
- WRITE_CMD((bciptr) , (height << 16) | width,u_int32_t);
- savageDMACommit (imesa, bciptr);
- }
-
- if ( pclear->flags & (SAVAGE_DEPTH |SAVAGE_STENCIL) ) {
- u_int32_t writeMask = 0x0;
- if(imesa->hw_stencil)
- {
- if(pclear->flags & SAVAGE_STENCIL)
- {
-
- writeMask |= 0xFF000000;
- }
- if(pclear->flags & SAVAGE_DEPTH)
- {
- writeMask |= 0x00FFFFFF;
- }
- }
- if(imesa->IsFullScreen && imesa->NotFirstFrame &&
- imesa->savageScreen->chipset >= S3_SAVAGE4)
- {
- imesa->regs.s4.zBufCtrl.ni.autoZEnable = GL_TRUE;
- imesa->regs.s4.zBufCtrl.ni.frameID =
- ~imesa->regs.s4.zBufCtrl.ni.frameID;
-
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
- }
- else
- {
- if(imesa->IsFullScreen)
- imesa->NotFirstFrame = GL_TRUE;
-
- if(imesa->hw_stencil)
- {
- bciptr = savageDMAAlloc (imesa, 10);
- if(writeMask != 0xFFFFFFFF)
- {
- WRITE_CMD((bciptr) , 0x960100D7,u_int32_t);
- WRITE_CMD((bciptr) , writeMask,u_int32_t);
- }
- }
- else
- {
- bciptr = savageDMAAlloc (imesa, 6);
- }
-
- WRITE_CMD((bciptr) , 0x4BCC8C00,u_int32_t);
- WRITE_CMD((bciptr) , imesa->savageScreen->depthOffset,u_int32_t);
- WRITE_CMD((bciptr) , imesa->savageScreen->depthBitmapDesc,u_int32_t);
- WRITE_CMD((bciptr) , pclear->clear_depth,u_int32_t);
- WRITE_CMD((bciptr) , (y <<16) | x,u_int32_t);
- WRITE_CMD((bciptr) , (height << 16) | width,u_int32_t);
- if(imesa->hw_stencil)
- {
- if(writeMask != 0xFFFFFFFF)
- {
- WRITE_CMD((bciptr) , 0x960100D7,u_int32_t);
- WRITE_CMD((bciptr) , 0xFFFFFFFF,u_int32_t);
- }
- }
- savageDMACommit (imesa, bciptr);
- }
- }
- }
- /* FK: Make sure that the clear stuff is emitted. Otherwise a
- software fallback may get overwritten by a delayed clear. */
- savageDMAFlush (imesa);
-}
-
-static void savage_BCI_swap(savageContextPtr imesa)
-{
- int nbox = imesa->sarea->nbox;
- drm_clip_rect_t *pbox = imesa->sarea->boxes;
- int i;
- volatile u_int32_t *bciptr;
-
- if (nbox > SAVAGE_NR_SAREA_CLIPRECTS)
- nbox = SAVAGE_NR_SAREA_CLIPRECTS;
- savageDMAFlush (imesa);
-
- if(imesa->IsFullScreen)
- { /* full screen*/
- unsigned int tmp0;
- tmp0 = imesa->savageScreen->frontOffset;
- imesa->savageScreen->frontOffset = imesa->savageScreen->backOffset;
- imesa->savageScreen->backOffset = tmp0;
-
- if(imesa->toggle == TARGET_BACK)
- imesa->toggle = TARGET_FRONT;
- else
- imesa->toggle = TARGET_BACK;
-
- imesa->drawMap = (char *)imesa->apertureBase[imesa->toggle];
- imesa->readMap = (char *)imesa->apertureBase[imesa->toggle];
-
- imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->backOffset>>11;
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
- bciptr = SAVAGE_GET_BCI_POINTER(imesa,3);
- *(bciptr) = 0x960100B0;
- *(bciptr) = (imesa->savageScreen->frontOffset);
- *(bciptr) = 0xA0000000;
- }
-
- else
- { /* Use bitblt copy from back to front buffer*/
-
- for (i = 0 ; i < nbox; i++, pbox++)
- {
- unsigned int w = pbox->x2 - pbox->x1;
- unsigned int h = pbox->y2 - pbox->y1;
-
- if (pbox->x1 > pbox->x2 ||
- pbox->y1 > pbox->y2 ||
- pbox->x2 > imesa->savageScreen->width ||
- pbox->y2 > imesa->savageScreen->height)
- continue;
-
- bciptr = SAVAGE_GET_BCI_POINTER(imesa,6);
-
- *(bciptr) = 0x4BCC00C0;
-
- *(bciptr) = imesa->savageScreen->backOffset;
- *(bciptr) = imesa->savageScreen->backBitmapDesc;
- *(bciptr) = (pbox->y1 <<16) | pbox->x1; /*x0, y0*/
- *(bciptr) = (pbox->y1 <<16) | pbox->x1;
- *(bciptr) = (h << 16) | w;
- }
-
- }
-}
-#endif
-
-
-static GLboolean intersect_rect( drm_clip_rect_t *out,
- const drm_clip_rect_t *a,
- const drm_clip_rect_t *b )
-{
- *out = *a;
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (b->y2 < out->y2) out->y2 = b->y2;
-
- return ((out->x1 < out->x2) && (out->y1 < out->y2));
-}
-
-
-static GLuint savageIntersectClipRects(drm_clip_rect_t *dest,
- const drm_clip_rect_t *src,
- GLuint nsrc,
- const drm_clip_rect_t *clip)
-{
- GLuint i, ndest;
-
- for (i = 0, ndest = 0; i < nsrc; ++i, ++src) {
- if (intersect_rect(dest, src, clip)) {
- dest++;
- ndest++;
- }
- }
-
- return ndest;
-}
-
-
-static void savageDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- GLuint colorMask, depthMask, clearColor, clearDepth, flags;
-
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "%s\n", __FUNCTION__);
-
- clearColor = imesa->ClearColor;
- if (imesa->float_depth) {
- if (imesa->savageScreen->zpp == 2)
- clearDepth = savageEncodeFloat16(1.0 - ctx->Depth.Clear);
- else
- clearDepth = savageEncodeFloat24(1.0 - ctx->Depth.Clear);
- } else {
- if (imesa->savageScreen->zpp == 2)
- clearDepth = (GLuint) ((1.0 - ctx->Depth.Clear) * DEPTH_SCALE_16);
- else
- clearDepth = (GLuint) ((1.0 - ctx->Depth.Clear) * DEPTH_SCALE_24);
- }
-
- colorMask = 0;
- depthMask = 0;
- switch (imesa->savageScreen->cpp) {
- case 2:
- colorMask = PACK_COLOR_565(ctx->Color.ColorMask[0],
- ctx->Color.ColorMask[1],
- ctx->Color.ColorMask[2]);
- break;
- case 4:
- colorMask = PACK_COLOR_8888(ctx->Color.ColorMask[3],
- ctx->Color.ColorMask[2],
- ctx->Color.ColorMask[1],
- ctx->Color.ColorMask[0]);
- break;
- }
-
- flags = 0;
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- flags |= SAVAGE_FRONT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if (mask & BUFFER_BIT_BACK_LEFT) {
- flags |= SAVAGE_BACK;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ((mask & BUFFER_BIT_DEPTH) && ctx->Depth.Mask) {
- flags |= SAVAGE_DEPTH;
- depthMask |=
- (imesa->savageScreen->zpp == 2) ? 0xffffffff : 0x00ffffff;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if((mask & BUFFER_BIT_STENCIL) && imesa->hw_stencil)
- {
- flags |= SAVAGE_DEPTH;
- depthMask |= 0xff000000;
- mask &= ~BUFFER_BIT_STENCIL;
- }
-
- savageFlushVertices(imesa);
-
- if (flags) {
- GLboolean depthCleared = GL_FALSE;
- if (flags & (SAVAGE_FRONT|SAVAGE_BACK)) {
- drm_savage_cmd_header_t *cmd;
- cmd = savageAllocCmdBuf(imesa, sizeof(drm_savage_cmd_header_t));
- cmd[0].clear0.cmd = SAVAGE_CMD_CLEAR;
- if ((flags & SAVAGE_DEPTH) &&
- clearDepth == clearColor && depthMask == colorMask) {
- cmd[0].clear0.flags = flags;
- depthCleared = GL_TRUE;
- } else
- cmd[0].clear0.flags = flags & (SAVAGE_FRONT|SAVAGE_BACK);
- cmd[1].clear1.mask = colorMask;
- cmd[1].clear1.value = clearColor;
- }
-
- if ((flags & SAVAGE_DEPTH) && !depthCleared) {
- drm_savage_cmd_header_t *cmd;
- cmd = savageAllocCmdBuf(imesa, sizeof(drm_savage_cmd_header_t));
- cmd[0].clear0.cmd = SAVAGE_CMD_CLEAR;
- cmd[0].clear0.flags = SAVAGE_DEPTH;
- cmd[1].clear1.mask = depthMask;
- cmd[1].clear1.value = clearDepth;
- }
- }
-
- if (mask)
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void savageSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- savageContextPtr imesa;
-
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "%s\n================================\n", __FUNCTION__);
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- imesa = (savageContextPtr) dPriv->driContextPriv->driverPrivate;
- if (imesa->IsDouble)
- _mesa_notifySwapBuffers( imesa->glCtx );
-
- FLUSH_BATCH(imesa);
-
- if (imesa->sync_frames)
- imesa->lastSwap = savageEmitEvent( imesa, 0 );
-
- if (imesa->lastSwap != 0)
- savageWaitEvent( imesa, imesa->lastSwap );
-
- {
- drm_savage_cmd_header_t *cmd = savageAllocCmdBuf(imesa, 0);
- cmd->cmd.cmd = SAVAGE_CMD_SWAP;
- imesa->inSwap = GL_TRUE; /* ignore scissors in savageFlushCmdBuf */
- savageFlushCmdBuf(imesa, GL_FALSE);
- imesa->inSwap = GL_FALSE;
- }
-
- if (!imesa->sync_frames)
- /* don't sync, but limit the lag to one frame. */
- imesa->lastSwap = savageEmitEvent( imesa, 0 );
-}
-
-unsigned int savageEmitEventLocked( savageContextPtr imesa, unsigned int flags )
-{
- drm_savage_event_emit_t event;
- int ret;
- event.count = 0;
- event.flags = flags;
- ret = drmCommandWriteRead( imesa->driFd, DRM_SAVAGE_BCI_EVENT_EMIT,
- &event, sizeof(event) );
- if (ret) {
- fprintf (stderr, "emit event returned %d\n", ret);
- exit (1);
- }
- return event.count;
-}
-unsigned int savageEmitEvent( savageContextPtr imesa, unsigned int flags )
-{
- unsigned int ret;
- LOCK_HARDWARE( imesa );
- ret = savageEmitEventLocked( imesa, flags );
- UNLOCK_HARDWARE( imesa );
- return ret;
-}
-
-
-void savageWaitEvent( savageContextPtr imesa, unsigned int count )
-{
- drm_savage_event_wait_t event;
- int ret;
- event.count = count;
- event.flags = 0;
- ret = drmCommandWriteRead( imesa->driFd, DRM_SAVAGE_BCI_EVENT_WAIT,
- &event, sizeof(event) );
- if (ret) {
- fprintf (stderr, "wait event returned %d\n", ret);
- exit (1);
- }
-}
-
-
-void savageFlushVertices( savageContextPtr imesa )
-{
- struct savage_vtxbuf_t *buffer = imesa->vtxBuf;
-
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "%s\n", __FUNCTION__);
-
- if (!buffer->total)
- return;
-
- if (buffer->used > buffer->flushed) {
- drm_savage_cmd_header_t *cmd;
- /* State must be updated "per primitive" because hardware
- * culling must be disabled for unfilled primitives, points
- * and lines. */
- savageEmitChangedState (imesa);
- cmd = savageAllocCmdBuf(imesa, 0);
- cmd->prim.cmd = buffer == &imesa->dmaVtxBuf ?
- SAVAGE_CMD_DMA_PRIM : SAVAGE_CMD_VB_PRIM;
- cmd->prim.prim = imesa->HwPrim;
- cmd->prim.skip = imesa->skip;
- cmd->prim.start = buffer->flushed / imesa->HwVertexSize;
- cmd->prim.count = buffer->used / imesa->HwVertexSize - cmd->prim.start;
- buffer->flushed = buffer->used;
- }
-}
-
-void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard )
-{
- __DRIdrawablePrivate *dPriv = imesa->driDrawable;
-
- if (!imesa->dmaVtxBuf.total)
- discard = GL_FALSE;
-
- /* complete indexed drawing commands */
- savageFlushElts(imesa);
-
- if (imesa->cmdBuf.write != imesa->cmdBuf.start || discard) {
- drm_savage_cmdbuf_t cmdbuf;
- drm_savage_cmd_header_t *start;
- int ret;
-
- /* If we lost the context we must restore the initial state (at
- * the start of the command buffer). */
- if (imesa->lostContext) {
- start = imesa->cmdBuf.base;
- imesa->lostContext = GL_FALSE;
- } else
- start = imesa->cmdBuf.start;
-
- if ((SAVAGE_DEBUG & DEBUG_DMA) && discard)
- fprintf (stderr, "Discarding DMA buffer, used=%u\n",
- imesa->dmaVtxBuf.used);
-
- cmdbuf.dma_idx = imesa->dmaVtxBuf.idx;
- cmdbuf.discard = discard;
- cmdbuf.vb_addr = imesa->clientVtxBuf.buf;
- cmdbuf.vb_size = imesa->clientVtxBuf.total*4;
- cmdbuf.vb_stride = imesa->HwVertexSize;
- cmdbuf.cmd_addr = start;
- cmdbuf.size = (imesa->cmdBuf.write - start);
- if (!imesa->inSwap && imesa->scissor.enabled) {
- drm_clip_rect_t *box = dPriv->pClipRects, *ibox;
- drm_clip_rect_t scissor;
- GLuint nbox = dPriv->numClipRects, nibox;
- /* transform and clip scissor to viewport */
- scissor.x1 = MAX2(imesa->scissor.x, 0) + dPriv->x;
- scissor.y1 = MAX2(dPriv->h - imesa->scissor.y - imesa->scissor.h,
- 0) + dPriv->y;
- scissor.x2 = MIN2(imesa->scissor.x + imesa->scissor.w,
- dPriv->w) + dPriv->x;
- scissor.y2 = MIN2(dPriv->h - imesa->scissor.y,
- dPriv->h) + dPriv->y;
- /* intersect cliprects with scissor */
- ibox = malloc(dPriv->numClipRects*sizeof(drm_clip_rect_t));
- if (!ibox) {
- fprintf(stderr, "Out of memory.\n");
- exit(1);
- }
- nibox = savageIntersectClipRects(ibox, box, nbox, &scissor);
- cmdbuf.nbox = nibox;
- cmdbuf.box_addr = ibox;
- } else {
- cmdbuf.nbox = dPriv->numClipRects;
- cmdbuf.box_addr = dPriv->pClipRects;
- }
-
- ret = drmCommandWrite( imesa->driFd, DRM_SAVAGE_BCI_CMDBUF,
- &cmdbuf, sizeof(cmdbuf) );
- if (ret) {
- fprintf (stderr, "cmdbuf ioctl returned %d\n", ret);
- exit(1);
- }
-
- if (cmdbuf.box_addr != dPriv->pClipRects) {
- free(cmdbuf.box_addr);
- }
-
- /* Save the current state at the start of the command buffer. That
- * state will only be emitted, if the context was lost since the
- * last command buffer. */
- imesa->cmdBuf.write = imesa->cmdBuf.base;
- savageEmitOldState(imesa);
- imesa->cmdBuf.start = imesa->cmdBuf.write;
- }
-
- if (discard) {
- assert (!savageHaveIndexedVerts(imesa));
- imesa->dmaVtxBuf.total = 0;
- imesa->dmaVtxBuf.used = 0;
- imesa->dmaVtxBuf.flushed = 0;
- }
- if (!savageHaveIndexedVerts(imesa)) {
- imesa->clientVtxBuf.used = 0;
- imesa->clientVtxBuf.flushed = 0;
- }
-}
-
-
-void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard )
-{
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "%s\n", __FUNCTION__);
- LOCK_HARDWARE(imesa);
- savageFlushCmdBufLocked (imesa, discard);
- UNLOCK_HARDWARE(imesa);
-}
-
-
-static void savageDDFlush( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "%s\n", __FUNCTION__);
- savageFlushVertices (imesa);
- savageFlushCmdBuf(imesa, GL_FALSE);
-}
-
-static void savageDDFinish( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "%s\n", __FUNCTION__);
- savageFlushVertices (imesa);
- savageFlushCmdBuf(imesa, GL_FALSE);
- WAIT_IDLE_EMPTY(imesa);
-}
-
-void savageDDInitIoctlFuncs( GLcontext *ctx )
-{
- ctx->Driver.Clear = savageDDClear;
- ctx->Driver.Flush = savageDDFlush;
- ctx->Driver.Finish = savageDDFinish;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.h
deleted file mode 100644
index c7ff0017f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savageioctl.h
+++ /dev/null
@@ -1,203 +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.
- */
-
-
-#ifndef SAVAGE_IOCTL_H
-#define SAVAGE_IOCTL_H
-
-#include "savagecontext.h"
-
-void savageFlushVertices( savageContextPtr mmesa );
-
-unsigned int savageEmitEventLocked( savageContextPtr imesa, unsigned int flags );
-unsigned int savageEmitEvent( savageContextPtr imesa, unsigned int flags );
-void savageWaitEvent( savageContextPtr imesa, unsigned int event);
-
-void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard );
-void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard );
-
-void savageDDInitIoctlFuncs( GLcontext *ctx );
-
-void savageSwapBuffers( __DRIdrawablePrivate *dPriv );
-
-#define WAIT_IDLE_EMPTY(imesa) do { \
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) \
- fprintf (stderr, "WAIT_IDLE_EMPTY in %s\n", __FUNCTION__); \
- savageWaitEvent(imesa, \
- savageEmitEvent(imesa, SAVAGE_WAIT_2D|SAVAGE_WAIT_3D)); \
-} while (0)
-
-#define WAIT_IDLE_EMPTY_LOCKED(imesa) do { \
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) \
- fprintf (stderr, "WAIT_IDLE_EMPTY_LOCKED in %s\n", __FUNCTION__); \
- savageWaitEvent(imesa, savageEmitEventLocked( \
- imesa, SAVAGE_WAIT_2D|SAVAGE_WAIT_3D)); \
-} while (0)
-
-#define FLUSH_BATCH(imesa) do { \
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) \
- fprintf (stderr, "FLUSH_BATCH in %s\n", __FUNCTION__); \
- savageFlushVertices(imesa); \
- savageFlushCmdBuf(imesa, GL_FALSE); \
-} while (0)
-
-extern void savageGetDMABuffer( savageContextPtr imesa );
-
-static __inline
-void savageReleaseIndexedVerts( savageContextPtr imesa )
-{
- imesa->firstElt = -1;
-}
-
-static __inline
-GLboolean savageHaveIndexedVerts( savageContextPtr imesa )
-{
- return (imesa->firstElt != -1);
-}
-
-static __inline
-u_int32_t *savageAllocVtxBuf( savageContextPtr imesa, GLuint words )
-{
- struct savage_vtxbuf_t *buffer = imesa->vtxBuf;
- u_int32_t *head;
-
- if (buffer == &imesa->dmaVtxBuf) {
- if (!buffer->total) {
- LOCK_HARDWARE(imesa);
- savageGetDMABuffer(imesa);
- UNLOCK_HARDWARE(imesa);
- } else if (buffer->used + words > buffer->total) {
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "... flushing DMA buffer in %s\n",
- __FUNCTION__);
- savageReleaseIndexedVerts(imesa);
- savageFlushVertices(imesa);
- LOCK_HARDWARE(imesa);
- savageFlushCmdBufLocked(imesa, GL_TRUE); /* discard DMA buffer */
- savageGetDMABuffer(imesa);
- UNLOCK_HARDWARE(imesa);
- }
- } else if (buffer->used + words > buffer->total) {
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "... flushing client vertex buffer in %s\n",
- __FUNCTION__);
- savageReleaseIndexedVerts(imesa);
- savageFlushVertices(imesa);
- LOCK_HARDWARE(imesa);
- savageFlushCmdBufLocked(imesa, GL_FALSE); /* free clientVtxBuf */
- UNLOCK_HARDWARE(imesa);
- }
-
- head = &buffer->buf[buffer->used];
-
- buffer->used += words;
- return head;
-}
-
-static __inline
-u_int32_t *savageAllocIndexedVerts( savageContextPtr imesa, GLuint n )
-{
- u_int32_t *ret;
- savageFlushVertices(imesa);
- ret = savageAllocVtxBuf(imesa, n*imesa->HwVertexSize);
- imesa->firstElt = imesa->vtxBuf->flushed / imesa->HwVertexSize;
- imesa->vtxBuf->flushed = imesa->vtxBuf->used;
- return ret;
-}
-
-/* Flush Elts:
- * - Complete the drawing command with the correct number of indices.
- * - Actually allocate entries for the indices in the command buffer.
- * (This allocation must succeed without wrapping the cmd buffer!)
- */
-static __inline
-void savageFlushElts( savageContextPtr imesa )
-{
- if (imesa->elts.cmd) {
- GLuint qwords = (imesa->elts.n + 3) >> 2;
- assert(imesa->cmdBuf.write - imesa->cmdBuf.base + qwords
- <= imesa->cmdBuf.size);
- imesa->cmdBuf.write += qwords;
-
- imesa->elts.cmd->idx.count = imesa->elts.n;
- imesa->elts.cmd = NULL;
- }
-}
-
-/* Allocate a command buffer entry with <bytes> bytes of arguments:
- * - implies savageFlushElts
- */
-static __inline
-drm_savage_cmd_header_t *savageAllocCmdBuf( savageContextPtr imesa, GLuint bytes )
-{
- drm_savage_cmd_header_t *ret;
- GLuint qwords = ((bytes + 7) >> 3) + 1; /* round up */
- assert (qwords < imesa->cmdBuf.size);
-
- savageFlushElts(imesa);
-
- if (imesa->cmdBuf.write - imesa->cmdBuf.base + qwords > imesa->cmdBuf.size)
- savageFlushCmdBuf(imesa, GL_FALSE);
-
- ret = (drm_savage_cmd_header_t *)imesa->cmdBuf.write;
- imesa->cmdBuf.write += qwords;
- return ret;
-}
-
-/* Allocate Elts:
- * - if it doesn't fit, flush the cmd buffer first
- * - allocates the drawing command on the cmd buffer if there is no
- * incomplete indexed drawing command yet
- * - increments the number of elts. Final allocation is done in savageFlushElts
- */
-static __inline
-u_int16_t *savageAllocElts( savageContextPtr imesa, GLuint n )
-{
- u_int16_t *ret;
- GLuint qwords;
- assert (savageHaveIndexedVerts(imesa));
-
- if (imesa->elts.cmd)
- qwords = (imesa->elts.n + n + 3) >> 2;
- else
- qwords = ((n + 3) >> 2) + 1;
- if (imesa->cmdBuf.write - imesa->cmdBuf.base + qwords > imesa->cmdBuf.size)
- savageFlushCmdBuf(imesa, GL_FALSE); /* implies savageFlushElts */
-
- if (!imesa->elts.cmd) {
- savageFlushVertices(imesa);
- imesa->elts.cmd = savageAllocCmdBuf(imesa, 0);
- imesa->elts.cmd->idx.cmd = (imesa->vtxBuf == &imesa->dmaVtxBuf) ?
- SAVAGE_CMD_DMA_IDX : SAVAGE_CMD_VB_IDX;
- imesa->elts.cmd->idx.prim = imesa->HwPrim;
- imesa->elts.cmd->idx.skip = imesa->skip;
- imesa->elts.n = 0;
- }
-
- ret = (u_int16_t *)(imesa->elts.cmd+1) + imesa->elts.n;
- imesa->elts.n += n;
- return ret;
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagerender.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagerender.c
deleted file mode 100644
index 514434c42..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagerender.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Copyright 2005 Felix Kuehling
- * 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 FELIX KUEHLING 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.
- */
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Simulate missing primitives with indexed vertices.
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "savagecontext.h"
-#include "savagetris.h"
-#include "savagestate.h"
-#include "savageioctl.h"
-
-/*
- * Standard render tab for Savage4 and smooth shading on Savage3D
- */
-#define HAVE_POINTS 0
-#define HAVE_LINES 0
-#define HAVE_LINE_STRIPS 0
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 0
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 1
-
-#define LOCAL_VARS savageContextPtr imesa = SAVAGE_CONTEXT(ctx)
-#define INIT( prim ) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- savageFlushVertices(imesa); \
- switch (prim) { \
- case GL_TRIANGLES: imesa->HwPrim = SAVAGE_PRIM_TRILIST; break; \
- case GL_TRIANGLE_STRIP: imesa->HwPrim = SAVAGE_PRIM_TRISTRIP; break; \
- case GL_TRIANGLE_FAN: imesa->HwPrim = SAVAGE_PRIM_TRIFAN; break; \
- } \
-} while (0)
-#define FLUSH() savageFlushElts(imesa), savageFlushVertices(imesa)
-
-#define GET_CURRENT_VB_MAX_VERTS() \
- ((imesa->bufferSize/4 - imesa->vtxBuf->used) / imesa->HwVertexSize)
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (imesa->bufferSize/4 / imesa->HwVertexSize)
-
-#define ALLOC_VERTS( nr ) \
- savageAllocVtxBuf( imesa, (nr) * imesa->HwVertexSize )
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf )
-
-#define ELTS_VARS( buf ) GLushort *dest = buf, firstElt = imesa->firstElt
-#define ELT_INIT( prim ) INIT(prim)
-
-/* (size - used - 1 qword for drawing command) * 4 elts per qword */
-#define GET_CURRENT_VB_MAX_ELTS() \
- ((imesa->cmdBuf.size - (imesa->cmdBuf.write - imesa->cmdBuf.base) - 1)*4)
-/* (size - space for initial state - 1 qword for drawing command) * 4 elts
- * imesa is not defined in validate_render :( */
-#define GET_SUBSEQUENT_VB_MAX_ELTS() \
- ((SAVAGE_CONTEXT(ctx)->cmdBuf.size - \
- (SAVAGE_CONTEXT(ctx)->cmdBuf.start - \
- SAVAGE_CONTEXT(ctx)->cmdBuf.base) - 1)*4)
-
-#define ALLOC_ELTS(nr) savageAllocElts(imesa, nr)
-#define EMIT_ELT(offset, x) do { \
- (dest)[offset] = (GLushort) ((x)+firstElt); \
-} while (0)
-#define EMIT_TWO_ELTS(offset, x, y) do { \
- *(GLuint *)(dest + offset) = (((y)+firstElt) << 16) | \
- ((x)+firstElt); \
-} while (0)
-
-#define INCR_ELTS( nr ) dest += nr
-#define ELTPTR dest
-#define RELEASE_ELT_VERTS() \
- savageReleaseIndexedVerts(imesa)
-
-#define EMIT_INDEXED_VERTS( ctx, start, count ) do { \
- GLuint *buf = savageAllocIndexedVerts(imesa, count-start); \
- EMIT_VERTS(ctx, start, count-start, buf); \
-} while (0)
-
-#define TAG(x) savage_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-/*
- * On Savage3D triangle fans and strips are broken with flat
- * shading. With triangles it wants the color for flat shading in the
- * first vertex! So we make another template instance which uses
- * triangles only (with reordered vertices: SAVAGE_PRIM_TRILIST_201).
- * The reordering is done by the DRM.
- */
-#undef HAVE_TRI_STRIPS
-#undef HAVE_TRI_FANS
-#define HAVE_TRI_STRIPS 0
-#define HAVE_TRI_FANS 0
-
-#undef INIT
-#define INIT( prim ) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- savageFlushVertices(imesa); \
- imesa->HwPrim = SAVAGE_PRIM_TRILIST_201; \
-} while(0)
-
-#undef TAG
-#define TAG(x) savage_flat_##x##_s3d
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-static GLboolean savage_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab, *tab_elts;
- GLboolean valid;
- GLuint i;
-
- if (savageHaveIndexedVerts(imesa))
- savageReleaseIndexedVerts(imesa);
-
- if (imesa->savageScreen->chipset < S3_SAVAGE4 &&
- (ctx->_TriangleCaps & DD_FLATSHADE)) {
- tab = savage_flat_render_tab_verts_s3d;
- tab_elts = savage_flat_render_tab_elts_s3d;
- valid = savage_flat_validate_render_s3d( ctx, VB );
- } else {
- tab = savage_render_tab_verts;
- tab_elts = savage_render_tab_elts;
- valid = savage_validate_render( ctx, VB );
- }
-
- /* Don't handle clipping or vertex manipulations.
- */
- if (imesa->RenderIndex != 0 || !valid) {
- return GL_TRUE;
- }
-
- tnl->Driver.Render.Start( ctx );
- /* Check RenderIndex again. The ptexHack is detected late in RenderStart.
- * Also check for ptex fallbacks detected late.
- */
- if (imesa->RenderIndex != 0 || imesa->Fallback != 0) {
- return GL_TRUE;
- }
-
- /* setup for hardware culling */
- imesa->raster_primitive = GL_TRIANGLES;
- imesa->new_state |= SAVAGE_NEW_CULL;
-
- /* update and emit state */
- savageDDUpdateHwState(ctx);
- savageEmitChangedState(imesa);
-
- if (VB->Elts) {
- tab = tab_elts;
- if (!savageHaveIndexedVerts(imesa)) {
- if (VB->Count > GET_SUBSEQUENT_VB_MAX_VERTS())
- return GL_TRUE;
- EMIT_INDEXED_VERTS(ctx, 0, VB->Count);
- }
- }
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (length)
- tab[prim & PRIM_MODE_MASK]( ctx, start, start+length, prim);
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- return GL_FALSE; /* finished the pipe */
-}
-
-struct tnl_pipeline_stage _savage_render_stage =
-{
- "savage render",
- NULL,
- NULL,
- NULL,
- NULL,
- savage_run_render /* run */
-};
-
-
-/**********************************************************************/
-/* Pipeline stage for texture coordinate normalization */
-/**********************************************************************/
-struct texnorm_stage_data {
- GLboolean active;
- GLvector4f texcoord[MAX_TEXTURE_UNITS];
-};
-
-#define TEXNORM_STAGE_DATA(stage) ((struct texnorm_stage_data *)stage->privatePtr)
-
-
-static GLboolean run_texnorm_stage( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage);
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- if (imesa->Fallback || !store->active)
- return GL_TRUE;
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- const GLbitfield reallyEnabled = ctx->Texture.Unit[i]._ReallyEnabled;
- if (reallyEnabled) {
- const struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
- const GLboolean normalizeS = (texObj->WrapS == GL_REPEAT);
- const GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) &&
- (texObj->WrapT == GL_REPEAT);
- const GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data;
- const GLint instride = VB->TexCoordPtr[i]->stride;
- GLfloat (*out)[4] = store->texcoord[i].data;
- GLint j;
-
- if (!ctx->Texture.Unit[i]._ReallyEnabled ||
- VB->TexCoordPtr[i]->size == 4)
- /* Never try to normalize homogenous tex coords! */
- continue;
-
- if (normalizeS && normalizeT) {
- /* take first texcoords as rough estimate of mean value */
- GLfloat correctionS = -floor(in[0]+0.5);
- GLfloat correctionT = -floor(in[1]+0.5);
- for (j = 0; j < VB->Count; ++j) {
- out[j][0] = in[0] + correctionS;
- out[j][1] = in[1] + correctionT;
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- } else if (normalizeS) {
- /* take first texcoords as rough estimate of mean value */
- GLfloat correctionS = -floor(in[0]+0.5);
- if (reallyEnabled & TEXTURE_2D_BIT) {
- for (j = 0; j < VB->Count; ++j) {
- out[j][0] = in[0] + correctionS;
- out[j][1] = in[1];
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- } else {
- for (j = 0; j < VB->Count; ++j) {
- out[j][0] = in[0] + correctionS;
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- }
- } else if (normalizeT) {
- /* take first texcoords as rough estimate of mean value */
- GLfloat correctionT = -floor(in[1]+0.5);
- for (j = 0; j < VB->Count; ++j) {
- out[j][0] = in[0];
- out[j][1] = in[1] + correctionT;
- in = (GLfloat *)((GLubyte *)in + instride);
- }
- }
-
- if (normalizeS || normalizeT)
- VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i];
- }
- }
-
- return GL_TRUE;
-}
-
-/* Called the first time stage->run() is invoked.
- */
-static GLboolean alloc_texnorm_data( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- struct texnorm_stage_data *store;
- GLuint i;
-
- stage->privatePtr = CALLOC(sizeof(*store));
- store = TEXNORM_STAGE_DATA(stage);
- if (!store)
- return GL_FALSE;
-
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
- _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
-
- return GL_TRUE;
-}
-
-static void validate_texnorm( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage);
- GLuint flags = 0;
-
- if (((ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) &&
- (ctx->Texture.Unit[0]._Current->WrapS == GL_REPEAT)) ||
- ((ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) &&
- (ctx->Texture.Unit[0]._Current->WrapT == GL_REPEAT)))
- flags |= VERT_BIT_TEX0;
-
- if (((ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) &&
- (ctx->Texture.Unit[1]._Current->WrapS == GL_REPEAT)) ||
- ((ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT) &&
- (ctx->Texture.Unit[1]._Current->WrapT == GL_REPEAT)))
- flags |= VERT_BIT_TEX1;
-
- store->active = (flags != 0);
-}
-
-static void free_texnorm_data( struct tnl_pipeline_stage *stage )
-{
- struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage);
- GLuint i;
-
- if (store) {
- for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
- if (store->texcoord[i].data)
- _mesa_vector4f_free( &store->texcoord[i] );
- FREE( store );
- stage->privatePtr = 0;
- }
-}
-
-struct tnl_pipeline_stage _savage_texnorm_stage =
-{
- "savage texture coordinate normalization stage", /* name */
- NULL, /* private data */
- alloc_texnorm_data, /* run -- initially set to init */
- free_texnorm_data, /* destructor */
- validate_texnorm,
- run_texnorm_stage
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.c
deleted file mode 100644
index a261299cc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.c
+++ /dev/null
@@ -1,343 +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 "mtypes.h"
-#include "savagedd.h"
-#include "savagespan.h"
-#include "savageioctl.h"
-#include "savage_bci.h"
-#include "savage_3d_reg.h"
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- savageScreenPrivate *savageScreen = imesa->savageScreen; \
- GLuint cpp = savageScreen->cpp; \
- GLuint pitch = imesa->aperturePitch; \
- GLuint height = dPriv->h; \
- GLubyte *buf = map + \
- dPriv->x * cpp + \
- dPriv->y * pitch; \
- char *read_buf = buf; \
- GLuint p; \
- (void) p
-
-#define LOCAL_DEPTH_VARS \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = imesa->mesa_drawable; \
- savageScreenPrivate *savageScreen = imesa->savageScreen; \
- GLuint zpp = savageScreen->zpp; \
- GLuint pitch = imesa->aperturePitch; \
- GLuint height = dPriv->h; \
- GLubyte *buf = imesa->apertureBase[TARGET_DEPTH] + \
- dPriv->x * zpp + \
- dPriv->y * pitch
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-#define HW_WRITE_LOCK() \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLubyte *map = imesa->drawMap;
-
-#define HW_READ_LOCK() \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLubyte *map = imesa->readMap;
-
-
-/* 16 bit, 565 rgb color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) savage##x##_565
-#define TAG2(x,y) savage##x##_565##y
-#include "spantmp2.h"
-
-
-/* 32 bit, 8888 ARGB color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) savage##x##_8888
-#define TAG2(x,y) savage##x##_8888##y
-#include "spantmp2.h"
-
-
-#undef HW_WRITE_LOCK
-#define HW_WRITE_LOCK()
-#undef HW_READ_LOCK
-#define HW_READ_LOCK()
-
-
-
-/* 16 bit integer depthbuffer functions
- * Depth range is reversed. See also savageCalcViewport.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch) = 0xFFFF - d
-
-#define READ_DEPTH( d, _x, _y ) \
- d = 0xFFFF - *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch)
-
-#define TAG(x) savage##x##_16
-#include "depthtmp.h"
-
-
-
-
-/* 16 bit float depthbuffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch) = \
- savageEncodeFloat16( 1.0 - (GLfloat)d/65535.0 )
-
-#define READ_DEPTH( d, _x, _y ) \
- d = 65535 - \
- savageDecodeFloat16( *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch) ) * \
- 65535.0
-
-#define TAG(x) savage##x##_16f
-#include "depthtmp.h"
-
-
-
-
-/* 8-bit stencil /24-bit integer depth depthbuffer functions.
- * Depth range is reversed. See also savageCalcViewport.
- */
-#define WRITE_DEPTH( _x, _y, d ) do { \
- GLuint tmp = *(GLuint *)(buf + ((_x)<<2) + (_y)*pitch); \
- tmp &= 0xFF000000; \
- tmp |= 0x00FFFFFF - d; \
- *(GLuint *)(buf + (_x<<2) + _y*pitch) = tmp; \
-} while(0)
-
-#define READ_DEPTH( d, _x, _y ) \
- d = 0x00FFFFFF - (*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0x00FFFFFF)
-
-#define TAG(x) savage##x##_8_24
-#include "depthtmp.h"
-
-
-
-
-/* 24 bit float depthbuffer functions
- */
-#define WRITE_DEPTH( _x, _y, d ) do { \
- GLuint tmp = *(GLuint *)(buf + ((_x)<<2) + (_y)*pitch); \
- tmp &= 0xFF000000; \
- tmp |= savageEncodeFloat24( 1.0 - (GLfloat)d/16777215.0 ); \
- *(GLuint *)(buf + (_x<<2) + _y*pitch) = tmp; \
-} while(0)
-
-#define READ_DEPTH( d, _x, _y ) \
- d = 16777215 - savageDecodeFloat24( \
- *(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0x00FFFFFF) \
- * 16777215.0
-
-#define TAG(x) savage##x##_8_24f
-#include "depthtmp.h"
-
-
-#define WRITE_STENCIL( _x, _y, d ) do { \
- GLuint tmp = *(GLuint *)(buf + ((_x)<<2) + (_y)*pitch); \
- tmp &= 0x00FFFFFF; \
- tmp |= (((GLuint)d)<<24) & 0xFF000000; \
- *(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) = tmp; \
-} while(0)
-
-#define READ_STENCIL( d, _x, _y ) \
- d = (GLstencil)((*(GLuint *)(buf + ((_x)<<2) + (_y)*pitch) & 0xFF000000) >> 24)
-
-#define TAG(x) savage##x##_8_24
-#include "stenciltmp.h"
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void savageDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
- GLuint bufferBit)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- char *map;
-
- assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT));
-
- map = (bufferBit == BUFFER_BIT_FRONT_LEFT)
- ? imesa->apertureBase[TARGET_FRONT]
- : imesa->apertureBase[TARGET_BACK];
-
- imesa->drawMap = map;
- imesa->readMap = map;
-
- assert( (buffer == imesa->driDrawable->driverPrivate)
- || (buffer == imesa->driReadable->driverPrivate) );
-
- imesa->mesa_drawable = (buffer == imesa->driDrawable->driverPrivate)
- ? imesa->driDrawable : imesa->driReadable;
-}
-
-/*
- * Wrappers around _swrast_Copy/Draw/ReadPixels that make sure all
- * primitives are flushed and the hardware is idle before accessing
- * the frame buffer.
- */
-static void
-savageCopyPixels( GLcontext *ctx,
- GLint srcx, GLint srcy, GLsizei width, GLsizei height,
- GLint destx, GLint desty,
- GLenum type )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY(imesa);
- _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type);
-}
-static void
-savageDrawPixels( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- const GLvoid *pixels )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY(imesa);
- _swrast_DrawPixels(ctx, x, y, width, height, format, type, packing, pixels);
-}
-static void
-savageReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *pixels )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY(imesa);
- _swrast_ReadPixels(ctx, x, y, width, height, format, type, packing, pixels);
-}
-
-/*
- * Make sure the hardware is idle when span-rendering.
- */
-static void savageSpanRenderStart( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY(imesa);
-}
-
-
-void savageDDInitSpanFuncs( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = savageDDSetBuffer;
- swdd->SpanRenderStart = savageSpanRenderStart;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = savageCopyPixels;
- ctx->Driver.DrawPixels = savageDrawPixels;
- ctx->Driver.ReadPixels = savageReadPixels;
-}
-
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
- GLboolean float_depth)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- savageInitPointers_565(&drb->Base);
- }
- else {
- savageInitPointers_8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- if (float_depth) {
- drb->Base.GetRow = savageReadDepthSpan_16f;
- drb->Base.GetValues = savageReadDepthPixels_16f;
- drb->Base.PutRow = savageWriteDepthSpan_16f;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16f;
- drb->Base.PutValues = savageWriteDepthPixels_16f;
- }
- else {
- drb->Base.GetRow = savageReadDepthSpan_16;
- drb->Base.GetValues = savageReadDepthPixels_16;
- drb->Base.PutRow = savageWriteDepthSpan_16;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16;
- drb->Base.PutValues = savageWriteDepthPixels_16;
- }
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- if (float_depth) {
- drb->Base.GetRow = savageReadDepthSpan_8_24f;
- drb->Base.GetValues = savageReadDepthPixels_8_24f;
- drb->Base.PutRow = savageWriteDepthSpan_8_24f;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24f;
- drb->Base.PutValues = savageWriteDepthPixels_8_24f;
- }
- else {
- drb->Base.GetRow = savageReadDepthSpan_8_24;
- drb->Base.GetValues = savageReadDepthPixels_8_24;
- drb->Base.PutRow = savageWriteDepthSpan_8_24;
- drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24;
- drb->Base.PutValues = savageWriteDepthPixels_8_24;
- }
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = savageReadStencilSpan_8_24;
- drb->Base.GetValues = savageReadStencilPixels_8_24;
- drb->Base.PutRow = savageWriteStencilSpan_8_24;
- drb->Base.PutMonoRow = savageWriteMonoStencilSpan_8_24;
- drb->Base.PutValues = savageWriteStencilPixels_8_24;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.h
deleted file mode 100644
index f6a312e82..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagespan.h
+++ /dev/null
@@ -1,137 +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.
- */
-
-#ifndef _SAVAGE_SPAN_H
-#define _SAVAGE_SPAN_H
-
-#include "drirenderbuffer.h"
-
-
-extern void savageDDInitSpanFuncs( GLcontext *ctx );
-
-extern void
-savageSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis,
- GLboolean float_depth);
-
-
-/*
- * Savage 16-bit float depth format with zExpOffset=16:
- * 4 bit unsigned exponent, 12 bit mantissa
- *
- * The meaning of the mantissa is different from IEEE floatint point
- * formats. The same number can't be encoded with different exponents.
- * So no bits are wasted.
- *
- * exponent | range encoded by mantissa | accuracy or mantissa
- * ---------+---------------------------+---------------------
- * 15 | 2^-1 .. 1 | 2^-13
- * 14 | 2^-2 .. 2^-1 | 2^-14
- * 13 | 2^-3 .. 2^-2 | 2^-15
- * ... | ... |
- * 2 | 2^-14 .. 2^-13 | 2^-27
- * 1 | 2^-15 .. 2^-14 | 2^-27
- * 0 | 2^-16 .. 2^-15 | 2^-28
- *
- * Note that there is no encoding for numbers < 2^-16.
- */
-static __inline GLuint savageEncodeFloat16( GLdouble x )
-{
- GLint r = (GLint)(x * 0x10000000);
- GLint exp = 0;
- if (r < 0x1000)
- return 0;
- while (r - 0x1000 > 0x0fff) {
- r >>= 1;
- exp++;
- }
- return exp > 0xf ? 0xffff : (r - 0x1000) | (exp << 12);
-}
-static __inline GLdouble savageDecodeFloat16( GLuint x )
-{
- static const GLdouble pow2[16] = {
- 1.0/(1<<28), 1.0/(1<<27), 1.0/(1<<26), 1.0/(1<<25),
- 1.0/(1<<24), 1.0/(1<<23), 1.0/(1<<22), 1.0/(1<<21),
- 1.0/(1<<20), 1.0/(1<<19), 1.0/(1<<18), 1.0/(1<<17),
- 1.0/(1<<16), 1.0/(1<<15), 1.0/(1<<14), 1.0/(1<<13)
- };
- static const GLdouble bias[16] = {
- 1.0/(1<<16), 1.0/(1<<15), 1.0/(1<<14), 1.0/(1<<13),
- 1.0/(1<<12), 1.0/(1<<11), 1.0/(1<<10), 1.0/(1<< 9),
- 1.0/(1<< 8), 1.0/(1<< 7), 1.0/(1<< 6), 1.0/(1<< 5),
- 1.0/(1<< 4), 1.0/(1<< 3), 1.0/(1<< 2), 1.0/(1<< 1)
- };
- GLuint mant = x & 0x0fff;
- GLuint exp = (x >> 12) & 0xf;
- return bias[exp] + pow2[exp]*mant;
-}
-
-/*
- * Savage 24-bit float depth format with zExpOffset=32:
- * 5 bit unsigned exponent, 19 bit mantissa
- *
- * Details analogous to the 16-bit format.
- */
-static __inline GLuint savageEncodeFloat24( GLdouble x )
-{
- int64_t r = (int64_t)(x * ((int64_t)1 << (19+32)));
- GLint exp = 0;
- if (r < 0x80000)
- return 0;
- while (r - 0x80000 > 0x7ffff) {
- r >>= 1;
- exp++;
- }
- return exp > 0x1f ? 0xffffff : (r - 0x80000) | (exp << 19);
-}
-#define _1 (int64_t)1
-static __inline GLdouble savageDecodeFloat24( GLuint x )
-{
- static const GLdouble pow2[32] = {
- 1.0/(_1<<51), 1.0/(_1<<50), 1.0/(_1<<49), 1.0/(_1<<48),
- 1.0/(_1<<47), 1.0/(_1<<46), 1.0/(_1<<45), 1.0/(_1<<44),
- 1.0/(_1<<43), 1.0/(_1<<42), 1.0/(_1<<41), 1.0/(_1<<40),
- 1.0/(_1<<39), 1.0/(_1<<38), 1.0/(_1<<37), 1.0/(_1<<36),
- 1.0/(_1<<35), 1.0/(_1<<34), 1.0/(_1<<33), 1.0/(_1<<32),
- 1.0/(_1<<31), 1.0/(_1<<30), 1.0/(_1<<29), 1.0/(_1<<28),
- 1.0/(_1<<27), 1.0/(_1<<26), 1.0/(_1<<25), 1.0/(_1<<24),
- 1.0/(_1<<23), 1.0/(_1<<22), 1.0/(_1<<21), 1.0/(_1<<20)
- };
- static const GLdouble bias[32] = {
- 1.0/(_1<<32), 1.0/(_1<<31), 1.0/(_1<<30), 1.0/(_1<<29),
- 1.0/(_1<<28), 1.0/(_1<<27), 1.0/(_1<<26), 1.0/(_1<<25),
- 1.0/(_1<<24), 1.0/(_1<<23), 1.0/(_1<<22), 1.0/(_1<<21),
- 1.0/(_1<<20), 1.0/(_1<<19), 1.0/(_1<<18), 1.0/(_1<<17),
- 1.0/(_1<<16), 1.0/(_1<<15), 1.0/(_1<<14), 1.0/(_1<<13),
- 1.0/(_1<<12), 1.0/(_1<<11), 1.0/(_1<<10), 1.0/(_1<< 9),
- 1.0/(_1<< 8), 1.0/(_1<< 7), 1.0/(_1<< 6), 1.0/(_1<< 5),
- 1.0/(_1<< 4), 1.0/(_1<< 3), 1.0/(_1<< 2), 1.0/(_1<< 1)
- };
- GLuint mant = x & 0x7ffff;
- GLuint exp = (x >> 19) & 0x1f;
- return bias[exp] + pow2[exp]*mant;
-}
-#undef _1
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.c
deleted file mode 100644
index 996d5b917..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.c
+++ /dev/null
@@ -1,1765 +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 "mtypes.h"
-#include "buffers.h"
-#include "enums.h"
-#include "macros.h"
-#include "dd.h"
-
-#include "mm.h"
-#include "savagedd.h"
-#include "savagecontext.h"
-
-#include "savagestate.h"
-#include "savagetex.h"
-#include "savagetris.h"
-#include "savageioctl.h"
-#include "savage_bci.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "xmlpool.h"
-
-/* Savage4, ProSavage[DDR], SuperSavage watermarks */
-#define S4_ZRLO 24
-#define S4_ZRHI 24
-#define S4_ZWLO 0
-#define S4_ZWHI 0
-
-#define S4_DRLO 0
-#define S4_DRHI 0
-#define S4_DWLO 0
-#define S4_DWHI 0
-
-#define S4_TR 15
-
-/* Savage3D/MX/IX watermarks */
-#define S3D_ZRLO 8
-#define S3D_ZRHI 24
-#define S3D_ZWLO 0
-#define S3D_ZWHI 24
-
-#define S3D_DRLO 0
-#define S3D_DRHI 0
-#define S3D_DWLO 0
-#define S3D_DWHI 0
-
-#define S3D_TR 15
-
-static void savageBlendFunc_s4(GLcontext *);
-static void savageBlendFunc_s3d(GLcontext *);
-
-static __inline__ GLuint savagePackColor(GLuint format,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
- switch (format) {
- case DV_PF_8888:
- return SAVAGEPACKCOLOR8888(r,g,b,a);
- case DV_PF_565:
- return SAVAGEPACKCOLOR565(r,g,b);
- default:
-
- return 0;
- }
-}
-
-
-static void savageDDAlphaFunc_s4(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- savageBlendFunc_s4(ctx);
-}
-static void savageDDAlphaFunc_s3d(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- savageBlendFunc_s3d(ctx);
-}
-
-static void savageDDBlendEquationSeparate(GLcontext *ctx,
- GLenum modeRGB, GLenum modeA)
-{
- assert( modeRGB == modeA );
-
- /* BlendEquation sets ColorLogicOpEnabled in an unexpected
- * manner.
- */
- FALLBACK( ctx, SAVAGE_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
-
- /* Can only do blend addition, not min, max, subtract, etc. */
- FALLBACK( ctx, SAVAGE_FALLBACK_BLEND_EQ,
- modeRGB != GL_FUNC_ADD);
-}
-
-
-static void savageBlendFunc_s4(GLcontext *ctx)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- u_int32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
- u_int32_t drawCtrl0 = imesa->regs.s4.drawCtrl0.ui;
- u_int32_t drawCtrl1 = imesa->regs.s4.drawCtrl1.ui;
-
- /* set up draw control register (including blending, alpha
- * test, and shading model)
- */
-
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_FALSE;
-
- /*
- * blend modes
- */
- if(ctx->Color.BlendEnabled){
- switch (ctx->Color.BlendDstRGB)
- {
- case GL_ZERO:
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_Zero;
- break;
-
- case GL_ONE:
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_One;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_SRC_COLOR:
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_SrcClr;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_SRC_COLOR:
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_1SrcClr;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_SRC_ALPHA:
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_SrcAlpha;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_1SrcAlpha;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_One;
- }
- else
- {
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode= DAM_DstAlpha;
- }
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_Zero;
- }
- else
- {
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode=DAM_1DstAlpha;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites= GL_TRUE;
- }
- break;
- }
-
- switch (ctx->Color.BlendSrcRGB)
- {
- case GL_ZERO:
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_Zero;
- break;
-
- case GL_ONE:
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_One;
- break;
-
- case GL_DST_COLOR:
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_DstClr;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_DST_COLOR:
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_1DstClr;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_SRC_ALPHA:
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_SrcAlpha;
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_1SrcAlpha;
- break;
-
- case GL_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_One;
- }
- else
- {
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode= SAM_DstAlpha;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites= GL_TRUE;
- }
- break;
-
- case GL_ONE_MINUS_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_Zero;
- }
- else
- {
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode=SAM_1DstAlpha;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites= GL_TRUE;
- }
- break;
- }
- }
- else
- {
- imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_Zero;
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_One;
- }
-
- /* alpha test*/
-
- if(ctx->Color.AlphaEnabled)
- {
- ACmpFunc a;
- GLubyte alphaRef;
-
- CLAMPED_FLOAT_TO_UBYTE(alphaRef,ctx->Color.AlphaRef);
-
- switch(ctx->Color.AlphaFunc) {
- case GL_NEVER: a = CF_Never; break;
- case GL_ALWAYS: a = CF_Always; break;
- case GL_LESS: a = CF_Less; break;
- case GL_LEQUAL: a = CF_LessEqual; break;
- case GL_EQUAL: a = CF_Equal; break;
- case GL_GREATER: a = CF_Greater; break;
- case GL_GEQUAL: a = CF_GreaterEqual; break;
- case GL_NOTEQUAL: a = CF_NotEqual; break;
- default:return;
- }
-
- imesa->regs.s4.drawCtrl1.ni.alphaTestEn = GL_TRUE;
- imesa->regs.s4.drawCtrl1.ni.alphaTestCmpFunc = a;
- imesa->regs.s4.drawCtrl0.ni.alphaRefVal = alphaRef;
- }
- else
- {
- imesa->regs.s4.drawCtrl1.ni.alphaTestEn = GL_FALSE;
- }
-
- /* Set/Reset Z-after-alpha*/
-
- imesa->regs.s4.drawLocalCtrl.ni.wrZafterAlphaTst =
- imesa->regs.s4.drawCtrl1.ni.alphaTestEn;
- /*imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn =
- ~drawLocalCtrl.ni.wrZafterAlphaTst;*/
-
- if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
- if (drawCtrl0 != imesa->regs.s4.drawCtrl0.ui ||
- drawCtrl1 != imesa->regs.s4.drawCtrl1.ui)
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
-}
-static void savageBlendFunc_s3d(GLcontext *ctx)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- u_int32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
- u_int32_t zBufCtrl = imesa->regs.s3d.zBufCtrl.ui;
-
- /* set up draw control register (including blending, alpha
- * test, dithering, and shading model)
- */
-
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = 0;
-
- /*
- * blend modes
- */
- if(ctx->Color.BlendEnabled){
- switch (ctx->Color.BlendDstRGB)
- {
- case GL_ZERO:
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_Zero;
- break;
-
- case GL_ONE:
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_One;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_SRC_COLOR:
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_SrcClr;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_SRC_COLOR:
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_1SrcClr;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_SRC_ALPHA:
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_SrcAlpha;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_1SrcAlpha;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_One;
- }
- else
- {
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_DstAlpha;
- }
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_Zero;
- }
- else
- {
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_1DstAlpha;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- }
- break;
- }
-
- switch (ctx->Color.BlendSrcRGB)
- {
- case GL_ZERO:
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_Zero;
- break;
-
- case GL_ONE:
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_One;
- break;
-
- case GL_DST_COLOR:
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_DstClr;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_ONE_MINUS_DST_COLOR:
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_1DstClr;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- break;
-
- case GL_SRC_ALPHA:
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_SrcAlpha;
- break;
-
- case GL_ONE_MINUS_SRC_ALPHA:
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_1SrcAlpha;
- break;
-
- case GL_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_One;
- }
- else
- {
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_DstAlpha;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- }
- break;
-
- case GL_ONE_MINUS_DST_ALPHA:
- if (imesa->glCtx->Visual.alphaBits == 0)
- {
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_Zero;
- }
- else
- {
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_1DstAlpha;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- }
- break;
- }
- }
- else
- {
- imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_Zero;
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_One;
- }
-
- /* alpha test*/
-
- if(ctx->Color.AlphaEnabled)
- {
- ACmpFunc a;
- GLubyte alphaRef;
-
- CLAMPED_FLOAT_TO_UBYTE(alphaRef,ctx->Color.AlphaRef);
-
- switch(ctx->Color.AlphaFunc) {
- case GL_NEVER: a = CF_Never; break;
- case GL_ALWAYS: a = CF_Always; break;
- case GL_LESS: a = CF_Less; break;
- case GL_LEQUAL: a = CF_LessEqual; break;
- case GL_EQUAL: a = CF_Equal; break;
- case GL_GREATER: a = CF_Greater; break;
- case GL_GEQUAL: a = CF_GreaterEqual; break;
- case GL_NOTEQUAL: a = CF_NotEqual; break;
- default:return;
- }
-
- imesa->regs.s3d.drawCtrl.ni.alphaTestEn = GL_TRUE;
- imesa->regs.s3d.drawCtrl.ni.alphaTestCmpFunc = a;
- imesa->regs.s3d.drawCtrl.ni.alphaRefVal = alphaRef;
- }
- else
- {
- imesa->regs.s3d.drawCtrl.ni.alphaTestEn = GL_FALSE;
- }
-
- /* Set/Reset Z-after-alpha*/
-
- imesa->regs.s3d.zBufCtrl.ni.wrZafterAlphaTst =
- imesa->regs.s3d.drawCtrl.ni.alphaTestEn;
-
- if (drawCtrl != imesa->regs.s3d.drawCtrl.ui ||
- zBufCtrl != imesa->regs.s3d.zBufCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
-}
-
-static void savageDDBlendFuncSeparate_s4( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- assert (dfactorRGB == dfactorA && sfactorRGB == sfactorA);
- savageBlendFunc_s4( ctx );
-}
-static void savageDDBlendFuncSeparate_s3d( GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- assert (dfactorRGB == dfactorA && sfactorRGB == sfactorA);
- savageBlendFunc_s3d( ctx );
-}
-
-
-
-static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- ZCmpFunc zmode;
- u_int32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
- u_int32_t zBufCtrl = imesa->regs.s4.zBufCtrl.ui;
- u_int32_t zWatermarks = imesa->regs.s4.zWatermarks.ui; /* FIXME: in DRM */
-
- /* set up z-buffer control register (global)
- * set up z-buffer offset register (global)
- * set up z read/write watermarks register (global)
- */
-
- switch(func) { /* reversed (see savageCalcViewport) */
- case GL_NEVER: zmode = CF_Never; break;
- case GL_ALWAYS: zmode = CF_Always; break;
- case GL_LESS: zmode = CF_Greater; break;
- case GL_LEQUAL: zmode = CF_GreaterEqual; break;
- case GL_EQUAL: zmode = CF_Equal; break;
- case GL_GREATER: zmode = CF_Less; break;
- case GL_GEQUAL: zmode = CF_LessEqual; break;
- case GL_NOTEQUAL: zmode = CF_NotEqual; break;
- default:return;
- }
- if (ctx->Depth.Test)
- {
-
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = zmode;
- imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn = ctx->Depth.Mask;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites = GL_TRUE;
- imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
- }
- else if (imesa->glCtx->Stencil.Enabled && imesa->hw_stencil)
- {
- /* Need to keep Z on for Stencil. */
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Always;
- imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
- imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn = GL_FALSE;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites = GL_FALSE;
- }
- else
- {
-
- if (imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn == GL_FALSE)
- {
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Always;
- imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
- }
- else
-
- /* DRAWUPDATE_REQUIRES_Z_ENABLED*/
- {
- imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_FALSE;
- }
- imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn = GL_FALSE;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites = GL_FALSE;
- }
-
- if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
- if (zBufCtrl != imesa->regs.s4.zBufCtrl.ui ||
- zWatermarks != imesa->regs.s4.zWatermarks.ui)
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
-}
-static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- ZCmpFunc zmode;
- u_int32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
- u_int32_t zBufCtrl = imesa->regs.s3d.zBufCtrl.ui;
- u_int32_t zWatermarks = imesa->regs.s3d.zWatermarks.ui; /* FIXME: in DRM */
-
- /* set up z-buffer control register (global)
- * set up z-buffer offset register (global)
- * set up z read/write watermarks register (global)
- */
- switch(func) { /* reversed (see savageCalcViewport) */
- case GL_NEVER: zmode = CF_Never; break;
- case GL_ALWAYS: zmode = CF_Always; break;
- case GL_LESS: zmode = CF_Greater; break;
- case GL_LEQUAL: zmode = CF_GreaterEqual; break;
- case GL_EQUAL: zmode = CF_Equal; break;
- case GL_GREATER: zmode = CF_Less; break;
- case GL_GEQUAL: zmode = CF_LessEqual; break;
- case GL_NOTEQUAL: zmode = CF_NotEqual; break;
- default:return;
- }
- if (ctx->Depth.Test)
- {
- imesa->regs.s3d.zBufCtrl.ni.zBufEn = GL_TRUE;
- imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = zmode;
- imesa->regs.s3d.zBufCtrl.ni.zUpdateEn = ctx->Depth.Mask;
-
- imesa->regs.s3d.drawCtrl.ni.flushPdZbufWrites = GL_TRUE;
- }
- else
- {
- if (imesa->regs.s3d.zBufCtrl.ni.drawUpdateEn == GL_FALSE) {
- imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = CF_Always;
- imesa->regs.s3d.zBufCtrl.ni.zBufEn = GL_TRUE;
- }
- else
-
- /* DRAWUPDATE_REQUIRES_Z_ENABLED*/
- {
- imesa->regs.s3d.zBufCtrl.ni.zBufEn = GL_FALSE;
- }
- imesa->regs.s3d.zBufCtrl.ni.zUpdateEn = GL_FALSE;
- imesa->regs.s3d.drawCtrl.ni.flushPdZbufWrites = GL_FALSE;
- }
-
- if (drawCtrl != imesa->regs.s3d.drawCtrl.ui ||
- zBufCtrl != imesa->regs.s3d.zBufCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
- if (zWatermarks != imesa->regs.s3d.zWatermarks.ui)
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
-}
-
-static void savageDDDepthMask_s4(GLcontext *ctx, GLboolean flag)
-{
- savageDDDepthFunc_s4(ctx,ctx->Depth.Func);
-}
-static void savageDDDepthMask_s3d(GLcontext *ctx, GLboolean flag)
-{
- savageDDDepthFunc_s3d(ctx,ctx->Depth.Func);
-}
-
-
-
-
-/* =============================================================
- * Hardware clipping
- */
-
-
-static void savageDDScissor( GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
- /* Emit buffered commands with old scissor state. */
- FLUSH_BATCH(imesa);
-
- /* Mirror scissors in private context. */
- imesa->scissor.enabled = ctx->Scissor.Enabled;
- imesa->scissor.x = x;
- imesa->scissor.y = y;
- imesa->scissor.w = w;
- imesa->scissor.h = h;
-}
-
-
-
-static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- u_int32_t destCtrl = imesa->regs.s4.destCtrl.ui;
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- imesa->IsDouble = GL_FALSE;
- imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->frontOffset>>11;
-
- imesa->NotFirstFrame = GL_FALSE;
- savageXMesaSetFrontClipRects( imesa );
- FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BUFFER_BIT_BACK_LEFT:
- imesa->IsDouble = GL_TRUE;
- imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->backOffset>>11;
- imesa->NotFirstFrame = GL_FALSE;
- savageXMesaSetBackClipRects( imesa );
- FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that r200SetBuffer() (?)
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- if (destCtrl != imesa->regs.s4.destCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
-}
-
-static void savageDDReadBuffer(GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-#if 0
-static void savageDDSetColor(GLcontext *ctx,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- imesa->MonoColor = savagePackColor( imesa->savageScreen->frontFormat, r, g, b, a );
-}
-#endif
-
-/* =============================================================
- * Window position and viewport transformation
- */
-
-void savageCalcViewport( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = imesa->hw_viewport;
-
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + imesa->drawX + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + imesa->driDrawable->h + imesa->drawY + SUBPIXEL_Y;
- /* Depth range is reversed (far: 0, near: 1) so that float depth
- * compensates for loss of accuracy of far coordinates. */
- if (imesa->float_depth && imesa->savageScreen->zpp == 2) {
- /* The Savage 16-bit floating point depth format can't encode
- * numbers < 2^-16. Make sure all depth values stay greater
- * than that. */
- m[MAT_SZ] = - v[MAT_SZ] * imesa->depth_scale * (65535.0/65536.0);
- m[MAT_TZ] = 1.0 - v[MAT_TZ] * imesa->depth_scale * (65535.0/65536.0);
- } else {
- m[MAT_SZ] = - v[MAT_SZ] * imesa->depth_scale;
- m[MAT_TZ] = 1.0 - v[MAT_TZ] * imesa->depth_scale;
- }
-
- imesa->SetupNewInputs = ~0;
-}
-
-static void savageViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- savageCalcViewport( ctx );
-}
-
-static void savageDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- savageCalcViewport( ctx );
-}
-
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void savageDDClearColor(GLcontext *ctx,
- const GLfloat color[4] )
-{
- savageContextPtr imesa = SAVAGE_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]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- imesa->ClearColor = savagePackColor( imesa->savageScreen->frontFormat,
- c[0], c[1], c[2], c[3] );
-}
-
-/* Fallback to swrast for select and feedback.
- */
-static void savageRenderMode( GLcontext *ctx, GLenum mode )
-{
- FALLBACK( ctx, SAVAGE_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-
-#if HW_CULL
-
-/* =============================================================
- * Culling - the savage isn't quite as clean here as the rest of
- * its interfaces, but it's not bad.
- */
-static void savageDDCullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLuint cullMode=imesa->LcsCullMode;
- switch (ctx->Polygon.CullFaceMode)
- {
- case GL_FRONT:
- switch (ctx->Polygon.FrontFace)
- {
- case GL_CW:
- cullMode = BCM_CW;
- break;
- case GL_CCW:
- cullMode = BCM_CCW;
- break;
- }
- break;
-
- case GL_BACK:
- switch (ctx->Polygon.FrontFace)
- {
- case GL_CW:
- cullMode = BCM_CCW;
- break;
- case GL_CCW:
- cullMode = BCM_CW;
- break;
- }
- break;
- }
- imesa->LcsCullMode = cullMode;
- imesa->new_state |= SAVAGE_NEW_CULL;
-}
-#endif /* end #if HW_CULL */
-
-static void savageUpdateCull( GLcontext *ctx )
-{
-#if HW_CULL
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLuint cullMode;
- if (ctx->Polygon.CullFlag &&
- imesa->raster_primitive >= GL_TRIANGLES &&
- ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK)
- cullMode = imesa->LcsCullMode;
- else
- cullMode = BCM_None;
- if (imesa->savageScreen->chipset >= S3_SAVAGE4) {
- if (imesa->regs.s4.drawCtrl1.ni.cullMode != cullMode) {
- imesa->regs.s4.drawCtrl1.ni.cullMode = cullMode;
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
- }
- } else {
- if (imesa->regs.s3d.drawCtrl.ni.cullMode != cullMode) {
- imesa->regs.s3d.drawCtrl.ni.cullMode = cullMode;
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
- }
- }
-#endif /* end #if HW_CULL */
-}
-
-
-
-/* =============================================================
- * Color masks
- */
-
-/* Savage4 can disable draw updates when all channels are
- * masked. Savage3D has a bit called drawUpdateEn, but it doesn't seem
- * to have any effect. If only some channels are masked we need a
- * software fallback on all chips.
- */
-static void savageDDColorMask_s4(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- GLboolean passAny, passAll;
-
- if (ctx->Visual.alphaBits) {
- passAny = b || g || r || a;
- passAll = r && g && b && a;
- } else {
- passAny = b || g || r;
- passAll = r && g && b;
- }
-
- if (passAny) {
- if (!imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn) {
- imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn = GL_TRUE;
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
- }
- FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !passAll);
- } else if (imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn) {
- imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn = GL_FALSE;
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
- }
-}
-static void savageDDColorMask_s3d(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- if (ctx->Visual.alphaBits)
- FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b && a));
- else
- FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b));
-}
-
-/* Seperate specular not fully implemented in hardware... Needs
- * some interaction with material state? Just punt to software
- * in all cases?
- * FK: Don't fall back for now. Let's see the failure cases and
- * fix them the right way. I don't see how this could be a
- * hardware limitation.
- */
-static void savageUpdateSpecular_s4(GLcontext *ctx) {
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- u_int32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
-
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
- ctx->Light.Enabled) {
- imesa->regs.s4.drawLocalCtrl.ni.specShadeEn = GL_TRUE;
- /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_TRUE);*/
- } else {
- imesa->regs.s4.drawLocalCtrl.ni.specShadeEn = GL_FALSE;
- /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_FALSE);*/
- }
-
- if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
-}
-static void savageUpdateSpecular_s3d(GLcontext *ctx) {
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- u_int32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
-
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR &&
- ctx->Light.Enabled) {
- imesa->regs.s3d.drawCtrl.ni.specShadeEn = GL_TRUE;
- /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_TRUE);*/
- } else {
- imesa->regs.s3d.drawCtrl.ni.specShadeEn = GL_FALSE;
- /*FALLBACK (ctx, SAVAGE_FALLBACK_SPECULAR, GL_FALSE);*/
- }
-
- if (drawCtrl != imesa->regs.s3d.drawCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
-}
-
-static void savageDDLightModelfv_s4(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- savageUpdateSpecular_s4 (ctx);
-}
-static void savageDDLightModelfv_s3d(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- savageUpdateSpecular_s3d (ctx);
-}
-
-static void savageDDShadeModel_s4(GLcontext *ctx, GLuint mod)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- u_int32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
-
- if (mod == GL_SMOOTH)
- {
- imesa->regs.s4.drawLocalCtrl.ni.flatShadeEn = GL_FALSE;
- }
- else
- {
- imesa->regs.s4.drawLocalCtrl.ni.flatShadeEn = GL_TRUE;
- }
-
- if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
-}
-static void savageDDShadeModel_s3d(GLcontext *ctx, GLuint mod)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- u_int32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
-
- if (mod == GL_SMOOTH)
- {
- imesa->regs.s3d.drawCtrl.ni.flatShadeEn = GL_FALSE;
- }
- else
- {
- imesa->regs.s3d.drawCtrl.ni.flatShadeEn = GL_TRUE;
- }
-
- if (drawCtrl != imesa->regs.s3d.drawCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
-}
-
-
-/* =============================================================
- * Fog
- * The fogCtrl register has the same position and the same layout
- * on savage3d and savage4. No need for two separate functions.
- */
-
-static void savageDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLuint fogClr;
- u_int32_t fogCtrl = imesa->regs.s4.fogCtrl.ui;
-
- /*if ((ctx->Fog.Enabled) &&(pname == GL_FOG_COLOR))*/
- if (ctx->Fog.Enabled)
- {
- fogClr = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
- imesa->regs.s4.fogCtrl.ni.fogEn = GL_TRUE;
- /*cheap fog*/
- imesa->regs.s4.fogCtrl.ni.fogMode = GL_TRUE;
- imesa->regs.s4.fogCtrl.ni.fogClr = fogClr;
- }
- else
- {
- /*No fog*/
-
- imesa->regs.s4.fogCtrl.ni.fogEn = 0;
- imesa->regs.s4.fogCtrl.ni.fogMode = 0;
- }
-
- if (fogCtrl != imesa->regs.s4.fogCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
-}
-
-
-static void savageDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref,
- GLuint mask)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- unsigned a=0;
- const u_int32_t zBufCtrl = imesa->regs.s4.zBufCtrl.ui;
- const u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui;
-
- imesa->regs.s4.zBufCtrl.ni.stencilRefVal = ctx->Stencil.Ref[0];
- imesa->regs.s4.stencilCtrl.ni.readMask = ctx->Stencil.ValueMask[0];
-
- switch (ctx->Stencil.Function[0])
- {
- case GL_NEVER: a = CF_Never; break;
- case GL_ALWAYS: a = CF_Always; break;
- case GL_LESS: a = CF_Less; break;
- case GL_LEQUAL: a = CF_LessEqual; break;
- case GL_EQUAL: a = CF_Equal; break;
- case GL_GREATER: a = CF_Greater; break;
- case GL_GEQUAL: a = CF_GreaterEqual; break;
- case GL_NOTEQUAL: a = CF_NotEqual; break;
- default:
- break;
- }
-
- imesa->regs.s4.stencilCtrl.ni.cmpFunc = a;
-
- if (zBufCtrl != imesa->regs.s4.zBufCtrl.ui ||
- stencilCtrl != imesa->regs.s4.stencilCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
-}
-
-static void savageDDStencilMask(GLcontext *ctx, GLuint mask)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
- if (imesa->regs.s4.stencilCtrl.ni.writeMask != ctx->Stencil.WriteMask[0]) {
- imesa->regs.s4.stencilCtrl.ni.writeMask = ctx->Stencil.WriteMask[0];
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
- }
-}
-
-static unsigned get_stencil_op_value( GLenum op )
-{
- switch (op)
- {
- case GL_KEEP: return STENCIL_Keep;
- case GL_ZERO: return STENCIL_Zero;
- case GL_REPLACE: return STENCIL_Equal;
- case GL_INCR: return STENCIL_IncClamp;
- case GL_DECR: return STENCIL_DecClamp;
- case GL_INVERT: return STENCIL_Invert;
- case GL_INCR_WRAP: return STENCIL_Inc;
- case GL_DECR_WRAP: return STENCIL_Dec;
- }
-
- /* Should *never* get here. */
- return STENCIL_Keep;
-}
-
-static void savageDDStencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- const u_int32_t stencilCtrl = imesa->regs.s4.stencilCtrl.ui;
-
- imesa->regs.s4.stencilCtrl.ni.failOp = get_stencil_op_value( ctx->Stencil.FailFunc[0] );
- imesa->regs.s4.stencilCtrl.ni.passZfailOp = get_stencil_op_value( ctx->Stencil.ZFailFunc[0] );
- imesa->regs.s4.stencilCtrl.ni.passZpassOp = get_stencil_op_value( ctx->Stencil.ZPassFunc[0] );
-
- if (stencilCtrl != imesa->regs.s4.stencilCtrl.ui)
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
-}
-
-
-/* =============================================================
- */
-
-static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state)
-{
-
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- switch(cap) {
- case GL_ALPHA_TEST:
- /* we should consider the disable case*/
- savageBlendFunc_s4(ctx);
- break;
- case GL_BLEND:
- /*add the savageBlendFunc 2001/11/25
- * if call no such function, then glDisable(GL_BLEND) will do noting,
- *our chip has no disable bit
- */
- savageBlendFunc_s4(ctx);
- case GL_COLOR_LOGIC_OP:
- /* Fall through:
- * For some reason enable(GL_BLEND) affects ColorLogicOpEnabled.
- */
- FALLBACK (ctx, SAVAGE_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
- case GL_DEPTH_TEST:
- savageDDDepthFunc_s4(ctx,ctx->Depth.Func);
- break;
- case GL_SCISSOR_TEST:
- savageDDScissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height);
- break;
- case GL_STENCIL_TEST:
- if (!imesa->hw_stencil)
- FALLBACK (ctx, SAVAGE_FALLBACK_STENCIL, state);
- else {
- imesa->regs.s4.stencilCtrl.ni.stencilEn = state;
- if (ctx->Stencil.Enabled &&
- imesa->regs.s4.zBufCtrl.ni.zBufEn != GL_TRUE)
- {
- /* Stencil buffer requires Z enabled. */
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Always;
- imesa->regs.s4.zBufCtrl.ni.zBufEn = GL_TRUE;
- imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn = GL_FALSE;
- }
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL | SAVAGE_UPLOAD_LOCAL;
- }
- break;
- case GL_FOG:
- savageDDFogfv(ctx,0,0);
- break;
- case GL_CULL_FACE:
-#if HW_CULL
- if (state)
- {
- savageDDCullFaceFrontFace(ctx,0);
- }
- else
- {
- imesa->LcsCullMode = BCM_None;
- imesa->new_state |= SAVAGE_NEW_CULL;
- }
-#endif
- break;
- case GL_DITHER:
- if (state)
- {
- if ( ctx->Color.DitherFlag )
- {
- imesa->regs.s4.drawCtrl1.ni.ditherEn=GL_TRUE;
- }
- }
- if (!ctx->Color.DitherFlag )
- {
- imesa->regs.s4.drawCtrl1.ni.ditherEn=GL_FALSE;
- }
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
- break;
-
- case GL_LIGHTING:
- savageUpdateSpecular_s4 (ctx);
- break;
- case GL_TEXTURE_1D:
- case GL_TEXTURE_3D:
- imesa->new_state |= SAVAGE_NEW_TEXTURE;
- break;
- case GL_TEXTURE_2D:
- imesa->new_state |= SAVAGE_NEW_TEXTURE;
- break;
- default:
- ;
- }
-}
-static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state)
-{
-
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- switch(cap) {
- case GL_ALPHA_TEST:
- /* we should consider the disable case*/
- savageBlendFunc_s3d(ctx);
- break;
- case GL_BLEND:
- /*add the savageBlendFunc 2001/11/25
- * if call no such function, then glDisable(GL_BLEND) will do noting,
- *our chip has no disable bit
- */
- savageBlendFunc_s3d(ctx);
- case GL_COLOR_LOGIC_OP:
- /* Fall through:
- * For some reason enable(GL_BLEND) affects ColorLogicOpEnabled.
- */
- FALLBACK (ctx, SAVAGE_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
- case GL_DEPTH_TEST:
- savageDDDepthFunc_s3d(ctx,ctx->Depth.Func);
- break;
- case GL_SCISSOR_TEST:
- savageDDScissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height);
- break;
- case GL_STENCIL_TEST:
- FALLBACK (ctx, SAVAGE_FALLBACK_STENCIL, state);
- break;
- case GL_FOG:
- savageDDFogfv(ctx,0,0);
- break;
- case GL_CULL_FACE:
-#if HW_CULL
- if (state)
- {
- savageDDCullFaceFrontFace(ctx,0);
- }
- else
- {
- imesa->LcsCullMode = BCM_None;
- imesa->new_state |= SAVAGE_NEW_CULL;
- }
-#endif
- break;
- case GL_DITHER:
- if (state)
- {
- if ( ctx->Color.DitherFlag )
- {
- imesa->regs.s3d.drawCtrl.ni.ditherEn=GL_TRUE;
- }
- }
- if (!ctx->Color.DitherFlag )
- {
- imesa->regs.s3d.drawCtrl.ni.ditherEn=GL_FALSE;
- }
- imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
- break;
-
- case GL_LIGHTING:
- savageUpdateSpecular_s3d (ctx);
- break;
- case GL_TEXTURE_1D:
- case GL_TEXTURE_3D:
- imesa->new_state |= SAVAGE_NEW_TEXTURE;
- break;
- case GL_TEXTURE_2D:
- imesa->new_state |= SAVAGE_NEW_TEXTURE;
- break;
- default:
- ;
- }
-}
-
-void savageDDUpdateHwState( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
- if (imesa->new_state) {
- savageFlushVertices(imesa);
- if (imesa->new_state & SAVAGE_NEW_TEXTURE) {
- savageUpdateTextureState( ctx );
- }
- if ((imesa->new_state & SAVAGE_NEW_CULL)) {
- savageUpdateCull(ctx);
- }
- imesa->new_state = 0;
- }
-}
-
-
-static void savageDDPrintDirty( const char *msg, GLuint state )
-{
- fprintf(stderr, "%s (0x%x): %s%s%s%s%s%s\n",
- msg,
- (unsigned int) state,
- (state & SAVAGE_UPLOAD_LOCAL) ? "upload-local, " : "",
- (state & SAVAGE_UPLOAD_TEX0) ? "upload-tex0, " : "",
- (state & SAVAGE_UPLOAD_TEX1) ? "upload-tex1, " : "",
- (state & SAVAGE_UPLOAD_FOGTBL) ? "upload-fogtbl, " : "",
- (state & SAVAGE_UPLOAD_GLOBAL) ? "upload-global, " : "",
- (state & SAVAGE_UPLOAD_TEXGLOBAL) ? "upload-texglobal, " : ""
- );
-}
-
-
-/**
- * Check if global registers were changed
- */
-static GLboolean savageGlobalRegChanged (savageContextPtr imesa,
- GLuint first, GLuint last) {
- GLuint i;
- for (i = first - SAVAGE_FIRST_REG; i <= last - SAVAGE_FIRST_REG; ++i) {
- if (((imesa->oldRegs.ui[i] ^ imesa->regs.ui[i]) &
- imesa->globalRegMask.ui[i]) != 0)
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-static void savageEmitOldRegs (savageContextPtr imesa,
- GLuint first, GLuint last, GLboolean global) {
- GLuint n = last-first+1;
- drm_savage_cmd_header_t *cmd = savageAllocCmdBuf(imesa, n*4);
- cmd->state.cmd = SAVAGE_CMD_STATE;
- cmd->state.global = global;
- cmd->state.count = n;
- cmd->state.start = first;
- memcpy(cmd+1, &imesa->oldRegs.ui[first-SAVAGE_FIRST_REG], n*4);
-}
-static void savageEmitContiguousRegs (savageContextPtr imesa,
- GLuint first, GLuint last) {
- GLuint i;
- GLuint n = last-first+1;
- drm_savage_cmd_header_t *cmd = savageAllocCmdBuf(imesa, n*4);
- cmd->state.cmd = SAVAGE_CMD_STATE;
- cmd->state.global = savageGlobalRegChanged(imesa, first, last);
- cmd->state.count = n;
- cmd->state.start = first;
- memcpy(cmd+1, &imesa->regs.ui[first-SAVAGE_FIRST_REG], n*4);
- /* savageAllocCmdBuf may need to flush the cmd buffer and backup
- * the current hardware state. It should see the "old" (current)
- * state that has actually been emitted to the hardware. Therefore
- * this update is done *after* savageAllocCmdBuf. */
- for (i = first - SAVAGE_FIRST_REG; i <= last - SAVAGE_FIRST_REG; ++i)
- imesa->oldRegs.ui[i] = imesa->regs.ui[i];
- if (SAVAGE_DEBUG & DEBUG_STATE)
- fprintf (stderr, "Emitting regs 0x%02x-0x%02x\n", first, last);
-}
-static void savageEmitChangedRegs (savageContextPtr imesa,
- GLuint first, GLuint last) {
- GLuint i, firstChanged;
- firstChanged = SAVAGE_NR_REGS;
- for (i = first - SAVAGE_FIRST_REG; i <= last - SAVAGE_FIRST_REG; ++i) {
- if (imesa->oldRegs.ui[i] != imesa->regs.ui[i]) {
- if (firstChanged == SAVAGE_NR_REGS)
- firstChanged = i;
- } else {
- if (firstChanged != SAVAGE_NR_REGS) {
- savageEmitContiguousRegs (imesa, firstChanged+SAVAGE_FIRST_REG,
- i-1+SAVAGE_FIRST_REG);
- firstChanged = SAVAGE_NR_REGS;
- }
- }
- }
- if (firstChanged != SAVAGE_NR_REGS)
- savageEmitContiguousRegs (imesa, firstChanged+SAVAGE_FIRST_REG,
- last);
-}
-static void savageEmitChangedRegChunk (savageContextPtr imesa,
- GLuint first, GLuint last) {
- GLuint i;
- for (i = first - SAVAGE_FIRST_REG; i <= last - SAVAGE_FIRST_REG; ++i) {
- if (imesa->oldRegs.ui[i] != imesa->regs.ui[i]) {
- savageEmitContiguousRegs (imesa, first, last);
- break;
- }
- }
-}
-static void savageUpdateRegister_s4(savageContextPtr imesa)
-{
- /* In case the texture image was changed without changing the
- * texture address as well, we need to force emitting the texture
- * address in order to flush texture cashes. */
- if ((imesa->dirty & SAVAGE_UPLOAD_TEX0) &&
- imesa->oldRegs.s4.texAddr[0].ui == imesa->regs.s4.texAddr[0].ui)
- imesa->oldRegs.s4.texAddr[0].ui = 0xffffffff;
- if ((imesa->dirty & SAVAGE_UPLOAD_TEX1) &&
- imesa->oldRegs.s4.texAddr[1].ui == imesa->regs.s4.texAddr[1].ui)
- imesa->oldRegs.s4.texAddr[1].ui = 0xffffffff;
-
- /* Fix up watermarks */
- if (imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites) {
- imesa->regs.s4.destTexWatermarks.ni.destWriteLow = 0;
- imesa->regs.s4.destTexWatermarks.ni.destFlush = 1;
- } else
- imesa->regs.s4.destTexWatermarks.ni.destWriteLow = S4_DWLO;
- if (imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites)
- imesa->regs.s4.zWatermarks.ni.wLow = 0;
- else
- imesa->regs.s4.zWatermarks.ni.wLow = S4_ZWLO;
-
- savageEmitChangedRegs (imesa, 0x1e, 0x39);
-
- imesa->dirty=0;
-}
-static void savageUpdateRegister_s3d(savageContextPtr imesa)
-{
- /* In case the texture image was changed without changing the
- * texture address as well, we need to force emitting the texture
- * address in order to flush texture cashes. */
- if ((imesa->dirty & SAVAGE_UPLOAD_TEX0) &&
- imesa->oldRegs.s3d.texAddr.ui == imesa->regs.s3d.texAddr.ui)
- imesa->oldRegs.s3d.texAddr.ui = 0xffffffff;
-
- /* Fix up watermarks */
- if (imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites) {
- imesa->regs.s3d.destTexWatermarks.ni.destWriteLow = 0;
- imesa->regs.s3d.destTexWatermarks.ni.destFlush = 1;
- } else
- imesa->regs.s3d.destTexWatermarks.ni.destWriteLow = S3D_DWLO;
- if (imesa->regs.s3d.drawCtrl.ni.flushPdZbufWrites)
- imesa->regs.s3d.zWatermarks.ni.wLow = 0;
- else
- imesa->regs.s3d.zWatermarks.ni.wLow = S3D_ZWLO;
-
-
- /* the savage3d uses two contiguous ranges of BCI registers:
- * 0x18-0x1c and 0x20-0x38. Some texture registers need to be
- * emitted in one chunk or we get some funky rendering errors. */
- savageEmitChangedRegs (imesa, 0x18, 0x19);
- savageEmitChangedRegChunk (imesa, 0x1a, 0x1c);
- savageEmitChangedRegs (imesa, 0x20, 0x38);
-
- imesa->dirty=0;
-}
-
-
-void savageEmitOldState( savageContextPtr imesa )
-{
- assert(imesa->cmdBuf.write == imesa->cmdBuf.base);
- if (imesa->savageScreen->chipset >= S3_SAVAGE4) {
- savageEmitOldRegs (imesa, 0x1e, 0x39, GL_TRUE);
- } else {
- savageEmitOldRegs (imesa, 0x18, 0x1c, GL_TRUE);
- savageEmitOldRegs (imesa, 0x20, 0x38, GL_FALSE);
- }
-}
-
-
-/* Push the state into the sarea and/or texture memory.
- */
-void savageEmitChangedState( savageContextPtr imesa )
-{
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_API)
- savageDDPrintDirty( "\n\n\nsavageEmitHwStateLocked", imesa->dirty );
-
- if (imesa->dirty)
- {
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf (stderr, "... emitting state\n");
- if (imesa->savageScreen->chipset >= S3_SAVAGE4)
- savageUpdateRegister_s4(imesa);
- else
- savageUpdateRegister_s3d(imesa);
- }
-
- imesa->dirty = 0;
-}
-
-
-static void savageDDInitState_s4( savageContextPtr imesa )
-{
-#if 1
- imesa->regs.s4.destCtrl.ui = 1<<7;
-#endif
-
- imesa->regs.s4.zBufCtrl.ni.zCmpFunc = CF_Less;
- imesa->regs.s4.zBufCtrl.ni.wToZEn = GL_TRUE;
- if (imesa->float_depth) {
- imesa->regs.s4.zBufCtrl.ni.zExpOffset =
- imesa->savageScreen->zpp == 2 ? 16 : 32;
- imesa->regs.s4.zBufCtrl.ni.floatZEn = GL_TRUE;
- } else {
- imesa->regs.s4.zBufCtrl.ni.zExpOffset = 0;
- imesa->regs.s4.zBufCtrl.ni.floatZEn = GL_FALSE;
- }
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_NoTexMap;
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_NoTexMap1;
- imesa->regs.s4.drawCtrl0.ui = 0;
-#if 0
- imesa->regs.s4.drawCtrl1.ni.xyOffsetEn = 1;
-#endif
-
- /* Set DestTexWatermarks_31,30 to 01 always.
- *Has no effect if dest. flush is disabled.
- */
-#if 0
- imesa->regs.s4.zWatermarks.ui = 0x12000C04;
- imesa->regs.s4.destTexWatermarks.ui = 0x40200400;
-#else
- /*imesa->regs.s4.zWatermarks.ui = 0x16001808;*/
- imesa->regs.s4.zWatermarks.ni.rLow = S4_ZRLO;
- imesa->regs.s4.zWatermarks.ni.rHigh = S4_ZRHI;
- imesa->regs.s4.zWatermarks.ni.wLow = S4_ZWLO;
- imesa->regs.s4.zWatermarks.ni.wHigh = S4_ZWHI;
- /*imesa->regs.s4.destTexWatermarks.ui = 0x4f000000;*/
- imesa->regs.s4.destTexWatermarks.ni.destReadLow = S4_DRLO;
- imesa->regs.s4.destTexWatermarks.ni.destReadHigh = S4_DRHI;
- imesa->regs.s4.destTexWatermarks.ni.destWriteLow = S4_DWLO;
- imesa->regs.s4.destTexWatermarks.ni.destWriteHigh = S4_DWHI;
- imesa->regs.s4.destTexWatermarks.ni.texRead = S4_TR;
- imesa->regs.s4.destTexWatermarks.ni.destFlush = 1;
-#endif
- imesa->regs.s4.drawCtrl0.ni.dPerfAccelEn = GL_TRUE;
-
- /* clrCmpAlphaBlendCtrl is needed to get alphatest and
- * alpha blending working properly
- */
-
- imesa->regs.s4.texCtrl[0].ni.dBias = 0x08;
- imesa->regs.s4.texCtrl[1].ni.dBias = 0x08;
- imesa->regs.s4.texCtrl[0].ni.texXprEn = GL_TRUE;
- imesa->regs.s4.texCtrl[1].ni.texXprEn = GL_TRUE;
- imesa->regs.s4.texCtrl[0].ni.dMax = 0x0f;
- imesa->regs.s4.texCtrl[1].ni.dMax = 0x0f;
- /* programm a valid tex address, in case texture state is emitted
- * in wrong order. */
- if (imesa->lastTexHeap == 2 && imesa->savageScreen->textureSize[1]) {
- /* AGP textures available */
- imesa->regs.s4.texAddr[0].ui = imesa->savageScreen->textureOffset[1]|3;
- imesa->regs.s4.texAddr[1].ui = imesa->savageScreen->textureOffset[1]|3;
- } else {
- /* no AGP textures available, use local */
- imesa->regs.s4.texAddr[0].ui = imesa->savageScreen->textureOffset[0]|2;
- imesa->regs.s4.texAddr[1].ui = imesa->savageScreen->textureOffset[0]|2;
- }
- imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn = GL_TRUE;
- imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_One;
- imesa->regs.s4.drawLocalCtrl.ni.wrZafterAlphaTst = GL_FALSE;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdZbufWrites= GL_TRUE;
- imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites= GL_TRUE;
-
- imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn= GL_TRUE;
- imesa->regs.s4.drawCtrl1.ni.ditherEn = (
- driQueryOptioni(&imesa->optionCache, "color_reduction") ==
- DRI_CONF_COLOR_REDUCTION_DITHER) ? GL_TRUE : GL_FALSE;
- imesa->regs.s4.drawCtrl1.ni.cullMode = BCM_None;
-
- imesa->regs.s4.zBufCtrl.ni.stencilRefVal = 0x00;
-
- imesa->regs.s4.stencilCtrl.ni.stencilEn = GL_FALSE;
- imesa->regs.s4.stencilCtrl.ni.cmpFunc = CF_Always;
- imesa->regs.s4.stencilCtrl.ni.failOp = STENCIL_Keep;
- imesa->regs.s4.stencilCtrl.ni.passZfailOp = STENCIL_Keep;
- imesa->regs.s4.stencilCtrl.ni.passZpassOp = STENCIL_Keep;
- imesa->regs.s4.stencilCtrl.ni.writeMask = 0xff;
- imesa->regs.s4.stencilCtrl.ni.readMask = 0xff;
-
- imesa->LcsCullMode=BCM_None;
- imesa->regs.s4.texDescr.ni.palSize = TPS_256;
-
- /* clear the local registers in the global reg mask */
- imesa->globalRegMask.s4.drawLocalCtrl.ui = 0;
- imesa->globalRegMask.s4.texPalAddr.ui = 0;
- imesa->globalRegMask.s4.texCtrl[0].ui = 0;
- imesa->globalRegMask.s4.texCtrl[1].ui = 0;
- imesa->globalRegMask.s4.texAddr[0].ui = 0;
- imesa->globalRegMask.s4.texAddr[1].ui = 0;
- imesa->globalRegMask.s4.texBlendCtrl[0].ui = 0;
- imesa->globalRegMask.s4.texBlendCtrl[1].ui = 0;
- imesa->globalRegMask.s4.texXprClr.ui = 0;
- imesa->globalRegMask.s4.texDescr.ui = 0;
-}
-static void savageDDInitState_s3d( savageContextPtr imesa )
-{
-#if 1
- imesa->regs.s3d.destCtrl.ui = 1<<7;
-#endif
-
- imesa->regs.s3d.zBufCtrl.ni.zCmpFunc = CF_Less;
-#if 0
- imesa->regs.s3d.drawCtrl.ni.xyOffsetEn = 1;
-#endif
-
- /* Set DestTexWatermarks_31,30 to 01 always.
- *Has no effect if dest. flush is disabled.
- */
-#if 0
- imesa->regs.s3d.zWatermarks.ui = 0x12000C04;
- imesa->regs.s3d.destTexWatermarks.ui = 0x40200400;
-#else
- /*imesa->regs.s3d.zWatermarks.ui = 0x16001808;*/
- imesa->regs.s3d.zWatermarks.ni.rLow = S3D_ZRLO;
- imesa->regs.s3d.zWatermarks.ni.rHigh = S3D_ZRHI;
- imesa->regs.s3d.zWatermarks.ni.wLow = S3D_ZWLO;
- imesa->regs.s3d.zWatermarks.ni.wHigh = S3D_ZWHI;
- /*imesa->regs.s3d.destTexWatermarks.ui = 0x4f000000;*/
- imesa->regs.s3d.destTexWatermarks.ni.destReadLow = S3D_DRLO;
- imesa->regs.s3d.destTexWatermarks.ni.destReadHigh = S3D_DRHI;
- imesa->regs.s3d.destTexWatermarks.ni.destWriteLow = S3D_DWLO;
- imesa->regs.s3d.destTexWatermarks.ni.destWriteHigh = S3D_DWHI;
- imesa->regs.s3d.destTexWatermarks.ni.texRead = S3D_TR;
- imesa->regs.s3d.destTexWatermarks.ni.destFlush = 1;
-#endif
-
- imesa->regs.s3d.texCtrl.ni.dBias = 0x08;
- imesa->regs.s3d.texCtrl.ni.texXprEn = GL_TRUE;
- /* texXprEn is needed to get alphatest and alpha blending working
- * properly. However, this makes texels with color texXprClr
- * completely transparent in some texture environment modes. I
- * couldn't find a way to disable this. So choose an arbitrary and
- * improbable color. (0 is a bad choice, makes all black texels
- * transparent.) */
- imesa->regs.s3d.texXprClr.ui = 0x26ae26ae;
- /* programm a valid tex address, in case texture state is emitted
- * in wrong order. */
- if (imesa->lastTexHeap == 2 && imesa->savageScreen->textureSize[1]) {
- /* AGP textures available */
- imesa->regs.s3d.texAddr.ui = imesa->savageScreen->textureOffset[1]|3;
- } else {
- /* no AGP textures available, use local */
- imesa->regs.s3d.texAddr.ui = imesa->savageScreen->textureOffset[0]|2;
- }
-
- imesa->regs.s3d.zBufCtrl.ni.drawUpdateEn = GL_TRUE;
- imesa->regs.s3d.zBufCtrl.ni.wrZafterAlphaTst = GL_FALSE;
- imesa->regs.s3d.zBufCtrl.ni.zUpdateEn = GL_TRUE;
-
- imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_One;
- imesa->regs.s3d.drawCtrl.ni.flushPdZbufWrites = GL_TRUE;
- imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
-
- imesa->regs.s3d.drawCtrl.ni.ditherEn = (
- driQueryOptioni(&imesa->optionCache, "color_reduction") ==
- DRI_CONF_COLOR_REDUCTION_DITHER) ? GL_TRUE : GL_FALSE;
- imesa->regs.s3d.drawCtrl.ni.cullMode = BCM_None;
-
- imesa->LcsCullMode = BCM_None;
- imesa->regs.s3d.texDescr.ni.palSize = TPS_256;
-
- /* clear the local registers in the global reg mask */
- imesa->globalRegMask.s3d.texPalAddr.ui = 0;
- imesa->globalRegMask.s3d.texXprClr.ui = 0;
- imesa->globalRegMask.s3d.texAddr.ui = 0;
- imesa->globalRegMask.s3d.texDescr.ui = 0;
- imesa->globalRegMask.s3d.texCtrl.ui = 0;
-
- imesa->globalRegMask.s3d.fogCtrl.ui = 0;
-
- /* drawCtrl is local with some exceptions */
- imesa->globalRegMask.s3d.drawCtrl.ui = 0;
- imesa->globalRegMask.s3d.drawCtrl.ni.cullMode = 0x3;
- imesa->globalRegMask.s3d.drawCtrl.ni.alphaTestCmpFunc = 0x7;
- imesa->globalRegMask.s3d.drawCtrl.ni.alphaTestEn = 0x1;
- imesa->globalRegMask.s3d.drawCtrl.ni.alphaRefVal = 0xff;
-
- /* zBufCtrl is local with some exceptions */
- imesa->globalRegMask.s3d.zBufCtrl.ui = 0;
- imesa->globalRegMask.s3d.zBufCtrl.ni.zCmpFunc = 0x7;
- imesa->globalRegMask.s3d.zBufCtrl.ni.zBufEn = 0x1;
-}
-void savageDDInitState( savageContextPtr imesa ) {
- memset (imesa->regs.ui, 0, SAVAGE_NR_REGS*sizeof(u_int32_t));
- memset (imesa->globalRegMask.ui, 0xff, SAVAGE_NR_REGS*sizeof(u_int32_t));
- if (imesa->savageScreen->chipset >= S3_SAVAGE4)
- savageDDInitState_s4 (imesa);
- else
- savageDDInitState_s3d (imesa);
-
- /*fprintf(stderr,"DBflag:%d\n",imesa->glCtx->Visual->DBflag);*/
- /* zbufoffset and destctrl have the same position and layout on
- * savage4 and savage3d. */
- if (imesa->glCtx->Visual.doubleBufferMode) {
- imesa->IsDouble = GL_TRUE;
- imesa->toggle = TARGET_BACK;
- imesa->regs.s4.destCtrl.ni.offset =
- imesa->savageScreen->backOffset>>11;
- } else {
- imesa->IsDouble = GL_FALSE;
- imesa->toggle = TARGET_FRONT;
- imesa->regs.s4.destCtrl.ni.offset =
- imesa->savageScreen->frontOffset>>11;
- }
- if(imesa->savageScreen->cpp == 2) {
- imesa->regs.s4.destCtrl.ni.dstPixFmt = 0;
- imesa->regs.s4.destCtrl.ni.dstWidthInTile =
- (imesa->savageScreen->width+63)>>6;
- } else {
- imesa->regs.s4.destCtrl.ni.dstPixFmt = 1;
- imesa->regs.s4.destCtrl.ni.dstWidthInTile =
- (imesa->savageScreen->width+31)>>5;
- }
- imesa->drawMap = imesa->apertureBase[imesa->toggle];
- imesa->readMap = imesa->apertureBase[imesa->toggle];
- imesa->NotFirstFrame = GL_FALSE;
-
- imesa->regs.s4.zBufOffset.ni.offset=imesa->savageScreen->depthOffset>>11;
- if(imesa->savageScreen->zpp == 2) {
- imesa->regs.s4.zBufOffset.ni.zBufWidthInTiles =
- (imesa->savageScreen->width+63)>>6;
- imesa->regs.s4.zBufOffset.ni.zDepthSelect = 0;
- } else {
- imesa->regs.s4.zBufOffset.ni.zBufWidthInTiles =
- (imesa->savageScreen->width+31)>>5;
- imesa->regs.s4.zBufOffset.ni.zDepthSelect = 1;
- }
-
- memcpy (imesa->oldRegs.ui, imesa->regs.ui, SAVAGE_NR_REGS*sizeof(u_int32_t));
-
- /* Emit the initial state to the (empty) command buffer. */
- assert (imesa->cmdBuf.write == imesa->cmdBuf.base);
- savageEmitOldState(imesa);
- imesa->cmdBuf.start = imesa->cmdBuf.write;
-}
-
-
-#define INTERESTED (~(NEW_MODELVIEW|NEW_PROJECTION|\
- NEW_TEXTURE_MATRIX|\
- NEW_USER_CLIP|NEW_CLIENT_STATE))
-
-static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- SAVAGE_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-void savageDDInitStateFuncs(GLcontext *ctx)
-{
- ctx->Driver.UpdateState = savageDDInvalidateState;
- ctx->Driver.BlendEquationSeparate = savageDDBlendEquationSeparate;
- ctx->Driver.Fogfv = savageDDFogfv;
- ctx->Driver.Scissor = savageDDScissor;
-#if HW_CULL
- ctx->Driver.CullFace = savageDDCullFaceFrontFace;
- ctx->Driver.FrontFace = savageDDCullFaceFrontFace;
-#else
- ctx->Driver.CullFace = 0;
- ctx->Driver.FrontFace = 0;
-#endif /* end #if HW_CULL */
- ctx->Driver.PolygonMode=NULL;
- ctx->Driver.PolygonStipple = 0;
- ctx->Driver.LineStipple = 0;
- ctx->Driver.LineWidth = 0;
- ctx->Driver.LogicOpcode = 0;
- ctx->Driver.DrawBuffer = savageDDDrawBuffer;
- ctx->Driver.ReadBuffer = savageDDReadBuffer;
- ctx->Driver.ClearColor = savageDDClearColor;
-
- ctx->Driver.DepthRange = savageDepthRange;
- ctx->Driver.Viewport = savageViewport;
- ctx->Driver.RenderMode = savageRenderMode;
-
- ctx->Driver.ClearIndex = 0;
- ctx->Driver.IndexMask = 0;
-
- if (SAVAGE_CONTEXT( ctx )->savageScreen->chipset >= S3_SAVAGE4) {
- ctx->Driver.Enable = savageDDEnable_s4;
- ctx->Driver.AlphaFunc = savageDDAlphaFunc_s4;
- ctx->Driver.DepthFunc = savageDDDepthFunc_s4;
- ctx->Driver.DepthMask = savageDDDepthMask_s4;
- ctx->Driver.BlendFuncSeparate = savageDDBlendFuncSeparate_s4;
- ctx->Driver.ColorMask = savageDDColorMask_s4;
- ctx->Driver.ShadeModel = savageDDShadeModel_s4;
- ctx->Driver.LightModelfv = savageDDLightModelfv_s4;
- ctx->Driver.StencilFunc = savageDDStencilFunc;
- ctx->Driver.StencilMask = savageDDStencilMask;
- ctx->Driver.StencilOp = savageDDStencilOp;
- } else {
- ctx->Driver.Enable = savageDDEnable_s3d;
- ctx->Driver.AlphaFunc = savageDDAlphaFunc_s3d;
- ctx->Driver.DepthFunc = savageDDDepthFunc_s3d;
- ctx->Driver.DepthMask = savageDDDepthMask_s3d;
- ctx->Driver.BlendFuncSeparate = savageDDBlendFuncSeparate_s3d;
- ctx->Driver.ColorMask = savageDDColorMask_s3d;
- ctx->Driver.ShadeModel = savageDDShadeModel_s3d;
- ctx->Driver.LightModelfv = savageDDLightModelfv_s3d;
- ctx->Driver.StencilFunc = 0;
- ctx->Driver.StencilMask = 0;
- ctx->Driver.StencilOp = 0;
- }
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.h
deleted file mode 100644
index 5fe718d7a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagestate.h
+++ /dev/null
@@ -1,41 +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.
- */
-
-
-#ifndef _SAVAGE_STATE_H
-#define _SAVAGE_STATE_H
-
-#include "savagecontext.h"
-
-void savageCalcViewport( GLcontext *ctx );
-void savageEmitOldState( savageContextPtr imesa );
-void savageEmitChangedState( savageContextPtr imesa );
-
-extern void savageDDUpdateHwState( GLcontext *ctx );
-extern void savageDDInitState( savageContextPtr imesa );
-extern void savageDDInitStateFuncs( GLcontext *ctx );
-extern void savageDDRenderStart(GLcontext *ctx);
-extern void savageDDRenderEnd(GLcontext *ctx);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.c
deleted file mode 100644
index ce9d1def8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.c
+++ /dev/null
@@ -1,2133 +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 <stdlib.h>
-#include <stdio.h>
-
-#include <GL/gl.h>
-
-#include "mm.h"
-#include "savagecontext.h"
-#include "savagetex.h"
-#include "savagetris.h"
-#include "savageioctl.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "savage_bci.h"
-
-#include "macros.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "texobj.h"
-
-#include "convolve.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-
-#include "xmlpool.h"
-
-#define TILE_INDEX_DXT1 0
-#define TILE_INDEX_8 1
-#define TILE_INDEX_16 2
-#define TILE_INDEX_DXTn 3
-#define TILE_INDEX_32 4
-
-/* On Savage4 the texure LOD-bias needs an offset of ~ 0.3 to get
- * somewhere close to software rendering.
- */
-#define SAVAGE4_LOD_OFFSET 10
-
-/* Tile info for S3TC formats counts in 4x4 blocks instead of texels.
- * In DXT1 each block is encoded in 64 bits. In DXT3 and 5 each block is
- * encoded in 128 bits. */
-
-/* Size 1, 2 and 4 images are packed into the last subtile. Each image
- * is repeated to fill a 4x4 pixel area. The figure below shows the
- * layout of those 4x4 pixel areas in the 8x8 subtile.
- *
- * 4 2
- * x 1
- *
- * Yuck! 8-bit texture formats use 4x8 subtiles. See below.
- */
-static const savageTileInfo tileInfo_pro[5] = {
- {16, 16, 16, 8, 1, 2, {0x18, 0x10}}, /* DXT1 */
- {64, 32, 16, 4, 4, 8, {0x30, 0x20}}, /* 8-bit */
- {64, 16, 8, 2, 8, 8, {0x48, 0x08}}, /* 16-bit */
- {16, 8, 16, 4, 1, 2, {0x30, 0x20}}, /* DXT3, DXT5 */
- {32, 16, 4, 2, 8, 8, {0x90, 0x10}}, /* 32-bit */
-};
-
-/* Size 1, 2 and 4 images are packed into the last two subtiles. Each
- * image is repeated to fill a 4x4 pixel area. The figures below show
- * the layout of those 4x4 pixel areas in the two 4x8 subtiles.
- *
- * second last subtile: 4 last subtile: 2
- * x 1
- */
-static const savageTileInfo tileInfo_s3d_s4[5] = {
- {16, 16, 16, 8, 1, 2, {0x18, 0x10}}, /* DXT1 */
- {64, 32, 16, 4, 4, 8, {0x30, 0x20}}, /* 8-bit */
- {64, 16, 16, 2, 4, 8, {0x60, 0x40}}, /* 16-bit */
- {16, 8, 16, 4, 1, 2, {0x30, 0x20}}, /* DXT3, DXT5 */
- {32, 16, 8, 2, 4, 8, {0xc0, 0x80}}, /* 32-bit */
-};
-
-/** \brief Template for subtile uploads.
- * \param h height in pixels
- * \param w width in bytes
- */
-#define SUBTILE_FUNC(w,h) \
-static __inline GLubyte *savageUploadSubtile_##w##x##h \
-(GLubyte *dest, GLubyte *src, GLuint srcStride) \
-{ \
- GLuint y; \
- for (y = 0; y < h; ++y) { \
- memcpy (dest, src, w); \
- src += srcStride; \
- dest += w; \
- } \
- return dest; \
-}
-
-SUBTILE_FUNC(2, 8) /* 4 bits per pixel, 4 pixels wide */
-SUBTILE_FUNC(4, 8)
-SUBTILE_FUNC(8, 8)
-SUBTILE_FUNC(16, 8)
-SUBTILE_FUNC(32, 8) /* 4 bytes per pixel, 8 pixels wide */
-
-SUBTILE_FUNC(8, 2) /* DXT1 */
-SUBTILE_FUNC(16, 2) /* DXT3 and DXT5 */
-
-/** \brief Upload a complete tile from src (srcStride) to dest
- *
- * \param tileInfo Pointer to tiling information
- * \param wInSub Width of source/dest image in subtiles
- * \param hInSub Height of source/dest image in subtiles
- * \param bpp Bytes per pixel
- * \param src Pointer to source data
- * \param srcStride Byte stride of rows in the source data
- * \param dest Pointer to destination
- *
- * Writes linearly to the destination memory in order to exploit write
- * combining.
- *
- * For a complete tile wInSub and hInSub are set to the same values as
- * in tileInfo. If the source image is smaller than a whole tile in
- * one or both dimensions then they are set to the values of the
- * source image. This only works as long as the source image is bigger
- * than 8x8 pixels.
- */
-static void savageUploadTile (const savageTileInfo *tileInfo,
- GLuint wInSub, GLuint hInSub, GLuint bpp,
- GLubyte *src, GLuint srcStride, GLubyte *dest) {
- GLuint subStride = tileInfo->subWidth * bpp;
- GLubyte *srcSRow = src, *srcSTile = src;
- GLubyte *(*subtileFunc) (GLubyte *, GLubyte *, GLuint);
- GLuint sx, sy;
- switch (subStride) {
- case 2: subtileFunc = savageUploadSubtile_2x8; break;
- case 4: subtileFunc = savageUploadSubtile_4x8; break;
- case 8: subtileFunc = tileInfo->subHeight == 8 ?
- savageUploadSubtile_8x8 : savageUploadSubtile_8x2; break;
- case 16: subtileFunc = tileInfo->subHeight == 8 ?
- savageUploadSubtile_16x8 : savageUploadSubtile_16x2; break;
- case 32: subtileFunc = savageUploadSubtile_32x8; break;
- default: assert(0);
- }
- for (sy = 0; sy < hInSub; ++sy) {
- srcSTile = srcSRow;
- for (sx = 0; sx < wInSub; ++sx) {
- src = srcSTile;
- dest = subtileFunc (dest, src, srcStride);
- srcSTile += subStride;
- }
- srcSRow += srcStride * tileInfo->subHeight;
- }
-}
-
-/** \brief Upload a image that is smaller than 8 pixels in either dimension.
- *
- * \param tileInfo Pointer to tiling information
- * \param width Width of the image
- * \param height Height of the image
- * \param bpp Bytes per pixel
- * \param src Pointer to source data
- * \param dest Pointer to destination
- *
- * This function handles all the special cases that need to be taken
- * care off. The caller may need to call this function multiple times
- * with the destination offset in different ways since small texture
- * images must be repeated in order to fill a whole tile (or 4x4 for
- * the last 3 levels).
- *
- * FIXME: Repeating inside this function would be more efficient.
- */
-static void savageUploadTiny (const savageTileInfo *tileInfo,
- GLuint pixWidth, GLuint pixHeight,
- GLuint width, GLuint height, GLuint bpp,
- GLubyte *src, GLubyte *dest) {
- GLuint size = MAX2(pixWidth, pixHeight);
-
- if (width > tileInfo->subWidth) { /* assert: height <= subtile height */
- GLuint wInSub = width / tileInfo->subWidth;
- GLuint srcStride = width * bpp;
- GLuint subStride = tileInfo->subWidth * bpp;
- GLuint subSkip = (tileInfo->subHeight - height) * subStride;
- GLubyte *srcSTile = src;
- GLuint sx, y;
- for (sx = 0; sx < wInSub; ++sx) {
- src = srcSTile;
- for (y = 0; y < height; ++y) {
- memcpy (dest, src, subStride);
- src += srcStride;
- dest += subStride;
- }
- dest += subSkip;
- srcSTile += subStride;
- }
- } else if (size > 4) { /* a tile or less wide, except the last 3 levels */
- GLuint srcStride = width * bpp;
- GLuint subStride = tileInfo->subWidth * bpp;
- /* if the subtile width is 4 we have to skip every other subtile */
- GLuint subSkip = tileInfo->subWidth <= 4 ?
- subStride * tileInfo->subHeight : 0;
- GLuint skipRemainder = tileInfo->subHeight - 1;
- GLuint y;
- for (y = 0; y < height; ++y) {
- memcpy (dest, src, srcStride);
- src += srcStride;
- dest += subStride;
- if ((y & skipRemainder) == skipRemainder)
- dest += subSkip;
- }
- } else { /* the last 3 mipmap levels */
- GLuint offset = (size <= 2 ? tileInfo->tinyOffset[size-1] : 0);
- GLuint subStride = tileInfo->subWidth * bpp;
- GLuint y;
- dest += offset;
- for (y = 0; y < height; ++y) {
- memcpy (dest, src, bpp*width);
- src += width * bpp;
- dest += subStride;
- }
- }
-}
-
-/** \brief Upload an image from mesa's internal copy.
- */
-static void savageUploadTexLevel( savageTexObjPtr t, int level )
-{
- const struct gl_texture_image *image = t->base.tObj->Image[0][level];
- const savageTileInfo *tileInfo = t->tileInfo;
- GLuint pixWidth = image->Width2, pixHeight = image->Height2;
- GLuint bpp = t->texelBytes;
- GLuint width, height;
-
- /* FIXME: Need triangle (rather than pixel) fallbacks to simulate
- * this using normal textured triangles.
- *
- * DO THIS IN DRIVER STATE MANAGMENT, not hardware state.
- */
- if(image->Border != 0)
- fprintf (stderr, "Not supported texture border %d.\n",
- (int) image->Border);
-
- if (t->hwFormat == TFT_S3TC4A4Bit || t->hwFormat == TFT_S3TC4CA4Bit ||
- t->hwFormat == TFT_S3TC4Bit) {
- width = (pixWidth+3) / 4;
- height = (pixHeight+3) / 4;
- } else {
- width = pixWidth;
- height = pixHeight;
- }
-
- if (pixWidth >= 8 && pixHeight >= 8) {
- GLuint *dirtyPtr = t->image[level].dirtyTiles;
- GLuint dirtyMask = 1;
-
- if (width >= tileInfo->width && height >= tileInfo->height) {
- GLuint wInTiles = width / tileInfo->width;
- GLuint hInTiles = height / tileInfo->height;
- GLubyte *srcTRow = image->Data, *src;
- GLubyte *dest = (GLubyte *)(t->bufAddr + t->image[level].offset);
- GLuint x, y;
- for (y = 0; y < hInTiles; ++y) {
- src = srcTRow;
- for (x = 0; x < wInTiles; ++x) {
- if (*dirtyPtr & dirtyMask) {
- savageUploadTile (tileInfo,
- tileInfo->wInSub, tileInfo->hInSub,
- bpp, src, width * bpp, dest);
- }
- src += tileInfo->width * bpp;
- dest += 2048; /* tile size is always 2k */
- if (dirtyMask == 1<<31) {
- dirtyMask = 1;
- dirtyPtr++;
- } else
- dirtyMask <<= 1;
- }
- srcTRow += width * tileInfo->height * bpp;
- }
- } else if (width >= tileInfo->width) {
- GLuint wInTiles = width / tileInfo->width;
- GLubyte *src = image->Data;
- GLubyte *dest = (GLubyte *)(t->bufAddr + t->image[level].offset);
- GLuint tileStride = tileInfo->width * bpp * height;
- savageContextPtr imesa = (savageContextPtr)t->base.heap->driverContext;
- GLuint x;
- /* Savage3D-based chips seem so use a constant tile stride
- * of 2048 for vertically incomplete tiles, but only if
- * the color depth is 32bpp. Nobody said this was supposed
- * to be logical!
- */
- if (bpp == 4 && imesa->savageScreen->chipset < S3_SAVAGE4)
- tileStride = 2048;
- for (x = 0; x < wInTiles; ++x) {
- if (*dirtyPtr & dirtyMask) {
- savageUploadTile (tileInfo,
- tileInfo->wInSub,
- height / tileInfo->subHeight,
- bpp, src, width * bpp, dest);
- }
- src += tileInfo->width * bpp;
- dest += tileStride;
- if (dirtyMask == 1<<31) {
- dirtyMask = 1;
- dirtyPtr++;
- } else
- dirtyMask <<= 1;
- }
- } else {
- savageUploadTile (tileInfo, width / tileInfo->subWidth,
- height / tileInfo->subHeight, bpp,
- image->Data, width * bpp,
- (GLubyte *)(t->bufAddr+t->image[level].offset));
- }
- } else {
- GLuint minHeight, minWidth, hRepeat, vRepeat, x, y;
- if (t->hwFormat == TFT_S3TC4A4Bit || t->hwFormat == TFT_S3TC4CA4Bit ||
- t->hwFormat == TFT_S3TC4Bit)
- minWidth = minHeight = 1;
- else
- minWidth = minHeight = 4;
- if (width > minWidth || height > minHeight) {
- minWidth = tileInfo->subWidth;
- minHeight = tileInfo->subHeight;
- }
- hRepeat = width >= minWidth ? 1 : minWidth / width;
- vRepeat = height >= minHeight ? 1 : minHeight / height;
- for (y = 0; y < vRepeat; ++y) {
- GLuint offset = y * tileInfo->subWidth*height * bpp;
- for (x = 0; x < hRepeat; ++x) {
- savageUploadTiny (tileInfo, pixWidth, pixHeight,
- width, height, bpp, image->Data,
- (GLubyte *)(t->bufAddr +
- t->image[level].offset+offset));
- offset += width * bpp;
- }
- }
- }
-}
-
-/** \brief Compute the destination size of a texture image
- */
-static GLuint savageTexImageSize (GLuint width, GLuint height, GLuint bpp) {
- /* full subtiles */
- if (width >= 8 && height >= 8)
- return width * height * bpp;
- /* special case for the last three mipmap levels: the hardware computes
- * the offset internally */
- else if (width <= 4 && height <= 4)
- return 0;
- /* partially filled sub tiles waste memory
- * on Savage3D and Savage4 with subtile width 4 every other subtile is
- * skipped if width < 8 so we can assume a uniform subtile width of 8 */
- else if (width >= 8)
- return width * 8 * bpp;
- else if (height >= 8)
- return 8 * height * bpp;
- else
- return 64 * bpp;
-}
-
-/** \brief Compute the destination size of a compressed texture image
- */
-static GLuint savageCompressedTexImageSize (GLuint width, GLuint height,
- GLuint bpp) {
- width = (width+3) / 4;
- height = (height+3) / 4;
- /* full subtiles */
- if (width >= 2 && height >= 2)
- return width * height * bpp;
- /* special case for the last three mipmap levels: the hardware computes
- * the offset internally */
- else if (width <= 1 && height <= 1)
- return 0;
- /* partially filled sub tiles waste memory
- * on Savage3D and Savage4 with subtile width 4 every other subtile is
- * skipped if width < 8 so we can assume a uniform subtile width of 8 */
- else if (width >= 2)
- return width * 2 * bpp;
- else if (height >= 2)
- return 2 * height * bpp;
- else
- return 4 * bpp;
-}
-
-/** \brief Compute the number of (partial) tiles of a texture image
- */
-static GLuint savageTexImageTiles (GLuint width, GLuint height,
- const savageTileInfo *tileInfo)
-{
- return (width + tileInfo->width - 1) / tileInfo->width *
- (height + tileInfo->height - 1) / tileInfo->height;
-}
-
-/** \brief Mark dirty tiles
- *
- * Some care must be taken because tileInfo may not be set or not
- * up-to-date. So we check if tileInfo is initialized and if the number
- * of tiles in the bit vector matches the number of tiles computed from
- * the current tileInfo.
- */
-static void savageMarkDirtyTiles (savageTexObjPtr t, GLuint level,
- GLuint totalWidth, GLuint totalHeight,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height)
-{
- GLuint wInTiles, hInTiles;
- GLuint x0, y0, x1, y1;
- GLuint x, y;
- if (!t->tileInfo)
- return;
- wInTiles = (totalWidth + t->tileInfo->width - 1) / t->tileInfo->width;
- hInTiles = (totalHeight + t->tileInfo->height - 1) / t->tileInfo->height;
- if (wInTiles * hInTiles != t->image[level].nTiles)
- return;
-
- x0 = xoffset / t->tileInfo->width;
- y0 = yoffset / t->tileInfo->height;
- x1 = (xoffset + width - 1) / t->tileInfo->width;
- y1 = (yoffset + height - 1) / t->tileInfo->height;
-
- for (y = y0; y <= y1; ++y) {
- GLuint *ptr = t->image[level].dirtyTiles + (y * wInTiles + x0) / 32;
- GLuint mask = 1 << (y * wInTiles + x0) % 32;
- for (x = x0; x <= x1; ++x) {
- *ptr |= mask;
- if (mask == (1<<31)) {
- ptr++;
- mask = 1;
- } else {
- mask <<= 1;
- }
- }
- }
-}
-
-/** \brief Mark all tiles as dirty
- */
-static void savageMarkAllTiles (savageTexObjPtr t, GLuint level)
-{
- GLuint words = (t->image[level].nTiles + 31) / 32;
- if (words)
- memset(t->image[level].dirtyTiles, ~0, words*sizeof(GLuint));
-}
-
-
-static void savageSetTexWrapping(savageTexObjPtr tex, GLenum s, GLenum t)
-{
- tex->setup.sWrapMode = s;
- tex->setup.tWrapMode = t;
-}
-
-static void savageSetTexFilter(savageTexObjPtr t, GLenum minf, GLenum magf)
-{
- t->setup.minFilter = minf;
- t->setup.magFilter = magf;
-}
-
-
-/* Need a fallback ?
- */
-static void savageSetTexBorderColor(savageTexObjPtr t, GLubyte color[4])
-{
-/* t->Setup[SAVAGE_TEXREG_TEXBORDERCOL] = */
- /*t->setup.borderColor = SAVAGEPACKCOLOR8888(color[0],color[1],color[2],color[3]); */
-}
-
-
-
-static savageTexObjPtr
-savageAllocTexObj( struct gl_texture_object *texObj )
-{
- savageTexObjPtr t;
-
- t = (savageTexObjPtr) calloc(1,sizeof(*t));
- texObj->DriverData = t;
- if ( t != NULL ) {
- GLuint i;
-
- /* Initialize non-image-dependent parts of the state:
- */
- t->base.tObj = texObj;
- t->base.dirty_images[0] = 0;
- t->dirtySubImages = 0;
- t->tileInfo = NULL;
-
- /* Initialize dirty tiles bit vectors
- */
- for (i = 0; i < SAVAGE_TEX_MAXLEVELS; ++i)
- t->image[i].nTiles = 0;
-
- /* FIXME Something here to set initial values for other parts of
- * FIXME t->setup?
- */
-
- make_empty_list( &t->base );
-
- savageSetTexWrapping(t,texObj->WrapS,texObj->WrapT);
- savageSetTexFilter(t,texObj->MinFilter,texObj->MagFilter);
- savageSetTexBorderColor(t,texObj->_BorderChan);
- }
-
- return t;
-}
-
-/* Mesa texture formats for alpha-images on Savage3D/IX/MX
- *
- * Promoting texture images to ARGB888 or ARGB4444 doesn't work
- * because we can't tell the hardware to ignore the color components
- * and only use the alpha component. So we define our own texture
- * formats that promote to ARGB8888 or ARGB4444 and set the color
- * components to white. This way we get the correct result. */
-static GLboolean
-_savage_texstore_a1114444 (GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking);
-static GLboolean
-_savage_texstore_a1118888 (GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking);
-
-static struct gl_texture_format _savage_texformat_a1114444 = {
- MESA_FORMAT_ARGB4444, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 4, /* RedBits */
- 4, /* GreenBits */
- 4, /* BlueBits */
- 4, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _savage_texstore_a1114444, /* StoreTexImageFunc */
- NULL, NULL, NULL, NULL, NULL, NULL /* FetchTexel* filled in by
- * savageDDInitTextureFuncs */
-};
-static struct gl_texture_format _savage_texformat_a1118888 = {
- MESA_FORMAT_ARGB8888, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 8, /* RedBits */
- 8, /* GreenBits */
- 8, /* BlueBits */
- 8, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 4, /* TexelBytes */
- _savage_texstore_a1118888, /* StoreTexImageFunc */
- NULL, NULL, NULL, NULL, NULL, NULL /* FetchTexel* filled in by
- * savageDDInitTextureFuncs */
-};
-
-static GLboolean
-_savage_texstore_a1114444 (GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking)
-{
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseInternalFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
-
- ASSERT(dstFormat == &_savage_texformat_a1114444);
- ASSERT(baseInternalFormat == GL_ALPHA);
-
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLushort *dstUI = (GLushort *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[0]),
- 255, 255, 255 );
- src += 1;
- }
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
-
- return GL_TRUE;
-}
-static GLboolean
-_savage_texstore_a1118888 (GLcontext *ctx, GLuint dims,
- GLenum baseInternalFormat,
- const struct gl_texture_format *dstFormat,
- GLvoid *dstAddr,
- GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
- GLint dstRowStride, GLint dstImageStride,
- GLint srcWidth, GLint srcHeight, GLint srcDepth,
- GLenum srcFormat, GLenum srcType,
- const GLvoid *srcAddr,
- const struct gl_pixelstore_attrib *srcPacking)
-{
- /* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
- baseInternalFormat,
- baseInternalFormat,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
- GLubyte *dstImage = (GLubyte *) dstAddr
- + dstZoffset * dstImageStride
- + dstYoffset * dstRowStride
- + dstXoffset * dstFormat->TexelBytes;
- GLint img, row, col;
-
- ASSERT(dstFormat == &_savage_texformat_a1118888);
- ASSERT(baseInternalFormat == GL_ALPHA);
-
- if (!tempImage)
- return GL_FALSE;
- _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
- for (img = 0; img < srcDepth; img++) {
- GLubyte *dstRow = dstImage;
- for (row = 0; row < srcHeight; row++) {
- GLuint *dstUI = (GLuint *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[0]),
- 255, 255, 255 );
- src += 1;
- }
- dstRow += dstRowStride;
- }
- dstImage += dstImageStride;
- }
- _mesa_free((void *) tempImage);
-
- return GL_TRUE;
-}
-
-/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
-savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- const GLboolean do32bpt =
- ( imesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
- const GLboolean force16bpt =
- ( imesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
- const GLboolean isSavage4 = (imesa->savageScreen->chipset >= S3_SAVAGE4);
- (void) format;
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- switch ( type ) {
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
- }
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- switch ( type ) {
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
- default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
- }
-
- case GL_RGBA8:
- case GL_RGBA12:
- case GL_RGBA16:
- return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGB10_A2:
- return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_COMPRESSED_ALPHA:
- return isSavage4 ? &_mesa_texformat_a8 : (
- do32bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444);
- case GL_ALPHA4:
- return isSavage4 ? &_mesa_texformat_a8 : &_savage_texformat_a1114444;
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return isSavage4 ? &_mesa_texformat_a8 : (
- !force16bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444);
-
- case 1:
- case GL_LUMINANCE:
- case GL_COMPRESSED_LUMINANCE:
- /* no alpha, but use argb1555 in 16bit case to get pure grey values */
- return isSavage4 ? &_mesa_texformat_l8 : (
- do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555);
- case GL_LUMINANCE4:
- return isSavage4 ? &_mesa_texformat_l8 : &_mesa_texformat_argb1555;
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return isSavage4 ? &_mesa_texformat_l8 : (
- !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555);
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- /* Savage4 has a al44 texture format. But it's not supported by Mesa. */
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- return &_mesa_texformat_argb4444;
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-#if 0
- /* TFT_I8 produces garbage on ProSavageDDR and subsequent texture
- * disable keeps rendering garbage. Disabled for now. */
- case GL_INTENSITY:
- case GL_COMPRESSED_INTENSITY:
- return isSavage4 ? &_mesa_texformat_i8 : (
- do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444);
- case GL_INTENSITY4:
- return isSavage4 ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444;
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return isSavage4 ? &_mesa_texformat_i8 : (
- !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444);
-#else
- case GL_INTENSITY:
- case GL_COMPRESSED_INTENSITY:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
- case GL_INTENSITY4:
- return &_mesa_texformat_argb4444;
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return !force16bpt ? &_mesa_texformat_argb8888 :
- &_mesa_texformat_argb4444;
-#endif
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- if (!isSavage4)
- /* Not the best choice but Savage3D/MX/IX don't support DXT3 or DXT5. */
- return &_mesa_texformat_rgba_dxt1;
- /* fall through */
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
-/*
- 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_texformat_ci8;
-*/
- default:
- _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__);
- return NULL;
- }
-}
-
-static void savageSetTexImages( savageContextPtr imesa,
- const struct gl_texture_object *tObj )
-{
- savageTexObjPtr t = (savageTexObjPtr) tObj->DriverData;
- struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- GLuint offset, i, textureFormat, tileIndex, size;
- GLint firstLevel, lastLevel;
-
- assert(t);
- assert(image);
-
- switch (image->TexFormat->MesaFormat) {
- case MESA_FORMAT_ARGB8888:
- textureFormat = TFT_ARGB8888;
- t->texelBytes = tileIndex = 4;
- break;
- case MESA_FORMAT_ARGB1555:
- textureFormat = TFT_ARGB1555;
- t->texelBytes = tileIndex = 2;
- break;
- case MESA_FORMAT_ARGB4444:
- textureFormat = TFT_ARGB4444;
- t->texelBytes = tileIndex = 2;
- break;
- case MESA_FORMAT_RGB565:
- textureFormat = TFT_RGB565;
- t->texelBytes = tileIndex = 2;
- break;
- case MESA_FORMAT_L8:
- textureFormat = TFT_L8;
- t->texelBytes = tileIndex = 1;
- break;
- case MESA_FORMAT_I8:
- textureFormat = TFT_I8;
- t->texelBytes = tileIndex = 1;
- break;
- case MESA_FORMAT_A8:
- textureFormat = TFT_A8;
- t->texelBytes = tileIndex = 1;
- break;
- case MESA_FORMAT_RGB_DXT1:
- textureFormat = TFT_S3TC4Bit;
- tileIndex = TILE_INDEX_DXT1;
- t->texelBytes = 8;
- break;
- case MESA_FORMAT_RGBA_DXT1:
- textureFormat = TFT_S3TC4Bit;
- tileIndex = TILE_INDEX_DXT1;
- t->texelBytes = 8;
- break;
- case MESA_FORMAT_RGBA_DXT3:
- textureFormat = TFT_S3TC4A4Bit;
- tileIndex = TILE_INDEX_DXTn;
- t->texelBytes = 16;
- break;
- case MESA_FORMAT_RGBA_DXT5:
- textureFormat = TFT_S3TC4CA4Bit;
- tileIndex = TILE_INDEX_DXTn;
- t->texelBytes = 16;
- break;
- default:
- _mesa_problem(imesa->glCtx, "Bad texture format in %s", __FUNCTION__);
- return;
- }
- t->hwFormat = textureFormat;
-
- /* Select tiling format depending on the chipset and texture format */
- if (imesa->savageScreen->chipset <= S3_SAVAGE4)
- t->tileInfo = &tileInfo_s3d_s4[tileIndex];
- else
- t->tileInfo = &tileInfo_pro[tileIndex];
-
- /* Compute which mipmap levels we really want to send to the hardware.
- */
- driCalculateTextureFirstLastLevel( &t->base );
- firstLevel = t->base.firstLevel;
- lastLevel = t->base.lastLevel;
-
- /* Figure out the size now (and count the levels). Upload won't be
- * done until later. If the number of tiles changes, it means that
- * this function is called for the first time on this tex object or
- * the image or the destination color format changed. So all tiles
- * are marked as dirty.
- */
- offset = 0;
- size = 1;
- for ( i = firstLevel ; i <= lastLevel && tObj->Image[0][i] ; i++ ) {
- GLuint nTiles;
- nTiles = savageTexImageTiles (image->Width2, image->Height2, t->tileInfo);
- if (t->image[i].nTiles != nTiles) {
- GLuint words = (nTiles + 31) / 32;
- if (t->image[i].nTiles != 0) {
- free(t->image[i].dirtyTiles);
- }
- t->image[i].dirtyTiles = malloc(words*sizeof(GLuint));
- memset(t->image[i].dirtyTiles, ~0, words*sizeof(GLuint));
- }
- t->image[i].nTiles = nTiles;
-
- t->image[i].offset = offset;
-
- image = tObj->Image[0][i];
- if (t->texelBytes >= 8)
- size = savageCompressedTexImageSize (image->Width2, image->Height2,
- t->texelBytes);
- else
- size = savageTexImageSize (image->Width2, image->Height2,
- t->texelBytes);
- offset += size;
- }
-
- t->base.lastLevel = i-1;
- t->base.totalSize = offset;
- /* the last three mipmap levels don't add to the offset. They are packed
- * into 64 pixels. */
- if (size == 0)
- t->base.totalSize += (t->texelBytes >= 8 ? 4 : 64) * t->texelBytes;
- /* 2k-aligned (really needed?) */
- t->base.totalSize = (t->base.totalSize + 2047UL) & ~2047UL;
-}
-
-void savageDestroyTexObj(savageContextPtr imesa, savageTexObjPtr t)
-{
- GLuint i;
-
- /* Free dirty tiles bit vectors */
- for (i = 0; i < SAVAGE_TEX_MAXLEVELS; ++i) {
- if (t->image[i].nTiles)
- free (t->image[i].dirtyTiles);
- }
-
- /* See if it was the driver's current object.
- */
- if ( imesa != NULL )
- {
- for ( i = 0 ; i < imesa->glCtx->Const.MaxTextureUnits ; i++ )
- {
- if ( &t->base == imesa->CurrentTexObj[ i ] ) {
- assert( t->base.bound & (1 << i) );
- imesa->CurrentTexObj[ i ] = NULL;
- }
- }
- }
-}
-
-/* Upload a texture's images to one of the texture heaps. May have to
- * eject our own and/or other client's texture objects to make room
- * for the upload.
- */
-static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t )
-{
- const GLint numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- GLuint i;
-
- assert(t);
-
- LOCK_HARDWARE(imesa);
-
- /* Do we need to eject LRU texture objects?
- */
- if (!t->base.memBlock) {
- GLint heap;
- GLuint ofs;
-
- heap = driAllocateTexture(imesa->textureHeaps, imesa->lastTexHeap,
- (driTextureObject *)t);
- if (heap == -1) {
- UNLOCK_HARDWARE(imesa);
- return;
- }
-
- ofs = t->base.memBlock->ofs;
- t->setup.physAddr = imesa->savageScreen->textureOffset[heap] + ofs;
- t->bufAddr = (GLubyte *)imesa->savageScreen->texVirtual[heap] + ofs;
- imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; /* FIXME: really needed? */
- }
-
- /* Let the world know we've used this memory recently.
- */
- driUpdateTextureLRU( &t->base );
- UNLOCK_HARDWARE(imesa);
-
- if (t->base.dirty_images[0] || t->dirtySubImages) {
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_TEX)
- fprintf(stderr, "Texture upload: |");
-
- /* Heap timestamps are only reliable with Savage DRM 2.3.x or
- * later. Earlier versions had only 16 bit time stamps which
- * would wrap too frequently. */
- if (imesa->savageScreen->driScrnPriv->drmMinor >= 3) {
- unsigned int heap = t->base.heap->heapId;
- LOCK_HARDWARE(imesa);
- savageWaitEvent (imesa, imesa->textureHeaps[heap]->timestamp);
- } else {
- savageFlushVertices (imesa);
- LOCK_HARDWARE(imesa);
- savageFlushCmdBufLocked (imesa, GL_FALSE);
- WAIT_IDLE_EMPTY_LOCKED(imesa);
- }
-
- for (i = 0 ; i < numLevels ; i++) {
- const GLint j = t->base.firstLevel + i; /* the texObj's level */
- if (t->base.dirty_images[0] & (1 << j)) {
- savageMarkAllTiles(t, j);
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_TEX)
- fprintf (stderr, "*");
- } else if (SAVAGE_DEBUG & DEBUG_VERBOSE_TEX) {
- if (t->dirtySubImages & (1 << j))
- fprintf (stderr, ".");
- else
- fprintf (stderr, " ");
- }
- if ((t->base.dirty_images[0] | t->dirtySubImages) & (1 << j))
- savageUploadTexLevel( t, j );
- }
-
- UNLOCK_HARDWARE(imesa);
- t->base.dirty_images[0] = 0;
- t->dirtySubImages = 0;
-
- if (SAVAGE_DEBUG & DEBUG_VERBOSE_TEX)
- fprintf(stderr, "|\n");
- }
-}
-
-
-static void
-savage4_set_wrap_mode( savageContextPtr imesa, unsigned unit,
- GLenum s_mode, GLenum t_mode )
-{
- switch( s_mode ) {
- case GL_REPEAT:
- imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Wrap;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Clamp;
- break;
- case GL_MIRRORED_REPEAT:
- imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Mirror;
- break;
- }
-
- switch( t_mode ) {
- case GL_REPEAT:
- imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Wrap;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Clamp;
- break;
- case GL_MIRRORED_REPEAT:
- imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Mirror;
- break;
- }
-}
-
-
-/**
- * Sets the hardware bits for the specified GL texture filter modes.
- *
- * \todo
- * Does the Savage4 have the ability to select the magnification filter?
- */
-static void
-savage4_set_filter_mode( savageContextPtr imesa, unsigned unit,
- GLenum minFilter, GLenum magFilter )
-{
- (void) magFilter;
-
- switch (minFilter) {
- case GL_NEAREST:
- imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Point;
- imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_FALSE;
- break;
-
- case GL_LINEAR:
- imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Bilin;
- imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_FALSE;
- break;
-
- case GL_NEAREST_MIPMAP_NEAREST:
- imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Point;
- imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE;
- break;
-
- case GL_LINEAR_MIPMAP_NEAREST:
- imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Bilin;
- imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE;
- break;
-
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Trilin;
- imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE;
- break;
- }
-}
-
-
-static void savageUpdateTex0State_s4( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- struct gl_texture_object *tObj;
- struct gl_texture_image *image;
- savageTexObjPtr t;
- GLuint format;
-
- /* disable */
- imesa->regs.s4.texDescr.ni.tex0En = GL_FALSE;
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_NoTexMap;
- imesa->regs.s4.texCtrl[0].ui = 0x20f040;
- if (ctx->Texture.Unit[0]._ReallyEnabled == 0)
- return;
-
- tObj = ctx->Texture.Unit[0]._Current;
- if ((ctx->Texture.Unit[0]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
- || tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- /* 3D texturing enabled, or texture border - fallback */
- FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
- return;
- }
-
- /* Do 2D texture setup */
-
- t = tObj->DriverData;
- if (!t) {
- t = savageAllocTexObj( tObj );
- if (!t)
- return;
- }
-
- imesa->CurrentTexObj[0] = &t->base;
- t->base.bound |= 1;
-
- if (t->base.dirty_images[0] || t->dirtySubImages) {
- savageSetTexImages(imesa, tObj);
- savageUploadTexImages(imesa, t);
- }
-
- driUpdateTextureLRU( &t->base );
-
- format = tObj->Image[0][tObj->BaseLevel]->Format;
-
- switch (ctx->Texture.Unit[0].EnvMode) {
- case GL_REPLACE:
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_FALSE;
- switch(format)
- {
- case GL_LUMINANCE:
- case GL_RGB:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_Decal;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- case GL_INTENSITY:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_Copy;
- break;
-
- case GL_ALPHA:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_CopyAlpha;
- break;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 0,
- &imesa->regs.s4.texBlendCtrl[0]);
- break;
-
- case GL_DECAL:
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_FALSE;
- switch (format)
- {
- case GL_RGB:
- case GL_LUMINANCE:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_Decal;
- break;
-
- case GL_RGBA:
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_DecalAlpha;
- break;
-
- /*
- GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_INTENSITY
- are undefined with GL_DECAL
- */
-
- case GL_ALPHA:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_CopyAlpha;
- break;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 0,
- &imesa->regs.s4.texBlendCtrl[0]);
- break;
-
- case GL_MODULATE:
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_FALSE;
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_ModulAlpha;
- __HWEnvCombineSingleUnitScale(imesa, 0, 0,
- &imesa->regs.s4.texBlendCtrl[0]);
- break;
-
- case GL_BLEND:
- imesa->regs.s4.texBlendColor.ui = imesa->texEnvColor;
-
- switch (format)
- {
- case GL_ALPHA:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_ModulAlpha;
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_FALSE;
- break;
-
- case GL_LUMINANCE:
- case GL_RGB:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_Blend0;
- imesa->regs.s4.texDescr.ni.tex1En = GL_TRUE;
- imesa->regs.s4.texDescr.ni.texBLoopEn = GL_TRUE;
- imesa->regs.s4.texDescr.ni.tex1Width =
- imesa->regs.s4.texDescr.ni.tex0Width;
- imesa->regs.s4.texDescr.ni.tex1Height =
- imesa->regs.s4.texDescr.ni.tex0Height;
- imesa->regs.s4.texDescr.ni.tex1Fmt =
- imesa->regs.s4.texDescr.ni.tex0Fmt;
-
- imesa->regs.s4.texAddr[1].ui = imesa->regs.s4.texAddr[0].ui;
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_Blend1;
-
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_TRUE;
- imesa->bTexEn1 = GL_TRUE;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_BlendAlpha0;
- imesa->regs.s4.texDescr.ni.tex1En = GL_TRUE;
- imesa->regs.s4.texDescr.ni.texBLoopEn = GL_TRUE;
- imesa->regs.s4.texDescr.ni.tex1Width =
- imesa->regs.s4.texDescr.ni.tex0Width;
- imesa->regs.s4.texDescr.ni.tex1Height =
- imesa->regs.s4.texDescr.ni.tex0Height;
- imesa->regs.s4.texDescr.ni.tex1Fmt =
- imesa->regs.s4.texDescr.ni.tex0Fmt;
-
- imesa->regs.s4.texAddr[1].ui = imesa->regs.s4.texAddr[0].ui;
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_BlendAlpha1;
-
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_TRUE;
- imesa->bTexEn1 = GL_TRUE;
- break;
-
- case GL_INTENSITY:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_BlendInt0;
- imesa->regs.s4.texDescr.ni.tex1En = GL_TRUE;
- imesa->regs.s4.texDescr.ni.texBLoopEn = GL_TRUE;
- imesa->regs.s4.texDescr.ni.tex1Width =
- imesa->regs.s4.texDescr.ni.tex0Width;
- imesa->regs.s4.texDescr.ni.tex1Height =
- imesa->regs.s4.texDescr.ni.tex0Height;
- imesa->regs.s4.texDescr.ni.tex1Fmt =
- imesa->regs.s4.texDescr.ni.tex0Fmt;
-
- imesa->regs.s4.texAddr[1].ui = imesa->regs.s4.texAddr[0].ui;
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_BlendInt1;
-
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_TRUE;
- imesa->regs.s4.texCtrl[0].ni.alphaArg1Invert = GL_TRUE;
- imesa->bTexEn1 = GL_TRUE;
- break;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 0,
- &imesa->regs.s4.texBlendCtrl[0]);
- break;
-
- case GL_ADD:
- imesa->regs.s4.texCtrl[0].ni.clrArg1Invert = GL_FALSE;
- switch (format)
- {
- case GL_ALPHA:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_ModulAlpha;
- break;
-
- case GL_LUMINANCE:
- case GL_RGB:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_Add;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_Add;
- break;
-
- case GL_INTENSITY:
- imesa->regs.s4.texBlendCtrl[0].ui = TBC_AddAlpha;
- break;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 0,
- &imesa->regs.s4.texBlendCtrl[0]);
- break;
-
-#if GL_ARB_texture_env_combine
- case GL_COMBINE_ARB:
- __HWParseTexEnvCombine(imesa, 0, &imesa->regs.s4.texCtrl[0],
- &imesa->regs.s4.texBlendCtrl[0]);
- break;
-#endif
-
- default:
- fprintf(stderr, "unknown tex env mode");
- exit(1);
- break;
- }
-
- savage4_set_wrap_mode( imesa, 0, t->setup.sWrapMode, t->setup.tWrapMode );
- savage4_set_filter_mode( imesa, 0, t->setup.minFilter, t->setup.magFilter );
-
- if((ctx->Texture.Unit[0].LodBias !=0.0F) ||
- (imesa->regs.s4.texCtrl[0].ni.dBias != 0))
- {
- int bias = (int)(ctx->Texture.Unit[0].LodBias * 32.0) +
- SAVAGE4_LOD_OFFSET;
- if (bias < -256)
- bias = -256;
- else if (bias > 255)
- bias = 255;
- imesa->regs.s4.texCtrl[0].ni.dBias = bias & 0x1ff;
- }
-
- image = tObj->Image[0][tObj->BaseLevel];
- imesa->regs.s4.texDescr.ni.tex0En = GL_TRUE;
- imesa->regs.s4.texDescr.ni.tex0Width = image->WidthLog2;
- imesa->regs.s4.texDescr.ni.tex0Height = image->HeightLog2;
- imesa->regs.s4.texDescr.ni.tex0Fmt = t->hwFormat;
- imesa->regs.s4.texCtrl[0].ni.dMax = t->base.lastLevel - t->base.firstLevel;
-
- if (imesa->regs.s4.texDescr.ni.tex1En)
- imesa->regs.s4.texDescr.ni.texBLoopEn = GL_TRUE;
-
- imesa->regs.s4.texAddr[0].ui = (u_int32_t) t->setup.physAddr | 0x2;
- if(t->base.heap->heapId == SAVAGE_AGP_HEAP)
- imesa->regs.s4.texAddr[0].ui |= 0x1;
-
- return;
-}
-static void savageUpdateTex1State_s4( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- struct gl_texture_object *tObj;
- struct gl_texture_image *image;
- savageTexObjPtr t;
- GLuint format;
-
- /* disable */
- if(imesa->bTexEn1)
- {
- imesa->bTexEn1 = GL_FALSE;
- return;
- }
-
- imesa->regs.s4.texDescr.ni.tex1En = GL_FALSE;
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_NoTexMap1;
- imesa->regs.s4.texCtrl[1].ui = 0x20f040;
- imesa->regs.s4.texDescr.ni.texBLoopEn = GL_FALSE;
- if (ctx->Texture.Unit[1]._ReallyEnabled == 0)
- return;
-
- tObj = ctx->Texture.Unit[1]._Current;
-
- if ((ctx->Texture.Unit[1]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
- || tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- /* 3D texturing enabled, or texture border - fallback */
- FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
- return;
- }
-
- /* Do 2D texture setup */
-
- t = tObj->DriverData;
- if (!t) {
- t = savageAllocTexObj( tObj );
- if (!t)
- return;
- }
-
- imesa->CurrentTexObj[1] = &t->base;
-
- t->base.bound |= 2;
-
- if (t->base.dirty_images[0] || t->dirtySubImages) {
- savageSetTexImages(imesa, tObj);
- savageUploadTexImages(imesa, t);
- }
-
- driUpdateTextureLRU( &t->base );
-
- format = tObj->Image[0][tObj->BaseLevel]->Format;
-
- switch (ctx->Texture.Unit[1].EnvMode) {
- case GL_REPLACE:
- imesa->regs.s4.texCtrl[1].ni.clrArg1Invert = GL_FALSE;
- switch (format)
- {
- case GL_LUMINANCE:
- case GL_RGB:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_Decal;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_RGBA:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_Copy;
- break;
-
- case GL_ALPHA:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_CopyAlpha1;
- break;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 1, &imesa->regs.s4.texBlendCtrl);
- break;
- case GL_MODULATE:
- imesa->regs.s4.texCtrl[1].ni.clrArg1Invert = GL_FALSE;
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_ModulAlpha1;
- __HWEnvCombineSingleUnitScale(imesa, 0, 1, &imesa->regs.s4.texBlendCtrl);
- break;
-
- case GL_ADD:
- imesa->regs.s4.texCtrl[1].ni.clrArg1Invert = GL_FALSE;
- switch (format)
- {
- case GL_ALPHA:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_ModulAlpha1;
- break;
-
- case GL_LUMINANCE:
- case GL_RGB:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_Add1;
- break;
-
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_Add1;
- break;
-
- case GL_INTENSITY:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_AddAlpha1;
- break;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 1, &imesa->regs.s4.texBlendCtrl);
- break;
-
-#if GL_ARB_texture_env_combine
- case GL_COMBINE_ARB:
- __HWParseTexEnvCombine(imesa, 1, &texCtrl, &imesa->regs.s4.texBlendCtrl);
- break;
-#endif
-
- case GL_DECAL:
- imesa->regs.s4.texCtrl[1].ni.clrArg1Invert = GL_FALSE;
-
- switch (format)
- {
- case GL_LUMINANCE:
- case GL_RGB:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_Decal1;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_RGBA:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_DecalAlpha1;
- break;
-
- /*
- // GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_INTENSITY
- // are undefined with GL_DECAL
- */
- case GL_ALPHA:
- imesa->regs.s4.texBlendCtrl[1].ui = TBC_CopyAlpha1;
- break;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 1, &imesa->regs.s4.texBlendCtrl);
- break;
-
- case GL_BLEND:
- if (format == GL_LUMINANCE)
- {
- /*
- // This is a hack for GLQuake, invert.
- */
- imesa->regs.s4.texCtrl[1].ni.clrArg1Invert = GL_TRUE;
- imesa->regs.s4.texBlendCtrl[1].ui = 0;
- }
- __HWEnvCombineSingleUnitScale(imesa, 0, 1, &imesa->regs.s4.texBlendCtrl);
- break;
-
- default:
- fprintf(stderr, "unknown tex 1 env mode\n");
- exit(1);
- break;
- }
-
- savage4_set_wrap_mode( imesa, 1, t->setup.sWrapMode, t->setup.tWrapMode );
- savage4_set_filter_mode( imesa, 1, t->setup.minFilter, t->setup.magFilter );
-
- if((ctx->Texture.Unit[1].LodBias !=0.0F) ||
- (imesa->regs.s4.texCtrl[1].ni.dBias != 0))
- {
- int bias = (int)(ctx->Texture.Unit[1].LodBias * 32.0) +
- SAVAGE4_LOD_OFFSET;
- if (bias < -256)
- bias = -256;
- else if (bias > 255)
- bias = 255;
- imesa->regs.s4.texCtrl[1].ni.dBias = bias & 0x1ff;
- }
-
- image = tObj->Image[0][tObj->BaseLevel];
- imesa->regs.s4.texDescr.ni.tex1En = GL_TRUE;
- imesa->regs.s4.texDescr.ni.tex1Width = image->WidthLog2;
- imesa->regs.s4.texDescr.ni.tex1Height = image->HeightLog2;
- imesa->regs.s4.texDescr.ni.tex1Fmt = t->hwFormat;
- imesa->regs.s4.texCtrl[1].ni.dMax = t->base.lastLevel - t->base.firstLevel;
- imesa->regs.s4.texDescr.ni.texBLoopEn = GL_TRUE;
-
- imesa->regs.s4.texAddr[1].ui = (u_int32_t) t->setup.physAddr | 2;
- if(t->base.heap->heapId == SAVAGE_AGP_HEAP)
- imesa->regs.s4.texAddr[1].ui |= 0x1;
-}
-static void savageUpdateTexState_s3d( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- struct gl_texture_object *tObj;
- struct gl_texture_image *image;
- savageTexObjPtr t;
- GLuint format;
-
- /* disable */
- imesa->regs.s3d.texCtrl.ui = 0;
- imesa->regs.s3d.texCtrl.ni.texEn = GL_FALSE;
- imesa->regs.s3d.texCtrl.ni.dBias = 0x08;
- imesa->regs.s3d.texCtrl.ni.texXprEn = GL_TRUE;
- if (ctx->Texture.Unit[0]._ReallyEnabled == 0)
- return;
-
- tObj = ctx->Texture.Unit[0]._Current;
- if ((ctx->Texture.Unit[0]._ReallyEnabled & ~(TEXTURE_1D_BIT|TEXTURE_2D_BIT))
- || tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- /* 3D texturing enabled, or texture border - fallback */
- FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
- return;
- }
-
- /* Do 2D texture setup */
- t = tObj->DriverData;
- if (!t) {
- t = savageAllocTexObj( tObj );
- if (!t)
- return;
- }
-
- imesa->CurrentTexObj[0] = &t->base;
- t->base.bound |= 1;
-
- if (t->base.dirty_images[0] || t->dirtySubImages) {
- savageSetTexImages(imesa, tObj);
- savageUploadTexImages(imesa, t);
- }
-
- driUpdateTextureLRU( &t->base );
-
- format = tObj->Image[0][tObj->BaseLevel]->Format;
-
- /* FIXME: copied from utah-glx, probably needs some tuning */
- switch (ctx->Texture.Unit[0].EnvMode) {
- case GL_DECAL:
- imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = SAVAGETBC_DECALALPHA_S3D;
- break;
- case GL_REPLACE:
- switch (format) {
- case GL_ALPHA: /* FIXME */
- imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = 4;
- break;
- case GL_RGB:
- case GL_LUMINANCE:
- imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = SAVAGETBC_DECAL_S3D;
- break;
- case GL_INTENSITY:
- imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = SAVAGETBC_COPY_S3D;
- }
- break;
- case GL_BLEND: /* hardware can't do GL_BLEND */
- FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
- return;
- case GL_MODULATE:
- imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = SAVAGETBC_MODULATEALPHA_S3D;
- break;
- default:
- fprintf(stderr, "unknown tex env mode\n");
- /*exit(1);*/
- break;
- }
-
- /* The Savage3D can't handle different wrapping modes in s and t.
- * If they are not the same, fall back to software. */
- if (t->setup.sWrapMode != t->setup.tWrapMode) {
- FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_TRUE);
- return;
- }
- imesa->regs.s3d.texCtrl.ni.uWrapEn = 0;
- imesa->regs.s3d.texCtrl.ni.vWrapEn = 0;
- imesa->regs.s3d.texCtrl.ni.wrapMode =
- (t->setup.sWrapMode == GL_REPEAT) ? TAM_Wrap : TAM_Clamp;
-
- switch (t->setup.minFilter) {
- case GL_NEAREST:
- imesa->regs.s3d.texCtrl.ni.filterMode = TFM_Point;
- imesa->regs.s3d.texCtrl.ni.mipmapDisable = GL_TRUE;
- break;
-
- case GL_LINEAR:
- imesa->regs.s3d.texCtrl.ni.filterMode = TFM_Bilin;
- imesa->regs.s3d.texCtrl.ni.mipmapDisable = GL_TRUE;
- break;
-
- case GL_NEAREST_MIPMAP_NEAREST:
- imesa->regs.s3d.texCtrl.ni.filterMode = TFM_Point;
- imesa->regs.s3d.texCtrl.ni.mipmapDisable = GL_FALSE;
- break;
-
- case GL_LINEAR_MIPMAP_NEAREST:
- imesa->regs.s3d.texCtrl.ni.filterMode = TFM_Bilin;
- imesa->regs.s3d.texCtrl.ni.mipmapDisable = GL_FALSE;
- break;
-
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- imesa->regs.s3d.texCtrl.ni.filterMode = TFM_Trilin;
- imesa->regs.s3d.texCtrl.ni.mipmapDisable = GL_FALSE;
- break;
- }
-
- /* There is no way to specify a maximum mipmap level. We may have to
- disable mipmapping completely. */
- /*
- if (t->max_level < t->image[0].image->WidthLog2 ||
- t->max_level < t->image[0].image->HeightLog2) {
- texCtrl.ni.mipmapEnable = GL_TRUE;
- if (texCtrl.ni.filterMode == TFM_Trilin)
- texCtrl.ni.filterMode = TFM_Bilin;
- texCtrl.ni.filterMode = TFM_Point;
- }
- */
-
- if((ctx->Texture.Unit[0].LodBias !=0.0F) ||
- (imesa->regs.s3d.texCtrl.ni.dBias != 0))
- {
- int bias = (int)(ctx->Texture.Unit[0].LodBias * 16.0);
- if (bias < -256)
- bias = -256;
- else if (bias > 255)
- bias = 255;
- imesa->regs.s3d.texCtrl.ni.dBias = bias & 0x1ff;
- }
-
- image = tObj->Image[0][tObj->BaseLevel];
- imesa->regs.s3d.texCtrl.ni.texEn = GL_TRUE;
- imesa->regs.s3d.texDescr.ni.texWidth = image->WidthLog2;
- imesa->regs.s3d.texDescr.ni.texHeight = image->HeightLog2;
- assert (t->hwFormat <= 7);
- imesa->regs.s3d.texDescr.ni.texFmt = t->hwFormat;
-
- imesa->regs.s3d.texAddr.ui = (u_int32_t) t->setup.physAddr | 2;
- if(t->base.heap->heapId == SAVAGE_AGP_HEAP)
- imesa->regs.s3d.texAddr.ui |= 0x1;
-}
-
-
-static void savageTimestampTextures( savageContextPtr imesa )
-{
- /* Timestamp current texture objects for texture heap aging.
- * Only useful with long-lived 32-bit event tags available
- * with Savage DRM 2.3.x or later. */
- if ((imesa->CurrentTexObj[0] || imesa->CurrentTexObj[1]) &&
- imesa->savageScreen->driScrnPriv->drmMinor >= 3) {
- unsigned int e;
- FLUSH_BATCH(imesa);
- e = savageEmitEvent(imesa, SAVAGE_WAIT_3D);
- if (imesa->CurrentTexObj[0])
- imesa->CurrentTexObj[0]->timestamp = e;
- if (imesa->CurrentTexObj[1])
- imesa->CurrentTexObj[1]->timestamp = e;
- }
-}
-
-
-static void savageUpdateTextureState_s4( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
- /* When a texture is about to change or be disabled, timestamp the
- * old texture(s). We'll have to wait for this time stamp before
- * uploading anything to the same texture heap.
- */
- if ((imesa->CurrentTexObj[0] && ctx->Texture.Unit[0]._ReallyEnabled &&
- ctx->Texture.Unit[0]._Current->DriverData != imesa->CurrentTexObj[0]) ||
- (imesa->CurrentTexObj[1] && ctx->Texture.Unit[1]._ReallyEnabled &&
- ctx->Texture.Unit[1]._Current->DriverData != imesa->CurrentTexObj[1]) ||
- (imesa->CurrentTexObj[0] && !ctx->Texture.Unit[0]._ReallyEnabled) ||
- (imesa->CurrentTexObj[1] && !ctx->Texture.Unit[1]._ReallyEnabled))
- savageTimestampTextures(imesa);
-
- if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->bound &= ~1;
- if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->bound &= ~2;
- imesa->CurrentTexObj[0] = 0;
- imesa->CurrentTexObj[1] = 0;
- savageUpdateTex0State_s4( ctx );
- savageUpdateTex1State_s4( ctx );
- imesa->dirty |= (SAVAGE_UPLOAD_TEX0 |
- SAVAGE_UPLOAD_TEX1);
-}
-static void savageUpdateTextureState_s3d( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
- /* When a texture is about to change or be disabled, timestamp the
- * old texture(s). We'll have to wait for this time stamp before
- * uploading anything to the same texture heap.
- */
- if ((imesa->CurrentTexObj[0] && ctx->Texture.Unit[0]._ReallyEnabled &&
- ctx->Texture.Unit[0]._Current->DriverData != imesa->CurrentTexObj[0]) ||
- (imesa->CurrentTexObj[0] && !ctx->Texture.Unit[0]._ReallyEnabled))
- savageTimestampTextures(imesa);
-
- if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->bound &= ~1;
- imesa->CurrentTexObj[0] = 0;
- savageUpdateTexState_s3d( ctx );
- imesa->dirty |= (SAVAGE_UPLOAD_TEX0);
-}
-void savageUpdateTextureState( GLcontext *ctx)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
- FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_FALSE);
- FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_FALSE);
- if (imesa->savageScreen->chipset >= S3_SAVAGE4)
- savageUpdateTextureState_s4 (ctx);
- else
- savageUpdateTextureState_s3d (ctx);
-}
-
-
-
-/*****************************************
- * DRIVER functions
- *****************************************/
-
-static void savageTexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
-
- if (pname == GL_TEXTURE_ENV_MODE) {
-
- imesa->new_state |= SAVAGE_NEW_TEXTURE;
-
- } else if (pname == GL_TEXTURE_ENV_COLOR) {
-
- struct gl_texture_unit *texUnit =
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- const GLfloat *fc = texUnit->EnvColor;
- GLuint r, g, b, a;
- 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]);
-
- imesa->texEnvColor = ((a << 24) | (r << 16) |
- (g << 8) | (b << 0));
-
-
- }
-}
-
-/* Update the heap's time stamp, so the new image is not uploaded
- * while the old one is still in use. If the texture that is going to
- * be changed is currently bound, we need to timestamp the texture
- * first. */
-static void savageTexImageChanged (savageTexObjPtr t) {
- if (t->base.heap) {
- if (t->base.bound)
- savageTimestampTextures(
- (savageContextPtr)t->base.heap->driverContext);
- if (t->base.timestamp > t->base.heap->timestamp)
- t->base.heap->timestamp = t->base.timestamp;
- }
-}
-
-static void savageTexImage1D( 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 )
-{
- savageTexObjPtr t = (savageTexObjPtr) texObj->DriverData;
- if (t) {
- savageTexImageChanged (t);
- } else {
- t = savageAllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
- return;
- }
- }
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, packing, texObj, texImage );
- t->base.dirty_images[0] |= (1 << level);
- SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void savageTexSubImage1D( 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 )
-{
- savageTexObjPtr t = (savageTexObjPtr) texObj->DriverData;
- assert( t ); /* this _should_ be true */
- if (t) {
- savageTexImageChanged (t);
- savageMarkDirtyTiles(t, level, texImage->Width2, 1,
- xoffset, 0, width, 1);
- } else {
- t = savageAllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
- return;
- }
- t->base.dirty_images[0] |= (1 << level);
- }
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
- t->dirtySubImages |= (1 << level);
- SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void savageTexImage2D( 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 )
-{
- savageTexObjPtr t = (savageTexObjPtr) texObj->DriverData;
- if (t) {
- savageTexImageChanged (t);
- } else {
- t = savageAllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- }
- _mesa_store_teximage2d( ctx, target, level, internalFormat,
- width, height, border, format, type,
- pixels, packing, texObj, texImage );
- t->base.dirty_images[0] |= (1 << level);
- SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void savageTexSubImage2D( 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 )
-{
- savageTexObjPtr t = (savageTexObjPtr) texObj->DriverData;
- assert( t ); /* this _should_ be true */
- if (t) {
- savageTexImageChanged (t);
- savageMarkDirtyTiles(t, level, texImage->Width2, texImage->Height2,
- xoffset, yoffset, width, height);
- } else {
- t = savageAllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- t->base.dirty_images[0] |= (1 << level);
- }
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
- t->dirtySubImages |= (1 << level);
- SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void
-savageCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLsizei imageSize, const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- savageTexObjPtr t = (savageTexObjPtr) texObj->DriverData;
- if (t) {
- savageTexImageChanged (t);
- } else {
- t = savageAllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- }
- _mesa_store_compressed_teximage2d( ctx, target, level, internalFormat,
- width, height, border, imageSize,
- data, texObj, texImage );
- t->base.dirty_images[0] |= (1 << level);
- SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void
-savageCompressedTexSubImage2D( GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize,
- const GLvoid *data,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- savageTexObjPtr t = (savageTexObjPtr) texObj->DriverData;
- assert( t ); /* this _should_ be true */
- if (t) {
- savageTexImageChanged (t);
- savageMarkDirtyTiles(t, level, texImage->Width2, texImage->Height2,
- xoffset, yoffset, width, height);
- } else {
- t = savageAllocTexObj(texObj);
- if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- return;
- }
- t->base.dirty_images[0] |= (1 << level);
- }
- _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset,
- width, height, format, imageSize,
- data, texObj, texImage);
- t->dirtySubImages |= (1 << level);
- SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void savageTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat *params )
-{
- savageTexObjPtr t = (savageTexObjPtr) tObj->DriverData;
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
-
- if (!t || (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D))
- return;
-
- switch (pname) {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- savageSetTexFilter(t,tObj->MinFilter,tObj->MagFilter);
- break;
-
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- savageSetTexWrapping(t,tObj->WrapS,tObj->WrapT);
- break;
-
- case GL_TEXTURE_BORDER_COLOR:
- savageSetTexBorderColor(t,tObj->_BorderChan);
- break;
-
- default:
- return;
- }
-
- imesa->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void savageBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *tObj )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
-
- assert( (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D) ||
- (tObj->DriverData != NULL) );
-
- imesa->new_state |= SAVAGE_NEW_TEXTURE;
-}
-
-static void savageDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
-{
- driTextureObject *t = (driTextureObject *)tObj->DriverData;
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
-
- if (t) {
- if (t->bound)
- savageTimestampTextures(imesa);
-
- driDestroyTextureObject(t);
- }
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
-}
-
-
-static struct gl_texture_object *
-savageNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- savageAllocTexObj( obj );
-
- return obj;
-}
-
-void savageDDInitTextureFuncs( struct dd_function_table *functions )
-{
- functions->TexEnv = savageTexEnv;
- functions->ChooseTextureFormat = savageChooseTextureFormat;
- functions->TexImage1D = savageTexImage1D;
- functions->TexSubImage1D = savageTexSubImage1D;
- functions->TexImage2D = savageTexImage2D;
- functions->TexSubImage2D = savageTexSubImage2D;
- functions->CompressedTexImage2D = savageCompressedTexImage2D;
- functions->CompressedTexSubImage2D = savageCompressedTexSubImage2D;
- functions->BindTexture = savageBindTexture;
- functions->NewTextureObject = savageNewTextureObject;
- functions->DeleteTexture = savageDeleteTexture;
- functions->IsTextureResident = driIsTextureResident;
- functions->TexParameter = savageTexParameter;
-
- /* Texel fetching with our custom texture formats works just like
- * the standard argb formats. */
- _savage_texformat_a1114444.FetchTexel1D = _mesa_texformat_argb4444.FetchTexel1D;
- _savage_texformat_a1114444.FetchTexel2D = _mesa_texformat_argb4444.FetchTexel2D;
- _savage_texformat_a1114444.FetchTexel3D = _mesa_texformat_argb4444.FetchTexel3D;
- _savage_texformat_a1114444.FetchTexel1Df= _mesa_texformat_argb4444.FetchTexel1Df;
- _savage_texformat_a1114444.FetchTexel2Df= _mesa_texformat_argb4444.FetchTexel2Df;
- _savage_texformat_a1114444.FetchTexel3Df= _mesa_texformat_argb4444.FetchTexel3Df;
-
- _savage_texformat_a1118888.FetchTexel1D = _mesa_texformat_argb8888.FetchTexel1D;
- _savage_texformat_a1118888.FetchTexel2D = _mesa_texformat_argb8888.FetchTexel2D;
- _savage_texformat_a1118888.FetchTexel3D = _mesa_texformat_argb8888.FetchTexel3D;
- _savage_texformat_a1118888.FetchTexel1Df= _mesa_texformat_argb8888.FetchTexel1Df;
- _savage_texformat_a1118888.FetchTexel2Df= _mesa_texformat_argb8888.FetchTexel2Df;
- _savage_texformat_a1118888.FetchTexel3Df= _mesa_texformat_argb8888.FetchTexel3Df;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.h
deleted file mode 100644
index f1ee72241..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetex.h
+++ /dev/null
@@ -1,83 +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.
- */
-
-
-#ifndef SAVAGETEX_INC
-#define SAVAGETEX_INC
-
-#include "mtypes.h"
-
-#include "savagecontext.h"
-#include "texmem.h"
-
-#define SAVAGE_TEX_MAXLEVELS 12
-
-/** \brief Texture tiling information */
-typedef struct savage_tileinfo_t {
- GLuint width, height; /**< tile width and height */
- GLuint wInSub, hInSub; /**< tile width and height in subtiles */
- GLuint subWidth, subHeight; /**< subtile width and height */
- GLuint tinyOffset[2]; /**< internal offsets size 1 and 2 images */
-} savageTileInfo, *savageTileInfoPtr;
-
-typedef struct {
- GLuint offset;
- GLuint nTiles;
- GLuint *dirtyTiles; /* bit vector of dirty tiles (still unused) */
-} savageTexImage;
-
-typedef struct {
- driTextureObject base;
-
- GLubyte *bufAddr;
-
- GLuint age;
- savageTexImage image[SAVAGE_TEX_MAXLEVELS];
- GLuint dirtySubImages;
-
- struct {
- GLuint sWrapMode, tWrapMode;
- GLuint minFilter, magFilter;
- GLuint physAddr;
- } setup;
-
- GLuint hwFormat;
- GLuint texelBytes;
- const savageTileInfo *tileInfo;
-} savageTexObj, *savageTexObjPtr;
-
-#define SAVAGE_NO_PALETTE 0x0
-#define SAVAGE_USE_PALETTE 0x1
-#define SAVAGE_UPDATE_PALETTE 0x2
-#define SAVAGE_FALLBACK_PALETTE 0x4
-#define __HWEnvCombineSingleUnitScale(imesa, flag0, flag1, TexBlendCtrl)
-#define __HWParseTexEnvCombine(imesa, flag0, TexCtrl, TexBlendCtrl)
-
-
-void savageUpdateTextureState( GLcontext *ctx );
-void savageDDInitTextureFuncs( struct dd_function_table *functions );
-
-void savageDestroyTexObj( savageContextPtr imesa, savageTexObjPtr t );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.c
deleted file mode 100644
index 184704013..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.c
+++ /dev/null
@@ -1,1297 +0,0 @@
-/* $XFree86$ */ /* -*- c-basic-offset: 3 -*- */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
-ATI, 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:
- * Keith Whitwell <keithw@valinux.com>
- * Felix Kuehling <fxkuehl@gmx.de>
- *
- */
-
-#include <stdio.h>
-#include <math.h>
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "macros.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 "savagetris.h"
-#include "savagestate.h"
-#include "savagetex.h"
-#include "savageioctl.h"
-#include "savage_bci.h"
-
-static void savageRasterPrimitive( GLcontext *ctx, GLuint prim );
-static void savageRenderPrimitive( 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
-};
-
-
-/***********************************************************************
- * Emit primitives *
- ***********************************************************************/
-
-#if defined (USE_X86_ASM)
-#define EMIT_VERT( j, vb, vertex_size, start, v ) \
-do { int __tmp; \
- vb += start; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertex_size-start), \
- "D" ((long)vb), \
- "S" ((long)&(v)->ui[start])); \
-} while (0)
-#else
-#define EMIT_VERT( j, vb, vertex_size, start, v ) \
-do { \
- for ( j = start ; j < vertex_size ; j++ ) \
- vb[j] = (v)->ui[j]; \
- vb += vertex_size; \
-} while (0)
-#endif
-
-static void __inline__ savage_draw_triangle (savageContextPtr imesa,
- savageVertexPtr v0,
- savageVertexPtr v1,
- savageVertexPtr v2) {
- GLuint vertsize = imesa->HwVertexSize;
- u_int32_t *vb = savageAllocVtxBuf (imesa, 3*vertsize);
- GLuint j;
-
- EMIT_VERT (j, vb, vertsize, 0, v0);
- EMIT_VERT (j, vb, vertsize, 0, v1);
- EMIT_VERT (j, vb, vertsize, 0, v2);
-}
-
-static void __inline__ savage_draw_quad (savageContextPtr imesa,
- savageVertexPtr v0,
- savageVertexPtr v1,
- savageVertexPtr v2,
- savageVertexPtr v3) {
- GLuint vertsize = imesa->HwVertexSize;
- u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- GLuint j;
-
- EMIT_VERT (j, vb, vertsize, 0, v0);
- EMIT_VERT (j, vb, vertsize, 0, v1);
- EMIT_VERT (j, vb, vertsize, 0, v3);
- EMIT_VERT (j, vb, vertsize, 0, v1);
- EMIT_VERT (j, vb, vertsize, 0, v2);
- EMIT_VERT (j, vb, vertsize, 0, v3);
-}
-
-static __inline__ void savage_draw_point (savageContextPtr imesa,
- savageVertexPtr tmp) {
- GLuint vertsize = imesa->HwVertexSize;
- u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- const GLfloat x = tmp->v.x;
- const GLfloat y = tmp->v.y;
- const GLfloat sz = imesa->glCtx->Point._Size * .5;
- GLuint j;
-
- *(float *)&vb[0] = x - sz;
- *(float *)&vb[1] = y - sz;
- EMIT_VERT (j, vb, vertsize, 2, tmp);
-
- *(float *)&vb[0] = x + sz;
- *(float *)&vb[1] = y - sz;
- EMIT_VERT (j, vb, vertsize, 2, tmp);
-
- *(float *)&vb[0] = x + sz;
- *(float *)&vb[1] = y + sz;
- EMIT_VERT (j, vb, vertsize, 2, tmp);
-
- *(float *)&vb[0] = x + sz;
- *(float *)&vb[1] = y + sz;
- EMIT_VERT (j, vb, vertsize, 2, tmp);
-
- *(float *)&vb[0] = x - sz;
- *(float *)&vb[1] = y + sz;
- EMIT_VERT (j, vb, vertsize, 2, tmp);
-
- *(float *)&vb[0] = x - sz;
- *(float *)&vb[1] = y - sz;
- EMIT_VERT (j, vb, vertsize, 2, tmp);
-}
-
-static __inline__ void savage_draw_line (savageContextPtr imesa,
- savageVertexPtr v0,
- savageVertexPtr v1 ) {
- GLuint vertsize = imesa->HwVertexSize;
- u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- GLfloat width = imesa->glCtx->Line._Width;
- GLfloat dx, dy, ix, iy;
- GLuint j;
-
- dx = v0->v.x - v1->v.x;
- dy = v0->v.y - v1->v.y;
-
- ix = width * .5; iy = 0;
- if (dx * dx > dy * dy) {
- iy = ix; ix = 0;
- }
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- EMIT_VERT (j, vb, vertsize, 2, v0);
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- EMIT_VERT (j, vb, vertsize, 2, v1);
-
- *(float *)&vb[0] = v0->v.x + ix;
- *(float *)&vb[1] = v0->v.y + iy;
- EMIT_VERT (j, vb, vertsize, 2, v0);
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- EMIT_VERT (j, vb, vertsize, 2, v0);
-
- *(float *)&vb[0] = v1->v.x - ix;
- *(float *)&vb[1] = v1->v.y - iy;
- EMIT_VERT (j, vb, vertsize, 2, v1);
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- EMIT_VERT (j, vb, vertsize, 2, v1);
-}
-
-/* Fallback drawing functions for the ptex hack. Code duplication
- * (especially lines and points) isn't beautiful, but I didn't feel
- * like inventing yet another template. :-/
- */
-#define PTEX_VERTEX( j, tmp, vertex_size, start, v) \
-do { \
- GLfloat rhw = 1.0 / v->f[vertex_size]; \
- for ( j = start ; j < vertex_size ; j++ ) \
- tmp.f[j] = v->f[j]; \
- tmp.f[3] *= v->f[vertex_size]; \
- tmp.f[vertex_size-2] *= rhw; \
- tmp.f[vertex_size-1] *= rhw; \
-} while (0)
-
-static void __inline__ savage_ptex_tri (savageContextPtr imesa,
- savageVertexPtr v0,
- savageVertexPtr v1,
- savageVertexPtr v2) {
- GLuint vertsize = imesa->HwVertexSize;
- u_int32_t *vb = savageAllocVtxBuf (imesa, 3*vertsize);
- savageVertex tmp;
- GLuint j;
-
- PTEX_VERTEX (j, tmp, vertsize, 0, v0); EMIT_VERT (j, vb, vertsize, 0, &tmp);
- PTEX_VERTEX (j, tmp, vertsize, 0, v1); EMIT_VERT (j, vb, vertsize, 0, &tmp);
- PTEX_VERTEX (j, tmp, vertsize, 0, v2); EMIT_VERT (j, vb, vertsize, 0, &tmp);
-}
-
-static __inline__ void savage_ptex_line (savageContextPtr imesa,
- savageVertexPtr v0,
- savageVertexPtr v1 ) {
- GLuint vertsize = imesa->HwVertexSize;
- u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- GLfloat width = imesa->glCtx->Line._Width;
- GLfloat dx, dy, ix, iy;
- savageVertex tmp0, tmp1;
- GLuint j;
-
- PTEX_VERTEX (j, tmp0, vertsize, 2, v0);
- PTEX_VERTEX (j, tmp1, vertsize, 2, v1);
-
- dx = v0->v.x - v1->v.x;
- dy = v0->v.y - v1->v.y;
-
- ix = width * .5; iy = 0;
- if (dx * dx > dy * dy) {
- iy = ix; ix = 0;
- }
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- EMIT_VERT (j, vb, vertsize, 2, &tmp0);
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- EMIT_VERT (j, vb, vertsize, 2, &tmp1);
-
- *(float *)&vb[0] = v0->v.x + ix;
- *(float *)&vb[1] = v0->v.y + iy;
- EMIT_VERT (j, vb, vertsize, 2, &tmp0);
-
- *(float *)&vb[0] = v0->v.x - ix;
- *(float *)&vb[1] = v0->v.y - iy;
- EMIT_VERT (j, vb, vertsize, 2, &tmp0);
-
- *(float *)&vb[0] = v1->v.x - ix;
- *(float *)&vb[1] = v1->v.y - iy;
- EMIT_VERT (j, vb, vertsize, 2, &tmp1);
-
- *(float *)&vb[0] = v1->v.x + ix;
- *(float *)&vb[1] = v1->v.y + iy;
- EMIT_VERT (j, vb, vertsize, 2, &tmp1);
-}
-
-static __inline__ void savage_ptex_point (savageContextPtr imesa,
- savageVertexPtr v0) {
- GLuint vertsize = imesa->HwVertexSize;
- u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- const GLfloat x = v0->v.x;
- const GLfloat y = v0->v.y;
- const GLfloat sz = imesa->glCtx->Point._Size * .5;
- savageVertex tmp;
- GLuint j;
-
- PTEX_VERTEX (j, tmp, vertsize, 2, v0);
-
- *(float *)&vb[0] = x - sz;
- *(float *)&vb[1] = y - sz;
- EMIT_VERT (j, vb, vertsize, 2, &tmp);
-
- *(float *)&vb[0] = x + sz;
- *(float *)&vb[1] = y - sz;
- EMIT_VERT (j, vb, vertsize, 2, &tmp);
-
- *(float *)&vb[0] = x + sz;
- *(float *)&vb[1] = y + sz;
- EMIT_VERT (j, vb, vertsize, 2, &tmp);
-
- *(float *)&vb[0] = x + sz;
- *(float *)&vb[1] = y + sz;
- EMIT_VERT (j, vb, vertsize, 2, &tmp);
-
- *(float *)&vb[0] = x - sz;
- *(float *)&vb[1] = y + sz;
- EMIT_VERT (j, vb, vertsize, 2, &tmp);
-
- *(float *)&vb[0] = x - sz;
- *(float *)&vb[1] = y - sz;
- EMIT_VERT (j, vb, vertsize, 2, &tmp);
-}
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_tri( imesa, a, b, c ); \
- else \
- savage_draw_triangle( imesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- imesa->draw_tri( imesa, a, b, d ); \
- imesa->draw_tri( imesa, b, c, d ); \
- } else \
- savage_draw_quad( imesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_line( imesa, v0, v1 ); \
- else \
- savage_draw_line( imesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- imesa->draw_point( imesa, v0 ); \
- else \
- savage_draw_point( imesa, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define SAVAGE_OFFSET_BIT 0x1
-#define SAVAGE_TWOSIDE_BIT 0x2
-#define SAVAGE_UNFILLED_BIT 0x4
-#define SAVAGE_FALLBACK_BIT 0x8
-#define SAVAGE_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[SAVAGE_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & SAVAGE_FALLBACK_BIT)
-#define DO_OFFSET (IND & SAVAGE_OFFSET_BIT)
-#define DO_UNFILLED (IND & SAVAGE_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & SAVAGE_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX savageVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE imesa->depth_scale
-#define REVERSE_DEPTH 1
-#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) (imesa->verts + (e * imesa->vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- savage_color_t *color = (savage_color_t *)&((v)->ub4[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) \
-do { \
- if (specoffset) { \
- savage_color_t *spec = (savage_color_t *)&((v)->ub4[specoffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(spec->blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
- if (specoffset) COPY_3V(v0->ub4[specoffset], v1->ub4[specoffset])
-#define VERT_SAVE_SPEC( idx ) \
- if (specoffset) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) \
- if (specoffset) v[idx]->ui[specoffset] = spec[idx]
-
-#define LOCAL_VARS(n) \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = \
- ((imesa->skip & SAVAGE_SKIP_W) ? 3 : 4); \
- GLboolean specoffset = \
- ((imesa->skip & SAVAGE_SKIP_C1) ? 0 : coloroffset+1); \
- (void) color; (void) spec; (void) coloroffset; (void) specoffset;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (imesa->raster_primitive != reduced_prim[x]) \
- savageRasterPrimitive( ctx, x )
-#define RENDER_PRIMITIVE imesa->render_primitive
-#define IND SAVAGE_FALLBACK_BIT
-#define TAG(x) x
-#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 (SAVAGE_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT|SAVAGE_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_OFFSET_BIT|SAVAGE_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT|SAVAGE_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT|SAVAGE_OFFSET_BIT|SAVAGE_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_OFFSET_BIT|SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT|SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT|SAVAGE_OFFSET_BIT|SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_UNFILLED_BIT|SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_OFFSET_BIT|SAVAGE_UNFILLED_BIT|SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT|SAVAGE_UNFILLED_BIT|SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SAVAGE_TWOSIDE_BIT|SAVAGE_OFFSET_BIT|SAVAGE_UNFILLED_BIT| \
- SAVAGE_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-
-/***********************************************************************
- * 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
-savage_fallback_tri( savageContextPtr imesa,
- savageVertexPtr v0,
- savageVertexPtr v1,
- savageVertexPtr v2 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[3];
- FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY(imesa);
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swsetup_Translate( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-savage_fallback_line( savageContextPtr imesa,
- savageVertexPtr v0,
- savageVertexPtr v1 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[2];
- FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY(imesa);
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-savage_fallback_point( savageContextPtr imesa,
- savageVertexPtr v0 )
-{
- GLcontext *ctx = imesa->glCtx;
- SWvertex v[1];
- FLUSH_BATCH(imesa);
- WAIT_IDLE_EMPTY(imesa);
- _swsetup_Translate( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (savageVertexPtr)(savageVerts + (x * vertsize * sizeof(int)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- savage_draw_point( imesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- savage_draw_line( imesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- savage_draw_triangle( imesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- savage_draw_quad( imesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) do { \
- if (0) fprintf(stderr, "%s\n", __FUNCTION__); \
- savageRenderPrimitive( ctx, x ); \
- /*SAVAGE_CONTEXT(ctx)->render_primitive = x;*/ \
-} while (0)
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \
- const GLuint vertsize = imesa->vertex_size; \
- const char *savageVerts = (char *)imesa->verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) savage_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) savage_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void savageRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- /* 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;
- }
-}
-
-static void savageRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-/*
-static void savageFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- r128ContextPtr rmesa = R128_CONTEXT( ctx );
- GLuint vertsize = rmesa->vertex_size;
- GLuint *vb = r128AllocDmaLow( rmesa, (n-2) * 3 * 4 * vertsize );
- GLubyte *r128verts = (GLubyte *)rmesa->verts;
- const GLuint shift = rmesa->vertex_stride_shift;
- const GLuint *start = (const GLuint *)VERT(elts[0]);
- int i,j;
-
- rmesa->num_verts += (n-2) * 3;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, (r128VertexPtr) start );
- COPY_DWORDS( j, vb, vertsize, (r128VertexPtr) VERT(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, (r128VertexPtr) VERT(elts[i]) );
- }
-}
-*/
-
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define _SAVAGE_NEW_RENDER_STATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_STIPPLE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET) \
-
-/* original driver didn't have DD_POINT_SMOOTH. really needed? */
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH)
-#define TRI_FALLBACK (DD_TRI_STIPPLE|DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-
-static void savageChooseRenderState(GLcontext *ctx)
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- /* Hook in fallback functions for the ptex hack. Do this first, so
- * that a real fallback will overwrite them with the respective
- * savage_fallback_... function.
- */
- if (imesa->ptexHack) {
- /* Do textures make sense with points? */
- imesa->draw_point = savage_ptex_point;
- imesa->draw_line = savage_ptex_line;
- imesa->draw_tri = savage_ptex_tri;
- index |= SAVAGE_FALLBACK_BIT;
- } else {
- imesa->draw_point = savage_draw_point;
- imesa->draw_line = savage_draw_line;
- imesa->draw_tri = savage_draw_triangle;
- }
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= SAVAGE_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= SAVAGE_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= SAVAGE_UNFILLED_BIT;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS) {
- if (flags & POINT_FALLBACK) imesa->draw_point = savage_fallback_point;
- if (flags & LINE_FALLBACK) imesa->draw_line = savage_fallback_line;
- if (flags & TRI_FALLBACK) imesa->draw_tri = savage_fallback_tri;
- index |= SAVAGE_FALLBACK_BIT;
- if (SAVAGE_DEBUG & DEBUG_FALLBACKS) {
- fprintf (stderr, "Per-primitive fallback, TriangleCaps=0x%x\n",
- ctx->_TriangleCaps);
- }
- }
- }
-
- if (index != imesa->RenderIndex) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- 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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = savage_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = savage_render_tab_elts;
- tnl->Driver.Render.ClippedLine = rast_tab[index].line;
- tnl->Driver.Render.ClippedPolygon = savageRenderClippedPoly/*r128FastRenderClippedPoly*/;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = savageRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = savageRenderClippedPoly;
- }
-
- imesa->RenderIndex = index;
- }
-}
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-static void savageRunPipeline( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-
- if (imesa->no_rast)
- FALLBACK(ctx, SAVAGE_FALLBACK_NORAST, GL_TRUE);
-
- if (imesa->new_state)
- savageDDUpdateHwState( ctx );
-
- if (!imesa->Fallback) {
- if (imesa->new_gl_state & _SAVAGE_NEW_RENDER_STATE)
- savageChooseRenderState( ctx );
-
- /* choose the correct primitive type for tnl rendering */
- if (imesa->savageScreen->chipset < S3_SAVAGE4 &&
- (ctx->_TriangleCaps & DD_FLATSHADE)) {
- if (imesa->HwPrim != SAVAGE_PRIM_TRILIST_201)
- savageFlushVertices(imesa);
- imesa->HwPrim = SAVAGE_PRIM_TRILIST_201;
- } else {
- if (imesa->HwPrim != SAVAGE_PRIM_TRILIST)
- savageFlushVertices(imesa);
- imesa->HwPrim = SAVAGE_PRIM_TRILIST;
- }
-
- imesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-
- if (imesa->no_rast)
- FALLBACK(ctx, SAVAGE_FALLBACK_NORAST, GL_FALSE);
-}
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-/* This is called when Mesa switches between rendering triangle
- * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc),
- * and lines, points and bitmaps.
- *
- * As the r128 uses triangles to render lines and points, it is
- * necessary to turn off hardware culling when rendering these
- * primitives.
- */
-
-static void savageRasterPrimitive( GLcontext *ctx, GLuint prim )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
-
- /* Update culling */
- if (imesa->raster_primitive != prim) {
- imesa->raster_primitive = prim;
- imesa->new_state |= SAVAGE_NEW_CULL;
- savageDDUpdateHwState (ctx);
- }
-
-#if 0
- if (ctx->Polygon.StippleFlag && mmesa->haveHwStipple)
- {
- mmesa->dirty |= MGA_UPLOAD_CONTEXT;
- mmesa->setup.dwgctl &= ~(0xf<<20);
- if (mmesa->raster_primitive == GL_TRIANGLES)
- mmesa->setup.dwgctl |= mmesa->poly_stipple;
- }
-#endif
-}
-
-static void savageRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLuint rprim = reduced_prim[prim];
-
- imesa->render_primitive = prim;
-
- if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- if (imesa->raster_primitive != rprim) {
- savageRasterPrimitive( ctx, rprim );
- }
-}
-
-/* Check if projective texture coordinates are used and if we can fake
- * them. Fallback to swrast we can't. Returns GL_TRUE if projective
- * texture coordinates must be faked, GL_FALSE otherwise.
- */
-static GLboolean savageCheckPTexHack( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
-
- if (index & _TNL_BIT_TEX(0) && VB->TexCoordPtr[0]->size == 4) {
- if ((index & _TNL_BITS_TEX_ANY) == _TNL_BIT_TEX(0))
- return GL_TRUE; /* apply ptex hack */
- else
- FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
- }
- if ((index & _TNL_BIT_TEX(1)) && VB->TexCoordPtr[1]->size == 4)
- FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE);
-
- return GL_FALSE; /* don't apply ptex hack */
-}
-
-
-#define DO_EMIT_ATTR( ATTR, STYLE ) \
-do { \
- imesa->vertex_attrs[imesa->vertex_attr_count].attrib = (ATTR); \
- imesa->vertex_attrs[imesa->vertex_attr_count].format = (STYLE); \
- imesa->vertex_attr_count++; \
-} while (0)
-
-#define NEED_ATTR( INDEX, SKIP ) \
-do { \
- setupIndex |= (INDEX); \
- skip &= ~(SKIP); \
-} while (0)
-
-#define EMIT_ATTR( ATTR, STYLE, INDEX, SKIP ) \
-do { \
- NEED_ATTR( INDEX, SKIP ); \
- DO_EMIT_ATTR( ATTR, STYLE ); \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- imesa->vertex_attrs[imesa->vertex_attr_count].attrib = 0; \
- imesa->vertex_attrs[imesa->vertex_attr_count].format = EMIT_PAD; \
- imesa->vertex_attrs[imesa->vertex_attr_count].offset = (N); \
- imesa->vertex_attr_count++; \
-} while (0)
-
-#define SAVAGE_EMIT_XYZ 0x0001
-#define SAVAGE_EMIT_W 0x0002
-#define SAVAGE_EMIT_C0 0x0004
-#define SAVAGE_EMIT_C1 0x0008
-#define SAVAGE_EMIT_FOG 0x0010
-#define SAVAGE_EMIT_S0 0x0020
-#define SAVAGE_EMIT_T0 0x0040
-#define SAVAGE_EMIT_Q0 0x0080
-#define SAVAGE_EMIT_ST0 0x0060
-#define SAVAGE_EMIT_STQ0 0x00e0
-#define SAVAGE_EMIT_S1 0x0100
-#define SAVAGE_EMIT_T1 0x0200
-#define SAVAGE_EMIT_ST1 0x0300
-
-
-static __inline__ GLuint savageChooseVertexFormat_s3d( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLuint setupIndex = SAVAGE_EMIT_XYZ;
- GLubyte skip;
-
- imesa->vertex_attr_count = 0;
-
- skip = SAVAGE_SKIP_ALL_S3D;
- skip &= ~SAVAGE_SKIP_Z; /* all mesa vertices have a z coordinate */
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if ((index & _TNL_BITS_TEX_ANY) || !(ctx->_TriangleCaps & DD_FLATSHADE))
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, SAVAGE_EMIT_W, SAVAGE_SKIP_W );
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, 0, 0 );
- EMIT_PAD( 4 );
- skip &= ~SAVAGE_SKIP_W;
- }
-
- /* t_context.c always includes a diffuse color */
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, SAVAGE_EMIT_C0, SAVAGE_SKIP_C0 );
-
- if ((index & _TNL_BIT_COLOR1))
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, SAVAGE_EMIT_C1, SAVAGE_SKIP_C1 );
- else
- EMIT_PAD( 3 );
- if ((index & _TNL_BIT_FOG))
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, SAVAGE_EMIT_FOG, SAVAGE_SKIP_C1 );
- else
- EMIT_PAD( 1 );
- skip &= ~SAVAGE_SKIP_C1;
-
- if (index & _TNL_BIT_TEX(0)) {
- if (imesa->ptexHack)
- EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0);
- else if (VB->TexCoordPtr[0]->size == 4)
- assert (0); /* should be caught by savageCheckPTexHack */
- else if (VB->TexCoordPtr[0]->size >= 2)
- /* The chromium menu emits some 3D tex coords even though no
- * 3D texture is enabled. Ignore the 3rd coordinate. */
- EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, SAVAGE_EMIT_ST0, SAVAGE_SKIP_ST0 );
- else if (VB->TexCoordPtr[0]->size == 1) {
- EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_1F, SAVAGE_EMIT_S0, SAVAGE_SKIP_S0 );
- EMIT_PAD( 4 );
- } else
- EMIT_PAD( 8 );
- } else
- EMIT_PAD( 8 );
- skip &= ~SAVAGE_SKIP_ST0;
-
- assert (skip == 0);
- imesa->skip = skip;
- return setupIndex;
-}
-
-
-static __inline__ GLuint savageChooseVertexFormat_s4( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLuint setupIndex = SAVAGE_EMIT_XYZ;
- GLubyte skip;
- GLuint size, mask;
-
- skip = SAVAGE_SKIP_ALL_S4;
- skip &= ~SAVAGE_SKIP_Z; /* all mesa vertices have a z coordinate */
-
- if ((index & _TNL_BITS_TEX_ANY) || !(ctx->_TriangleCaps & DD_FLATSHADE))
- NEED_ATTR( SAVAGE_EMIT_W, SAVAGE_SKIP_W );
-
- /* t_context.c always includes a diffuse color */
- NEED_ATTR( SAVAGE_EMIT_C0, SAVAGE_SKIP_C0 );
-
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if ((index & _TNL_BIT_COLOR1))
- NEED_ATTR( SAVAGE_EMIT_C1, SAVAGE_SKIP_C1 );
- if ((index & _TNL_BIT_FOG))
- NEED_ATTR( SAVAGE_EMIT_FOG, SAVAGE_SKIP_C1 );
- }
-
- if (index & _TNL_BIT_TEX(0)) {
- if (imesa->ptexHack)
- NEED_ATTR( SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0);
- else if (VB->TexCoordPtr[0]->size == 4)
- assert (0); /* should be caught by savageCheckPTexHack */
- else if (VB->TexCoordPtr[0]->size >= 2)
- /* The chromium menu emits some 3D tex coords even though no
- * 3D texture is enabled. Ignore the 3rd coordinate. */
- NEED_ATTR( SAVAGE_EMIT_ST0, SAVAGE_SKIP_ST0 );
- else
- NEED_ATTR( SAVAGE_EMIT_S0, SAVAGE_SKIP_S0 );
- }
- if (index & _TNL_BIT_TEX(1)) {
- if (VB->TexCoordPtr[1]->size == 4)
- /* projective textures are not supported by the hardware */
- assert (0); /* should be caught by savageCheckPTexHack */
- else if (VB->TexCoordPtr[1]->size >= 2)
- NEED_ATTR( SAVAGE_EMIT_ST1, SAVAGE_SKIP_ST1 );
- else
- NEED_ATTR( SAVAGE_EMIT_S1, SAVAGE_SKIP_S1 );
- }
-
- /* if nothing changed we can skip the rest */
- if (setupIndex == imesa->SetupIndex && imesa->vertex_size != 0)
- return setupIndex;
-
- if (imesa->enable_vdma) {
- mask = SAVAGE_SKIP_W;
- size = 10 - (skip & 1) - (skip >> 1 & 1) -
- (skip >> 2 & 1) - (skip >> 3 & 1) - (skip >> 4 & 1) -
- (skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1);
-
- while (size < 8) {
- if (skip & mask) {
- skip &= ~mask;
- size++;
- }
- mask <<= 1;
- }
- }
-
- imesa->vertex_attr_count = 0;
-
- if (skip & SAVAGE_SKIP_W)
- DO_EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT );
- else if (setupIndex & SAVAGE_EMIT_W)
- DO_EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT );
- else {
- DO_EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT );
- EMIT_PAD( 4 );
- }
-
- DO_EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA );
-
- if (!(skip & SAVAGE_SKIP_C1)) {
- if (!(setupIndex & (SAVAGE_EMIT_C1|SAVAGE_EMIT_FOG)))
- EMIT_PAD( 4 );
- else {
- if (setupIndex & SAVAGE_EMIT_C1)
- DO_EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR );
- else
- EMIT_PAD( 3 );
- if (setupIndex & SAVAGE_EMIT_FOG)
- DO_EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F );
- else
- EMIT_PAD( 1 );
- }
- }
-
- if ((skip & SAVAGE_SKIP_ST0) != SAVAGE_SKIP_ST0) {
- if ((setupIndex & SAVAGE_EMIT_STQ0) == SAVAGE_EMIT_STQ0)
- DO_EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW );
- else if ((setupIndex & SAVAGE_EMIT_ST0) == SAVAGE_EMIT_ST0)
- DO_EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F );
- else if ((setupIndex & SAVAGE_EMIT_ST0) == SAVAGE_EMIT_S0) {
- DO_EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_1F );
- if (!(skip & SAVAGE_SKIP_T0)) EMIT_PAD( 4 );
- } else {
- if (!(skip & SAVAGE_SKIP_S0)) EMIT_PAD( 4 );
- if (!(skip & SAVAGE_SKIP_T0)) EMIT_PAD( 4 );
- }
- }
-
- if ((skip & SAVAGE_SKIP_ST1) != SAVAGE_SKIP_ST1) {
- if ((setupIndex & SAVAGE_EMIT_ST1) == SAVAGE_EMIT_ST1)
- DO_EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F );
- else if ((setupIndex & SAVAGE_EMIT_ST1) == SAVAGE_EMIT_S1) {
- DO_EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_1F );
- if (!(skip & SAVAGE_SKIP_T1)) EMIT_PAD( 4 );
- } else {
- if (!(skip & SAVAGE_SKIP_S1)) EMIT_PAD( 4 );
- if (!(skip & SAVAGE_SKIP_T1)) EMIT_PAD( 4 );
- }
- }
-
- imesa->skip = skip;
- return setupIndex;
-}
-
-
-static void savageRenderStart( GLcontext *ctx )
-{
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint setupIndex = SAVAGE_EMIT_XYZ;
- GLboolean ptexHack;
-
- /* Check if we need to apply the ptex hack. Choose a new render
- * state if necessary. (Note: this can't be done in
- * savageRunPipeline, since the number of vertex coordinates can
- * change in the pipeline. texmat or texgen or both?) */
- ptexHack = savageCheckPTexHack( ctx );
- if (ptexHack != imesa->ptexHack) {
- imesa->ptexHack = ptexHack;
- savageChooseRenderState (ctx);
- }
- /* Handle fallback cases identified in savageCheckPTexHack. */
- if (SAVAGE_CONTEXT(ctx)->Fallback) {
- tnl->Driver.Render.Start(ctx);
- return;
- }
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
-
- if (imesa->savageScreen->chipset < S3_SAVAGE4) {
- setupIndex = savageChooseVertexFormat_s3d(ctx);
- } else {
- setupIndex = savageChooseVertexFormat_s4(ctx);
- }
-
- /* Need to change the vertex emit code if the SetupIndex changed or
- * is set for the first time (indicated by vertex_size == 0). */
- if (setupIndex != imesa->SetupIndex || imesa->vertex_size == 0) {
- GLuint hwVertexSize;
- imesa->vertex_size =
- _tnl_install_attrs( ctx,
- imesa->vertex_attrs,
- imesa->vertex_attr_count,
- imesa->hw_viewport, 0 );
- imesa->vertex_size >>= 2;
- imesa->SetupIndex = setupIndex;
-
- hwVertexSize = imesa->vertex_size;
- if (setupIndex & SAVAGE_EMIT_Q0) {
- /* The vertex setup code emits homogenous texture
- * coordinates. They are converted to normal 2D coords by
- * savage_ptex_tri/line/point. Now we have two different
- * vertex sizes. Functions that emit vertices to the hardware
- * need to use HwVertexSize, anything that manipulates the
- * vertices generated by t_vertex uses vertex_size. */
- hwVertexSize--;
- assert (imesa->ptexHack);
- } else
- assert (!imesa->ptexHack);
-
- if (hwVertexSize != imesa->HwVertexSize) {
- /* Changing the vertex size: flush vertex and command buffer and
- * discard the DMA buffer, if we were using one. */
- savageFlushVertices(imesa);
- savageFlushCmdBuf(imesa, GL_TRUE);
- if (hwVertexSize == 8 && imesa->enable_vdma) {
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf (stderr, "Using DMA, skip=0x%02x\n", imesa->skip);
- /* we can use vertex dma */
- imesa->vtxBuf = &imesa->dmaVtxBuf;
- } else {
- if (SAVAGE_DEBUG & DEBUG_DMA)
- fprintf (stderr, "Not using DMA, skip=0x%02x\n", imesa->skip);
- imesa->vtxBuf = &imesa->clientVtxBuf;
- }
- imesa->HwVertexSize = hwVertexSize;
- }
- }
-}
-
-static void savageRenderFinish( GLcontext *ctx )
-{
- /* Flush the last primitive now, before any state is changed. */
- savageFlushVertices(SAVAGE_CONTEXT(ctx));
-
- if (SAVAGE_CONTEXT(ctx)->RenderIndex & SAVAGE_FALLBACK_BIT)
- _swrast_flush( ctx );
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-static const char * const fallbackStrings[] = {
- "Texture mode",
- "Draw buffer",
- "Read buffer",
- "Color mask",
- "Specular",
- "LogicOp",
- "glEnable(GL_STENCIL) without hw stencil buffer",
- "glRenderMode(selection or feedback)",
- "glBlendEquation",
- "Hardware rasterization disabled",
- "Projective texture",
-};
-
-void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- GLuint oldfallback = imesa->Fallback;
- GLuint index;
- for (index = 0; (1 << index) < bit; ++index);
-
- if (mode) {
- imesa->Fallback |= bit;
- if (oldfallback == 0) {
- /* the first fallback */
- _swsetup_Wakeup( ctx );
- imesa->RenderIndex = ~0;
- }
- if (!(oldfallback & bit) && (SAVAGE_DEBUG & DEBUG_FALLBACKS))
- fprintf (stderr, "Savage begin fallback: 0x%x %s\n",
- bit, fallbackStrings[index]);
- }
- else {
- imesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- /* the last fallback */
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = savageRenderStart;
- tnl->Driver.Render.PrimitiveNotify = savageRenderPrimitive;
- tnl->Driver.Render.Finish = savageRenderFinish;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_invalidate_vertex_state( ctx, ~0 );
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_install_attrs( ctx,
- imesa->vertex_attrs,
- imesa->vertex_attr_count,
- imesa->hw_viewport, 0 );
-
- imesa->new_gl_state |= _SAVAGE_NEW_RENDER_STATE;
- }
- if ((oldfallback & bit) && (SAVAGE_DEBUG & DEBUG_FALLBACKS))
- fprintf (stderr, "Savage end fallback: 0x%x %s\n",
- bit, fallbackStrings[index]);
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void savageInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = savageRunPipeline;
- tnl->Driver.Render.Start = savageRenderStart;
- tnl->Driver.Render.Finish = savageRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = savageRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- (6 + 2*ctx->Const.MaxTextureUnits) * sizeof(GLfloat) );
-
- SAVAGE_CONTEXT(ctx)->verts = (char *)tnl->clipspace.vertex_buf;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.h
deleted file mode 100644
index 00803e7ff..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/savagetris.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.4 2001/01/08 01:07:24 martin Exp $ */
-/**************************************************************************
-
-Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, 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, 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
-ATI, 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:
- * Keith Whitwell <keithw@valinux.com>
- * Felix Kuehling <fxkuehl@gmx.de>
- *
- */
-
-#ifndef __R128_TRIS_H__
-#define __R128_TRIS_H__
-
-#include "mtypes.h"
-
-extern void savageInitTriFuncs( GLcontext *ctx );
-
-
-extern void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( ctx, bit, mode ) savageFallback( ctx, bit, mode )
-
-
-#endif /* __R128_TRIS_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/server/savage_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/server/savage_dri.h
deleted file mode 100644
index 214d9851a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/savage/server/savage_dri.h
+++ /dev/null
@@ -1,76 +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.
- */
-
-
-#ifndef __SAVAGE_DRI_H__
-#define __SAVAGE_DRI_H__
-
-#include "drm.h"
-
-typedef struct {
- int chipset;
- int width;
- int height;
- int mem;
- int cpp;
- int zpp;
-
- int agpMode; /* 0 for PCI cards */
-
- unsigned int sarea_priv_offset;
-
- unsigned int bufferSize; /* size of DMA buffers */
-
- unsigned int frontbufferSize;
- unsigned int frontOffset;
-
- unsigned int backbufferSize;
- unsigned int backOffset;
-
- unsigned int depthbufferSize;
- unsigned int depthOffset;
-
- unsigned int textureOffset;
- unsigned int textureSize;
- int logTextureGranularity;
-
- /* Linear aperture */
- drm_handle_t apertureHandle;
- unsigned int apertureSize;
- unsigned int aperturePitch; /* in byte */
-
- /* Status page (probably not needed, but no harm, read-only) */
- drm_handle_t statusHandle;
- unsigned int statusSize;
-
- /* AGP textures */
- drm_handle_t agpTextureHandle;
- unsigned int agpTextureSize;
- int logAgpTextureGranularity;
-
- /* Not sure about this one */
- drm_handle_t xvmcSurfHandle; /* ? */
-} SAVAGEDRIRec, *SAVAGEDRIPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/Makefile
deleted file mode 100644
index 32c64bdbf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# src/mesa/drivers/dri/sis/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = sis_dri.so
-
-
-# Not yet
-# MINIGLX_SOURCES = server/sis_dri.c
-
-DRIVER_SOURCES = \
- sis_alloc.c \
- sis_clear.c \
- sis_context.c \
- sis_dd.c \
- sis_fog.c \
- sis_lock.c \
- sis_screen.c \
- sis_span.c \
- sis_state.c \
- sis_stencil.c \
- sis_tex.c \
- sis_texstate.c \
- sis_tris.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_common.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_common.h
deleted file mode 100644
index cbddf0c73..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_common.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h,v 1.1 2003/08/29 08:52:12 twini Exp $ */
-/*
- * Common header definitions for SiS 2D/3D/DRM suite
- *
- * Copyright (C) 2003 Eric Anholt
- *
- * 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 the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER 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.
- *
- * Author:
- * Eric Anholt <anholt@FreeBSD.org>
- *
- */
-
-#ifndef _SIS_COMMON_H_
-#define _SIS_COMMON_H_
-
-#define DRM_SIS_FB_ALLOC 0x04
-#define DRM_SIS_FB_FREE 0x05
-#define DRM_SIS_FLIP 0x08
-#define DRM_SIS_FLIP_INIT 0x09
-#define DRM_SIS_FLIP_FINAL 0x10
-#define DRM_SIS_AGP_INIT 0x13
-#define DRM_SIS_AGP_ALLOC 0x14
-#define DRM_SIS_AGP_FREE 0x15
-#define DRM_SIS_FB_INIT 0x16
-
-typedef struct {
- int context;
- unsigned long offset;
- unsigned long size;
- void *free;
-} drm_sis_mem_t;
-
-typedef struct {
- unsigned long offset, size;
-} drm_sis_agp_t;
-
-typedef struct {
- unsigned long offset, size;
-} drm_sis_fb_t;
-
-typedef struct {
- unsigned int left, right;
-} drm_sis_flip_t;
-
-#endif /* _SIS_COMMON_H_ */
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_dri.h
deleted file mode 100644
index a05662430..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/server/sis_dri.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.9 2003/08/29 08:50:54 twini Exp $ */
-
-/* modified from tdfx_dri.h */
-
-#ifndef _SIS_DRI_
-#define _SIS_DRI_
-
-#include "xf86drm.h"
-#include "drm.h"
-
-#define SIS_MAX_DRAWABLES 256
-#define SISIOMAPSIZE (64*1024)
-
-typedef struct {
- int CtxOwner;
- int QueueLength;
- unsigned int AGPCmdBufNext;
- unsigned int FrameCount;
-#ifdef SIS315DRI
- /* For 315 series */
- unsigned long sharedWPoffset;
-#endif
-#if 0
- unsigned char *AGPCmdBufBase;
- unsigned long AGPCmdBufAddr;
- unsigned long AGPCmdBufOffset;
- unsigned int AGPCmdBufSize;
- unsigned long AGPCmdBufNext;
-#endif
-} SISSAREAPriv, *SISSAREAPrivPtr;
-
-#define AGPVtxBufNext AGPCmdBufNext
-
-#define SIS_FRONT 0
-#define SIS_BACK 1
-#define SIS_DEPTH 2
-
-typedef struct {
- drm_handle_t handle;
- drmSize size;
-} sisRegion, *sisRegionPtr;
-
-typedef struct {
- sisRegion regs, agp;
- int deviceID;
- int width;
- int height;
- int mem; /* unused in Mesa 3 DRI */
- int bytesPerPixel;
- int priv1; /* unused in Mesa 3 DRI */
- int priv2; /* unused in Mesa 3 DRI */
- int fbOffset; /* unused in Mesa 3 DRI */
- int backOffset; /* unused in Mesa 3 DRI */
- int depthOffset; /* unused in Mesa 3 DRI */
- int textureOffset; /* unused in Mesa 3 DRI */
- int textureSize; /* unused in Mesa 3 DRI */
- unsigned int AGPCmdBufOffset;
- unsigned int AGPCmdBufSize;
- int irqEnabled; /* unused in Mesa 3 DRI */
- unsigned int scrnX, scrnY; /* unused in Mesa 3 DRI */
-} SISDRIRec, *SISDRIPtr;
-
-#define AGPVtxBufOffset AGPCmdBufOffset
-#define AGPVtxBufSize AGPCmdBufSize
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} SISConfigPrivRec, *SISConfigPrivPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} SISDRIContextRec, *SISDRIContextPtr;
-
-#ifdef XFree86Server
-
-#include "screenint.h"
-
-Bool SISDRIScreenInit(ScreenPtr pScreen);
-void SISDRICloseScreen(ScreenPtr pScreen);
-Bool SISDRIFinishScreenInit(ScreenPtr pScreen);
-
-#endif
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.c
deleted file mode 100644
index b808daae3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_alloc.c,v 1.7 2001/01/08 01:07:29 martin Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_alloc.h"
-
-#include "sis_common.h"
-
-#include <unistd.h>
-
-#define Z_BUFFER_HW_ALIGNMENT 16
-#define Z_BUFFER_HW_PLUS (16 + 4)
-
-/* 3D engine uses 2, and bitblt uses 4 */
-#define DRAW_BUFFER_HW_ALIGNMENT 16
-#define DRAW_BUFFER_HW_PLUS (16 + 4)
-
-#define ALIGNMENT(value, align) (((value) + (align) - 1) / (align) * (align))
-
-static int _total_video_memory_used = 0;
-static int _total_video_memory_count = 0;
-
-void *
-sisAllocFB( sisContextPtr smesa, GLuint size, void **handle )
-{
- drm_sis_mem_t fb;
-
- _total_video_memory_used += size;
-
- fb.context = smesa->hHWContext;
- fb.size = size;
- if (drmCommandWriteRead( smesa->driFd, DRM_SIS_FB_ALLOC, &fb,
- sizeof(drm_sis_mem_t) ) || fb.offset == 0)
- {
- return NULL;
- }
- *handle = (void *)fb.free;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisAllocFB: size=%d, offset=%lu, pid=%d, count=%d\n",
- size, fb.offset, (GLint)getpid(),
- ++_total_video_memory_count);
- }
-
- return (void *)(smesa->FbBase + fb.offset);
-}
-
-void
-sisFreeFB( sisContextPtr smesa, void *handle )
-{
- drm_sis_mem_t fb;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisFreeFB: free=%p, pid=%d, count=%d\n",
- handle, (GLint)getpid(), --_total_video_memory_count);
- }
-
- fb.context = smesa->hHWContext;
- fb.free = handle;
- drmCommandWrite( smesa->driFd, DRM_SIS_FB_FREE, &fb, sizeof(drm_sis_mem_t) );
-}
-
-void *
-sisAllocAGP( sisContextPtr smesa, GLuint size, void **handle )
-{
- drm_sis_mem_t agp;
-
- if (smesa->AGPSize == 0)
- return NULL;
-
- agp.context = smesa->hHWContext;
- agp.size = size;
- if (drmCommandWriteRead( smesa->driFd, DRM_SIS_AGP_ALLOC, &agp,
- sizeof(drm_sis_mem_t) ) || agp.offset == 0)
- {
- return NULL;
- }
- *handle = (void *)agp.free;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisAllocAGP: size=%u, offset=%lu, pid=%d, count=%d\n",
- size, agp.offset, (GLint)getpid(),
- ++_total_video_memory_count);
- }
-
- return (void *)(smesa->AGPBase + agp.offset);
-}
-
-void
-sisFreeAGP( sisContextPtr smesa, void *handle )
-{
- drm_sis_mem_t agp;
-
- if (SIS_VERBOSE & VERBOSE_SIS_MEMORY) {
- fprintf(stderr, "sisFreeAGP: free=%p, pid=%d, count=%d\n",
- handle, (GLint)getpid(), --_total_video_memory_count);
- }
-
- agp.context = smesa->hHWContext;
- agp.free = handle;
- drmCommandWrite( smesa->driFd, DRM_SIS_AGP_FREE, &agp,
- sizeof(drm_sis_mem_t) );
-}
-
-void
-sisAllocZStencilBuffer( sisContextPtr smesa )
-{
- GLuint z_depth;
- GLuint totalBytes;
- int width2;
-
- GLubyte *addr;
-
- z_depth = ( smesa->glCtx->Visual.depthBits +
- smesa->glCtx->Visual.stencilBits ) / 8;
-
- width2 = ALIGNMENT( smesa->width * z_depth, 4 );
-
- totalBytes = smesa->height * width2 + Z_BUFFER_HW_PLUS;
-
- addr = sisAllocFB( smesa, totalBytes, &smesa->zbFree );
- if (addr == NULL)
- sis_fatal_error("Failure to allocate Z buffer.\n");
-
- if (SIS_VERBOSE & VERBOSE_SIS_BUFFER) {
- fprintf(stderr, "sis_alloc_z_stencil_buffer: addr=%p\n", addr);
- }
-
- addr = (GLubyte *)ALIGNMENT( (unsigned long)addr, Z_BUFFER_HW_ALIGNMENT );
-
- smesa->depthbuffer = (void *) addr;
- smesa->depthPitch = width2;
- smesa->depthOffset = (unsigned long)addr - (unsigned long)smesa->FbBase;
-
- /* set pZClearPacket */
- memset( &smesa->zClearPacket, 0, sizeof(ENGPACKET) );
-
- smesa->zClearPacket.dwSrcPitch = (z_depth == 2) ? 0x80000000 : 0xf0000000;
- smesa->zClearPacket.dwDestBaseAddr = (unsigned long)(addr -
- (unsigned long)smesa->FbBase);
- smesa->zClearPacket.wDestPitch = width2;
- smesa->zClearPacket.stdwDestPos.wY = 0;
- smesa->zClearPacket.stdwDestPos.wX = 0;
-
- smesa->zClearPacket.wDestHeight = smesa->virtualY;
- smesa->zClearPacket.stdwDim.wWidth = (GLshort)width2 / z_depth;
- smesa->zClearPacket.stdwDim.wHeight = (GLshort)smesa->height;
- smesa->zClearPacket.stdwCmd.cRop = 0xf0;
-
- if (smesa->blockWrite)
- smesa->zClearPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
- else
- smesa->zClearPacket.stdwCmd.cCmd0 = 0;
- smesa->zClearPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-}
-
-void
-sisFreeZStencilBuffer( sisContextPtr smesa )
-{
- sisFreeFB( smesa, smesa->zbFree );
- smesa->zbFree = NULL;
- smesa->depthbuffer = NULL;
-}
-
-void
-sisAllocBackbuffer( sisContextPtr smesa )
-{
- GLuint depth = smesa->bytesPerPixel;
- GLuint size, width2;
-
- char *addr;
-
- width2 = (depth == 2) ? ALIGNMENT (smesa->width, 2) : smesa->width;
- size = width2 * smesa->height * depth + DRAW_BUFFER_HW_PLUS;
-
- /* Fixme: unique context alloc/free back-buffer? */
- addr = sisAllocFB( smesa, size, &smesa->bbFree );
- if (addr == NULL)
- sis_fatal_error("Failure to allocate back buffer.\n");
-
- addr = (char *)ALIGNMENT( (unsigned long)addr, DRAW_BUFFER_HW_ALIGNMENT );
-
- smesa->backbuffer = addr;
- smesa->backOffset = (unsigned long)(addr - (unsigned long)smesa->FbBase);
- smesa->backPitch = width2 * depth;
-
- memset ( &smesa->cbClearPacket, 0, sizeof(ENGPACKET) );
-
- smesa->cbClearPacket.dwSrcPitch = (depth == 2) ? 0x80000000 : 0xf0000000;
- smesa->cbClearPacket.dwDestBaseAddr = smesa->backOffset;
- smesa->cbClearPacket.wDestPitch = smesa->backPitch;
- smesa->cbClearPacket.stdwDestPos.wY = 0;
- smesa->cbClearPacket.stdwDestPos.wX = 0;
-
- smesa->cbClearPacket.wDestHeight = smesa->virtualY;
- smesa->cbClearPacket.stdwDim.wWidth = (GLshort) width2;
- smesa->cbClearPacket.stdwDim.wHeight = (GLshort) smesa->height;
- smesa->cbClearPacket.stdwCmd.cRop = 0xf0;
-
- if (smesa->blockWrite)
- smesa->cbClearPacket.stdwCmd.cCmd0 = (GLbyte)(CMD0_PAT_FG_COLOR);
- else
- smesa->cbClearPacket.stdwCmd.cCmd0 = 0;
- smesa->cbClearPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-}
-
-void
-sisFreeBackbuffer( sisContextPtr smesa )
-{
- sisFreeFB( smesa, smesa->bbFree );
- smesa->backbuffer = NULL;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.h
deleted file mode 100644
index e76fc53fe..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_alloc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-enum {
- VIDEO_TYPE,
- AGP_TYPE
-};
-
-void sisAllocZStencilBuffer( sisContextPtr smesa );
-void sisFreeZStencilBuffer( sisContextPtr smesa );
-void sisAllocBackbuffer( sisContextPtr smesa );
-void sisFreeBackbuffer ( sisContextPtr smesa );
-void *sisAllocFB( sisContextPtr smesa, GLuint size, void **handle );
-void sisFreeFB( sisContextPtr smesa, void *handle );
-void *sisAllocAGP( sisContextPtr smesa, GLuint size, void **handle );
-void sisFreeAGP( sisContextPtr smesa, void *handle );
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_clear.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_clear.c
deleted file mode 100644
index 7b68aadc7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_clear.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_clear.c,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_lock.h"
-
-#include "swrast/swrast.h"
-#include "macros.h"
-
-static GLbitfield sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
- GLint x, GLint y, GLint width,
- GLint height );
-static void sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x,
- GLint y, GLint width, GLint height );
-static void sis_clear_z_stencil_buffer( GLcontext * ctx,
- GLbitfield mask, GLint x,
- GLint y, GLint width,
- GLint height );
-
-static void
-set_color_pattern( sisContextPtr smesa, GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha )
-{
- /* XXX only RGB565 and ARGB8888 */
- switch (smesa->colorFormat)
- {
- case DST_FORMAT_ARGB_8888:
- smesa->clearColorPattern = (alpha << 24) +
- (red << 16) + (green << 8) + (blue);
- break;
- case DST_FORMAT_RGB_565:
- smesa->clearColorPattern = ((red >> 3) << 11) +
- ((green >> 2) << 5) + (blue >> 3);
- smesa->clearColorPattern |= smesa->clearColorPattern << 16;
- break;
- default:
- sis_fatal_error("Bad dst color format\n");
- }
-}
-
-void
-sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil )
-{
- GLuint zPattern;
-
- switch (smesa->zFormat)
- {
- case SiS_ZFORMAT_Z16:
- CLAMPED_FLOAT_TO_USHORT(zPattern, z);
- zPattern |= zPattern << 16;
- break;
- case SiS_ZFORMAT_S8Z24:
- zPattern = FLOAT_TO_UINT(z) >> 8;
- zPattern |= stencil << 24;
- break;
- case SiS_ZFORMAT_Z32:
- zPattern = FLOAT_TO_UINT(z);
- break;
- default:
- sis_fatal_error("Bad Z format\n");
- }
- smesa->clearZStencilPattern = zPattern;
-}
-
-void
-sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- GLint x1, y1, width1, height1;
-
- if (all) {
- GLframebuffer *buffer = ctx->DrawBuffer;
-
- x1 = 0;
- y1 = 0;
- width1 = buffer->Width;
- height1 = buffer->Height;
- } else {
- x1 = x;
- y1 = Y_FLIP(y+height-1);
- width1 = width;
- height1 = height;
- }
- /* XXX: Scissoring */
-
- /* Mask out any non-existent buffers */
- if (ctx->Visual.depthBits == 0 || !ctx->Depth.Mask)
- mask &= ~BUFFER_BIT_DEPTH;
- if (ctx->Visual.stencilBits == 0)
- mask &= ~BUFFER_BIT_STENCIL;
-
- LOCK_HARDWARE();
-
- /* The 3d clear code is use for masked clears because apparently the SiS
- * 300-series can't do write masks for 2d blits. 3d isn't used in general
- * because it's slower, even in the case of clearing multiple buffers.
- */
- /* XXX: Appears to be broken with stencil. */
- if ((smesa->current.hwCapEnable2 & (MASK_AlphaMaskWriteEnable |
- MASK_ColorMaskWriteEnable) &&
- (mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0) ||
- (ctx->Stencil.WriteMask[0] < 0xff && (mask & BUFFER_BIT_STENCIL) != 0) )
- {
- mask = sis_3D_Clear( ctx, mask, x1, y1, width1, height1 );
- }
-
- if ( mask & BUFFER_BIT_FRONT_LEFT || mask & BUFFER_BIT_BACK_LEFT) {
- sis_clear_color_buffer( ctx, mask, x1, y1, width1, height1 );
- mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
- }
-
- if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) {
- if (smesa->depthbuffer != NULL)
- sis_clear_z_stencil_buffer( ctx, mask, x1, y1, width1, height1 );
- mask &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
- }
-
- UNLOCK_HARDWARE();
-
- if (mask != 0)
- _swrast_Clear( ctx, mask, all, x1, y1, width, height );
-}
-
-
-void
-sisDDClearColor( GLcontext * ctx, const GLfloat color[4] )
-{
- sisContextPtr smesa = SIS_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]);
- CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
-
- set_color_pattern( smesa, c[0], c[1], c[2], c[3] );
-}
-
-void
-sisDDClearDepth( GLcontext * ctx, GLclampd d )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- sisUpdateZStencilPattern( smesa, d, ctx->Stencil.Clear );
-}
-
-void
-sisDDClearStencil( GLcontext * ctx, GLint s )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- sisUpdateZStencilPattern( smesa, ctx->Depth.Clear, s );
-}
-
-static GLbitfield
-sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
- GLint x, GLint y, GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *current = &smesa->current;
-
- float left, top, right, bottom, zClearVal;
- GLboolean bClrColor, bClrDepth, bClrStencil;
- GLint dwPrimitiveSet;
- GLint dwEnable1 = 0, dwEnable2 = MASK_ColorMaskWriteEnable;
- GLint dwDepthMask = 0, dwSten1 = 0, dwSten2 = 0;
- GLint dirtyflags = GFLAG_ENABLESETTING | GFLAG_ENABLESETTING2 |
- GFLAG_CLIPPING | GFLAG_DESTSETTING;
- int count;
- drm_clip_rect_t *pExtents;
-
- bClrColor = (mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0;
- bClrDepth = (mask & BUFFER_BIT_DEPTH) != 0;
- bClrStencil = (mask & BUFFER_BIT_STENCIL) != 0;
-
- if (smesa->GlobalFlag & GFLAG_RENDER_STATES)
- sis_update_render_state( smesa );
-
- if (bClrStencil) {
- dwSten1 = STENCIL_FORMAT_8 | SiS_STENCIL_ALWAYS |
- (ctx->Stencil.Clear << 8) | 0xff;
- dwSten2 = SiS_SFAIL_REPLACE | SiS_SPASS_ZFAIL_REPLACE |
- SiS_SPASS_ZPASS_REPLACE;
- dwEnable1 = MASK_ZWriteEnable | MASK_StencilWriteEnable |
- MASK_StencilTestEnable;
- dwEnable2 |= MASK_ZMaskWriteEnable;
- dwDepthMask |= ctx->Stencil.WriteMask[0] << 24;
- } else if (bClrDepth) {
- dwEnable1 = MASK_ZWriteEnable;
- dwEnable2 |= MASK_ZMaskWriteEnable;
- }
-
- if (bClrDepth) {
- zClearVal = ctx->Depth.Clear;
- if (ctx->Visual.depthBits != 32)
- dwDepthMask |= 0x00ffffff;
- else
- dwDepthMask = 0xffffffff;
- } else
- zClearVal = 0.0;
-
- mWait3DCmdQueue(9);
- MMIO(REG_3D_TEnable, dwEnable1);
- MMIO(REG_3D_TEnable2, dwEnable2);
- if (bClrDepth || bClrStencil) {
- MMIO(REG_3D_ZSet, (current->hwZ & ~MASK_ZTestMode) | SiS_Z_COMP_ALWAYS);
- dirtyflags |= GFLAG_ZSETTING;
- }
- if (bClrColor) {
- MMIO(REG_3D_DstSet, (current->hwDstSet & ~MASK_ROP2) | LOP_COPY);
- } else {
- MMIO(REG_3D_DstAlphaWriteMask, 0L);
- }
- if (bClrStencil) {
- MMIO(REG_3D_StencilSet, dwSten1);
- MMIO(REG_3D_StencilSet2, dwSten2);
- dirtyflags |= GFLAG_STENCILSETTING;
- }
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- pExtents = smesa->driDrawable->pClipRects;
- count = smesa->driDrawable->numClipRects;
- } else {
- pExtents = NULL;
- count = 1;
- }
-
- while(count--) {
- left = x;
- right = x + width;
- top = y;
- bottom = y + height;
-
- if (pExtents != NULL) {
- GLuint x1, y1, x2, y2;
-
- x1 = pExtents->x1 - smesa->driDrawable->x;
- y1 = pExtents->y1 - smesa->driDrawable->y;
- x2 = pExtents->x2 - smesa->driDrawable->x - 1;
- y2 = pExtents->y2 - smesa->driDrawable->y - 1;
-
- left = (left > x1) ? left : x1;
- right = (right > x2) ? x2 : right;
- top = (top > y1) ? top : y1;
- bottom = (bottom > y2) ? y2 : bottom;
- pExtents++;
- if (left > right || top > bottom)
- continue;
- }
-
- mWait3DCmdQueue(20);
-
- MMIO(REG_3D_ClipTopBottom, ((GLint)top << 13) | (GLint)bottom);
- MMIO(REG_3D_ClipLeftRight, ((GLint)left << 13) | (GLint)right);
-
- /* the first triangle */
- dwPrimitiveSet = OP_3D_TRIANGLE_DRAW | OP_3D_FIRE_TSARGBc |
- SHADE_FLAT_VertexC;
- MMIO(REG_3D_PrimitiveSet, dwPrimitiveSet);
-
- MMIO(REG_3D_TSZa, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXa, *(GLint *) &right);
- MMIO(REG_3D_TSYa, *(GLint *) &top);
- MMIO(REG_3D_TSARGBa, smesa->clearColorPattern);
-
- MMIO(REG_3D_TSZb, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXb, *(GLint *) &left);
- MMIO(REG_3D_TSYb, *(GLint *) &top);
- MMIO(REG_3D_TSARGBb, smesa->clearColorPattern);
-
- MMIO(REG_3D_TSZc, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXc, *(GLint *) &left);
- MMIO(REG_3D_TSYc, *(GLint *) &bottom);
- MMIO(REG_3D_TSARGBc, smesa->clearColorPattern);
-
- /* second triangle */
- dwPrimitiveSet = OP_3D_TRIANGLE_DRAW | OP_3D_FIRE_TSARGBb |
- SHADE_FLAT_VertexB;
- MMIO(REG_3D_PrimitiveSet, dwPrimitiveSet);
-
- MMIO(REG_3D_TSZb, *(GLint *) &zClearVal);
- MMIO(REG_3D_TSXb, *(GLint *) &right);
- MMIO(REG_3D_TSYb, *(GLint *) &bottom);
- MMIO(REG_3D_TSARGBb, smesa->clearColorPattern);
- }
-
- mEndPrimitive();
-
- /* If BUFFER_BIT_FRONT_LEFT is set, we've only cleared the front buffer so far */
- if ((mask & BUFFER_BIT_FRONT_LEFT) != 0 && (mask & BUFFER_BIT_BACK_LEFT) != 0)
- sis_3D_Clear( ctx, BUFFER_BIT_BACK_LEFT, x, y, width, height );
-
- smesa->GlobalFlag |= dirtyflags;
-
- return mask & ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL | BUFFER_BIT_BACK_LEFT |
- BUFFER_BIT_FRONT_LEFT);
-}
-
-static void
-sis_bitblt_clear_cmd( sisContextPtr smesa, ENGPACKET * pkt )
-{
- GLint *lpdwDest, *lpdwSrc;
- int i;
-
- lpdwSrc = (GLint *) pkt + 1;
- lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR) + 1;
-
- mWait3DCmdQueue (10);
-
- *lpdwDest++ = *lpdwSrc++;
- lpdwSrc++;
- lpdwDest++;
- for (i = 3; i < 8; i++) {
- *lpdwDest++ = *lpdwSrc++;
- }
-
- MMIO(REG_CMD0, *(GLint *) & pkt->stdwCmd);
- MMIO(REG_CommandQueue, -1);
-}
-
-static void
-sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
- GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- int count;
- GLuint depth = smesa->bytesPerPixel;
- drm_clip_rect_t *pExtents = NULL;
- GLint xx, yy;
- GLint x0, y0, width0, height0;
-
- ENGPACKET stEngPacket;
-
- /* Clear back buffer */
- if (mask & BUFFER_BIT_BACK_LEFT) {
- smesa->cbClearPacket.stdwDestPos.wY = y;
- smesa->cbClearPacket.stdwDestPos.wX = x;
- smesa->cbClearPacket.stdwDim.wWidth = (GLshort) width;
- smesa->cbClearPacket.stdwDim.wHeight = (GLshort) height;
- smesa->cbClearPacket.dwFgRopColor = smesa->clearColorPattern;
-
- sis_bitblt_clear_cmd( smesa, &smesa->cbClearPacket );
- }
-
- if ((mask & BUFFER_BIT_FRONT_LEFT) == 0)
- return;
-
- /* Clear front buffer */
- x0 = x;
- y0 = y;
- width0 = width;
- height0 = height;
-
- pExtents = smesa->driDrawable->pClipRects;
- count = smesa->driDrawable->numClipRects;
-
- memset( &stEngPacket, 0, sizeof (ENGPACKET) );
-
- stEngPacket.dwSrcPitch = (depth == 2) ? 0x80000000 : 0xc0000000;
- stEngPacket.dwDestBaseAddr = smesa->frontOffset;
- stEngPacket.wDestPitch = smesa->frontPitch;
- /* TODO: set maximum value? */
- stEngPacket.wDestHeight = smesa->virtualY;
- stEngPacket.stdwCmd.cRop = 0xf0;
- stEngPacket.dwFgRopColor = smesa->clearColorPattern;
-
- /* for SGRAM Block Write Enable */
- if (smesa->blockWrite)
- stEngPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
- else
- stEngPacket.stdwCmd.cCmd0 = 0;
- stEngPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-
- while (count--) {
- GLint x2 = pExtents->x1 - smesa->driDrawable->x;
- GLint y2 = pExtents->y1 - smesa->driDrawable->y;
- GLint xx2 = pExtents->x2 - smesa->driDrawable->x;
- GLint yy2 = pExtents->y2 - smesa->driDrawable->y;
-
- x = (x0 > x2) ? x0 : x2;
- y = (y0 > y2) ? y0 : y2;
- xx = ((x0 + width0) > (xx2)) ? xx2 : x0 + width0;
- yy = ((y0 + height0) > (yy2)) ? yy2 : y0 + height0;
- width = xx - x;
- height = yy - y;
- pExtents++;
-
- if (width <= 0 || height <= 0)
- continue;
-
- stEngPacket.stdwDestPos.wY = y;
- stEngPacket.stdwDestPos.wX = x;
- stEngPacket.stdwDim.wWidth = (GLshort)width;
- stEngPacket.stdwDim.wHeight = (GLshort)height;
-
- sis_bitblt_clear_cmd( smesa, &stEngPacket );
- }
-}
-
-static void
-sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask,
- GLint x, GLint y, GLint width, GLint height )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- /* TODO: consider alignment of width, height? */
- smesa->zClearPacket.stdwDestPos.wY = y;
- smesa->zClearPacket.stdwDestPos.wX = x;
- smesa->zClearPacket.stdwDim.wWidth = (GLshort) width;
- smesa->zClearPacket.stdwDim.wHeight = (GLshort) height;
- smesa->zClearPacket.dwFgRopColor = smesa->clearZStencilPattern;
-
- sis_bitblt_clear_cmd( smesa, &smesa->zClearPacket );
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_common2.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_common2.h
deleted file mode 100644
index c52abd5e5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_common2.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-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 SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_common.h,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- */
-
-#ifndef _sis_common_h_
-#define _sis_common_h_
-
-#if 0
-#define free(x)
-#define calloc(x,y) sis_debug_malloc((x)*(y))
-extern void *sis_debug_malloc(int x);
-#endif
-
-#if defined(SIS_DUMP)
-#include "sis_debug.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-typedef struct _Box
-{
- short x1, y1, x2, y2;
-}
-BoxRec;
-#define NullBox ((BoxPtr)0)
-typedef struct _Box *BoxPtr;
-
-/* BitBlt Commands */
-#define CMD0_DD_ENABLE 0x06
-#define CMD0_SRC_VIDEO 0x00
-#define CMD0_SRC_CPU 0x10
-#define CMD0_PAT_FG_COLOR 0x00
-#define CMD1_DIR_X_DEC 0x00
-#define CMD1_DIR_X_INC 0x01
-#define CMD1_DIR_Y_DEC 0x00
-#define CMD1_DIR_Y_INC 0x02
-#define REG_SRC_ADDR 0x8200
-#define REG_CMD0 0x823c
-
-typedef struct
-{
- GLshort wSrcPitch;
- GLshort wDestPitch;
-}
-_PITCH;
-typedef struct
-{
- GLshort wWidth;
- GLshort wHeight;
-}
-_DIM;
-typedef struct
-{
- GLshort wY;
- GLshort wX;
-}
-_POS;
-
-typedef struct
-{
- GLubyte cCmd0;
- GLubyte cRop;
- GLubyte cCmd1;
- GLubyte cReserved;
-}
-_CMD;
-
-typedef struct
-{
- GLshort wStatus0;
- GLbyte cStatus0_GLbyte3;
- GLbyte cStatus0_GLbyte4;
-}
-_CMDQUESTATUS;
-
-typedef struct
-{
- GLint dwSrcBaseAddr;
- GLint dwSrcPitch;
- _POS stdwSrcPos;
- _POS stdwDestPos;
- GLint dwDestBaseAddr;
- GLshort wDestPitch;
- GLshort wDestHeight;
- _DIM stdwDim;
- GLint dwFgRopColor;
- GLint dwBgRopColor;
- GLint dwSrcHiCKey;
- GLint dwSrcLoCKey;
- GLint dwMaskA;
- GLint dwMaskB;
- GLint dwClipA;
- GLint dwClipB;
- _CMD stdwCmd;
- _CMDQUESTATUS stdwCmdQueStatus;
-}
-ENGPACKET, *LPENGPACKET;
-
-/* Hardware Info */
-#include "sis_reg.h"
-
-/* HW capability */
-#define SIS_MAX_TEXTURE_SIZE 2048
-#define SIS_MAX_TEXTURES 2
-
-#define SIS_MAX_FRAME_LENGTH 3
-
-GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.c
deleted file mode 100644
index cfb7700af..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_dri.h"
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_dd.h"
-#include "sis_span.h"
-#include "sis_stencil.h"
-#include "sis_tex.h"
-#include "sis_tris.h"
-#include "sis_alloc.h"
-
-#include "imports.h"
-#include "matrix.h"
-#include "extensions.h"
-#include "utils.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#define need_GL_ARB_multisample
-#include "extension_helper.h"
-
-int GlobalCurrentHwcx = -1;
-int GlobalHwcxCountBase = 1;
-int GlobalCmdQueueLen = 0;
-
-struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_NV_blend_square", NULL },
- { NULL, NULL }
-};
-
-void
-WaitEngIdle (sisContextPtr smesa)
-{
- GLuint engineState;
-
- do {
- engineState = MMIO_READ(REG_CommandQueue);
- } while ((engineState & SiS_EngIdle) != SiS_EngIdle);
-}
-
-void
-Wait2DEngIdle (sisContextPtr smesa)
-{
- GLuint engineState;
-
- do {
- engineState = MMIO_READ(REG_CommandQueue);
- } while ((engineState & SiS_EngIdle2d) != SiS_EngIdle2d);
-}
-
-/* To be called from mWait3DCmdQueue. Separate function for profiling
- * purposes, and speed doesn't matter because we're spinning anyway.
- */
-void
-WaitingFor3dIdle(sisContextPtr smesa, int wLen)
-{
- while (*(smesa->CurrentQueueLenPtr) < wLen) {
- *(smesa->CurrentQueueLenPtr) =
- (MMIO_READ(REG_CommandQueue) & MASK_QueueLen) - 20;
- }
-}
-
-GLboolean
-sisCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- sisContextPtr smesa;
- sisScreenPtr sisScreen;
- int i;
- struct dd_function_table functions;
-
- smesa = (sisContextPtr)CALLOC( sizeof(*smesa) );
- if (smesa == NULL)
- return GL_FALSE;
-
- /* Init default driver functions then plug in our SIS-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions(&functions);
- sisInitDriverFuncs(&functions);
- sisInitTextureFuncs(&functions);
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((sisContextPtr)sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
- smesa->glCtx = _mesa_create_context( glVisual, shareCtx,
- &functions, (void *) smesa);
- if (!smesa->glCtx) {
- FREE(smesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = smesa;
- ctx = smesa->glCtx;
-
- sisScreen = smesa->sisScreen = (sisScreenPtr)(sPriv->private);
-
- smesa->driContext = driContextPriv;
- smesa->driScreen = sPriv;
- smesa->driDrawable = NULL;
- smesa->hHWContext = driContextPriv->hHWContext;
- smesa->driHwLock = &sPriv->pSAREA->lock;
- smesa->driFd = sPriv->fd;
-
- smesa->virtualX = sisScreen->screenX;
- smesa->virtualY = sisScreen->screenY;
- smesa->bytesPerPixel = sisScreen->cpp;
- smesa->IOBase = sisScreen->mmio.map;
- smesa->Chipset = sisScreen->deviceID;
- smesa->irqEnabled = sisScreen->irqEnabled;
-
- smesa->FbBase = sPriv->pFB;
- smesa->displayWidth = sPriv->fbWidth;
- smesa->frontPitch = sPriv->fbStride;
-
- smesa->sarea = (SISSAREAPriv *)((char *)sPriv->pSAREA +
- sisScreen->sarea_priv_offset);
-
-#if defined(SIS_DUMP)
- IOBase4Debug = GET_IOBase (smesa);
-#endif
-
- /* support ARGB8888 and RGB565 */
- switch (smesa->bytesPerPixel)
- {
- case 4:
- smesa->redMask = 0x00ff0000;
- smesa->greenMask = 0x0000ff00;
- smesa->blueMask = 0x000000ff;
- smesa->alphaMask = 0xff000000;
- smesa->colorFormat = DST_FORMAT_ARGB_8888;
- break;
- case 2:
- smesa->redMask = 0xf800;
- smesa->greenMask = 0x07e0;
- smesa->blueMask = 0x001f;
- smesa->alphaMask = 0;
- smesa->colorFormat = DST_FORMAT_RGB_565;
- break;
- default:
- sis_fatal_error("Bad bytesPerPixel.\n");
- }
-
- /* Parse configuration files */
- driParseConfigFiles (&smesa->optionCache, &sisScreen->optionCache,
- sisScreen->driScreen->myNum, "sis");
-
- /* TODO: index mode */
-
- smesa->CurrentQueueLenPtr = &(smesa->sarea->QueueLength);
- smesa->FrameCountPtr = &(smesa->sarea->FrameCount);
-
- /* set AGP */
- smesa->AGPSize = sisScreen->agp.size;
- smesa->AGPBase = sisScreen->agp.map;
- smesa->AGPAddr = sisScreen->agp.handle;
-
- /* Create AGP command buffer */
- if (smesa->AGPSize != 0 &&
- !driQueryOptionb(&smesa->optionCache, "agp_disable"))
- {
- smesa->vb = sisAllocAGP(smesa, 64 * 1024, &smesa->vb_agp_handle);
- if (smesa->vb != NULL) {
- smesa->using_agp = GL_TRUE;
- smesa->vb_cur = smesa->vb;
- smesa->vb_last = smesa->vb;
- smesa->vb_end = smesa->vb + 64 * 1024;
- smesa->vb_agp_offset = ((long)smesa->vb - (long)smesa->AGPBase +
- (long)smesa->AGPAddr);
- }
- }
- if (!smesa->using_agp) {
- smesa->vb = malloc(64 * 1024);
- if (smesa->vb == NULL) {
- FREE(smesa);
- return GL_FALSE;
- }
- smesa->vb_cur = smesa->vb;
- smesa->vb_last = smesa->vb;
- smesa->vb_end = smesa->vb + 64 * 1024;
- }
-
- smesa->GlobalFlag = 0L;
-
- smesa->Fallback = 0;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- _swrast_allow_pixel_fog( ctx, GL_TRUE );
- _swrast_allow_vertex_fog( ctx, GL_FALSE );
- _tnl_allow_pixel_fog( ctx, GL_TRUE );
- _tnl_allow_vertex_fog( ctx, GL_FALSE );
-
- /* XXX these should really go right after _mesa_init_driver_functions() */
- sisDDInitStateFuncs( ctx );
- sisDDInitState( smesa ); /* Initializes smesa->zFormat, important */
- sisInitTriFuncs( ctx );
- sisDDInitSpanFuncs( ctx );
- sisDDInitStencilFuncs( ctx );
-
- driInitExtensions( ctx, card_extensions, GL_FALSE );
-
- /* TODO */
- /* smesa->blockWrite = SGRAMbw = IsBlockWrite (); */
- smesa->blockWrite = GL_FALSE;
-
- for (i = 0; i < SIS_MAX_TEXTURES; i++) {
- smesa->TexStates[i] = 0;
- smesa->PrevTexFormat[i] = 0;
- }
-
- return GL_TRUE;
-}
-
-void
-sisDestroyContext ( __DRIcontextPrivate *driContextPriv )
-{
- sisContextPtr smesa = (sisContextPtr)driContextPriv->driverPrivate;
-
- assert( smesa != NULL );
-
- if ( smesa != NULL ) {
- _swsetup_DestroyContext( smesa->glCtx );
- _tnl_DestroyContext( smesa->glCtx );
- _ac_DestroyContext( smesa->glCtx );
- _swrast_DestroyContext( smesa->glCtx );
-
- if (smesa->using_agp)
- sisFreeAGP(smesa, smesa->vb_agp_handle);
-
- /* free the Mesa context */
- /* XXX: Is the next line needed? The DriverCtx (smesa) reference is
- * needed for sisDDDeleteTexture, since it needs to call the FB/AGP free
- * function.
- */
- /* smesa->glCtx->DriverCtx = NULL; */
- _mesa_destroy_context(smesa->glCtx);
- }
-
- FREE( smesa );
-}
-
-GLboolean
-sisMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( driContextPriv ) {
- GET_CURRENT_CONTEXT(ctx);
- sisContextPtr oldSisCtx = ctx ? SIS_CONTEXT(ctx) : NULL;
- sisContextPtr newSisCtx = (sisContextPtr) driContextPriv->driverPrivate;
-
- if ( newSisCtx != oldSisCtx) {
- newSisCtx->GlobalFlag = GFLAG_ALL;
- }
-
- newSisCtx->driDrawable = driDrawPriv;
-
- _mesa_make_current( newSisCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- sisUpdateBufferSize( newSisCtx );
- sisUpdateClipping( newSisCtx->glCtx );
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return GL_TRUE;
-}
-
-GLboolean
-sisUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-void
-sis_update_render_state( sisContextPtr smesa )
-{
- __GLSiSHardware *prev = &smesa->prev;
-
- mWait3DCmdQueue (45);
-
- if (smesa->GlobalFlag & GFLAG_ENABLESETTING) {
- if (!smesa->clearTexCache) {
- MMIO(REG_3D_TEnable, prev->hwCapEnable);
- } else {
- MMIO(REG_3D_TEnable, prev->hwCapEnable | MASK_TextureCacheClear);
- MMIO(REG_3D_TEnable, prev->hwCapEnable);
- smesa->clearTexCache = GL_FALSE;
- }
- }
-
- if (smesa->GlobalFlag & GFLAG_ENABLESETTING2)
- MMIO(REG_3D_TEnable2, prev->hwCapEnable2);
-
- /* Z Setting */
- if (smesa->GlobalFlag & GFLAG_ZSETTING)
- {
- MMIO(REG_3D_ZSet, prev->hwZ);
- MMIO(REG_3D_ZStWriteMask, prev->hwZMask);
- MMIO(REG_3D_ZAddress, prev->hwOffsetZ);
- }
-
- /* Alpha Setting */
- if (smesa->GlobalFlag & GFLAG_ALPHASETTING)
- MMIO(REG_3D_AlphaSet, prev->hwAlpha);
-
- if (smesa->GlobalFlag & GFLAG_DESTSETTING) {
- MMIO(REG_3D_DstSet, prev->hwDstSet);
- MMIO(REG_3D_DstAlphaWriteMask, prev->hwDstMask);
- MMIO(REG_3D_DstAddress, prev->hwOffsetDest);
- }
-
- /* Line Setting */
-#if 0
- if (smesa->GlobalFlag & GFLAG_LINESETTING)
- MMIO(REG_3D_LinePattern, prev->hwLinePattern);
-#endif
-
- /* Fog Setting */
- if (smesa->GlobalFlag & GFLAG_FOGSETTING)
- {
- MMIO(REG_3D_FogSet, prev->hwFog);
- MMIO(REG_3D_FogInverseDistance, prev->hwFogInverse);
- MMIO(REG_3D_FogFarDistance, prev->hwFogFar);
- MMIO(REG_3D_FogFactorDensity, prev->hwFogDensity);
- }
-
- /* Stencil Setting */
- if (smesa->GlobalFlag & GFLAG_STENCILSETTING) {
- MMIO(REG_3D_StencilSet, prev->hwStSetting);
- MMIO(REG_3D_StencilSet2, prev->hwStSetting2);
- }
-
- /* Miscellaneous Setting */
- if (smesa->GlobalFlag & GFLAG_DSTBLEND)
- MMIO(REG_3D_DstBlendMode, prev->hwDstSrcBlend);
- if (smesa->GlobalFlag & GFLAG_CLIPPING) {
- MMIO(REG_3D_ClipTopBottom, prev->clipTopBottom);
- MMIO(REG_3D_ClipLeftRight, prev->clipLeftRight);
- }
-
- smesa->GlobalFlag &= ~GFLAG_RENDER_STATES;
-}
-
-void
-sis_update_texture_state (sisContextPtr smesa)
-{
- __GLSiSHardware *prev = &smesa->prev;
-
- mWait3DCmdQueue (55);
- if (smesa->clearTexCache || (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS)) {
- MMIO(REG_3D_TEnable, prev->hwCapEnable | MASK_TextureCacheClear);
- MMIO(REG_3D_TEnable, prev->hwCapEnable);
- smesa->clearTexCache = GL_FALSE;
- }
-
- /* Texture Setting */
- if (smesa->GlobalFlag & CFLAG_TEXTURERESET)
- MMIO(REG_3D_TextureSet, prev->texture[0].hwTextureSet);
-
- if (smesa->GlobalFlag & GFLAG_TEXTUREMIPMAP)
- MMIO(REG_3D_TextureMip, prev->texture[0].hwTextureMip);
-
- /*
- MMIO(REG_3D_TextureTransparencyColorHigh, prev->texture[0].hwTextureClrHigh);
- MMIO(REG_3D_TextureTransparencyColorLow, prev->texture[0].hwTextureClrLow);
- */
-
- if (smesa->GlobalFlag & GFLAG_TEXBORDERCOLOR)
- MMIO(REG_3D_TextureBorderColor, prev->texture[0].hwTextureBorderColor);
-
- if (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS) {
- switch ((prev->texture[0].hwTextureSet & MASK_TextureLevel) >> 8)
- {
- case 11:
- MMIO(REG_3D_TextureAddress11, prev->texture[0].texOffset11);
- case 10:
- MMIO(REG_3D_TextureAddress10, prev->texture[0].texOffset10);
- MMIO(REG_3D_TexturePitch10, prev->texture[0].texPitch10);
- case 9:
- MMIO(REG_3D_TextureAddress9, prev->texture[0].texOffset9);
- case 8:
- MMIO(REG_3D_TextureAddress8, prev->texture[0].texOffset8);
- MMIO(REG_3D_TexturePitch8, prev->texture[0].texPitch89);
- case 7:
- MMIO(REG_3D_TextureAddress7, prev->texture[0].texOffset7);
- case 6:
- MMIO(REG_3D_TextureAddress6, prev->texture[0].texOffset6);
- MMIO(REG_3D_TexturePitch6, prev->texture[0].texPitch67);
- case 5:
- MMIO(REG_3D_TextureAddress5, prev->texture[0].texOffset5);
- case 4:
- MMIO(REG_3D_TextureAddress4, prev->texture[0].texOffset4);
- MMIO(REG_3D_TexturePitch4, prev->texture[0].texPitch45);
- case 3:
- MMIO(REG_3D_TextureAddress3, prev->texture[0].texOffset3);
- case 2:
- MMIO(REG_3D_TextureAddress2, prev->texture[0].texOffset2);
- MMIO(REG_3D_TexturePitch2, prev->texture[0].texPitch23);
- case 1:
- MMIO(REG_3D_TextureAddress1, prev->texture[0].texOffset1);
- case 0:
- MMIO(REG_3D_TextureAddress0, prev->texture[0].texOffset0);
- MMIO(REG_3D_TexturePitch0, prev->texture[0].texPitch01);
- }
- }
- if (smesa->GlobalFlag & CFLAG_TEXTURERESET_1)
- MMIO(REG_3D_Texture1Set, prev->texture[1].hwTextureSet);
- if (smesa->GlobalFlag & GFLAG_TEXTUREMIPMAP_1)
- MMIO(REG_3D_Texture1Mip, prev->texture[1].hwTextureMip);
-
- if (smesa->GlobalFlag & GFLAG_TEXBORDERCOLOR_1) {
- MMIO(REG_3D_Texture1BorderColor,
- prev->texture[1].hwTextureBorderColor);
- }
- if (smesa->GlobalFlag & GFLAG_TEXTUREADDRESS_1) {
- switch ((prev->texture[1].hwTextureSet & MASK_TextureLevel) >> 8)
- {
- case 11:
- MMIO(REG_3D_Texture1Address11, prev->texture[1].texOffset11);
- case 10:
- MMIO(REG_3D_Texture1Address10, prev->texture[1].texOffset10);
- MMIO(REG_3D_Texture1Pitch10, prev->texture[1].texPitch10);
- case 9:
- MMIO(REG_3D_Texture1Address9, prev->texture[1].texOffset9);
- case 8:
- MMIO(REG_3D_Texture1Address8, prev->texture[1].texOffset8);
- MMIO(REG_3D_Texture1Pitch8, prev->texture[1].texPitch89);
- case 7:
- MMIO(REG_3D_Texture1Address7, prev->texture[1].texOffset7);
- case 6:
- MMIO(REG_3D_Texture1Address6, prev->texture[1].texOffset6);
- MMIO(REG_3D_Texture1Pitch6, prev->texture[1].texPitch67);
- case 5:
- MMIO(REG_3D_Texture1Address5, prev->texture[1].texOffset5);
- case 4:
- MMIO(REG_3D_Texture1Address4, prev->texture[1].texOffset4);
- MMIO(REG_3D_Texture1Pitch4, prev->texture[1].texPitch45);
- case 3:
- MMIO(REG_3D_Texture1Address3, prev->texture[1].texOffset3);
- case 2:
- MMIO(REG_3D_Texture1Address2, prev->texture[1].texOffset2);
- MMIO(REG_3D_Texture1Pitch2, prev->texture[1].texPitch23);
- case 1:
- MMIO(REG_3D_Texture1Address1, prev->texture[1].texOffset1);
- case 0:
- MMIO(REG_3D_Texture1Address0, prev->texture[1].texOffset0);
- MMIO(REG_3D_Texture1Pitch0, prev->texture[1].texPitch01);
- }
- }
-
- /* texture environment */
- if (smesa->GlobalFlag & GFLAG_TEXTUREENV) {
- MMIO(REG_3D_TextureBlendFactor, prev->hwTexEnvColor);
- MMIO(REG_3D_TextureColorBlendSet0, prev->hwTexBlendColor0);
- MMIO(REG_3D_TextureAlphaBlendSet0, prev->hwTexBlendAlpha0);
- }
- if (smesa->GlobalFlag & GFLAG_TEXTUREENV_1) {
- MMIO(REG_3D_TextureBlendFactor, prev->hwTexEnvColor);
- MMIO(REG_3D_TextureColorBlendSet1, prev->hwTexBlendColor1);
- MMIO(REG_3D_TextureAlphaBlendSet1, prev->hwTexBlendAlpha1);
- }
-
- smesa->GlobalFlag &= ~GFLAG_TEXTURE_STATES;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.h
deleted file mode 100644
index 367540222..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_context.h
+++ /dev/null
@@ -1,440 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef _sis_ctx_h_
-#define _sis_ctx_h_
-
-#include "context.h"
-#include "dri_util.h"
-#include "drm.h"
-#include "drm_sarea.h"
-#include "xmlconfig.h"
-#include "tnl/t_vertex.h"
-
-#include "sis_screen.h"
-#include "sis_common2.h"
-#include "sis_dri.h"
-
-/* for GLboolean */
-#include <GL/gl.h>
-
-#define PCI_CHIP_SIS300 0x0300
-#define PCI_CHIP_SIS630 0x6300
-#define PCI_CHIP_SIS540 0x5300
-
-#define NEW_TEXTURING 0x1
-#define NEW_TEXTURE_ENV 0x2
-
-/* Flags for software fallback cases:
- */
-#define SIS_FALLBACK_TEXTURE 0x0001
-#define SIS_FALLBACK_TEXTURE0 0x0002
-#define SIS_FALLBACK_TEXTURE1 0x0004
-#define SIS_FALLBACK_TEXENV0 0x0008
-#define SIS_FALLBACK_TEXENV1 0x0010
-#define SIS_FALLBACK_DRAW_BUFFER 0x0020
-#define SIS_FALLBACK_STENCIL 0x0040
-#define SIS_FALLBACK_FORCE 0x8000
-
-/* Flags for hardware state that needs to be updated */
-#define GFLAG_ENABLESETTING 0x00000001
-#define GFLAG_ENABLESETTING2 0x00000002
-#define GFLAG_ZSETTING 0x00000004
-#define GFLAG_ALPHASETTING 0x00000008
-#define GFLAG_DESTSETTING 0x00000010
-#define GFLAG_LINESETTING 0x00000020
-#define GFLAG_STENCILSETTING 0x00000040
-#define GFLAG_FOGSETTING 0x00000080
-#define GFLAG_DSTBLEND 0x00000100
-#define GFLAG_CLIPPING 0x00000200
-#define CFLAG_TEXTURERESET 0x00000400
-#define GFLAG_TEXTUREMIPMAP 0x00000800
-#define GFLAG_TEXBORDERCOLOR 0x00001000
-#define GFLAG_TEXTUREADDRESS 0x00002000
-#define GFLAG_TEXTUREENV 0x00004000
-#define CFLAG_TEXTURERESET_1 0x00008000
-#define GFLAG_TEXTUREMIPMAP_1 0x00010000
-#define GFLAG_TEXBORDERCOLOR_1 0x00020000
-#define GFLAG_TEXTUREADDRESS_1 0x00040000
-#define GFLAG_TEXTUREENV_1 0x00080000
-#define GFLAG_ALL 0x000fffff
-
-#define GFLAG_TEXTURE_STATES (CFLAG_TEXTURERESET | GFLAG_TEXTUREMIPMAP | \
- GFLAG_TEXBORDERCOLOR | GFLAG_TEXTUREADDRESS | \
- CFLAG_TEXTURERESET_1 | GFLAG_TEXTUREMIPMAP_1 | \
- GFLAG_TEXBORDERCOLOR_1 | \
- GFLAG_TEXTUREADDRESS_1 | \
- GFLAG_TEXTUREENV | GFLAG_TEXTUREENV_1)
-
-
-#define GFLAG_RENDER_STATES (GFLAG_ENABLESETTING | GFLAG_ENABLESETTING2 | \
- GFLAG_ZSETTING | GFLAG_ALPHASETTING | \
- GFLAG_DESTSETTING | GFLAG_FOGSETTING | \
- GFLAG_STENCILSETTING | GFLAG_DSTBLEND | \
- GFLAG_CLIPPING)
-
-/* Use the templated vertex format:
- */
-#define TAG(x) sis##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-/* Subpixel offsets for window coordinates (triangles):
- */
-#define SUBPIXEL_X (-0.5F)
-#define SUBPIXEL_Y (-0.5F)
-
-#define SIS_MAX_TEXTURE_LEVELS 11
-
-typedef struct {
- GLubyte *Data; /* Pointer to texture in offscreen */
- GLuint memType; /* VIDEO_TYPE or AGP_TYPE */
- void *handle; /* Handle for sisFree*() */
- GLuint pitch;
- GLuint size;
-} sisTexImage;
-
-typedef struct sis_tex_obj {
- sisTexImage image[SIS_MAX_TEXTURE_LEVELS]; /* Image data for each mipmap
- * level */
- GLenum format; /* One of GL_ALPHA, GL_INTENSITY, GL_LUMINANCE,
- * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA */
- GLint hwformat; /* One of the TEXEL_ defines */
- GLint numImages; /* Number of images loaded into .image */
-} sisTexObj, *sisTexObjPtr;
-
-/*
- ** Device dependent context state
- */
-typedef struct __GLSiSTextureRec
-{
- GLint hwTextureSet;
- GLint hwTextureMip;
- GLint hwTextureClrHigh;
- GLint hwTextureClrLow;
- GLint hwTextureBorderColor;
-
- GLint texOffset0;
- GLint texOffset1;
- GLint texOffset2;
- GLint texOffset3;
- GLint texOffset4;
- GLint texOffset5;
- GLint texOffset6;
- GLint texOffset7;
- GLint texOffset8;
- GLint texOffset9;
- GLint texOffset10;
- GLint texOffset11;
-
- GLint texPitch01;
- GLint texPitch23;
- GLint texPitch45;
- GLint texPitch67;
- GLint texPitch89;
- GLint texPitch10;
-} __GLSiSTexture;
-
-typedef struct __GLSiSHardwareRec
-{
- GLint hwCapEnable, hwCapEnable2; /* Enable Setting */
-
- GLint hwOffsetZ, hwZ; /* Z Setting */
-
- GLint hwZBias, hwZMask; /* Z Setting */
-
- GLint hwAlpha; /* Alpha Setting */
-
- GLint hwDstSet, hwDstMask; /* Destination Setting */
-
- GLint hwOffsetDest; /* Destination Setting */
-
- GLint hwLinePattern; /* Line Setting */
-
- GLint hwFog; /* Fog Setting */
-
- GLint hwFogFar, hwFogInverse; /* Fog Distance setting */
-
- GLint hwFogDensity; /* Fog factor & density */
-
- GLint hwStSetting, hwStSetting2; /* Stencil Setting */
-
- GLint hwStOffset; /* Stencil Setting */
-
- GLint hwDstSrcBlend; /* Blending mode Setting */
-
- GLint clipTopBottom; /* Clip for Top & Bottom */
-
- GLint clipLeftRight; /* Clip for Left & Right */
-
- struct __GLSiSTextureRec texture[2];
-
- GLint hwTexEnvColor; /* Texture Blending Setting */
-
- GLint hwTexBlendColor0;
- GLint hwTexBlendColor1;
- GLint hwTexBlendAlpha0;
- GLint hwTexBlendAlpha1;
-
-}
-__GLSiSHardware;
-
-typedef struct sis_context sisContextRec;
-typedef struct sis_context *sisContextPtr;
-
-typedef void (*sis_quad_func)( sisContextPtr,
- sisVertex *,
- sisVertex *,
- sisVertex *,
- sisVertex * );
-
-typedef void (*sis_tri_func)( sisContextPtr,
- sisVertex *,
- sisVertex *,
- sisVertex * );
-
-typedef void (*sis_line_func)( sisContextPtr,
- sisVertex *,
- sisVertex * );
-
-typedef void (*sis_point_func)( sisContextPtr,
- sisVertex * );
-
-/* Device dependent context state */
-
-struct sis_context
-{
- /* This must be first in this structure */
- GLcontext *glCtx;
-
- /* Vertex state */
- GLuint vertex_size;
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
- char *verts; /* points to tnl->clipspace.vertex_buf */
-
- /* Vertex buffer (in system memory or AGP) state. */
- unsigned char *vb; /* Beginning of vertex buffer */
- unsigned char *vb_cur; /* Current write location in vertex buffer */
- unsigned char *vb_last; /* Last written location in vertex buffer */
- unsigned char *vb_end; /* End of vertex buffer */
- void *vb_agp_handle;
- GLuint vb_agp_offset;
- GLboolean using_agp;
-
- GLuint NewGLState;
- GLuint Fallback;
- GLuint RenderIndex;
- GLfloat hw_viewport[16];
- GLfloat depth_scale;
-
- unsigned int virtualX, virtualY;
- unsigned int bytesPerPixel;
- unsigned char *IOBase;
- unsigned char *FbBase;
- unsigned int displayWidth;
- unsigned int frontOffset;
- unsigned int frontPitch;
-
- /* HW RGBA layout */
- unsigned int redMask, greenMask, blueMask, alphaMask;
- unsigned int colorFormat;
-
- /* Z format */
- unsigned int zFormat;
-
- /* Clear patterns, 4 bytes */
- unsigned int clearColorPattern;
- unsigned int clearZStencilPattern;
-
- /* Fallback rasterization functions
- */
- sis_point_func draw_point;
- sis_line_func draw_line;
- sis_tri_func draw_tri;
- sis_quad_func draw_quad;
-
- GLuint hw_primitive;
- GLenum raster_primitive;
- GLenum render_primitive;
-
- /* DRM fd */
- int driFd;
-
- /* AGP Memory */
- unsigned int AGPSize;
- unsigned char *AGPBase;
- unsigned int AGPAddr;
-
- /* register 0x89F4 */
- GLint AGPParseSet;
-
- /* register 0x89F8 */
- GLint dwPrimitiveSet;
-
- __GLSiSHardware prev, current;
-
- int Chipset;
-
- GLint drawableID;
-
- /* SGRAM block write */
- GLboolean blockWrite;
-
- GLint GlobalFlag;
- GLuint last_tcl_state;
-
- /* Stereo */
- GLboolean useStereo;
- GLboolean stereoEnabled;
- int stereo_drawIndex;
- int stereo_drawSide;
- GLboolean irqEnabled;
-
- GLboolean clearTexCache;
-
- GLuint TexStates[SIS_MAX_TEXTURES];
- GLuint PrevTexFormat[SIS_MAX_TEXTURES];
-
- int *CurrentQueueLenPtr;
- unsigned int *FrameCountPtr;
-
- /* Front/back/depth buffer info */
- GLuint width, height; /* size of buffers */
- GLint bottom; /* used for FLIP macro */
- GLvoid *backbuffer;
- unsigned int backOffset;
- unsigned int backPitch;
- GLvoid *depthbuffer;
- unsigned int depthOffset;
- unsigned int depthPitch;
- void *zbFree, *bbFree; /* Cookies for freeing buffers */
- ENGPACKET zClearPacket, cbClearPacket;
-
- /* Drawable, cliprect and scissor information
- */
- GLint drawOffset, drawPitch;
- GLint readOffset, readPitch;
-
- /* Mirrors of some DRI state
- */
- __DRIcontextPrivate *driContext; /* DRI context */
- __DRIscreenPrivate *driScreen; /* DRI screen */
- __DRIdrawablePrivate *driDrawable; /* DRI drawable bound to this ctx */
-
- unsigned int lastStamp; /* mirror driDrawable->lastStamp */
-
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
-
- sisScreenPtr sisScreen; /* Screen private DRI data */
- SISSAREAPrivPtr sarea; /* Private SAREA data */
-
- /* Configuration cache */
- driOptionCache optionCache;
-};
-
-#define SIS_CONTEXT(ctx) ((sisContextPtr)(ctx->DriverCtx))
-
-/* Macros */
-#define GET_IOBase(x) ((x)->IOBase)
-
-#define Y_FLIP(Y) (smesa->bottom - (Y))
-
-#define SISPACKCOLOR565( r, g, b ) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define SISPACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define SIS_VERBOSE 0
-
-
-#define MMIO(reg, value) \
-{\
- *(volatile GLint *)(smesa->IOBase + (reg)) = value; \
-}
-
-#define MMIO_READ(reg) *(volatile GLint *)(smesa->IOBase + (reg))
-#define MMIO_READf(reg) *(volatile GLfloat *)(smesa->IOBase + (reg))
-
-#define mEndPrimitive() \
-{ \
- *(volatile GLubyte *)(smesa->IOBase + REG_3D_EndPrimitiveList) = 0xff; \
- *(volatile GLuint *)(smesa->IOBase + 0x8b60) = 0xffffffff; \
-}
-
-#define sis_fatal_error(msg) \
-do { \
- fprintf(stderr, "[%s:%d]: %s", __FILE__, __LINE__, msg); \
- exit(-1); \
-} while (0)
-
-/* Lock required */
-#define mWait3DCmdQueue(wLen) \
-/* Update the mirrored queue pointer if it doesn't indicate enough space */ \
-if (*(smesa->CurrentQueueLenPtr) < (wLen)) { \
- *(smesa->CurrentQueueLenPtr) = \
- (*(GLint *)(GET_IOBase(smesa) + REG_CommandQueue) & MASK_QueueLen) - 20; \
- /* Spin and wait if the queue is actually too full */ \
- if (*(smesa->CurrentQueueLenPtr) < (wLen)) \
- WaitingFor3dIdle(smesa, wLen); \
- *(smesa->CurrentQueueLenPtr) -= wLen; \
-}
-
-enum _sis_verbose {
- VERBOSE_SIS_BUFFER = 0x1,
- VERBOSE_SIS_MEMORY = 0x2
-};
-
-extern GLboolean sisCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-extern void sisDestroyContext( __DRIcontextPrivate * );
-
-extern GLboolean sisMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-
-extern GLboolean sisUnbindContext( __DRIcontextPrivate *driContextPriv );
-
-void WaitEngIdle (sisContextPtr smesa);
-void Wait2DEngIdle (sisContextPtr smesa);
-void WaitingFor3dIdle(sisContextPtr smesa, int wLen);
-
-/* update to hw */
-extern void sis_update_texture_state( sisContextPtr smesa );
-extern void sis_update_render_state( sisContextPtr smesa );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.c
deleted file mode 100644
index 2617980cc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- *
- */
-
-#include "sis_context.h"
-#include "sis_dd.h"
-#include "sis_lock.h"
-#include "sis_alloc.h"
-#include "sis_state.h"
-#include "sis_tris.h"
-
-#include "swrast/swrast.h"
-#include "framebuffer.h"
-
-#include "utils.h"
-
-#define DRIVER_DATE "20051019"
-
-/* Return the width and height of the given buffer.
- */
-static void
-sisGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- LOCK_HARDWARE();
- *width = smesa->driDrawable->w;
- *height = smesa->driDrawable->h;
- UNLOCK_HARDWARE();
-}
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *
-sisGetString( GLcontext *ctx, GLenum name )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- static char buffer[128];
- unsigned offset;
- GLuint agp_mode = (smesa->AGPSize > 0);
-
- switch ( name )
- {
- case GL_VENDOR:
- return (GLubyte *)"Eric Anholt";
-
- case GL_RENDERER:
- offset = driGetRendererString( buffer, "SiS", DRIVER_DATE, agp_mode );
-
- return (GLubyte *)buffer;
-
- default:
- return NULL;
- }
-}
-
-/* Send all commands to the hardware.
- */
-static void
-sisFlush( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- SIS_FIREVERTICES(smesa);
-}
-
-/* Make sure all commands have been sent to the hardware and have
- * completed processing.
- */
-static void
-sisFinish( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- SIS_FIREVERTICES(smesa);
- LOCK_HARDWARE();
- WaitEngIdle( smesa );
- UNLOCK_HARDWARE();
-}
-
-void
-sisUpdateBufferSize( sisContextPtr smesa )
-{
- __GLSiSHardware *current = &smesa->current;
- __GLSiSHardware *prev = &smesa->prev;
- GLuint z_depth;
-
- /* XXX Should get the base offset of the frontbuffer from the X Server */
- smesa->frontOffset = smesa->driDrawable->x * smesa->bytesPerPixel +
- smesa->driDrawable->y * smesa->frontPitch;
-
- if ( smesa->width == smesa->driDrawable->w &&
- smesa->height == smesa->driDrawable->h )
- {
- return;
- }
-
- smesa->width = smesa->driDrawable->w;
- smesa->height = smesa->driDrawable->h;
- smesa->bottom = smesa->height - 1;
-
- if ( smesa->backbuffer )
- sisFreeBackbuffer( smesa );
- if ( smesa->depthbuffer )
- sisFreeZStencilBuffer( smesa );
-
- if ( smesa->glCtx->Visual.depthBits > 0 )
- sisAllocZStencilBuffer( smesa );
- if ( smesa->glCtx->Visual.doubleBufferMode )
- sisAllocBackbuffer( smesa );
-
- switch (smesa->zFormat)
- {
- case SiS_ZFORMAT_Z16:
- z_depth = 2;
- break;
- case SiS_ZFORMAT_Z32:
- case SiS_ZFORMAT_S8Z24:
- z_depth = 4;
- break;
- default:
- sis_fatal_error("Bad Z format\n");
- }
-
- current->hwZ &= ~MASK_ZBufferPitch;
- current->hwZ |= smesa->width * z_depth >> 2;
- current->hwOffsetZ = smesa->depthOffset >> 2;
-
- if ((current->hwOffsetZ != prev->hwOffsetZ) || (current->hwZ != prev->hwZ)) {
- prev->hwOffsetZ = current->hwOffsetZ;
- prev->hwZ = current->hwZ;
- smesa->GlobalFlag |= GFLAG_ZSETTING;
- }
-
- sisUpdateClipping( smesa->glCtx );
-}
-
-/* Initialize the driver's misc functions.
- */
-void
-sisInitDriverFuncs( struct dd_function_table *functions )
-{
- functions->GetBufferSize = sisGetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->GetString = sisGetString;
- functions->Finish = sisFinish;
- functions->Flush = sisFlush;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.h
deleted file mode 100644
index da76596e9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_dd.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_DD_H__
-#define __SIS_DD_H__
-
-extern void sisUpdateBufferSize( sisContextPtr smesa );
-
-extern void sisInitDriverFuncs( struct dd_function_table *functions );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.c
deleted file mode 100644
index 99cb09c25..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-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 SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_debug.c,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- *
- */
-
-/*
- * dump HW states, set environment variable SIS_DEBUG
- * to enable these functions
- */
-
-#include <fcntl.h>
-#include <assert.h>
-
-#include "sis_context.h"
-
-/* for SiS 300/630/540 */
-#define MMIOLength (0x8FFF-0x8800+1)
-#define MMIO3DOffset (0x8800)
-#define FILE_NAME "300.dump"
-
-char *IOBase4Debug = 0;
-
-char *prevLockFile = NULL;
-int prevLockLine = 0;
-
-GLint _empty[0x10000];
-
-void
-dump_agp (void *addr, int dword_count)
-{
- if (!getenv ("SIS_DEBUG"))
- return;
-
- {
- int i;
- FILE *file = fopen ("300agp.dump", "w");
-
- if (file)
- {
- for (i = 0; i < dword_count; i++)
- {
- fprintf (file, "%f\n", *(float *) addr);
- ((unsigned char *) addr) += 4;
- }
- fclose (file);
- }
- }
-}
-
-void
-d2f_once (GLcontext * ctx)
-{
- XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- static int serialNumber = -1;
-
- if (serialNumber == smesa->serialNumber)
- return;
- else
- serialNumber = smesa->serialNumber;
-
- d2f();
-}
-
-void
-d2f (void)
-{
- if (!getenv ("SIS_DEBUG"))
- return;
-
- /* dump 0x8800 - 0x8AFF */
- {
- int fh;
- int rval;
- void *addr = IOBase4Debug + MMIO3DOffset;
-
- assert (IOBase4Debug);
-
- if ((fh = open (FILE_NAME, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE)) != -1)
- {
- rval = write (fh, addr, MMIOLength);
- assert (rval != -1);
- close (fh);
- }
- }
-}
-
-/* dump to HW */
-void
-d2h (char *file_name)
-{
- int fh;
- int rval;
- void *addr[MMIOLength];
-
- if (!getenv ("SIS_DEBUG"))
- return;
-
- if ((fh = open (file_name, O_CREAT, S_IREAD | S_IWRITE)) != -1)
- {
- rval = read (fh, addr, MMIOLength);
- assert (rval != -1);
- close (fh);
- }
- memcpy (IOBase4Debug + MMIO3DOffset, addr, MMIOLength);
-
-}
-
-/* dump video memory to file */
-void
-dvidmem (unsigned char *addr, int size)
-{
- int fh;
- int rval;
- static char *file_name = "vidmem.dump";
-
- if (!getenv ("SIS_DEBUG"))
- return;
-
- if ((fh = open (file_name, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE)) != -1)
- {
- rval = write (fh, addr, size);
- assert (rval != -1);
- close (fh);
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.h
deleted file mode 100644
index 5e2b30912..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_debug.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-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 SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_debug.h,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- *
- */
-
-#ifndef _sis_debug_h_
-#define _sis_debug_h_
-
-void dump_agp (void *addr, int dword_count);
-void d2f (void);
-void d2f_once (GLcontext * ctx);
-void d2h (char *file_name);
-void dvidmem (unsigned char *addr, int size);
-extern char *IOBase4Debug;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_fog.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_fog.c
deleted file mode 100644
index e1230f6b4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_fog.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_fog.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "swrast/swrast.h"
-
-#include "macros.h"
-
-static GLint convertFtToFogFt( GLfloat dwInValue );
-
-void
-sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- float fArg;
- GLint fogColor;
-
- switch (pname)
- {
- case GL_FOG_MODE:
- current->hwFog &= ~MASK_FogMode;
- switch (ctx->Fog.Mode)
- {
- case GL_LINEAR:
- current->hwFog |= FOGMODE_LINEAR;
- break;
- case GL_EXP:
- current->hwFog |= FOGMODE_EXP;
- break;
- case GL_EXP2:
- current->hwFog |= FOGMODE_EXP2;
- break;
- }
- if (current->hwFog != prev->hwFog) {
- prev->hwFog = current->hwFog;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- case GL_FOG_DENSITY:
- current->hwFogDensity = convertFtToFogFt( ctx->Fog.Density );
- if (current->hwFogDensity != prev->hwFogDensity) {
- prev->hwFogDensity = current->hwFogDensity;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- fArg = 1.0 / (ctx->Fog.End - ctx->Fog.Start);
- current->hwFogInverse = doFPtoFixedNoRound( fArg, 10 );
- if (pname == GL_FOG_END)
- {
- if (smesa->Chipset == PCI_CHIP_SIS300)
- current->hwFogFar = doFPtoFixedNoRound( ctx->Fog.End, 10 );
- else
- current->hwFogFar = doFPtoFixedNoRound( ctx->Fog.End, 6 );
- }
- if (current->hwFogFar != prev->hwFogFar ||
- current->hwFogInverse != prev->hwFogInverse)
- {
- prev->hwFogFar = current->hwFogFar;
- prev->hwFogInverse = current->hwFogInverse;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- case GL_FOG_INDEX:
- /* TODO */
- break;
- case GL_FOG_COLOR:
- fogColor = FLOAT_TO_UBYTE( ctx->Fog.Color[0] ) << 16;
- fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[1] ) << 8;
- fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[2] );
- current->hwFog &= 0xff000000;
- current->hwFog |= fogColor;
- if (current->hwFog != prev->hwFog) {
- prev->hwFog = current->hwFog;
- smesa->GlobalFlag |= GFLAG_FOGSETTING;
- }
- break;
- }
-}
-
-GLint
-doFPtoFixedNoRound( GLfloat dwInValue, int nFraction )
-{
- GLint dwMantissa;
- int nTemp;
- union { int i; float f; } u;
- GLint val;
-
- u.f = dwInValue;
- val = u.i;
-
- if (val == 0)
- return 0;
- nTemp = (int) (val & 0x7F800000) >> 23;
- nTemp = nTemp - 127 + nFraction - 23;
- dwMantissa = (val & 0x007FFFFF) | 0x00800000;
-
- if (nTemp < -25)
- return 0;
- if (nTemp > 0)
- dwMantissa <<= nTemp;
- else {
- nTemp = -nTemp;
- dwMantissa >>= nTemp;
- }
- if (val & 0x80000000)
- dwMantissa = ~dwMantissa + 1;
- return dwMantissa;
-}
-
-/* s[8].23->s[7].10 */
-static GLint
-convertFtToFogFt( GLfloat dwInValue )
-{
- GLint dwMantissa, dwExp;
- GLint dwRet;
- union { int i; float f; } u;
- GLint val;
-
- u.f = dwInValue;
- val = u.i;
-
- if (val == 0)
- return 0;
-
- /* ----- Standard float Format: s[8].23 -----
- * ----- = (-1)^S * 2^(E - 127) * (1 + M / 2^23) -----
- * ----- = (-1)^S * 2^((E-63) - 64) * (1 + (M/2^13) / 2^10) -----
- * ----- Density float Format: s[7].10 -----
- * ----- New Exponential = E - 63 -----
- * ----- New Mantissa = M / 2^13 -----
- * ----- -----
- */
-
- dwExp = (val & 0x7F800000) >> 23;
- dwExp -= 63;
-
- if (dwExp < 0)
- return 0;
-
- if (dwExp <= 0x7F)
- dwMantissa = (val & 0x007FFFFF) >> (23 - 10);
- else {
- /* ----- To Return +Max(or -Max) ----- */
- dwExp = 0x7F;
- dwMantissa = 0x3FF;
- }
-
- dwRet = (val & 0x80000000) >> (31 - 17); /* Shift Sign Bit */
-
- dwRet |= (dwExp << 10) | dwMantissa;
-
- return dwRet;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.c
deleted file mode 100644
index f598e52d9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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 <anholt@FreeBSD.org>
- */
-
-#include "context.h"
-#include "sis_context.h"
-#include "sis_lock.h"
-#include "sis_dd.h"
-#include "sis_state.h"
-
-/* 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
-sisGetLock( sisContextPtr smesa, GLuint flags )
-{
- __DRIdrawablePrivate *dPriv = smesa->driDrawable;
- __DRIscreenPrivate *sPriv = smesa->driScreen;
- SISSAREAPrivPtr sarea = smesa->sarea;
-
- drmGetLock( smesa->driFd, smesa->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 ( smesa->lastStamp != dPriv->lastStamp ) {
- sisUpdateBufferSize( smesa );
- sisUpdateClipping( smesa->glCtx );
- sisDDDrawBuffer( smesa->glCtx, smesa->glCtx->Color.DrawBuffer[0] );
- smesa->lastStamp = dPriv->lastStamp;
- }
-
- if ( sarea->CtxOwner != smesa->hHWContext ) {
- sarea->CtxOwner = smesa->hHWContext;
- smesa->GlobalFlag = GFLAG_ALL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.h
deleted file mode 100644
index fef993196..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_lock.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_LOCK_H
-#define __SIS_LOCK_H
-
-extern void sisGetLock( sisContextPtr smesa, GLuint flags );
-
-#ifdef DEBUG_LOCKING
-extern char *prevLockFile;
-extern int prevLockLine;
-#define DEBUG_LOCK() \
- do { \
- prevLockFile=(__FILE__); \
- prevLockLine=(__LINE__); \
- } while (0)
-#define DEBUG_RESET() \
- do { \
- prevLockFile=NULL; \
- prevLockLine=0; \
- } while (0)
-#define DEBUG_CHECK_LOCK() \
- do { \
- if(prevLockFile){ \
- fprintf(stderr, "LOCK SET : %s:%d\n", __FILE__, __LINE__); \
- } \
- } while (0)
-#else
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-#endif
-
-/* Lock the hardware using the global current context */
-#define LOCK_HARDWARE() \
- do { \
- char __ret=0; \
- mEndPrimitive(); \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( smesa->driHwLock, smesa->hHWContext, \
- (DRM_LOCK_HELD | smesa->hHWContext), __ret ); \
- if ( __ret != 0 ) \
- sisGetLock( smesa, 0 ); \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware using the global current context */
-#define UNLOCK_HARDWARE() \
- do { \
- mEndPrimitive(); \
- DRM_UNLOCK(smesa->driFd, smesa->driHwLock, \
- smesa->hHWContext); \
- DEBUG_RESET(); \
- } while (0)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_reg.h
deleted file mode 100644
index 76014ff3e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_reg.h
+++ /dev/null
@@ -1,868 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_reg.h,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef _sis_reg_h_
-#define _sis_reg_h_
-
-/*
- * Define All the Register Address of 6327
- */
-
-#define REG_CommandQueue 0x8240
-
-#define REG_3D_TSFSa 0x8800
-#define REG_3D_TSZa 0x8804
-#define REG_3D_TSXa 0x8808
-#define REG_3D_TSYa 0x880C
-#define REG_3D_TSARGBa 0x8810
-#define REG_3D_TSWGa 0x8814
-#define REG_3D_TSUAa 0x8818
-#define REG_3D_TSVAa 0x881C
-#define REG_3D_TSUBa 0x8820
-#define REG_3D_TSVBa 0x8824
-#define REG_3D_TSUCa 0x8828
-#define REG_3D_TSVCa 0x882C
-
-#define REG_3D_TSFSb 0x8830
-#define REG_3D_TSZb 0x8834
-#define REG_3D_TSXb 0x8838
-#define REG_3D_TSYb 0x883C
-#define REG_3D_TSARGBb 0x8840
-#define REG_3D_TSWGb 0x8844
-#define REG_3D_TSUAb 0x8848
-#define REG_3D_TSVAb 0x884C
-#define REG_3D_TSUBb 0x8850
-#define REG_3D_TSVBb 0x8854
-#define REG_3D_TSUCb 0x8858
-#define REG_3D_TSVCb 0x885C
-
-#define REG_3D_TSFSc 0x8860
-#define REG_3D_TSZc 0x8864
-#define REG_3D_TSXc 0x8868
-#define REG_3D_TSYc 0x886C
-#define REG_3D_TSARGBc 0x8870
-#define REG_3D_TSWGc 0x8874
-#define REG_3D_TSUAc 0x8878
-#define REG_3D_TSVAc 0x887C
-#define REG_3D_TSUBc 0x8880
-#define REG_3D_TSVBc 0x8884
-#define REG_3D_TSUCc 0x8888
-#define REG_3D_TSVCc 0x888C
-
-/*
- * REG_3D_AGPCmdSetting (89e4h-89f7)
- */
-#define REG_3D_AGPCmBase 0x89E4
-#define REG_3D_AGPRmDwNum 0x89E8
-#define REG_3D_AGPTtDwNum 0x89EC
-#define REG_3D_AGPCmFire 0x89F0
-
-#define REG_3D_ParsingSet 0x89F4
-#define REG_3D_PrimitiveSet 0x89F8
-#define REG_3D_ShadeMode 0x89F8
-#define REG_3D_EngineFire 0x89FC
-#define REG_3D_EngineStatus 0x89FC
-#define REG_3D_TEnable 0x8A00
-#define REG_3D_TEnable2 0x8A04
-
-#define REG_3D_ZSet 0x8A08
-#define REG_3D_ZBias 0x8A0C
-#define REG_3D_ZStWriteMask 0x8A10
-
-#define REG_3D_ZAddress 0x8A14
-#define REG_3D_AlphaSet 0x8A18
-#define REG_3D_AlphaAddress 0x8A1C
-#define REG_3D_DstSet 0x8A20
-#define REG_3D_DstAlphaWriteMask 0x8A24
-
-#define REG_3D_DstAddress 0x8A28
-
-#define REG_3D_LinePattern 0x8A2C
-
-#define REG_3D_FogSet 0x8A30
-
-#define REG_3D_FogFarDistance 0x8A34
-#define REG_3D_FogInverseDistance 0x8A38
-#define REG_3D_FogFactorDensity 0x8A3C
-
-#define REG_3D_StencilSet 0x8A44
-#define REG_3D_StencilSet2 0x8A48
-#define REG_3D_StencilAddress 0x8A4C
-
-#define REG_3D_DstBlendMode 0x8A50
-#define REG_3D_SrcBlendMode 0x8A50
-#define REG_3D_ClipTopBottom 0x8A54
-#define REG_3D_ClipLeftRight 0x8A58
-
-#define REG_3D_Brightness 0x8A5C
-
-#define REG_3D_BumpMapSet 0x8A68
-#define REG_3D_BumpMapAddress 0x8A6C
-#define REG_3D_BumpMapPitch 0x8A70
-#define REG_3D_BumpMapMatrix0 0x8A74
-#define REG_3D_BumpMapMatrix1 0x8A78
-
-/*
- * Define the Texture Register Address of 6326
- */
-#define REG_3D_TextureSet 0x8A7C
-#define REG_3D_TextureWidthHeight 0x8A7C
-#define REG_3D_TextureMip 0x8A80
-
-#define REG_3D_TextureTransparencyColorHigh 0x8A84
-#define REG_3D_TextureTransparencyColorLow 0x8A88
-#define REG_3D_TextureBorderColor 0x8A8C
-#define REG_3D_TextureAddress0 0x8A90
-#define REG_3D_TextureAddress1 0x8A94
-#define REG_3D_TextureAddress2 0x8A98
-#define REG_3D_TextureAddress3 0x8A9C
-#define REG_3D_TextureAddress4 0x8AA0
-#define REG_3D_TextureAddress5 0x8AA4
-#define REG_3D_TextureAddress6 0x8AA8
-#define REG_3D_TextureAddress7 0x8AAC
-#define REG_3D_TextureAddress8 0x8AB0
-#define REG_3D_TextureAddress9 0x8AB4
-#define REG_3D_TextureAddress10 0x8AB8
-#define REG_3D_TextureAddress11 0x8ABC
-#define REG_3D_TexturePitch0 0x8AC0
-#define REG_3D_TexturePitch1 0x8AC0
-#define REG_3D_TexturePitch2 0x8AC4
-#define REG_3D_TexturePitch3 0x8AC4
-#define REG_3D_TexturePitch4 0x8AC8
-#define REG_3D_TexturePitch5 0x8AC8
-#define REG_3D_TexturePitch6 0x8ACC
-#define REG_3D_TexturePitch7 0x8ACC
-#define REG_3D_TexturePitch8 0x8AD0
-#define REG_3D_TexturePitch9 0x8AD0
-#define REG_3D_TexturePitch10 0x8AD4
-
-#define REG_3D_Texture1Set 0x8ADC
-#define REG_3D_Texture1WidthHeight 0x8ADC
-#define REG_3D_Texture1Mip 0x8AE0
-
-#define REG_3D_Texture1TransparencyColorHigh 0x8AE4
-#define REG_3D_Texture1TransparencyColorLow 0x8AE8
-#define REG_3D_Texture1BorderColor 0x8AEC
-#define REG_3D_Texture1Address0 0x8AF0
-#define REG_3D_Texture1Address1 0x8AF4
-#define REG_3D_Texture1Address2 0x8AF8
-#define REG_3D_Texture1Address3 0x8AFC
-#define REG_3D_Texture1Address4 0x8B00
-#define REG_3D_Texture1Address5 0x8B04
-#define REG_3D_Texture1Address6 0x8B08
-#define REG_3D_Texture1Address7 0x8B0C
-#define REG_3D_Texture1Address8 0x8B10
-#define REG_3D_Texture1Address9 0x8B14
-#define REG_3D_Texture1Address10 0x8B18
-#define REG_3D_Texture1Address11 0x8B1C
-#define REG_3D_Texture1Pitch0 0x8B20
-#define REG_3D_Texture1Pitch1 0x8B20
-#define REG_3D_Texture1Pitch2 0x8B24
-#define REG_3D_Texture1Pitch3 0x8B24
-#define REG_3D_Texture1Pitch4 0x8B28
-#define REG_3D_Texture1Pitch5 0x8B28
-#define REG_3D_Texture1Pitch6 0x8B2C
-#define REG_3D_Texture1Pitch7 0x8B2C
-#define REG_3D_Texture1Pitch8 0x8B30
-#define REG_3D_Texture1Pitch9 0x8B30
-#define REG_3D_Texture1Pitch10 0x8B34
-
-#define REG_3D_TextureBlendFactor 0x8B3C
-#define REG_3D_TextureColorBlendSet0 0x8B40
-#define REG_3D_TextureColorBlendSet1 0x8B44
-#define REG_3D_TextureAlphaBlendSet0 0x8B48
-#define REG_3D_TextureAlphaBlendSet1 0x8B4C
-/*
- * Define the End of Primitive List of 6326
- */
-#define REG_3D_EndPrimitiveList 0X8B50
-
-
-/*
- * Define the Stipple Register Address of 6326
- */
-#define REG_3D_Stipple0 0X8B60
-
-#define REG_3D_TexturePalette 0x8C00
-
-/*
- * REG_CommandQueue -- (8240h-8243h)
- */
-#define MASK_QueueLen 0x0000ffff
-#define SiS_EngIdle2d 0x80000000
-#define SiS_EngIdle 0xe0000000
-#define MASK_EngState 0xf0000000
-
-/*
- * REG_3D_ParsingSet -- Define Parsing Mask (89F4h-89F7h)
- */
-#define MASK_VertexDWSize 0xf0000000
-#define MASK_VertexDataFormat 0x0fff0000
-/* Because the original MASK_PsVertex_* names of these bits appared to be
- * wrong, new names SiS_PS_* based off of the 4.3.0 driver and research are
- * below.
- */
-#define SiS_PS_HAS_XYZ 0x08000000
-#define SiS_PS_HAS_W 0x04000000
-#define SiS_PS_HAS_SPECULAR 0x02000000 /* XXX ? */
-#define SiS_PS_HAS_DIFFUSE 0x01000000
-#define SiS_PS_HAS_UV0 0x00400000
-#define SiS_PS_HAS_UV1 0x00200000
-#define MASK_PsVertex_HAS_RHW 0x08000000
-#define MASK_PsVertex_HAS_NORMALXYZ 0x04000000
-#define MASK_PsVertex_HAS_DIFFUSE 0x02000000
-#define MASK_PsVertex_HAS_SPECULAR 0x01000000
-#define MASK_PsUVSet 0x00ff0000
-#define MASK_PsVertex_HAS_1SetUV 0x00800000
-#define MASK_PsVertex_HAS_2SetUV 0x00c00000
-#define MASK_PsVertex_HAS_3SetUV 0x00e00000
-#define MASK_PsVertex_HAS_UVSet1 0x00800000
-#define MASK_PsVertex_HAS_UVSet2 0x00400000
-#define MASK_PsVertex_HAS_UVSet3 0x00200000
-#define MASK_PsCullDirection_CCW 0x00008000
-#define MASK_PsShadingMode 0x00007000
-/* XXX Shading modes just a guess, but seem to work*/
-#define MASK_PsShadingFlatA 0x00001000
-#define MASK_PsShadingFlatB 0x00002000
-#define MASK_PsShadingFlatC 0x00003000
-#define MASK_PsShadingSmooth 0x00004000
-#define MASK_PsTextureFrom 0x000003f0
-#define MASK_PsTexture0FromA 0x00000000
-#define MASK_PsTexture1FromA 0x00000000
-#define MASK_PsTexture1FromB 0x00000040
-#define MASK_PsBumpTextureFromA 0x00000000
-#define MASK_PsBumpTextureFromB 0x00000010
-#define MASK_PsBumpTextureFromC 0x00000020
-#define MASK_PsDataType 0x0000000f
-#define MASK_PsPointList 0x00000000
-#define MASK_PsLineList 0x00000004
-#define MASK_PsLineStrip 0x00000005
-#define MASK_PsTriangleList 0x00000008
-#define MASK_PsTriangleStrip 0x00000009
-#define MASK_PsTriangleFan 0x0000000a
-
-/*
- * REG_3D_PrimitiveSet -- Define Fire Primitive Mask (89F8h-89FBh)
- */
-#define MASK_DrawPrimitiveCommand 0x00000007
-#define MASK_SetFirePosition 0x00001F00
-#define MASK_BumpTextureFrom 0x00030000
-#define MASK_Texture1From 0x000C0000
-#define MASK_Texture0From 0x00300000
-#define MASK_ShadingMode 0x07000000
-#define MASK_CullDirection 0x08000000
-
-#define OP_3D_POINT_DRAW 0x00000000
-#define OP_3D_LINE_DRAW 0x00000001
-#define OP_3D_TRIANGLE_DRAW 0x00000002
-
-#define OP_3D_DIRECTION_RIGHT 0x00000000
-#define OP_3D_DIRECTION_LEFT 0x00000100
-#define OP_3D_DIRECTION_HORIZONTAL 0x00000000
-#define OP_3D_DIRECTION_VERTICAL 0x00000100
-
-#define OP_3D_FIRE_TFIRE 0x00000000
-#define OP_3D_FIRE_TSARGBa 0x00000100
-#define OP_3D_FIRE_TSWa 0x00000200
-#define OP_3D_FIRE_TSVAa 0x00000300
-#define OP_3D_FIRE_TSVBa 0x00000400
-#define OP_3D_FIRE_TSVCa 0x00000500
-
-#define OP_3D_FIRE_TSARGBb 0x00000900
-#define OP_3D_FIRE_TSWb 0x00000a00
-#define OP_3D_FIRE_TSVAb 0x00000b00
-#define OP_3D_FIRE_TSVBb 0x00000c00
-#define OP_3D_FIRE_TSVCb 0x00000d00
-
-#define OP_3D_FIRE_TSARGBc 0x00001100
-#define OP_3D_FIRE_TSWc 0x00001200
-#define OP_3D_FIRE_TSVAc 0x00001300
-#define OP_3D_FIRE_TSVBc 0x00001400
-#define OP_3D_FIRE_TSVCc 0x00001500
-
-#define OP_3D_Texture0FromA 0x00000000
-#define OP_3D_Texture0FromB 0x00100000
-#define OP_3D_Texture0FromC 0x00200000
-#define OP_3D_Texture1FromA 0x00000000
-#define OP_3D_Texture1FromB 0x00040000
-#define OP_3D_Texture1FromC 0x00080000
-#define OP_3D_TextureBumpFromA 0x00000000
-#define OP_3D_TextureBumpFromB 0x00010000
-#define OP_3D_TextureBumpFromC 0x00020000
-
-#define OP_3D_CullDirection_CCW 0x08000000
-
-#define SHADE_FLAT_VertexA 0x01000000
-#define SHADE_FLAT_VertexB 0x02000000
-#define SHADE_FLAT_VertexC 0x03000000
-#define SHADE_GOURAUD 0x04000000
-
-/*
- * Define Command Queue Length Mask (89FCh-89FF)
- */
-#define MASK_CmdQueueLen 0x0FFF0000
-
-/*
- * REG_3D_TEnable -- Define Capility Enable Mask (8A00h-8A03h)
- */
-#define MASK_DitherEnable 0x00000001
-#define MASK_BlendEnable 0x00000002
-#define MASK_FogTestEnable 0x00000004
-#define MASK_FogEnable 0x00000008
-#define MASK_SpecularEnable 0x00000010
-#define MASK_FogPerspectiveEnable 0x00000020
-#define MASK_TextureCacheClear 0x00000040
-#define MASK_TextureCacheEnable 0x00000080
-#define MASK_BumpMapEnable 0x00000100
-#define MASK_TexturePerspectiveEnable 0x00000200
-#define MASK_TextureEnable 0x00000400
-#define MASK_CullEnable 0x00000800
-#define MASK_TextureNumUsed 0x0000F000
-#define MASK_AlphaBufferEnable 0x00010000
-#define MASK_AlphaTestEnable 0x00020000
-#define MASK_AlphaWriteEnable 0x00040000
-#define MASK_ZTestEnable 0x00080000
-#define MASK_ZWriteEnable 0x00100000
-#define MASK_StencilBufferEnable 0x00200000
-#define MASK_StencilTestEnable 0x00400000
-#define MASK_StencilWriteEnable 0x00800000
-#define MASK_Texture0TransparencyEnable 0x01000000
-#define MASK_Texture1TransparencyEnable 0x02000000
-#define MASK_TextureAWrapUCorrection 0x04000000
-#define MASK_TextureAWrapVCorrection 0x08000000
-#define MASK_TextureBWrapUCorrection 0x10000000
-#define MASK_TextureBWrapVCorrection 0x20000000
-#define MASK_TextureCWrapUCorrection 0x40000000
-#define MASK_TextureCWrapVCorrection 0x80000000
-
-/*
- * REG_3D_TEnable2 -- Define Capility Enable Mask2 (8A04h-8A07h)
- */
-#define MASK_Texture0BlockTextureEnable 0x00000001
-#define MASK_Texture1BlockTextureEnable 0x00000002
-#define MASK_Texture0AnisotropicEnable 0x00000010
-#define MASK_Texture1AnisotropicEnable 0x00000020
-#define MASK_TextureMipmapBiasEnable 0x00000040
-#define MASK_LinePatternEnable 0x00000100
-#define MASK_StippleAlphaEnable 0x00000200
-#define MASK_StippleEnable 0x00000400
-#define MASK_AntiAliasEnable 0x00000800
-#define MASK_ZMaskWriteEnable 0x00001000
-#define MASK_StencilMaskWriteEnable 0x00002000
-#define MASK_AlphaMaskWriteEnable 0x00004000
-#define MASK_ColorMaskWriteEnable 0x00008000
-#define MASK_ZCacheClear 0x00010000
-#define MASK_ZCacheEnable 0x00020000
-#define MASK_StencilCacheClear 0x00040000
-#define MASK_StencilCacheEnable 0x00080000
-#define MASK_AlphaCacheClear 0x00100000
-#define MASK_AlphaCacheEnable 0x00200000
-#define MASK_ColorCacheClear 0x00400000
-#define MASK_ColorCacheEnable 0x00800000
-
-/*
- * REG_3D_ZSet -- Define Z Buffer Setting Mask (8A08h-8A0Bh)
- */
-#define MASK_ZBufferPitch 0x00000FFF
-#define MASK_ZTestMode 0x00070000
-#define MASK_ZBufferInSystem 0x00080000
-#define MASK_ZBufferFormat 0x01F00000
-
-#define SiS_Z_COMP_NEVER 0x00000000
-#define SiS_Z_COMP_S_LT_B 0x00010000
-#define SiS_Z_COMP_S_EQ_B 0x00020000
-#define SiS_Z_COMP_S_LE_B 0x00030000
-#define SiS_Z_COMP_S_GT_B 0x00040000
-#define SiS_Z_COMP_S_NE_B 0x00050000
-#define SiS_Z_COMP_S_GE_B 0x00060000
-#define SiS_Z_COMP_ALWAYS 0x00070000
-
-#define SiS_ZFORMAT_Z16 0x00000000
-#define SiS_ZFORMAT_Z16_INT 0x00100000
-#define SiS_ZFORMAT_S1Z15 0x00400000
-#define SiS_ZFORMAT_S1Z15_INT 0x00500000
-#define SiS_ZFORMAT_Z32 0x00800000
-#define SiS_ZFORMAT_S1Z31 0x00C00000
-#define SiS_ZFORMAT_S2Z30 0x00D00000
-#define SiS_ZFORMAT_S4Z28 0x00E00000
-#define SiS_ZFORMAT_S8Z24 0x00F00000
-#define SiS_ZFORMAT_FZ30 0x01800000
-#define SiS_ZFORMAT_FS1Z30 0x01C00000
-#define SiS_ZFORMAT_FS2Z30 0x01D00000
-
-/*
- * REG_3D_ZBias -- Define Z Buffer Setting Mask (8A0Ch-8A0Fh)
- */
-#define MASK_ZBias 0xFFFFFFFF
-
-/*
- * REG_3D_ZStWriteMask -- Define Z and Stencil Buffer Mask (8A10h-8A13h)
- */
-#define MASK_ZWriteMask 0x00FFFFFF
-
-/*
- * REG_3D_ZAddress -- Define Z Buffer Base Address(8A14h-8A17h)
- */
-#define MASK_ZAddress 0xFFFFFFFF
-
-/*
- * REG_3D_AlphaSet -- Define Alpha Buffer Setting Mask (8A18h-8A1Bh)
- */
-#define MASK_AlphaBufferPitch 0x000003FF
-#define MASK_AlphaRefValue 0x00FF0000
-#define MASK_AlphaTestMode 0x07000000
-#define MASK_AlphaBufferInSystem 0x08000000
-#define MASK_AlphaBufferFormat 0x30000000
-
-#define SiS_ALPHA_NEVER 0x00000000
-#define SiS_ALPHA_LESS 0x01000000
-#define SiS_ALPHA_EQUAL 0x02000000
-#define SiS_ALPHA_LEQUAL 0x03000000
-#define SiS_ALPHA_GREATER 0x04000000
-#define SiS_ALPHA_NOTEQUAL 0x05000000
-#define SiS_ALPHA_GEQUAL 0x06000000
-#define SiS_ALPHA_ALWAYS 0x07000000
-
-/*
- * REG_3D_AlphaAddress -- Define Alpha Buffer Base Address(8A1Ch-8A1Fh)
- */
-#define MASK_AlphaAddress 0xFFFFFFFF
-
-/*
- * REG_3D_DstSet -- Define Destination Buffer Setting Mask (8A20h-8A23h)
- */
-#define MASK_DstBufferPitch 0x00000FFF
-#define MASK_DstBufferFormat 0x000F0000
-#define MASK_DstBufferBitDepth 0x00300000
-#define MASK_DstBufferRgbOrder 0x00400000
-#define MASK_DstBufferInSystem 0x00800000
-#define MASK_Dst7BitFormat 0x007F0000
-#define MASK_ROP2 0x0F000000
-
-#define DST_FORMAT_RGB_555 0x00100000
-#define DST_FORMAT_RGB_565 0x00110000
-#define DST_FORMAT_ARGB_1555 0x00120000
-#define DST_FORMAT_ARGB_4444 0x00130000
-#define DST_FORMAT_ARGB_1888 0x00300000
-#define DST_FORMAT_ARGB_2888 0x00310000
-#define DST_FORMAT_ARGB_4888 0x00320000
-#define DST_FORMAT_ARGB_8888 0x00330000
-#define DST_FORMAT_ARGB_0888 0x00340000
-
-#define DST_FORMAT_BGR_555 0x00500000
-#define DST_FORMAT_BGR_565 0x00510000
-#define DST_FORMAT_ABGR_1555 0x00520000
-#define DST_FORMAT_ABGR_4444 0x00530000
-#define DST_FORMAT_ABGR_1888 0x00700000
-#define DST_FORMAT_ABGR_2888 0x00710000
-#define DST_FORMAT_ABGR_4888 0x00720000
-#define DST_FORMAT_ABGR_8888 0x00730000
-#define DST_FORMAT_ABGR_0888 0x00740000
-
-#define LOP_CLEAR 0x00000000
-#define LOP_NOR 0x01000000
-#define LOP_AND_INVERTED 0x02000000
-#define LOP_COPY_INVERTED 0x03000000
-#define LOP_AND_REVERSE 0x04000000
-#define LOP_INVERT 0x05000000
-#define LOP_XOR 0x06000000
-#define LOP_NAND 0x07000000
-#define LOP_AND 0x08000000
-#define LOP_EQUIV 0x09000000
-#define LOP_NOOP 0x0a000000
-#define LOP_OR_INVERTED 0x0b000000
-#define LOP_COPY 0x0c000000
-#define LOP_OR_REVERSE 0x0d000000
-#define LOP_OR 0x0e000000
-#define LOP_SET 0x0f000000
-
-/*
- * REG_3D_DstAlphaWriteMask -- Define Destination/Alpha Buffer Write Mask (8A24h-8A27h)
- */
-#define MASK_ColorWriteMask 0x00FFFFFF
-#define MASK_AlphaWriteMask 0xFF000000
-
-/*
- * REG_3D_DstAddress -- Define Destination Buffer Base Address(8A1Ch-8A1Fh)
- */
-#define MASK_DstAddress 0xFFFFFFFF
-
-/*
- * REG_3D_LinePattern -- Define Line Pattern (8A2Ch-8A2Fh)
- */
-#define MASK_LinePatternRepeatFactor 0x00007FFF
-#define MASK_LinePatternLastPixelFlag 0x00008000
-#define MASK_LinePattern 0xFFFF0000
-
-/*
- * REG_3D_FogSet -- Define Fog Mask (8A30h-8A33h)
- */
-#define MASK_FogColor 0x00FFFFFF
-#define MASK_FogMode 0x07000000
-#define MASK_FogZLookup 0x08000000
-
-#define FOGMODE_CHEAP 0x04000000
-#define FOGMODE_LINEAR 0x05000000
-#define FOGMODE_EXP 0x06000000
-#define FOGMODE_EXP2 0x07000000
-
-/*
- * REG_3D_FogStartEnd -- Define Fog Start End Setting (0x8A34 - 0x8A37)
- */
-#define MASK_FogFarDistance 0x0007FFFF
-
-/*
- * REG_3D_FogStartEnd -- Define Fog End Setting (0x8A38 - 0x8A3B)
- */
-#define MASK_FogInvFarDistance 0x0007FFFF
-
-/*
- * REG_3D_FogFactorDensity (0x8A3C - 0x8A3F)
- */
-#define MASK_FogDensity 0x0003FFFF
-#define MASK_FogFactor 0xFF000000
-
-/*
- * REG_3D_StencilSet -- Define stencil test (8A44h-8A47h)
- */
-#define MASK_StencilValueMask 0x000000ff
-#define MASK_StencilRefMask 0x0000ff00
-#define MASK_StencilTestMode 0x07000000
-#define MASK_StencilBufferInSystem 0x08000000
-#define MASK_StencilFormat 0x30000000
-
-#define SiS_STENCIL_NEVER 0x00000000
-#define SiS_STENCIL_LESS 0x01000000
-#define SiS_STENCIL_EQUAL 0x02000000
-#define SiS_STENCIL_LEQUAL 0x03000000
-#define SiS_STENCIL_GREATER 0x04000000
-#define SiS_STENCIL_NOTEQUAL 0x05000000
-#define SiS_STENCIL_GEQUAL 0x06000000
-#define SiS_STENCIL_ALWAYS 0x07000000
-
-#define STENCIL_FORMAT_1 0x00000000
-#define STENCIL_FORMAT_2 0x10000000
-#define STENCIL_FORMAT_4 0x20000000
-#define STENCIL_FORMAT_8 0x30000000
-
-/*
- * REG_3D_StencilSet2 -- Define stencil test (8A4h-8A47h)
- */
-#define MASK_StencilBufferPitch 0x00000FFF
-#define MASK_StencilZPassOp 0x00007000
-#define MASK_StencilZFailOp 0x00070000
-#define MASK_StencilFailOp 0x00700000
-#define MASK_StencilWriteMask 0xFF000000
-
-#define SiS_SFAIL_KEEP 0x00000000
-#define SiS_SFAIL_ZERO 0x00100000
-#define SiS_SFAIL_REPLACE 0x00200000
-#define SiS_SFAIL_INVERT 0x00500000
-#define SiS_SFAIL_INCR 0x00600000
-#define SiS_SFAIL_DECR 0x00700000
-
-#define SiS_SPASS_ZFAIL_KEEP 0x00000000
-#define SiS_SPASS_ZFAIL_ZERO 0x00010000
-#define SiS_SPASS_ZFAIL_REPLACE 0x00020000
-#define SiS_SPASS_ZFAIL_INVERT 0x00050000
-#define SiS_SPASS_ZFAIL_INCR 0x00060000
-#define SiS_SPASS_ZFAIL_DECR 0x00070000
-
-#define SiS_SPASS_ZPASS_KEEP 0x00000000
-#define SiS_SPASS_ZPASS_ZERO 0x00001000
-#define SiS_SPASS_ZPASS_REPLACE 0x00002000
-#define SiS_SPASS_ZPASS_INVERT 0x00005000
-#define SiS_SPASS_ZPASS_INCR 0x00006000
-#define SiS_SPASS_ZPASS_DECR 0x00007000
-
-/*
- * REG_3D_DstBlendMode (0x8A50 - 0x8A53)
- */
-#define MASK_SrcBlendMode 0x0000000F
-#define MASK_DstBlendMode 0x000000F0
-
-#define SiS_D_ZERO 0x00000000
-#define SiS_D_ONE 0x00000010
-#define SiS_D_SRC_COLOR 0x00000020
-#define SiS_D_ONE_MINUS_SRC_COLOR 0x00000030
-#define SiS_D_SRC_ALPHA 0x00000040
-#define SiS_D_ONE_MINUS_SRC_ALPHA 0x00000050
-#define SiS_D_DST_ALPHA 0x00000060
-#define SiS_D_ONE_MINUS_DST_ALPHA 0x00000070
-#define SiS_D_DST_COLOR 0x00000080
-#define SiS_D_ONE_MINUS_DST_COLOR 0x00000090
-#define SiS_D_SRC_ALPHA_SAT 0x000000a0
-
-#define SiS_S_ZERO 0x00000000
-#define SiS_S_ONE 0x00000001
-#define SiS_S_SRC_COLOR 0x00000002
-#define SiS_S_ONE_MINUS_SRC_COLOR 0x00000003
-#define SiS_S_SRC_ALPHA 0x00000004
-#define SiS_S_ONE_MINUS_SRC_ALPHA 0x00000005
-#define SiS_S_DST_ALPHA 0x00000006
-#define SiS_S_ONE_MINUS_DST_ALPHA 0x00000007
-#define SiS_S_DST_COLOR 0x00000008
-#define SiS_S_ONE_MINUS_DST_COLOR 0x00000009
-#define SiS_S_SRC_ALPHA_SATURATE 0x0000000a
-#define SiS_S_BOTH_SRC_ALPHA 0x0000000b
-#define SiS_S_BOTH_ONE_MINUS_SRC_ALPHA 0x0000000c
-
-/*
- * REG_3D_ClipTopBottom (0x8A54 - 0x8A57)
- */
-#define MASK_BottomClip 0x00001FFF
-#define MASK_TopClip 0x03FFE000
-
-/*
- * REG_3D_ClipLeftRight (0x8A58 - 0x8A5B)
- */
-#define MASK_RightClip 0x00001FFF
-#define MASK_LeftClip 0x03FFE000
-
-/*
- * REG_3D_TextureSet (0x8A7C - 0x8A7F)
- * REG_3D_Texture1Set (0x8ADC - 0x8ADF)
- */
-#define MASK_TextureHeight 0x0000000F
-#define MASK_TextureWidth 0x000000F0
-#define MASK_TextureLevel 0x00000F00
-#define MASK_TextureSignYUVFormat 0x00001000
-#define MASK_TextureMappingMode 0x00FF0000
-#define MASK_TextureWrapU 0x00010000
-#define MASK_TextureWrapV 0x00020000
-#define MASK_TextureMirrorU 0x00040000
-#define MASK_TextureMirrorV 0x00080000
-#define MASK_TextureClampU 0x00100000
-#define MASK_TextureClampV 0x00200000
-#define MASK_TextureBorderU 0x00400000
-#define MASK_TextureBorderV 0x00800000
-#define MASK_TextureFormat 0xFF000000
-#define MASK_TextureBitDepth 0x70000000
-#define MASK_TextureRgbOrder 0x80000000
-
-#define TEXEL_INDEX1 0x00000000
-#define TEXEL_INDEX2 0x01000000
-#define TEXEL_INDEX4 0x02000000
-#define TEXEL_INDEX8 0x03000000
-
-#define TEXEL_INDEX1WithAlpha 0x04000000
-#define TEXEL_INDEX2WithAlpha 0x05000000
-#define TEXEL_INDEX4WithAlpha 0x06000000
-#define TEXEL_INDEX8WithAlpha 0x07000000
-
-#define TEXEL_I1 0x10000000
-#define TEXEL_I2 0x11000000
-#define TEXEL_I4 0x12000000
-#define TEXEL_I8 0x13000000
-
-#define TEXEL_DXT1 0x19000000
-#define TEXEL_DXT2 0x1A000000
-#define TEXEL_DXT3 0x1B000000
-
-#define TEXEL_YUV422 0x20000000
-#define TEXEL_YVU422 0x21000000
-#define TEXEL_UVY422 0x22000000
-#define TEXEL_VUY422 0x23000000
-#define TEXEL_YUV411 0x24000000
-
-#define TEXEL_L1 0x30000000
-#define TEXEL_L2 0x31000000
-#define TEXEL_L4 0x32000000
-#define TEXEL_L8 0x33000000
-
-#define TEXEL_AL11 0x34000000
-#define TEXEL_AL44 0x35000000
-#define TEXEL_AL26 0x37000000
-#define TEXEL_AL88 0x38000000
-
-#define TEXEL_A1 0x40000000
-#define TEXEL_A2 0x41000000
-#define TEXEL_A4 0x42000000
-#define TEXEL_A8 0x43000000
-
-#define TEXEL_RGB_332_8 0x50000000
-#define TEXEL_RGB_233_8 0x51000000
-#define TEXEL_RGB_232_8 0x52000000
-#define TEXEL_ARGB_1232_8 0x53000000
-#define TEXEL_ARGB_2222_8 0x54000000
-
-#define TEXEL_RGB_555_16 0x60000000
-#define TEXEL_RGB_565_16 0x61000000
-#define TEXEL_ARGB_1555_16 0x62000000
-#define TEXEL_ARGB_4444_16 0x63000000
-
-#define TEXEL_ARGB_1888_32 0x70000000
-#define TEXEL_ARGB_2888_32 0x71000000
-#define TEXEL_ARGB_4888_32 0x72000000
-#define TEXEL_ARGB_8888_32 0x73000000
-#define TEXEL_ARGB_0888_32 0x74000000
-
-#define TEXEL_BGR_332_8 0xD0000000
-#define TEXEL_BGR_233_8 0xD1000000
-#define TEXEL_BGR_232_8 0xD2000000
-#define TEXEL_ABGR_1232_8 0xD3000000
-#define TEXEL_ABGR_2222_8 0xD4000000
-
-#define TEXEL_BGR_555_16 0xE0000000
-#define TEXEL_BGR_565_16 0xE1000000
-#define TEXEL_ABGR_1555_16 0xE2000000
-#define TEXEL_ABGR_4444_16 0xE3000000
-
-#define TEXEL_ABGR_1888_32 0xF0000000
-#define TEXEL_ABGR_2888_32 0xF1000000
-#define TEXEL_ABGR_4888_32 0xF2000000
-#define TEXEL_ABGR_8888_32 0xF3000000
-#define TEXEL_ABGR_0888_32 0xF4000000
-
-#define TEXEL_VU88 0x00000000
-#define TEXEL_LVU655 0x00800000
-#define TEXEL_LVU888 0x01000000
-#define TEXEL_UV88 0x02000000
-#define TEXEL_LUV655 0x02800000
-#define TEXEL_LUV888 0x03000000
-
-/*
- * REG_3D_TextureMip (0x8A80 - 0x8A83)
- * REG_3D_Texture1Mip (0x8AE0 - 0x8AE3)
- */
-#define MASK_TextureAnisotropyRatio 0x0000000F
-#define MASK_TextureMipmapLodBias 0x00003FF0
-#define MASK_TextureFilterMin 0x0001C000
-#define MASK_TextureFilterMag 0x00020000
-#define MASK_TextureFilter 0x0003C000
-#define MASK_TextureLevelInSystem 0x3FFC0000
-#define MASK_TextureLevel0InSystem 0x00040000
-#define MASK_TextureBlockLength 0xF0000000
-
-#define TEXTURE_FILTER_NEAREST 0x00000000
-#define TEXTURE_FILTER_LINEAR 0x00004000
-#define TEXTURE_FILTER_NEAREST_MIP_NEAREST 0x00008000
-#define TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x00010000
-#define TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x0000c000
-#define TEXTURE_FILTER_LINEAR_MIP_LINEAR 0x00014000
-
-/*
- * REG_3D_TextureTransparencyColorHigh (0x8A84 - 0x8A87)
- * REG_3D_Texture1TransparencyColorHigh (0x8AE4 - 0x8AE7)
- */
-#define MASK_TextureTransparencyColorHighB 0x000000FF
-#define MASK_TextureTransparencyColorHighG 0x0000FF00
-#define MASK_TextureTransparencyColorHighR 0x00FF0000
-#define MASK_TextureAlphaTransparencyMode 0x08000000
-
-/*
- * REG_3D_TextureTransparencyColorLow (0x8A88 - 0x8A8B)
- * REG_3D_Texture1TransparencyColorLow (0x8AE8 - 0x8AEB)
- */
-#define MASK_TextureTransparencyColorLowB 0x000000FF
-#define MASK_TextureTransparencyColorLowG 0x0000FF00
-#define MASK_TextureTransparencyColorLowR 0x00FF0000
-#define MASK_TextureBlockHeight 0x07000000
-#define MASK_TextureBlockWidth 0x70000000
-
-/*
- * REG_3D_TextureTransparencyColorLow (0x8A8C - 0x8A8F)
- * REG_3D_Texture1TransparencyColorLow (0x8AEC - 0x8AEF)
- */
-#define MASK_TextureBorderColorB 0x000000FF
-#define MASK_TextureBorderColorG 0x0000FF00
-#define MASK_TextureBorderColorR 0x00FF0000
-#define MASK_TextureBorderColorA 0xFF000000
-
-/*
- * REG_3D_TexturePitch0-10 (0x8AC0 - 0x8AD7)
- * REG_3D_Texture1Pitch0-10 (0x8B20 - 0x8B37)
- */
-#define MASK_TexturePitchOdd 0x000003FF
-#define MASK_TexturePitchEven 0x03FF0000
-#define SHIFT_TexturePitchEven 16
-
-/*
- * REG_3D_TextureColorBlendSet0 (0x8B40 - 0x8B43)
- * REG_3D_TextureColorBlendSet1 (0x8B44 - 0x8B46)
- * REG_3D_TextureAlphaBlendSet0 (0x8B40 - 0x8B43)
- * REG_3D_TextureAlphaBlendSet1 (0x8B44 - 0x8B46)
- */
-#define STAGE0_C_CF 0xa1485000
-#define STAGE0_C_CS 0xc1485000
-#define STAGE0_C_CFCS 0xa1705000
-#define STAGE0_C_CFOMAS_CSAS 0xc534c001
-#define STAGE0_C_CFOMCS_CCCS 0x4530c001
-
-#define STAGE0_A_AF 0x63230000
-#define STAGE0_A_AS 0xc3230000
-#define STAGE0_A_AFAS 0x63c30000
-#define STAGE0_A_AFOMAS_ACAS 0x46c60001
-
-#define STAGE1_C_CF 0xa1485000
-#define STAGE1_C_CS 0xe1485000
-#define STAGE1_C_CFCS 0xa1785000
-#define STAGE1_C_CFOMAS_CSAS 0xe5394001
-#define STAGE1_C_CFOMCS_CCCS 0x45394001
-
-#define STAGE1_A_AF 0xa3230000
-#define STAGE1_A_AS 0xe3230000
-#define STAGE1_A_AFAS 0xa3e30000
-#define STAGE1_A_AFOMAS_ACAS 0x4aea0001
-
-/* What registers are these associated with? */
-#define MASK_BMMemoryInSystem 0x00000080
-#define MASK_BMHeight 0x00000F00
-#define MASK_BMWidth 0x0000F000
-#define MASK_BMFilter 0x00010000
-#define MASK_BMMappingMode 0x007E0000
-#define MASK_BMFormat 0x07800000
-#define MASK_BMTxBumpmap 0x08000000
-
-#define MASK_BMAddress 0xFFFFFFFC
-
-#define MASK_BMOffset 0xFF800000
-#define MASK_BMScale 0x007FE000
-#define MASK_BMPitch 0x00001FFF
-
-#define MASK_BMMatrix00 0x000007FF
-#define MASK_BMMatrix01 0x07FF0000
-#define MASK_BMMatrix10 0x000007FF
-#define MASK_BMMatrix11 0x07FF0000
-
-#define MASK_TextureRealInSystem 0x00000001
-#define MASK_TextureDowngrade 0x00000002
-
-#define ALPHA_BUFFER_FORMAT_1 0x00000000
-#define ALPHA_BUFFER_FORMAT_2 0x10000000
-#define ALPHA_BUFFER_FORMAT_4 0x20000000
-#define ALPHA_BUFFER_FORMAT_8 0x30000000
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.c
deleted file mode 100644
index cc6afda1f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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 <anholt@FreeBSD.org>
- */
-
-#include "dri_util.h"
-
-#include "context.h"
-#include "utils.h"
-#include "imports.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-
-#include "sis_context.h"
-#include "sis_dri.h"
-#include "sis_lock.h"
-#include "sis_span.h"
-
-#include "xmlpool.h"
-
-#include "GL/internal/dri_interface.h"
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_OPT_BEGIN(agp_disable,bool,false)
- DRI_CONF_DESC(en,"Disable AGP vertex dispatch")
- DRI_CONF_OPT_END
- DRI_CONF_OPT_BEGIN(fallback_force,bool,false)
- DRI_CONF_DESC(en,"Force software fallback")
- DRI_CONF_OPT_END
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 2;
-
-extern const struct dri_extension card_extensions[];
-
-static __GLcontextModes *
-sisFillInModes(int bpp)
-{
- __GLcontextModes *modes;
- __GLcontextModes *m;
- unsigned num_modes;
- unsigned depth_buffer_factor;
- unsigned back_buffer_factor;
- GLenum fb_format;
- GLenum fb_type;
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML
- };
- u_int8_t depth_bits_array[4];
- u_int8_t stencil_bits_array[4];
-
- depth_bits_array[0] = 0;
- stencil_bits_array[0] = 0;
- depth_bits_array[1] = 16;
- stencil_bits_array[1] = 0;
- depth_bits_array[2] = 24;
- stencil_bits_array[2] = 8;
- depth_bits_array[3] = 32;
- stencil_bits_array[3] = 0;
-
- depth_buffer_factor = 4;
- back_buffer_factor = 2;
-
- /* Last 4 is for GLX_TRUE_COLOR & GLX_DIRECT_COLOR, with/without accum */
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
- if (bpp == 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;
- }
-
- modes = (*dri_interface->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;
- }
-
- return modes;
-}
-
-
-/* Create the device specific screen private data struct.
- */
-static sisScreenPtr
-sisCreateScreen( __DRIscreenPrivate *sPriv )
-{
- sisScreenPtr sisScreen;
- SISDRIPtr sisDRIPriv = (SISDRIPtr)sPriv->pDevPriv;
-
- if (sPriv->devPrivSize != sizeof(SISDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(SISDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- sisScreen = (sisScreenPtr)CALLOC( sizeof(*sisScreen) );
- if ( sisScreen == NULL )
- return NULL;
-
- sisScreen->screenX = sisDRIPriv->width;
- sisScreen->screenY = sisDRIPriv->height;
- sisScreen->cpp = sisDRIPriv->bytesPerPixel;
- sisScreen->irqEnabled = sisDRIPriv->bytesPerPixel;
- sisScreen->deviceID = sisDRIPriv->deviceID;
- sisScreen->AGPCmdBufOffset = sisDRIPriv->AGPCmdBufOffset;
- sisScreen->AGPCmdBufSize = sisDRIPriv->AGPCmdBufSize;
- sisScreen->sarea_priv_offset = sizeof(drm_sarea_t);
-
- sisScreen->mmio.handle = sisDRIPriv->regs.handle;
- sisScreen->mmio.size = sisDRIPriv->regs.size;
- if ( drmMap( sPriv->fd, sisScreen->mmio.handle, sisScreen->mmio.size,
- &sisScreen->mmio.map ) )
- {
- FREE( sisScreen );
- return NULL;
- }
-
- if (sisDRIPriv->agp.size) {
- sisScreen->agp.handle = sisDRIPriv->agp.handle;
- sisScreen->agp.size = sisDRIPriv->agp.size;
- if ( drmMap( sPriv->fd, sisScreen->agp.handle, sisScreen->agp.size,
- &sisScreen->agp.map ) )
- {
- sisScreen->agp.size = 0;
- }
- }
-
- sisScreen->driScreen = sPriv;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo(&sisScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- return sisScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-static void
-sisDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- sisScreenPtr sisScreen = (sisScreenPtr)sPriv->private;
-
- if ( sisScreen == NULL )
- return;
-
- if (sisScreen->agp.size != 0)
- drmUnmap( sisScreen->agp.map, sisScreen->agp.size );
- drmUnmap( sisScreen->mmio.map, sisScreen->mmio.size );
-
- FREE( sisScreen );
- sPriv->private = NULL;
-}
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private;
- struct gl_framebuffer *fb;
-
- if (isPixmap)
- return GL_FALSE; /* not implemented */
-
-#if 0
- driDrawPriv->driverPrivate = (void *)_mesa_create_framebuffer(
- mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 ); /* XXX */
-#else
- fb = _mesa_create_framebuffer(mesaVis);
-
- /* XXX double-check the Offset/Pitch parameters! */
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- 0, driScrnPriv->fbStride);
- sisSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- 0, driScrnPriv->fbStride);
- sisSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- 0, driScrnPriv->fbStride);
- sisSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- 0, driScrnPriv->fbStride);
- sisSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 32) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
- 0, driScrnPriv->fbStride);
- sisSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- /* no h/w stencil?
- if (mesaVis->stencilBits > 0) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
- sisSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
- */
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
-
- return (driDrawPriv->driverPrivate != NULL);
-}
-
-
-static void
-sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-__inline__ static void
-sis_bitblt_copy_cmd (sisContextPtr smesa, ENGPACKET * pkt)
-{
- GLint *lpdwDest, *lpdwSrc;
- int i;
-
- lpdwSrc = (GLint *) pkt;
- lpdwDest = (GLint *) (GET_IOBase (smesa) + REG_SRC_ADDR);
-
- mWait3DCmdQueue (10);
-
- for (i = 0; i < 7; i++)
- *lpdwDest++ = *lpdwSrc++;
-
- MMIO(REG_CMD0, *(GLint *)&pkt->stdwCmd);
- MMIO(REG_CommandQueue, -1);
-}
-
-static void sisCopyBuffer( __DRIdrawablePrivate *dPriv )
-{
- sisContextPtr smesa = (sisContextPtr)dPriv->driContextPriv->driverPrivate;
- int i;
- ENGPACKET stEngPacket;
-
- memset(&stEngPacket, 0, sizeof(ENGPACKET));
-
- while ((*smesa->FrameCountPtr) - MMIO_READ(0x8a2c) > SIS_MAX_FRAME_LENGTH)
- ;
-
- LOCK_HARDWARE();
-
- stEngPacket.dwSrcBaseAddr = smesa->backOffset;
- stEngPacket.dwSrcPitch = smesa->backPitch |
- ((smesa->bytesPerPixel == 2) ? 0x80000000 : 0xc0000000);
- stEngPacket.dwDestBaseAddr = 0;
- stEngPacket.wDestPitch = smesa->frontPitch;
- /* TODO: set maximum value? */
- stEngPacket.wDestHeight = smesa->virtualY;
-
- stEngPacket.stdwCmd.cRop = 0xcc;
-
- if (smesa->blockWrite)
- stEngPacket.stdwCmd.cCmd0 = CMD0_PAT_FG_COLOR;
- else
- stEngPacket.stdwCmd.cCmd0 = 0;
- stEngPacket.stdwCmd.cCmd1 = CMD1_DIR_X_INC | CMD1_DIR_Y_INC;
-
- for (i = 0; i < dPriv->numClipRects; i++) {
- drm_clip_rect_t *box = &dPriv->pClipRects[i];
- stEngPacket.stdwSrcPos.wY = box->y1 - dPriv->y;
- stEngPacket.stdwSrcPos.wX = box->x1 - dPriv->x;
- stEngPacket.stdwDestPos.wY = box->y1;
- stEngPacket.stdwDestPos.wX = box->x1;
-
- stEngPacket.stdwDim.wWidth = (GLshort) box->x2 - box->x1;
- stEngPacket.stdwDim.wHeight = (GLshort) box->y2 - box->y1;
- sis_bitblt_copy_cmd( smesa, &stEngPacket );
- }
-
- *(GLint *)(smesa->IOBase+0x8a2c) = *smesa->FrameCountPtr;
- (*smesa->FrameCountPtr)++;
-
- UNLOCK_HARDWARE ();
-}
-
-
-/* Copy the back color buffer to the front color buffer */
-static void
-sisSwapBuffers(__DRIdrawablePrivate *dPriv)
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- sisContextPtr smesa = (sisContextPtr) dPriv->driContextPriv->driverPrivate;
- GLcontext *ctx = smesa->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- sisCopyBuffer( dPriv );
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
- }
-}
-
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-sisInitDriver( __DRIscreenPrivate *sPriv )
-{
- sPriv->private = (void *) sisCreateScreen( sPriv );
-
- if ( !sPriv->private ) {
- sisDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec sisAPI = {
- .InitDriver = sisInitDriver,
- .DestroyScreen = sisDestroyScreen,
- .CreateContext = sisCreateContext,
- .DestroyContext = sisDestroyContext,
- .CreateBuffer = sisCreateBuffer,
- .DestroyBuffer = sisDestroyBuffer,
- .SwapBuffers = sisSwapBuffers,
- .MakeCurrent = sisMakeCurrent,
- .UnbindContext = sisUnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-
-};
-
-
-/**
- * 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes **driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = {0, 8, 0};
- static const __DRIversion dri_expected = {4, 0, 0};
- static const __DRIversion drm_expected = {1, 0, 0};
-
- dri_interface = interface;
-
- if (!driCheckDriDdxDrmVersions2("SiS", 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, &sisAPI);
- if (psp != NULL) {
- SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv;
- *driver_modes = sisFillInModes(dri_priv->bytesPerPixel * 8);
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *)psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.h
deleted file mode 100644
index 068c0410d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_screen.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_SCREEN_H
-#define __SIS_SCREEN_H
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- drmAddress map; /* Mapping of the DRM region */
-} sisRegionRec2, *sisRegionPtr2;
-
-typedef struct {
- sisRegionRec2 mmio;
- sisRegionRec2 agp;
-
- unsigned int AGPCmdBufOffset;
- unsigned int AGPCmdBufSize;
-
- int deviceID;
- int irqEnabled;
-
- int cpp;
- unsigned int screenX, screenY;
-
- __DRIscreenPrivate *driScreen;
- unsigned int sarea_priv_offset;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-
-} sisScreenRec, *sisScreenPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.c
deleted file mode 100644
index f0cf771d6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_span.c,v 1.5 2001/03/21 16:14:26 dawes Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_span.h"
-#include "sis_lock.h"
-#include "sis_tris.h"
-
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define LOCAL_VARS \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = smesa->driDrawable; \
- GLuint pitch = smesa->drawPitch; \
- char *buf = (char *)(smesa->FbBase + smesa->drawOffset); \
- char *read_buf = (char *)(smesa->FbBase + smesa->readOffset); \
- GLuint p; \
- (void) read_buf; (void) buf; (void) p
-
-#define LOCAL_DEPTH_VARS \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = smesa->driDrawable; \
- char *buf = smesa->depthbuffer; \
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-#define HW_LOCK() do {} while(0);
-
-#define HW_UNLOCK() do {} while(0);
-
-/* RGB565 */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) sis##x##_RGB565
-#define TAG2(x,y) sis##x##_RGB565##y
-#include "spantmp2.h"
-
-
-/* ARGB8888 */
-/* FIXME the old code always read back alpha as 0xff, i.e. fully opaque.
- Was there a reason to do so ? If so that'll won't work with that template... */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) sis##x##_ARGB8888
-#define TAG2(x,y) sis##x##_ARGB8888##y
-#include "spantmp2.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + (_x)*2 + (_y)*smesa->depthPitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + (_x)*2 + (_y)*smesa->depthPitch);
-
-#define TAG(x) sis##x##_16
-#include "depthtmp.h"
-
-
-/* 32 bit depthbuffer functions.
- */
-#define WRITE_DEPTH( _x, _y, d ) \
- *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch);
-
-#define TAG(x) sis##x##_32
-#include "depthtmp.h"
-
-
-/* 8/24 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch); \
- tmp &= 0xff000000; \
- tmp |= (d & 0x00ffffff); \
- *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) { \
- d = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0x00ffffff; \
-}
-
-#define TAG(x) sis##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch); \
- tmp &= 0x00ffffff; \
- tmp |= (d << 24); \
- *(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = (*(GLuint *)(buf + (_x)*4 + (_y)*smesa->depthPitch) & 0xff000000) >> 24;
-
-#define TAG(x) sis##x##_24_8
-#include "stenciltmp.h"
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void sisDDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- smesa->drawOffset = smesa->readOffset = smesa->frontOffset;
- smesa->drawPitch = smesa->readPitch = smesa->frontPitch;
- break;
- case BUFFER_BIT_BACK_LEFT:
- smesa->drawOffset = smesa->readOffset = smesa->backOffset;
- smesa->drawPitch = smesa->readPitch = smesa->backPitch;
- break;
- default:
- break;
- }
-}
-
-void sisSpanRenderStart( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- SIS_FIREVERTICES(smesa);
- LOCK_HARDWARE();
- WaitEngIdle( smesa );
-}
-
-void sisSpanRenderFinish( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- _swrast_flush( ctx );
- UNLOCK_HARDWARE();
-}
-
-void
-sisDDInitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = sisDDSetBuffer;
- swdd->SpanRenderStart = sisSpanRenderStart;
- swdd->SpanRenderFinish = sisSpanRenderFinish;
-}
-
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-sisSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- sisInitPointers_RGB565( &drb->Base );
- }
- else {
- sisInitPointers_ARGB8888( &drb->Base );
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = sisReadDepthSpan_16;
- drb->Base.GetValues = sisReadDepthPixels_16;
- drb->Base.PutRow = sisWriteDepthSpan_16;
- drb->Base.PutMonoRow = sisWriteMonoDepthSpan_16;
- drb->Base.PutValues = sisWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = sisReadDepthSpan_24_8;
- drb->Base.GetValues = sisReadDepthPixels_24_8;
- drb->Base.PutRow = sisWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = sisWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = sisWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
- drb->Base.GetRow = sisReadDepthSpan_32;
- drb->Base.GetValues = sisReadDepthPixels_32;
- drb->Base.PutRow = sisWriteDepthSpan_32;
- drb->Base.PutMonoRow = sisWriteMonoDepthSpan_32;
- drb->Base.PutValues = sisWriteDepthPixels_32;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = sisReadStencilSpan_24_8;
- drb->Base.GetValues = sisReadStencilPixels_24_8;
- drb->Base.PutRow = sisWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = sisWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = sisWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.h
deleted file mode 100644
index 7c73bc6d3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_span.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_SPAN_H__
-#define __SIS_SPAN_H__
-
-#include "drirenderbuffer.h"
-
-
-extern void sisSpanRenderStart( GLcontext *ctx );
-extern void sisSpanRenderFinish( GLcontext *ctx );
-
-extern void sisDDInitSpanFuncs( GLcontext *ctx );
-
-extern void
-sisSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.c
deleted file mode 100644
index db58e9090..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.c
+++ /dev/null
@@ -1,853 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_ctx.c,v 1.3 2000/09/26 15:56:48 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_tris.h"
-#include "sis_lock.h"
-#include "sis_tex.h"
-
-#include "context.h"
-#include "buffers.h"
-#include "enums.h"
-#include "colormac.h"
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-/* =============================================================
- * Alpha blending
- */
-
-static void
-sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- GLubyte refbyte;
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- CLAMPED_FLOAT_TO_UBYTE(refbyte, ref);
- current->hwAlpha = refbyte << 16;
-
- /* Alpha Test function */
- switch (func)
- {
- case GL_NEVER:
- current->hwAlpha |= SiS_ALPHA_NEVER;
- break;
- case GL_LESS:
- current->hwAlpha |= SiS_ALPHA_LESS;
- break;
- case GL_EQUAL:
- current->hwAlpha |= SiS_ALPHA_EQUAL;
- break;
- case GL_LEQUAL:
- current->hwAlpha |= SiS_ALPHA_LEQUAL;
- break;
- case GL_GREATER:
- current->hwAlpha |= SiS_ALPHA_GREATER;
- break;
- case GL_NOTEQUAL:
- current->hwAlpha |= SiS_ALPHA_NOTEQUAL;
- break;
- case GL_GEQUAL:
- current->hwAlpha |= SiS_ALPHA_GEQUAL;
- break;
- case GL_ALWAYS:
- current->hwAlpha |= SiS_ALPHA_ALWAYS;
- break;
- }
-
- prev->hwAlpha = current->hwAlpha;
- smesa->GlobalFlag |= GFLAG_ALPHASETTING;
-}
-
-static void
-sisDDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- current->hwDstSrcBlend = 0;
-
- switch (dfactorRGB)
- {
- case GL_ZERO:
- current->hwDstSrcBlend |= SiS_D_ZERO;
- break;
- case GL_ONE:
- current->hwDstSrcBlend |= SiS_D_ONE;
- break;
- case GL_SRC_COLOR:
- current->hwDstSrcBlend |= SiS_D_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- current->hwDstSrcBlend |= SiS_D_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_D_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_D_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_COLOR:
- current->hwDstSrcBlend |= SiS_D_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- current->hwDstSrcBlend |= SiS_D_ONE_MINUS_DST_COLOR;
- break;
- case GL_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_D_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_D_ONE_MINUS_DST_ALPHA;
- break;
- default:
- fprintf(stderr, "Unknown dst blend function 0x%x\n", dfactorRGB);
- break;
- }
-
- switch (sfactorRGB)
- {
- case GL_ZERO:
- current->hwDstSrcBlend |= SiS_S_ZERO;
- break;
- case GL_ONE:
- current->hwDstSrcBlend |= SiS_S_ONE;
- break;
- case GL_SRC_COLOR:
- current->hwDstSrcBlend |= SiS_S_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- current->hwDstSrcBlend |= SiS_S_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_S_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- current->hwDstSrcBlend |= SiS_S_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_COLOR:
- current->hwDstSrcBlend |= SiS_S_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_COLOR;
- break;
- case GL_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_S_DST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_ALPHA;
- break;
- case GL_SRC_ALPHA_SATURATE:
- current->hwDstSrcBlend |= SiS_S_SRC_ALPHA_SATURATE;
- break;
- default:
- fprintf(stderr, "Unknown src blend function 0x%x\n", sfactorRGB);
- break;
- }
-
- if (current->hwDstSrcBlend != prev->hwDstSrcBlend) {
- prev->hwDstSrcBlend = current->hwDstSrcBlend;
- smesa->GlobalFlag |= GFLAG_DSTBLEND;
- }
-}
-
-/* =============================================================
- * Depth testing
- */
-
-static void
-sisDDDepthFunc( GLcontext * ctx, GLenum func )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- current->hwZ &= ~MASK_ZTestMode;
- switch (func)
- {
- case GL_LESS:
- current->hwZ |= SiS_Z_COMP_S_LT_B;
- break;
- case GL_GEQUAL:
- current->hwZ |= SiS_Z_COMP_S_GE_B;
- break;
- case GL_LEQUAL:
- current->hwZ |= SiS_Z_COMP_S_LE_B;
- break;
- case GL_GREATER:
- current->hwZ |= SiS_Z_COMP_S_GT_B;
- break;
- case GL_NOTEQUAL:
- current->hwZ |= SiS_Z_COMP_S_NE_B;
- break;
- case GL_EQUAL:
- current->hwZ |= SiS_Z_COMP_S_EQ_B;
- break;
- case GL_ALWAYS:
- current->hwZ |= SiS_Z_COMP_ALWAYS;
- break;
- case GL_NEVER:
- current->hwZ |= SiS_Z_COMP_NEVER;
- break;
- }
-
- if (current->hwZ != prev->hwZ) {
- prev->hwZ = current->hwZ;
- smesa->GlobalFlag |= GFLAG_ZSETTING;
- }
-}
-
-void
-sisDDDepthMask( GLcontext * ctx, GLboolean flag )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (!ctx->Depth.Test)
- flag = GL_FALSE;
-
- if (ctx->Visual.stencilBits) {
- if (flag || (ctx->Stencil.WriteMask[0] != 0)) {
- current->hwCapEnable |= MASK_ZWriteEnable;
- if (flag && (ctx->Stencil.WriteMask[0] == 0xff)) {
- current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable;
- } else {
- current->hwCapEnable2 |= MASK_ZMaskWriteEnable;
- current->hwZMask = (ctx->Stencil.WriteMask[0] << 24) |
- ((flag) ? 0x00ffffff : 0);
-
- if (current->hwZMask ^ prev->hwZMask) {
- prev->hwZMask = current->hwZMask;
- smesa->GlobalFlag |= GFLAG_ZSETTING;
- }
- }
- } else {
- current->hwCapEnable &= ~MASK_ZWriteEnable;
- }
- } else {
- if (flag) {
- current->hwCapEnable |= MASK_ZWriteEnable;
- current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable;
- } else {
- current->hwCapEnable &= ~MASK_ZWriteEnable;
- }
- }
-}
-
-/* =============================================================
- * Clipping
- */
-
-void
-sisUpdateClipping( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- GLint x1, y1, x2, y2;
-
- x1 = 0;
- y1 = 0;
- x2 = smesa->width - 1;
- y2 = smesa->height - 1;
-
- if (ctx->Scissor.Enabled) {
- if (ctx->Scissor.X > x1)
- x1 = ctx->Scissor.X;
- if (ctx->Scissor.Y > y1)
- y1 = ctx->Scissor.Y;
- if (ctx->Scissor.X + ctx->Scissor.Width - 1 < x2)
- x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
- if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < y2)
- y2 = ctx->Scissor.Y + ctx->Scissor.Height - 1;
- }
-
- y1 = Y_FLIP(y1);
- y2 = Y_FLIP(y2);
-
- current->clipTopBottom = (y2 << 13) | y1;
- current->clipLeftRight = (x1 << 13) | x2;
-
- if ((current->clipTopBottom ^ prev->clipTopBottom) ||
- (current->clipLeftRight ^ prev->clipLeftRight))
- {
- prev->clipTopBottom = current->clipTopBottom;
- prev->clipLeftRight = current->clipLeftRight;
- smesa->GlobalFlag |= GFLAG_CLIPPING;
- }
-}
-
-static void
-sisDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
-{
- if (ctx->Scissor.Enabled)
- sisUpdateClipping( ctx );
-}
-
-/* =============================================================
- * Culling
- */
-
-static void
-sisUpdateCull( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- GLint cullflag, frontface;
-
- cullflag = ctx->Polygon.CullFaceMode;
- frontface = ctx->Polygon.FrontFace;
-
- smesa->AGPParseSet &= ~(MASK_PsCullDirection_CCW);
- smesa->dwPrimitiveSet &= ~(MASK_CullDirection);
-
- if((cullflag == GL_FRONT && frontface == GL_CCW) ||
- (cullflag == GL_BACK && frontface == GL_CW))
- {
- smesa->AGPParseSet |= MASK_PsCullDirection_CCW;
- smesa->dwPrimitiveSet |= OP_3D_CullDirection_CCW;
- }
-}
-
-
-static void
-sisDDCullFace( GLcontext *ctx, GLenum mode )
-{
- sisUpdateCull( ctx );
-}
-
-static void
-sisDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- sisUpdateCull( ctx );
-}
-
-/* =============================================================
- * Masks
- */
-
-static void sisDDColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (r && g && b && ((ctx->Visual.alphaBits == 0) || a)) {
- current->hwCapEnable2 &= ~(MASK_AlphaMaskWriteEnable |
- MASK_ColorMaskWriteEnable);
- } else {
- current->hwCapEnable2 |= (MASK_AlphaMaskWriteEnable |
- MASK_ColorMaskWriteEnable);
-
- current->hwDstMask = (r) ? smesa->redMask : 0 |
- (g) ? smesa->greenMask : 0 |
- (b) ? smesa->blueMask : 0 |
- (a) ? smesa->alphaMask : 0;
- }
-
- if (current->hwDstMask != prev->hwDstMask) {
- prev->hwDstMask = current->hwDstMask;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-}
-
-/* =============================================================
- * Rendering attributes
- */
-
-static void sisDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- /* Signal to sisRasterPrimitive to recalculate dwPrimitiveSet */
- smesa->hw_primitive = -1;
-}
-
-/* =============================================================
- * Window position
- */
-
-/* =============================================================
- * Viewport
- */
-
-static void sisCalcViewport( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = smesa->hw_viewport;
-
- /* See also sis_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + smesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * smesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale;
-}
-
-static void sisDDViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- sisCalcViewport( ctx );
-}
-
-static void sisDDDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- sisCalcViewport( ctx );
-}
-
-/* =============================================================
- * Miscellaneous
- */
-
-static void
-sisDDLogicOpCode( GLcontext *ctx, GLenum opcode )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- current->hwDstSet &= ~MASK_ROP2;
- switch (opcode)
- {
- case GL_CLEAR:
- current->hwDstSet |= LOP_CLEAR;
- break;
- case GL_SET:
- current->hwDstSet |= LOP_SET;
- break;
- case GL_COPY:
- current->hwDstSet |= LOP_COPY;
- break;
- case GL_COPY_INVERTED:
- current->hwDstSet |= LOP_COPY_INVERTED;
- break;
- case GL_NOOP:
- current->hwDstSet |= LOP_NOOP;
- break;
- case GL_INVERT:
- current->hwDstSet |= LOP_INVERT;
- break;
- case GL_AND:
- current->hwDstSet |= LOP_AND;
- break;
- case GL_NAND:
- current->hwDstSet |= LOP_NAND;
- break;
- case GL_OR:
- current->hwDstSet |= LOP_OR;
- break;
- case GL_NOR:
- current->hwDstSet |= LOP_NOR;
- break;
- case GL_XOR:
- current->hwDstSet |= LOP_XOR;
- break;
- case GL_EQUIV:
- current->hwDstSet |= LOP_EQUIV;
- break;
- case GL_AND_REVERSE:
- current->hwDstSet |= LOP_AND_REVERSE;
- break;
- case GL_AND_INVERTED:
- current->hwDstSet |= LOP_AND_INVERTED;
- break;
- case GL_OR_REVERSE:
- current->hwDstSet |= LOP_OR_REVERSE;
- break;
- case GL_OR_INVERTED:
- current->hwDstSet |= LOP_OR_INVERTED;
- break;
- }
-
- if (current->hwDstSet ^ prev->hwDstSet) {
- prev->hwDstSet = current->hwDstSet;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-}
-
-void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- case BUFFER_BIT_BACK_LEFT:
- FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
- FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- /* We want to update the s/w rast state too so that sisDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
- current->hwOffsetDest = (smesa->drawOffset) >> 1;
- current->hwDstSet &= ~MASK_DstBufferPitch;
- current->hwDstSet |= smesa->drawPitch >> 2;
-
- if (current->hwDstSet != prev->hwDstSet) {
- prev->hwDstSet = current->hwDstSet;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-
- if (current->hwOffsetDest != prev->hwOffsetDest) {
- prev->hwOffsetDest = current->hwOffsetDest;
- smesa->GlobalFlag |= GFLAG_DESTSETTING;
- }
-}
-
-/* =============================================================
- * Polygon stipple
- */
-
-/* =============================================================
- * Render mode
- */
-
-/* =============================================================
- * State enable/disable
- */
-
-static void
-sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *current = &smesa->current;
-
- switch (cap)
- {
- case GL_ALPHA_TEST:
- if (state)
- current->hwCapEnable |= MASK_AlphaTestEnable;
- else
- current->hwCapEnable &= ~MASK_AlphaTestEnable;
- break;
- case GL_BLEND:
- /* TODO: */
- if (state)
- /* if (state & !ctx->Color.ColorLogicOpEnabled) */
- current->hwCapEnable |= MASK_BlendEnable;
- else
- current->hwCapEnable &= ~MASK_BlendEnable;
- break;
- case GL_CULL_FACE:
- if (state)
- current->hwCapEnable |= MASK_CullEnable;
- else
- current->hwCapEnable &= ~MASK_CullEnable;
- break;
- case GL_DEPTH_TEST:
- if (state && smesa->depthbuffer)
- current->hwCapEnable |= MASK_ZTestEnable;
- else
- current->hwCapEnable &= ~MASK_ZTestEnable;
- sisDDDepthMask( ctx, ctx->Depth.Mask );
- break;
- case GL_DITHER:
- if (state)
- current->hwCapEnable |= MASK_DitherEnable;
- else
- current->hwCapEnable &= ~MASK_DitherEnable;
- break;
- case GL_FOG:
- if (state)
- current->hwCapEnable |= MASK_FogEnable;
- else
- current->hwCapEnable &= ~MASK_FogEnable;
- break;
- case GL_COLOR_LOGIC_OP:
- if (state)
- sisDDLogicOpCode( ctx, ctx->Color.LogicOp );
- else
- sisDDLogicOpCode( ctx, GL_COPY );
- break;
- case GL_SCISSOR_TEST:
- sisUpdateClipping( ctx );
- break;
- case GL_STENCIL_TEST:
- if (state) {
- if (smesa->zFormat != SiS_ZFORMAT_S8Z24)
- FALLBACK(smesa, SIS_FALLBACK_STENCIL, 1);
- else
- current->hwCapEnable |= (MASK_StencilTestEnable |
- MASK_StencilWriteEnable);
- } else {
- FALLBACK(smesa, SIS_FALLBACK_STENCIL, 0);
- current->hwCapEnable &= ~(MASK_StencilTestEnable |
- MASK_StencilWriteEnable);
- }
- break;
- }
-}
-
-
-/* =============================================================
- * State initialization, management
- */
-
-/* Called before beginning of rendering. */
-void
-sisUpdateHWState( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- /* enable setting 1 */
- if (current->hwCapEnable ^ prev->hwCapEnable) {
- prev->hwCapEnable = current->hwCapEnable;
- smesa->GlobalFlag |= GFLAG_ENABLESETTING;
- }
-
- /* enable setting 2 */
- if (current->hwCapEnable2 ^ prev->hwCapEnable2) {
- prev->hwCapEnable2 = current->hwCapEnable2;
- smesa->GlobalFlag |= GFLAG_ENABLESETTING2;
- }
-
- if (smesa->GlobalFlag & GFLAG_RENDER_STATES)
- sis_update_render_state( smesa );
-
- if (smesa->GlobalFlag & GFLAG_TEXTURE_STATES)
- sis_update_texture_state( smesa );
-}
-
-static void
-sisDDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- smesa->NewGLState |= new_state;
-}
-
-/* Initialize the context's hardware state.
- */
-void sisDDInitState( sisContextPtr smesa )
-{
- __GLSiSHardware *current = &smesa->current;
- __GLSiSHardware *prev = &(smesa->prev);
- GLcontext *ctx = smesa->glCtx;
-
- /* add Texture Perspective Enable */
- prev->hwCapEnable = MASK_FogPerspectiveEnable | MASK_TextureCacheEnable |
- MASK_TexturePerspectiveEnable | MASK_DitherEnable;
- /*| MASK_SpecularEnable*/
-
- /*
- prev->hwCapEnable2 = 0x00aa0080;
- */
- /* if multi-texture enabled, disable Z pre-test */
- prev->hwCapEnable2 = MASK_TextureMipmapBiasEnable;
-
- /* Z test mode is LESS */
- prev->hwZ = SiS_Z_COMP_S_LT_B;
-
- /* Depth mask */
- prev->hwZMask = 0xffffffff;
-
- /* Alpha test mode is ALWAYS, alpha ref value is 0 */
- prev->hwAlpha = SiS_ALPHA_ALWAYS;
-
- /* ROP2 is COPYPEN */
- prev->hwDstSet = LOP_COPY;
-
- /* color mask */
- prev->hwDstMask = 0xffffffff;
-
- /* LinePattern is 0, Repeat Factor is 0 */
- prev->hwLinePattern = 0x00008000;
-
- /* Src blend is BLEND_ONE, Dst blend is D3DBLEND_ZERO */
- prev->hwDstSrcBlend = SiS_S_ONE | SiS_D_ZERO;
-
- /* Stenciling disabled, function ALWAYS, ref value zero, mask all ones */
- prev->hwStSetting = STENCIL_FORMAT_8 | SiS_STENCIL_ALWAYS | 0xff;
- /* Op is KEEP for all three operations */
- prev->hwStSetting2 = SiS_SFAIL_KEEP | SiS_SPASS_ZFAIL_KEEP |
- SiS_SPASS_ZPASS_KEEP;
-
- /* Texture mapping mode is Tile */
-#if 0
- prev->texture[0].hwTextureSet = 0x00030000;
-#endif
- /* Magnified & minified texture filter is NEAREST */
-#if 0
- prev->texture[0].hwTextureMip = 0;
-#endif
-
- /* Texture Blending setting -- use fragment color/alpha*/
- prev->hwTexBlendColor0 = STAGE0_C_CF;
- prev->hwTexBlendColor1 = STAGE1_C_CF;
- prev->hwTexBlendAlpha0 = STAGE0_A_AF;
- prev->hwTexBlendAlpha1 = STAGE1_A_AF;
-
- switch (smesa->bytesPerPixel)
- {
- case 2:
- prev->hwDstSet |= DST_FORMAT_RGB_565;
- break;
- case 4:
- prev->hwDstSet |= DST_FORMAT_ARGB_8888;
- break;
- }
-
- switch (ctx->Visual.depthBits)
- {
- case 0:
- prev->hwCapEnable &= ~MASK_ZWriteEnable;
- case 16:
- smesa->zFormat = SiS_ZFORMAT_Z16;
- prev->hwCapEnable |= MASK_ZWriteEnable;
- smesa->depth_scale = 1.0 / (GLfloat)0xffff;
- break;
- case 32:
- smesa->zFormat = SiS_ZFORMAT_Z32;
- prev->hwCapEnable |= MASK_ZWriteEnable;
- smesa->depth_scale = 1.0 / (GLfloat)0xffffffff;
- break;
- case 24:
- assert (ctx->Visual.stencilBits);
- smesa->zFormat = SiS_ZFORMAT_S8Z24;
- prev->hwCapEnable |= MASK_StencilBufferEnable;
- prev->hwCapEnable |= MASK_ZWriteEnable;
- smesa->depth_scale = 1.0 / (GLfloat)0xffffff;
- break;
- }
-
- prev->hwZ |= smesa->zFormat;
-
- /* TODO: need to clear cache? */
- smesa->clearTexCache = GL_TRUE;
-
- smesa->clearColorPattern = 0;
-
- smesa->AGPParseSet = MASK_PsTexture1FromB | MASK_PsBumpTextureFromC;
- smesa->dwPrimitiveSet = OP_3D_Texture1FromB | OP_3D_TextureBumpFromC;
-
- sisUpdateZStencilPattern( smesa, 1.0, 0 );
- sisUpdateCull( ctx );
-
- memcpy( current, prev, sizeof (__GLSiSHardware) );
-
- /* Set initial fog settings. Start and end are the same case. */
- sisDDFogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- sisDDFogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- sisDDFogfv( ctx, GL_FOG_MODE, NULL );
-}
-
-/* Initialize the driver's state functions.
- */
-void sisDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = sisDDInvalidateState;
-
- ctx->Driver.Clear = sisDDClear;
- ctx->Driver.ClearColor = sisDDClearColor;
- ctx->Driver.ClearDepth = sisDDClearDepth;
- ctx->Driver.ClearStencil = sisDDClearStencil;
-
- ctx->Driver.AlphaFunc = sisDDAlphaFunc;
- ctx->Driver.BlendFuncSeparate = sisDDBlendFuncSeparate;
- ctx->Driver.ColorMask = sisDDColorMask;
- ctx->Driver.CullFace = sisDDCullFace;
- ctx->Driver.DepthMask = sisDDDepthMask;
- ctx->Driver.DepthFunc = sisDDDepthFunc;
- ctx->Driver.DepthRange = sisDDDepthRange;
- ctx->Driver.DrawBuffer = sisDDDrawBuffer;
- ctx->Driver.Enable = sisDDEnable;
- ctx->Driver.FrontFace = sisDDFrontFace;
- ctx->Driver.Fogfv = sisDDFogfv;
- ctx->Driver.Hint = NULL;
- ctx->Driver.Lightfv = NULL;
- ctx->Driver.LogicOpcode = sisDDLogicOpCode;
- ctx->Driver.PolygonMode = NULL;
- ctx->Driver.PolygonStipple = NULL;
- ctx->Driver.ReadBuffer = NULL;
- ctx->Driver.RenderMode = NULL;
- ctx->Driver.Scissor = sisDDScissor;
- ctx->Driver.ShadeModel = sisDDShadeModel;
- ctx->Driver.Viewport = sisDDViewport;
-
- /* Pixel path fallbacks. */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.h
deleted file mode 100644
index 770ba478a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_state.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_STATE_H__
-#define __SIS_STATE_H__
-
-#include "sis_context.h"
-
-extern void sisDDInitState( sisContextPtr smesa );
-extern void sisDDInitStateFuncs( GLcontext *ctx );
-
-extern void sisDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height );
-extern void sisDDClearColor( GLcontext * ctx, const GLfloat color[4] );
-extern void sisDDClearDepth( GLcontext * ctx, GLclampd d );
-extern void sisDDClearStencil( GLcontext * ctx, GLint s );
-extern void sisDDFogfv( GLcontext * ctx, GLenum pname, const GLfloat * params );
-extern void sisDDDepthMask( GLcontext * ctx, GLboolean flag );
-
-extern void sisUpdateClipping( GLcontext * gc );
-extern void sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z,
- int stencil );
-extern void sisDDDrawBuffer( GLcontext *ctx, GLenum mode );
-extern void sisUpdateHWState( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.c
deleted file mode 100644
index a31d49ca2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_stencil.c,v 1.3 2000/09/26 15:56:49 tsi Exp $ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_stencil.h"
-
-static void
-sisDDStencilFunc( GLcontext * ctx, GLenum func, GLint ref, GLuint mask )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- /* set reference */
- current->hwStSetting = STENCIL_FORMAT_8 | (ctx->Stencil.Ref[0] << 8) |
- ctx->Stencil.ValueMask[0];
-
- switch (func)
- {
- case GL_NEVER:
- current->hwStSetting |= SiS_STENCIL_NEVER;
- break;
- case GL_LESS:
- current->hwStSetting |= SiS_STENCIL_LESS;
- break;
- case GL_EQUAL:
- current->hwStSetting |= SiS_STENCIL_EQUAL;
- break;
- case GL_LEQUAL:
- current->hwStSetting |= SiS_STENCIL_LEQUAL;
- break;
- case GL_GREATER:
- current->hwStSetting |= SiS_STENCIL_GREATER;
- break;
- case GL_NOTEQUAL:
- current->hwStSetting |= SiS_STENCIL_NOTEQUAL;
- break;
- case GL_GEQUAL:
- current->hwStSetting |= SiS_STENCIL_GEQUAL;
- break;
- case GL_ALWAYS:
- current->hwStSetting |= SiS_STENCIL_ALWAYS;
- break;
- }
-
- if (current->hwStSetting != prev->hwStSetting)
- {
- prev->hwStSetting = current->hwStSetting;
-
- smesa->GlobalFlag |= GFLAG_STENCILSETTING;
- }
-}
-
-static void
-sisDDStencilMask( GLcontext * ctx, GLuint mask )
-{
- if (!ctx->Visual.stencilBits)
- return;
-
- /* set Z buffer Write Enable */
- sisDDDepthMask (ctx, ctx->Depth.Mask);
-}
-
-static void
-sisDDStencilOp( GLcontext * ctx, GLenum fail, GLenum zfail, GLenum zpass )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- current->hwStSetting2 &= ~(MASK_StencilZPassOp | MASK_StencilZFailOp |
- MASK_StencilFailOp);
-
- switch (fail)
- {
- case GL_KEEP:
- current->hwStSetting2 |= SiS_SFAIL_KEEP;
- break;
- case GL_ZERO:
- current->hwStSetting2 |= SiS_SFAIL_ZERO;
- break;
- case GL_REPLACE:
- current->hwStSetting2 |= SiS_SFAIL_REPLACE;
- break;
- case GL_INVERT:
- current->hwStSetting2 |= SiS_SFAIL_INVERT;
- break;
- case GL_INCR:
- current->hwStSetting2 |= SiS_SFAIL_INCR;
- break;
- case GL_DECR:
- current->hwStSetting2 |= SiS_SFAIL_DECR;
- break;
- }
-
- switch (zfail)
- {
- case GL_KEEP:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_KEEP;
- break;
- case GL_ZERO:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_ZERO;
- break;
- case GL_REPLACE:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_REPLACE;
- break;
- case GL_INVERT:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_INVERT;
- break;
- case GL_INCR:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_INCR;
- break;
- case GL_DECR:
- current->hwStSetting2 |= SiS_SPASS_ZFAIL_DECR;
- break;
- }
-
- switch (zpass)
- {
- case GL_KEEP:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_KEEP;
- break;
- case GL_ZERO:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_ZERO;
- break;
- case GL_REPLACE:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_REPLACE;
- break;
- case GL_INVERT:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_INVERT;
- break;
- case GL_INCR:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_INCR;
- break;
- case GL_DECR:
- current->hwStSetting2 |= SiS_SPASS_ZPASS_DECR;
- break;
- }
-
- if (current->hwStSetting2 != prev->hwStSetting2)
- {
- prev->hwStSetting2 = current->hwStSetting2;
- smesa->GlobalFlag |= GFLAG_STENCILSETTING;
- }
-}
-
-void
-sisDDInitStencilFuncs( GLcontext *ctx )
-{
- ctx->Driver.StencilFunc = sisDDStencilFunc;
- ctx->Driver.StencilMask = sisDDStencilMask;
- ctx->Driver.StencilOp = sisDDStencilOp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.h
deleted file mode 100644
index 4a36c98f3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_stencil.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_STENCIL_H__
-#define __SIS_STENCIL_H__
-
-extern void sisDDInitStencilFuncs( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.c
deleted file mode 100644
index 5fa8256f1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "sis_context.h"
-#include "sis_alloc.h"
-#include "sis_tex.h"
-
-#include "swrast/swrast.h"
-#include "imports.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "texobj.h"
-
-#define ALIGN(value, align) (GLubyte *)((long)(value + align - 1) & ~(align - 1))
-
-#define TEXTURE_HW_ALIGNMENT 4
-#define TEXTURE_HW_PLUS (4 + 4)
-
-static sisTexObjPtr
-sisAllocTexObj( struct gl_texture_object *texObj )
-{
- sisTexObjPtr t;
-
- t = (sisTexObjPtr) CALLOC_STRUCT( sis_tex_obj );
- texObj->DriverData = t;
- return t;
-}
-
-static void
-sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level,
- const struct gl_texture_image *image )
-{
- char *addr;
- int size, texel_size;
-
- if (t->format == 0) {
- t->format = image->Format;
- switch (t->format)
- {
- case GL_RGBA:
- t->hwformat = TEXEL_ARGB_8888_32;
- break;
- case GL_INTENSITY:
- t->hwformat = TEXEL_I8;
- break;
- case GL_ALPHA:
- t->hwformat = TEXEL_A8;
- break;
- case GL_LUMINANCE:
- t->hwformat = TEXEL_L8;
- break;
- case GL_LUMINANCE_ALPHA:
- t->hwformat = TEXEL_AL88;
- break;
- case GL_RGB:
- t->hwformat = TEXEL_ARGB_0888_32;
- break;
- default:
- sis_fatal_error("Bad texture format.\n");
- }
- }
- assert(t->format == image->Format);
-
- texel_size = image->TexFormat->TexelBytes;
- size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS;
-
- addr = sisAllocFB( smesa, size, &t->image[level].handle );
- if (addr == NULL) {
- addr = sisAllocAGP( smesa, size, &t->image[level].handle );
- if (addr == NULL)
- sis_fatal_error("Failure to allocate texture memory.\n");
- t->image[level].memType = AGP_TYPE;
- }
- else
- t->image[level].memType = VIDEO_TYPE;
-
- t->image[level].Data = ALIGN(addr, TEXTURE_HW_ALIGNMENT);
- t->image[level].pitch = image->Width * texel_size;
- t->image[level].size = image->Width * image->Height * texel_size;
- t->numImages++;
-}
-
-static void
-sisFreeTexImage( sisContextPtr smesa, sisTexObjPtr t, int level )
-{
- if (t->image[level].Data == NULL)
- return;
-
- switch (t->image[level].memType)
- {
- case VIDEO_TYPE:
- sisFreeFB( smesa, t->image[level].handle );
- break;
- case AGP_TYPE:
- sisFreeAGP( smesa, t->image[level].handle );
- break;
- }
- t->image[level].Data = NULL;
- t->image[level].handle = NULL;
- /* If there are no textures loaded any more, reset the hw format so the
- * object can be reused for new formats
- */
- t->numImages--;
- if (t->numImages == 0) {
- t->format = 0;
- t->hwformat = 0;
- }
-}
-
-static void
-sisTexEnv( GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
-}
-
-static void
-sisTexParameter( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj, GLenum pname,
- const GLfloat *params )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void
-sisBindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
-
- if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) {
- if ( texObj->DriverData == NULL ) {
- sisAllocTexObj( texObj );
- }
- }
-
- t = texObj->DriverData;
- if (!t)
- return;
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format) {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void
-sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
- int i;
-
- smesa->clearTexCache = GL_TRUE;
-
- t = texObj->DriverData;
- if (t == NULL) {
- /*
- * this shows the texture is default object and never be a
- * argument of sisTexImage*
- */
- return;
- }
- for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
- sisFreeTexImage( smesa, t, i );
- }
-
- FREE(t);
- texObj->DriverData = NULL;
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, texObj);
-}
-
-static GLboolean sisIsTextureResident( GLcontext * ctx,
- struct gl_texture_object *texObj )
-{
- return (texObj->DriverData != NULL);
-}
-
-static const struct gl_texture_format *
-sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- /* XXX 16-bit internal texture formats? */
- switch ( internalFormat ) {
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8;
- 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:
- return &_mesa_texformat_al88;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_i8;
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_argb8888 /*_mesa_texformat_rgb888*/; /* XXX */
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- default:
- _mesa_problem(ctx, "unexpected format in tdfxDDChooseTextureFormat: %d",
- internalFormat);
- return NULL;
- }
-}
-
-static void sisTexImage1D( 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 )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- /* Note, this will call sisChooseTextureFormat */
- _mesa_store_teximage1d( ctx, target, level, internalFormat,
- width, border, format, type,
- pixels, packing, texObj, texImage );
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- memcpy(t->image[level].Data, texImage->Data, t->image[level].size);
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-
-static void sisTexSubImage1D( 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 )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
- GLuint copySize;
- GLint texelBytes;
- const char *src;
- GLubyte *dst;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- texelBytes = texImage->TexFormat->TexelBytes;
-
- copySize = width * texelBytes;
- src = (char *)texImage->Data + xoffset * texelBytes;
- dst = t->image[level].Data + xoffset * texelBytes;
-
- memcpy( dst, src, copySize );
-
- smesa->clearTexCache = GL_TRUE;
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void sisTexImage2D( 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 )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- /* Note, this will call sisChooseTextureFormat */
- _mesa_store_teximage2d(ctx, target, level, internalFormat,
- width, height, border, format, type, pixels,
- &ctx->Unpack, texObj, texImage);
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- memcpy(t->image[level].Data, texImage->Data, t->image[level].size);
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-static void sisTexSubImage2D( 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 )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- sisTexObjPtr t;
- GLuint copySize;
- GLint texelBytes;
- const char *src;
- GLubyte *dst;
- int j;
- GLuint soffset;
-
- if ( texObj->DriverData == NULL )
- sisAllocTexObj( texObj );
- t = texObj->DriverData;
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-
- /* Allocate offscreen space for the texture */
- sisFreeTexImage(smesa, t, level);
- sisAllocTexImage(smesa, t, level, texImage);
-
- /* Upload the texture */
- texelBytes = texImage->TexFormat->TexelBytes;
-
- copySize = width * texelBytes;
- src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) *
- texelBytes;
- dst = t->image[level].Data + (xoffset + yoffset * texImage->Width) *
- texelBytes;
- soffset = texImage->Width * texelBytes;
-
- for (j = yoffset; j < yoffset + height; j++) {
- memcpy( dst, src, copySize );
- src += soffset;
- dst += soffset;
- }
-
- smesa->clearTexCache = GL_TRUE;
-
- if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)
- {
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;
- smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;
- }
- smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
-}
-
-
-/**
- * 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 *
-sisNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- return obj;
-}
-
-
-void sisInitTextureFuncs( struct dd_function_table *functions )
-{
- functions->TexEnv = sisTexEnv;
- functions->ChooseTextureFormat = sisChooseTextureFormat;
- functions->TexImage1D = sisTexImage1D;
- functions->TexSubImage1D = sisTexSubImage1D;
- functions->TexImage2D = sisTexImage2D;
- functions->TexSubImage2D = sisTexSubImage2D;
- functions->TexParameter = sisTexParameter;
- functions->BindTexture = sisBindTexture;
- functions->NewTextureObject = sisNewTextureObject;
- functions->DeleteTexture = sisDeleteTexture;
- functions->IsTextureResident = sisIsTextureResident;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.h
deleted file mode 100644
index 8ddc7c469..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tex.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_TEX_H__
-#define __SIS_TEX_H__
-
-extern void sisInitTextureFuncs( struct dd_function_table *table );
-extern void sisUpdateTextureState( GLcontext *ctx );
-
-#endif /* __SIS_TEX_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_texstate.c
deleted file mode 100644
index a18ad06bd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_texstate.c
+++ /dev/null
@@ -1,672 +0,0 @@
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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.
-
-**************************************************************************/
-/* $XFree86$ */
-
-/*
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "macros.h"
-#include "texformat.h"
-
-#include "sis_context.h"
-#include "sis_state.h"
-#include "sis_tex.h"
-#include "sis_tris.h"
-#include "sis_alloc.h"
-
-static GLint TransferTexturePitch (GLint dwPitch);
-
-/* Handle texenv stuff, called from validate_texture (renderstart) */
-static void
-sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj,
- int unit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- struct gl_texture_unit *texture_unit = &ctx->Texture.Unit[unit];
-
- sisTexObjPtr t = texObj->DriverData;
-
- switch (texture_unit->EnvMode)
- {
- case GL_REPLACE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CS;
- current->hwTexBlendAlpha0 = STAGE0_A_AS;
- break;
- }
- break;
-
- case GL_MODULATE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CFCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CFCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- }
- break;
-
- case GL_DECAL:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 0);
- switch (t->format)
- {
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CFOMAS_CSAS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- }
- break;
-
- case GL_BLEND:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV0, 1);
-#if 0 /* XXX Blending broken */
- current->hwTexEnvColor =
- ((GLint) (texture_unit->EnvColor[3])) << 24 |
- ((GLint) (texture_unit->EnvColor[0])) << 16 |
- ((GLint) (texture_unit->EnvColor[1])) << 8 |
- ((GLint) (texture_unit->EnvColor[2]));
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor0 = STAGE0_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
- break;
- case GL_INTENSITY:
- current->hwTexBlendColor0 = STAGE0_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AFOMAS_ACAS;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor0 = STAGE0_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha0 = STAGE0_A_AFAS;
- break;
- }
- break;
-#endif
- }
-
- if ((current->hwTexBlendColor0 != prev->hwTexBlendColor0) ||
- (current->hwTexBlendAlpha0 != prev->hwTexBlendAlpha0) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexEnvColor = current->hwTexEnvColor;
- prev->hwTexBlendColor0 = current->hwTexBlendColor0;
- prev->hwTexBlendAlpha0 = current->hwTexBlendAlpha0;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV;
- }
-}
-
-/* Handle texenv stuff, called from validate_texture (renderstart) */
-static void
-sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj,
- int unit)
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- struct gl_texture_unit *texture_unit = &ctx->Texture.Unit[unit];
-
- sisTexObjPtr t = texObj->DriverData;
-
- switch (texture_unit->EnvMode)
- {
- case GL_REPLACE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CS;
- current->hwTexBlendAlpha1 = STAGE1_A_AS;
- break;
- }
- break;
-
- case GL_MODULATE:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 0);
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CFCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_INTENSITY:
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CFCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- }
- break;
-
- case GL_DECAL:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 0);
- switch (t->format)
- {
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CFOMAS_CSAS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- }
- break;
-
- case GL_BLEND:
- FALLBACK(smesa, SIS_FALLBACK_TEXENV1, 1);
-#if 0 /* XXX Blending broken */
- current->hwTexEnvColor =
- ((GLint) (texture_unit->EnvColor[3])) << 24 |
- ((GLint) (texture_unit->EnvColor[0])) << 16 |
- ((GLint) (texture_unit->EnvColor[1])) << 8 |
- ((GLint) (texture_unit->EnvColor[2]));
- switch (t->format)
- {
- case GL_ALPHA:
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- case GL_LUMINANCE:
- case GL_RGB:
- current->hwTexBlendColor1 = STAGE1_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
- break;
- case GL_INTENSITY:
- current->hwTexBlendColor1 = STAGE1_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AFOMAS_ACAS;
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- current->hwTexBlendColor1 = STAGE1_C_CFOMCS_CCCS;
- current->hwTexBlendAlpha1 = STAGE1_A_AFAS;
- break;
- }
- break;
-#endif
- }
-
- if ((current->hwTexBlendColor1 != prev->hwTexBlendColor1) ||
- (current->hwTexBlendAlpha1 != prev->hwTexBlendAlpha1) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexBlendColor1 = current->hwTexBlendColor1;
- prev->hwTexBlendAlpha1 = current->hwTexBlendAlpha1;
- prev->hwTexEnvColor = current->hwTexEnvColor;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV_1;
- }
-}
-
-/* Returns 0 if a software fallback is necessary */
-static GLboolean
-sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
- int hw_unit )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- int ok = 1;
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- sisTexObjPtr t = texObj->DriverData;
-
- GLint firstLevel, lastLevel;
- GLint i;
-
- current->texture[hw_unit].hwTextureMip = 0UL;
- current->texture[hw_unit].hwTextureSet = t->hwformat;
-
- if ((texObj->MinFilter == GL_NEAREST) || (texObj->MinFilter == GL_LINEAR)) {
- firstLevel = lastLevel = texObj->BaseLevel;
- } else {
- /* 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.
- */
-
- firstLevel = texObj->BaseLevel + (GLint)(texObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, texObj->BaseLevel);
- lastLevel = texObj->BaseLevel + (GLint)(texObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, texObj->BaseLevel);
- lastLevel = MIN2(lastLevel, texObj->BaseLevel +
- texObj->Image[0][texObj->BaseLevel]->MaxLog2);
- lastLevel = MIN2(lastLevel, texObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
-
- current->texture[hw_unit].hwTextureSet |= (lastLevel << 8);
-
- switch (texObj->MagFilter)
- {
- case GL_NEAREST:
- current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- current->texture[hw_unit].hwTextureMip |= (TEXTURE_FILTER_LINEAR << 3);
- break;
- }
-
- {
- GLint b;
-
- /* The mipmap lod biasing is based on experiment. It seems there's a
- * limit of around +4/-4 to the bias value; we're being conservative.
- */
- b = (GLint) (ctx->Texture.Unit[hw_unit].LodBias * 32.0);
- if (b > 127)
- b = 127;
- else if (b < -128)
- b = -128;
-
- current->texture[hw_unit].hwTextureMip |= ((b << 4) &
- MASK_TextureMipmapLodBias);
- }
-
- switch (texObj->MinFilter)
- {
- case GL_NEAREST:
- current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_NEAREST;
- break;
- case GL_LINEAR:
- current->texture[hw_unit].hwTextureMip |= TEXTURE_FILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_NEAREST_MIP_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_NEAREST_MIP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_LINEAR_MIP_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- current->texture[hw_unit].hwTextureMip |=
- TEXTURE_FILTER_LINEAR_MIP_LINEAR;
- break;
- }
-
- switch (texObj->WrapS)
- {
- case GL_REPEAT:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapU;
- break;
- case GL_CLAMP:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureClampU;
- break;
- case GL_CLAMP_TO_EDGE:
- /*
- * ?? not support yet
- */
- ok = 0;
- break;
- }
-
- switch (texObj->WrapT)
- {
- case GL_REPEAT:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapV;
- break;
- case GL_CLAMP:
- current->texture[hw_unit].hwTextureSet |= MASK_TextureClampV;
- break;
- case GL_CLAMP_TO_EDGE:
- /*
- * ?? not support yet
- */
- ok = 0;
- break;
- }
-
-/*
- if (current->texture[hw_unit].hwTextureSet & MASK_TextureClampU) {
- current->texture[hw_unit].hwTextureSet &= ~MASK_TextureClampU;
- current->texture[hw_unit].hwTextureSet |= MASK_TextureBorderU;
- }
-
- if (current->texture[hw_unit].hwTextureSet & MASK_TextureClampV) {
- current->texture[hw_unit].hwTextureSet &= ~MASK_TextureClampV;
- current->texture[hw_unit].hwTextureSet |= MASK_TextureBorderV;
- }
-*/
- current->texture[hw_unit].hwTextureBorderColor =
- ((GLuint) texObj->BorderColor[3] << 24) +
- ((GLuint) texObj->BorderColor[0] << 16) +
- ((GLuint) texObj->BorderColor[1] << 8) +
- ((GLuint) texObj->BorderColor[2]);
-
- if (current->texture[hw_unit].hwTextureBorderColor !=
- prev->texture[hw_unit].hwTextureBorderColor)
- {
- prev->texture[hw_unit].hwTextureBorderColor =
- current->texture[hw_unit].hwTextureBorderColor;
- if (hw_unit == 1)
- smesa->GlobalFlag |= GFLAG_TEXBORDERCOLOR_1;
- else
- smesa->GlobalFlag |= GFLAG_TEXBORDERCOLOR;
- }
-
- current->texture[hw_unit].hwTextureSet |=
- texObj->Image[0][firstLevel]->WidthLog2 << 4;
- current->texture[hw_unit].hwTextureSet |=
- texObj->Image[0][firstLevel]->HeightLog2;
-
- if (hw_unit == 0)
- smesa->GlobalFlag |= GFLAG_TEXTUREADDRESS;
- else
- smesa->GlobalFlag |= GFLAG_TEXTUREADDRESS_1;
-
- for (i = firstLevel; i <= lastLevel; i++)
- {
- GLuint texOffset = 0;
- GLuint texPitch = TransferTexturePitch( t->image[i].pitch );
-
- switch (t->image[i].memType)
- {
- case VIDEO_TYPE:
- texOffset = ((unsigned long)t->image[i].Data - (unsigned long)smesa->FbBase);
- break;
- case AGP_TYPE:
- texOffset = ((unsigned long)t->image[i].Data - (unsigned long)smesa->AGPBase) +
- (unsigned long) smesa->AGPAddr;
- current->texture[hw_unit].hwTextureMip |=
- (MASK_TextureLevel0InSystem << i);
- break;
- }
-
- switch (i)
- {
- case 0:
- prev->texture[hw_unit].texOffset0 = texOffset;
- prev->texture[hw_unit].texPitch01 = texPitch << 16;
- break;
- case 1:
- prev->texture[hw_unit].texOffset1 = texOffset;
- prev->texture[hw_unit].texPitch01 |= texPitch;
- break;
- case 2:
- prev->texture[hw_unit].texOffset2 = texOffset;
- prev->texture[hw_unit].texPitch23 = texPitch << 16;
- break;
- case 3:
- prev->texture[hw_unit].texOffset3 = texOffset;
- prev->texture[hw_unit].texPitch23 |= texPitch;
- break;
- case 4:
- prev->texture[hw_unit].texOffset4 = texOffset;
- prev->texture[hw_unit].texPitch45 = texPitch << 16;
- break;
- case 5:
- prev->texture[hw_unit].texOffset5 = texOffset;
- prev->texture[hw_unit].texPitch45 |= texPitch;
- break;
- case 6:
- prev->texture[hw_unit].texOffset6 = texOffset;
- prev->texture[hw_unit].texPitch67 = texPitch << 16;
- break;
- case 7:
- prev->texture[hw_unit].texOffset7 = texOffset;
- prev->texture[hw_unit].texPitch67 |= texPitch;
- break;
- case 8:
- prev->texture[hw_unit].texOffset8 = texOffset;
- prev->texture[hw_unit].texPitch89 = texPitch << 16;
- break;
- case 9:
- prev->texture[hw_unit].texOffset9 = texOffset;
- prev->texture[hw_unit].texPitch89 |= texPitch;
- break;
- case 10:
- prev->texture[hw_unit].texOffset10 = texOffset;
- prev->texture[hw_unit].texPitch10 = texPitch << 16;
- break;
- case 11:
- prev->texture[hw_unit].texOffset11 = texOffset;
- prev->texture[hw_unit].texPitch10 |= texPitch;
- break;
- }
- }
-
- if (current->texture[hw_unit].hwTextureSet !=
- prev->texture[hw_unit].hwTextureSet)
- {
- prev->texture[hw_unit].hwTextureSet =
- current->texture[hw_unit].hwTextureSet;
- if (hw_unit == 1)
- smesa->GlobalFlag |= CFLAG_TEXTURERESET_1;
- else
- smesa->GlobalFlag |= CFLAG_TEXTURERESET;
- }
- if (current->texture[hw_unit].hwTextureMip !=
- prev->texture[hw_unit].hwTextureMip)
- {
- prev->texture[hw_unit].hwTextureMip =
- current->texture[hw_unit].hwTextureMip;
- if (hw_unit == 1)
- smesa->GlobalFlag |= GFLAG_TEXTUREMIPMAP_1;
- else
- smesa->GlobalFlag |= GFLAG_TEXTUREMIPMAP;
- }
-
- return ok;
-}
-
-/* Disable a texture unit, called from validate_texture */
-static void
-sis_reset_texture_env (GLcontext *ctx, int hw_unit)
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- __GLSiSHardware *prev = &smesa->prev;
- __GLSiSHardware *current = &smesa->current;
-
- if (hw_unit == 1)
- {
- current->hwTexBlendColor1 = STAGE1_C_CF;
- current->hwTexBlendAlpha1 = STAGE1_A_AF;
-
- if ((current->hwTexBlendColor1 != prev->hwTexBlendColor1) ||
- (current->hwTexBlendAlpha1 != prev->hwTexBlendAlpha1) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexBlendColor1 = current->hwTexBlendColor1;
- prev->hwTexBlendAlpha1 = current->hwTexBlendAlpha1;
- prev->hwTexEnvColor = current->hwTexEnvColor;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV_1;
- }
- } else {
- current->hwTexBlendColor0 = STAGE0_C_CF;
- current->hwTexBlendAlpha0 = STAGE0_A_AF;
-
- if ((current->hwTexBlendColor0 != prev->hwTexBlendColor0) ||
- (current->hwTexBlendAlpha0 != prev->hwTexBlendAlpha0) ||
- (current->hwTexEnvColor != prev->hwTexEnvColor))
- {
- prev->hwTexBlendColor0 = current->hwTexBlendColor0;
- prev->hwTexBlendAlpha0 = current->hwTexBlendAlpha0;
- prev->hwTexEnvColor = current->hwTexEnvColor;
- smesa->GlobalFlag |= GFLAG_TEXTUREENV;
- }
- }
-}
-
-static void updateTextureUnit( GLcontext *ctx, int unit )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj = texUnit->_Current;
- GLint fallbackbit;
-
- if (unit == 0)
- fallbackbit = SIS_FALLBACK_TEXTURE0;
- else
- fallbackbit = SIS_FALLBACK_TEXTURE1;
-
- if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
- if (smesa->TexStates[unit] & NEW_TEXTURING) {
- GLboolean ok;
-
- ok = sis_set_texobj_parm (ctx, texObj, unit);
- FALLBACK( smesa, fallbackbit, !ok );
- }
- if (smesa->TexStates[unit] & NEW_TEXTURE_ENV) {
- if (unit == 0)
- sis_set_texture_env0( ctx, texObj, unit );
- else
- sis_set_texture_env1( ctx, texObj, unit );
- }
- smesa->TexStates[unit] = 0;
- } else if ( texUnit->_ReallyEnabled ) {
- /* fallback */
- FALLBACK( smesa, fallbackbit, 1 );
- } else {
- sis_reset_texture_env( ctx, unit );
- FALLBACK( smesa, fallbackbit, 0 );
- }
-}
-
-
-void sisUpdateTextureState( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- int i;
- __GLSiSHardware *current = &smesa->current;
-
-#if 1
- /* TODO : if unmark these, error in multitexture */ /* XXX */
- for (i = 0; i < SIS_MAX_TEXTURES; i++)
- smesa->TexStates[i] |= (NEW_TEXTURING | NEW_TEXTURE_ENV);
-#endif
-
- updateTextureUnit( ctx, 0 );
- updateTextureUnit( ctx, 1 );
-
- /* XXX Issues with the 2nd unit but not the first being enabled? */
- if ( ctx->Texture.Unit[0]._ReallyEnabled &
- (TEXTURE_1D_BIT | TEXTURE_2D_BIT) ||
- ctx->Texture.Unit[1]._ReallyEnabled &
- (TEXTURE_1D_BIT | TEXTURE_2D_BIT) )
- {
- current->hwCapEnable |= MASK_TextureEnable;
- current->hwCapEnable &= ~MASK_TextureNumUsed;
- if (ctx->Texture.Unit[1]._ReallyEnabled)
- current->hwCapEnable |= 0x00002000;
- else
- current->hwCapEnable |= 0x00001000;
- } else {
- current->hwCapEnable &= ~MASK_TextureEnable;
- }
-}
-
-static GLint
-BitScanForward( GLshort w )
-{
- GLint i;
-
- for (i = 0; i < 16; i++) {
- if (w & (1 << i))
- break;
- }
- return i;
-}
-
-static GLint
-TransferTexturePitch( GLint dwPitch )
-{
- GLint dwRet, i;
-
- i = BitScanForward( (GLshort)dwPitch );
- dwRet = dwPitch >> i;
- dwRet |= i << 9;
- return dwRet;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.c
deleted file mode 100644
index fb0fd1ac0..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.c
+++ /dev/null
@@ -1,1071 +0,0 @@
-/* $XFree86*/ /* -*- c-basic-offset: 3 -*- */
-/**************************************************************************
-
-Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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:
- * Sung-Ching Lin <sclin@sis.com.tw>
- * Eric Anholt <anholt@FreeBSD.org>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "macros.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "sis_context.h"
-#include "sis_tris.h"
-#include "sis_state.h"
-#include "sis_lock.h"
-#include "sis_span.h"
-#include "sis_alloc.h"
-#include "sis_tex.h"
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- OP_3D_POINT_DRAW, /* GL_POINTS */
- OP_3D_LINE_DRAW, /* GL_LINES */
- OP_3D_LINE_DRAW, /* GL_LINE_LOOP */
- OP_3D_LINE_DRAW, /* GL_LINE_STRIP */
- OP_3D_TRIANGLE_DRAW, /* GL_TRIANGLES */
- OP_3D_TRIANGLE_DRAW, /* GL_TRIANGLE_STRIP */
- OP_3D_TRIANGLE_DRAW, /* GL_TRIANGLE_FAN */
- OP_3D_TRIANGLE_DRAW, /* GL_QUADS */
- OP_3D_TRIANGLE_DRAW, /* GL_QUAD_STRIP */
- OP_3D_TRIANGLE_DRAW /* GL_POLYGON */
-};
-
-static const GLuint hw_prim_mmio_fire[OP_3D_TRIANGLE_DRAW+1] = {
- OP_3D_FIRE_TSARGBa,
- OP_3D_FIRE_TSARGBb,
- OP_3D_FIRE_TSARGBc
-};
-
-static const GLuint hw_prim_mmio_shade[OP_3D_TRIANGLE_DRAW+1] = {
- SHADE_FLAT_VertexA,
- SHADE_FLAT_VertexB,
- SHADE_FLAT_VertexC
-};
-
-static const GLuint hw_prim_agp_type[OP_3D_TRIANGLE_DRAW+1] = {
- MASK_PsPointList,
- MASK_PsLineList,
- MASK_PsTriangleList
-};
-
-static const GLuint hw_prim_agp_shade[OP_3D_TRIANGLE_DRAW+1] = {
- MASK_PsShadingFlatA,
- MASK_PsShadingFlatB,
- MASK_PsShadingFlatC
-};
-
-static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void sisRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#define HAVE_QUADS 0
-#define HAVE_LINES 1
-#define HAVE_POINTS 1
-#define CTX_ARG sisContextPtr smesa
-#define GET_VERTEX_DWORDS() smesa->vertex_size
-#define ALLOC_VERTS( n, size ) sisAllocDmaLow( smesa, n * size * sizeof(int) )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- const char *vertptr = smesa->verts;
-#define VERT(x) (sisVertex *)(vertptr + (x * vertsize * sizeof(int)))
-#define VERTEX sisVertex
-#undef TAG
-#define TAG(x) sis_##x
-#include "tnl_dd/t_dd_triemit.h"
-#undef TAG
-#undef LOCAL_VARS
-
-/***********************************************************************
- * Dispatch vertices to hardware through MMIO *
- ***********************************************************************/
-
-/* The ARGB write of the last vertex of the primitive fires the 3d engine, so
- * save it until the end.
- */
-#define SIS_MMIO_WRITE_VERTEX(_v, i, lastvert) \
-do { \
- GLuint __color, __i = 0; \
- MMIO(REG_3D_TSXa+(i)*0x30, _v->ui[__i++]); \
- MMIO(REG_3D_TSYa+(i)*0x30, _v->ui[__i++]); \
- MMIO(REG_3D_TSZa+(i)*0x30, _v->ui[__i++]); \
- if (SIS_STATES & VERT_W) \
- MMIO(REG_3D_TSWGa+(i)*0x30, _v->ui[__i++]); \
- __color = _v->ui[__i++]; \
- if (SIS_STATES & VERT_SPEC) \
- MMIO(REG_3D_TSFSa+(i)*0x30, _v->ui[__i++]); \
- if (SIS_STATES & VERT_UV0) { \
- MMIO(REG_3D_TSUAa+(i)*0x30, _v->ui[__i++]); \
- MMIO(REG_3D_TSVAa+(i)*0x30, _v->ui[__i++]); \
- } \
- if (SIS_STATES & VERT_UV1) { \
- MMIO(REG_3D_TSUBa+(i)*0x30, _v->ui[__i++]); \
- MMIO(REG_3D_TSVBa+(i)*0x30, _v->ui[__i++]); \
- } \
- if (lastvert || (SIS_STATES & VERT_SMOOTH)) \
- MMIO(REG_3D_TSARGBa+(i)*0x30, __color); \
-} while (0)
-
-#define MMIO_VERT_REG_COUNT 10
-
-#define VERT_SMOOTH 0x01
-#define VERT_W 0x02
-#define VERT_SPEC 0x04
-#define VERT_UV0 0x08
-#define VERT_UV1 0x10
-
-typedef void (*mmio_draw_func)(sisContextPtr smesa, char *verts);
-static mmio_draw_func sis_tri_func_mmio[32];
-static mmio_draw_func sis_line_func_mmio[32];
-static mmio_draw_func sis_point_func_mmio[32];
-
-#define SIS_STATES (0)
-#define TAG(x) x##_none
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH)
-#define TAG(x) x##_g
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W)
-#define TAG(x) x##_w
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W)
-#define TAG(x) x##_gw
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SPEC)
-#define TAG(x) x##_s
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_SPEC)
-#define TAG(x) x##_gs
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W | VERT_SPEC)
-#define TAG(x) x##_ws
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W | VERT_SPEC)
-#define TAG(x) x##_gws
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_UV0)
-#define TAG(x) x##_t0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_UV0)
-#define TAG(x) x##_gt0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W | VERT_UV0)
-#define TAG(x) x##_wt0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W | VERT_UV0)
-#define TAG(x) x##_gwt0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SPEC | VERT_UV0)
-#define TAG(x) x##_st0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_SPEC | VERT_UV0)
-#define TAG(x) x##_gst0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W | VERT_SPEC | VERT_UV0)
-#define TAG(x) x##_wst0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W | VERT_SPEC | VERT_UV0)
-#define TAG(x) x##_gwst0
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_UV1)
-#define TAG(x) x##_t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_UV1)
-#define TAG(x) x##_gt1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W | VERT_UV1)
-#define TAG(x) x##_wt1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W | VERT_UV1)
-#define TAG(x) x##_gwt1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SPEC | VERT_UV1)
-#define TAG(x) x##_st1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_SPEC | VERT_UV1)
-#define TAG(x) x##_gst1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W | VERT_SPEC | VERT_UV1)
-#define TAG(x) x##_wst1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W | VERT_SPEC | VERT_UV1)
-#define TAG(x) x##_gwst1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_t0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_gt0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W | VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_wt0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W | VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_gwt0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SPEC | VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_st0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_SPEC | VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_gst0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_W | VERT_SPEC | VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_wst0t1
-#include "sis_tritmp.h"
-
-#define SIS_STATES (VERT_SMOOTH | VERT_W | VERT_SPEC | VERT_UV0 | VERT_UV1)
-#define TAG(x) x##_gwst0t1
-#include "sis_tritmp.h"
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- smesa->draw_tri( smesa, a, b, c ); \
- else \
- sis_triangle( smesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- smesa->draw_tri( smesa, a, b, d ); \
- smesa->draw_tri( smesa, b, c, d ); \
- } else \
- sis_quad( smesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- smesa->draw_line( smesa, v0, v1 ); \
- else \
- sis_line( smesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- smesa->draw_point( smesa, v0 ); \
- else \
- sis_point( smesa, v0 ); \
-} while (0)
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define SIS_OFFSET_BIT 0x01
-#define SIS_TWOSIDE_BIT 0x02
-#define SIS_UNFILLED_BIT 0x04
-#define SIS_FALLBACK_BIT 0x08
-#define SIS_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[SIS_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & SIS_FALLBACK_BIT)
-#define DO_OFFSET (IND & SIS_OFFSET_BIT)
-#define DO_UNFILLED (IND & SIS_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & SIS_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX sisVertex
-#define TAB rast_tab
-
-#define DEPTH_SCALE smesa->depth_scale
-#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) (smesa->verts + (e * smesa->vertex_size * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- sis_color_t *color = (sis_color_t *)&((v)->ui[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-
-#define VERT_SET_SPEC( v0, c ) \
-do { \
- if (havespec) { \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- if (havespec) { \
- v0->v.specular.red = v1->v.specular.red; \
- v0->v.specular.green = v1->v.specular.green; \
- v0->v.specular.blue = v1->v.specular.blue; \
- } \
-} while (0)
-
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (smesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (smesa->vertex_size == 4 ? 0 : 1); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (smesa->hw_primitive != hw_prim[x]) \
- sisRasterPrimitive( ctx, hw_prim[x] )
-#define RENDER_PRIMITIVE smesa->render_primitive
-#define IND SIS_FALLBACK_BIT
-#define TAG(x) x
-#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 (SIS_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT|SIS_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_OFFSET_BIT|SIS_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT|SIS_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT|SIS_OFFSET_BIT|SIS_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_OFFSET_BIT|SIS_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT|SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT|SIS_OFFSET_BIT|SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_UNFILLED_BIT|SIS_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_OFFSET_BIT|SIS_UNFILLED_BIT|SIS_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT|SIS_UNFILLED_BIT|SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (SIS_TWOSIDE_BIT|SIS_OFFSET_BIT|SIS_UNFILLED_BIT| \
- SIS_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-
-/***********************************************************************
- * 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
-sis_fallback_tri( sisContextPtr smesa,
- sisVertex *v0,
- sisVertex *v1,
- sisVertex *v2 )
-{
- GLcontext *ctx = smesa->glCtx;
- SWvertex v[3];
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swsetup_Translate( ctx, v2, &v[2] );
- sisSpanRenderStart( ctx );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
- sisSpanRenderFinish( ctx );
- _swrast_flush( ctx );
-}
-
-
-static void
-sis_fallback_line( sisContextPtr smesa,
- sisVertex *v0,
- sisVertex *v1 )
-{
- GLcontext *ctx = smesa->glCtx;
- SWvertex v[2];
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- sisSpanRenderStart( ctx );
- _swrast_Line( ctx, &v[0], &v[1] );
- sisSpanRenderFinish( ctx );
- _swrast_flush( ctx );
-}
-
-
-static void
-sis_fallback_point( sisContextPtr smesa,
- sisVertex *v0 )
-{
- GLcontext *ctx = smesa->glCtx;
- SWvertex v[1];
- _swsetup_Translate( ctx, v0, &v[0] );
- sisSpanRenderStart( ctx );
- _swrast_Point( ctx, &v[0] );
- sisSpanRenderFinish( ctx );
- _swrast_flush( ctx );
-}
-
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define IND 0
-#define V(x) (sisVertex *)(vertptr + (x * vertsize * sizeof(int)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- POINT( V(ELT(start)) )
-#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
-#define RENDER_TRI( v0, v1, v2 ) TRI( V(v0), V(v1), V(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) QUAD( V(v0), V(v1), V(v2), V(v3) )
-#define INIT(x) sisRenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- sisContextPtr smesa = SIS_CONTEXT(ctx); \
- const GLuint vertsize = smesa->vertex_size; \
- const char *vertptr = (char *)smesa->verts; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) sis_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) sis_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH)
-#define TRI_FALLBACK (DD_TRI_STIPPLE|DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-#define _SIS_NEW_RENDER_STATE (ANY_RASTER_FLAGS | ANY_FALLBACK_FLAGS)
-
-static void sisChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT( ctx );
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= SIS_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= SIS_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= SIS_UNFILLED_BIT;
- }
-
- smesa->draw_point = sis_point;
- smesa->draw_line = sis_line;
- smesa->draw_tri = sis_triangle;
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS) {
- if (flags & POINT_FALLBACK)
- smesa->draw_point = sis_fallback_point;
- if (flags & LINE_FALLBACK)
- smesa->draw_line = sis_fallback_line;
- if (flags & TRI_FALLBACK)
- smesa->draw_tri = sis_fallback_tri;
- index |= SIS_FALLBACK_BIT;
- }
- }
-
- if (index != smesa->RenderIndex) {
- smesa->RenderIndex = index;
-
- 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 = sis_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = sis_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = sis_fast_clipped_poly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- }
- }
-}
-
-/**********************************************************************/
-/* Multipass rendering for front buffering */
-/**********************************************************************/
-static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
-
- if (pass >= smesa->driDrawable->numClipRects) {
- return GL_FALSE;
- } else {
- GLint x1, y1, x2, y2;
-
- x1 = smesa->driDrawable->pClipRects[pass].x1 - smesa->driDrawable->x;
- y1 = smesa->driDrawable->pClipRects[pass].y1 - smesa->driDrawable->y;
- x2 = smesa->driDrawable->pClipRects[pass].x2 - smesa->driDrawable->x;
- y2 = smesa->driDrawable->pClipRects[pass].y2 - smesa->driDrawable->y;
-
- if (ctx->Scissor.Enabled) {
- GLint scisy1 = Y_FLIP(ctx->Scissor.Y + ctx->Scissor.Height - 1);
- GLint scisy2 = Y_FLIP(ctx->Scissor.Y);
-
- if (ctx->Scissor.X > x1)
- x1 = ctx->Scissor.X;
- if (scisy1 > y1)
- y1 = scisy1;
- if (ctx->Scissor.X + ctx->Scissor.Width - 1 < x2)
- x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
- if (scisy2 < y2)
- y2 = scisy2;
- }
-
- MMIO(REG_3D_ClipTopBottom, y1 << 13 | y2);
- MMIO(REG_3D_ClipLeftRight, x1 << 13 | x2);
- /* Mark that we clobbered these registers */
- smesa->GlobalFlag |= GFLAG_CLIPPING;
- return GL_TRUE;
- }
-}
-
-
-
-/**********************************************************************/
-/* Validate state at pipeline start */
-/**********************************************************************/
-
-static void sisRunPipeline( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT( ctx );
-
- if (!smesa->Fallback && smesa->NewGLState) {
- if (smesa->NewGLState & _NEW_TEXTURE) {
- SIS_FIREVERTICES(smesa);
- sisUpdateTextureState(ctx);
- }
-
- if (smesa->NewGLState & _SIS_NEW_RENDER_STATE)
- sisChooseRenderState( ctx );
-
- smesa->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-
- /* XXX: If we put flushing in sis_state.c and friends, we can avoid this.
- * Is it worth it?
- */
- SIS_FIREVERTICES(smesa);
-}
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-/* This is called when Mesa switches between rendering triangle
- * primitives (such as GL_POLYGON, GL_QUADS, GL_TRIANGLE_STRIP, etc),
- * and lines, points and bitmaps.
- */
-
-static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- if (smesa->hw_primitive != hwprim) {
- SIS_FIREVERTICES(smesa);
- smesa->hw_primitive = hwprim;
- smesa->AGPParseSet &= ~(MASK_PsDataType | MASK_PsShadingMode);
- smesa->dwPrimitiveSet &= ~(MASK_DrawPrimitiveCommand |
- MASK_SetFirePosition | MASK_ShadingMode);
- smesa->AGPParseSet |= hw_prim_agp_type[hwprim];
- smesa->dwPrimitiveSet |= hwprim | hw_prim_mmio_fire[hwprim];
- if (ctx->Light.ShadeModel == GL_FLAT) {
- smesa->AGPParseSet |= hw_prim_agp_shade[hwprim];
- smesa->dwPrimitiveSet |= hw_prim_mmio_shade[hwprim];
- } else {
- smesa->AGPParseSet |= MASK_PsShadingSmooth;
- smesa->dwPrimitiveSet |= SHADE_GOURAUD;
- }
- }
-}
-
-static void sisRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
-
- smesa->render_primitive = prim;
-
- if (prim >= GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
- sisRasterPrimitive( ctx, hw_prim[prim] );
-}
-
-#define EMIT_ATTR( ATTR, STYLE) \
-do { \
- smesa->vertex_attrs[smesa->vertex_attr_count].attrib = (ATTR); \
- smesa->vertex_attrs[smesa->vertex_attr_count].format = (STYLE); \
- smesa->vertex_attr_count++; \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- smesa->vertex_attrs[smesa->vertex_attr_count].attrib = 0; \
- smesa->vertex_attrs[smesa->vertex_attr_count].format = EMIT_PAD; \
- smesa->vertex_attrs[smesa->vertex_attr_count].offset = (N); \
- smesa->vertex_attr_count++; \
-} while (0)
-
-#define SIS_TCL_STATE_BITS \
- (_TNL_BITS_TEX_ANY | _TNL_BIT_COLOR1 | _TNL_BIT_FOG)
-
-static void sisRenderStart( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLuint AGPParseSet = smesa->AGPParseSet;
- GLboolean tex_fallback = GL_FALSE;
-
- if (ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT &&
- smesa->driDrawable->numClipRects != 0)
- {
- multipass_cliprect(ctx, 0);
- if (smesa->driDrawable->numClipRects > 1)
- tnl->Driver.Render.Multipass = multipass_cliprect;
- else
- tnl->Driver.Render.Multipass = NULL;
- } else {
- tnl->Driver.Render.Multipass = NULL;
- }
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- smesa->vertex_attr_count = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to build up a
- * hardware vertex.
- */
-
- AGPParseSet &= ~(MASK_VertexDWSize | MASK_VertexDataFormat);
- AGPParseSet |= SiS_PS_HAS_XYZ | SiS_PS_HAS_DIFFUSE;
- if (index & _TNL_BITS_TEX_ANY) {
- EMIT_ATTR(_TNL_ATTRIB_POS, EMIT_4F_VIEWPORT);
- AGPParseSet |= SiS_PS_HAS_W;
- } else {
- EMIT_ATTR(_TNL_ATTRIB_POS, EMIT_3F_VIEWPORT);
- }
-
- EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA);
-
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- AGPParseSet |= SiS_PS_HAS_SPECULAR;
-
- if (index & _TNL_BIT_COLOR1) {
- EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR);
- } else {
- EMIT_PAD(3);
- }
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1UB_1F);
- else
- EMIT_PAD(1);
- }
-
- /* projective textures are not supported by the hardware */
- if (index & _TNL_BIT_TEX(0)) {
- if (VB->TexCoordPtr[0]->size > 2)
- tex_fallback = GL_TRUE;
- EMIT_ATTR(_TNL_ATTRIB_TEX0, EMIT_2F);
- AGPParseSet |= SiS_PS_HAS_UV0;
- }
- if (index & _TNL_BIT_TEX(1)) {
- if (VB->TexCoordPtr[1]->size > 2)
- tex_fallback = GL_TRUE;
- EMIT_ATTR(_TNL_ATTRIB_TEX1, EMIT_2F);
- AGPParseSet |= SiS_PS_HAS_UV1;
- }
- FALLBACK(smesa, SIS_FALLBACK_TEXTURE, tex_fallback);
-
- if (smesa->last_tcl_state != index) {
- smesa->AGPParseSet = AGPParseSet;
-
- smesa->vertex_size = _tnl_install_attrs( ctx, smesa->vertex_attrs,
- smesa->vertex_attr_count, smesa->hw_viewport, 0 );
-
- smesa->vertex_size >>= 2;
- smesa->AGPParseSet |= smesa->vertex_size << 28;
- }
-}
-
-static void sisRenderFinish( GLcontext *ctx )
-{
-}
-
-/**********************************************************************/
-/* AGP/PCI vertex submission */
-/**********************************************************************/
-
-void
-sisFlushPrimsLocked(sisContextPtr smesa)
-{
- if (smesa->vb_cur == smesa->vb_last)
- return;
-
- sisUpdateHWState(smesa->glCtx);
-
- if (smesa->using_agp) {
- mWait3DCmdQueue(8);
- mEndPrimitive();
- MMIO(REG_3D_AGPCmBase, (smesa->vb_last - smesa->vb) +
- smesa->vb_agp_offset);
- MMIO(REG_3D_AGPTtDwNum, ((smesa->vb_cur - smesa->vb_last) / 4) |
- 0x50000000);
- MMIO(REG_3D_ParsingSet, smesa->AGPParseSet);
- MMIO(REG_3D_AGPCmFire, (GLint)(-1));
- mEndPrimitive();
- } else {
- int mmio_index = 0, incr = 0;
- void (*sis_emit_func)(sisContextPtr smesa, char *verts) = NULL;
-
- if (smesa->AGPParseSet & MASK_PsShadingSmooth)
- mmio_index |= VERT_SMOOTH;
- if (smesa->AGPParseSet & SiS_PS_HAS_SPECULAR)
- mmio_index |= VERT_SPEC;
- if (smesa->AGPParseSet & SiS_PS_HAS_W)
- mmio_index |= VERT_W;
- if (smesa->AGPParseSet & SiS_PS_HAS_UV0)
- mmio_index |= VERT_UV0;
- if (smesa->AGPParseSet & SiS_PS_HAS_UV1)
- mmio_index |= VERT_UV1;
-
- switch (smesa->AGPParseSet & MASK_PsDataType) {
- case MASK_PsPointList:
- incr = smesa->vertex_size * 4;
- sis_emit_func = sis_point_func_mmio[mmio_index];
- break;
- case MASK_PsLineList:
- incr = smesa->vertex_size * 4 * 2;
- sis_emit_func = sis_line_func_mmio[mmio_index];
- break;
- case MASK_PsTriangleList:
- incr = smesa->vertex_size * 4 * 3;
- sis_emit_func = sis_tri_func_mmio[mmio_index];
- break;
- }
-
- mWait3DCmdQueue(1);
- MMIO(REG_3D_PrimitiveSet, smesa->dwPrimitiveSet);
- while (smesa->vb_last < smesa->vb_cur) {
- sis_emit_func(smesa, smesa->vb_last);
- smesa->vb_last += incr;
- }
- mWait3DCmdQueue(1);
- mEndPrimitive();
-
- /* With PCI, we can just start writing to the start of the VB again. */
- smesa->vb_cur = smesa->vb;
- }
- smesa->vb_last = smesa->vb_cur;
-}
-
-void sisFlushPrims(sisContextPtr smesa)
-{
- LOCK_HARDWARE();
- sisFlushPrimsLocked(smesa);
- UNLOCK_HARDWARE();
-}
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- GLuint oldfallback = smesa->Fallback;
-
- if (mode) {
- smesa->Fallback |= bit;
- if (oldfallback == 0) {
- SIS_FIREVERTICES(smesa);
- _swsetup_Wakeup( ctx );
- smesa->RenderIndex = ~0;
- }
- }
- else {
- smesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = sisRenderStart;
- tnl->Driver.Render.PrimitiveNotify = sisRenderPrimitive;
- tnl->Driver.Render.Finish = sisRenderFinish;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_invalidate_vertex_state( ctx, ~0 );
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_install_attrs( ctx,
- smesa->vertex_attrs,
- smesa->vertex_attr_count,
- smesa->hw_viewport, 0 );
-
- smesa->NewGLState |= _SIS_NEW_RENDER_STATE;
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-void sisInitTriFuncs( GLcontext *ctx )
-{
- sisContextPtr smesa = SIS_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
-
- sis_vert_init_none();
- sis_vert_init_g();
- sis_vert_init_w();
- sis_vert_init_gw();
- sis_vert_init_s();
- sis_vert_init_gs();
- sis_vert_init_ws();
- sis_vert_init_gws();
- sis_vert_init_t0();
- sis_vert_init_gt0();
- sis_vert_init_wt0();
- sis_vert_init_gwt0();
- sis_vert_init_st0();
- sis_vert_init_gst0();
- sis_vert_init_wst0();
- sis_vert_init_gwst0();
- sis_vert_init_t1();
- sis_vert_init_gt1();
- sis_vert_init_wt1();
- sis_vert_init_gwt1();
- sis_vert_init_st1();
- sis_vert_init_gst1();
- sis_vert_init_wst1();
- sis_vert_init_gwst1();
- sis_vert_init_t0t1();
- sis_vert_init_gt0t1();
- sis_vert_init_wt0t1();
- sis_vert_init_gwt0t1();
- sis_vert_init_st0t1();
- sis_vert_init_gst0t1();
- sis_vert_init_wst0t1();
- sis_vert_init_gwst0t1();
- }
-
- if (driQueryOptionb(&smesa->optionCache, "fallback_force"))
- sisFallback(ctx, SIS_FALLBACK_FORCE, 1);
- else
- sisFallback(ctx, SIS_FALLBACK_FORCE, 0);
-
- smesa->RenderIndex = ~0;
- smesa->NewGLState |= _SIS_NEW_RENDER_STATE;
-
- tnl->Driver.RunPipeline = sisRunPipeline;
- tnl->Driver.Render.Start = sisRenderStart;
- tnl->Driver.Render.Finish = sisRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = sisRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- (6 + 2*ctx->Const.MaxTextureUnits) * sizeof(GLfloat) );
-
- smesa->verts = (char *)tnl->clipspace.vertex_buf;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.h
deleted file mode 100644
index 5e07acc21..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tris.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.8 2002/10/30 12:51:43 alanh Exp $ */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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 <anholt@FreeBSD.org>
- */
-
-#ifndef __SIS_TRIS_H__
-#define __SIS_TRIS_H__
-
-#include "sis_lock.h"
-#include "mtypes.h"
-
-extern void sisInitTriFuncs( GLcontext *ctx );
-extern void sisFlushPrims( sisContextPtr smesa );
-extern void sisFlushPrimsLocked( sisContextPtr smesa );
-extern void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-
-#define FALLBACK( smesa, bit, mode ) sisFallback( smesa->glCtx, bit, mode )
-
-#define SIS_FIREVERTICES(smesa) \
-do { \
- if (smesa->vb_cur != smesa->vb_last) \
- sisFlushPrims(smesa); \
-} while (0)
-
-static __inline GLuint *sisAllocDmaLow(sisContextPtr smesa, int bytes)
-{
- GLuint *start;
-
- if (smesa->vb_cur + bytes >= smesa->vb_end) {
- LOCK_HARDWARE();
- sisFlushPrimsLocked(smesa);
- if (smesa->using_agp) {
- WaitEngIdle(smesa);
- smesa->vb_cur = smesa->vb;
- smesa->vb_last = smesa->vb_cur;
- }
- UNLOCK_HARDWARE();
- }
-
- start = (GLuint *)smesa->vb_cur;
- smesa->vb_cur += bytes;
- return start;
-}
-
-#endif /* __SIS_TRIS_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tritmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tritmp.h
deleted file mode 100644
index bd2ecd1c4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/sis/sis_tritmp.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $XFree86*/ /* -*- c-basic-offset: 3 -*- */
-/**************************************************************************
-
-Copyright 2003 Eric Anholt
-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, 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
-ERIC ANHOLT 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 <anholt@FreeBSD.org>
- */
-
-static void TAG(sis_draw_tri_mmio)(sisContextPtr smesa, char *verts)
-{
- sisVertexPtr v0 = (sisVertexPtr)verts;
- sisVertexPtr v1 = (sisVertexPtr)(verts + smesa->vertex_size * 4);
- sisVertexPtr v2 = (sisVertexPtr)(verts + smesa->vertex_size * 4 * 2);
-
- mWait3DCmdQueue (MMIO_VERT_REG_COUNT * 3);
- SIS_MMIO_WRITE_VERTEX(v0, 0, 0);
- SIS_MMIO_WRITE_VERTEX(v1, 1, 0);
- SIS_MMIO_WRITE_VERTEX(v2, 2, 1);
-}
-
-static void TAG(sis_draw_line_mmio)(sisContextPtr smesa, char *verts)
-{
- sisVertexPtr v0 = (sisVertexPtr)verts;
- sisVertexPtr v1 = (sisVertexPtr)(verts + smesa->vertex_size * 4);
-
- mWait3DCmdQueue (MMIO_VERT_REG_COUNT * 2);
- SIS_MMIO_WRITE_VERTEX(v0, 0, 0);
- SIS_MMIO_WRITE_VERTEX(v1, 1, 1);
-}
-
-static void TAG(sis_draw_point_mmio)(sisContextPtr smesa, char *verts)
-{
- sisVertexPtr v0 = (sisVertexPtr)verts;
-
- mWait3DCmdQueue (MMIO_VERT_REG_COUNT * 1);
- SIS_MMIO_WRITE_VERTEX(v0, 1, 1);
-}
-
-static __inline void TAG(sis_vert_init)( void )
-{
- sis_tri_func_mmio[SIS_STATES] = TAG(sis_draw_tri_mmio);
- sis_line_func_mmio[SIS_STATES] = TAG(sis_draw_line_mmio);
- sis_point_func_mmio[SIS_STATES] = TAG(sis_draw_point_mmio);
-}
-
-#undef TAG
-#undef SIS_STATES
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/BUGS b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/BUGS
deleted file mode 100644
index b15f6a91e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/BUGS
+++ /dev/null
@@ -1,64 +0,0 @@
-REMOVE THIS FILE BEFORE MERGING WITH TRUNK
-------------------------------------------
-
-OUTSTANDING BUGS
-
-demos/reflect - reading back Z on Voodoo3, image offset to right
- Fixed in latest Glide.
-
-Q3 - some polygons drawn as vertical strips, similar to bug that was
- seen in demos/fire. Voodoo3 only. May be related to glDepthMask
- or glColorMask.
-
-book/fog - not fogging
- Fog in orthograph mode still not implemented. Checking with
- 3dfx engineers for ideas.
-
-Q3 demo crashes after changing display settings
- but the full Q3 game version seems OK.
-
-
-
-MORE OUTSTANDING BUGS
-
-private context was NULL! causing immediate failure of any glx prog. cant
-reproduce after restarting the X server. putting it down as halluc.
-
-texture object image was NULL, causing segmentation failure. happens with
-prboom. ive put a check in tdfx_texstate.c but this isn't a fix.
-
-prboom, wall textures near first chainsaw aren't bound properly. sideways
-movements causes the wall textures to move with you. prboom busted?
-
-16bpp mode, quake3, windowed, q3dm1, floor under rocketlauncher bands. it
-looks like multitexturing gone wrong. i'll disable a tmu and test.
-
-sof, polygons appear at wrong x,y,z positions, intermittent, have not yet
-found reliable way of reproducing. culling? sometimes polys disappear.
-
-descent3 is all black in 16bpp mode - FIXED (palette problems)
-
-smeared pixels in quake3 - FIXED (texture memory overlapped FB)
-
-
-
-PERFORMANCE COMPARISON (Brian / Alan)
-
- V3/16 is Voodoo3 in 16bpp on a P3/500
- V5/16 is Voodoo5 in 16bpp on a P3/600
- V5/32 is Voodoo5 in 32bpp on a P3/600
- V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600
- V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600
-
- tdfx-2-1-branch tdfx-3-0-0-branch
-demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32
-------------------------------------------------------------------------
-gloss 257 183 174 320 308 177 313 167
-fire 42 39 52 41
-fire (no help) 98 80 50 106 113 73 124 80
-tunnel 61 50 70 58
-tunnel (no help) 167 142 57 138 152 113 171 122
-gears 663 554 540 881 1232 776 1484 830
-teapot 20 21 37 36
-teapot (no help) 22 14 14 24 30 30 43 42
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/Makefile
deleted file mode 100644
index 092c580fe..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-# src/mesa/drivers/dri/tdfx/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = tdfx_dri.so
-
-# not yet
-# MINIGLX_SOURCES = server/tdfx_dri.c
-
-DRIVER_SOURCES = \
- tdfx_context.c \
- tdfx_dd.c \
- tdfx_lock.c \
- tdfx_pixels.c \
- tdfx_render.c \
- tdfx_screen.c \
- tdfx_span.c \
- tdfx_state.c \
- tdfx_tex.c \
- tdfx_texman.c \
- tdfx_texstate.c \
- tdfx_tris.c \
- tdfx_vb.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S
deleted file mode 100644
index 0f4cc4508..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fastpath.S,v 1.2 2000/09/26 15:56:51 tsi Exp $ */
-
-#include "../../X86/assyntax.h"
-
-#define SETUP_RGBA 0x1
-#define SETUP_TMU0 0x2
-#define SETUP_TMU1 0x4
-
-
-/* Pack either rgba or texture into the remaining half of a 32 byte vertex.
- */
-#define CLIP_R 24
-#define CLIP_G 16
-#define CLIP_B 20
-#define CLIP_A 28 /* defined inf fxdrv.h */
-
-#define CLIP_S0 16
-#define CLIP_T0 20
-#define CLIP_S1 24
-#define CLIP_T1 28
-
-#define SIZE 4
-#define TYPE (0)
-#define TAG(x) x
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 8
-#define TYPE (SETUP_RGBA)
-#define TAG(x) x##_RGBA
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 6
-#define TYPE (SETUP_TMU0)
-#define TAG(x) x##_TMU0
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 8
-#define TYPE (SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_TMU0_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-#undef CLIP_S1
-#undef CLIP_T1
-#define CLIP_S1 16
-#define CLIP_T1 20
-
-#define SIZE 6
-#define TYPE (SETUP_TMU1)
-#define TAG(x) x##_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-/* These three need to use a full 64 byte clip-space vertex.
- */
-#undef CLIP_S0
-#undef CLIP_T0
-#undef CLIP_S1
-#undef CLIP_T1
-
-#define CLIP_S0 32
-#define CLIP_T0 36
-#define CLIP_S1 40
-#define CLIP_T1 44
-
-#define SIZE 10
-#define TYPE (SETUP_RGBA|SETUP_TMU0)
-#define TAG(x) x##_RGBA_TMU0
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 12
-#define TYPE (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_RGBA_TMU0_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-#undef CLIP_S1
-#undef CLIP_T1
-#define CLIP_S1 32
-#define CLIP_T1 36
-
-#define SIZE 10
-#define TYPE (SETUP_RGBA|SETUP_TMU1)
-#define TAG(x) x##_RGBA_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h
deleted file mode 100644
index 9ec4935d7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fasttmp.h,v 1.2 2000/09/26 15:56:51 tsi Exp $ */
-
-#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER)
-#define TAGLLBL(a) TAG(.L##a)
-#else
-#define TAGLLBL(a) TAG(a)
-#endif
-
-#if !GLIDE3
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 4
-#define GR_VERTEX_Z_OFFSET 8
-#define GR_VERTEX_R_OFFSET 12
-#define GR_VERTEX_G_OFFSET 16
-#define GR_VERTEX_B_OFFSET 20
-#define GR_VERTEX_OOZ_OFFSET 24
-#define GR_VERTEX_A_OFFSET 28
-#define GR_VERTEX_OOW_OFFSET 32
-
-#else /* GLIDE3 */
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 4
-#define GR_VERTEX_OOZ_OFFSET 8
-#define GR_VERTEX_OOW_OFFSET 12
-#define GR_VERTEX_R_OFFSET 16
-#define GR_VERTEX_G_OFFSET 20
-#define GR_VERTEX_B_OFFSET 24
-#define GR_VERTEX_A_OFFSET 28
-#define GR_VERTEX_Z_OFFSET 32
-
-#endif /* GLIDE3 */
-
-#define GR_VERTEX_SOW_TMU0_OFFSET 36
-#define GR_VERTEX_TOW_TMU0_OFFSET 40
-#define GR_VERTEX_OOW_TMU0_OFFSET 44
-#define GR_VERTEX_SOW_TMU1_OFFSET 48
-#define GR_VERTEX_TOW_TMU1_OFFSET 52
-#define GR_VERTEX_OOW_TMU1_OFFSET 56
-
-
-
-
-/*#define MAT_SX 0 /* accessed by REGIND !! */
-#define MAT_SY 20
-#define MAT_SZ 40
-#define MAT_TX 48
-#define MAT_TY 52
-#define MAT_TZ 56
-
-
-
-
-/* Do viewport map, device scale and perspective projection.
- *
- * void project_verts( GLfloat *first,
- * GLfloat *last,
- * const GLfloat *m,
- * GLuint stride )
- *
- *
- * Rearrange fxVertices to look like grVertices.
- */
-
-GLOBL GLNAME( TAG(fx_3dnow_project_vertices) )
-GLNAME( TAG(fx_3dnow_project_vertices) ):
-
- PUSH_L ( EBP )
-
- MOV_L ( REGOFF(8, ESP), ECX ) /* first_vert */
- MOV_L ( REGOFF(12, ESP), EDX ) /* last_vert */
-
- CMP_L ( ECX, EDX )
- JE ( TAGLLBL(FXPV_end) )
-
- FEMMS
-
- PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
-
- MOV_L ( REGOFF(16, ESP), EBP ) /* matrix */
- MOV_L ( REGOFF(20, ESP), EAX ) /* stride */
-
- MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
- PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
-
-#if !defined(FX_V2)
- MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
- MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
-#endif
-
- MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
- PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
-
- MOVD ( REGIND(EBP), MM5 )
- PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
-
- MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
-
-
-ALIGNTEXT32
-TAGLLBL(FXPV_loop_start):
-
- PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
-
-
- MOVD ( REGOFF(12, ECX), MM0 ) /* | f[3] */
- PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
-
- MOVD ( REGOFF(12, ECX), MM7 ) /* | f[3] */
- PFRCPIT1 ( MM0, MM7 )
- PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
-
- PUNPCKLDQ ( MM7, MM7 )
-
-
-#if (TYPE & SETUP_RGBA)
- MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
- MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
-#endif
-
-#if (TYPE & SETUP_TMU1)
- MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
- PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
-#endif
-
-
-#if (TYPE & SETUP_TMU0)
- MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
- PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
-#endif
-
-
-
-
-
-/* DO_SETUP_XYZ */
-
- MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
- PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
-
- MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
- PFMUL ( MM7, MM3 ) /* | f[2] * oow */
-
- MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
- PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
-
- PFADD ( MM0, MM3 ) /* | f[2] += vtz */
- PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
-
- PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
-
-#if !defined(FX_V2)
- PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
-#endif
-
- MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
- MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
-
-
-/* end of DO_SETUP_XYZ */
-
- MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
- ADD_L ( EAX, ECX ) /* f += stride */
-
- CMP_L ( ECX, EDX ) /* stall??? */
- JA ( TAGLLBL(FXPV_loop_start) )
-
-TAGLLBL(FXPV_end):
- FEMMS
- POP_L ( EBP )
- RET
-
-
-
-
-
-
-
-/* void project_verts( GLfloat *first,
- * GLfloat *last,
- * const GLfloat *m,
- * GLuint stride,
- * const GLubyte *mask )
- *
- */
-
-GLOBL GLNAME( TAG(fx_3dnow_project_clipped_vertices) )
-GLNAME( TAG(fx_3dnow_project_clipped_vertices) ):
-
- PUSH_L ( EBP )
-
- MOV_L ( REGOFF(8, ESP), ECX ) /* first FXDRIVER(VB)->verts*/
- MOV_L ( REGOFF(12, ESP), EDX ) /* last FXDRIVER(VB)->last_vert */
-
- FEMMS
-
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
-
- MOV_L ( REGOFF(24, ESP), EBP ) /* mat ctx->Viewport.WindowMap.M */
- MOV_L ( REGOFF(28, ESP), EAX ) /* stride */
- MOV_L ( REGOFF(32, ESP), ESI ) /* VB->ClipMask */
-
- MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
- PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
-
-#if !defined(FX_V2)
- MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
- MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
-#endif
-
- MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
- PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
-
- MOVD ( REGIND(EBP), MM5 )
- PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
-
- MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
-
-
-
-ALIGNTEXT32
-TAGLLBL(FXPCV_loop_start):
-
- PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
-
- CMP_B ( CONST(0), REGIND(ESI) )
- JNE ( TAGLLBL(FXPCV_skip) )
-
- MOVD ( REGOFF(12, ECX), MM0) /* | f[3] */
- PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
-
- MOVD ( REGOFF(12, ECX), MM7) /* | f[3] */
- PFRCPIT1 ( MM0, MM7 )
- PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
-
- PUNPCKLDQ ( MM7, MM7 )
-
-
-#if (TYPE & SETUP_RGBA)
- MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
- MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
-#endif
-
-#if (TYPE & SETUP_TMU1)
- MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
- PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
-#endif
-
-
-#if (TYPE & SETUP_TMU0)
- MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
- PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
-#endif
-
-
-
-
-/* DO_SETUP_XYZ */
-
- MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
- PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
-
- MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
- PFMUL ( MM7, MM3 ) /* | f[2] * oow */
-
- MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
- PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
-
- PFADD ( MM0, MM3 ) /* | f[2] += vtz */
- PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
-
- PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
-
-#if !defined(FX_V2)
- PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
-#endif
-
- MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
- MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
-
-
-/* end of DO_SETUP_XYZ */
-
- MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
-
-TAGLLBL(FXPCV_skip):
- ADD_L ( EAX, ECX ) /* f += stride */
-
- INC_L ( ESI ) /* next ClipMask */
- CMP_L ( ECX, EDX )
- JA ( TAGLLBL(FXPCV_loop_start) )
-
- POP_L ( ESI )
- POP_L ( EDI )
-
-TAGLLBL(FXPCV_end):
- FEMMS
- POP_L ( EBP )
- RET
-
-
-
-#undef TYPE
-#undef TAG
-#undef SIZE
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/dri_glide.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/dri_glide.h
deleted file mode 100644
index 52a53f7dd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/dri_glide.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/dri_glide.h,v 1.1 2001/03/21 16:14:26 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __DRI_GLIDE_H__
-#define __DRI_GLIDE_H__
-
-#include <glide.h>
-#include "dri_mesaint.h"
-
-/*
- * This is the private interface between Glide and the DRI.
- */
-extern void grDRIOpen( char *pFB, char *pRegs, int deviceID,
- int width, int height,
- int mem, int cpp, int stride,
- int fifoOffset, int fifoSize,
- int fbOffset, int backOffset, int depthOffset,
- int textureOffset, int textureSize,
- volatile int *fifoPtr, volatile int *fifoRead );
-extern void grDRIPosition( int x, int y, int w, int h,
- int numClip, drm_clip_rect_t *pClip );
-extern void grDRILostContext( void );
-extern void grDRIImportFifo( int fifoPtr, int fifoRead );
-extern void grDRIInvalidateAll( void );
-extern void grDRIResetSAREA( void );
-extern void grDRIBufferSwap( FxU32 swapInterval );
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c
deleted file mode 100644
index 63fe875f5..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h
deleted file mode 100644
index acd0b9ae5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/server/tdfx_dri.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.5 2001/03/21 17:02:26 dawes Exp $ */
-
-#ifndef _TDFX_DRI_
-#define _TDFX_DRI_
-
-#include "xf86drm.h"
-#include "drm.h"
-
-typedef struct {
- drm_handle_t regs;
- drmSize regsSize;
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int stride;
- int fifoOffset;
- int fifoSize;
- int fbOffset;
- int backOffset;
- int depthOffset;
- int textureOffset;
- int textureSize;
- unsigned int sarea_priv_offset;
-} TDFXDRIRec, *TDFXDRIPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.c
deleted file mode 100644
index 412a2791d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.c,v 1.12 2003/05/08 09:25:35 herrb Exp $ */
-
-/*
- * New fixes:
- * Daniel Borca <dborca@users.sourceforge.net>, 19 Jul 2004
- *
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include <dlfcn.h>
-#include "tdfx_context.h"
-#include "tdfx_dd.h"
-#include "tdfx_state.h"
-#include "tdfx_vb.h"
-#include "tdfx_tex.h"
-#include "tdfx_tris.h"
-#include "tdfx_render.h"
-#include "tdfx_span.h"
-#include "tdfx_texman.h"
-#include "extensions.h"
-#include "hash.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "utils.h"
-
-#define need_GL_ARB_multisample
-/* #define need_GL_ARB_point_parameters */
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-/* #define need_GL_ARB_vertex_program */
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_paletted_texture
-/* #define need_GL_EXT_secondary_color */
-#define need_GL_IBM_multimode_draw_arrays
-/* #define need_GL_MESA_program_debug */
-/* #define need_GL_NV_vertex_program */
-#include "extension_helper.h"
-
-
-/**
- * Common extension strings exported by all cards
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
-
- { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
- { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
- { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
- { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions },
- { "GL_EXT_shared_texture_palette", NULL },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_env_add", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_HP_occlusion_test", NULL },
- { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions },
-
-#ifdef need_GL_ARB_point_parameters
- { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
- { "GL_ARB_point_sprite", NULL },
-#endif
-#ifdef need_GL_EXT_secondary_color
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
-#endif
-#ifdef need_GL_ARB_vertex_program
- { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }
-#endif
-#ifdef need_GL_NV_vertex_program
- { "GL_NV_vertex_program", GL_NV_vertex_program_functions }
- { "GL_NV_vertex_program1_1", NULL },
-#endif
-#ifdef need_GL_MESA_program_debug
- { "GL_MESA_program_debug", GL_MESA_program_debug_functions },
-#endif
- { NULL, NULL }
-};
-
-/**
- * Extension strings exported only by Naplam (e.g., Voodoo4 & Voodoo5) cards.
- */
-const struct dri_extension napalm_extensions[] =
-{
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_env_combine", NULL },
- { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
- { "GL_EXT_blend_subtract", GL_EXT_blend_minmax_functions },
- { "GL_EXT_texture_compression_s3tc", NULL },
- { "GL_EXT_texture_env_combine", NULL },
-
- { "GL_3DFX_texture_compression_FXT1", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_S3_s3tc", NULL },
- { NULL, NULL }
-};
-
-/*
- * Enable/Disable the extensions for this context.
- */
-static void tdfxDDInitExtensions( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- driInitExtensions( ctx, card_extensions, GL_FALSE );
-
- if ( fxMesa->haveTwoTMUs ) {
- _mesa_enable_extension( ctx, "GL_ARB_multitexture" );
- }
-
- if ( TDFX_IS_NAPALM( fxMesa ) ) {
- driInitExtensions( ctx, napalm_extensions, GL_FALSE );
- } else {
- _mesa_enable_extension( ctx, "GL_SGIS_generate_mipmap" );
- }
-}
-
-
-
-static const struct tnl_pipeline_stage *tdfx_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
-#if 0
-#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_ARB_vertex_program)
- &_tnl_arb_vertex_program_stage,
- &_tnl_vertex_program_stage,
-#endif
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-static const struct dri_debug_control debug_control[] =
-{
- { "dri", DEBUG_VERBOSE_DRI },
- { "sync", DEBUG_ALWAYS_SYNC },
- { "api", DEBUG_VERBOSE_API },
- { "fall", DEBUG_VERBOSE_FALL },
- { NULL, 0 }
-};
-
-GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate )
-{
- tdfxContextPtr fxMesa;
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private;
- TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA +
- sizeof(drm_sarea_t));
- struct dd_function_table functions;
-
- /* Allocate tdfx context */
- fxMesa = (tdfxContextPtr) CALLOC( sizeof(tdfxContextRec) );
- if (!fxMesa)
- return GL_FALSE;
-
- /* Init default driver functions then plug in our tdfx-specific functions
- * (the texture functions are especially important)
- */
- _mesa_init_driver_functions(&functions);
- tdfxDDInitDriverFuncs(mesaVis, &functions);
- tdfxInitTextureFuncs(&functions);
- tdfxInitRenderFuncs(&functions);
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((tdfxContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- fxMesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
- &functions, (void *) fxMesa);
- if (!fxMesa->glCtx) {
- FREE(fxMesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = fxMesa;
-
- /* Mirror some important DRI state
- */
- fxMesa->hHWContext = driContextPriv->hHWContext;
- fxMesa->driHwLock = &sPriv->pSAREA->lock;
- fxMesa->driFd = sPriv->fd;
-
- fxMesa->driScreen = sPriv;
- fxMesa->driContext = driContextPriv;
- fxMesa->fxScreen = fxScreen;
- fxMesa->sarea = saPriv;
-
- /*JJJ - really?*/
- fxMesa->haveHwAlpha = ( mesaVis->alphaBits &&
- ((mesaVis->greenBits == 8) ||
- (mesaVis->depthBits == 0)) );
- fxMesa->haveHwStencil = ( TDFX_IS_NAPALM( fxMesa ) &&
- mesaVis->stencilBits &&
- mesaVis->depthBits == 24 );
-
- fxMesa->screen_width = fxScreen->width;
- fxMesa->screen_height = fxScreen->height;
-
- fxMesa->new_gl_state = ~0;
- fxMesa->new_state = ~0;
- fxMesa->dirty = ~0;
-
- /* Parse configuration files */
- driParseConfigFiles (&fxMesa->optionCache, &fxScreen->optionCache,
- fxMesa->driScreen->myNum, "tdfx");
-
- /* NOTE: This must be here before any Glide calls! */
- if (!tdfxInitGlide( fxMesa )) {
- FREE(fxMesa);
- return GL_FALSE;
- }
-
- fxMesa->Glide.grDRIOpen( (char*) sPriv->pFB, fxScreen->regs.map, fxScreen->deviceID,
- fxScreen->width, fxScreen->height, fxScreen->mem, fxScreen->cpp,
- fxScreen->stride, fxScreen->fifoOffset, fxScreen->fifoSize,
- fxScreen->fbOffset, fxScreen->backOffset, fxScreen->depthOffset,
- fxScreen->textureOffset, fxScreen->textureSize, &saPriv->fifoPtr,
- &saPriv->fifoRead );
-
- if ( getenv( "FX_GLIDE_SWAPINTERVAL" ) ) {
- fxMesa->Glide.SwapInterval = atoi( getenv( "FX_GLIDE_SWAPINTERVAL" ) );
- } else {
- fxMesa->Glide.SwapInterval = 0;
- }
- if ( getenv( "FX_MAX_PENDING_SWAPS" ) ) {
- fxMesa->Glide.MaxPendingSwaps = atoi( getenv( "FX_MAX_PENDING_SWAPS" ) );
- } else {
- fxMesa->Glide.MaxPendingSwaps = 2;
- }
-
- fxMesa->Glide.Initialized = GL_FALSE;
- fxMesa->Glide.Board = 0;
-
-
- if (getenv("FX_EMULATE_SINGLE_TMU")) {
- fxMesa->haveTwoTMUs = GL_FALSE;
- }
- else {
- if ( TDFX_IS_BANSHEE( fxMesa ) ) {
- fxMesa->haveTwoTMUs = GL_FALSE;
- } else {
- fxMesa->haveTwoTMUs = GL_TRUE;
- }
- }
-
- fxMesa->stats.swapBuffer = 0;
- fxMesa->stats.reqTexUpload = 0;
- fxMesa->stats.texUpload = 0;
- fxMesa->stats.memTexUpload = 0;
-
- fxMesa->tmuSrc = TDFX_TMU_NONE;
-
- ctx = fxMesa->glCtx;
- if ( TDFX_IS_NAPALM( fxMesa ) ) {
- ctx->Const.MaxTextureLevels = 12;
- } else {
- ctx->Const.MaxTextureLevels = 9;
- }
- ctx->Const.MaxTextureUnits = TDFX_IS_BANSHEE( fxMesa ) ? 1 : 2;
- ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
- ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
-
- /* 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;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, tdfx_pipeline );
-
- /* Configure swrast and T&L to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_TRUE );
- _swrast_allow_vertex_fog( ctx, GL_FALSE );
- _tnl_allow_pixel_fog( ctx, GL_TRUE );
- _tnl_allow_vertex_fog( ctx, GL_FALSE );
-
- tdfxDDInitExtensions( ctx );
- /* XXX these should really go right after _mesa_init_driver_functions() */
- tdfxDDInitSpanFuncs( ctx );
- tdfxDDInitStateFuncs( ctx );
- tdfxDDInitTriFuncs( ctx );
- tdfxInitVB( ctx );
- tdfxInitState( fxMesa );
-
-#if DO_DEBUG
- TDFX_DEBUG = driParseDebugString( getenv( "TDFX_DEBUG" ), debug_control );
-#endif
-
- if (driQueryOptionb(&fxMesa->optionCache, "no_rast")) {
- fprintf(stderr, "disabling 3D acceleration\n");
- FALLBACK(fxMesa, TDFX_FALLBACK_DISABLE, 1);
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa )
-{
- FxI32 result;
- int i;
-
- LOCK_HARDWARE( fxMesa );
-
- fxMesa->Glide.grGet( GR_GLIDE_VERTEXLAYOUT_SIZE, sizeof(FxI32), &result );
- for ( i = 0 ; i < TDFX_NUM_LAYOUTS ; i++ ) {
- fxMesa->layout[i] = MALLOC( result );
- if ( !fxMesa->layout[i] ) {
- UNLOCK_HARDWARE( fxMesa );
- return GL_FALSE;
- }
- }
-
- /* Tiny vertex format - 16 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_TINY] );
-
- /* Non textured vertex format - 24 bytes (Need w for table fog)
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_NOTEX] );
-
- /* Single textured vertex format - 32 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_SINGLE] );
-
- /* Multitextured vertex format - 40 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_MULTI] );
-
- /* Projected texture vertex format - 36 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJ1] );
-
- /* Projected multitexture vertex format - 48 bytes.
- */
- fxMesa->Glide.grReset( GR_VERTEX_PARAMETER );
- fxMesa->Glide.grCoordinateSpace( GR_WINDOW_COORDS );
- fxMesa->Glide.grVertexLayout( GR_PARAM_XY, TDFX_XY_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Z, TDFX_Z_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q, TDFX_Q_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_PARGB, TDFX_ARGB_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST0, TDFX_ST0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q0, TDFX_Q0_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_ST1, TDFX_ST1_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grVertexLayout( GR_PARAM_Q1, TDFX_Q1_OFFSET, GR_PARAM_ENABLE );
- fxMesa->Glide.grGlideGetVertexLayout( fxMesa->layout[TDFX_LAYOUT_PROJ2] );
-
- UNLOCK_HARDWARE( fxMesa );
-
- return GL_TRUE;
-}
-
-
-/*
- * Initialize the state in an tdfxContextPtr struct.
- */
-static GLboolean
-tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, tdfxContextPtr fxMesa )
-{
- /* KW: Would be nice to make one of these a member of the other.
- */
- FxI32 result[2];
- const char *gext;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)fxMesa );
- }
-
-#if DEBUG_LOCKING
- fprintf(stderr, "Debug locking enabled\n");
-#endif
-
- if ( fxMesa->Glide.Initialized )
- return GL_TRUE;
-
- fxMesa->width = driDrawPriv->w;
- fxMesa->height = driDrawPriv->h;
-
- /* We have to use a light lock here, because we can't do any glide
- * operations yet. No use of FX_* functions in this function.
- */
- DRM_LIGHT_LOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext );
-
- fxMesa->Glide.grGlideInit();
- fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
-
- fxMesa->Glide.Context = fxMesa->Glide.grSstWinOpen( (FxU32) -1,
- GR_RESOLUTION_NONE,
- GR_REFRESH_NONE,
- fxMesa->Glide.ColorFormat,
- fxMesa->Glide.Origin,
- 2, 1 );
-
- fxMesa->Glide.grDRIResetSAREA();
-
- DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext );
-
- if ( !fxMesa->Glide.Context )
- return GL_FALSE;
-
-
- /* Perform the Glide-dependant part of the context initialization.
- */
- FX_grColorMaskv( fxMesa->glCtx, true4 );
-
- tdfxTMInit( fxMesa );
-
- LOCK_HARDWARE( fxMesa );
-
- /* JJJ - COMMAND_TRANSPORT, PALETTE6666 */
- gext = fxMesa->Glide.grGetString( GR_EXTENSION );
- fxMesa->Glide.HaveCombineExt = strstr(gext, "COMBINE") && !getenv("MESA_FX_IGNORE_CMBEXT");
- fxMesa->Glide.HaveCommandTransportExt = GL_FALSE;
- fxMesa->Glide.HaveFogCoordExt = GL_TRUE;
- fxMesa->Glide.HavePixelExt = strstr(gext, "PIXEXT") && !getenv("MESA_FX_IGNORE_PIXEXT");
- fxMesa->Glide.HaveTextureBufferExt = GL_TRUE;
- fxMesa->Glide.HaveTexFmtExt = strstr(gext, "TEXFMT") && !getenv("MESA_FX_IGNORE_TEXFMT");
- fxMesa->Glide.HaveTexUMAExt = strstr(gext, "TEXUMA") && !getenv("MESA_FX_IGNORE_TEXUMA");
- fxMesa->Glide.HaveMirrorExt = strstr(gext, "TEXMIRROR") && !getenv("MESA_FX_IGNORE_MIREXT");
- fxMesa->Glide.HaveTexus2 = GL_FALSE;
-
- if ( fxMesa->glCtx->Visual.depthBits > 0 ) {
- fxMesa->Glide.grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
- } else {
- fxMesa->Glide.grDepthBufferMode(GR_DEPTHBUFFER_DISABLE);
- }
-
- fxMesa->Glide.grLfbWriteColorFormat( GR_COLORFORMAT_ABGR );
-
- fxMesa->Glide.grGet( GR_TEXTURE_ALIGN, sizeof(FxI32), result );
- fxMesa->Glide.TextureAlign = result[0];
-
- fxMesa->Glide.State = NULL;
- fxMesa->Glide.grGet( GR_GLIDE_STATE_SIZE, sizeof(FxI32), result );
- fxMesa->Glide.State = MALLOC( result[0] );
-
- fxMesa->Fog.Table = NULL;
- fxMesa->Glide.grGet( GR_FOG_TABLE_ENTRIES, sizeof(FxI32), result );
- fxMesa->Fog.Table = MALLOC( result[0] * sizeof(GrFog_t) );
-
- UNLOCK_HARDWARE( fxMesa );
-
- if ( !fxMesa->Glide.State || !fxMesa->Fog.Table ) {
- if ( fxMesa->Glide.State )
- FREE( fxMesa->Glide.State );
- if ( fxMesa->Fog.Table )
- FREE( fxMesa->Fog.Table );
- return GL_FALSE;
- }
-
- if ( !tdfxInitVertexFormats( fxMesa ) ) {
- return GL_FALSE;
- }
-
- LOCK_HARDWARE( fxMesa );
-
- fxMesa->Glide.grGlideGetState( fxMesa->Glide.State );
-
- if ( getenv( "FX_GLIDE_INFO" ) ) {
- printf( "GR_RENDERER = %s\n", (char *) fxMesa->Glide.grGetString( GR_RENDERER ) );
- printf( "GR_VERSION = %s\n", (char *) fxMesa->Glide.grGetString( GR_VERSION ) );
- printf( "GR_VENDOR = %s\n", (char *) fxMesa->Glide.grGetString( GR_VENDOR ) );
- printf( "GR_HARDWARE = %s\n", (char *) fxMesa->Glide.grGetString( GR_HARDWARE ) );
- printf( "GR_EXTENSION = %s\n", (char *) gext );
- }
-
- UNLOCK_HARDWARE( fxMesa );
-
- fxMesa->numClipRects = 0;
- fxMesa->pClipRects = NULL;
- fxMesa->scissoredClipRects = GL_FALSE;
-
- fxMesa->Glide.Initialized = GL_TRUE;
-
- return GL_TRUE;
-}
-
-
-void
-tdfxDestroyContext( __DRIcontextPrivate *driContextPriv )
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)fxMesa );
- }
-
- if ( fxMesa ) {
- if (fxMesa->glCtx->Shared->RefCount == 1 && fxMesa->driDrawable) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- struct _mesa_HashTable *textures = fxMesa->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);
- tdfxTMFreeTexture(fxMesa, tObj);
- }
- }
-
- tdfxTMClose(fxMesa); /* free texture memory */
-
- _swsetup_DestroyContext( fxMesa->glCtx );
- _tnl_DestroyContext( fxMesa->glCtx );
- _ac_DestroyContext( fxMesa->glCtx );
- _swrast_DestroyContext( fxMesa->glCtx );
-
- tdfxFreeVB( fxMesa->glCtx );
-
- /* Free Mesa context */
- fxMesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(fxMesa->glCtx);
-
- /* free the tdfx context */
- FREE( fxMesa );
- }
-}
-
-
-GLboolean
-tdfxUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)driContextPriv );
- }
-
- if ( driContextPriv && (tdfxContextPtr) driContextPriv == fxMesa ) {
- LOCK_HARDWARE(fxMesa);
- fxMesa->Glide.grGlideGetState(fxMesa->Glide.State);
- UNLOCK_HARDWARE(fxMesa);
- }
- return GL_TRUE;
-}
-
-
-GLboolean
-tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv )
-{
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)driContextPriv );
- }
-
- if ( driContextPriv ) {
- tdfxContextPtr newFx = (tdfxContextPtr) driContextPriv->driverPrivate;
- GLcontext *newCtx = newFx->glCtx;
- GET_CURRENT_CONTEXT(curCtx);
-
- if ( newFx->driDrawable != driDrawPriv ) {
- newFx->driDrawable = driDrawPriv;
- newFx->dirty = ~0;
- }
- else {
- if (curCtx == newCtx) {
- /* same drawable, same context -> no-op */
- /* Need to call _mesa_make_current2() in order to make sure API
- * dispatch is set correctly.
- */
- _mesa_make_current( newCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
- return GL_TRUE;
- }
- /* [dBorca] tunnel2 requires this */
- newFx->dirty = ~0;
- }
-
- if ( !newFx->Glide.Initialized ) {
- if ( !tdfxInitContext( driDrawPriv, newFx ) )
- return GL_FALSE;
-
- LOCK_HARDWARE( newFx );
-
- /* FIXME: Force loading of window information */
- newFx->width = 0;
- tdfxUpdateClipping(newCtx);
- tdfxUploadClipping(newFx);
-
- UNLOCK_HARDWARE( newFx );
- } else {
- LOCK_HARDWARE( newFx );
-
- newFx->Glide.grSstSelect( newFx->Glide.Board );
- newFx->Glide.grGlideSetState( newFx->Glide.State );
-
- tdfxUpdateClipping(newCtx);
- tdfxUploadClipping(newFx);
-
- UNLOCK_HARDWARE( newFx );
- }
-
- _mesa_make_current( newCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return GL_TRUE;
-}
-
-
-/*
- * Enable this to trace calls to various Glide functions.
- */
-/*#define DEBUG_TRAP*/
-#ifdef DEBUG_TRAP
-static void (*real_grDrawTriangle)( const void *a, const void *b, const void *c );
-static void (*real_grDrawPoint)( const void *a );
-static void (*real_grDrawVertexArray)(FxU32 mode, FxU32 Count, void *pointers);
-static void (*real_grDrawVertexArrayContiguous)(FxU32 mode, FxU32 Count,
- void *pointers, FxU32 stride);
-static void (*real_grClipWindow)( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
-
-static void (*real_grVertexLayout)(FxU32 param, FxI32 offset, FxU32 mode);
-static void (*real_grGlideGetVertexLayout)( void *layout );
-static void (*real_grGlideSetVertexLayout)( const void *layout );
-
-static void (*real_grTexDownloadMipMapLevel)( GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data );
-
-
-static void debug_grDrawTriangle( const void *a, const void *b, const void *c )
-{
- printf("%s\n", __FUNCTION__);
- (*real_grDrawTriangle)(a, b, c);
-}
-
-static void debug_grDrawPoint( const void *a )
-{
- const float *f = (const float *) a;
- printf("%s %g %g\n", __FUNCTION__, f[0], f[1]);
- (*real_grDrawPoint)(a);
-}
-
-static void debug_grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers)
-{
- printf("%s count=%d\n", __FUNCTION__, (int) Count);
- (*real_grDrawVertexArray)(mode, Count, pointers);
-}
-
-static void debug_grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count,
- void *pointers, FxU32 stride)
-{
- printf("%s mode=0x%x count=%d\n", __FUNCTION__, (int) mode, (int) Count);
- (*real_grDrawVertexArrayContiguous)(mode, Count, pointers, stride);
-}
-
-static void debug_grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy )
-{
- printf("%s %d,%d .. %d,%d\n", __FUNCTION__,
- (int) minx, (int) miny, (int) maxx, (int) maxy);
- (*real_grClipWindow)(minx, miny, maxx, maxy);
-}
-
-static void debug_grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode)
-{
- (*real_grVertexLayout)(param, offset, mode);
-}
-
-static void debug_grGlideGetVertexLayout( void *layout )
-{
- (*real_grGlideGetVertexLayout)(layout);
-}
-
-static void debug_grGlideSetVertexLayout( const void *layout )
-{
- (*real_grGlideSetVertexLayout)(layout);
-}
-
-static void debug_grTexDownloadMipMapLevel( GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data )
-{
- (*real_grTexDownloadMipMapLevel)(tmu, startAddress, thisLod, largeLod,
- aspectRatio, format, evenOdd, data);
-}
-
-#endif
-
-
-/*
- * Examine the context's deviceID to determine what kind of 3dfx hardware
- * is installed. dlopen() the appropriate Glide library and initialize
- * this context's Glide function pointers.
- * Return: true/false = success/failure
- */
-GLboolean tdfxInitGlide(tdfxContextPtr tmesa)
-{
- static const char *defaultGlide = "libglide3.so";
- const char *libName;
- void *libHandle;
-
- /*
- * XXX this code which selects a Glide library filename given the
- * deviceID may need to be cleaned up a bit.
- * Non-Linux systems may have different filenames, for example.
- */
- switch (tmesa->fxScreen->deviceID) {
- case PCI_CHIP_BANSHEE:
- case PCI_CHIP_VOODOO3:
- libName = "libglide3-v3.so";
- break;
- case PCI_CHIP_VOODOO5: /* same as PCI_CHIP_VOODOO4 */
- libName = "libglide3-v5.so";
- break;
- default:
- {
- __driUtilMessage("unrecognized 3dfx deviceID: 0x%x",
- tmesa->fxScreen->deviceID);
- }
- return GL_FALSE;
- }
-
- libHandle = dlopen(libName, RTLD_NOW);
- if (!libHandle) {
- /* The device-specific Glide library filename didn't work, try the
- * old, generic libglide3.so library.
- */
- libHandle = dlopen(defaultGlide, RTLD_NOW);
- if (!libHandle) {
- __driUtilMessage(
- "can't find Glide library, dlopen(%s) and dlopen(%s) both failed.",
- libName, defaultGlide);
- __driUtilMessage("dlerror() message: %s", dlerror());
- return GL_FALSE;
- }
- libName = defaultGlide;
- }
-
- {
- const char *env = getenv("LIBGL_DEBUG");
- if (env && strstr(env, "verbose")) {
- fprintf(stderr, "libGL: using Glide library %s\n", libName);
- }
- }
-
-#define GET_FUNCTION(PTR, NAME) \
- tmesa->Glide.PTR = dlsym(libHandle, NAME); \
- if (!tmesa->Glide.PTR) { \
- __driUtilMessage("couldn't find Glide function %s in %s.", \
- NAME, libName); \
- }
-
- GET_FUNCTION(grDrawPoint, "grDrawPoint");
- GET_FUNCTION(grDrawLine, "grDrawLine");
- GET_FUNCTION(grDrawTriangle, "grDrawTriangle");
- GET_FUNCTION(grVertexLayout, "grVertexLayout");
- GET_FUNCTION(grDrawVertexArray, "grDrawVertexArray");
- GET_FUNCTION(grDrawVertexArrayContiguous, "grDrawVertexArrayContiguous");
- GET_FUNCTION(grBufferClear, "grBufferClear");
- /*GET_FUNCTION(grBufferSwap, "grBufferSwap");*/
- GET_FUNCTION(grRenderBuffer, "grRenderBuffer");
- GET_FUNCTION(grErrorSetCallback, "grErrorSetCallback");
- GET_FUNCTION(grFinish, "grFinish");
- GET_FUNCTION(grFlush, "grFlush");
- GET_FUNCTION(grSstWinOpen, "grSstWinOpen");
- GET_FUNCTION(grSstWinClose, "grSstWinClose");
-#if 0
- /* Not in V3 lib, and not used anyway. */
- GET_FUNCTION(grSetNumPendingBuffers, "grSetNumPendingBuffers");
-#endif
- GET_FUNCTION(grSelectContext, "grSelectContext");
- GET_FUNCTION(grSstOrigin, "grSstOrigin");
- GET_FUNCTION(grSstSelect, "grSstSelect");
- GET_FUNCTION(grAlphaBlendFunction, "grAlphaBlendFunction");
- GET_FUNCTION(grAlphaCombine, "grAlphaCombine");
- GET_FUNCTION(grAlphaControlsITRGBLighting, "grAlphaControlsITRGBLighting");
- GET_FUNCTION(grAlphaTestFunction, "grAlphaTestFunction");
- GET_FUNCTION(grAlphaTestReferenceValue, "grAlphaTestReferenceValue");
- GET_FUNCTION(grChromakeyMode, "grChromakeyMode");
- GET_FUNCTION(grChromakeyValue, "grChromakeyValue");
- GET_FUNCTION(grClipWindow, "grClipWindow");
- GET_FUNCTION(grColorCombine, "grColorCombine");
- GET_FUNCTION(grColorMask, "grColorMask");
- GET_FUNCTION(grCullMode, "grCullMode");
- GET_FUNCTION(grConstantColorValue, "grConstantColorValue");
- GET_FUNCTION(grDepthBiasLevel, "grDepthBiasLevel");
- GET_FUNCTION(grDepthBufferFunction, "grDepthBufferFunction");
- GET_FUNCTION(grDepthBufferMode, "grDepthBufferMode");
- GET_FUNCTION(grDepthMask, "grDepthMask");
- GET_FUNCTION(grDisableAllEffects, "grDisableAllEffects");
- GET_FUNCTION(grDitherMode, "grDitherMode");
- GET_FUNCTION(grFogColorValue, "grFogColorValue");
- GET_FUNCTION(grFogMode, "grFogMode");
- GET_FUNCTION(grFogTable, "grFogTable");
- GET_FUNCTION(grLoadGammaTable, "grLoadGammaTable");
- GET_FUNCTION(grSplash, "grSplash");
- GET_FUNCTION(grGet, "grGet");
- GET_FUNCTION(grGetString, "grGetString");
- GET_FUNCTION(grQueryResolutions, "grQueryResolutions");
- GET_FUNCTION(grReset, "grReset");
- GET_FUNCTION(grGetProcAddress, "grGetProcAddress");
- GET_FUNCTION(grEnable, "grEnable");
- GET_FUNCTION(grDisable, "grDisable");
- GET_FUNCTION(grCoordinateSpace, "grCoordinateSpace");
- GET_FUNCTION(grDepthRange, "grDepthRange");
- GET_FUNCTION(grStippleMode, "grStippleMode");
- GET_FUNCTION(grStipplePattern, "grStipplePattern");
- GET_FUNCTION(grViewport, "grViewport");
- GET_FUNCTION(grTexCalcMemRequired, "grTexCalcMemRequired");
- GET_FUNCTION(grTexTextureMemRequired, "grTexTextureMemRequired");
- GET_FUNCTION(grTexMinAddress, "grTexMinAddress");
- GET_FUNCTION(grTexMaxAddress, "grTexMaxAddress");
- GET_FUNCTION(grTexNCCTable, "grTexNCCTable");
- GET_FUNCTION(grTexSource, "grTexSource");
- GET_FUNCTION(grTexClampMode, "grTexClampMode");
- GET_FUNCTION(grTexCombine, "grTexCombine");
- GET_FUNCTION(grTexDetailControl, "grTexDetailControl");
- GET_FUNCTION(grTexFilterMode, "grTexFilterMode");
- GET_FUNCTION(grTexLodBiasValue, "grTexLodBiasValue");
- GET_FUNCTION(grTexDownloadMipMap, "grTexDownloadMipMap");
- GET_FUNCTION(grTexDownloadMipMapLevel, "grTexDownloadMipMapLevel");
- GET_FUNCTION(grTexDownloadMipMapLevelPartial, "grTexDownloadMipMapLevelPartial");
- GET_FUNCTION(grTexDownloadTable, "grTexDownloadTable");
- GET_FUNCTION(grTexDownloadTablePartial, "grTexDownloadTablePartial");
- GET_FUNCTION(grTexMipMapMode, "grTexMipMapMode");
- GET_FUNCTION(grTexMultibase, "grTexMultibase");
- GET_FUNCTION(grTexMultibaseAddress, "grTexMultibaseAddress");
- GET_FUNCTION(grLfbLock, "grLfbLock");
- GET_FUNCTION(grLfbUnlock, "grLfbUnlock");
- GET_FUNCTION(grLfbConstantAlpha, "grLfbConstantAlpha");
- GET_FUNCTION(grLfbConstantDepth, "grLfbConstantDepth");
- GET_FUNCTION(grLfbWriteColorSwizzle, "grLfbWriteColorSwizzle");
- GET_FUNCTION(grLfbWriteColorFormat, "grLfbWriteColorFormat");
- GET_FUNCTION(grLfbWriteRegion, "grLfbWriteRegion");
- GET_FUNCTION(grLfbReadRegion, "grLfbReadRegion");
- GET_FUNCTION(grGlideInit, "grGlideInit");
- GET_FUNCTION(grGlideShutdown, "grGlideShutdown");
- GET_FUNCTION(grGlideGetState, "grGlideGetState");
- GET_FUNCTION(grGlideSetState, "grGlideSetState");
- GET_FUNCTION(grGlideGetVertexLayout, "grGlideGetVertexLayout");
- GET_FUNCTION(grGlideSetVertexLayout, "grGlideSetVertexLayout");
-
- /* Glide utility functions */
- GET_FUNCTION(guFogGenerateExp, "guFogGenerateExp");
- GET_FUNCTION(guFogGenerateExp2, "guFogGenerateExp2");
- GET_FUNCTION(guFogGenerateLinear, "guFogGenerateLinear");
-
- /* DRI functions */
- GET_FUNCTION(grDRIOpen, "grDRIOpen");
- GET_FUNCTION(grDRIPosition, "grDRIPosition");
- /*GET_FUNCTION(grDRILostContext, "grDRILostContext");*/
- GET_FUNCTION(grDRIImportFifo, "grDRIImportFifo");
- GET_FUNCTION(grDRIInvalidateAll, "grDRIInvalidateAll");
- GET_FUNCTION(grDRIResetSAREA, "grDRIResetSAREA");
- GET_FUNCTION(grDRIBufferSwap, "grDRIBufferSwap");
-
- /*
- * Extension functions:
- * Just use dlysm() because we want a NULL pointer if the function is
- * not found.
- */
- /* PIXEXT extension */
- tmesa->Glide.grStencilFunc = dlsym(libHandle, "grStencilFunc");
- tmesa->Glide.grStencilMask = dlsym(libHandle, "grStencilMask");
- tmesa->Glide.grStencilOp = dlsym(libHandle, "grStencilOp");
- tmesa->Glide.grBufferClearExt = dlsym(libHandle, "grBufferClearExt");
- tmesa->Glide.grColorMaskExt = dlsym(libHandle, "grColorMaskExt");
- /* COMBINE extension */
- tmesa->Glide.grColorCombineExt = dlsym(libHandle, "grColorCombineExt");
- tmesa->Glide.grTexColorCombineExt = dlsym(libHandle, "grTexColorCombineExt");
- tmesa->Glide.grAlphaCombineExt = dlsym(libHandle, "grAlphaCombineExt");
- tmesa->Glide.grTexAlphaCombineExt = dlsym(libHandle, "grTexAlphaCombineExt");
- tmesa->Glide.grAlphaBlendFunctionExt = dlsym(libHandle, "grAlphaBlendFunctionExt");
- tmesa->Glide.grConstantColorValueExt = dlsym(libHandle, "grConstantColorValueExt");
- /* Texus 2 */
- tmesa->Glide.txImgQuantize = dlsym(libHandle, "txImgQuantize");
- tmesa->Glide.txImgDequantizeFXT1 = dlsym(libHandle, "_txImgDequantizeFXT1");
- tmesa->Glide.txErrorSetCallback = dlsym(libHandle, "txErrorSetCallback");
-
-#ifdef DEBUG_TRAP
- /* wrap the drawing functions so we can trap them */
- real_grDrawTriangle = tmesa->Glide.grDrawTriangle;
- tmesa->Glide.grDrawTriangle = debug_grDrawTriangle;
-
- real_grDrawPoint = tmesa->Glide.grDrawPoint;
- tmesa->Glide.grDrawPoint = debug_grDrawPoint;
-
- real_grDrawVertexArray = tmesa->Glide.grDrawVertexArray;
- tmesa->Glide.grDrawVertexArray = debug_grDrawVertexArray;
-
- real_grDrawVertexArrayContiguous = tmesa->Glide.grDrawVertexArrayContiguous;
- tmesa->Glide.grDrawVertexArrayContiguous = debug_grDrawVertexArrayContiguous;
-
- real_grClipWindow = tmesa->Glide.grClipWindow;
- tmesa->Glide.grClipWindow = debug_grClipWindow;
-
- real_grVertexLayout = tmesa->Glide.grVertexLayout;
- tmesa->Glide.grVertexLayout = debug_grVertexLayout;
-
- real_grGlideGetVertexLayout = tmesa->Glide.grGlideGetVertexLayout;
- tmesa->Glide.grGlideGetVertexLayout = debug_grGlideGetVertexLayout;
-
- real_grGlideSetVertexLayout = tmesa->Glide.grGlideSetVertexLayout;
- tmesa->Glide.grGlideSetVertexLayout = debug_grGlideSetVertexLayout;
-
- real_grTexDownloadMipMapLevel = tmesa->Glide.grTexDownloadMipMapLevel;
- tmesa->Glide.grTexDownloadMipMapLevel = debug_grTexDownloadMipMapLevel;
-
-#endif
- return GL_TRUE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.h
deleted file mode 100644
index b8349fec7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_context.h
+++ /dev/null
@@ -1,1007 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_context.h,v 1.5 2002/02/24 21:51:10 dawes Exp $ */
-
-/*
- * New fixes:
- * Daniel Borca <dborca@users.sourceforge.net>, 19 Jul 2004
- *
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_CONTEXT_H__
-#define __TDFX_CONTEXT_H__
-
-#include <sys/time.h>
-#include "dri_util.h"
-#ifdef XFree86Server
-#include "GL/xf86glx.h"
-#else
-#include "glheader.h"
-#endif
-#if defined(__linux__)
-#include <signal.h>
-#endif
-
-#include "drm.h"
-#include "drm_sarea.h"
-#include "tdfx_glide.h"
-#include "xmlconfig.h"
-
-#include "clip.h"
-#include "context.h"
-#include "macros.h"
-#include "matrix.h"
-#include "imports.h"
-#include "mtypes.h"
-
-#include "tdfx_screen.h"
-
-
-
-
-#define TDFX_TMU0 GR_TMU0
-#define TDFX_TMU1 GR_TMU1
-#define TDFX_TMU_SPLIT 98
-#define TDFX_TMU_BOTH 99
-#define TDFX_TMU_NONE 100
-
-
-
-/* Flags for fxMesa->new_state
- */
-#define TDFX_NEW_COLOR 0x0001
-#define TDFX_NEW_ALPHA 0x0002
-#define TDFX_NEW_DEPTH 0x0004
-#define TDFX_NEW_FOG 0x0008
-#define TDFX_NEW_STENCIL 0x0010
-#define TDFX_NEW_CLIP 0x0020
-#define TDFX_NEW_VIEWPORT 0x0040
-#define TDFX_NEW_CULL 0x0080
-#define TDFX_NEW_GLIDE 0x0100
-#define TDFX_NEW_TEXTURE 0x0200
-#define TDFX_NEW_CONTEXT 0x0400
-#define TDFX_NEW_LINE 0x0800
-#define TDFX_NEW_RENDER 0x1000
-#define TDFX_NEW_STIPPLE 0x2000
-#define TDFX_NEW_TEXTURE_BIND 0x4000 /* experimental */
-
-
-/* Flags for fxMesa->dirty
- */
-#define TDFX_UPLOAD_COLOR_COMBINE 0x00000001
-#define TDFX_UPLOAD_ALPHA_COMBINE 0x00000002
-#define TDFX_UPLOAD_RENDER_BUFFER 0x00000004
-#define TDFX_UPLOAD_ALPHA_TEST 0x00000008
-#define TDFX_UPLOAD_ALPHA_REF 0x00000010
-#define TDFX_UPLOAD_BLEND_FUNC 0x00000020
-#define TDFX_UPLOAD_DEPTH_MODE 0x00000040
-#define TDFX_UPLOAD_DEPTH_BIAS 0x00000080
-#define TDFX_UPLOAD_DEPTH_FUNC 0x00000100
-#define TDFX_UPLOAD_DEPTH_MASK 0x00000200
-#define TDFX_UPLOAD_FOG_MODE 0x00000400
-#define TDFX_UPLOAD_FOG_COLOR 0x00000800
-#define TDFX_UPLOAD_FOG_TABLE 0x00001000
-#define TDFX_UPLOAD_CONSTANT_COLOR 0x00002000
-
-#define TDFX_UPLOAD_CLIP 0x00002000
-#define TDFX_UPLOAD_CULL 0x00004000
-#define TDFX_UPLOAD_VERTEX_LAYOUT 0x00008000
-#define TDFX_UPLOAD_COLOR_MASK 0x00010000
-#define TDFX_UPLOAD_DITHER 0x00040000
-#define TDFX_UPLOAD_STENCIL 0x00080000
-
-#define TDFX_UPLOAD_TEXTURE_SOURCE 0x00100000
-#define TDFX_UPLOAD_TEXTURE_PARAMS 0x00200000
-#define TDFX_UPLOAD_TEXTURE_PALETTE 0x00400000
-#define TDFX_UPLOAD_TEXTURE_ENV 0x00800000
-#define TDFX_UPLOAD_TEXTURE_IMAGES 0x01000000
-
-#define TDFX_UPLOAD_LINE 0x02000000
-
-#define TDFX_UPLOAD_STIPPLE 0x04000000
-
-/* Flags for software fallback cases */
-/* See correponding strings in tdfx_tris.c */
-#define TDFX_FALLBACK_TEXTURE_MAP 0x0001
-#define TDFX_FALLBACK_DRAW_BUFFER 0x0002
-#define TDFX_FALLBACK_SPECULAR 0x0004
-#define TDFX_FALLBACK_STENCIL 0x0008
-#define TDFX_FALLBACK_RENDER_MODE 0x0010
-#define TDFX_FALLBACK_LOGICOP 0x0020
-#define TDFX_FALLBACK_TEXTURE_ENV 0x0040
-#define TDFX_FALLBACK_TEXTURE_BORDER 0x0080
-#define TDFX_FALLBACK_COLORMASK 0x0100
-#define TDFX_FALLBACK_BLEND 0x0200
-#define TDFX_FALLBACK_LINE_STIPPLE 0x0400
-#define TDFX_FALLBACK_DISABLE 0x0800
-
-/* Different Glide vertex layouts
- */
-#define TDFX_LAYOUT_TINY 0
-#define TDFX_LAYOUT_NOTEX 1
-#define TDFX_LAYOUT_SINGLE 2
-#define TDFX_LAYOUT_MULTI 3
-#define TDFX_LAYOUT_PROJ1 4
-#define TDFX_LAYOUT_PROJ2 5
-#define TDFX_NUM_LAYOUTS 6
-
-#define TDFX_XY_OFFSET 0
-#define TDFX_Z_OFFSET 8
-#define TDFX_Q_OFFSET 12
-#define TDFX_ARGB_OFFSET 16
-#define TDFX_FOG_OFFSET 20
-#define TDFX_ST0_OFFSET 24
-#define TDFX_ST1_OFFSET 32
-#define TDFX_Q0_OFFSET 40
-#define TDFX_Q1_OFFSET 44
-
-
-/* Flags for buffer clears
- */
-#define TDFX_FRONT 0x1
-#define TDFX_BACK 0x2
-#define TDFX_DEPTH 0x4
-#define TDFX_STENCIL 0x8
-
-/*
- * 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)
-
-
-#define TDFX_DEPTH_BIAS_SCALE 128
-
-/* Including xf86PciInfo.h causes a bunch of errors
- */
-#ifndef PCI_CHIP_BANSHEE
-#define PCI_CHIP_BANSHEE 0x0003
-#define PCI_CHIP_VOODOO3 0x0005
-#define PCI_CHIP_VOODOO4 0x0009
-#define PCI_CHIP_VOODOO5 0x0009
-#endif
-
-#define TDFX_IS_BANSHEE( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_BANSHEE )
-#define TDFX_IS_VOODOO3( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO3 )
-#define TDFX_IS_VOODOO4( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4 )
-#define TDFX_IS_VOODOO5( fxMesa ) \
- ( fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5 )
-#define TDFX_IS_NAPALM( fxMesa ) \
- ( (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO4) || \
- (fxMesa->fxScreen->deviceID == PCI_CHIP_VOODOO5) )
-
-
-#define PACK_BGRA32(R, G, B, A) \
- ( (((GLuint) (R)) << 16) | \
- (((GLuint) (G)) << 8) | \
- (((GLuint) (B)) ) | \
- (((GLuint) (A)) << 24) )
-
-#define PACK_RGBA32(R, G, B, A) \
- ( (((GLuint) (R)) ) | \
- (((GLuint) (G)) << 8) | \
- (((GLuint) (B)) << 16) | \
- (((GLuint) (A)) << 24) )
-
-/*
- * The first two macros are to pack 8 bit color
- * channel values into a 565 format.
- */
-#define PACK_RGB16(R, G, B) \
- ((((GLuint) (R) & 0xF8) << 8) | \
- (((GLuint) (G) & 0xFC) << 3) | \
- (((GLuint) (B) & 0xFF) >> 3))
-#define PACK_BGR16(R, G, B) \
- ((((GLuint) (B) & 0xF8) << 8) | \
- (((GLuint) (G) & 0xFC) << 3) | \
- (((GLuint) (R) & 0xFF) >> 3))
-/*
- * The second two macros pack 8 bit color channel values
- * into 1555 values.
- */
-#define PACK_RGBA16(R, G, B, A) \
- (((((GLuint) (A) & 0xFF) > 0) << 15)| \
- (((GLuint) (R) & 0xF8) << 7) | \
- (((GLuint) (G) & 0xF8) << 2) | \
- (((GLuint) (B) & 0xF8) >> 3))
-#define PACK_BGRA16(R, G, B, A) \
- (((((GLuint) (A) & 0xFF) > 0) << 15)| \
- (((GLuint) (B) & 0xF8) << 7) | \
- (((GLuint) (G) & 0xF8) << 2) | \
- (((GLuint) (R) & 0xF8) >> 3))
-
-/* Used in calls to grColorMaskv()...
- */
-extern const GLboolean false4[4];
-extern const GLboolean true4[4];
-
-
-typedef struct tdfx_context tdfxContextRec;
-typedef struct tdfx_context *tdfxContextPtr;
-
-
-typedef struct {
- volatile int fifoPtr;
- volatile int fifoRead;
- volatile int fifoOwner;
- volatile int ctxOwner;
- volatile int texOwner;
-}
-TDFXSAREAPriv;
-
-
-typedef struct {
- GLuint swapBuffer;
- GLuint reqTexUpload;
- GLuint texUpload;
- GLuint memTexUpload;
- GLuint texSwaps;
-} tdfxStats;
-
-
-
-/*
- * Memory range from startAddr to endAddr-1
- */
-typedef struct mem_range {
- struct mem_range *next;
- FxU32 startAddr, endAddr;
-}
-tdfxMemRange;
-
-
-typedef struct {
- GLsizei width, height; /* image size */
- GLint wScale, hScale; /* scale factors */
- GrTextureFormat_t glideFormat; /* Glide image format */
-}
-tdfxMipMapLevel;
-
-
-#define TDFX_NUM_TMU 2
-
-
-typedef struct tdfxTexInfo_t
-{
- GLboolean isInTM;
- GLboolean reloadImages; /* if true, resend images to Glide */
- GLuint lastTimeUsed;
- FxU32 whichTMU;
-
- GrTexInfo info;
- GrAspectRatio_t aspectRatio;
- tdfxMemRange *tm[TDFX_NUM_TMU];
-
- GLint minLevel, maxLevel;
- GrTextureFilterMode_t minFilt;
- GrTextureFilterMode_t magFilt;
- GrTextureClampMode_t sClamp;
- GrTextureClampMode_t tClamp;
- FxBool LODblend;
- GrMipMapMode_t mmMode;
-
- GLfloat sScale, tScale; /* texcoord scale factor */
-
- GrTexTable_t paltype;
- GuTexPalette palette;
-
- GLboolean padded;
-}
-tdfxTexInfo;
-
-
-#define TDFX_TEXTURE_DATA(mesaObj) ((tdfxTexInfo *)((mesaObj)->DriverData))
-
-#define TDFX_TEXIMAGE_DATA(mesaImg) ((tdfxMipMapLevel *)((mesaImg)->DriverData))
-
-
-
-/*
- * This is state which may be shared by several tdfx contexts.
- * It hangs off of Mesa's gl_shared_state object (ctx->Shared->DriverData).
- */
-struct tdfxSharedState {
- GLboolean umaTexMemory;
- GLuint totalTexMem[TDFX_NUM_TMU]; /* constant */
- GLuint freeTexMem[TDFX_NUM_TMU]; /* changes as we go */
- tdfxMemRange *tmPool;
- tdfxMemRange *tmFree[TDFX_NUM_TMU];
-};
-
-
-
-/* ================================================================
- * The vertex structures.
- */
-/* The size of this union is not of relevence:
- */
-typedef struct tdfx_vertex_t {
- GLfloat x, y, z; /* Coordinates in screen space */
- GLfloat rhw; /* Reciprocal homogeneous w */
- GLubyte color[4]; /* Diffuse color */
- GLfloat fog;
- GLfloat tu0, tv0; /* Texture 0 coordinates */
- GLfloat tu1, tv1; /* Texture 1 coordinates */
- GLfloat tq0, tq1; /* Texture 0/1 q coords */
- unsigned char pspec[4]; /* B, G, R, A [0..255] */
- float psize; /* point size */
- long pad[16 - 14]; /* ensure 64b structure */
-} tdfxVertex, *tdfxVertexPtr;
-
-
-/* ================================================================
- *
- * We want to keep a mirror of the Glide function call parameters so we
- * can avoid updating our state too often.
- *
- * Each of these broad groups will typically have a new state flag
- * associated with it, and will be updated together. The individual
- * Glide function calls each have a dirty flag and will only be called
- * when absolutely necessary.
- */
-
-/* for grTexSource() */
-struct tdfx_texsource {
- FxU32 StartAddress;
- FxU32 EvenOdd;
- GrTexInfo *Info;
-};
-
-/* Texture object params */
-struct tdfx_texparams {
- GrTextureClampMode_t sClamp;
- GrTextureClampMode_t tClamp;
- GrTextureFilterMode_t minFilt;
- GrTextureFilterMode_t magFilt;
- GrMipMapMode_t mmMode;
- FxBool LODblend;
- GLfloat LodBias;
-};
-
-/* for grTexDownloadTable() texture palettes */
-struct tdfx_texpalette {
- GrTexTable_t Type;
- void *Data;
-};
-
-/* 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;
-};
-
-/* Used to track changes between Glide's state and Mesa's */
-struct tdfx_texstate {
- GLuint Enabled[2]; /* values ala ctx->Texture.Unit[i]._ReallyEnabled */
- GLenum EnvMode[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */
- GLenum TexFormat[TDFX_NUM_TMU]; /* index is Glide index, not OpenGL */
-};
-
-struct tdfx_color {
- GrColor_t ClearColor; /* Buffer clear color value */
- GrAlpha_t ClearAlpha; /* Buffer clear alpha value */
- FxBool ColorMask[4]; /* Per-channel write enable flags */
-
- GrColor_t MonoColor; /* Constant color value */
-
- /* Alpha testing */
- GrCmpFnc_t AlphaFunc; /* Alpha test function */
- GrAlpha_t AlphaRef; /* Alpha ref value in range [0,255] */
-
- /* Blending */
- GrAlphaBlendFnc_t BlendSrcRGB; /* Blend source RGB factor */
- GrAlphaBlendFnc_t BlendDstRGB; /* Blend destination RGB factor */
- GrAlphaBlendOp_t BlendEqRGB; /* Blend source RGB op */
- GrAlphaBlendFnc_t BlendSrcA; /* Blend source alpha factor */
- GrAlphaBlendFnc_t BlendDstA; /* Blend destination alpha factor */
- GrAlphaBlendOp_t BlendEqA; /* Blend source alpha op */
-
- GrDitherMode_t Dither; /* Dither enable */
-};
-
-struct tdfx_depth {
- GrDepthBufferMode_t Mode; /* Fixed-point Z or floating-point W */
- FxI32 Bias; /* Polygon offset factor */
- GrCmpFnc_t Func; /* Depth test function */
- FxU32 Clear; /* Buffer clear value */
- FxBool Mask; /* Write enable flag */
-};
-
-struct tdfx_stipple {
- GrStippleMode_t Mode; /* Stipple enable/disable */
- FxU32 Pattern; /* 8x4 Stipple Pattern */
-};
-
-struct tdfx_fog {
- GrFogMode_t Mode; /* Glide fog mode */
- GrColor_t Color; /* Fog color value */
- GLenum TableMode; /* GL fog mode currently in table */
- GrFog_t *Table; /* Fog value table */
- FxFloat Density; /* Density >= 0 */
- FxFloat Near; /* Start distance in eye coords */
- FxFloat Far; /* End distance in eye coords */
-};
-
-struct tdfx_stencil {
- GrCmpFnc_t Function; /* Stencil function */
- GrStencil_t RefValue; /* Stencil reference value */
- GrStencil_t ValueMask; /* Value mask */
- GrStencil_t WriteMask; /* Write mask */
- GrStencil_t FailFunc; /* Stencil fail function */
- GrStencil_t ZFailFunc; /* Stencil pass, depth fail function */
- GrStencil_t ZPassFunc; /* Stencil pass, depth pass function */
- GrStencil_t Clear; /* Buffer clear value */
-};
-
-struct tdfx_scissor {
- FxU32 minX, minY; /* Lower left corner */
- FxU32 maxX, maxY; /* Upper right corner */
-};
-
-struct tdfx_viewport {
- GrCoordinateSpaceMode_t Mode; /* Coordinate space */
- FxI32 X, Y; /* Position */
- FxI32 Width, Height; /* Size */
- FxFloat Near, Far; /* Depth buffer range */
-};
-
-struct tdfx_glide {
- void *State; /* Mirror of internal Glide state */
- GrContext_t Context; /* Glide context identifier */
- FxI32 Board; /* Current graphics subsystem */
- GrColorFormat_t ColorFormat; /* Framebuffer format */
- GrOriginLocation_t Origin; /* Location of screen space origin */
-
- FxBool Initialized; /* Glide initialization done? */
-
- FxI32 SwapInterval; /* SwapBuffers interval */
- FxI32 MaxPendingSwaps; /* Maximum outstanding SwapBuffers */
- FxI32 TextureAlign;
-
- /* Extensions */
- FxBool HaveCombineExt; /* COMBINE */
- FxBool HaveCommandTransportExt; /* COMMAND_TRANSPORT */
- FxBool HaveFogCoordExt; /* FOGCOORD */
- FxBool HavePixelExt; /* PIXEXT */
- FxBool HaveTextureBufferExt; /* TEXTUREBUFFER */
- FxBool HaveTexFmtExt; /* TEXFMT */
- FxBool HaveTexUMAExt; /* TEXUMA */
- FxBool HaveMirrorExt; /* MIRROR */
- FxBool HaveTexus2; /* Texus 2 - FXT1 */
-
- /* Glide library function pointers */
- void (*grDrawPoint)( const void *pt );
- void (*grDrawLine)( const void *v1, const void *v2 );
- void (*grDrawTriangle)( const void *a, const void *b, const void *c );
- void (*grVertexLayout)(FxU32 param, FxI32 offset, FxU32 mode);
- void (*grDrawVertexArray)(FxU32 mode, FxU32 Count, void *pointers);
- void (*grDrawVertexArrayContiguous)(FxU32 mode, FxU32 Count,
- void *pointers, FxU32 stride);
- void (*grBufferClear)( GrColor_t color, GrAlpha_t alpha, FxU32 depth );
- void (*grBufferSwap)( FxU32 swap_interval );
- void (*grRenderBuffer)( GrBuffer_t buffer );
- void (*grErrorSetCallback)( GrErrorCallbackFnc_t fnc );
- void (*grFinish)(void);
- void (*grFlush)(void);
- GrContext_t (*grSstWinOpen)(FxU32 hWnd,
- GrScreenResolution_t screen_resolution,
- GrScreenRefresh_t refresh_rate,
- GrColorFormat_t color_format,
- GrOriginLocation_t origin_location,
- int nColBuffers,
- int nAuxBuffers);
- void (*grSstWinClose)( GrContext_t context );
-/* Not used */
-#if 0
- void (*grSetNumPendingBuffers)(FxI32 NumPendingBuffers);
-#endif
- void (*grSelectContext)( GrContext_t context );
- void (*grSstOrigin)(GrOriginLocation_t origin);
- void (*grSstSelect)( int which_sst );
- void (*grAlphaBlendFunction)(GrAlphaBlendFnc_t rgb_sf,
- GrAlphaBlendFnc_t rgb_df,
- GrAlphaBlendFnc_t alpha_sf,
- GrAlphaBlendFnc_t alpha_df);
- void (*grAlphaCombine)(GrCombineFunction_t function,
- GrCombineFactor_t factor,
- GrCombineLocal_t local, GrCombineOther_t other,
- FxBool invert);
- void (*grAlphaControlsITRGBLighting)( FxBool enable );
- void (*grAlphaTestFunction)( GrCmpFnc_t function );
- void (*grAlphaTestReferenceValue)( GrAlpha_t value );
- void (*grChromakeyMode)( GrChromakeyMode_t mode );
- void (*grChromakeyValue)( GrColor_t value );
- void (*grClipWindow)( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );
- void (*grColorCombine)( GrCombineFunction_t function,
- GrCombineFactor_t factor,
- GrCombineLocal_t local,
- GrCombineOther_t other,
- FxBool invert );
- void (*grColorMask)( FxBool rgb, FxBool a );
- void (*grCullMode)( GrCullMode_t mode );
- void (*grConstantColorValue)( GrColor_t value );
- void (*grDepthBiasLevel)( FxI32 level );
- void (*grDepthBufferFunction)( GrCmpFnc_t function );
- void (*grDepthBufferMode)( GrDepthBufferMode_t mode );
- void (*grDepthMask)( FxBool mask );
- void (*grDisableAllEffects)( void );
- void (*grDitherMode)( GrDitherMode_t mode );
- void (*grFogColorValue)( GrColor_t fogcolor );
- void (*grFogMode)( GrFogMode_t mode );
- void (*grFogTable)( const GrFog_t ft[] );
- void (*grLoadGammaTable)( FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
- void (*grSplash)(float x, float y, float width, float height, FxU32 frame);
- FxU32 (*grGet)( FxU32 pname, FxU32 plength, FxI32 *params );
- const char * (*grGetString)( FxU32 pname );
- FxI32 (*grQueryResolutions)( const GrResolution *resTemplate,
- GrResolution *output );
- FxBool (*grReset)( FxU32 what );
- GrProc (*grGetProcAddress)( char *procName );
- void (*grEnable)( GrEnableMode_t mode );
- void (*grDisable)( GrEnableMode_t mode );
- void (*grCoordinateSpace)( GrCoordinateSpaceMode_t mode );
- void (*grDepthRange)( FxFloat n, FxFloat f );
- void (*grStippleMode)( GrStippleMode_t mode );
- void (*grStipplePattern)( GrStipplePattern_t mode );
- void (*grViewport)( FxI32 x, FxI32 y, FxI32 width, FxI32 height );
- FxU32 (*grTexCalcMemRequired)(GrLOD_t lodmin, GrLOD_t lodmax,
- GrAspectRatio_t aspect, GrTextureFormat_t fmt);
- FxU32 (*grTexTextureMemRequired)( FxU32 evenOdd, GrTexInfo *info );
- FxU32 (*grTexMinAddress)( GrChipID_t tmu );
- FxU32 (*grTexMaxAddress)( GrChipID_t tmu );
- void (*grTexNCCTable)( GrNCCTable_t table );
- void (*grTexSource)( GrChipID_t tmu, FxU32 startAddress,
- FxU32 evenOdd, GrTexInfo *info );
- void (*grTexClampMode)( GrChipID_t tmu,
- GrTextureClampMode_t s_clampmode,
- GrTextureClampMode_t t_clampmode );
- void (*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 (*grTexDetailControl)( GrChipID_t tmu, int lod_bias,
- FxU8 detail_scale, float detail_max );
- void (*grTexFilterMode)( GrChipID_t tmu,
- GrTextureFilterMode_t minfilter_mode,
- GrTextureFilterMode_t magfilter_mode );
- void (*grTexLodBiasValue)(GrChipID_t tmu, float bias );
- void (*grTexDownloadMipMap)( GrChipID_t tmu, FxU32 startAddress,
- FxU32 evenOdd, GrTexInfo *info );
- void (*grTexDownloadMipMapLevel)( GrChipID_t tmu,
- FxU32 startAddress,
- GrLOD_t thisLod,
- GrLOD_t largeLod,
- GrAspectRatio_t aspectRatio,
- GrTextureFormat_t format,
- FxU32 evenOdd,
- void *data );
- FxBool (*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 (*grTexDownloadTable)( GrTexTable_t type, void *data );
- void (*grTexDownloadTablePartial)( GrTexTable_t type,
- void *data, int start, int end );
- void (*grTexMipMapMode)( GrChipID_t tmu, GrMipMapMode_t mode,
- FxBool lodBlend );
- void (*grTexMultibase)( GrChipID_t tmu, FxBool enable );
- void (*grTexMultibaseAddress)( GrChipID_t tmu,
- GrTexBaseRange_t range,
- FxU32 startAddress,
- FxU32 evenOdd,
- GrTexInfo *info );
- FxBool (*grLfbLock)( GrLock_t type, GrBuffer_t buffer,
- GrLfbWriteMode_t writeMode,
- GrOriginLocation_t origin, FxBool pixelPipeline,
- GrLfbInfo_t *info );
- FxBool (*grLfbUnlock)( GrLock_t type, GrBuffer_t buffer );
- void (*grLfbConstantAlpha)( GrAlpha_t alpha );
- void (*grLfbConstantDepth)( FxU32 depth );
- void (*grLfbWriteColorSwizzle)(FxBool swizzleBytes, FxBool swapWords);
- void (*grLfbWriteColorFormat)(GrColorFormat_t colorFormat);
- FxBool (*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 (*grLfbReadRegion)( GrBuffer_t src_buffer,
- FxU32 src_x, FxU32 src_y,
- FxU32 src_width, FxU32 src_height,
- FxU32 dst_stride, void *dst_data );
- void (*grGlideInit)( void );
- void (*grGlideShutdown)( void );
- void (*grGlideGetState)( void *state );
- void (*grGlideSetState)( const void *state );
- void (*grGlideGetVertexLayout)( void *layout );
- void (*grGlideSetVertexLayout)( const void *layout );
- /* Glide utility functions */
- void (*guFogGenerateExp)( GrFog_t *fogtable, float density );
- void (*guFogGenerateExp2)( GrFog_t *fogtable, float density );
- void (*guFogGenerateLinear)(GrFog_t *fogtable, float nearZ, float farZ );
- /* DRI functions */
- void (*grDRIOpen)( char *pFB, char *pRegs, int deviceID,
- int width, int height,
- int mem, int cpp, int stride,
- int fifoOffset, int fifoSize,
- int fbOffset, int backOffset, int depthOffset,
- int textureOffset, int textureSize,
- volatile int *fifoPtr, volatile int *fifoRead );
- void (*grDRIPosition)( int x, int y, int w, int h,
- int numClip, drm_clip_rect_t *pClip );
- void (*grDRILostContext)( void );
- void (*grDRIImportFifo)( int fifoPtr, int fifoRead );
- void (*grDRIInvalidateAll)( void );
- void (*grDRIResetSAREA)( void );
- void (*grDRIBufferSwap)( FxU32 swapInterval );
- /* Glide extensions */
- /* PIXEXT extension */
- void (*grStencilFunc)( GrCmpFnc_t func, GrStencil_t ref, GrStencil_t mask );
- void (*grStencilMask)( GrStencil_t mask );
- void (*grStencilOp)( GrStencilOp_t fail, GrStencilOp_t zfail,
- GrStencilOp_t zpass );
- void (*grBufferClearExt)( GrColor_t color, GrAlpha_t alpha,
- FxU32 depth, GrStencil_t stencil );
- void (*grColorMaskExt)( FxBool r, FxBool g, FxBool b, FxBool a );
- /* COMBINE extension */
- void (*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 (*grTexColorCombineExt)( FxU32 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 (*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 (*grTexAlphaCombineExt)( FxU32 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 (*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 (*grConstantColorValueExt)( FxU32 tmu, GrColor_t value );
- /* Texus 2 */
- void (*txImgQuantize)( void *xxx_unknown_arguments );
- void (*txImgDequantizeFXT1)( void *txMip, void *pxMip );
- void (*txErrorSetCallback)( void *fnc );
-};
-
-typedef void (*tdfx_tri_func)( tdfxContextPtr, tdfxVertex *, tdfxVertex *,
- tdfxVertex * );
-typedef void (*tdfx_line_func)( tdfxContextPtr, tdfxVertex *, tdfxVertex * );
-typedef void (*tdfx_point_func)( tdfxContextPtr, tdfxVertex * );
-
-struct tdfx_context {
- /* Set once and never changed:
- */
- GLcontext *glCtx; /* The core Mesa context */
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
- /* Mirror of hardware state, Glide parameters
- */
- GLuint tmu_source[TDFX_NUM_TMU];
- struct tdfx_texsource TexSource[TDFX_NUM_TMU];
- struct tdfx_texparams TexParams[TDFX_NUM_TMU];
- struct tdfx_texpalette TexPalette;
-
- /* Voodoo3 texture/color combine state */
- struct tdfx_combine ColorCombine;
- struct tdfx_combine AlphaCombine;
- struct tdfx_texcombine TexCombine[TDFX_NUM_TMU];
-
- /* Voodoo5 texture/color combine state */
- struct tdfx_combine_color_ext ColorCombineExt;
- struct tdfx_combine_alpha_ext AlphaCombineExt;
- struct tdfx_texcombine_ext TexCombineExt[TDFX_NUM_TMU];
-
- /* Tracks tex state difference between Glide and Mesa */
- struct tdfx_texstate TexState;
-
- GrBuffer_t DrawBuffer; /* Current draw buffer */
- GrBuffer_t ReadBuffer; /* Current read buffer */
-
- struct tdfx_color Color;
- struct tdfx_depth Depth;
- struct tdfx_fog Fog;
- struct tdfx_stencil Stencil;
- struct tdfx_scissor Scissor;
- struct tdfx_viewport Viewport;
- struct tdfx_stipple Stipple;
-
- GrCullMode_t CullMode;
-
- struct tdfx_glide Glide;
-
- /* Fallback rasterization functions
- */
- tdfx_point_func draw_point;
- tdfx_line_func draw_line;
- tdfx_tri_func draw_triangle;
-
-
- /* Variable-size Glide vertex formats
- */
- GLuint vertexFormat; /* the current format */
- void *layout[TDFX_NUM_LAYOUTS];
- tdfxVertex *verts;
-
- GLfloat hw_viewport[16];
-
- GLuint SetupIndex;
- GLuint SetupNewInputs;
- GLuint RenderIndex;
- GLuint Fallback;
- GLenum render_primitive; /* what GL thinks */
- GLenum raster_primitive; /* what the hardware thinks */
-
- GLfloat sScale0, tScale0;
- GLfloat sScale1, tScale1;
-
- GLuint texBindNumber;
- GLint tmuSrc;
-
- int screen_width;
- int screen_height;
-
- GLboolean haveTwoTMUs; /* True if we have 2 tmu's */
- GLboolean haveHwAlpha;
- GLboolean haveHwStencil;
- GLboolean haveHwStipple;
-
- GLint maxPendingSwapBuffers;
-
- char rendererString[100];
-
- /* stuff added for DRI */
- __DRIscreenPrivate *driScreen;
- __DRIcontextPrivate *driContext;
- __DRIdrawablePrivate *driDrawable;
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
- tdfxScreenPrivate *fxScreen;
- TDFXSAREAPriv *sarea;
-
-
- /*
- * Changes during execution:
- */
- int width, height; /* size of window */
- int x_offset; /* distance from window left to screen left */
- int y_offset; /* distance from window top to screen top */
- int y_delta; /* distance from window bottom to screen bottom */
-
- int numClipRects;
- drm_clip_rect_t *pClipRects;
- GLboolean scissoredClipRects; /* if true, pClipRects is private storage */
-
- GuTexPalette glbPalette; /* global texture palette */
-
- tdfxStats stats;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-};
-
-#define TDFX_CONTEXT(ctx) ((tdfxContextPtr)((ctx)->DriverCtx))
-
-
-extern GLboolean
-tdfxCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate );
-
-extern void
-tdfxDestroyContext( __DRIcontextPrivate *driContextPriv );
-
-extern GLboolean
-tdfxUnbindContext( __DRIcontextPrivate *driContextPriv );
-
-extern GLboolean
-tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv );
-
-extern GLboolean
-tdfxInitGlide( tdfxContextPtr tmesa );
-
-extern void
-FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]);
-
-extern void
-FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]);
-
-
-/* Color packing utilities
- */
-#define TDFXPACKCOLOR332( r, g, b ) \
- (((b) & 0xe0) | (((g) & 0xe0) >> 3) | (((r) & 0xc0) >> 6))
-
-#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 TDFXPACKCOLOR888( r, g, b ) \
- (((b) << 16) | ((g) << 8) | (r))
-
-#define TDFXPACKCOLOR8888( r, g, b, a ) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define TDFXPACKCOLOR4444( r, g, b, a ) \
- ((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((g) & 0xf0) | ((r) >> 4))
-
-static __inline__ GrColor_t tdfxPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return TDFXPACKCOLOR565( r, g, b );
- case 4:
- return TDFXPACKCOLOR8888( r, g, b, a );
- default:
- return 0;
- }
-}
-
-#define DO_DEBUG 1
-#if DO_DEBUG
-extern int TDFX_DEBUG;
-#else
-#define TDFX_DEBUG 0
-#endif
-
-#define DEBUG_ALWAYS_SYNC 0x01
-#define DEBUG_VERBOSE_API 0x02
-#define DEBUG_VERBOSE_DRI 0x04
-#define DEBUG_VERBOSE_FALL 0x08
-
-/* conf */
-#define FX_COMPRESS_S3TC_AS_FXT1_HACK 1
-#define FX_TC_NAPALM 0
-
-#endif /* __TDFX_CONTEXT_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.c
deleted file mode 100644
index 02fbace5b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c,v 1.10 2002/10/30 12:52:00 alanh Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_dd.h"
-#include "tdfx_lock.h"
-#include "tdfx_vb.h"
-#include "tdfx_pixels.h"
-
-#include "context.h"
-#include "enums.h"
-#include "framebuffer.h"
-#include "swrast/swrast.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-
-#define TDFX_DATE "20040719"
-
-
-/* These are used in calls to FX_grColorMaskv() */
-const GLboolean false4[4] = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE };
-const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE };
-
-
-
-/* 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 *tdfxDDGetString( GLcontext *ctx, GLenum name )
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
-
- switch ( name ) {
- case GL_RENDERER:
- {
- /* The renderer string must be per-context state to handle
- * multihead correctly.
- */
- char *buffer = fxMesa->rendererString;
- char hardware[100];
-
- LOCK_HARDWARE(fxMesa);
- strcpy( hardware, fxMesa->Glide.grGetString(GR_HARDWARE) );
- UNLOCK_HARDWARE(fxMesa);
-
- strcpy( buffer, "Mesa DRI " );
- strcat( buffer, TDFX_DATE );
- strcat( buffer, " " );
-
- if ( strcmp( hardware, "Voodoo3 (tm)" ) == 0 ) {
- strcat( buffer, "Voodoo3" );
- }
- else if ( strcmp( hardware, "Voodoo Banshee (tm)" ) == 0 ) {
- strcat( buffer, "VoodooBanshee" );
- }
- else if ( strcmp( hardware, "Voodoo4 (tm)" ) == 0 ) {
- strcat( buffer, "Voodoo4" );
- }
- else if ( strcmp( hardware, "Voodoo5 (tm)" ) == 0 ) {
- strcat( buffer, "Voodoo5" );
- }
- else {
- /* unexpected result: replace spaces with hyphens */
- int i;
- for ( i = 0 ; hardware[i] && i < 60 ; i++ ) {
- if ( hardware[i] == ' ' || hardware[i] == '\t' )
- hardware[i] = '-';
- }
- strcat( buffer, hardware );
- }
-
- /* Append any CPU-specific information.
- */
-#ifdef USE_X86_ASM
- if ( _mesa_x86_cpu_features ) {
- strncat( buffer, " x86", 4 );
- }
-#endif
-#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
- return (const GLubyte *) buffer;
- }
- case GL_VENDOR:
- return (const GLubyte *)"VA Linux Systems, Inc.";
- default:
- return NULL;
- }
-}
-
-
-/* Return uptodate buffer size information.
- */
-static void tdfxDDGetBufferSize( GLframebuffer *buffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- LOCK_HARDWARE( fxMesa );
- *width = fxMesa->width;
- *height = fxMesa->height;
- UNLOCK_HARDWARE( fxMesa );
-}
-
-
-
-/*
- * Return the current value of the occlusion test flag and
- * reset the flag (hardware counters) to false.
- */
-static GLboolean get_occlusion_result( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLboolean result;
-
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grFinish(); /* required to flush the FIFO - FB 21-01-2002 */
-
- if (ctx->Depth.OcclusionTest) {
- if (ctx->OcclusionResult) {
- result = GL_TRUE; /* result of software rendering */
- }
- else {
- FxI32 zfail, in;
- fxMesa->Glide.grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &zfail);
- fxMesa->Glide.grGet(GR_STATS_PIXELS_IN, 4, &in);
- /* Geometry is occluded if there is no input (in == 0) */
- /* or if all pixels failed the depth test (zfail == in) */
- /* The < 1 is there because I have empirically seen cases where */
- /* zfail > in.... go figure. FB - 21-01-2002. */
- result = ((in - zfail) < 1 || in == 0) ? GL_FALSE : GL_TRUE;
- }
- }
- else {
- result = ctx->OcclusionResultSaved;
- }
-
- /* reset results now */
- fxMesa->Glide.grReset(GR_STATS_PIXELS);
- ctx->OcclusionResult = GL_FALSE;
- ctx->OcclusionResultSaved = GL_FALSE;
-
- UNLOCK_HARDWARE( fxMesa );
-
- return result;
-}
-
-
-/*
- * We're only implementing this function to handle the
- * GL_OCCLUSTION_TEST_RESULT_HP case. It's special because it
- * has a side-effect: resetting the occlustion result flag.
- */
-static GLboolean tdfxDDGetBooleanv( GLcontext *ctx, GLenum pname,
- GLboolean *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-static GLboolean tdfxDDGetDoublev( GLcontext *ctx, GLenum pname,
- GLdouble *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = (GLdouble) get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-static GLboolean tdfxDDGetFloatv( GLcontext *ctx, GLenum pname,
- GLfloat *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = (GLfloat) get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-static GLboolean tdfxDDGetIntegerv( GLcontext *ctx, GLenum pname,
- GLint *result )
-{
- if ( pname == GL_OCCLUSION_TEST_RESULT_HP ) {
- *result = (GLint) get_occlusion_result( ctx );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-
-#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \
- ((vis->redBits == r) && \
- (vis->greenBits == g) && \
- (vis->blueBits == b) && \
- (vis->alphaBits == a))
-
-void tdfxDDInitDriverFuncs( const __GLcontextModes *visual,
- struct dd_function_table *functions )
-{
- if ( MESA_VERBOSE & VERBOSE_DRIVER ) {
- fprintf( stderr, "tdfx: %s()\n", __FUNCTION__ );
- }
-
- functions->GetString = tdfxDDGetString;
- functions->GetBufferSize = tdfxDDGetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
-
- /* Accelerated paths
- */
- if ( VISUAL_EQUALS_RGBA(visual, 8, 8, 8, 8) )
- {
- functions->DrawPixels = tdfx_drawpixels_R8G8B8A8;
- functions->ReadPixels = tdfx_readpixels_R8G8B8A8;
- }
- else if ( VISUAL_EQUALS_RGBA(visual, 5, 6, 5, 0) )
- {
- functions->ReadPixels = tdfx_readpixels_R5G6B5;
- }
-
- functions->GetBooleanv = tdfxDDGetBooleanv;
- functions->GetDoublev = tdfxDDGetDoublev;
- functions->GetFloatv = tdfxDDGetFloatv;
- functions->GetIntegerv = tdfxDDGetIntegerv;
-}
-
-
-/*
- * These are here for lack of a better place.
- */
-
-void
-FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- LOCK_HARDWARE(fxMesa);
- if (ctx->Visual.redBits == 8) {
- /* 32bpp mode */
- ASSERT( fxMesa->Glide.grColorMaskExt );
- fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
- rgba[BCOMP], rgba[ACOMP]);
- }
- else {
- /* 16 bpp mode */
- /* we never have an alpha buffer */
- fxMesa->Glide.grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP],
- GL_FALSE);
- }
- UNLOCK_HARDWARE(fxMesa);
-}
-
-void
-FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4])
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- if (ctx->Visual.redBits == 8) {
- /* 32bpp mode */
- ASSERT( fxMesa->Glide.grColorMaskExt );
- fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
- rgba[BCOMP], rgba[ACOMP]);
- }
- else {
- /* 16 bpp mode */
- /* we never have an alpha buffer */
- fxMesa->Glide.grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP],
- GL_FALSE);
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.h
deleted file mode 100644
index 5ceba9d5f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_dd.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.h,v 1.1 2001/03/21 16:14:27 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_DD_H__
-#define __TDFX_DD_H__
-
-#include "context.h"
-
-extern void tdfxDDInitDriverFuncs( const __GLcontextModes *visual,
- struct dd_function_table *functions );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_glide.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_glide.h
deleted file mode 100644
index f077aa678..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_glide.h
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * This file defines macros and types necessary for accessing glide3.
- */
-
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_glide.h,v 1.1 2002/02/22 21:45:03 dawes Exp $ */
-
-#ifndef NEWGLIDE_H
-#define NEWGLIDE_H
-
-#define FX_CALL
-
-typedef unsigned char FxU8;
-typedef signed char FxI8;
-typedef unsigned short FxU16;
-typedef signed short FxI16;
-#if defined(__alpha__) || defined (__LP64__)
-typedef signed int FxI32;
-typedef unsigned int FxU32;
-#else
-typedef signed long FxI32;
-typedef unsigned long FxU32;
-#endif
-typedef unsigned long AnyPtr;
-typedef int FxBool;
-typedef float FxFloat;
-typedef double FxDouble;
-
-typedef unsigned long FxColor_t;
-typedef struct
-{
- float r, g, b, a;
-}
-FxColor4;
-
-typedef FxU32 GrColor_t;
-typedef FxU8 GrAlpha_t;
-typedef FxU32 GrMipMapId_t;
-typedef FxU32 GrStipplePattern_t;
-typedef FxU8 GrFog_t;
-typedef FxU32 GrContext_t;
-typedef int (FX_CALL * GrProc) (void);
-
-#define FXTRUE 1
-#define FXFALSE 0
-
-#define FXBIT(i) (1L << (i))
-
-#define GR_NULL_MIPMAP_HANDLE ((GrMipMapId_t) -1)
-
-#define GR_MIPMAPLEVELMASK_EVEN FXBIT(0)
-#define GR_MIPMAPLEVELMASK_ODD FXBIT(1)
-#define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD )
-
-typedef FxI32 GrChipID_t;
-#define GR_TMU0 0x0
-#define GR_TMU1 0x1
-#define GR_TMU2 0x2
-
-#define GR_FBI 0x0
-
-typedef FxI32 GrCombineFunction_t;
-#define GR_COMBINE_FUNCTION_ZERO 0x0
-#define GR_COMBINE_FUNCTION_NONE GR_COMBINE_FUNCTION_ZERO
-#define GR_COMBINE_FUNCTION_LOCAL 0x1
-#define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2
-#define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3
-#define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7
-#define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL
-#define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8
-#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9
-#define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
-#define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10
-
-typedef FxI32 GrCombineFactor_t;
-#define GR_COMBINE_FACTOR_ZERO 0x0
-#define GR_COMBINE_FACTOR_NONE GR_COMBINE_FACTOR_ZERO
-#define GR_COMBINE_FACTOR_LOCAL 0x1
-#define GR_COMBINE_FACTOR_OTHER_ALPHA 0x2
-#define GR_COMBINE_FACTOR_LOCAL_ALPHA 0x3
-#define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4
-#define GR_COMBINE_FACTOR_TEXTURE_RGB 0x5
-#define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA
-#define GR_COMBINE_FACTOR_LOD_FRACTION 0x5
-#define GR_COMBINE_FACTOR_ONE 0x8
-#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9
-#define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa
-#define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb
-#define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc
-#define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA
-#define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd
-
-typedef FxI32 GrCombineLocal_t;
-#define GR_COMBINE_LOCAL_ITERATED 0x0
-#define GR_COMBINE_LOCAL_CONSTANT 0x1
-#define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT
-#define GR_COMBINE_LOCAL_DEPTH 0x2
-
-typedef FxI32 GrCombineOther_t;
-#define GR_COMBINE_OTHER_ITERATED 0x0
-#define GR_COMBINE_OTHER_TEXTURE 0x1
-#define GR_COMBINE_OTHER_CONSTANT 0x2
-#define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT
-
-typedef FxI32 GrAlphaSource_t;
-#define GR_ALPHASOURCE_CC_ALPHA 0x0
-#define GR_ALPHASOURCE_ITERATED_ALPHA 0x1
-#define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2
-#define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3
-
-typedef FxI32 GrColorCombineFnc_t;
-#define GR_COLORCOMBINE_ZERO 0x0
-#define GR_COLORCOMBINE_CCRGB 0x1
-#define GR_COLORCOMBINE_ITRGB 0x2
-#define GR_COLORCOMBINE_ITRGB_DELTA0 0x3
-#define GR_COLORCOMBINE_DECAL_TEXTURE 0x4
-#define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9
-#define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa
-#define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb
-#define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc
-#define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd
-#define GR_COLORCOMBINE_DIFF_SPEC_A 0xe
-#define GR_COLORCOMBINE_DIFF_SPEC_B 0xf
-#define GR_COLORCOMBINE_ONE 0x10
-
-typedef FxI32 GrAlphaBlendFnc_t;
-#define GR_BLEND_ZERO 0x0
-#define GR_BLEND_SRC_ALPHA 0x1
-#define GR_BLEND_SRC_COLOR 0x2
-#define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR
-#define GR_BLEND_DST_ALPHA 0x3
-#define GR_BLEND_ONE 0x4
-#define GR_BLEND_ONE_MINUS_SRC_ALPHA 0x5
-#define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6
-#define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR
-#define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7
-#define GR_BLEND_RESERVED_8 0x8
-#define GR_BLEND_RESERVED_9 0x9
-#define GR_BLEND_RESERVED_A 0xa
-#define GR_BLEND_RESERVED_B 0xb
-#define GR_BLEND_RESERVED_C 0xc
-#define GR_BLEND_RESERVED_D 0xd
-#define GR_BLEND_RESERVED_E 0xe
-#define GR_BLEND_ALPHA_SATURATE 0xf
-#define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE
-#define GR_BLEND_SAME_COLOR_EXT 0x08
-#define GR_BLEND_ONE_MINUS_SAME_COLOR_EXT 0x09
-
-typedef FxI32 GrAspectRatio_t;
-#define GR_ASPECT_LOG2_8x1 3
-#define GR_ASPECT_LOG2_4x1 2
-#define GR_ASPECT_LOG2_2x1 1
-#define GR_ASPECT_LOG2_1x1 0
-#define GR_ASPECT_LOG2_1x2 -1
-#define GR_ASPECT_LOG2_1x4 -2
-#define GR_ASPECT_LOG2_1x8 -3
-
-typedef FxI32 GrBuffer_t;
-#define GR_BUFFER_FRONTBUFFER 0x0
-#define GR_BUFFER_BACKBUFFER 0x1
-#define GR_BUFFER_AUXBUFFER 0x2
-#define GR_BUFFER_DEPTHBUFFER 0x3
-#define GR_BUFFER_ALPHABUFFER 0x4
-#define GR_BUFFER_TRIPLEBUFFER 0x5
-
-typedef FxI32 GrChromakeyMode_t;
-#define GR_CHROMAKEY_DISABLE 0x0
-#define GR_CHROMAKEY_ENABLE 0x1
-
-typedef FxI32 GrChromaRangeMode_t;
-#define GR_CHROMARANGE_RGB_ALL_EXT 0x0
-
-#define GR_CHROMARANGE_DISABLE_EXT 0x00
-#define GR_CHROMARANGE_ENABLE_EXT 0x01
-
-typedef FxI32 GrTexChromakeyMode_t;
-#define GR_TEXCHROMA_DISABLE_EXT 0x0
-#define GR_TEXCHROMA_ENABLE_EXT 0x1
-
-#define GR_TEXCHROMARANGE_RGB_ALL_EXT 0x0
-
-typedef FxI32 GrCmpFnc_t;
-#define GR_CMP_NEVER 0x0
-#define GR_CMP_LESS 0x1
-#define GR_CMP_EQUAL 0x2
-#define GR_CMP_LEQUAL 0x3
-#define GR_CMP_GREATER 0x4
-#define GR_CMP_NOTEQUAL 0x5
-#define GR_CMP_GEQUAL 0x6
-#define GR_CMP_ALWAYS 0x7
-
-typedef FxI32 GrColorFormat_t;
-#define GR_COLORFORMAT_ARGB 0x0
-#define GR_COLORFORMAT_ABGR 0x1
-
-#define GR_COLORFORMAT_RGBA 0x2
-#define GR_COLORFORMAT_BGRA 0x3
-
-typedef FxI32 GrCullMode_t;
-#define GR_CULL_DISABLE 0x0
-#define GR_CULL_NEGATIVE 0x1
-#define GR_CULL_POSITIVE 0x2
-
-typedef FxI32 GrDepthBufferMode_t;
-#define GR_DEPTHBUFFER_DISABLE 0x0
-#define GR_DEPTHBUFFER_ZBUFFER 0x1
-#define GR_DEPTHBUFFER_WBUFFER 0x2
-#define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS 0x3
-#define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS 0x4
-
-typedef FxI32 GrDitherMode_t;
-#define GR_DITHER_DISABLE 0x0
-#define GR_DITHER_2x2 0x1
-#define GR_DITHER_4x4 0x2
-
-typedef FxI32 GrStippleMode_t;
-#define GR_STIPPLE_DISABLE 0x0
-#define GR_STIPPLE_PATTERN 0x1
-#define GR_STIPPLE_ROTATE 0x2
-
-typedef FxI32 GrFogMode_t;
-#define GR_FOG_DISABLE 0x0
-#define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x1
-#define GR_FOG_WITH_TABLE_ON_Q 0x2
-#define GR_FOG_WITH_TABLE_ON_W GR_FOG_WITH_TABLE_ON_Q
-#define GR_FOG_WITH_ITERATED_Z 0x3
-#define GR_FOG_WITH_ITERATED_ALPHA_EXT 0x4
-#define GR_FOG_MULT2 0x100
-#define GR_FOG_ADD2 0x200
-
-typedef FxU32 GrLock_t;
-#define GR_LFB_READ_ONLY 0x00
-#define GR_LFB_WRITE_ONLY 0x01
-#define GR_LFB_IDLE 0x00
-#define GR_LFB_NOIDLE 0x10
-
-typedef FxI32 GrLfbBypassMode_t;
-#define GR_LFBBYPASS_DISABLE 0x0
-#define GR_LFBBYPASS_ENABLE 0x1
-
-typedef FxI32 GrLfbWriteMode_t;
-#define GR_LFBWRITEMODE_565 0x0
-#define GR_LFBWRITEMODE_555 0x1
-#define GR_LFBWRITEMODE_1555 0x2
-#define GR_LFBWRITEMODE_RESERVED1 0x3
-#define GR_LFBWRITEMODE_888 0x4
-#define GR_LFBWRITEMODE_8888 0x5
-#define GR_LFBWRITEMODE_RESERVED2 0x6
-#define GR_LFBWRITEMODE_RESERVED3 0x7
-#define GR_LFBWRITEMODE_RESERVED4 0x8
-#define GR_LFBWRITEMODE_RESERVED5 0x9
-#define GR_LFBWRITEMODE_RESERVED6 0xa
-#define GR_LFBWRITEMODE_RESERVED7 0xb
-#define GR_LFBWRITEMODE_565_DEPTH 0xc
-#define GR_LFBWRITEMODE_555_DEPTH 0xd
-#define GR_LFBWRITEMODE_1555_DEPTH 0xe
-#define GR_LFBWRITEMODE_ZA16 0xf
-#define GR_LFBWRITEMODE_ANY 0xFF
-
-typedef FxI32 GrOriginLocation_t;
-#define GR_ORIGIN_UPPER_LEFT 0x0
-#define GR_ORIGIN_LOWER_LEFT 0x1
-#define GR_ORIGIN_ANY 0xFF
-
-typedef struct
-{
- int size;
- void *lfbPtr;
- FxU32 strideInBytes;
- GrLfbWriteMode_t writeMode;
- GrOriginLocation_t origin;
-}
-GrLfbInfo_t;
-
-typedef FxI32 GrLOD_t;
-#define GR_LOD_LOG2_2048 0xb
-#define GR_LOD_LOG2_1024 0xa
-#define GR_LOD_LOG2_512 0x9
-#define GR_LOD_LOG2_256 0x8
-#define GR_LOD_LOG2_128 0x7
-#define GR_LOD_LOG2_64 0x6
-#define GR_LOD_LOG2_32 0x5
-#define GR_LOD_LOG2_16 0x4
-#define GR_LOD_LOG2_8 0x3
-#define GR_LOD_LOG2_4 0x2
-#define GR_LOD_LOG2_2 0x1
-#define GR_LOD_LOG2_1 0x0
-
-typedef FxI32 GrMipMapMode_t;
-#define GR_MIPMAP_DISABLE 0x0
-#define GR_MIPMAP_NEAREST 0x1
-#define GR_MIPMAP_NEAREST_DITHER 0x2
-
-typedef FxI32 GrSmoothingMode_t;
-#define GR_SMOOTHING_DISABLE 0x0
-#define GR_SMOOTHING_ENABLE 0x1
-
-typedef FxI32 GrTextureClampMode_t;
-#define GR_TEXTURECLAMP_WRAP 0x0
-#define GR_TEXTURECLAMP_CLAMP 0x1
-#define GR_TEXTURECLAMP_MIRROR_EXT 0x2
-
-typedef FxI32 GrTextureCombineFnc_t;
-#define GR_TEXTURECOMBINE_ZERO 0x0
-#define GR_TEXTURECOMBINE_DECAL 0x1
-#define GR_TEXTURECOMBINE_OTHER 0x2
-#define GR_TEXTURECOMBINE_ADD 0x3
-#define GR_TEXTURECOMBINE_MULTIPLY 0x4
-#define GR_TEXTURECOMBINE_SUBTRACT 0x5
-#define GR_TEXTURECOMBINE_DETAIL 0x6
-#define GR_TEXTURECOMBINE_DETAIL_OTHER 0x7
-#define GR_TEXTURECOMBINE_TRILINEAR_ODD 0x8
-#define GR_TEXTURECOMBINE_TRILINEAR_EVEN 0x9
-#define GR_TEXTURECOMBINE_ONE 0xa
-
-typedef FxI32 GrTextureFilterMode_t;
-#define GR_TEXTUREFILTER_POINT_SAMPLED 0x0
-#define GR_TEXTUREFILTER_BILINEAR 0x1
-
-typedef FxI32 GrTextureFormat_t;
-#define GR_TEXFMT_8BIT 0x0
-#define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT
-#define GR_TEXFMT_YIQ_422 0x1
-#define GR_TEXFMT_ALPHA_8 0x2
-#define GR_TEXFMT_INTENSITY_8 0x3
-#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
-#define GR_TEXFMT_P_8 0x5
-#define GR_TEXFMT_RSVD0 0x6
-#define GR_TEXFMT_RSVD1 0x7
-#define GR_TEXFMT_16BIT 0x8
-#define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT
-#define GR_TEXFMT_AYIQ_8422 0x9
-#define GR_TEXFMT_RGB_565 0xa
-#define GR_TEXFMT_ARGB_1555 0xb
-#define GR_TEXFMT_ARGB_4444 0xc
-#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
-#define GR_TEXFMT_AP_88 0xe
-#define GR_TEXFMT_RSVD2 0xf
-#define GR_TEXFMT_ARGB_CMP_FXT1 0x11
-#define GR_TEXFMT_ARGB_8888 0x12
-#define GR_TEXFMT_YUYV_422 0x13
-#define GR_TEXFMT_UYVY_422 0x14
-#define GR_TEXFMT_AYUV_444 0x15
-#define GR_TEXFMT_ARGB_CMP_DXT1 0x16
-#define GR_TEXFMT_ARGB_CMP_DXT2 0x17
-#define GR_TEXFMT_ARGB_CMP_DXT3 0x18
-#define GR_TEXFMT_ARGB_CMP_DXT4 0x19
-#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A
-
-typedef FxU32 GrTexTable_t;
-#define GR_TEXTABLE_NCC0 0x0
-#define GR_TEXTABLE_NCC1 0x1
-#define GR_TEXTABLE_PALETTE 0x2
-#define GR_TEXTABLE_PALETTE_6666_EXT 0x3
-
-typedef FxU32 GrNCCTable_t;
-#define GR_NCCTABLE_NCC0 0x0
-#define GR_NCCTABLE_NCC1 0x1
-
-typedef FxU32 GrTexBaseRange_t;
-#define GR_TEXBASE_256 0x3
-#define GR_TEXBASE_128 0x2
-#define GR_TEXBASE_64 0x1
-#define GR_TEXBASE_32_TO_1 0x0
-#define GR_TEXBASE_2048 0x7
-#define GR_TEXBASE_1024 0x6
-#define GR_TEXBASE_512 0x5
-#define GR_TEXBASE_256_TO_1 0x4
-
-typedef FxU32 GrEnableMode_t;
-#define GR_MODE_DISABLE 0x0
-#define GR_MODE_ENABLE 0x1
-
-#define GR_AA_ORDERED 0x01
-#define GR_ALLOW_MIPMAP_DITHER 0x02
-#define GR_PASSTHRU 0x03
-#define GR_SHAMELESS_PLUG 0x04
-#define GR_VIDEO_SMOOTHING 0x05
-
-typedef FxU32 GrCoordinateSpaceMode_t;
-#define GR_WINDOW_COORDS 0x00
-#define GR_CLIP_COORDS 0x01
-
-/* Parameters for strips */
-#define GR_PARAM_XY 0x01
-#define GR_PARAM_Z 0x02
-#define GR_PARAM_W 0x03
-#define GR_PARAM_Q 0x04
-#define GR_PARAM_FOG_EXT 0x05
-
-#define GR_PARAM_A 0x10
-
-#define GR_PARAM_RGB 0x20
-
-#define GR_PARAM_PARGB 0x30
-
-#define GR_PARAM_ST0 0x40
-#define GR_PARAM_ST1 GR_PARAM_ST0+1
-#define GR_PARAM_ST2 GR_PARAM_ST0+2
-
-#define GR_PARAM_Q0 0x50
-#define GR_PARAM_Q1 GR_PARAM_Q0+1
-#define GR_PARAM_Q2 GR_PARAM_Q0+2
-
-#define GR_PARAM_DISABLE 0x00
-#define GR_PARAM_ENABLE 0x01
-
-/* grDrawVertexArray/grDrawVertexArrayContiguous */
-#define GR_POINTS 0
-#define GR_LINE_STRIP 1
-#define GR_LINES 2
-#define GR_POLYGON 3
-#define GR_TRIANGLE_STRIP 4
-#define GR_TRIANGLE_FAN 5
-#define GR_TRIANGLES 6
-#define GR_TRIANGLE_STRIP_CONTINUE 7
-#define GR_TRIANGLE_FAN_CONTINUE 8
-
-/* grGet/grReset */
-#define GR_BITS_DEPTH 0x01
-#define GR_BITS_RGBA 0x02
-#define GR_FIFO_FULLNESS 0x03
-#define GR_FOG_TABLE_ENTRIES 0x04
-#define GR_GAMMA_TABLE_ENTRIES 0x05
-#define GR_GLIDE_STATE_SIZE 0x06
-#define GR_GLIDE_VERTEXLAYOUT_SIZE 0x07
-#define GR_IS_BUSY 0x08
-#define GR_LFB_PIXEL_PIPE 0x09
-#define GR_MAX_TEXTURE_SIZE 0x0a
-#define GR_MAX_TEXTURE_ASPECT_RATIO 0x0b
-#define GR_MEMORY_FB 0x0c
-#define GR_MEMORY_TMU 0x0d
-#define GR_MEMORY_UMA 0x0e
-#define GR_NUM_BOARDS 0x0f
-#define GR_NON_POWER_OF_TWO_TEXTURES 0x10
-#define GR_NUM_FB 0x11
-#define GR_NUM_SWAP_HISTORY_BUFFER 0x12
-#define GR_NUM_TMU 0x13
-#define GR_PENDING_BUFFERSWAPS 0x14
-#define GR_REVISION_FB 0x15
-#define GR_REVISION_TMU 0x16
-#define GR_STATS_LINES 0x17
-#define GR_STATS_PIXELS_AFUNC_FAIL 0x18
-#define GR_STATS_PIXELS_CHROMA_FAIL 0x19
-#define GR_STATS_PIXELS_DEPTHFUNC_FAIL 0x1a
-#define GR_STATS_PIXELS_IN 0x1b
-#define GR_STATS_PIXELS_OUT 0x1c
-#define GR_STATS_PIXELS 0x1d
-#define GR_STATS_POINTS 0x1e
-#define GR_STATS_TRIANGLES_IN 0x1f
-#define GR_STATS_TRIANGLES_OUT 0x20
-#define GR_STATS_TRIANGLES 0x21
-#define GR_SWAP_HISTORY 0x22
-#define GR_SUPPORTS_PASSTHRU 0x23
-#define GR_TEXTURE_ALIGN 0x24
-#define GR_VIDEO_POSITION 0x25
-#define GR_VIEWPORT 0x26
-#define GR_WDEPTH_MIN_MAX 0x27
-#define GR_ZDEPTH_MIN_MAX 0x28
-#define GR_VERTEX_PARAMETER 0x29
-#define GR_BITS_GAMMA 0x2a
-#define GR_GET_RESERVED_1 0x1000
-
-/* grGetString types */
-#define GR_EXTENSION 0xa0
-#define GR_HARDWARE 0xa1
-#define GR_RENDERER 0xa2
-#define GR_VENDOR 0xa3
-#define GR_VERSION 0xa4
-
-typedef FxI32 GrScreenRefresh_t;
-#define GR_REFRESH_NONE 0xff
-
-typedef FxI32 GrScreenResolution_t;
-#define GR_RESOLUTION_NONE 0xff
-
-typedef struct
-{
- GrLOD_t smallLodLog2;
- GrLOD_t largeLodLog2;
- GrAspectRatio_t aspectRatioLog2;
- GrTextureFormat_t format;
- void *data;
-}
-GrTexInfo;
-
-typedef struct GrSstPerfStats_s
-{
- FxU32 pixelsIn;
- FxU32 chromaFail;
- FxU32 zFuncFail;
- FxU32 aFuncFail;
- FxU32 pixelsOut;
-}
-GrSstPerfStats_t;
-
-typedef struct
-{
- GrScreenResolution_t resolution;
- GrScreenRefresh_t refresh;
- int numColorBuffers;
- int numAuxBuffers;
-}
-GrResolution;
-
-typedef GrResolution GlideResolution;
-#define GR_QUERY_ANY ((FxU32)(~0))
-
-typedef FxU32 GrLfbSrcFmt_t;
-#define GR_LFB_SRC_FMT_565 0x00
-#define GR_LFB_SRC_FMT_555 0x01
-#define GR_LFB_SRC_FMT_1555 0x02
-#define GR_LFB_SRC_FMT_888 0x04
-#define GR_LFB_SRC_FMT_8888 0x05
-#define GR_LFB_SRC_FMT_565_DEPTH 0x0c
-#define GR_LFB_SRC_FMT_555_DEPTH 0x0d
-#define GR_LFB_SRC_FMT_1555_DEPTH 0x0e
-#define GR_LFB_SRC_FMT_ZA16 0x0f
-#define GR_LFB_SRC_FMT_RLE16 0x80
-
-typedef FxU32 GrPixelFormat_t;
-#define GR_PIXFMT_I_8 0x0001
-#define GR_PIXFMT_AI_88 0x0002
-#define GR_PIXFMT_RGB_565 0x0003
-#define GR_PIXFMT_ARGB_1555 0x0004
-#define GR_PIXFMT_ARGB_8888 0x0005
-#define GR_PIXFMT_AA_2_RGB_565 0x0006
-#define GR_PIXFMT_AA_2_ARGB_1555 0x0007
-#define GR_PIXFMT_AA_2_ARGB_8888 0x0008
-#define GR_PIXFMT_AA_4_RGB_565 0x0009
-#define GR_PIXFMT_AA_4_ARGB_1555 0x000a
-#define GR_PIXFMT_AA_4_ARGB_8888 0x000b
-
-#define GR_LFBWRITEMODE_Z32 0x0008
-
-typedef FxU32 GrAAMode_t;
-#define GR_AA_NONE 0x0000
-#define GR_AA_4SAMPLES 0x0001
-
-typedef FxU8 GrStencil_t;
-
-typedef FxU32 GrStencilOp_t;
-#define GR_STENCILOP_KEEP 0x00
-#define GR_STENCILOP_ZERO 0x01
-#define GR_STENCILOP_REPLACE 0x02
-#define GR_STENCILOP_INCR_CLAMP 0x03
-#define GR_STENCILOP_DECR_CLAMP 0x04
-#define GR_STENCILOP_INVERT 0x05
-#define GR_STENCILOP_INCR_WRAP 0x06
-#define GR_STENCILOP_DECR_WRAP 0x07
-
-#define GR_TEXTURE_UMA_EXT 0x06
-#define GR_STENCIL_MODE_EXT 0x07
-#define GR_OPENGL_MODE_EXT 0x08
-
-typedef FxU32 GrCCUColor_t;
-typedef FxU32 GrACUColor_t;
-typedef FxU32 GrTCCUColor_t;
-typedef FxU32 GrTACUColor_t;
-#define GR_CMBX_ZERO 0x00
-#define GR_CMBX_TEXTURE_ALPHA 0x01
-#define GR_CMBX_ALOCAL 0x02
-#define GR_CMBX_AOTHER 0x03
-#define GR_CMBX_B 0x04
-#define GR_CMBX_CONSTANT_ALPHA 0x05
-#define GR_CMBX_CONSTANT_COLOR 0x06
-#define GR_CMBX_DETAIL_FACTOR 0x07
-#define GR_CMBX_ITALPHA 0x08
-#define GR_CMBX_ITRGB 0x09
-#define GR_CMBX_LOCAL_TEXTURE_ALPHA 0x0a
-#define GR_CMBX_LOCAL_TEXTURE_RGB 0x0b
-#define GR_CMBX_LOD_FRAC 0x0c
-#define GR_CMBX_OTHER_TEXTURE_ALPHA 0x0d
-#define GR_CMBX_OTHER_TEXTURE_RGB 0x0e
-#define GR_CMBX_TEXTURE_RGB 0x0f
-#define GR_CMBX_TMU_CALPHA 0x10
-#define GR_CMBX_TMU_CCOLOR 0x11
-
-typedef FxU32 GrCombineMode_t;
-#define GR_FUNC_MODE_ZERO 0x00
-#define GR_FUNC_MODE_X 0x01
-#define GR_FUNC_MODE_ONE_MINUS_X 0x02
-#define GR_FUNC_MODE_NEGATIVE_X 0x03
-#define GR_FUNC_MODE_X_MINUS_HALF 0x04
-
-typedef FxU32 GrAlphaBlendOp_t;
-#define GR_BLEND_OP_ADD 0x00
-#define GR_BLEND_OP_SUB 0x01
-#define GR_BLEND_OP_REVSUB 0x02
-
-typedef struct
-{
- FxU32 data[256];
-}
-GuTexPalette;
-
-typedef void (*GrErrorCallbackFnc_t) (const char *string, FxBool fatal);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.c
deleted file mode 100644
index 6bbfb8d3a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.c,v 1.5 2002/12/16 16:19:00 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_lock.h"
-#include "tdfx_state.h"
-#include "tdfx_render.h"
-#include "tdfx_texman.h"
-#include "tdfx_tris.h"
-
-
-void tdfxGetLock( tdfxContextPtr fxMesa )
-{
- __DRIcontextPrivate *cPriv = fxMesa->driContext;
- __DRIdrawablePrivate *dPriv = cPriv->driDrawablePriv;
- __DRIscreenPrivate *sPriv = dPriv->driScreenPriv;
- TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) +
- fxMesa->fxScreen->sarea_priv_offset);
- unsigned int stamp = dPriv->lastStamp;
-
- drmGetLock( fxMesa->driFd, fxMesa->hHWContext, 0 );
-
- /* This macro will update dPriv's cliprects if needed */
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if ( saPriv->fifoOwner != fxMesa->hHWContext ) {
- fxMesa->Glide.grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead );
- }
-
- if ( saPriv->ctxOwner != fxMesa->hHWContext ) {
- /* This sequence looks a little odd. Glide mirrors the state, and
- * when you get the state you are forcing the mirror to be up to
- * date, and then getting a copy from the mirror. You can then force
- * that state onto the hardware when you set the state.
- */
- void *state;
- FxI32 stateSize;
- fxMesa->Glide.grGet(GR_GLIDE_STATE_SIZE, 4, &stateSize);
- state = malloc(stateSize);
- fxMesa->Glide.grGlideGetState( state );
- fxMesa->Glide.grGlideSetState( state );
- free( state );
- }
-
-#if 0
- if ( saPriv->texOwner != fxMesa->hHWContext ) {
- tdfxTMRestoreTextures_NoLock( fxMesa );
- }
-#endif
-
- if ( *dPriv->pStamp != stamp || saPriv->ctxOwner != fxMesa->hHWContext ) {
- tdfxUpdateClipping(fxMesa->glCtx);
- tdfxUploadClipping(fxMesa);
- }
-
- DEBUG_LOCK();
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.h
deleted file mode 100644
index 616e65b2a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_lock.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_lock.h,v 1.3 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_LOCK_H__
-#define __TDFX_LOCK_H__
-
-/* You can turn this 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 /* DEBUG_LOCKING */
-
-
-extern void tdfxGetLock( tdfxContextPtr fxMesa );
-
-
-/* !!! 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 !!! */
-
-#define DRM_LIGHT_LOCK_RETURN(fd,lock,context,__ret) \
- do { \
- DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \
- if (__ret) drmGetLock(fd,context,0); \
- } while(0)
-
-#define LOCK_HARDWARE( fxMesa ) \
- do { \
- char __ret = 0; \
- \
- DEBUG_CHECK_LOCK(); \
- DRM_CAS( fxMesa->driHwLock, fxMesa->hHWContext, \
- DRM_LOCK_HELD | fxMesa->hHWContext, __ret ); \
- if ( __ret ) { \
- tdfxGetLock( fxMesa ); \
- } \
- DEBUG_LOCK(); \
- } while (0)
-
-/* Unlock the hardware using the global current context */
-#define UNLOCK_HARDWARE( fxMesa ) \
- do { \
- DRM_UNLOCK( fxMesa->driFd, fxMesa->driHwLock, fxMesa->hHWContext ); \
- DEBUG_RESET(); \
- } while (0)
-
-/*
- * This pair of macros makes a loop over the drawing operations
- * so it is not self contained and doesn't have the nice single
- * statement semantics of most macros.
- */
-#define BEGIN_CLIP_LOOP(fxMesa) \
- do { \
- LOCK_HARDWARE( fxMesa ); \
- BEGIN_CLIP_LOOP_LOCKED( fxMesa )
-
-#define BEGIN_CLIP_LOOP_LOCKED(fxMesa) \
- do { \
- int _nc = fxMesa->numClipRects; \
- while (_nc--) { \
- if (fxMesa->numClipRects > 1) { \
- int _height = fxMesa->screen_height; \
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[_nc].x1, \
- _height - fxMesa->pClipRects[_nc].y2, \
- fxMesa->pClipRects[_nc].x2, \
- _height - fxMesa->pClipRects[_nc].y1); \
- }
-
-
-#define END_CLIP_LOOP_LOCKED( fxMesa ) \
- } \
- } while (0)
-
-#define END_CLIP_LOOP( fxMesa ) \
- END_CLIP_LOOP_LOCKED( fxMesa ); \
- UNLOCK_HARDWARE( fxMesa ); \
- } while (0)
-
-#endif /* __TDFX_LOCK_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
deleted file mode 100644
index 6592ecccf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
+++ /dev/null
@@ -1,689 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.c,v 1.4 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Nathan Hand <nhand@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_dd.h"
-#include "tdfx_lock.h"
-#include "tdfx_vb.h"
-#include "tdfx_pixels.h"
-#include "tdfx_render.h"
-
-#include "swrast/swrast.h"
-
-#include "image.h"
-
-
-#define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
- do { \
- LOCK_HARDWARE(fxMesa); \
- fxMesa->Glide.grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,FXFALSE,src_stride,src_data); \
- UNLOCK_HARDWARE(fxMesa); \
- } while(0)
-
-
-#define FX_grLfbReadRegion(fxMesa,src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
- do { \
- LOCK_HARDWARE(fxMesa); \
- fxMesa->Glide.grLfbReadRegion(src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data); \
- UNLOCK_HARDWARE(fxMesa); \
- } while (0);
-
-
-#if 0
-static FxBool
-FX_grLfbLock(tdfxContextPtr fxMesa, GrLock_t type, GrBuffer_t buffer,
- GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
- FxBool pixelPipeline, GrLfbInfo_t * info)
-{
- FxBool result;
-
- LOCK_HARDWARE(fxMesa);
- result = fxMesa->Glide.grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
- UNLOCK_HARDWARE(fxMesa);
- return result;
-}
-#endif
-
-
-#define FX_grLfbUnlock(fxMesa, t, b) \
- do { \
- LOCK_HARDWARE(fxMesa); \
- fxMesa->Glide.grLfbUnlock(t, b); \
- UNLOCK_HARDWARE(fxMesa); \
- } while (0)
-
-
-
-#if 0
-/* test if window coord (px,py) is visible */
-static GLboolean
-inClipRects(tdfxContextPtr fxMesa, int px, int py)
-{
- int i;
- for (i = 0; i < fxMesa->numClipRects; i++) {
- if ((px >= fxMesa->pClipRects[i].x1) &&
- (px < fxMesa->pClipRects[i].x2) &&
- (py >= fxMesa->pClipRects[i].y1) &&
- (py < fxMesa->pClipRects[i].y2)) return GL_TRUE;
- }
- return GL_FALSE;
-}
-#endif
-
-/* test if rectangle of pixels (px,py) (px+width,py+height) is visible */
-static GLboolean
-inClipRects_Region(tdfxContextPtr fxMesa, int x, int y, int width, int height)
-{
- int i;
- int x1, y1, x2, y2;
- int xmin, xmax, ymin, ymax, pixelsleft;
-
- y1 = y - height + 1; y2 = y;
- x1 = x; x2 = x + width - 1;
- pixelsleft = width * height;
-
- for (i = 0; i < fxMesa->numClipRects; i++)
- {
- /* algorithm requires x1 < x2 and y1 < y2 */
- if ((fxMesa->pClipRects[i].x1 < fxMesa->pClipRects[i].x2)) {
- xmin = fxMesa->pClipRects[i].x1;
- xmax = fxMesa->pClipRects[i].x2-1;
- } else {
- xmin = fxMesa->pClipRects[i].x2;
- xmax = fxMesa->pClipRects[i].x1-1;
- }
- if ((fxMesa->pClipRects[i].y1 < fxMesa->pClipRects[i].y2)) {
- ymin = fxMesa->pClipRects[i].y1;
- ymax = fxMesa->pClipRects[i].y2-1;
- } else {
- ymin = fxMesa->pClipRects[i].y2;
- ymax = fxMesa->pClipRects[i].y1-1;
- }
-
- /* reject trivial cases */
- if (xmax < x1) continue;
- if (ymax < y1) continue;
- if (xmin > x2) continue;
- if (ymin > y2) continue;
-
- /* find the intersection */
- if (xmin < x1) xmin = x1;
- if (ymin < y1) ymin = y1;
- if (xmax > x2) xmax = x2;
- if (ymax > y2) ymax = y2;
-
- pixelsleft -= (xmax-xmin+1) * (ymax-ymin+1);
- }
-
- return pixelsleft == 0;
-}
-
-#if 0
-GLboolean
-tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte * bitmap)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- TdfxU16 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 (ctx->RasterMask & (ALPHATEST_BIT |
- BLEND_BIT |
- DEPTH_BIT |
- FOG_BIT |
- LOGIC_OP_BIT |
- SCISSOR_BIT |
- STENCIL_BIT |
- MASKING_BIT |
- MULTI_DRAW_BIT)) return GL_FALSE;
-
- 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 GL_TRUE; /* totally scissored away */
- }
- else {
- finalUnpack = unpack;
- }
-
- /* compute pixel value */
- {
- GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f);
- GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f);
- GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f);
- /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f); */
- if (fxMesa->bgrOrder) {
- color = (TdfxU16)
- (((TdfxU16) 0xf8 & b) << (11 - 3)) |
- (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) |
- (((TdfxU16) 0xf8 & r) >> 3);
- }
- else
- color = (TdfxU16)
- (((TdfxU16) 0xf8 & r) << (11 - 3)) |
- (((TdfxU16) 0xfc & g) << (5 - 3 + 1)) |
- (((TdfxU16) 0xf8 & b) >> 3);
- }
-
- info.size = sizeof(info);
- if (!TDFX_grLfbLock(fxMesa,
- GR_LFB_WRITE_ONLY,
- fxMesa->currentFB,
- GR_LFBWRITEMODE_565,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
-#ifndef TDFX_SILENT
- fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n");
-#endif
- return GL_TRUE;
- }
-
- {
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- /* 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 = (fxMesa->glCtx->Color.DrawBuffer[0] == GL_FRONT)
- ? (fxMesa->screen_width) : (info.strideInBytes / 2);
- 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) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- 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) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- dst[col] = color;
- }
- if (mask == 1U) {
- src++;
- mask = 128U;
- }
- else {
- mask = mask >> 1;
- }
- }
- if (mask != 128)
- src++;
- }
- dst -= dstStride;
- }
- }
-
- TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- return GL_TRUE;
-}
-#endif
-
-#if 0
-GLboolean
-tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte * bitmap)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GLuint 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 (ctx->RasterMask & (ALPHATEST_BIT |
- BLEND_BIT |
- DEPTH_BIT |
- FOG_BIT |
- LOGIC_OP_BIT |
- SCISSOR_BIT |
- STENCIL_BIT |
- MASKING_BIT |
- MULTI_DRAW_BIT)) return GL_FALSE;
-
- 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 GL_TRUE; /* totally scissored away */
- }
- else {
- finalUnpack = unpack;
- }
-
- /* compute pixel value */
- {
- GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f);
- GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f);
- GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f);
- GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0f);
- color = PACK_BGRA32(r, g, b, a);
- }
-
- info.size = sizeof(info);
- if (!TDFX_grLfbLock(fxMesa, GR_LFB_WRITE_ONLY,
- fxMesa->currentFB, GR_LFBWRITEMODE_8888,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
-#ifndef TDFX_SILENT
- fprintf(stderr, "tdfx Driver: error locking the linear frame buffer\n");
-#endif
- return GL_TRUE;
- }
-
- {
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- GLint dstStride;
- GLuint *dst;
- GLint row;
-
- if (fxMesa->glCtx->Color.DrawBuffer[0] == GL_FRONT) {
- dstStride = fxMesa->screen_width;
- dst =
- (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX +
- px);
- }
- else {
- dstStride = info.strideInBytes / 4;
- dst =
- (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX +
- px);
- }
-
- /* compute dest address of bottom-left pixel in bitmap */
- 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) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- 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) {
- if (inClipRects(fxMesa, winX + px + col, winY - py - row))
- dst[col] = color;
- }
- if (mask == 1U) {
- src++;
- mask = 128U;
- }
- else {
- mask = mask >> 1;
- }
- }
- if (mask != 128)
- src++;
- }
- dst -= dstStride;
- }
- }
-
- TDFX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB);
- return GL_TRUE;
-}
-#endif
-
-void
-tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid * dstImage)
-{
- if (format != GL_RGB ||
- type != GL_UNSIGNED_SHORT_5_6_5 ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)))
- {
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, packing,
- dstImage );
- return;
- }
-
- {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
-
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
-
- LOCK_HARDWARE( fxMesa );
- info.size = sizeof(info);
- if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->ReadBuffer,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
- const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer[0] ==
- GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes / 2);
- const GLushort *src = (const GLushort *) info.lfbPtr
- + scrY * srcStride + scrX;
- GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing,
- dstImage, width, height, format, type, 0, 0);
- const GLint dstStride = _mesa_image_row_stride(packing,
- width, format, type);
-
- /* 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;
- }
-
- fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
- }
- UNLOCK_HARDWARE( fxMesa );
- return;
- }
-}
-
-void
-tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid * dstImage)
-{
- if ((!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) &&
- !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)))
- {
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, packing,
- dstImage );
- return;
- }
-
-
- {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
-
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
-
- LOCK_HARDWARE(fxMesa);
- info.size = sizeof(info);
- if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY,
- fxMesa->ReadBuffer,
- GR_LFBWRITEMODE_ANY,
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
- {
- const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer[0] == GL_FRONT)
- ? (fxMesa->screen_width) : (info.strideInBytes / 4);
- const GLuint *src = (const GLuint *) info.lfbPtr
- + scrY * srcStride + scrX;
- const GLint dstStride =
- _mesa_image_row_stride(packing, width, format, type);
- GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing,
- dstImage, width, height, format, type, 0, 0);
- const GLint widthInBytes = width * 4;
-
- {
- GLint row;
- for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
- dst += dstStride;
- src -= srcStride;
- }
- }
-
- fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->ReadBuffer);
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-}
-
-void
-tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid * pixels)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ((!(format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) &&
- !(format == GL_BGRA && type == GL_UNSIGNED_BYTE)) ||
- ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != 1.0F ||
- (ctx->_ImageTransferState & (IMAGE_SCALE_BIAS_BIT|
- IMAGE_MAP_COLOR_BIT)) ||
- ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest ||
- fxMesa->Fallback)
- {
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
-
- {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GLboolean result = GL_FALSE;
-
- const GLint winX = fxMesa->x_offset;
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
-
- /* lock early to make sure cliprects are right */
- LOCK_HARDWARE(fxMesa);
-
- /* make sure hardware has latest blend funcs */
- if (ctx->Color.BlendEnabled) {
- fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC;
- tdfxEmitHwStateLocked( fxMesa );
- }
-
- /* look for clipmasks, giveup if region obscured */
- if (fxMesa->glCtx->Color.DrawBuffer[0] == GL_FRONT) {
- if (!inClipRects_Region(fxMesa, scrX, scrY, width, height)) {
- UNLOCK_HARDWARE(fxMesa);
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- return;
- }
- }
-
- info.size = sizeof(info);
- if (fxMesa->Glide.grLfbLock(GR_LFB_WRITE_ONLY,
- fxMesa->DrawBuffer,
- GR_LFBWRITEMODE_8888,
- GR_ORIGIN_UPPER_LEFT, FXTRUE, &info))
- {
- const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer[0] == GL_FRONT)
- ? (fxMesa->screen_width * 4) : (info.strideInBytes);
- GLubyte *dst = (GLubyte *) info.lfbPtr
- + scrY * dstStride + scrX * 4;
- const GLint srcStride =
- _mesa_image_row_stride(unpack, width, format, type);
- const GLubyte *src = (GLubyte *) _mesa_image_address2d(unpack,
- pixels, width, height, format, type, 0, 0);
- const GLint widthInBytes = width * 4;
-
- if ((format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) ||
- (format == GL_BGRA && type == GL_UNSIGNED_BYTE)) {
- GLint row;
- for (row = 0; row < height; row++) {
- MEMCPY(dst, src, widthInBytes);
- dst -= dstStride;
- src += srcStride;
- }
- result = GL_TRUE;
- }
-
- fxMesa->Glide.grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer);
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.h
deleted file mode 100644
index c38ce070c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_pixels.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_pixels.h,v 1.2 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Nathan Hand <nhand@valinux.com>
- *
- */
-
-#ifndef __TDFX_PIXELS_H__
-#define __TDFX_PIXELS_H__
-
-#include "context.h"
-
-extern void
-tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
-
-extern void
-tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap );
-
-extern void
-tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *dstImage );
-
-extern void
-tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *packing,
- GLvoid *dstImage );
-
-extern void
-tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.c
deleted file mode 100644
index 56f5f147e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.c
+++ /dev/null
@@ -1,808 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c,v 1.4 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * New fixes:
- * Daniel Borca <dborca@users.sourceforge.net>, 19 Jul 2004
- *
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_render.h"
-#include "tdfx_state.h"
-#include "tdfx_texman.h"
-#include "swrast/swrast.h"
-
-/* Clear the color and/or depth buffers.
- */
-static void tdfxClear( GLcontext *ctx,
- GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
-{
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLbitfield softwareMask = mask & (BUFFER_BIT_ACCUM);
- const GLuint stencil_size =
- fxMesa->haveHwStencil ? fxMesa->glCtx->Visual.stencilBits : 0;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %d, %d, %d, %d )\n",
- __FUNCTION__, (int) x, (int) y, (int) width, (int) height );
- }
-
- /* Need this check to respond to glScissor and clipping updates */
- if ((fxMesa->new_state & (TDFX_NEW_CLIP | TDFX_NEW_DEPTH)) ||
- (fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK)) {
- tdfxDDUpdateHwState(ctx);
- }
-
- /* we can't clear accum buffers */
- mask &= ~(BUFFER_BIT_ACCUM);
-
- if (mask & BUFFER_BIT_STENCIL) {
- if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask[0] != 0xff) {
- /* Napalm seems to have trouble with stencil write masks != 0xff */
- /* do stencil clear in software */
- mask &= ~(BUFFER_BIT_STENCIL);
- softwareMask |= BUFFER_BIT_STENCIL;
- }
- }
-
- if (fxMesa->glCtx->Visual.redBits != 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.
- */
- LOCK_HARDWARE(fxMesa);
- if (mask & BUFFER_BIT_STENCIL) {
- fxMesa->Glide.grStencilMask(/*ctx->Stencil.WriteMask*/ 0xff);
- /* set stencil ref value = desired clear value */
- fxMesa->Glide.grStencilFunc(GR_CMP_ALWAYS,
- fxMesa->Stencil.Clear, 0xff);
- fxMesa->Glide.grStencilOp(GR_STENCILOP_REPLACE,
- GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
- fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
- }
- else {
- fxMesa->Glide.grDisable(GR_STENCIL_MODE_EXT);
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-
- /*
- * This may be ugly, but it's needed in order to work around a number
- * of Glide bugs.
- */
- BEGIN_CLIP_LOOP(fxMesa);
- {
- /*
- * 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 */
- FX_grColorMaskv_NoLock(ctx, true4); /* work around Voodoo3 bug */
- fxMesa->Glide.grDepthMask(FXTRUE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0) {
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- }
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXFALSE);
- }
- 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 */
- fxMesa->Glide.grDepthMask(FXTRUE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grColorMaskv_NoLock(ctx, false4);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- /* clear front */
- FX_grColorMaskv_NoLock(ctx, true4);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXFALSE);
- }
- break;
- case BUFFER_BIT_BACK_LEFT:
- /* back buffer only */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- break;
- case BUFFER_BIT_FRONT_LEFT:
- /* front buffer only */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- break;
- case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT:
- /* front and back */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- break;
- case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT | BUFFER_BIT_DEPTH:
- /* clear front */
- fxMesa->Glide.grDepthMask(FXFALSE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- /* clear back and depth */
- fxMesa->Glide.grDepthMask(FXTRUE);
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- if (!ctx->Depth.Mask || !ctx->Depth.Mask) {
- fxMesa->Glide.grDepthMask(FXFALSE);
- }
- break;
- case BUFFER_BIT_DEPTH:
- /* just the depth buffer */
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grColorMaskv_NoLock(ctx, false4);
- fxMesa->Glide.grDepthMask(FXTRUE);
- if (stencil_size > 0)
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- else
- fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
- FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT)
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (!ctx->Depth.Test || !ctx->Depth.Mask)
- fxMesa->Glide.grDepthMask(FXFALSE);
- 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 */
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
- fxMesa->Glide.grDepthMask(FXFALSE);
- FX_grColorMaskv_NoLock(ctx, false4);
- fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
- fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
- if (ctx->Depth.Mask && ctx->Depth.Test) {
- fxMesa->Glide.grDepthMask(FXTRUE);
- }
- FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT)
- fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- }
- }
- }
- END_CLIP_LOOP(fxMesa);
-
- if (fxMesa->haveHwStencil && (mask & BUFFER_BIT_STENCIL)) {
- /* We changed the stencil state above. Signal that we need to
- * upload it again.
- */
- fxMesa->dirty |= TDFX_UPLOAD_STENCIL;
- }
-
- if (softwareMask)
- _swrast_Clear( ctx, softwareMask, all, x, y, width, height );
-}
-
-
-
-static void tdfxFinish( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
-
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grFinish();
- UNLOCK_HARDWARE( fxMesa );
-}
-
-static void tdfxFlush( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
-
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grFlush();
- UNLOCK_HARDWARE( fxMesa );
-}
-
-
-#if 0
-static const char *texSource(int k)
-{
- switch (k) {
- case GR_CMBX_ZERO:
- return "GR_CMBX_ZERO";
- case GR_CMBX_TEXTURE_ALPHA:
- return "GR_CMBX_TEXTURE_ALPHA";
- case GR_CMBX_ALOCAL:
- return "GR_CMBX_ALOCAL";
- case GR_CMBX_AOTHER:
- return "GR_CMBX_AOTHER";
- case GR_CMBX_B:
- return "GR_CMBX_B";
- case GR_CMBX_CONSTANT_ALPHA:
- return "GR_CMBX_CONSTANT_ALPHA";
- case GR_CMBX_CONSTANT_COLOR:
- return "GR_CMBX_CONSTANT_COLOR";
- case GR_CMBX_DETAIL_FACTOR:
- return "GR_CMBX_DETAIL_FACTOR";
- case GR_CMBX_ITALPHA:
- return "GR_CMBX_ITALPHA";
- case GR_CMBX_ITRGB:
- return "GR_CMBX_ITRGB";
- case GR_CMBX_LOCAL_TEXTURE_ALPHA:
- return "GR_CMBX_LOCAL_TEXTURE_ALPHA";
- case GR_CMBX_LOCAL_TEXTURE_RGB:
- return "GR_CMBX_LOCAL_TEXTURE_RGB";
- case GR_CMBX_LOD_FRAC:
- return "GR_CMBX_LOD_FRAC";
- case GR_CMBX_OTHER_TEXTURE_ALPHA:
- return "GR_CMBX_OTHER_TEXTURE_ALPHA";
- case GR_CMBX_OTHER_TEXTURE_RGB:
- return "GR_CMBX_OTHER_TEXTURE_RGB";
- case GR_CMBX_TEXTURE_RGB:
- return "GR_CMBX_TEXTURE_RGB";
- case GR_CMBX_TMU_CALPHA:
- return "GR_CMBX_TMU_CALPHA";
- case GR_CMBX_TMU_CCOLOR:
- return "GR_CMBX_TMU_CCOLOR";
- default:
- return "";
- }
-}
-#endif
-
-#if 0
-static const char *texMode(int k)
-{
- switch (k) {
- case GR_FUNC_MODE_ZERO:
- return "GR_FUNC_MODE_ZERO";
- case GR_FUNC_MODE_X:
- return "GR_FUNC_MODE_X";
- case GR_FUNC_MODE_ONE_MINUS_X:
- return "GR_FUNC_MODE_ONE_MINUS_X";
- case GR_FUNC_MODE_NEGATIVE_X:
- return "GR_FUNC_MODE_NEGATIVE_X";
- case GR_FUNC_MODE_X_MINUS_HALF:
- return "GR_FUNC_MODE_X_MINUS_HALF";
- default:
- return "";
- }
-}
-#endif
-
-#if 0
-static const char *texInvert(int k)
-{
- return k ? "FXTRUE" : "FXFALSE";
-}
-#endif
-
-static void uploadTextureEnv( tdfxContextPtr fxMesa )
-{
- if (TDFX_IS_NAPALM(fxMesa)) {
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
-#if 0
- printf("upload env %d\n", unit);
- printf(" cSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceA));
- printf(" cModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeA));
- printf(" cSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceB));
- printf(" cModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Color.ModeB));
- printf(" cSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceC));
- printf(" cInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertC));
- printf(" cSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Color.SourceD));
- printf(" cInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Color.InvertD));
- printf(" cShift = %d\t", fxMesa->TexCombineExt[unit].Color.Shift);
- printf(" cInvert = %d\n", fxMesa->TexCombineExt[unit].Color.Invert);
- printf(" aSourceA = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceA));
- printf(" aModeA = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeA));
- printf(" aSourceB = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceB));
- printf(" aModeB = %s\n", texMode(fxMesa->TexCombineExt[unit].Alpha.ModeB));
- printf(" aSourceC = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceC));
- printf(" aInvertC = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertC));
- printf(" aSourceD = %s\t", texSource(fxMesa->TexCombineExt[unit].Alpha.SourceD));
- printf(" aInvertD = %s\n", texInvert(fxMesa->TexCombineExt[unit].Alpha.InvertD));
- printf(" aShift = %d\t", fxMesa->TexCombineExt[unit].Alpha.Shift);
- printf(" aInvert = %d\n", fxMesa->TexCombineExt[unit].Alpha.Invert);
- printf(" Color = 0x%08x\n", fxMesa->TexCombineExt[unit].EnvColor);
-#endif
- fxMesa->Glide.grTexColorCombineExt(TDFX_TMU0 + unit,
- fxMesa->TexCombineExt[unit].Color.SourceA,
- fxMesa->TexCombineExt[unit].Color.ModeA,
- fxMesa->TexCombineExt[unit].Color.SourceB,
- fxMesa->TexCombineExt[unit].Color.ModeB,
- fxMesa->TexCombineExt[unit].Color.SourceC,
- fxMesa->TexCombineExt[unit].Color.InvertC,
- fxMesa->TexCombineExt[unit].Color.SourceD,
- fxMesa->TexCombineExt[unit].Color.InvertD,
- fxMesa->TexCombineExt[unit].Color.Shift,
- fxMesa->TexCombineExt[unit].Color.Invert);
- fxMesa->Glide.grTexAlphaCombineExt(TDFX_TMU0 + unit,
- fxMesa->TexCombineExt[unit].Alpha.SourceA,
- fxMesa->TexCombineExt[unit].Alpha.ModeA,
- fxMesa->TexCombineExt[unit].Alpha.SourceB,
- fxMesa->TexCombineExt[unit].Alpha.ModeB,
- fxMesa->TexCombineExt[unit].Alpha.SourceC,
- fxMesa->TexCombineExt[unit].Alpha.InvertC,
- fxMesa->TexCombineExt[unit].Alpha.SourceD,
- fxMesa->TexCombineExt[unit].Alpha.InvertD,
- fxMesa->TexCombineExt[unit].Alpha.Shift,
- fxMesa->TexCombineExt[unit].Alpha.Invert);
- fxMesa->Glide.grConstantColorValueExt(TDFX_TMU0 + unit,
- fxMesa->TexCombineExt[unit].EnvColor);
- }
- }
- else {
- /* Voodoo3 */
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- struct tdfx_texcombine *comb = &fxMesa->TexCombine[unit];
- fxMesa->Glide.grTexCombine(TDFX_TMU0 + unit,
- comb->FunctionRGB,
- comb->FactorRGB,
- comb->FunctionAlpha,
- comb->FactorAlpha,
- comb->InvertRGB,
- comb->InvertAlpha);
- }
- }
-}
-
-
-static void uploadTextureParams( tdfxContextPtr fxMesa )
-{
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- const struct tdfx_texparams *p = &fxMesa->TexParams[unit];
- /*
- printf("upload params %d\n", unit);
- printf(" clamp %x %x\n", env->sClamp, env->tClamp);
- printf(" filter %x %x\n", env->minFilt, env->magFilt);
- printf(" mipmap %x %x\n", env->mmMode, env->LODblend);
- printf(" lod bias %f\n", env->LodBias);
- */
- fxMesa->Glide.grTexClampMode(GR_TMU0 + unit, p->sClamp, p->tClamp);
- fxMesa->Glide.grTexFilterMode(GR_TMU0 + unit, p->minFilt, p->magFilt);
- fxMesa->Glide.grTexMipMapMode(GR_TMU0 + unit, p->mmMode, p->LODblend);
- fxMesa->Glide.grTexLodBiasValue(GR_TMU0 + unit, CLAMP(p->LodBias, -8, 7.75));
- }
-}
-
-
-static void uploadTextureSource( tdfxContextPtr fxMesa )
-{
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- const struct tdfx_texsource *src = &fxMesa->TexSource[unit];
- /*
- printf("upload source %d @ %d %p\n", unit, src->StartAddress, src->Info);
- */
- if (src->Info) {
- /*
- printf(" smallLodLog2=%d largeLodLog2=%d ar=%d format=%d data=%p\n",
- src->Info->smallLodLog2, src->Info->largeLodLog2,
- src->Info->aspectRatioLog2, src->Info->format,
- src->Info->data);
- */
- fxMesa->Glide.grTexSource(GR_TMU0 + unit,
- src->StartAddress,
- src->EvenOdd,
- src->Info);
- }
- }
-}
-
-
-static void uploadTextureImages( tdfxContextPtr fxMesa )
-{
- GLcontext *ctx = fxMesa->glCtx;
- int unit;
- for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
- if (ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- if (ti && ti->reloadImages && ti->whichTMU != TDFX_TMU_NONE) {
- /*
- printf("download texture image on unit %d\n", unit);
- */
- tdfxTMDownloadTexture(fxMesa, tObj);
- ti->reloadImages = GL_FALSE;
- }
- }
- }
-}
-
-
-
-/*
- * If scissoring is enabled, compute intersection of scissor region
- * with all X clip rects, resulting in new cliprect list.
- * If number of cliprects is zero or one, call grClipWindow to setup
- * the clip region. Otherwise we'll call grClipWindow inside the
- * BEGIN_CLIP_LOOP macro.
- */
-void tdfxUploadClipping( tdfxContextPtr fxMesa )
-{
- __DRIdrawablePrivate *dPriv = fxMesa->driDrawable;
-
- assert(dPriv);
-
- if (fxMesa->numClipRects == 0) {
- /* all drawing clipped away */
- fxMesa->Glide.grClipWindow(0, 0, 0, 0);
- }
- else if (fxMesa->numClipRects == 1) {
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[0].x1,
- fxMesa->screen_height - fxMesa->pClipRects[0].y2,
- fxMesa->pClipRects[0].x2,
- fxMesa->screen_height - fxMesa->pClipRects[0].y1);
- }
- /* else, we'll do a cliprect loop around all drawing */
-
- fxMesa->Glide.grDRIPosition( dPriv->x, dPriv->y, dPriv->w, dPriv->h,
- fxMesa->numClipRects, fxMesa->pClipRects );
-}
-
-
-void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa )
-{
- if ( !fxMesa->dirty )
- return;
-
- if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_COMBINE ) {
- if (TDFX_IS_NAPALM(fxMesa)) {
- fxMesa->Glide.grColorCombineExt(fxMesa->ColorCombineExt.SourceA,
- fxMesa->ColorCombineExt.ModeA,
- fxMesa->ColorCombineExt.SourceB,
- fxMesa->ColorCombineExt.ModeB,
- fxMesa->ColorCombineExt.SourceC,
- fxMesa->ColorCombineExt.InvertC,
- fxMesa->ColorCombineExt.SourceD,
- fxMesa->ColorCombineExt.InvertD,
- fxMesa->ColorCombineExt.Shift,
- fxMesa->ColorCombineExt.Invert);
- }
- else {
- /* Voodoo 3 */
- fxMesa->Glide.grColorCombine( fxMesa->ColorCombine.Function,
- fxMesa->ColorCombine.Factor,
- fxMesa->ColorCombine.Local,
- fxMesa->ColorCombine.Other,
- fxMesa->ColorCombine.Invert );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_COMBINE;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_COMBINE ) {
- if (TDFX_IS_NAPALM(fxMesa)) {
- fxMesa->Glide.grAlphaCombineExt(fxMesa->AlphaCombineExt.SourceA,
- fxMesa->AlphaCombineExt.ModeA,
- fxMesa->AlphaCombineExt.SourceB,
- fxMesa->AlphaCombineExt.ModeB,
- fxMesa->AlphaCombineExt.SourceC,
- fxMesa->AlphaCombineExt.InvertC,
- fxMesa->AlphaCombineExt.SourceD,
- fxMesa->AlphaCombineExt.InvertD,
- fxMesa->AlphaCombineExt.Shift,
- fxMesa->AlphaCombineExt.Invert);
- }
- else {
- /* Voodoo 3 */
- fxMesa->Glide.grAlphaCombine( fxMesa->AlphaCombine.Function,
- fxMesa->AlphaCombine.Factor,
- fxMesa->AlphaCombine.Local,
- fxMesa->AlphaCombine.Other,
- fxMesa->AlphaCombine.Invert );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_COMBINE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_RENDER_BUFFER ) {
- fxMesa->Glide.grRenderBuffer( fxMesa->DrawBuffer );
- fxMesa->dirty &= ~TDFX_UPLOAD_RENDER_BUFFER;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE) {
- fxMesa->Glide.grStipplePattern( fxMesa->Stipple.Pattern );
- fxMesa->Glide.grStippleMode( fxMesa->Stipple.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_TEST ) {
- fxMesa->Glide.grAlphaTestFunction( fxMesa->Color.AlphaFunc );
- fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_TEST;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_ALPHA_REF ) {
- fxMesa->Glide.grAlphaTestReferenceValue( fxMesa->Color.AlphaRef );
- fxMesa->dirty &= ~TDFX_UPLOAD_ALPHA_REF;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_BLEND_FUNC ) {
- if (fxMesa->Glide.grAlphaBlendFunctionExt) {
- fxMesa->Glide.grAlphaBlendFunctionExt( fxMesa->Color.BlendSrcRGB,
- fxMesa->Color.BlendDstRGB,
- fxMesa->Color.BlendEqRGB,
- fxMesa->Color.BlendSrcA,
- fxMesa->Color.BlendDstA,
- fxMesa->Color.BlendEqA );
- }
- else {
- fxMesa->Glide.grAlphaBlendFunction( fxMesa->Color.BlendSrcRGB,
- fxMesa->Color.BlendDstRGB,
- fxMesa->Color.BlendSrcA,
- fxMesa->Color.BlendDstA );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_BLEND_FUNC;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MODE ) {
- fxMesa->Glide.grDepthBufferMode( fxMesa->Depth.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MODE;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_BIAS ) {
- fxMesa->Glide.grDepthBiasLevel( fxMesa->Depth.Bias );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_BIAS;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_FUNC ) {
- fxMesa->Glide.grDepthBufferFunction( fxMesa->Depth.Func );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_FUNC;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_DEPTH_MASK ) {
- fxMesa->Glide.grDepthMask( fxMesa->Depth.Mask );
- fxMesa->dirty &= ~TDFX_UPLOAD_DEPTH_MASK;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_DITHER) {
- fxMesa->Glide.grDitherMode( fxMesa->Color.Dither );
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_FOG_MODE ) {
- fxMesa->Glide.grFogMode( fxMesa->Fog.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_FOG_MODE;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_FOG_COLOR ) {
- fxMesa->Glide.grFogColorValue( fxMesa->Fog.Color );
- fxMesa->dirty &= ~TDFX_UPLOAD_FOG_COLOR;
- }
- if ( fxMesa->dirty & TDFX_UPLOAD_FOG_TABLE ) {
- fxMesa->Glide.grFogTable( fxMesa->Fog.Table );
- fxMesa->dirty &= ~TDFX_UPLOAD_FOG_TABLE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) {
- fxMesa->Glide.grCullMode( fxMesa->CullMode );
- fxMesa->dirty &= ~TDFX_UPLOAD_CULL;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_CLIP ) {
- tdfxUploadClipping( fxMesa );
- fxMesa->dirty &= ~TDFX_UPLOAD_CLIP;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_COLOR_MASK ) {
- if ( fxMesa->Glide.grColorMaskExt
- && fxMesa->glCtx->Visual.redBits == 8) {
- fxMesa->Glide.grColorMaskExt( fxMesa->Color.ColorMask[RCOMP],
- fxMesa->Color.ColorMask[GCOMP],
- fxMesa->Color.ColorMask[BCOMP],
- fxMesa->Color.ColorMask[ACOMP] );
- } else {
- fxMesa->Glide.grColorMask( fxMesa->Color.ColorMask[RCOMP] ||
- fxMesa->Color.ColorMask[GCOMP] ||
- fxMesa->Color.ColorMask[BCOMP],
- /*fxMesa->Color.ColorMask[ACOMP]*/GL_FALSE/*[dBorca] no-no*/ );
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_MASK;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_CONSTANT_COLOR ) {
- fxMesa->Glide.grConstantColorValue( fxMesa->Color.MonoColor );
- fxMesa->dirty &= ~TDFX_UPLOAD_CONSTANT_COLOR;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_LINE ) {
- if (fxMesa->glCtx->Line.SmoothFlag && fxMesa->glCtx->Line.Width == 1.0)
- fxMesa->Glide.grEnable(GR_AA_ORDERED);
- else
- fxMesa->Glide.grDisable(GR_AA_ORDERED);
- fxMesa->dirty &= ~TDFX_UPLOAD_LINE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) {
- if (fxMesa->glCtx->Stencil.Enabled) {
- fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
- fxMesa->Glide.grStencilOp(fxMesa->Stencil.FailFunc,
- fxMesa->Stencil.ZFailFunc,
- fxMesa->Stencil.ZPassFunc);
- fxMesa->Glide.grStencilFunc(fxMesa->Stencil.Function,
- fxMesa->Stencil.RefValue,
- fxMesa->Stencil.ValueMask);
- fxMesa->Glide.grStencilMask(fxMesa->Stencil.WriteMask);
- }
- else {
- fxMesa->Glide.grDisable(GR_STENCIL_MODE_EXT);
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_STENCIL;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_VERTEX_LAYOUT ) {
- fxMesa->Glide.grGlideSetVertexLayout( fxMesa->layout[fxMesa->vertexFormat] );
- /* [dborca] enable fogcoord */
- fxMesa->Glide.grVertexLayout(GR_PARAM_FOG_EXT, TDFX_FOG_OFFSET,
- fxMesa->Fog.Mode == GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
- fxMesa->dirty &= ~TDFX_UPLOAD_VERTEX_LAYOUT;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_ENV ) {
- uploadTextureEnv(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_ENV;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PARAMS ) {
- uploadTextureParams(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_PALETTE ) {
- if (fxMesa->TexPalette.Data) {
- fxMesa->Glide.grTexDownloadTable(fxMesa->TexPalette.Type, fxMesa->TexPalette.Data);
- }
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_PALETTE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_SOURCE ) {
- uploadTextureSource(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_SOURCE;
- }
-
- if ( fxMesa->dirty & TDFX_UPLOAD_TEXTURE_IMAGES ) {
- uploadTextureImages(fxMesa);
- fxMesa->dirty &= ~TDFX_UPLOAD_TEXTURE_IMAGES;
- }
-
- fxMesa->dirty = 0;
-}
-
-
-
-void tdfxInitRenderFuncs( struct dd_function_table *functions )
-{
- functions->Clear = tdfxClear;
- functions->Finish = tdfxFinish;
- functions->Flush = tdfxFlush;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.h
deleted file mode 100644
index 09d0d9019..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_render.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_RENDER_H__
-#define __TDFX_RENDER_H__
-
-#include "tdfx_context.h"
-
-extern void tdfxInitRenderFuncs( struct dd_function_table *functions );
-
-extern void tdfxEmitHwStateLocked( tdfxContextPtr fxMesa );
-
-extern void tdfxUploadClipping( tdfxContextPtr fxMesa );
-
-#define FLUSH_BATCH( fxMesa )
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.c
deleted file mode 100644
index ab64f7986..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.c,v 1.3 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include "tdfx_dri.h"
-#include "tdfx_context.h"
-#include "tdfx_lock.h"
-#include "tdfx_vb.h"
-#include "tdfx_span.h"
-#include "tdfx_tris.h"
-
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "xmlpool.h"
-
-#include "utils.h"
-
-#ifdef DEBUG_LOCKING
-char *prevLockFile = 0;
-int prevLockLine = 0;
-#endif
-
-#ifndef TDFX_DEBUG
-int TDFX_DEBUG = 0;
-#endif
-
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-
-static const GLuint __driNConfigOptions = 1;
-
-extern const struct dri_extension card_extensions[];
-extern const struct dri_extension napalm_extensions[];
-
-static GLboolean
-tdfxCreateScreen( __DRIscreenPrivate *sPriv )
-{
- tdfxScreenPrivate *fxScreen;
- TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv;
-
- if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- fxScreen = (tdfxScreenPrivate *) CALLOC( sizeof(tdfxScreenPrivate) );
- if ( !fxScreen )
- return GL_FALSE;
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&fxScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- fxScreen->driScrnPriv = sPriv;
- sPriv->private = (void *) fxScreen;
-
- fxScreen->regs.handle = fxDRIPriv->regs;
- fxScreen->regs.size = fxDRIPriv->regsSize;
- fxScreen->deviceID = fxDRIPriv->deviceID;
- fxScreen->width = fxDRIPriv->width;
- fxScreen->height = fxDRIPriv->height;
- fxScreen->mem = fxDRIPriv->mem;
- fxScreen->cpp = fxDRIPriv->cpp;
- fxScreen->stride = fxDRIPriv->stride;
- fxScreen->fifoOffset = fxDRIPriv->fifoOffset;
- fxScreen->fifoSize = fxDRIPriv->fifoSize;
- fxScreen->fbOffset = fxDRIPriv->fbOffset;
- fxScreen->backOffset = fxDRIPriv->backOffset;
- fxScreen->depthOffset = fxDRIPriv->depthOffset;
- fxScreen->textureOffset = fxDRIPriv->textureOffset;
- fxScreen->textureSize = fxDRIPriv->textureSize;
- fxScreen->sarea_priv_offset = fxDRIPriv->sarea_priv_offset;
-
- if ( drmMap( sPriv->fd, fxScreen->regs.handle,
- fxScreen->regs.size, &fxScreen->regs.map ) ) {
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static void
-tdfxDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private;
-
- if (!fxScreen)
- return;
-
- drmUnmap( fxScreen->regs.map, fxScreen->regs.size );
-
- /* free all option information */
- driDestroyOptionInfo (&fxScreen->optionCache);
-
- FREE( fxScreen );
- sPriv->private = NULL;
-}
-
-
-static GLboolean
-tdfxInitDriver( __DRIscreenPrivate *sPriv )
-{
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)sPriv );
- }
-
- if ( !tdfxCreateScreen( sPriv ) ) {
- tdfxDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- tdfxScreenPrivate *screen = (tdfxScreenPrivate *) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* software alpha channel? */ );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->fbOffset, screen->width);
- tdfxSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->width);
- tdfxSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->width);
- tdfxSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->width);
- tdfxSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
- screen->depthOffset, screen->width);
- tdfxSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- GL_FALSE, /*swStencil,*/
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-tdfxDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-static void
-tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
-
-{
- GET_CURRENT_CONTEXT(ctx);
- tdfxContextPtr fxMesa = 0;
- GLframebuffer *mesaBuffer;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
- fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)driDrawPriv );
- }
-
- mesaBuffer = (GLframebuffer *) driDrawPriv->driverPrivate;
- if ( !mesaBuffer->Visual.doubleBufferMode )
- return; /* can't swap a single-buffered window */
-
- /* If the current context's drawable matches the given drawable
- * we have to do a glFinish (per the GLX spec).
- */
- if ( ctx ) {
- __DRIdrawablePrivate *curDrawPriv;
- fxMesa = TDFX_CONTEXT(ctx);
- curDrawPriv = fxMesa->driContext->driDrawablePriv;
-
- if ( curDrawPriv == driDrawPriv ) {
- /* swapping window bound to current context, flush first */
- _mesa_notifySwapBuffers( ctx );
- LOCK_HARDWARE( fxMesa );
- }
- else {
- /* find the fxMesa context previously bound to the window */
- fxMesa = (tdfxContextPtr) driDrawPriv->driContextPriv->driverPrivate;
- if (!fxMesa)
- return;
- LOCK_HARDWARE( fxMesa );
- fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
- printf("SwapBuf SetState 1\n");
- fxMesa->Glide.grGlideSetState(fxMesa->Glide.State );
- }
- }
-
-#ifdef STATS
- {
- int stalls;
- static int prevStalls = 0;
-
- stalls = fxMesa->Glide.grFifoGetStalls();
-
- fprintf( stderr, "%s:\n", __FUNCTION__ );
- if ( stalls != prevStalls ) {
- fprintf( stderr, " %d stalls occurred\n",
- stalls - prevStalls );
- prevStalls = stalls;
- }
- if ( fxMesa && fxMesa->texSwaps ) {
- fprintf( stderr, " %d texture swaps occurred\n",
- fxMesa->texSwaps );
- fxMesa->texSwaps = 0;
- }
- }
-#endif
-
- if (fxMesa->scissoredClipRects) {
- /* restore clip rects without scissor box */
- fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
- driDrawPriv->w, driDrawPriv->h,
- driDrawPriv->numClipRects,
- driDrawPriv->pClipRects );
- }
-
- fxMesa->Glide.grDRIBufferSwap( fxMesa->Glide.SwapInterval );
-
- if (fxMesa->scissoredClipRects) {
- /* restore clip rects WITH scissor box */
- fxMesa->Glide.grDRIPosition( driDrawPriv->x, driDrawPriv->y,
- driDrawPriv->w, driDrawPriv->h,
- fxMesa->numClipRects, fxMesa->pClipRects );
- }
-
-
-#if 0
- {
- FxI32 result;
- do {
- FxI32 result;
- fxMesa->Glide.grGet(GR_PENDING_BUFFERSWAPS, 4, &result);
- } while ( result > fxMesa->maxPendingSwapBuffers );
- }
-#endif
-
- fxMesa->stats.swapBuffer++;
-
- if (ctx) {
- if (ctx->DriverCtx != fxMesa) {
- fxMesa = TDFX_CONTEXT(ctx);
- fxMesa->Glide.grSstSelect( fxMesa->Glide.Board );
- printf("SwapBuf SetState 2\n");
- fxMesa->Glide.grGlideSetState(fxMesa->Glide.State );
- }
- UNLOCK_HARDWARE( fxMesa );
- }
-}
-
-
-static const struct __DriverAPIRec tdfxAPI = {
- .InitDriver = tdfxInitDriver,
- .DestroyScreen = tdfxDestroyScreen,
- .CreateContext = tdfxCreateContext,
- .DestroyContext = tdfxDestroyContext,
- .CreateBuffer = tdfxCreateBuffer,
- .DestroyBuffer = tdfxDestroyBuffer,
- .SwapBuffers = tdfxSwapBuffers,
- .MakeCurrent = tdfxMakeCurrent,
- .UnbindContext = tdfxUnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits,
- unsigned depth_bits,
- unsigned stencil_bits,
- GLboolean have_back_buffer)
-{
- __GLcontextModes *modes;
- __GLcontextModes *m;
- unsigned num_modes;
- unsigned vis[2] = { GLX_TRUE_COLOR, GLX_DIRECT_COLOR };
- unsigned deep = (depth_bits > 17);
- unsigned i, db, depth, accum, stencil;
-
- /* 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.
- */
-
- num_modes = (depth_bits == 16) ? 32 : 16;
-
- modes = (*dri_interface->createContextModes)(num_modes, sizeof(__GLcontextModes));
- m = modes;
-
- for (i = 0; i <= 1; i++) {
- for (db = 0; db <= 1; db++) {
- for (depth = 0; depth <= 1; depth++) {
- for (accum = 0; accum <= 1; accum++) {
- for (stencil = 0; stencil <= !deep; stencil++) {
- if (deep) stencil = depth;
- m->redBits = deep ? 8 : 5;
- m->greenBits = deep ? 8 : 6;
- m->blueBits = deep ? 8 : 5;
- m->alphaBits = deep ? 8 : 0;
- m->redMask = deep ?0xFF000000 :0x0000F800;
- m->greenMask = deep ?0x00FF0000 :0x000007E0;
- m->blueMask = deep ?0x0000FF00 :0x0000001F;
- m->alphaMask = deep ? 0x000000FF : 0;
- m->rgbBits = m->redBits + m->greenBits +
- m->blueBits + m->alphaBits;
- m->accumRedBits = accum ? 16 : 0;
- m->accumGreenBits = accum ? 16 : 0;
- m->accumBlueBits = accum ? 16 : 0;
- m->accumAlphaBits = accum ? 16 : 0;
- m->stencilBits = stencil ? 8 : 0;
- m->depthBits = deep
- ? (depth ? 24 : 0)
- : (depth ? 0 : depth_bits);
- m->visualType = vis[i];
- m->renderType = GLX_RGBA_BIT;
- m->drawableType = GLX_WINDOW_BIT;
- m->rgbMode = GL_TRUE;
- m->doubleBufferMode = db ? GL_TRUE : GL_FALSE;
- if (db)
- m->swapMethod = GLX_SWAP_UNDEFINED_OML;
- m->visualRating = ((stencil && !deep) || accum)
- ? GLX_SLOW_CONFIG
- : GLX_NONE;
- m = m->next;
- if (deep) stencil = 0;
- }
- }
- }
- }
- }
-
- 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 1, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 0, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "tdfx",
- 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, &tdfxAPI);
-
- if (psp != NULL) {
- /* divined from tdfx_dri.c, sketchy */
- TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv;
- int bpp = (dri_priv->cpp > 2) ? 24 : 16;
-
- /* XXX i wish it was like this */
- /* bpp = dri_priv->bpp */
-
- *driver_modes = tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24,
- (bpp == 16) ? 0 : 8,
- (dri_priv->backOffset!=dri_priv->depthOffset));
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- driInitExtensions( NULL, napalm_extensions, GL_FALSE );
- }
-
- return (void *)psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.h
deleted file mode 100644
index 90be89a35..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_screen.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_screen.h,v 1.2 2002/02/22 21:45:03 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef __TDFX_SCREEN_H__
-#define __TDFX_SCREEN_H__
-
-typedef struct {
- drm_handle_t handle;
- drmSize size;
- drmAddress map;
-} tdfxRegion, *tdfxRegionPtr;
-
-typedef struct {
- tdfxRegion regs;
-
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int stride;
-
- int fifoOffset;
- int fifoSize;
-
- int fbOffset;
- int backOffset;
- int depthOffset;
- int textureOffset;
- int textureSize;
-
- __DRIscreenPrivate *driScrnPriv;
- unsigned int sarea_priv_offset;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} tdfxScreenPrivate;
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.c
deleted file mode 100644
index b00b7ad8d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.c
+++ /dev/null
@@ -1,1427 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.c,v 1.7 2002/10/30 12:52:00 alanh Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_lock.h"
-#include "tdfx_span.h"
-#include "tdfx_render.h"
-#include "swrast/swrast.h"
-
-
-#define DBG 0
-
-
-#define LOCAL_VARS \
- __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \
- tdfxScreenPrivate *fxPriv = fxMesa->fxScreen; \
- GLuint pitch = (fxMesa->glCtx->Color.DrawBuffer[0] == GL_FRONT) \
- ? (fxMesa->screen_width * BYTESPERPIXEL) : \
- (info.strideInBytes); \
- GLuint height = fxMesa->height; \
- char *buf = (char *)((char *)info.lfbPtr + \
- dPriv->x * fxPriv->cpp + \
- dPriv->y * pitch); \
- GLuint p; \
- (void) buf; (void) p;
-
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-
-#define HW_WRITE_LOCK() \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- FLUSH_BATCH( fxMesa ); \
- UNLOCK_HARDWARE( fxMesa ); \
- LOCK_HARDWARE( fxMesa ); \
- info.size = sizeof(GrLfbInfo_t); \
- if ( fxMesa->Glide.grLfbLock( GR_LFB_WRITE_ONLY, \
- fxMesa->DrawBuffer, LFB_MODE, \
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
- {
-
-#define HW_WRITE_UNLOCK() \
- fxMesa->Glide.grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->DrawBuffer );\
- }
-
-
-#define HW_READ_LOCK() \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- FLUSH_BATCH( fxMesa ); \
- UNLOCK_HARDWARE( fxMesa ); \
- LOCK_HARDWARE( fxMesa ); \
- info.size = sizeof(GrLfbInfo_t); \
- if ( fxMesa->Glide.grLfbLock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer, \
- LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) \
- {
-
-#define HW_READ_UNLOCK() \
- fxMesa->Glide.grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->ReadBuffer );\
- }
-
-
-#define HW_WRITE_CLIPLOOP() \
- do { \
- int _nc = fxMesa->numClipRects; \
- while (_nc--) { \
- int minx = fxMesa->pClipRects[_nc].x1 - fxMesa->x_offset; \
- int miny = fxMesa->pClipRects[_nc].y1 - fxMesa->y_offset; \
- int maxx = fxMesa->pClipRects[_nc].x2 - fxMesa->x_offset; \
- int maxy = fxMesa->pClipRects[_nc].y2 - fxMesa->y_offset;
-
-#define HW_READ_CLIPLOOP() \
- do { \
- const __DRIdrawablePrivate *dPriv = fxMesa->driDrawable; \
- drm_clip_rect_t *rect = dPriv->pClipRects; \
- int _nc = dPriv->numClipRects; \
- while (_nc--) { \
- const int minx = rect->x1 - fxMesa->x_offset; \
- const int miny = rect->y1 - fxMesa->y_offset; \
- const int maxx = rect->x2 - fxMesa->x_offset; \
- const int maxy = rect->y2 - fxMesa->y_offset; \
- rect++;
-
-#define HW_ENDCLIPLOOP() \
- } \
- } while (0)
-
-
-
-#define LFB_MODE GR_LFBWRITEMODE_565
-
-
-/* 16 bit, RGB565 color spanline and pixel functions */ \
-
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR565( 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 >> 11) & 0x1f) * 255) / 31; \
- rgba[1] = (((p >> 5) & 0x3f) * 255) / 63; \
- rgba[2] = (((p >> 0) & 0x1f) * 255) / 31; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) tdfx##x##_RGB565
-#define BYTESPERPIXEL 2
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-
-
-/* 16 bit, BGR565 color spanline and pixel functions */ \
-#if 0
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)b & 0xf8) << 8) | \
- (((int)g & 0xfc) << 3) | \
- (((int)r & 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 << 3) & 0xf8; \
- rgba[1] = (p >> 3) & 0xfc; \
- rgba[2] = (p >> 8) & 0xf8; \
- rgba[3] = 0xff; \
- } while (0)
-
-#define TAG(x) tdfx##x##_BGR565
-#define BYTESPERPIXEL 2
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-#endif
-
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_888
-
-
-/* 24 bit, RGB888 color spanline and pixel functions */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR888( color[0], color[1], color[2] )
-
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(buf + _x*3 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = 0xff; \
-} while (0)
-
-#define TAG(x) tdfx##x##_RGB888
-#define BYTESPERPIXEL 4
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-
-
-#undef LFB_MODE
-#define LFB_MODE GR_LFBWRITEMODE_8888
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions */
-#undef INIT_MONO_PIXEL
-#define INIT_MONO_PIXEL(p, color) \
- p = TDFXPACKCOLOR8888( color[0], color[1], color[2], color[3] )
-
-#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) tdfx##x##_ARGB8888
-#define BYTESPERPIXEL 4
-#include "spantmp.h"
-#undef BYTESPERPIXEL
-
-
-
-/* ================================================================
- * Old span functions below...
- */
-
-
-/*
- * Examine the cliprects to generate an array of flags to indicate
- * which pixels in a span are visible. Note: (x,y) is a screen
- * coordinate.
- */
-static void
-generate_vismask(const tdfxContextPtr fxMesa, GLint x, GLint y, GLint n,
- GLubyte vismask[])
-{
- GLboolean initialized = GL_FALSE;
- GLint i, j;
-
- /* Ensure we clear the visual mask */
- MEMSET(vismask, 0, n);
-
- /* turn on flags for all visible pixels */
- for (i = 0; i < fxMesa->numClipRects; i++) {
- const drm_clip_rect_t *rect = &fxMesa->pClipRects[i];
-
- 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);
- 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);
- initialized = GL_TRUE;
- }
- if (x < rect->x1)
- start = rect->x1 - x;
- else
- start = 0;
- if (x + n > rect->x2)
- end = rect->x2 - x;
- else
- end = n;
- assert(start >= 0);
- assert(end <= n);
- for (j = start; j < end; j++)
- vismask[j] = 1;
- }
- }
- }
-}
-
-/*
- * Examine cliprects and determine if the given screen pixel is visible.
- */
-static GLboolean
-visible_pixel(const tdfxContextPtr fxMesa, int scrX, int scrY)
-{
- int i;
- for (i = 0; i < fxMesa->numClipRects; i++) {
- const drm_clip_rect_t *rect = &fxMesa->pClipRects[i];
- if (scrX >= rect->x1 &&
- scrX < rect->x2 &&
- scrY >= rect->y1 && scrY < rect->y2) return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-
-/*
- * Depth buffer read/write functions.
- */
-/*
- * To read the frame buffer, we need to lock and unlock it. The
- * four macros {READ,WRITE}_FB_SPAN_{LOCK,UNLOCK}
- * do this for us.
- *
- * Note that the lock must be matched with an unlock. These
- * macros include a spare curly brace, so they must
- * be syntactically matched.
- *
- * Note, also, that you can't lock a buffer twice with different
- * modes. That is to say, you can't lock a buffer in both read
- * and write modes. The strideInBytes and LFB pointer will be
- * the same with read and write locks, so you can use either.
- * o The HW has different state for reads and writes, so
- * locking it twice may give screwy results.
- * o The DRM won't let you lock twice. It hangs. This is probably
- * because of the LOCK_HARDWARE IN THE *_FB_SPAN_LOCK macros,
- * and could be eliminated with nonlocking lock routines. But
- * what's the point after all.
- */
-#define READ_FB_SPAN_LOCK(fxMesa, info, target_buffer) \
- UNLOCK_HARDWARE(fxMesa); \
- LOCK_HARDWARE(fxMesa); \
- (info).size=sizeof(info); \
- if (fxMesa->Glide.grLfbLock(GR_LFB_READ_ONLY, \
- target_buffer, \
- GR_LFBWRITEMODE_ANY, \
- GR_ORIGIN_UPPER_LEFT, \
- FXFALSE, \
- &(info))) {
-
-#define READ_FB_SPAN_UNLOCK(fxMesa, target_buffer) \
- fxMesa->Glide.grLfbUnlock(GR_LFB_READ_ONLY, target_buffer); \
- } else { \
- fprintf(stderr, "tdfxDriver: Can't get %s (%d) read lock\n", \
- (target_buffer == GR_BUFFER_BACKBUFFER) \
- ? "back buffer" \
- : ((target_buffer == GR_BUFFER_AUXBUFFER) \
- ? "depth buffer" \
- : "unknown buffer"), \
- target_buffer); \
- }
-
-#define WRITE_FB_SPAN_LOCK(fxMesa, info, target_buffer, write_mode) \
- UNLOCK_HARDWARE(fxMesa); \
- LOCK_HARDWARE(fxMesa); \
- info.size=sizeof(info); \
- if (fxMesa->Glide.grLfbLock(GR_LFB_WRITE_ONLY, \
- target_buffer, \
- write_mode, \
- GR_ORIGIN_UPPER_LEFT, \
- FXFALSE, \
- &info)) {
-
-#define WRITE_FB_SPAN_UNLOCK(fxMesa, target_buffer) \
- fxMesa->Glide.grLfbUnlock(GR_LFB_WRITE_ONLY, target_buffer); \
- } else { \
- fprintf(stderr, "tdfxDriver: Can't get %s (%d) write lock\n", \
- (target_buffer == GR_BUFFER_BACKBUFFER) \
- ? "back buffer" \
- : ((target_buffer == GR_BUFFER_AUXBUFFER) \
- ? "depth buffer" \
- : "unknown buffer"), \
- target_buffer); \
- }
-
-/*
- * Because the Linear Frame Buffer is not necessarily aligned
- * with the depth buffer, we have to do some fiddling
- * around to get the right addresses.
- *
- * Perhaps a picture is in order. The Linear Frame Buffer
- * looks like this:
- *
- * |<----------------------info.strideInBytes------------->|
- * |<-----physicalStrideInBytes------->|
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- * | | |
- * | Legal Memory | Forbidden Zone |
- * | | |
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- *
- * You can only reliably read and write legal locations. Reads
- * and writes from the Forbidden Zone will return undefined values,
- * and may cause segmentation faults.
- *
- * Now, the depth buffer may not end up in a location such each
- * scan line is an LFB line. For example, the depth buffer may
- * look like this:
- *
- * wrapped ordinary.
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- * |0000000000000000000000 | | back
- * |1111111111111111111111 | | buffer
- * |2222222222222222222222 | |
- * |4096b align. padxx00000000000000000| Forbidden Zone | depth
- * |0000 11111111111111111| | buffer
- * |1111 22222222222222222| |
- * |2222 | |
- * +-----------------------------------+xxxxxxxxxxxxxxxxxxx+
- * where each number is the scan line number. We know it will
- * be aligned on 128 byte boundaries, at least. Aligning this
- * on a scanline boundary causes the back and depth buffers to
- * thrash in the SST1 cache. (Note that the back buffer is always
- * allocated at the beginning of LFB memory, and so it is always
- * properly aligned with the LFB stride.)
- *
- * We call the beginning of the line (which is the rightmost
- * part of the depth line in the picture above) the *ordinary* part
- * of the scanline, and the end of the line (which is the
- * leftmost part, one line below) the *wrapped* part of the scanline.
- * a.) We need to know what x value to subtract from the screen
- * x coordinate to index into the wrapped part.
- * b.) We also need to figure out if we need to read from the ordinary
- * part scan line, or from the wrapped part of the scan line.
- *
- * [ad a]
- * The first wrapped x coordinate is that coordinate such that
- * depthBufferOffset&(info.strideInBytes) + x*elmentSize {*}
- * > physicalStrideInBytes
- * where depthBufferOffset is the LFB distance in bytes
- * from the back buffer to the depth buffer. The expression
- * depthBufferOffset&(info.strideInBytes)
- * is then the offset (in bytes) from the beginining of (any)
- * depth buffer line to first element in the line.
- * Simplifying inequation {*} above we see that x is the smallest
- * value such that
- * x*elementSize > physicalStrideInBytes {**}
- * - depthBufferOffset&(info.strideInBytes)
- * Now, we know that both the summands on the right are multiples of
- * 128, and elementSize <= 4, so if equality holds in {**}, x would
- * be a multiple of 32. Thus we can set x to
- * xwrapped = (physicalStrideInBytes
- * - depthBufferOffset&(info.strideInBytes))/elementSize
- * + 1
- *
- * [ad b]
- * Question b is now simple. We read from the wrapped scan line if
- * x is greater than xwrapped.
- */
-#define TILE_WIDTH_IN_BYTES 128
-#define TILE_WIDTH_IN_ZOXELS(bpz) (TILE_WIDTH_IN_BYTES/(bpz))
-#define TILE_HEIGHT_IN_LINES 32
-typedef struct
-{
- void *lfbPtr;
- void *lfbWrapPtr;
- FxU32 LFBStrideInElts;
- GLint firstWrappedX;
-}
-LFBParameters;
-
-/*
- * We need information about the back buffer. Note that
- * this function *cannot be called* while the aux buffer
- * is locked, or the caller will hang.
- *
- * Only Glide knows the LFB address of the back and depth
- * offsets. The upper levels of Mesa know the depth offset,
- * but that is not in LFB space, it is tiled memory space,
- * and is not useable for us.
- */
-static void
-GetBackBufferInfo(tdfxContextPtr fxMesa, GrLfbInfo_t * backBufferInfo)
-{
- READ_FB_SPAN_LOCK(fxMesa, *backBufferInfo, GR_BUFFER_BACKBUFFER);
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_BACKBUFFER);
-}
-
-static void
-GetFbParams(tdfxContextPtr fxMesa,
- GrLfbInfo_t * info,
- GrLfbInfo_t * backBufferInfo,
- LFBParameters * ReadParamsp, FxU32 elementSize)
-{
- FxU32 physicalStrideInBytes, bufferOffset;
- FxU32 strideInBytes = info->strideInBytes;
- char *lfbPtr = (char *) (info->lfbPtr); /* For arithmetic, use char * */
-
- /*
- * These two come directly from the info structure.
- */
- ReadParamsp->lfbPtr = (void *) lfbPtr;
- ReadParamsp->LFBStrideInElts = strideInBytes / elementSize;
- /*
- * Now, calculate the value of firstWrappedX.
- *
- * The physical stride is the screen width in bytes rounded up to
- * the next highest multiple of 128 bytes. Note that this fails
- * when TILE_WIDTH_IN_BYTES is not a power of two.
- *
- * The buffer Offset is the distance between the beginning of
- * the LFB space, which is the beginning of the back buffer,
- * and the buffer we are gathering information about.
- * We want to make this routine usable for operations on the
- * back buffer, though we don't actually use it on the back
- * buffer. Note, then, that if bufferOffset == 0, the firstWrappedX
- * is in the forbidden zone, and is therefore never reached.
- *
- * Note that if
- * physicalStrideInBytes
- * < bufferOffset&(info->strideInBytes-1)
- * the buffer begins in the forbidden zone. We assert for this.
- */
- bufferOffset = (FxU32)(lfbPtr - (char *) backBufferInfo->lfbPtr);
- physicalStrideInBytes
- = (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1)
- & ~(TILE_WIDTH_IN_BYTES - 1);
- assert(physicalStrideInBytes > (bufferOffset & (strideInBytes - 1)));
- ReadParamsp->firstWrappedX
- = (physicalStrideInBytes
- - (bufferOffset & (strideInBytes - 1))) / elementSize;
- /*
- * This is the address of the next physical line.
- */
- ReadParamsp->lfbWrapPtr
- = (void *) ((char *) backBufferInfo->lfbPtr
- + (bufferOffset & ~(strideInBytes - 1))
- + (TILE_HEIGHT_IN_LINES) * strideInBytes);
-}
-
-/*
- * These macros fetch data from the frame buffer. The type is
- * the type of data we want to fetch. It should match the type
- * whose size was used with GetFbParams to fill in the structure
- * in *ReadParamsp. We have a macro to read the ordinary
- * part, a second macro to read the wrapped part, and one which
- * will do either. When we are reading a span, we will know
- * when the ordinary part ends, so there's no need to test for
- * it. However, when reading and writing pixels, we don't
- * necessarily know. I suppose it's a matter of taste whether
- * it's better in the macro or in the call.
- *
- * Recall that x and y are screen coordinates.
- */
-#define GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \
- (((type *)((ReadParamsp)->lfbPtr)) \
- [(y) * ((ReadParamsp)->LFBStrideInElts) \
- + (x)])
-#define GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) \
- (((type *)((ReadParamsp)->lfbWrapPtr)) \
- [((y)) * ((ReadParamsp)->LFBStrideInElts) \
- + ((x) - (ReadParamsp)->firstWrappedX)])
-#define GET_FB_DATA(ReadParamsp, type, x, y) \
- (((x) < (ReadParamsp)->firstWrappedX) \
- ? GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) \
- : GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y))
-#define PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value) \
- (GET_ORDINARY_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
-#define PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value) \
- (GET_WRAPPED_FB_DATA(ReadParamsp, type, x, y) = (type)(value))
-#define PUT_FB_DATA(ReadParamsp, type, x, y, value) \
- do { \
- if ((x) < (ReadParamsp)->firstWrappedX) \
- PUT_ORDINARY_FB_DATA(ReadParamsp, type, x, y, value); \
- else \
- PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value); \
- } while (0)
-
-
-static void
-tdfxDDWriteDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, const void *values,
- const GLubyte mask[])
-{
- const GLuint *depth = (const GLuint *) values;
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->y_offset + fxMesa->height - 1;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GLuint stencil_size = fxMesa->glCtx->Visual.stencilBits;
- GrLfbInfo_t info;
- GLubyte visMask[MAX_WIDTH];
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthSpan(...)\n");
- }
-
- assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32));
- /*
- * Convert x and y to screen coordinates.
- */
- x += fxMesa->x_offset;
- y = bottom - y;
- if (mask) {
- GLint i;
- GLushort d16;
- GrLfbInfo_t backBufferInfo;
-
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER,
- GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- int wrappedPartStart;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- if (mask[i] && visMask[i]) {
- d16 = depth[i];
- PUT_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y, d16);
- }
- }
- for (; i < n; i++) {
- if (mask[i] && visMask[i]) {
- d16 = depth[i];
- PUT_WRAPPED_FB_DATA(&ReadParams, GLushort, x + i, y, d16);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER,
- GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- int wrappedPartStart;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- GLuint d32;
- if (mask[i] && visMask[i]) {
- if (stencil_size > 0) {
- d32 =
- GET_ORDINARY_FB_DATA(&ReadParams, GLuint,
- x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- for (; i < n; i++) {
- GLuint d32;
- if (mask[i] && visMask[i]) {
- if (stencil_size > 0) {
- d32 =
- GET_WRAPPED_FB_DATA(&ReadParams, GLuint,
- x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- }
- else {
- GLint i;
- GLuint d32;
- GLushort d16;
- GrLfbInfo_t backBufferInfo;
-
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- GLuint wrappedPartStart;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- if (visMask[i]) {
- d16 = depth[i];
- PUT_ORDINARY_FB_DATA(&ReadParams,
- GLushort,
- x + i, y,
- d16);
- }
- }
- for (; i < n; i++) {
- if (visMask[i]) {
- d16 = depth[i];
- PUT_WRAPPED_FB_DATA(&ReadParams,
- GLushort,
- x + i, y,
- d16);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- generate_vismask(fxMesa, x, y, n, visMask);
- {
- LFBParameters ReadParams;
- GLuint wrappedPartStart;
-
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- if (visMask[i]) {
- if (stencil_size > 0) {
- d32 = GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- for (; i < n; i++) {
- if (visMask[i]) {
- if (stencil_size > 0) {
- d32 = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y);
- d32 =
- (d32 & 0xFF000000) | (depth[i] & 0x00FFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y, d32);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- }
-}
-
-static void
-tdfxDDWriteMonoDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, const void *value,
- const GLubyte mask[])
-{
- GLuint depthVal = *((GLuint *) value);
- GLuint depths[MAX_WIDTH];
- GLuint i;
- for (i = 0; i < n; i++)
- depths[i] = depthVal;
- tdfxDDWriteDepthSpan(ctx, rb, n, x, y, depths, mask);
-}
-
-
-static void
-tdfxDDReadDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y, void *values)
-{
- GLuint *depth = (GLuint *) values;
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->height + fxMesa->y_offset - 1;
- GLuint i;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GrLfbInfo_t info;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDReadDepthSpan(...)\n");
- }
-
- /*
- * Convert to screen coordinates.
- */
- x += fxMesa->x_offset;
- y = bottom - y;
- switch (depth_size) {
- case 16:
- {
- LFBParameters ReadParams;
- GrLfbInfo_t backBufferInfo;
- int wrappedPartStart;
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- /*
- * Read the line.
- */
- for (i = 0; i < wrappedPartStart; i++) {
- depth[i] =
- GET_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y);
- }
- for (; i < n; i++) {
- depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLushort,
- x + i, y);
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- case 24:
- case 32:
- {
- LFBParameters ReadParams;
- GrLfbInfo_t backBufferInfo;
- int wrappedPartStart;
- GLuint stencil_size = fxMesa->glCtx->Visual.stencilBits;
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- /*
- * Read the line.
- */
- for (i = 0; i < wrappedPartStart; i++) {
- const GLuint mask =
- (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF;
- depth[i] =
- GET_ORDINARY_FB_DATA(&ReadParams, GLuint, x + i, y);
- depth[i] &= mask;
- }
- for (; i < n; i++) {
- const GLuint mask =
- (stencil_size > 0) ? 0x00FFFFFF : 0xFFFFFFFF;
- depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLuint, x + i, y);
- depth[i] &= mask;
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
- }
-}
-
-
-static void
-tdfxDDWriteDepthPixels(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;
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->height + fxMesa->y_offset - 1;
- GLuint i;
- GLushort d16;
- GLuint d32;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GLuint stencil_size = fxMesa->glCtx->Visual.stencilBits;
- GrLfbInfo_t info;
- int xpos;
- int ypos;
- GrLfbInfo_t backBufferInfo;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDWriteDepthPixels(...)\n");
- }
-
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- for (i = 0; i < n; i++) {
- if (mask[i] && visible_pixel(fxMesa, x[i], y[i])) {
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- d16 = depth[i];
- PUT_FB_DATA(&ReadParams, GLushort, xpos, ypos, d16);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info,
- GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- for (i = 0; i < n; i++) {
- if (mask[i]) {
- if (visible_pixel(fxMesa, x[i], y[i])) {
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- if (stencil_size > 0) {
- d32 =
- GET_FB_DATA(&ReadParams, GLuint, xpos, ypos);
- d32 = (d32 & 0xFF000000) | (depth[i] & 0xFFFFFF);
- }
- else {
- d32 = depth[i];
- }
- PUT_FB_DATA(&ReadParams, GLuint, xpos, ypos, d32);
- }
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- }
-}
-
-
-static void
-tdfxDDReadDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n,
- const GLint x[], const GLint y[], void *values)
-{
- GLuint *depth = (GLuint *) values;
- tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLint bottom = fxMesa->height + fxMesa->y_offset - 1;
- GLuint i;
- GLuint depth_size = fxMesa->glCtx->Visual.depthBits;
- GLushort d16;
- int xpos;
- int ypos;
- GrLfbInfo_t info;
- GLuint stencil_size;
- GrLfbInfo_t backBufferInfo;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "tdfxmesa: tdfxDDReadDepthPixels(...)\n");
- }
-
- assert((depth_size == 16) || (depth_size == 24) || (depth_size == 32));
- switch (depth_size) {
- case 16:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLushort));
- for (i = 0; i < n; i++) {
- /*
- * Convert to screen coordinates.
- */
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- d16 = GET_FB_DATA(&ReadParams, GLushort, xpos, ypos);
- depth[i] = d16;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- case 24:
- case 32:
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- stencil_size = fxMesa->glCtx->Visual.stencilBits;
- {
- LFBParameters ReadParams;
- GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
- for (i = 0; i < n; i++) {
- GLuint d32;
-
- /*
- * Convert to screen coordinates.
- */
- xpos = x[i] + fxMesa->x_offset;
- ypos = bottom - y[i];
- d32 = GET_FB_DATA(&ReadParams, GLuint, xpos, ypos);
- if (stencil_size > 0) {
- d32 &= 0x00FFFFFF;
- }
- depth[i] = d32;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
- break;
- default:
- assert(0);
- }
-}
-
-/*
- * Stencil buffer read/write functions.
- */
-#define EXTRACT_S_FROM_ZS(zs) (((zs) >> 24) & 0xFF)
-#define EXTRACT_Z_FROM_ZS(zs) ((zs) & 0xffffff)
-#define BUILD_ZS(z, s) (((s) << 24) | (z))
-
-static void
-write_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *values, const GLubyte mask[])
-{
- const GLubyte *stencil = (const GLubyte *) values;
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- const GLint scrX = winX + x;
- const GLint scrY = winY - y;
- LFBParameters ReadParams;
- GLubyte visMask[MAX_WIDTH];
- GLuint i;
- int wrappedPartStart;
-
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- generate_vismask(fxMesa, scrX, scrY, n, visMask);
- for (i = 0; i < wrappedPartStart; i++) {
- if (visMask[i] && (!mask || mask[i])) {
- GLuint z = GET_ORDINARY_FB_DATA(&ReadParams, GLuint,
- scrX + i, scrY) & 0x00FFFFFF;
- z |= (stencil[i] & 0xFF) << 24;
- PUT_ORDINARY_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z);
- }
- }
- for (; i < n; i++) {
- if (visMask[i] && (!mask || mask[i])) {
- GLuint z = GET_WRAPPED_FB_DATA(&ReadParams, GLuint,
- scrX + i, scrY) & 0x00FFFFFF;
- z |= (stencil[i] & 0xFF) << 24;
- PUT_WRAPPED_FB_DATA(&ReadParams, GLuint, scrX + i, scrY, z);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-
-static void
-write_mono_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const void *value, const GLubyte mask[])
-{
- GLbyte stencilVal = *((GLbyte *) value);
- GLbyte stencils[MAX_WIDTH];
- GLuint i;
- for (i = 0; i < n; i++)
- stencils[i] = stencilVal;
- write_stencil_span(ctx, rb, n, x, y, stencils, mask);
-}
-
-
-static void
-read_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- void *values)
-{
- GLubyte *stencil = (GLubyte *) values;
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- GLuint i;
- LFBParameters ReadParams;
- int wrappedPartStart;
-
- /*
- * Convert to screen coordinates.
- */
- x += winX;
- y = winY - y;
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- if (ReadParams.firstWrappedX <= x) {
- wrappedPartStart = 0;
- }
- else if (n <= (ReadParams.firstWrappedX - x)) {
- wrappedPartStart = n;
- }
- else {
- wrappedPartStart = (ReadParams.firstWrappedX - x);
- }
- for (i = 0; i < wrappedPartStart; i++) {
- stencil[i] = (GET_ORDINARY_FB_DATA(&ReadParams, GLuint,
- x + i, y) >> 24) & 0xFF;
- }
- for (; i < n; i++) {
- stencil[i] = (GET_WRAPPED_FB_DATA(&ReadParams, GLuint,
- x + i, y) >> 24) & 0xFF;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-
-static void
-write_stencil_pixels(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;
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- WRITE_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER, GR_LFBWRITEMODE_ANY);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- LFBParameters ReadParams;
- GLuint i;
-
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- for (i = 0; i < n; i++) {
- const GLint scrX = winX + x[i];
- const GLint scrY = winY - y[i];
- if ((!mask || mask[i]) && visible_pixel(fxMesa, scrX, scrY)) {
- GLuint z =
- GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) & 0x00FFFFFF;
- z |= (stencil[i] & 0xFF) << 24;
- PUT_FB_DATA(&ReadParams, GLuint, scrX, scrY, z);
- }
- }
- }
- WRITE_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-
-static void
-read_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- void *values)
-{
- GLubyte *stencil = (GLubyte *) values;
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrLfbInfo_t info;
- GrLfbInfo_t backBufferInfo;
-
- GetBackBufferInfo(fxMesa, &backBufferInfo);
- /*
- * Note that the _LOCK macro adds a curly brace,
- * and the UNLOCK macro removes it.
- */
- READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
- {
- const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
- const GLint winX = fxMesa->x_offset;
- GLuint i;
- LFBParameters ReadParams;
-
- GetFbParams(fxMesa, &info, &backBufferInfo, &ReadParams,
- sizeof(GLuint));
- for (i = 0; i < n; i++) {
- const GLint scrX = winX + x[i];
- const GLint scrY = winY - y[i];
- stencil[i] =
- (GET_FB_DATA(&ReadParams, GLuint, scrX, scrY) >> 24) & 0xFF;
- }
- }
- READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
-}
-
-#define VISUAL_EQUALS_RGBA(vis, r, g, b, a) \
- ((vis.redBits == r) && \
- (vis.greenBits == g) && \
- (vis.blueBits == b) && \
- (vis.alphaBits == a))
-
-
-
-
-/**********************************************************************/
-/* Locking for swrast */
-/**********************************************************************/
-
-
-static void tdfxSpanRenderStart( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- LOCK_HARDWARE(fxMesa);
-}
-
-static void tdfxSpanRenderFinish( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- _swrast_flush( ctx );
- UNLOCK_HARDWARE(fxMesa);
-}
-
-/* Set the buffer used for reading */
-static void tdfxDDSetBuffer( GLcontext *ctx,
- GLframebuffer *buffer, GLuint bufferBit )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- (void) buffer;
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
- break;
- case BUFFER_BIT_BACK_LEFT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
- break;
- default:
- break;
- }
-}
-
-/**********************************************************************/
-/* Initialize swrast device driver */
-/**********************************************************************/
-
-void tdfxDDInitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- swdd->SetBuffer = tdfxDDSetBuffer;
- swdd->SpanRenderStart = tdfxSpanRenderStart;
- swdd->SpanRenderFinish = tdfxSpanRenderFinish;
-}
-
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-tdfxSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- drb->Base.GetRow = tdfxReadRGBASpan_RGB565;
- drb->Base.GetValues = tdfxReadRGBAPixels_RGB565;
- drb->Base.PutRow = tdfxWriteRGBASpan_RGB565;
- drb->Base.PutRowRGB = tdfxWriteRGBSpan_RGB565;
- drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_RGB565;
- drb->Base.PutValues = tdfxWriteRGBAPixels_RGB565;
- drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB565;
- }
- else if (vis->redBits == 8 && vis->greenBits == 8
- && vis->blueBits == 8 && vis->alphaBits == 0) {
- drb->Base.GetRow = tdfxReadRGBASpan_RGB888;
- drb->Base.GetValues = tdfxReadRGBAPixels_RGB888;
- drb->Base.PutRow = tdfxWriteRGBASpan_RGB888;
- drb->Base.PutRowRGB = tdfxWriteRGBSpan_RGB888;
- drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_RGB888;
- drb->Base.PutValues = tdfxWriteRGBAPixels_RGB888;
- drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB888;
- }
- else if (vis->redBits == 8 && vis->greenBits == 8
- && vis->blueBits == 8 && vis->alphaBits == 8) {
- drb->Base.GetRow = tdfxReadRGBASpan_ARGB8888;
- drb->Base.GetValues = tdfxReadRGBAPixels_ARGB8888;
- drb->Base.PutRow = tdfxWriteRGBASpan_ARGB8888;
- drb->Base.PutRowRGB = tdfxWriteRGBSpan_ARGB8888;
- drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_ARGB8888;
- drb->Base.PutValues = tdfxWriteRGBAPixels_ARGB8888;
- drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_ARGB8888;
- }
- else {
- _mesa_problem(NULL, "problem in tdfxSetSpanFunctions");
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16 ||
- drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = tdfxDDReadDepthSpan;
- drb->Base.GetValues = tdfxDDReadDepthPixels;
- drb->Base.PutRow = tdfxDDWriteDepthSpan;
- drb->Base.PutMonoRow = tdfxDDWriteMonoDepthSpan;
- drb->Base.PutValues = tdfxDDWriteDepthPixels;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = read_stencil_span;
- drb->Base.GetValues = read_stencil_pixels;
- drb->Base.PutRow = write_stencil_span;
- drb->Base.PutMonoRow = write_mono_stencil_span;
- drb->Base.PutValues = write_stencil_pixels;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.h
deleted file mode 100644
index 62044144f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_span.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_span.h,v 1.1 2001/03/21 16:14:28 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_SPAN_H__
-#define __TDFX_SPAN_H__
-
-#include "context.h"
-#include "drirenderbuffer.h"
-
-extern void tdfxDDInitSpanFuncs( GLcontext *ctx );
-
-extern void
-tdfxSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.c
deleted file mode 100644
index 85d99bb05..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.c
+++ /dev/null
@@ -1,1449 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.c,v 1.7 2002/10/30 12:52:00 alanh Exp $ */
-
-/*
- * New fixes:
- * Daniel Borca <dborca@users.sourceforge.net>, 19 Jul 2004
- *
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- * Keith Whitwell <keith@tungstengraphics.com> (port to 3.5)
- *
- */
-
-#include "mtypes.h"
-#include "buffers.h"
-#include "colormac.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tdfx_context.h"
-#include "tdfx_state.h"
-#include "tdfx_vb.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-#include "tdfx_texstate.h"
-#include "tdfx_tris.h"
-#include "tdfx_render.h"
-
-
-
-/* =============================================================
- * Alpha blending
- */
-
-static void tdfxUpdateAlphaMode( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrCmpFnc_t func;
- GrAlphaBlendFnc_t srcRGB, dstRGB, srcA, dstA;
- GrAlphaBlendOp_t eqRGB, eqA;
- GrAlpha_t ref = (GLint) (ctx->Color.AlphaRef * 255.0);
-
- GLboolean isNapalm = TDFX_IS_NAPALM(fxMesa);
- GLboolean have32bpp = (ctx->Visual.greenBits == 8);
- GLboolean haveAlpha = fxMesa->haveHwAlpha;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if ( ctx->Color.AlphaEnabled ) {
- func = ctx->Color.AlphaFunc - GL_NEVER + GR_CMP_NEVER;
- } else {
- func = GR_CMP_ALWAYS;
- }
-
- if ( ctx->Color.BlendEnabled
- && (fxMesa->Fallback & TDFX_FALLBACK_BLEND) == 0 ) {
- switch ( ctx->Color.BlendSrcRGB ) {
- case GL_ZERO:
- srcRGB = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- srcRGB = GR_BLEND_ONE;
- break;
- case GL_DST_COLOR:
- srcRGB = GR_BLEND_DST_COLOR;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- srcRGB = GR_BLEND_ONE_MINUS_DST_COLOR;
- break;
- case GL_SRC_ALPHA:
- srcRGB = GR_BLEND_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- srcRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- srcRGB = haveAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*JJJ*/;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- srcRGB = haveAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*JJJ*/;
- break;
- case GL_SRC_ALPHA_SATURATE:
- srcRGB = GR_BLEND_ALPHA_SATURATE;
- break;
- case GL_SRC_COLOR:
- if (isNapalm) {
- srcRGB = GR_BLEND_SAME_COLOR_EXT;
- break;
- }
- case GL_ONE_MINUS_SRC_COLOR:
- if (isNapalm) {
- srcRGB = GR_BLEND_ONE_MINUS_SAME_COLOR_EXT;
- break;
- }
- default:
- srcRGB = GR_BLEND_ONE;
- }
-
- switch ( ctx->Color.BlendSrcA ) {
- case GL_ZERO:
- srcA = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- srcA = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- srcA = have32bpp ? GR_BLEND_SRC_ALPHA : GR_BLEND_ONE/*JJJ*/;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- srcA = have32bpp ? GR_BLEND_ONE_MINUS_SRC_ALPHA : GR_BLEND_ONE/*JJJ*/;
- break;
- case GL_DST_COLOR:
- case GL_DST_ALPHA:
- srcA = (have32bpp && haveAlpha) ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*JJJ*/;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- case GL_ONE_MINUS_DST_ALPHA:
- srcA = (have32bpp && haveAlpha) ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*JJJ*/;
- break;
- case GL_SRC_ALPHA_SATURATE:
- srcA = GR_BLEND_ONE;
- break;
- default:
- srcA = GR_BLEND_ONE;
- }
-
- switch ( ctx->Color.BlendDstRGB ) {
- case GL_ZERO:
- dstRGB = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- dstRGB = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- dstRGB = GR_BLEND_SRC_COLOR;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- dstRGB = GR_BLEND_ONE_MINUS_SRC_COLOR;
- break;
- case GL_SRC_ALPHA:
- dstRGB = GR_BLEND_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dstRGB = GR_BLEND_ONE_MINUS_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- dstRGB = haveAlpha ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*JJJ*/;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dstRGB = haveAlpha ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*JJJ*/;
- break;
- case GL_DST_COLOR:
- if (isNapalm) {
- dstRGB = GR_BLEND_SAME_COLOR_EXT;
- break;
- }
- case GL_ONE_MINUS_DST_COLOR:
- if (isNapalm) {
- dstRGB = GR_BLEND_ONE_MINUS_SAME_COLOR_EXT;
- break;
- }
- default:
- dstRGB = GR_BLEND_ZERO;
- }
-
- switch ( ctx->Color.BlendDstA ) {
- case GL_ZERO:
- dstA = GR_BLEND_ZERO;
- break;
- case GL_ONE:
- dstA = GR_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- dstA = have32bpp ? GR_BLEND_SRC_ALPHA : GR_BLEND_ZERO/*JJJ*/;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- dstA = have32bpp ? GR_BLEND_ONE_MINUS_SRC_ALPHA : GR_BLEND_ZERO/*JJJ*/;
- break;
- case GL_DST_COLOR:
- case GL_DST_ALPHA:
- dstA = have32bpp ? GR_BLEND_DST_ALPHA : GR_BLEND_ONE/*JJJ*/;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- case GL_ONE_MINUS_DST_ALPHA:
- dstA = have32bpp ? GR_BLEND_ONE_MINUS_DST_ALPHA : GR_BLEND_ZERO/*JJJ*/;
- break;
- default:
- dstA = GR_BLEND_ZERO;
- }
-
- switch ( ctx->Color.BlendEquationRGB ) {
- case GL_FUNC_SUBTRACT:
- eqRGB = GR_BLEND_OP_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqRGB = GR_BLEND_OP_REVSUB;
- break;
- case GL_FUNC_ADD:
- default:
- eqRGB = GR_BLEND_OP_ADD;
- break;
- }
-
- switch ( ctx->Color.BlendEquationA ) {
- case GL_FUNC_SUBTRACT:
- eqA = GR_BLEND_OP_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqA = GR_BLEND_OP_REVSUB;
- break;
- case GL_FUNC_ADD:
- default:
- eqA = GR_BLEND_OP_ADD;
- break;
- }
- } else {
- /* blend disabled */
- srcRGB = GR_BLEND_ONE;
- dstRGB = GR_BLEND_ZERO;
- eqRGB = GR_BLEND_OP_ADD;
- srcA = GR_BLEND_ONE;
- dstA = GR_BLEND_ZERO;
- eqA = GR_BLEND_OP_ADD;
- }
-
- if ( fxMesa->Color.AlphaFunc != func ) {
- fxMesa->Color.AlphaFunc = func;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_TEST;
- }
- if ( fxMesa->Color.AlphaRef != ref ) {
- fxMesa->Color.AlphaRef = ref;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_REF;
- }
-
- if ( fxMesa->Color.BlendSrcRGB != srcRGB ||
- fxMesa->Color.BlendDstRGB != dstRGB ||
- fxMesa->Color.BlendEqRGB != eqRGB ||
- fxMesa->Color.BlendSrcA != srcA ||
- fxMesa->Color.BlendDstA != dstA ||
- fxMesa->Color.BlendEqA != eqA )
- {
- fxMesa->Color.BlendSrcRGB = srcRGB;
- fxMesa->Color.BlendDstRGB = dstRGB;
- fxMesa->Color.BlendEqRGB = eqRGB;
- fxMesa->Color.BlendSrcA = srcA;
- fxMesa->Color.BlendDstA = dstA;
- fxMesa->Color.BlendEqA = eqA;
- fxMesa->dirty |= TDFX_UPLOAD_BLEND_FUNC;
- }
-}
-
-static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-}
-
-static void tdfxDDBlendEquationSeparate( GLcontext *ctx,
- GLenum modeRGB, GLenum modeA )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- assert( modeRGB == modeA );
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-}
-
-static void tdfxDDBlendFuncSeparate( GLcontext *ctx,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
-
- /*
- * XXX - Voodoo5 seems to suffer from precision problems in some
- * blend modes. To pass all the conformance tests we'd have to
- * fall back to software for many modes. Revisit someday.
- */
-}
-
-/* =============================================================
- * Stipple
- */
-
-void tdfxUpdateStipple( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GrStippleMode_t mode = GR_STIPPLE_DISABLE;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( fxMesa );
-
- if (ctx->Polygon.StippleFlag) {
- mode = GR_STIPPLE_PATTERN;
- }
-
- if ( fxMesa->Stipple.Mode != mode ) {
- fxMesa->Stipple.Mode = mode;
- fxMesa->dirty |= TDFX_UPLOAD_STIPPLE;
- }
-}
-
-
-/* =============================================================
- * Depth testing
- */
-
-static void tdfxUpdateZMode( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GrCmpFnc_t func;
- FxI32 bias;
- FxBool mask;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API )
- fprintf( stderr, "%s()\n", __FUNCTION__ );
-
-
- bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE);
-
- if ( ctx->Depth.Test ) {
- func = ctx->Depth.Func - GL_NEVER + GR_CMP_NEVER;
- mask = ctx->Depth.Mask;
- }
- else {
- /* depth testing disabled */
- func = GR_CMP_ALWAYS; /* fragments always pass */
- mask = FXFALSE; /* zbuffer is not touched */
- }
-
- fxMesa->Depth.Clear = (FxU32) (ctx->DrawBuffer->_DepthMaxF * ctx->Depth.Clear);
-
- if ( fxMesa->Depth.Bias != bias ) {
- fxMesa->Depth.Bias = bias;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS;
- }
- if ( fxMesa->Depth.Func != func ) {
- fxMesa->Depth.Func = func;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_FUNC | TDFX_UPLOAD_DEPTH_MASK;
- }
- if ( fxMesa->Depth.Mask != mask ) {
- fxMesa->Depth.Mask = mask;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_MASK;
- }
-}
-
-static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
-}
-
-static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
-}
-
-static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
-}
-
-
-
-/* =============================================================
- * Stencil
- */
-
-
-/* Evaluate all stencil state and make the Glide calls.
- */
-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 */
-}
-
-
-static void tdfxUpdateStencil( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if (fxMesa->haveHwStencil) {
- if (ctx->Stencil.Enabled) {
- fxMesa->Stencil.Function = ctx->Stencil.Function[0] - GL_NEVER + GR_CMP_NEVER;
- fxMesa->Stencil.RefValue = ctx->Stencil.Ref[0];
- fxMesa->Stencil.ValueMask = ctx->Stencil.ValueMask[0];
- fxMesa->Stencil.WriteMask = ctx->Stencil.WriteMask[0];
- fxMesa->Stencil.FailFunc = convertGLStencilOp(ctx->Stencil.FailFunc[0]);
- fxMesa->Stencil.ZFailFunc = convertGLStencilOp(ctx->Stencil.ZFailFunc[0]);
- fxMesa->Stencil.ZPassFunc = convertGLStencilOp(ctx->Stencil.ZPassFunc[0]);
- fxMesa->Stencil.Clear = ctx->Stencil.Clear & 0xff;
- }
- fxMesa->dirty |= TDFX_UPLOAD_STENCIL;
- }
-}
-
-
-static void tdfxDDStencilFunc( GLcontext *ctx, GLenum func,
- GLint ref, GLuint mask )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_STENCIL;
-}
-
-static void tdfxDDStencilMask( GLcontext *ctx, GLuint mask )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_STENCIL;
-}
-
-static void tdfxDDStencilOp( GLcontext *ctx, GLenum sfail,
- GLenum zfail, GLenum zpass )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_STENCIL;
-}
-
-
-/* =============================================================
- * Fog - orthographic fog still not working
- */
-
-static void tdfxUpdateFogAttrib( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrFogMode_t mode;
- GrColor_t color;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if ( ctx->Fog.Enabled ) {
- if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) {
- mode = GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT;
- } else {
- mode = GR_FOG_WITH_TABLE_ON_Q;
- }
- } else {
- mode = GR_FOG_DISABLE;
- }
-
- color = TDFXPACKCOLOR888((GLubyte)(ctx->Fog.Color[0]*255.0F),
- (GLubyte)(ctx->Fog.Color[1]*255.0F),
- (GLubyte)(ctx->Fog.Color[2]*255.0F));
-
- if ( fxMesa->Fog.Mode != mode ) {
- fxMesa->Fog.Mode = mode;
- fxMesa->dirty |= TDFX_UPLOAD_FOG_MODE;
- fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT;/*JJJ*/
- }
- if ( fxMesa->Fog.Color != color ) {
- fxMesa->Fog.Color = color;
- fxMesa->dirty |= TDFX_UPLOAD_FOG_COLOR;
- }
- if ( fxMesa->Fog.TableMode != ctx->Fog.Mode ||
- fxMesa->Fog.Density != ctx->Fog.Density ||
- fxMesa->Fog.Near != ctx->Fog.Start ||
- fxMesa->Fog.Far != ctx->Fog.End )
- {
- switch( ctx->Fog.Mode ) {
- case GL_EXP:
- fxMesa->Glide.guFogGenerateExp( fxMesa->Fog.Table, ctx->Fog.Density );
- break;
- case GL_EXP2:
- fxMesa->Glide.guFogGenerateExp2( fxMesa->Fog.Table, ctx->Fog.Density);
- break;
- case GL_LINEAR:
- fxMesa->Glide.guFogGenerateLinear( fxMesa->Fog.Table,
- ctx->Fog.Start, ctx->Fog.End );
- break;
- }
-
- fxMesa->Fog.TableMode = ctx->Fog.Mode;
- fxMesa->Fog.Density = ctx->Fog.Density;
- fxMesa->Fog.Near = ctx->Fog.Start;
- fxMesa->Fog.Far = ctx->Fog.End;
- fxMesa->dirty |= TDFX_UPLOAD_FOG_TABLE;
- }
-}
-
-static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_FOG;
-
- switch (pname) {
- case GL_FOG_COORDINATE_SOURCE_EXT: {
- GLenum p = (GLenum)*param;
- 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:
- ;
- }
-}
-
-
-/* =============================================================
- * Clipping
- */
-
-static int intersect_rect( drm_clip_rect_t *out,
- const drm_clip_rect_t *a,
- const drm_clip_rect_t *b)
-{
- *out = *a;
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (b->y2 < out->y2) out->y2 = b->y2;
- if (out->x1 >= out->x2) return 0;
- if (out->y1 >= out->y2) return 0;
- return 1;
-}
-
-
-/*
- * Examine XF86 cliprect list and scissor state to recompute our
- * cliprect list.
- */
-void tdfxUpdateClipping( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = fxMesa->driDrawable;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- assert(ctx);
- assert(fxMesa);
- assert(dPriv);
-
- if ( dPriv->x != fxMesa->x_offset || dPriv->y != fxMesa->y_offset ||
- dPriv->w != fxMesa->width || dPriv->h != fxMesa->height ) {
- fxMesa->x_offset = dPriv->x;
- fxMesa->y_offset = dPriv->y;
- fxMesa->width = dPriv->w;
- fxMesa->height = dPriv->h;
- fxMesa->y_delta =
- fxMesa->screen_height - fxMesa->y_offset - fxMesa->height;
- tdfxUpdateViewport( ctx );
- }
-
- if (fxMesa->scissoredClipRects && fxMesa->pClipRects) {
- free(fxMesa->pClipRects);
- }
-
- if (ctx->Scissor.Enabled) {
- /* intersect OpenGL scissor box with all cliprects to make a new
- * list of cliprects.
- */
- drm_clip_rect_t scissor;
- int x1 = ctx->Scissor.X + fxMesa->x_offset;
- int y1 = fxMesa->screen_height - fxMesa->y_delta
- - ctx->Scissor.Y - ctx->Scissor.Height;
- int x2 = x1 + ctx->Scissor.Width;
- int y2 = y1 + ctx->Scissor.Height;
- scissor.x1 = MAX2(x1, 0);
- scissor.y1 = MAX2(y1, 0);
- scissor.x2 = MAX2(x2, 0);
- scissor.y2 = MAX2(y2, 0);
-
- assert(scissor.x2 >= scissor.x1);
- assert(scissor.y2 >= scissor.y1);
-
- fxMesa->pClipRects = malloc(dPriv->numClipRects
- * sizeof(drm_clip_rect_t));
- if (fxMesa->pClipRects) {
- int i;
- fxMesa->numClipRects = 0;
- for (i = 0; i < dPriv->numClipRects; i++) {
- if (intersect_rect(&fxMesa->pClipRects[fxMesa->numClipRects],
- &scissor, &dPriv->pClipRects[i])) {
- fxMesa->numClipRects++;
- }
- }
- fxMesa->scissoredClipRects = GL_TRUE;
- }
- else {
- /* out of memory, forgo scissor */
- fxMesa->numClipRects = dPriv->numClipRects;
- fxMesa->pClipRects = dPriv->pClipRects;
- fxMesa->scissoredClipRects = GL_FALSE;
- }
- }
- else {
- fxMesa->numClipRects = dPriv->numClipRects;
- fxMesa->pClipRects = dPriv->pClipRects;
- fxMesa->scissoredClipRects = GL_FALSE;
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_CLIP;
-}
-
-
-
-/* =============================================================
- * Culling
- */
-
-void tdfxUpdateCull( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrCullMode_t mode = GR_CULL_DISABLE;
-
- /* KW: don't need to check raster_primitive here as we don't
- * attempt to draw lines or points with triangles.
- */
- if ( ctx->Polygon.CullFlag ) {
- switch ( ctx->Polygon.CullFaceMode ) {
- case GL_FRONT:
- if ( ctx->Polygon.FrontFace == GL_CCW ) {
- mode = GR_CULL_POSITIVE;
- } else {
- mode = GR_CULL_NEGATIVE;
- }
- break;
-
- case GL_BACK:
- if ( ctx->Polygon.FrontFace == GL_CCW ) {
- mode = GR_CULL_NEGATIVE;
- } else {
- mode = GR_CULL_POSITIVE;
- }
- 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;
- fxMesa->dirty |= TDFX_UPLOAD_CULL;
- }
-}
-
-static void tdfxDDCullFace( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CULL;
-}
-
-static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CULL;
-}
-
-
-/* =============================================================
- * Line drawing.
- */
-
-static void tdfxUpdateLine( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( fxMesa );
- fxMesa->dirty |= TDFX_UPLOAD_LINE;
-}
-
-
-static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_LINE;
-}
-
-
-/* =============================================================
- * Color Attributes
- */
-
-static void tdfxDDColorMask( GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FLUSH_BATCH( fxMesa );
-
- if ( fxMesa->Color.ColorMask[RCOMP] != r ||
- fxMesa->Color.ColorMask[GCOMP] != g ||
- fxMesa->Color.ColorMask[BCOMP] != b ||
- fxMesa->Color.ColorMask[ACOMP] != a ) {
- fxMesa->Color.ColorMask[RCOMP] = r;
- fxMesa->Color.ColorMask[GCOMP] = g;
- fxMesa->Color.ColorMask[BCOMP] = b;
- fxMesa->Color.ColorMask[ACOMP] = a;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_MASK;
-
- if (ctx->Visual.redBits < 8) {
- /* Can't do RGB colormasking in 16bpp mode. */
- /* We can completely ignore the alpha mask. */
- FALLBACK( fxMesa, TDFX_FALLBACK_COLORMASK, (r != g || g != b) );
- }
- }
-}
-
-
-static void tdfxDDClearColor( GLcontext *ctx,
- const GLfloat color[4] )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLubyte c[4];
- FLUSH_BATCH( fxMesa );
- 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]);
- fxMesa->Color.ClearColor = TDFXPACKCOLOR888( c[0], c[1], c[2] );
- fxMesa->Color.ClearAlpha = c[3];
-}
-
-
-/* =============================================================
- * Light Model
- */
-
-static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( pname == GL_LIGHT_MODEL_COLOR_CONTROL ) {
- FALLBACK( fxMesa, TDFX_FALLBACK_SPECULAR,
- (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ));
- }
-}
-
-static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- /* FIXME: Can we implement native flat shading? */
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-/* =============================================================
- * Scissor
- */
-
-static void
-tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CLIP;
-}
-
-/* =============================================================
- * Render
- */
-
-static void tdfxUpdateRenderAttrib( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FLUSH_BATCH( fxMesa );
- fxMesa->dirty |= TDFX_UPLOAD_RENDER_BUFFER;
-}
-
-/* =============================================================
- * Viewport
- */
-
-void tdfxUpdateViewport( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = fxMesa->hw_viewport;
-
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + fxMesa->x_offset + TRI_X_OFFSET;
- m[MAT_SY] = v[MAT_SY];
- m[MAT_TY] = v[MAT_TY] + fxMesa->y_delta + TRI_Y_OFFSET;
- m[MAT_SZ] = v[MAT_SZ];
- m[MAT_TZ] = v[MAT_TZ];
-
- fxMesa->SetupNewInputs |= VERT_BIT_POS;
-}
-
-
-static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_VIEWPORT;
-}
-
-
-static void tdfxDDDepthRange( GLcontext *ctx, GLclampd nearVal, GLclampd farVal )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_VIEWPORT;
-}
-
-
-/* =============================================================
- * State enable/disable
- */
-
-static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- switch ( cap ) {
- case GL_ALPHA_TEST:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
- break;
-
- case GL_BLEND:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_ALPHA;
- FALLBACK( fxMesa, TDFX_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY)/*JJJ - more blending*/);
- break;
-
- case GL_CULL_FACE:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CULL;
- break;
-
- case GL_DEPTH_TEST:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_DEPTH;
- break;
-
- case GL_DITHER:
- FLUSH_BATCH( fxMesa );
- if ( state ) {
- fxMesa->Color.Dither = GR_DITHER_2x2;
- } else {
- fxMesa->Color.Dither = GR_DITHER_DISABLE;
- }
- fxMesa->dirty |= TDFX_UPLOAD_DITHER;
- break;
-
- case GL_FOG:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_FOG;
- break;
-
- case GL_COLOR_LOGIC_OP:
- FALLBACK( fxMesa, TDFX_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
- break;
-
- case GL_LIGHTING:
- FALLBACK( fxMesa, TDFX_FALLBACK_SPECULAR,
- (ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ));
- break;
-
- case GL_LINE_SMOOTH:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_LINE;
- break;
-
- case GL_LINE_STIPPLE:
- FALLBACK(fxMesa, TDFX_FALLBACK_LINE_STIPPLE, state);
- break;
-
- case GL_POLYGON_STIPPLE:
- FLUSH_BATCH(fxMesa);
- fxMesa->new_state |= TDFX_NEW_STIPPLE;
- break;
-
- case GL_SCISSOR_TEST:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_CLIP;
- break;
-
- case GL_STENCIL_TEST:
- FLUSH_BATCH( fxMesa );
- FALLBACK( fxMesa, TDFX_FALLBACK_STENCIL, state && !fxMesa->haveHwStencil);
- fxMesa->new_state |= TDFX_NEW_STENCIL;
- break;
-
- case GL_TEXTURE_3D:
- FLUSH_BATCH( fxMesa );
- FALLBACK( fxMesa, TDFX_FALLBACK_TEXTURE_MAP, state); /* wrong */
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- FLUSH_BATCH( fxMesa );
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- default:
- return;
- }
-}
-
-
-
-/* Set the buffer used for drawing */
-/* XXX support for separate read/draw buffers hasn't been tested */
-static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- FLUSH_BATCH( fxMesa );
-
- /*
- * _ColorDrawBufferMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
- fxMesa->new_state |= TDFX_NEW_RENDER;
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BUFFER_BIT_BACK_LEFT:
- fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
- fxMesa->new_state |= TDFX_NEW_RENDER;
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case 0:
- FX_grColorMaskv( ctx, false4 );
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_TRUE );
- break;
- }
-
- /* We want to update the s/w rast state too so that tdfxDDSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-
-static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* XXX ??? */
-}
-
-
-/* =============================================================
- * Polygon stipple
- */
-
-static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte q[4];
- int i,j,k;
- GLboolean allBitsSet;
-
-/* int active = (ctx->Polygon.StippleFlag && */
-/* fxMesa->reduced_prim == GL_TRIANGLES); */
-
- FLUSH_BATCH(fxMesa);
- fxMesa->Stipple.Pattern = 0xffffffff;
- fxMesa->dirty |= TDFX_UPLOAD_STIPPLE;
- fxMesa->new_state |= TDFX_NEW_STIPPLE;
-
- /* Check if the stipple pattern is fully opaque. If so, use software
- * rendering. This basically a trick to make sure the OpenGL conformance
- * test passes.
- */
- allBitsSet = GL_TRUE;
- for (i = 0; i < 32; i++) {
- if (((GLuint *) mask)[i] != 0xffffffff) {
- allBitsSet = GL_FALSE;
- break;
- }
- }
- if (allBitsSet) {
- fxMesa->haveHwStipple = GL_FALSE;
- return;
- }
-
- q[0] = mask[0];
- q[1] = mask[4];
- q[2] = mask[8];
- q[3] = mask[12];
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 0 ; j < 4; j++)
- for (i = 0 ; i < 4 ; i++,m++) {
- if (*m != q[j]) {
- fxMesa->haveHwStipple = GL_FALSE;
- return;
- }
- }
-
- fxMesa->haveHwStipple = GL_TRUE;
- fxMesa->Stipple.Pattern = ( (q[0] << 0) |
- (q[1] << 8) |
- (q[2] << 16) |
- (q[3] << 24) );
-}
-
-
-
-static void tdfxDDRenderMode( GLcontext *ctx, GLenum mode )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- FALLBACK( fxMesa, TDFX_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-}
-
-
-
-static void tdfxDDPrintState( const char *msg, GLuint flags )
-{
- fprintf( stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s\n",
- msg,
- flags,
- (flags & TDFX_NEW_COLOR) ? "color, " : "",
- (flags & TDFX_NEW_ALPHA) ? "alpha, " : "",
- (flags & TDFX_NEW_DEPTH) ? "depth, " : "",
- (flags & TDFX_NEW_RENDER) ? "render, " : "",
- (flags & TDFX_NEW_FOG) ? "fog, " : "",
- (flags & TDFX_NEW_STENCIL) ? "stencil, " : "",
- (flags & TDFX_NEW_STIPPLE) ? "stipple, " : "",
- (flags & TDFX_NEW_CLIP) ? "clip, " : "",
- (flags & TDFX_NEW_VIEWPORT) ? "viewport, " : "",
- (flags & TDFX_NEW_CULL) ? "cull, " : "",
- (flags & TDFX_NEW_GLIDE) ? "glide, " : "",
- (flags & TDFX_NEW_TEXTURE) ? "texture, " : "",
- (flags & TDFX_NEW_CONTEXT) ? "context, " : "");
-}
-
-
-
-void tdfxDDUpdateHwState( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- int new_state = fxMesa->new_state;
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s()\n", __FUNCTION__ );
- }
-
- if ( new_state )
- {
- FLUSH_BATCH( fxMesa );
-
- fxMesa->new_state = 0;
-
- if ( 0 )
- tdfxDDPrintState( "tdfxUpdateHwState", new_state );
-
- /* Update the various parts of the context's state.
- */
- if ( new_state & TDFX_NEW_ALPHA ) {
- tdfxUpdateAlphaMode( ctx );
- }
-
- if ( new_state & TDFX_NEW_DEPTH )
- tdfxUpdateZMode( ctx );
-
- if ( new_state & TDFX_NEW_FOG )
- tdfxUpdateFogAttrib( ctx );
-
- if ( new_state & TDFX_NEW_CLIP )
- tdfxUpdateClipping( ctx );
-
- if ( new_state & TDFX_NEW_STIPPLE )
- tdfxUpdateStipple( ctx );
-
- if ( new_state & TDFX_NEW_CULL )
- tdfxUpdateCull( ctx );
-
- if ( new_state & TDFX_NEW_LINE )
- tdfxUpdateLine( ctx );
-
- if ( new_state & TDFX_NEW_VIEWPORT )
- tdfxUpdateViewport( ctx );
-
- if ( new_state & TDFX_NEW_RENDER )
- tdfxUpdateRenderAttrib( ctx );
-
- if ( new_state & TDFX_NEW_STENCIL )
- tdfxUpdateStencil( ctx );
-
- if ( new_state & TDFX_NEW_TEXTURE ) {
- tdfxUpdateTextureState( ctx );
- }
- else if ( new_state & TDFX_NEW_TEXTURE_BIND ) {
- tdfxUpdateTextureBinding( ctx );
- }
- }
-
- if ( 0 ) {
- FxI32 bias = (FxI32) (ctx->Polygon.OffsetUnits * TDFX_DEPTH_BIAS_SCALE);
-
- if ( fxMesa->Depth.Bias != bias ) {
- fxMesa->Depth.Bias = bias;
- fxMesa->dirty |= TDFX_UPLOAD_DEPTH_BIAS;
- }
- }
-
- if ( fxMesa->dirty ) {
- LOCK_HARDWARE( fxMesa );
- tdfxEmitHwStateLocked( fxMesa );
- UNLOCK_HARDWARE( fxMesa );
- }
-}
-
-
-static void tdfxDDInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- TDFX_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-
-/* Initialize the context's Glide state mirror. These values will be
- * used as Glide function call parameters when the time comes.
- */
-void tdfxInitState( tdfxContextPtr fxMesa )
-{
- GLcontext *ctx = fxMesa->glCtx;
- GLint i;
-
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
-
- fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB;
- fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertC = FXTRUE;
- fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertD = FXFALSE;
- fxMesa->ColorCombineExt.Shift = 0;
- fxMesa->ColorCombineExt.Invert = FXFALSE;
- fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA;
- fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertC = FXTRUE;
- fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertD = FXFALSE;
- fxMesa->AlphaCombineExt.Shift = 0;
- fxMesa->AlphaCombineExt.Invert = FXFALSE;
-
- fxMesa->sScale0 = fxMesa->tScale0 = 1.0;
- fxMesa->sScale1 = fxMesa->tScale1 = 1.0;
-
- fxMesa->TexPalette.Type = 0;
- fxMesa->TexPalette.Data = NULL;
-
- for ( i = 0 ; i < TDFX_NUM_TMU ; i++ ) {
- fxMesa->TexSource[i].StartAddress = 0;
- fxMesa->TexSource[i].EvenOdd = GR_MIPMAPLEVELMASK_EVEN;
- fxMesa->TexSource[i].Info = NULL;
-
- fxMesa->TexCombine[i].FunctionRGB = 0;
- fxMesa->TexCombine[i].FactorRGB = 0;
- fxMesa->TexCombine[i].FunctionAlpha = 0;
- fxMesa->TexCombine[i].FactorAlpha = 0;
- fxMesa->TexCombine[i].InvertRGB = FXFALSE;
- fxMesa->TexCombine[i].InvertAlpha = FXFALSE;
-
- fxMesa->TexCombineExt[i].Alpha.SourceA = 0;
- /* XXX more state to init here */
- fxMesa->TexCombineExt[i].Color.SourceA = 0;
- fxMesa->TexCombineExt[i].EnvColor = 0x0;
-
- fxMesa->TexParams[i].sClamp = GR_TEXTURECLAMP_WRAP;
- fxMesa->TexParams[i].tClamp = GR_TEXTURECLAMP_WRAP;
- fxMesa->TexParams[i].minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- fxMesa->TexParams[i].magFilt = GR_TEXTUREFILTER_BILINEAR;
- fxMesa->TexParams[i].mmMode = GR_MIPMAP_DISABLE;
- fxMesa->TexParams[i].LODblend = FXFALSE;
- fxMesa->TexParams[i].LodBias = 0.0;
-
- fxMesa->TexState.EnvMode[i] = ~0;
- fxMesa->TexState.TexFormat[i] = ~0;
- fxMesa->TexState.Enabled[i] = 0;
- }
-
- if ( ctx->Visual.doubleBufferMode) {
- fxMesa->DrawBuffer = GR_BUFFER_BACKBUFFER;
- fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
- } else {
- fxMesa->DrawBuffer = GR_BUFFER_FRONTBUFFER;
- fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
- }
-
- fxMesa->Color.ClearColor = 0x00000000;
- fxMesa->Color.ClearAlpha = 0x00;
- fxMesa->Color.ColorMask[RCOMP] = FXTRUE;
- fxMesa->Color.ColorMask[BCOMP] = FXTRUE;
- fxMesa->Color.ColorMask[GCOMP] = FXTRUE;
- fxMesa->Color.ColorMask[ACOMP] = FXTRUE;
- fxMesa->Color.MonoColor = 0xffffffff;
-
- fxMesa->Color.AlphaFunc = GR_CMP_ALWAYS;
- fxMesa->Color.AlphaRef = 0x00;
- fxMesa->Color.BlendSrcRGB = GR_BLEND_ONE;
- fxMesa->Color.BlendDstRGB = GR_BLEND_ZERO;
- fxMesa->Color.BlendSrcA = GR_BLEND_ONE;
- fxMesa->Color.BlendSrcA = GR_BLEND_ZERO;
-
- fxMesa->Color.Dither = GR_DITHER_2x2;
-
- if ( fxMesa->glCtx->Visual.depthBits > 0 ) {
- fxMesa->Depth.Mode = GR_DEPTHBUFFER_ZBUFFER;
- } else {
- fxMesa->Depth.Mode = GR_DEPTHBUFFER_DISABLE;
- }
- fxMesa->Depth.Bias = 0;
- fxMesa->Depth.Func = GR_CMP_LESS;
- fxMesa->Depth.Clear = 0; /* computed later */
- fxMesa->Depth.Mask = FXTRUE;
-
-
- fxMesa->Fog.Mode = GR_FOG_DISABLE;
- fxMesa->Fog.Color = 0x00000000;
- fxMesa->Fog.Table = NULL;
- fxMesa->Fog.Density = 1.0;
- fxMesa->Fog.Near = 1.0;
- fxMesa->Fog.Far = 1.0;
-
- fxMesa->Stencil.Function = GR_CMP_ALWAYS;
- fxMesa->Stencil.RefValue = 0;
- fxMesa->Stencil.ValueMask = 0xff;
- fxMesa->Stencil.WriteMask = 0xff;
- fxMesa->Stencil.FailFunc = 0;
- fxMesa->Stencil.ZFailFunc = 0;
- fxMesa->Stencil.ZPassFunc = 0;
- fxMesa->Stencil.Clear = 0;
-
- fxMesa->Stipple.Mode = GR_STIPPLE_DISABLE;
- fxMesa->Stipple.Pattern = 0xffffffff;
-
- fxMesa->Scissor.minX = 0;
- fxMesa->Scissor.minY = 0;
- fxMesa->Scissor.maxX = 0;
- fxMesa->Scissor.maxY = 0;
-
- fxMesa->Viewport.Mode = GR_WINDOW_COORDS;
- fxMesa->Viewport.X = 0;
- fxMesa->Viewport.Y = 0;
- fxMesa->Viewport.Width = 0;
- fxMesa->Viewport.Height = 0;
- fxMesa->Viewport.Near = 0.0;
- fxMesa->Viewport.Far = 0.0;
-
- fxMesa->CullMode = GR_CULL_DISABLE;
-
- fxMesa->Glide.ColorFormat = GR_COLORFORMAT_ABGR;
- fxMesa->Glide.Origin = GR_ORIGIN_LOWER_LEFT;
- fxMesa->Glide.Initialized = FXFALSE;
-}
-
-
-
-void tdfxDDInitStateFuncs( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- ctx->Driver.UpdateState = tdfxDDInvalidateState;
-
-
- /* State notification callbacks:
- */
- ctx->Driver.ClearColor = tdfxDDClearColor;
- ctx->Driver.DrawBuffer = tdfxDDDrawBuffer;
- ctx->Driver.ReadBuffer = tdfxDDReadBuffer;
-
- ctx->Driver.ColorMask = tdfxDDColorMask;
-
- ctx->Driver.AlphaFunc = tdfxDDAlphaFunc;
- ctx->Driver.BlendEquationSeparate = tdfxDDBlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = tdfxDDBlendFuncSeparate;
- ctx->Driver.ClearDepth = tdfxDDClearDepth;
- ctx->Driver.CullFace = tdfxDDCullFace;
- ctx->Driver.FrontFace = tdfxDDFrontFace;
- ctx->Driver.DepthFunc = tdfxDDDepthFunc;
- ctx->Driver.DepthMask = tdfxDDDepthMask;
- ctx->Driver.DepthRange = tdfxDDDepthRange;
- ctx->Driver.Enable = tdfxDDEnable;
- ctx->Driver.Fogfv = tdfxDDFogfv;
- ctx->Driver.LightModelfv = tdfxDDLightModelfv;
- ctx->Driver.LineWidth = tdfxDDLineWidth;
- ctx->Driver.PolygonStipple = tdfxDDPolygonStipple;
- ctx->Driver.RenderMode = tdfxDDRenderMode;
- ctx->Driver.Scissor = tdfxDDScissor;
- ctx->Driver.ShadeModel = tdfxDDShadeModel;
-
- if ( fxMesa->haveHwStencil ) {
- ctx->Driver.StencilFunc = tdfxDDStencilFunc;
- ctx->Driver.StencilMask = tdfxDDStencilMask;
- ctx->Driver.StencilOp = tdfxDDStencilOp;
- }
-
- ctx->Driver.Viewport = tdfxDDViewport;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.h
deleted file mode 100644
index b10c38f59..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_state.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_state.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_STATE_H__
-#define __TDFX_STATE_H__
-
-#include "context.h"
-#include "tdfx_context.h"
-
-extern void tdfxDDInitStateFuncs( GLcontext *ctx );
-
-extern void tdfxDDUpdateHwState( GLcontext *ctx );
-
-extern void tdfxInitState( tdfxContextPtr fxMesa );
-
-extern void tdfxUpdateClipping( GLcontext *ctx );
-
-
-extern void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
-#define FALLBACK( rmesa, bit, mode ) tdfxFallback( rmesa->glCtx, bit, mode )
-
-extern void tdfxUpdateCull( GLcontext *ctx );
-extern void tdfxUpdateStipple( GLcontext *ctx );
-extern void tdfxUpdateViewport( GLcontext *ctx );
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.c
deleted file mode 100644
index cf4de23b3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.c
+++ /dev/null
@@ -1,1914 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.c,v 1.7 2002/11/05 17:46:10 tsi Exp $ */
-
-/*
- * New fixes:
- * Daniel Borca <dborca@users.sourceforge.net>, 19 Jul 2004
- *
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-
-#include "enums.h"
-#include "image.h"
-#include "texcompress.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "texobj.h"
-#include "tdfx_context.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-
-
-/* no borders! can't halve 1x1! (stride > width * comp) not allowed */
-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_rgba8888(ctx, 2, GL_RGBA,
- &_mesa_texformat_rgba8888_rev, src,
- 0, 0, 0, /* dstX/Y/Zoffset */
- srcRowStride, /* dstRowStride */
- 0, /* dstImageStride */
- srcWidth, srcHeight, 1,
- texImage->Format, _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;
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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);
- }
-}
-
-
-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;
- }
-}
-
-
-/*
- * Compute various texture image parameters.
- * Input: w, h - source texture width and height
- * Output: lodlevel - Glide lod level token for the larger texture dimension
- * aspectratio - 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
- *
- * Sample results:
- * w h lodlevel aspectRatio
- * 128 128 GR_LOD_LOG2_128 (=7) GR_ASPECT_LOG2_1x1 (=0)
- * 64 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x1 (=0)
- * 64 32 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_2x1 (=1)
- * 32 64 GR_LOD_LOG2_64 (=6) GR_ASPECT_LOG2_1x2 (=-1)
- * 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0)
- */
-static void
-tdfxTexGetInfo(const GLcontext *ctx, int w, int h,
- GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio,
- float *sscale, float *tscale,
- int *wscale, int *hscale)
-{
- int logw, logh, ar, lod, ws, hs;
- float s, t;
-
- ASSERT(w >= 1);
- ASSERT(h >= 1);
-
- logw = logbase2(w);
- logh = logbase2(h);
- ar = logw - logh; /* aspect ratio = difference in log dimensions */
- s = t = 256.0;
- ws = hs = 1;
-
- /* Hardware only allows a maximum aspect ratio of 8x1, so handle
- |ar| > 3 by scaling the image and using an 8x1 aspect ratio */
- if (ar >= 0) {
- ASSERT(w >= h);
- lod = logw;
- if (ar <= GR_ASPECT_LOG2_8x1) {
- t = 256 >> ar;
- }
- else {
- /* have to stretch image height */
- t = 32.0;
- hs = 1 << (ar - 3);
- ar = GR_ASPECT_LOG2_8x1;
- }
- }
- else {
- ASSERT(w < h);
- lod = logh;
- if (ar >= GR_ASPECT_LOG2_1x8) {
- s = 256 >> -ar;
- }
- else {
- /* have to stretch image width */
- s = 32.0;
- ws = 1 << (-ar - 3);
- ar = GR_ASPECT_LOG2_1x8;
- }
- }
-
- if (lodlevel)
- *lodlevel = (GrLOD_t) lod;
- if (aspectratio)
- *aspectratio = (GrAspectRatio_t) ar;
- if (sscale)
- *sscale = s;
- if (tscale)
- *tscale = t;
- if (wscale)
- *wscale = ws;
- if (hscale)
- *hscale = hs;
-}
-
-
-/*
- * We need to call this when a texture object's minification filter
- * or texture image sizes change.
- */
-static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- GLint minl, maxl;
-
- if (!ti)
- return;
-
- minl = maxl = tObj->BaseLevel;
-
- if (tObj->Image[0][minl]) {
- maxl = MIN2(tObj->MaxLevel, tObj->Image[0][minl]->MaxLog2);
-
- /* compute largeLodLog2, aspect ratio and texcoord scale factors */
- tdfxTexGetInfo(ctx, tObj->Image[0][minl]->Width, tObj->Image[0][minl]->Height,
- &ti->info.largeLodLog2,
- &ti->info.aspectRatioLog2,
- &(ti->sScale), &(ti->tScale), NULL, NULL);
- }
-
- if (tObj->Image[0][maxl] && (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) {
- /* mipmapping: need to compute smallLodLog2 */
- tdfxTexGetInfo(ctx, tObj->Image[0][maxl]->Width,
- tObj->Image[0][maxl]->Height,
- &ti->info.smallLodLog2, NULL,
- NULL, NULL, NULL, NULL);
- }
- else {
- /* not mipmapping: smallLodLog2 = largeLodLog2 */
- ti->info.smallLodLog2 = ti->info.largeLodLog2;
- maxl = minl;
- }
-
- ti->minLevel = minl;
- ti->maxLevel = maxl;
- ti->info.data = NULL;
-
- /* this is necessary because of fxDDCompressedTexImage2D */
- if (ti->padded) {
- struct gl_texture_image *texImage = tObj->Image[0][minl];
- tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- if (mml->wScale != 1 || mml->hScale != 1) {
- ti->sScale /= mml->wScale;
- ti->tScale /= mml->hScale;
- }
- }
-}
-
-
-static tdfxTexInfo *
-fxAllocTexObjData(tdfxContextPtr fxMesa)
-{
- tdfxTexInfo *ti;
-
- if (!(ti = CALLOC(sizeof(tdfxTexInfo)))) {
- _mesa_problem(NULL, "tdfx driver: out of memory");
- return NULL;
- }
-
- ti->isInTM = GL_FALSE;
-
- ti->whichTMU = TDFX_TMU_NONE;
-
- ti->tm[TDFX_TMU0] = NULL;
- ti->tm[TDFX_TMU1] = NULL;
-
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->magFilt = GR_TEXTUREFILTER_BILINEAR;
-
- ti->sClamp = GR_TEXTURECLAMP_WRAP;
- ti->tClamp = GR_TEXTURECLAMP_WRAP;
-
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->LODblend = FXFALSE;
-
- return ti;
-}
-
-
-/*
- * Called via glBindTexture.
- */
-static void
-tdfxBindTexture(GLcontext * ctx, GLenum target,
- struct gl_texture_object *tObj)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexBind(%d,%p)\n", tObj->Name,
- tObj->DriverData);
- }
-
- if ((target != GL_TEXTURE_1D) && (target != GL_TEXTURE_2D))
- return;
-
- if (!tObj->DriverData) {
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- }
-
- ti = TDFX_TEXTURE_DATA(tObj);
- ti->lastTimeUsed = fxMesa->texBindNumber++;
-
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-/*
- * Called via glTexEnv.
- */
-static void
-tdfxTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
- const GLfloat * param)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- if (param)
- fprintf(stderr, "fxmesa: texenv(%x,%x)\n", pname,
- (GLint) (*param));
- else
- fprintf(stderr, "fxmesa: texenv(%x)\n", pname);
- }
-
- /* XXX this is a bit of a hack to force the Glide texture
- * state to be updated.
- */
- fxMesa->TexState.EnvMode[ctx->Texture.CurrentUnit] = 0;
-
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-/*
- * Called via glTexParameter.
- */
-static void
-tdfxTexParameter(GLcontext * ctx, GLenum target,
- struct gl_texture_object *tObj,
- GLenum pname, const GLfloat * params)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLenum param = (GLenum) (GLint) params[0];
- tdfxTexInfo *ti;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexParam(%d,%p,%x,%x)\n", tObj->Name,
- tObj->DriverData, pname, param);
- }
-
- if ((target != GL_TEXTURE_1D) && (target != GL_TEXTURE_2D))
- return;
-
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
-
- ti = TDFX_TEXTURE_DATA(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:
- if (!fxMesa->Glide.HaveCombineExt) {
- 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;
- }
- /* XXX Voodoo3/Banshee mipmap blending seems to produce
- * incorrectly filtered colors for the smallest mipmap levels.
- * To work-around we fall-through here and use a different filter.
- */
- 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:
- if (!fxMesa->Glide.HaveCombineExt) {
- 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;
- }
- /* XXX Voodoo3/Banshee mipmap blending seems to produce
- * incorrectly filtered colors for the smallest mipmap levels.
- * To work-around we fall-through here and use a different filter.
- */
- case GL_LINEAR_MIPMAP_NEAREST:
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- ti->LODblend = FXFALSE;
- break;
- default:
- break;
- }
- ti->reloadImages = GL_TRUE;
- RevalidateTexture(ctx, tObj);
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_MAG_FILTER:
- switch (param) {
- case GL_NEAREST:
- ti->magFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- break;
- case GL_LINEAR:
- ti->magFilt = GR_TEXTUREFILTER_BILINEAR;
- break;
- default:
- break;
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_WRAP_S:
- switch (param) {
- case GL_CLAMP_TO_BORDER:
- case GL_CLAMP_TO_EDGE:
- case GL_CLAMP:
- ti->sClamp = GR_TEXTURECLAMP_CLAMP;
- break;
- case GL_REPEAT:
- ti->sClamp = GR_TEXTURECLAMP_WRAP;
- break;
- case GL_MIRRORED_REPEAT:
- ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT;
- break;
- default:
- break;
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- break;
-
- case GL_TEXTURE_WRAP_T:
- switch (param) {
- case GL_CLAMP_TO_BORDER:
- case GL_CLAMP_TO_EDGE:
- case GL_CLAMP:
- ti->tClamp = GR_TEXTURECLAMP_CLAMP;
- break;
- case GL_REPEAT:
- ti->tClamp = GR_TEXTURECLAMP_WRAP;
- break;
- case GL_MIRRORED_REPEAT:
- ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT;
- break;
- default:
- break;
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- 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:
- RevalidateTexture(ctx, tObj);
- break;
- case GL_TEXTURE_MAX_LEVEL:
- RevalidateTexture(ctx, tObj);
- break;
-
- default:
- break;
- }
-}
-
-
-/*
- * Called via glDeleteTextures to delete a texture object.
- * Here, we delete the Glide data associated with the texture.
- */
-static void
-tdfxDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- if (ctx && ctx->DriverCtx) {
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTMFreeTexture(fxMesa, tObj);
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
- /* Free mipmap images and the texture object itself */
- _mesa_delete_texture_object(ctx, tObj);
- }
-}
-
-
-/*
- * Return true if texture is resident, false otherwise.
- */
-static GLboolean
-tdfxIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- return (GLboolean) (ti && ti->isInTM);
-}
-
-
-
-/*
- * Convert a gl_color_table texture palette to Glide's format.
- */
-static GrTexTable_t
-convertPalette(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->Format) {
- 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 GR_TEXTABLE_PALETTE_6666_EXT;
- 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 GR_TEXTABLE_PALETTE_6666_EXT;
- 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 GR_TEXTABLE_PALETTE_6666_EXT;
- 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 GR_TEXTABLE_PALETTE_6666_EXT;
- default:
- /* XXX fixme: how can this happen? */
- _mesa_error(NULL, GL_INVALID_ENUM, "convertPalette: table->Format == %s",
- _mesa_lookup_enum_by_nr(table->Format));
- return GR_TEXTABLE_PALETTE;
- }
-}
-
-
-
-static void
-tdfxUpdateTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (tObj) {
- /* per-texture palette */
- tdfxTexInfo *ti;
-
- /* This might be a proxy texture. */
- if (!tObj->Palette.Table)
- return;
-
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- ti = TDFX_TEXTURE_DATA(tObj);
- assert(ti);
- ti->paltype = convertPalette(ti->palette.data, &tObj->Palette);
- /*tdfxTexInvalidate(ctx, tObj);*/
- }
- else {
- /* global texture palette */
- fxMesa->TexPalette.Type = convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette);
- fxMesa->TexPalette.Data = &(fxMesa->glbPalette.data);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX too heavy-handed */
-}
-
-
-/**********************************************************************/
-/**** NEW TEXTURE IMAGE FUNCTIONS ****/
-/**********************************************************************/
-
-#if 000
-static FxBool TexusFatalError = FXFALSE;
-static FxBool TexusError = FXFALSE;
-
-#define TX_DITHER_NONE 0x00000000
-
-static void
-fxTexusError(const char *string, FxBool fatal)
-{
- _mesa_problem(NULL, string);
- /*
- * Just propagate the fatal value up.
- */
- TexusError = FXTRUE;
- TexusFatalError = fatal;
-}
-#endif
-
-
-static const struct gl_texture_format *
-tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum srcFormat, GLenum srcType )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GLboolean allow32bpt = TDFX_IS_NAPALM(fxMesa);
-
- switch (internalFormat) {
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
- 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_texformat_al88;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- return &_mesa_texformat_rgb565;
- 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_texformat_rgb565;
- }
- /* intentional fall through */
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_rgb565;
- case GL_RGBA2:
- case GL_RGBA4:
- return &_mesa_texformat_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_texformat_argb8888;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- /* intentional fall through */
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return allow32bpt ? &_mesa_texformat_argb8888
- : &_mesa_texformat_argb4444;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- 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_texformat_ci8;
- /* 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_texformat_rgb_dxt1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- return &_mesa_texformat_rgba_dxt3;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
- /* GL_3DFX_texture_compression_FXT1 */
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
- default:
- _mesa_problem(ctx, "unexpected format in tdfxChooseTextureFormat");
- return NULL;
- }
-}
-
-
-/*
- * Return the Glide format for the given mesa texture format.
- */
-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;
- }
-}
-
-
-/* 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.
- */
-extern void
-fxt1_decode_1 (const void *texture, int width,
- int i, int j, unsigned char *rgba);
-
-static void
-fetch_intensity8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan * rgba)
-{
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
- rgba[GCOMP] = (((*texel) >> 5) & 0x3f) * 255 / 63;
- rgba[BCOMP] = (((*texel) >> 0) & 0x1f) * 255 / 31;
- rgba[ACOMP] = 255;
-}
-
-
-static void
-fetch_r4g4b4a4(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan * rgba)
-{
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 12) & 0xf) * 255 / 15;
- rgba[GCOMP] = (((*texel) >> 8) & 0xf) * 255 / 15;
- rgba[BCOMP] = (((*texel) >> 4) & 0xf) * 255 / 15;
- rgba[ACOMP] = (((*texel) >> 0) & 0xf) * 255 / 15;
-}
-
-
-static void
-fetch_r5g5b5a1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan * rgba)
-{
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
- const GLushort *texel;
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
- rgba[GCOMP] = (((*texel) >> 6) & 0x1f) * 255 / 31;
- rgba[BCOMP] = (((*texel) >> 1) & 0x1f) * 255 / 31;
- rgba[ACOMP] = (((*texel) >> 0) & 0x01) * 255;
-}
-
-
-static void
-fetch_a8r8g8b8(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan * rgba)
-{
- const tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_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 tdfxMipMapLevel *mml = TDFX_TEXIMAGE_DATA(texImage);
-
- i = i * mml->wScale;
- j = j * mml->hScale;
-
- _mesa_texformat_rgba_dxt5.FetchTexel2D(texImage, i, j, k, rgba);
-}
-
-
-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,
- tdfxMipMapLevel *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 (!texImage->IsCompressed) {
- GLubyte *destAddr;
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- return GL_FALSE;
- }
-
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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_rgba8888(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*/ );
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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;
-}
-
-
-static void
-tdfxTexImage2D(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)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
- GLint texelBytes, dstRowStride;
-
- /*
- printf("TexImage id=%d int 0x%x format 0x%x type 0x%x %dx%d\n",
- texObj->Name, texImage->IntFormat, format, type,
- texImage->Width, texImage->Height);
- */
-
- ti = TDFX_TEXTURE_DATA(texObj);
- if (!ti) {
- texObj->DriverData = fxAllocTexObjData(fxMesa);
- if (!texObj->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- ti = TDFX_TEXTURE_DATA(texObj);
- }
- assert(ti);
-
- mml = TDFX_TEXIMAGE_DATA(texImage);
- if (!mml) {
- texImage->DriverData = CALLOC(sizeof(tdfxMipMapLevel));
- if (!texImage->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- return;
- }
- mml = TDFX_TEXIMAGE_DATA(texImage);
- }
-
- /* Determine width and height scale factors for texture.
- * Remember, Glide is limited to 8:1 aspect ratios.
- */
- tdfxTexGetInfo(ctx,
- texImage->Width, texImage->Height,
- NULL, /* lod level */
- NULL, /* aspect ratio */
- NULL, NULL, /* sscale, tscale */
- &mml->wScale, &mml->hScale);
-
- /* rescaled size: */
- 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 */
- /* [dBorca] we should update texture's attribute, then,
- * because if the application asks us to decompress, we
- * have to know the REAL format! Also, DXT3/5 might not
- * be correct, since it would mess with "compressedSize".
- * Ditto for GL_RGBA[4]_S3TC, which is always mapped to DXT3.
- */
- if (texImage->IsCompressed) {
- 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->IntFormat = 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->IntFormat = internalFormat = texNapalm;
- texImage->IsCompressed = GL_TRUE;
- }
- }
-#endif
-
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
- assert(texImage->TexFormat);
- mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
- ti->info.format = mml->glideFormat;
- texImage->FetchTexelc = fxFetchFunction(texImage->TexFormat->MesaFormat);
- texelBytes = texImage->TexFormat->TexelBytes;
-
- if (texImage->IsCompressed) {
- texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
- mml->width,
- mml->height,
- 1,
- internalFormat);
- dstRowStride = _mesa_compressed_row_stride(internalFormat, 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 */
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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;
- tdfxMipMapLevel *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(!texImage->IsCompressed);
-
- 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 = TDFX_TEXIMAGE_DATA(mipImage);
- _mesa_halve2x2_teximage2d(ctx,
- texImage,
- texelBytes,
- mml->width, mml->height,
- texImage->Data, mipImage->Data);
- texImage = mipImage;
- mml = mip;
- width = mipWidth;
- height = mipHeight;
- }
- }
- }
-
- RevalidateTexture(ctx, texObj);
-
- ti->reloadImages = GL_TRUE;
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-static void
-tdfxTexSubImage2D(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 )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
- GLint texelBytes, dstRowStride;
-
- if (!texObj->DriverData) {
- _mesa_problem(ctx, "problem in fxDDTexSubImage2D");
- return;
- }
-
- ti = TDFX_TEXTURE_DATA(texObj);
- assert(ti);
- mml = TDFX_TEXIMAGE_DATA(texImage);
- assert(mml);
-
- assert(texImage->Data); /* must have an existing texture image! */
- assert(texImage->Format);
-
- texelBytes = texImage->TexFormat->TexelBytes;
- if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, 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 */
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- texImage->TexFormat, texImage->Data,
- xoffset, yoffset, 0,
- dstRowStride,
- 0, /* dstImageStride */
- width, height, 1,
- format, type, pixels, packing);
- }
-
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- GLint mipWidth, mipHeight;
- tdfxMipMapLevel *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(!texImage->IsCompressed);
-
- 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 = TDFX_TEXIMAGE_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->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */
- fxMesa->new_state |= TDFX_NEW_TEXTURE; /* XXX this might be a bit much */
-}
-
-
-static void
-tdfxTexImage1D(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)
-{
- tdfxTexImage2D(ctx, target, level,
- internalFormat, width, 1, border,
- format, type, pixels,
- packing,
- texObj,
- texImage);
-}
-
-static void
-tdfxTexSubImage1D(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 )
-{
- tdfxTexSubImage2D(ctx, target, level,
- xoffset, 0,
- width, 1,
- format, type,
- pixels,
- packing,
- texObj,
- texImage);
-}
-
-/**********************************************************************/
-/**** COMPRESSED TEXTURE IMAGE FUNCTIONS ****/
-/**********************************************************************/
-
-static void
-tdfxCompressedTexImage2D (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)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
-
- if (TDFX_DEBUG & DEBUG_VERBOSE_DRI) {
- fprintf(stderr, "tdfxCompressedTexImage2D: id=%d int 0x%x %dx%d\n",
- texObj->Name, internalFormat,
- width, height);
- }
-
- if ((target != GL_TEXTURE_1D && target != GL_TEXTURE_2D) || texImage->Border > 0) {
- _mesa_problem(NULL, "tdfx: unsupported texture in tdfxCompressedTexImg()\n");
- return;
- }
-
- assert(texImage->IsCompressed);
-
- ti = TDFX_TEXTURE_DATA(texObj);
- if (!ti) {
- texObj->DriverData = fxAllocTexObjData(fxMesa);
- if (!texObj->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- ti = TDFX_TEXTURE_DATA(texObj);
- }
- assert(ti);
-
- mml = TDFX_TEXIMAGE_DATA(texImage);
- if (!mml) {
- texImage->DriverData = CALLOC(sizeof(tdfxMipMapLevel));
- if (!texImage->DriverData) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
- return;
- }
- mml = TDFX_TEXIMAGE_DATA(texImage);
- }
-
- tdfxTexGetInfo(ctx, width, height, NULL, NULL, NULL, NULL,
- &mml->wScale, &mml->hScale);
-
- mml->width = width * mml->wScale;
- mml->height = height * mml->hScale;
-
-
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, -1/*format*/, -1/*type*/);
- assert(texImage->TexFormat);
-
- /* Determine the appropriate Glide texel format,
- * given the user's internal texture format hint.
- */
- mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
- ti->info.format = mml->glideFormat;
- texImage->FetchTexelc = fxFetchFunction(texImage->TexFormat->MesaFormat);
-
- /* allocate new storage for texture image, if needed */
- if (!texImage->Data) {
- texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
- mml->width,
- mml->height,
- 1,
- internalFormat);
- 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_compressed_row_stride(internalFormat, width);
-
- GLuint destRowStride = _mesa_compressed_row_stride(internalFormat,
- 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);
- }
-
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- assert(!texImage->IsCompressed);
- }
-
- RevalidateTexture(ctx, texObj);
-
- ti->reloadImages = GL_TRUE;
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-static void
-tdfxCompressedTexSubImage2D( 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 )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- tdfxMipMapLevel *mml;
- GLint destRowStride, srcRowStride;
- GLint i, rows;
- GLubyte *dest;
-
- if (TDFX_DEBUG & DEBUG_VERBOSE_DRI) {
- fprintf(stderr, "tdfxCompressedTexSubImage2D: id=%d\n", texObj->Name);
- }
-
- ti = TDFX_TEXTURE_DATA(texObj);
- assert(ti);
- mml = TDFX_TEXIMAGE_DATA(texImage);
- assert(mml);
-
- srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width);
-
- destRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
- mml->width);
- dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texImage->IntFormat,
- mml->width,
- (GLubyte*) texImage->Data);
-
- rows = height / 4; /* [dBorca] 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_compressed_row_stride(texImage->IntFormat, texImage->Width);
-
- destRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
- 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(!texImage->IsCompressed);
- }
-
- RevalidateTexture(ctx, texObj);
-
- ti->reloadImages = GL_TRUE;
- fxMesa->new_state |= TDFX_NEW_TEXTURE;
-}
-
-
-#if 0
-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)
- printf("%02x %02x ", data[0], data[1]);
- else if (c == 3)
- printf("%02x %02x %02x ", data[0], data[1], data[2]);
- data += c;
- }
- printf("\n");
- }
-}
-#endif
-
-
-GLboolean
-tdfxTestProxyTexImage(GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLenum format, GLenum type,
- GLint width, GLint height,
- GLint depth, GLint border)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
-
- switch (target) {
- case GL_PROXY_TEXTURE_1D:
- /*JJJ wrong*/
- case GL_PROXY_TEXTURE_2D:
- {
- struct gl_texture_object *tObj;
- tdfxTexInfo *ti;
- int memNeeded;
-
- tObj = ctx->Texture.Proxy2D;
- if (!tObj->DriverData)
- tObj->DriverData = fxAllocTexObjData(fxMesa);
- ti = TDFX_TEXTURE_DATA(tObj);
- assert(ti);
-
- /* assign the parameters to test against */
- tObj->Image[0][level]->Width = width;
- tObj->Image[0][level]->Height = height;
- tObj->Image[0][level]->Border = border;
-#if 0
- tObj->Image[0][level]->IntFormat = internalFormat;
-#endif
- if (level == 0) {
- /* don't use mipmap levels > 0 */
- tObj->MinFilter = tObj->MagFilter = GL_NEAREST;
- }
- else {
- /* test with all mipmap levels */
- tObj->MinFilter = GL_LINEAR_MIPMAP_LINEAR;
- tObj->MagFilter = GL_NEAREST;
- }
- RevalidateTexture(ctx, tObj);
-
- /*
- printf("small lodlog2 0x%x\n", ti->info.smallLodLog2);
- printf("large lodlog2 0x%x\n", ti->info.largeLodLog2);
- printf("aspect ratio 0x%x\n", ti->info.aspectRatioLog2);
- printf("glide format 0x%x\n", ti->info.format);
- printf("data %p\n", ti->info.data);
- printf("lodblend %d\n", (int) ti->LODblend);
- */
-
- /* determine where texture will reside */
- if (ti->LODblend && !shared->umaTexMemory) {
- /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
- memNeeded = fxMesa->Glide.grTexTextureMemRequired(
- GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- }
- else {
- /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
- memNeeded = fxMesa->Glide.grTexTextureMemRequired(
- GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- }
- /*
- printf("Proxy test %d > %d\n", memNeeded, shared->totalTexMem[0]);
- */
- if (memNeeded > shared->totalTexMem[0])
- return GL_FALSE;
- else
- return GL_TRUE;
- }
- case GL_PROXY_TEXTURE_3D:
- return GL_TRUE; /* software rendering */
- default:
- return GL_TRUE; /* never happens, silence compiler */
- }
-}
-
-
-/**
- * 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 *
-tdfxNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
-{
- struct gl_texture_object *obj;
- obj = _mesa_new_texture_object(ctx, name, target);
- return obj;
-}
-
-
-void tdfxInitTextureFuncs( struct dd_function_table *functions )
-{
- functions->BindTexture = tdfxBindTexture;
- functions->NewTextureObject = tdfxNewTextureObject;
- functions->DeleteTexture = tdfxDeleteTexture;
- functions->TexEnv = tdfxTexEnv;
- functions->TexParameter = tdfxTexParameter;
- functions->ChooseTextureFormat = tdfxChooseTextureFormat;
- functions->TexImage1D = tdfxTexImage1D;
- functions->TexSubImage1D = tdfxTexSubImage1D;
- functions->TexImage2D = tdfxTexImage2D;
- functions->TexSubImage2D = tdfxTexSubImage2D;
- functions->IsTextureResident = tdfxIsTextureResident;
- functions->CompressedTexImage2D = tdfxCompressedTexImage2D;
- functions->CompressedTexSubImage2D = tdfxCompressedTexSubImage2D;
- functions->UpdateTexturePalette = tdfxUpdateTexturePalette;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.h
deleted file mode 100644
index f536c25a2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tex.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tex.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef _TDFX_TEX_H_
-#define _TDFX_TEX_H_
-
-
-#define tdfxDDIsCompressedFormatMacro(internalFormat) \
- (((internalFormat) == GL_COMPRESSED_RGB_FXT1_3DFX) || \
- ((internalFormat) == GL_COMPRESSED_RGBA_FXT1_3DFX))
-#define tdfxDDIsCompressedGlideFormatMacro(internalFormat) \
- ((internalFormat) == GR_TEXFMT_ARGB_CMP_FXT1)
-
-
-
-extern void
-tdfxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj);
-
-
-#if 000 /* DEAD? */
-extern void
-fxDDTexUseGlobalPalette(GLcontext * ctx, GLboolean state);
-#endif
-
-extern GLboolean
-tdfxTestProxyTexImage(GLcontext *ctx, GLenum target,
- GLint level, GLint internalFormat,
- GLenum format, GLenum type,
- GLint width, GLint height,
- GLint depth, GLint border);
-
-extern GLvoid *
-tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level,
- const struct gl_texture_object *texObj,
- GLenum * formatOut, GLenum * typeOut,
- GLboolean * freeImageOut);
-
-extern void
-tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target,
- GLint lod, void *image,
- const struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
-
-extern GLint
-tdfxSpecificCompressedTexFormat(GLcontext *ctx,
- GLint internalFormat,
- GLint numDimensions);
-
-extern GLint
-tdfxBaseCompressedTexFormat(GLcontext *ctx,
- GLint internalFormat);
-
-extern GLboolean
-tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat);
-
-extern GLsizei
-tdfxDDCompressedImageSize(GLcontext *ctx,
- GLenum intFormat,
- GLuint numDimensions,
- GLuint width,
- GLuint height,
- GLuint depth);
-
-
-extern void
-tdfxInitTextureFuncs( struct dd_function_table *functions );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.c
deleted file mode 100644
index 63cae17e4..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.c
+++ /dev/null
@@ -1,994 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c,v 1.5 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_context.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-#include "hash.h"
-
-
-#define BAD_ADDRESS ((FxU32) -1)
-
-
-#if 0 /* DEBUG use */
-/*
- * Verify the consistancy of the texture memory manager.
- * This involves:
- * Traversing all texture objects and computing total memory used.
- * Traverse the free block list and computing total memory free.
- * Compare the total free and total used amounts to the total memory size.
- * Make various assertions about the results.
- */
-static void
-VerifyFreeList(tdfxContextPtr fxMesa, FxU32 tmu)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *block;
- int prevStart = -1, prevEnd = -1;
- int totalFree = 0;
- int numObj = 0, numRes = 0;
- int totalUsed = 0;
-
- for (block = shared->tmFree[tmu]; block; block = block->next) {
- assert( block->endAddr > 0 );
- assert( block->startAddr <= shared->totalTexMem[tmu] );
- assert( block->endAddr <= shared->totalTexMem[tmu] );
- assert( (int) block->startAddr > prevStart );
- assert( (int) block->startAddr >= prevEnd );
- prevStart = (int) block->startAddr;
- prevEnd = (int) block->endAddr;
- totalFree += (block->endAddr - block->startAddr);
- }
- assert(totalFree == shared->freeTexMem[tmu]);
-
- {
- struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
- GLuint id;
- for (id = _mesa_HashFirstEntry(textures);
- id;
- id = _mesa_HashNextEntry(textures, id)) {
- struct gl_texture_object *tObj;
- tObj = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- if (ti) {
- if (ti->isInTM) {
- numRes++;
- assert(ti->tm[0]);
- if (ti->tm[tmu])
- totalUsed += (ti->tm[tmu]->endAddr - ti->tm[tmu]->startAddr);
- }
- else {
- assert(!ti->tm[0]);
- }
- }
- }
- }
-
- printf("totalFree: %d totalUsed: %d totalMem: %d #objs=%d #res=%d\n",
- shared->freeTexMem[tmu], totalUsed, shared->totalTexMem[tmu],
- numObj, numRes);
-
- assert(totalUsed + totalFree == shared->totalTexMem[tmu]);
-}
-
-
-static void
-dump_texmem(tdfxContextPtr fxMesa)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct _mesa_HashTable *textures = mesaShared->TexObjects;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *r;
- FxU32 prev;
- GLuint id;
-
- printf("DUMP Objects:\n");
- for (id = _mesa_HashFirstEntry(textures);
- id;
- id = _mesa_HashNextEntry(textures, id)) {
- struct gl_texture_object *obj
- = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
- tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
-
- if (info && info->isInTM) {
- printf("Obj %8p: %4d info = %p\n", obj, obj->Name, info);
-
- printf(" isInTM=%d whichTMU=%d lastTimeUsed=%d\n",
- info->isInTM, info->whichTMU, info->lastTimeUsed);
- printf(" tm[0] = %p", info->tm[0]);
- assert(info->tm[0]);
- if (info->tm[0]) {
- printf(" tm startAddr = %d endAddr = %d",
- info->tm[0]->startAddr,
- info->tm[0]->endAddr);
- }
- printf("\n");
- printf(" tm[1] = %p", info->tm[1]);
- if (info->tm[1]) {
- printf(" tm startAddr = %d endAddr = %d",
- info->tm[1]->startAddr,
- info->tm[1]->endAddr);
- }
- printf("\n");
- }
- }
-
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
-
- printf("Free memory unit 0: %d bytes\n", shared->freeTexMem[0]);
- prev = 0;
- for (r = shared->tmFree[0]; r; r = r->next) {
- printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev);
- prev = r->endAddr;
- }
-
- printf("Free memory unit 1: %d bytes\n", shared->freeTexMem[1]);
- prev = 0;
- for (r = shared->tmFree[1]; r; r = r->next) {
- printf("%8p: start %8d end %8d size %8d gap %8d\n", r, r->startAddr, r->endAddr, r->endAddr - r->startAddr, r->startAddr - prev);
- prev = r->endAddr;
- }
-
-}
-#endif
-
-
-
-#ifdef TEXSANITY
-static void
-fubar(void)
-{
-}
-
-/*
- * Sanity Check
- */
-static void
-sanity(tdfxContextPtr fxMesa)
-{
- tdfxMemRange *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
-
-
-
-
-
-/*
- * Allocate and initialize a new MemRange struct.
- * Try to allocate it from the pool of free MemRange nodes rather than malloc.
- */
-static tdfxMemRange *
-NewRangeNode(tdfxContextPtr fxMesa, FxU32 start, FxU32 end)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *result;
-
- _glthread_LOCK_MUTEX(mesaShared->Mutex);
- if (shared && shared->tmPool) {
- result = shared->tmPool;
- shared->tmPool = shared->tmPool->next;
- }
- else {
- result = MALLOC(sizeof(tdfxMemRange));
-
- }
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
-
- if (!result) {
- /*fprintf(stderr, "fxDriver: out of memory!\n");*/
- return NULL;
- }
-
- result->startAddr = start;
- result->endAddr = end;
- result->next = NULL;
-
- return result;
-}
-
-
-/*
- * Initialize texture memory.
- * We take care of one or both TMU's here.
- */
-void
-tdfxTMInit(tdfxContextPtr fxMesa)
-{
- if (!fxMesa->glCtx->Shared->DriverData) {
- const char *extensions;
- struct tdfxSharedState *shared = CALLOC_STRUCT(tdfxSharedState);
- if (!shared)
- return;
-
- LOCK_HARDWARE(fxMesa);
- extensions = fxMesa->Glide.grGetString(GR_EXTENSION);
- UNLOCK_HARDWARE(fxMesa);
- if (strstr(extensions, "TEXUMA")) {
- FxU32 start, end;
- shared->umaTexMemory = GL_TRUE;
- LOCK_HARDWARE(fxMesa);
- fxMesa->Glide.grEnable(GR_TEXTURE_UMA_EXT);
- start = fxMesa->Glide.grTexMinAddress(0);
- end = fxMesa->Glide.grTexMaxAddress(0);
- UNLOCK_HARDWARE(fxMesa);
- shared->totalTexMem[0] = end - start;
- shared->totalTexMem[1] = 0;
- shared->freeTexMem[0] = end - start;
- shared->freeTexMem[1] = 0;
- shared->tmFree[0] = NewRangeNode(fxMesa, start, end);
- shared->tmFree[1] = NULL;
- /*printf("UMA tex memory: %d\n", (int) (end - start));*/
- }
- else {
- const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
- int tmu;
- shared->umaTexMemory = GL_FALSE;
- LOCK_HARDWARE(fxMesa);
- for (tmu = 0; tmu < numTMUs; tmu++) {
- FxU32 start = fxMesa->Glide.grTexMinAddress(tmu);
- FxU32 end = fxMesa->Glide.grTexMaxAddress(tmu);
- shared->totalTexMem[tmu] = end - start;
- shared->freeTexMem[tmu] = end - start;
- shared->tmFree[tmu] = NewRangeNode(fxMesa, start, end);
- /*printf("Split tex memory: %d\n", (int) (end - start));*/
- }
- UNLOCK_HARDWARE(fxMesa);
- }
-
- shared->tmPool = NULL;
- fxMesa->glCtx->Shared->DriverData = shared;
- /*printf("Texture memory init UMA: %d\n", shared->umaTexMemory);*/
- }
-}
-
-
-/*
- * Clean-up texture memory before destroying context.
- */
-void
-tdfxTMClose(tdfxContextPtr fxMesa)
-{
- if (fxMesa->glCtx->Shared->RefCount == 1 && fxMesa->driDrawable) {
- /* refcount will soon go to zero, free our 3dfx stuff */
- struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData;
-
- const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
- int tmu;
- tdfxMemRange *tmp, *next;
-
- /* Deallocate the pool of free tdfxMemRange nodes */
- tmp = shared->tmPool;
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
-
- /* Delete the texture memory block tdfxMemRange nodes */
- for (tmu = 0; tmu < numTMUs; tmu++) {
- tmp = shared->tmFree[tmu];
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
- }
-
- FREE(shared);
- fxMesa->glCtx->Shared->DriverData = NULL;
- }
-}
-
-
-
-/*
- * Delete a tdfxMemRange struct.
- * We keep a linked list of free/available tdfxMemRange structs to
- * avoid extra malloc/free calls.
- */
-#if 0
-static void
-DeleteRangeNode_NoLock(struct TdfxSharedState *shared, tdfxMemRange *range)
-{
- /* insert at head of list */
- range->next = shared->tmPool;
- shared->tmPool = range;
-}
-#endif
-
-#define DELETE_RANGE_NODE(shared, range) \
- (range)->next = (shared)->tmPool; \
- (shared)->tmPool = (range)
-
-
-
-/*
- * When we've run out of texture memory we have to throw out an
- * existing texture to make room for the new one. This function
- * determins the texture to throw out.
- */
-static struct gl_texture_object *
-FindOldestObject(tdfxContextPtr fxMesa, FxU32 tmu)
-{
- const GLuint bindnumber = fxMesa->texBindNumber;
- struct gl_texture_object *oldestObj, *lowestPriorityObj;
- GLfloat lowestPriority;
- GLuint oldestAge;
- GLuint id;
- struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
-
- oldestObj = NULL;
- oldestAge = 0;
-
- lowestPriority = 1.0F;
- lowestPriorityObj = NULL;
-
- for (id = _mesa_HashFirstEntry(textures);
- id;
- id = _mesa_HashNextEntry(textures, id)) {
- struct gl_texture_object *obj
- = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
- tdfxTexInfo *info = TDFX_TEXTURE_DATA(obj);
-
- if (info && info->isInTM &&
- ((info->whichTMU == tmu) || (info->whichTMU == TDFX_TMU_BOTH) ||
- (info->whichTMU == TDFX_TMU_SPLIT))) {
- GLuint age, lasttime;
-
- assert(info->tm[0]);
- lasttime = info->lastTimeUsed;
-
- if (lasttime > bindnumber)
- age = bindnumber + (UINT_MAX - lasttime + 1); /* TO DO: check wrap around */
- else
- age = bindnumber - lasttime;
-
- if (age >= oldestAge) {
- oldestAge = age;
- oldestObj = obj;
- }
-
- /* examine priority */
- if (obj->Priority < lowestPriority) {
- lowestPriority = obj->Priority;
- lowestPriorityObj = obj;
- }
- }
- }
-
- if (lowestPriority < 1.0) {
- ASSERT(lowestPriorityObj);
- /*
- printf("discard %d pri=%f\n", lowestPriorityObj->Name, lowestPriority);
- */
- return lowestPriorityObj;
- }
- else {
- /*
- printf("discard %d age=%d\n", oldestObj->Name, oldestAge);
- */
- return oldestObj;
- }
-}
-
-
-#if 0
-static void
-FlushTexMemory(tdfxContextPtr fxMesa)
-{
- struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
- GLuint id;
-
- for (id = _mesa_HashFirstEntry(textures);
- id;
- id = _mesa_HashNextEntry(textures, id)) {
- struct gl_texture_object *obj
- = (struct gl_texture_object *) _mesa_HashLookup(textures, id);
- if (obj->RefCount < 2) {
- /* don't flush currently bound textures */
- tdfxTMMoveOutTM_NoLock(fxMesa, obj);
- }
- }
-}
-#endif
-
-
-/*
- * Find the address (offset?) at which we can store a new texture.
- * <tmu> is the texture unit.
- * <size> is the texture size in bytes.
- */
-static FxU32
-FindStartAddr(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 size)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *prev, *block;
- FxU32 result;
-#if 0
- int discardedCount = 0;
-#define MAX_DISCARDS 10
-#endif
-
- if (shared->umaTexMemory) {
- assert(tmu == TDFX_TMU0);
- }
-
- _glthread_LOCK_MUTEX(mesaShared->Mutex);
- while (1) {
- prev = NULL;
- block = shared->tmFree[tmu];
- while (block) {
- if (block->endAddr - block->startAddr >= size) {
- /* The texture will fit here */
- result = block->startAddr;
- block->startAddr += size;
- if (block->startAddr == block->endAddr) {
- /* Remove this node since it's empty */
- if (prev) {
- prev->next = block->next;
- }
- else {
- shared->tmFree[tmu] = block->next;
- }
- DELETE_RANGE_NODE(shared, block);
- }
- shared->freeTexMem[tmu] -= size;
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return result;
- }
- prev = block;
- block = block->next;
- }
- /* We failed to find a block large enough to accomodate <size> bytes.
- * Find the oldest texObject and free it.
- */
-#if 0
- discardedCount++;
- if (discardedCount > MAX_DISCARDS + 1) {
- _mesa_problem(NULL, "%s: extreme texmem fragmentation", __FUNCTION__);
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return BAD_ADDRESS;
- }
- else if (discardedCount > MAX_DISCARDS) {
- /* texture memory is probably really fragmented, flush it */
- FlushTexMemory(fxMesa);
- }
- else
-#endif
- {
- struct gl_texture_object *obj = FindOldestObject(fxMesa, tmu);
- if (obj) {
- tdfxTMMoveOutTM_NoLock(fxMesa, obj);
- fxMesa->stats.texSwaps++;
- }
- else {
- _mesa_problem(NULL, "%s: extreme texmem fragmentation", __FUNCTION__);
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return BAD_ADDRESS;
- }
- }
- }
-
- /* never get here, but play it safe */
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
- return BAD_ADDRESS;
-}
-
-
-/*
- * Remove the given tdfxMemRange node from hardware texture memory.
- */
-static void
-RemoveRange_NoLock(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxMemRange *block, *prev;
-
- if (shared->umaTexMemory) {
- assert(tmu == TDFX_TMU0);
- }
-
- if (!range)
- return;
-
- if (range->startAddr == range->endAddr) {
- DELETE_RANGE_NODE(shared, range);
- return;
- }
- shared->freeTexMem[tmu] += range->endAddr - range->startAddr;
-
- /* find position in linked list to insert this tdfxMemRange node */
- prev = NULL;
- block = shared->tmFree[tmu];
- while (block) {
- assert(range->startAddr != block->startAddr);
- if (range->startAddr > block->startAddr) {
- prev = block;
- block = block->next;
- }
- else {
- break;
- }
- }
-
- /* Insert the free block, combine with adjacent blocks when possible */
- range->next = block;
- if (block) {
- if (range->endAddr == block->startAddr) {
- /* Combine */
- block->startAddr = range->startAddr;
- DELETE_RANGE_NODE(shared, range);
- range = block;
- }
- }
- if (prev) {
- if (prev->endAddr == range->startAddr) {
- /* Combine */
- prev->endAddr = range->endAddr;
- prev->next = range->next;
- DELETE_RANGE_NODE(shared, range);
- }
- else {
- prev->next = range;
- }
- }
- else {
- shared->tmFree[tmu] = range;
- }
-}
-
-
-#if 0 /* NOT USED */
-static void
-RemoveRange(tdfxContextPtr fxMesa, FxU32 tmu, tdfxMemRange *range)
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- _glthread_LOCK_MUTEX(mesaShared->Mutex);
- RemoveRange_NoLock(fxMesa, tmu, range);
- _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
-}
-#endif
-
-
-/*
- * Allocate space for a texture image.
- * <tmu> is the texture unit
- * <texmemsize> is the number of bytes to allocate
- */
-static tdfxMemRange *
-AllocTexMem(tdfxContextPtr fxMesa, FxU32 tmu, FxU32 texmemsize)
-{
- FxU32 startAddr;
- startAddr = FindStartAddr(fxMesa, tmu, texmemsize);
- if (startAddr == BAD_ADDRESS) {
- _mesa_problem(fxMesa->glCtx, "%s returned NULL! tmu=%d texmemsize=%d",
- __FUNCTION__, (int) tmu, (int) texmemsize);
- return NULL;
- }
- else {
- tdfxMemRange *range;
- range = NewRangeNode(fxMesa, startAddr, startAddr + texmemsize);
- return range;
- }
-}
-
-
-/*
- * Download (copy) the given texture data (all mipmap levels) into the
- * Voodoo's texture memory.
- * The texture memory must have already been allocated.
- */
-void
-tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti;
- GLint l;
- FxU32 targetTMU;
-
- assert(tObj);
- ti = TDFX_TEXTURE_DATA(tObj);
- assert(ti);
- targetTMU = ti->whichTMU;
-
- switch (targetTMU) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- if (ti->tm[targetTMU]) {
- for (l = ti->minLevel; l <= ti->maxLevel
- && tObj->Image[0][l]->Data; l++) {
- GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel;
- fxMesa->Glide.grTexDownloadMipMapLevel(targetTMU,
- ti->tm[targetTMU]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[0][l]->Data);
- }
- }
- break;
- case TDFX_TMU_SPLIT:
- if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) {
- for (l = ti->minLevel; l <= ti->maxLevel
- && tObj->Image[0][l]->Data; l++) {
- GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel;
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[TDFX_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_ODD,
- tObj->Image[0][l]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[TDFX_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_EVEN,
- tObj->Image[0][l]->Data);
- }
- }
- break;
- case TDFX_TMU_BOTH:
- if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) {
- for (l = ti->minLevel; l <= ti->maxLevel
- && tObj->Image[0][l]->Data; l++) {
- GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel;
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[TDFX_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[0][l]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[TDFX_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[0][l]->Data);
- }
- }
- break;
- default:
- _mesa_problem(NULL, "%s: bad tmu (%d)", __FUNCTION__, (int)targetTMU);
- return;
- }
-}
-
-
-void
-tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj,
- GLint level)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- GrLOD_t glideLod;
- FxU32 tmu;
-
- tmu = ti->whichTMU;
- glideLod = ti->info.largeLodLog2 - level + tObj->BaseLevel;
- ASSERT(ti->isInTM);
-
- LOCK_HARDWARE(fxMesa);
-
- switch (tmu) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- fxMesa->Glide.grTexDownloadMipMapLevel(tmu,
- ti->tm[tmu]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[0][level]->Data);
- break;
- case TDFX_TMU_SPLIT:
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[GR_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_ODD,
- tObj->Image[0][level]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[GR_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_EVEN,
- tObj->Image[0][level]->Data);
- break;
- case TDFX_TMU_BOTH:
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0,
- ti->tm[GR_TMU0]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[0][level]->Data);
-
- fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1,
- ti->tm[GR_TMU1]->startAddr,
- glideLod,
- ti->info.largeLodLog2,
- ti->info.aspectRatioLog2,
- ti->info.format,
- GR_MIPMAPLEVELMASK_BOTH,
- tObj->Image[0][level]->Data);
- break;
-
- default:
- _mesa_problem(ctx, "%s: bad tmu (%d)", __FUNCTION__, (int)tmu);
- break;
- }
- UNLOCK_HARDWARE(fxMesa);
-}
-
-
-/*
- * Allocate space for the given texture in texture memory then
- * download (copy) it into that space.
- */
-void
-tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj,
- FxU32 targetTMU )
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- FxU32 texmemsize;
-
- fxMesa->stats.reqTexUpload++;
-
- if (ti->isInTM) {
- if (ti->whichTMU == targetTMU)
- return;
- if (targetTMU == TDFX_TMU_SPLIT || ti->whichTMU == TDFX_TMU_SPLIT) {
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj);
- }
- else {
- if (ti->whichTMU == TDFX_TMU_BOTH)
- return;
- targetTMU = TDFX_TMU_BOTH;
- }
- }
-
- ti->whichTMU = targetTMU;
-
- switch (targetTMU) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[targetTMU] = AllocTexMem(fxMesa, targetTMU, texmemsize);
- break;
- case TDFX_TMU_SPLIT:
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_ODD,
- &(ti->info));
- ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize);
- if (ti->tm[TDFX_TMU0])
- fxMesa->stats.memTexUpload += texmemsize;
-
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_EVEN,
- &(ti->info));
- ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize);
- break;
- case TDFX_TMU_BOTH:
- texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[TDFX_TMU0] = AllocTexMem(fxMesa, TDFX_TMU0, texmemsize);
- if (ti->tm[TDFX_TMU0])
- fxMesa->stats.memTexUpload += texmemsize;
-
- /*texmemsize = fxMesa->Glide.grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));*/
- ti->tm[TDFX_TMU1] = AllocTexMem(fxMesa, TDFX_TMU1, texmemsize);
- break;
- default:
- _mesa_problem(NULL, "%s: bad tmu (%d)", __FUNCTION__, (int)targetTMU);
- return;
- }
-
- ti->reloadImages = GL_TRUE;
- ti->isInTM = GL_TRUE;
-
- fxMesa->stats.texUpload++;
-}
-
-
-/*
- * Move the given texture out of hardware texture memory.
- * This deallocates the texture's memory space.
- */
-void
-tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa, struct gl_texture_object *tObj )
-{
- struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: %s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
- }
-
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-
- if (!ti || !ti->isInTM)
- return;
-
- switch (ti->whichTMU) {
- case TDFX_TMU0:
- case TDFX_TMU1:
- RemoveRange_NoLock(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]);
- break;
- case TDFX_TMU_SPLIT:
- case TDFX_TMU_BOTH:
- assert(!shared->umaTexMemory);
- RemoveRange_NoLock(fxMesa, TDFX_TMU0, ti->tm[TDFX_TMU0]);
- RemoveRange_NoLock(fxMesa, TDFX_TMU1, ti->tm[TDFX_TMU1]);
- break;
- default:
- _mesa_problem(NULL, "%s: bad tmu (%d)", __FUNCTION__, (int)ti->whichTMU);
- return;
- }
-
- ti->isInTM = GL_FALSE;
- ti->tm[0] = NULL;
- ti->tm[1] = NULL;
- ti->whichTMU = TDFX_TMU_NONE;
-
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-}
-
-
-/*
- * Called via glDeleteTexture to delete a texture object.
- */
-void
-tdfxTMFreeTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj)
-{
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- if (ti) {
- tdfxTMMoveOutTM(fxMesa, tObj);
- FREE(ti);
- tObj->DriverData = NULL;
- }
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-}
-
-
-
-/*
- * After a context switch this function will be called to restore
- * texture memory for the new context.
- */
-void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa )
-{
- GLcontext *ctx = fxMesa->glCtx;
- struct _mesa_HashTable *textures = fxMesa->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);
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA( tObj );
- if ( ti && ti->isInTM ) {
- int i;
- for ( i = 0 ; i < MAX_TEXTURE_UNITS ; i++ ) {
- if ( ctx->Texture.Unit[i]._Current == tObj ) {
- tdfxTMDownloadTexture( fxMesa, tObj );
- break;
- }
- }
- if ( i == MAX_TEXTURE_UNITS ) {
- tdfxTMMoveOutTM_NoLock( fxMesa, tObj );
- }
- }
- }
- /*
- VerifyFreeList(fxMesa, 0);
- VerifyFreeList(fxMesa, 1);
- */
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.h
deleted file mode 100644
index 739d4e142..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texman.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_TEXMAN_H__
-#define __TDFX_TEXMAN_H__
-
-
-#include "tdfx_lock.h"
-
-
-extern void tdfxTMInit( tdfxContextPtr fxMesa );
-
-extern void tdfxTMClose( tdfxContextPtr fxMesa );
-
-extern void tdfxTMDownloadTexture(tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj);
-
-extern void tdfxTMReloadMipMapLevel( GLcontext *ctx,
- struct gl_texture_object *tObj,
- GLint level );
-
-extern void tdfxTMMoveInTM_NoLock( tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj,
- FxU32 targetTMU );
-
-extern void tdfxTMMoveOutTM_NoLock( tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj );
-
-extern void tdfxTMFreeTexture( tdfxContextPtr fxMesa,
- struct gl_texture_object *tObj );
-
-extern void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa );
-
-
-#define tdfxTMMoveInTM( fxMesa, tObj, targetTMU ) \
- do { \
- LOCK_HARDWARE( fxMesa ); \
- tdfxTMMoveInTM_NoLock( fxMesa, tObj, targetTMU ); \
- UNLOCK_HARDWARE( fxMesa ); \
- } while (0)
-
-#define tdfxTMMoveOutTM( fxMesa, tObj ) \
- do { \
- LOCK_HARDWARE( fxMesa ); \
- tdfxTMMoveOutTM_NoLock( fxMesa, tObj ); \
- UNLOCK_HARDWARE( fxMesa ); \
- } while (0)
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
deleted file mode 100644
index 7059b56e3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
+++ /dev/null
@@ -1,2209 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.c,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * New fixes:
- * Daniel Borca <dborca@users.sourceforge.net>, 19 Jul 2004
- *
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#include "tdfx_state.h"
-#include "tdfx_tex.h"
-#include "tdfx_texman.h"
-#include "tdfx_texstate.h"
-
-
-/* =============================================================
- * Texture
- */
-
-/*
- * 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; \
- }
-
-
-
-/*
- * Setup a texture environment on Voodoo5.
- * Return GL_TRUE for success, GL_FALSE for failure.
- * If we fail, we'll have to use software rendering.
- */
-static GLboolean
-SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
- const struct gl_texture_unit *texUnit, GLenum baseFormat,
- struct tdfx_texcombine_ext *env)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrTCCUColor_t incomingRGB, incomingAlpha;
- const GLenum envMode = texUnit->EnvMode;
-
- if (useIteratedRGBA) {
- incomingRGB = GR_CMBX_ITRGB;
- incomingAlpha = GR_CMBX_ITALPHA;
- }
- else {
- incomingRGB = GR_CMBX_OTHER_TEXTURE_RGB;
- incomingAlpha = GR_CMBX_OTHER_TEXTURE_ALPHA;
- }
-
- /* invariant: */
- env->Color.Shift = 0;
- env->Color.Invert = FXFALSE;
- env->Alpha.Shift = 0;
- env->Alpha.Invert = FXFALSE;
-
- switch (envMode) {
- case GL_REPLACE:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceA = incomingRGB;
- }
- else {
- /* Rv = Rt */
- env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB;
- }
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceD = incomingAlpha;
- }
- else {
- /* Av = At */
- env->Alpha.SourceD = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- }
- env->Alpha.SourceA = GR_CMBX_ITALPHA;
- env->Alpha.ModeA = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXFALSE;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_MODULATE:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- }
- else {
- /* Result = Frag * Tex */
- env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.InvertC = FXFALSE;
- }
- env->Color.SourceA = incomingRGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- }
- else {
- /* Av = Af * At */
- env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.SourceC = incomingAlpha;
- env->Alpha.InvertC = FXFALSE;
- }
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_DECAL:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_RGB) {
- /* Rv = Rt */
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_X;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- }
- else {
- /* Rv = Rf * (1 - At) + Rt * At */
- env->Color.SourceB = incomingRGB;
- env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Color.InvertC = FXFALSE;
- env->Color.SourceD = GR_CMBX_B;
- env->Color.InvertD = FXFALSE;
- }
- env->Color.SourceA = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- /* -- Setup Alpha combiner */
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_BLEND:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceA = incomingRGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- }
- else {
- /* Rv = Rf * (1 - Rt) + Rc * Rt */
- env->Color.SourceA = GR_CMBX_TMU_CCOLOR;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceB = incomingRGB;
- env->Color.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- env->Color.SourceC = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.InvertC = FXFALSE;
- env->Color.SourceD = GR_CMBX_B;
- env->Color.InvertD = FXFALSE;
- }
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ZERO;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- }
- else if (baseFormat == GL_INTENSITY) {
- /* Av = Af * (1 - It) + Ac * It */
- env->Alpha.SourceA = GR_CMBX_TMU_CALPHA;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = incomingAlpha;
- env->Alpha.ModeB = GR_FUNC_MODE_NEGATIVE_X;
- env->Alpha.SourceC = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.InvertC = FXFALSE;
- env->Alpha.SourceD = GR_CMBX_B;
- env->Alpha.InvertD = FXFALSE;
- }
- else {
- /* Av = Af * At */
- env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = incomingAlpha;
- env->Alpha.InvertC = FXFALSE;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- }
- /* Also have to set up the tex env constant color */
- env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F,
- texUnit->EnvColor[1] * 255.0F,
- texUnit->EnvColor[2] * 255.0F,
- texUnit->EnvColor[3] * 255.0F);
- break;
- case GL_ADD:
- /* -- Setup RGB combiner */
- if (baseFormat == GL_ALPHA) {
- /* Rv = Rf */
- env->Color.SourceB = GR_CMBX_ZERO;
- env->Color.ModeB = GR_FUNC_MODE_ZERO;
- }
- else {
- /* Rv = Rf + Tt */
- env->Color.SourceB = GR_CMBX_LOCAL_TEXTURE_RGB;
- env->Color.ModeB = GR_FUNC_MODE_X;
- }
- env->Color.SourceA = incomingRGB;
- env->Color.ModeA = GR_FUNC_MODE_X;
- env->Color.SourceC = GR_CMBX_ZERO;
- env->Color.InvertC = FXTRUE;
- env->Color.SourceD = GR_CMBX_ZERO;
- env->Color.InvertD = FXFALSE;
- /* -- Setup Alpha combiner */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
-
- }
- else if (baseFormat == GL_INTENSITY) {
- /* Av = Af + It */
- env->Alpha.SourceA = incomingAlpha;
- env->Alpha.SourceB = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_X;
- env->Alpha.SourceC = GR_CMBX_ZERO;
- env->Alpha.InvertC = FXTRUE;
- }
- else {
- /* Av = Af * At */
- env->Alpha.SourceA = GR_CMBX_LOCAL_TEXTURE_ALPHA;
- env->Alpha.SourceB = GR_CMBX_ITALPHA;
- env->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- env->Alpha.SourceC = incomingAlpha;
- env->Alpha.InvertC = FXFALSE;
- }
- env->Alpha.ModeA = GR_FUNC_MODE_X;
- env->Alpha.SourceD = GR_CMBX_ZERO;
- env->Alpha.InvertD = FXFALSE;
- break;
-
- case GL_COMBINE_EXT:
- {
- FxU32 A_RGB, B_RGB, C_RGB, D_RGB;
- FxU32 Amode_RGB, Bmode_RGB;
- FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB;
- FxU32 Shift_RGB;
- FxU32 A_A, B_A, C_A, D_A;
- FxU32 Amode_A, Bmode_A;
- FxBool Cinv_A, Dinv_A, Ginv_A;
- FxU32 Shift_A;
-
- /*
- *
- * In the formulas below, we write:
- * o "1(x)" for the identity function applied to x,
- * so 1(x) = x.
- * o "0(x)" for the constant function 0, so
- * 0(x) = 0 for all values of x.
- *
- * Calculate the color combination.
- */
- Shift_RGB = texUnit->Combine.ScaleShiftRGB;
- Shift_A = texUnit->Combine.ScaleShiftA;
- switch (texUnit->Combine.ModeRGB) {
- case GL_REPLACE:
- /*
- * The formula is: Arg0
- * We implement this by the formula:
- * (Arg0 + 0(0))*(1-0) + 0
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->Combine.OperandRGB[0]);
- B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
- Bmode_RGB = GR_FUNC_MODE_ZERO;
- Cinv_RGB = FXTRUE;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_MODULATE:
- /*
- * The formula is: Arg0 * Arg1
- *
- * We implement this by the formula
- * (Arg0 + 0(0)) * Arg1 + 0(0)
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->Combine.OperandRGB[0]);
- B_RGB = GR_CMBX_ZERO;
- Bmode_RGB = GR_CMBX_ZERO;
- TEXENV_SETUP_ARG_RGB(C_RGB,
- texUnit->Combine.SourceRGB[1],
- texUnit->Combine.OperandRGB[1],
- incomingRGB, incomingAlpha);
- Cinv_RGB = TEXENV_OPERAND_INVERTED
- (texUnit->Combine.OperandRGB[1]);
- D_RGB = GR_CMBX_ZERO;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_ADD:
- /*
- * The formula is Arg0 + Arg1
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->Combine.OperandRGB[0]);
- TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->Combine.SourceRGB[1],
- texUnit->Combine.OperandRGB[1],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Bmode_RGB,
- texUnit->Combine.OperandRGB[1]);
- C_RGB = D_RGB = GR_CMBX_ZERO;
- Cinv_RGB = FXTRUE;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_ADD_SIGNED_EXT:
- /*
- * The formula is: Arg0 + Arg1 - 0.5.
- * We compute this by calculating:
- * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA}
- * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA}
- * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
- * we cannot implement the formula properly.
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->Combine.SourceRGB[1],
- texUnit->Combine.OperandRGB[1],
- incomingRGB, incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandRGB[0])) {
- /*
- * A is not inverted. So, choose it.
- */
- Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->Combine.OperandRGB[1])) {
- Bmode_RGB = GR_FUNC_MODE_X;
- }
- else {
- Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
- }
- }
- else {
- /*
- * A is inverted, so try to subtract 1/2
- * from B.
- */
- Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->Combine.OperandRGB[1])) {
- Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
- }
- else {
- /*
- * Both are inverted. This is the case
- * we cannot handle properly. We just
- * choose to not add the - 1/2.
- */
- Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
- return GL_FALSE;
- }
- }
- C_RGB = D_RGB = GR_CMBX_ZERO;
- Cinv_RGB = FXTRUE;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- case GL_INTERPOLATE_EXT:
- /*
- * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
- * We compute this by the formula:
- * (Arg0 - Arg1) * Arg2 + Arg1
- * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
- * == Arg0 * Arg2 + Arg1 * (1 - Arg2)
- * However, if both Arg1 is ONE_MINUS_X, the HW does
- * not support it properly.
- */
- TEXENV_SETUP_ARG_RGB(A_RGB,
- texUnit->Combine.SourceRGB[0],
- texUnit->Combine.OperandRGB[0],
- incomingRGB, incomingAlpha);
- TEXENV_SETUP_MODE_RGB(Amode_RGB,
- texUnit->Combine.OperandRGB[0]);
- TEXENV_SETUP_ARG_RGB(B_RGB,
- texUnit->Combine.SourceRGB[1],
- texUnit->Combine.OperandRGB[1],
- incomingRGB, incomingAlpha);
- if (TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandRGB[1])) {
- /*
- * This case is wrong.
- */
- Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
- return GL_FALSE;
- }
- else {
- Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
- }
- /*
- * The Source/Operand for the C value must
- * specify some kind of alpha value.
- */
- TEXENV_SETUP_ARG_A(C_RGB,
- texUnit->Combine.SourceRGB[2],
- texUnit->Combine.OperandRGB[2],
- incomingAlpha);
- Cinv_RGB = FXFALSE;
- D_RGB = GR_CMBX_B;
- Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- default:
- /*
- * This is here mostly to keep from getting
- * a compiler warning about these not being set.
- * However, this should set all the texture values
- * to zero.
- */
- A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
- Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X;
- Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE;
- break;
- }
- /*
- * Calculate the alpha combination.
- */
- switch (texUnit->Combine.ModeA) {
- case GL_REPLACE:
- /*
- * The formula is: Arg0
- * We implement this by the formula:
- * (Arg0 + 0(0))*(1-0) + 0
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->Combine.OperandA[0]);
- B_A = GR_CMBX_ITALPHA;
- Bmode_A = GR_FUNC_MODE_ZERO;
- C_A = D_A = GR_CMBX_ZERO;
- Cinv_A = FXTRUE;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_MODULATE:
- /*
- * The formula is: Arg0 * Arg1
- *
- * We implement this by the formula
- * (Arg0 + 0(0)) * Arg1 + 0(0)
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->Combine.OperandA[0]);
- B_A = GR_CMBX_ZERO;
- Bmode_A = GR_CMBX_ZERO;
- TEXENV_SETUP_ARG_A(C_A,
- texUnit->Combine.SourceA[1],
- texUnit->Combine.OperandA[1],
- incomingAlpha);
- Cinv_A = TEXENV_OPERAND_INVERTED
- (texUnit->Combine.OperandA[1]);
- D_A = GR_CMBX_ZERO;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_ADD:
- /*
- * The formula is Arg0 + Arg1
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->Combine.OperandA[0]);
- TEXENV_SETUP_ARG_A(B_A,
- texUnit->Combine.SourceA[1],
- texUnit->Combine.OperandA[1],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Bmode_A,
- texUnit->Combine.OperandA[1]);
- C_A = D_A = GR_CMBX_ZERO;
- Cinv_A = FXTRUE;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_ADD_SIGNED_EXT:
- /*
- * The formula is: Arg0 + Arg1 - 0.5.
- * We compute this by calculating:
- * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA}
- * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA}
- * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
- * we cannot implement the formula properly.
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- incomingAlpha);
- TEXENV_SETUP_ARG_A(B_A,
- texUnit->Combine.SourceA[1],
- texUnit->Combine.OperandA[1],
- incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandA[0])) {
- /*
- * A is not inverted. So, choose it.
- */
- Amode_A = GR_FUNC_MODE_X_MINUS_HALF;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->Combine.OperandA[1])) {
- Bmode_A = GR_FUNC_MODE_X;
- } else {
- Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
- }
- } else {
- /*
- * A is inverted, so try to subtract 1/2
- * from B.
- */
- Amode_A = GR_FUNC_MODE_ONE_MINUS_X;
- if (!TEXENV_OPERAND_INVERTED
- (texUnit->Combine.OperandA[1])) {
- Bmode_A = GR_FUNC_MODE_X_MINUS_HALF;
- } else {
- /*
- * Both are inverted. This is the case
- * we cannot handle properly. We just
- * choose to not add the - 1/2.
- */
- Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
- return GL_FALSE;
- }
- }
- C_A = D_A = GR_CMBX_ZERO;
- Cinv_A = FXTRUE;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- case GL_INTERPOLATE_EXT:
- /*
- * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
- * We compute this by the formula:
- * (Arg0 - Arg1) * Arg2 + Arg1
- * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
- * == Arg0 * Arg2 + Arg1 * (1 - Arg2)
- * However, if both Arg1 is ONE_MINUS_X, the HW does
- * not support it properly.
- */
- TEXENV_SETUP_ARG_A(A_A,
- texUnit->Combine.SourceA[0],
- texUnit->Combine.OperandA[0],
- incomingAlpha);
- TEXENV_SETUP_MODE_A(Amode_A,
- texUnit->Combine.OperandA[0]);
- TEXENV_SETUP_ARG_A(B_A,
- texUnit->Combine.SourceA[1],
- texUnit->Combine.OperandA[1],
- incomingAlpha);
- if (!TEXENV_OPERAND_INVERTED(texUnit->Combine.OperandA[1])) {
- Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
- }
- else {
- /*
- * This case is wrong.
- */
- Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
- return GL_FALSE;
- }
- /*
- * The Source/Operand for the C value must
- * specify some kind of alpha value.
- */
- TEXENV_SETUP_ARG_A(C_A,
- texUnit->Combine.SourceA[2],
- texUnit->Combine.OperandA[2],
- incomingAlpha);
- Cinv_A = FXFALSE;
- D_A = GR_CMBX_B;
- Dinv_A = Ginv_A = FXFALSE;
- break;
- default:
- /*
- * This is here mostly to keep from getting
- * a compiler warning about these not being set.
- * However, this should set all the alpha values
- * to one.
- */
- A_A = B_A = C_A = D_A = GR_CMBX_ZERO;
- Amode_A = Bmode_A = GR_FUNC_MODE_X;
- Cinv_A = Dinv_A = FXFALSE;
- Ginv_A = FXTRUE;
- break;
- }
- /*
- * Save the parameters.
- */
- env->Color.SourceA = A_RGB;
- env->Color.ModeA = Amode_RGB;
- env->Color.SourceB = B_RGB;
- env->Color.ModeB = Bmode_RGB;
- env->Color.SourceC = C_RGB;
- env->Color.InvertC = Cinv_RGB;
- env->Color.SourceD = D_RGB;
- env->Color.InvertD = Dinv_RGB;
- env->Color.Shift = Shift_RGB;
- env->Color.Invert = Ginv_RGB;
- env->Alpha.SourceA = A_A;
- env->Alpha.ModeA = Amode_A;
- env->Alpha.SourceB = B_A;
- env->Alpha.ModeB = Bmode_A;
- env->Alpha.SourceC = C_A;
- env->Alpha.InvertC = Cinv_A;
- env->Alpha.SourceD = D_A;
- env->Alpha.InvertD = Dinv_A;
- env->Alpha.Shift = Shift_A;
- env->Alpha.Invert = Ginv_A;
- env->EnvColor = PACK_RGBA32(texUnit->EnvColor[0] * 255.0F,
- texUnit->EnvColor[1] * 255.0F,
- texUnit->EnvColor[2] * 255.0F,
- texUnit->EnvColor[3] * 255.0F);
- }
- break;
-
- default:
- _mesa_problem(ctx, "%s: Bad envMode", __FUNCTION__);
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV;
-
- fxMesa->ColorCombineExt.SourceA = GR_CMBX_TEXTURE_RGB;
- fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X,
- fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_X;
- fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertC = FXTRUE;
- fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertD = FXFALSE;
- fxMesa->ColorCombineExt.Shift = 0;
- fxMesa->ColorCombineExt.Invert = FXFALSE;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- fxMesa->AlphaCombineExt.SourceA = GR_CMBX_TEXTURE_ALPHA;
- fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertC = FXTRUE;
- fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertD = FXFALSE;
- fxMesa->AlphaCombineExt.Shift = 0;
- fxMesa->AlphaCombineExt.Invert = FXFALSE;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
- return GL_TRUE; /* success */
-}
-
-
-
-/*
- * Setup the Voodoo3 texture environment for a single texture unit.
- * Return GL_TRUE for success, GL_FALSE for failure.
- * If failure, we'll use software rendering.
- */
-static GLboolean
-SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit,
- GLenum envMode, GLenum baseFormat)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GrCombineLocal_t localc, locala;
- struct tdfx_combine alphaComb, colorComb;
-
- if (1 /*iteratedRGBA*/)
- localc = locala = GR_COMBINE_LOCAL_ITERATED;
- else
- localc = locala = GR_COMBINE_LOCAL_CONSTANT;
-
- switch (envMode) {
- case GL_DECAL:
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- colorComb.Function = GR_COMBINE_FUNCTION_BLEND;
- colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- break;
- case GL_MODULATE:
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- if (baseFormat == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- }
- break;
-
- case GL_BLEND:
- /*
- * XXX we can't do real GL_BLEND mode. These settings assume that
- * the TexEnv color is black and incoming fragment color is white.
- */
- if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* Av = Af */
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- }
- else if (baseFormat == GL_INTENSITY) {
- /* Av = Af * (1 - It) + Ac * It */
- alphaComb.Function = GR_COMBINE_FUNCTION_BLEND;
- alphaComb.Factor = GR_COMBINE_FACTOR_TEXTURE_ALPHA;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_CONSTANT;
- alphaComb.Invert = FXFALSE;
- }
- else {
- /* Av = Af * At */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- if (baseFormat == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- colorComb.Function = GR_COMBINE_FUNCTION_BLEND;
- colorComb.Factor = GR_COMBINE_FACTOR_TEXTURE_RGB;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_CONSTANT;
- colorComb.Invert = FXTRUE;
- }
- fxMesa->Color.MonoColor = PACK_RGBA32(
- ctx->Texture.Unit[unit].EnvColor[0] * 255.0f,
- ctx->Texture.Unit[unit].EnvColor[1] * 255.0f,
- ctx->Texture.Unit[unit].EnvColor[2] * 255.0f,
- ctx->Texture.Unit[unit].EnvColor[3] * 255.0f);
- fxMesa->dirty |= TDFX_UPLOAD_CONSTANT_COLOR;
- break;
-
- case GL_REPLACE:
- if ((baseFormat == GL_RGB) || (baseFormat == GL_LUMINANCE)) {
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- }
- else {
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- if (baseFormat == GL_ALPHA) {
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- }
- break;
-
- case GL_ADD:
- if (baseFormat == GL_ALPHA ||
- baseFormat == GL_LUMINANCE_ALPHA ||
- baseFormat == GL_RGBA) {
- /* product of texel and fragment alpha */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- alphaComb.Factor = GR_COMBINE_FACTOR_LOCAL;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- else if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
- /* fragment alpha is unchanged */
- alphaComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- alphaComb.Factor = GR_COMBINE_FACTOR_NONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_NONE;
- alphaComb.Invert = FXFALSE;
- }
- else {
- ASSERT(baseFormat == GL_INTENSITY);
- /* sum of texel and fragment alpha */
- alphaComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
- alphaComb.Factor = GR_COMBINE_FACTOR_ONE;
- alphaComb.Local = locala;
- alphaComb.Other = GR_COMBINE_OTHER_TEXTURE;
- alphaComb.Invert = FXFALSE;
- }
- if (baseFormat == GL_ALPHA) {
- /* rgb unchanged */
- colorComb.Function = GR_COMBINE_FUNCTION_LOCAL;
- colorComb.Factor = GR_COMBINE_FACTOR_NONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_NONE;
- colorComb.Invert = FXFALSE;
- }
- else {
- /* sum of texel and fragment rgb */
- colorComb.Function = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
- colorComb.Factor = GR_COMBINE_FACTOR_ONE;
- colorComb.Local = localc;
- colorComb.Other = GR_COMBINE_OTHER_TEXTURE;
- colorComb.Invert = FXFALSE;
- }
- break;
-
- default:
- _mesa_problem(ctx, "bad texture env mode in %s", __FUNCTION__);
- }
-
- if (colorComb.Function != fxMesa->ColorCombine.Function ||
- colorComb.Factor != fxMesa->ColorCombine.Factor ||
- colorComb.Local != fxMesa->ColorCombine.Local ||
- colorComb.Other != fxMesa->ColorCombine.Other ||
- colorComb.Invert != fxMesa->ColorCombine.Invert) {
- fxMesa->ColorCombine = colorComb;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- }
-
- if (alphaComb.Function != fxMesa->AlphaCombine.Function ||
- alphaComb.Factor != fxMesa->AlphaCombine.Factor ||
- alphaComb.Local != fxMesa->AlphaCombine.Local ||
- alphaComb.Other != fxMesa->AlphaCombine.Other ||
- alphaComb.Invert != fxMesa->AlphaCombine.Invert) {
- fxMesa->AlphaCombine = alphaComb;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
- }
- return GL_TRUE;
-}
-
-
-/*
- * Setup the Voodoo3 texture environment for dual texture units.
- * Return GL_TRUE for success, GL_FALSE for failure.
- * If failure, we'll use software rendering.
- */
-static GLboolean
-SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0,
- GLenum envMode0, GLenum baseFormat0,
- GLenum envMode1, GLenum baseFormat1)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- const GrCombineLocal_t locala = GR_COMBINE_LOCAL_ITERATED;
- const GrCombineLocal_t localc = GR_COMBINE_LOCAL_ITERATED;
- const int tmu1 = 1 - tmu0;
-
- if (envMode0 == GL_MODULATE && envMode1 == GL_MODULATE) {
- GLboolean isalpha[TDFX_NUM_TMU];
-
- isalpha[tmu0] = (baseFormat0 == GL_ALPHA);
- isalpha[tmu1] = (baseFormat1 == GL_ALPHA);
-
- if (isalpha[TDFX_TMU1]) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXTRUE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- if (isalpha[TDFX_TMU0]) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else if (envMode0 == GL_REPLACE && envMode1 == GL_BLEND) { /* Quake */
- if (tmu0 == TDFX_TMU1) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXTRUE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else if (envMode0 == GL_REPLACE && envMode1 == GL_MODULATE) {
- /* Quake 2/3 */
- if (tmu1 == TDFX_TMU1) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXTRUE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND_OTHER;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
-
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- if (baseFormat0 == GL_RGB) {
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else {
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- }
- else if (envMode0 == GL_MODULATE && envMode1 == GL_ADD) {
- /* Quake 3 sky */
- GLboolean isalpha[TDFX_NUM_TMU];
-
- isalpha[tmu0] = (baseFormat0 == GL_ALPHA);
- isalpha[tmu1] = (baseFormat1 == GL_ALPHA);
-
- if (isalpha[TDFX_TMU1]) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXTRUE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- if (isalpha[TDFX_TMU0]) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- else {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_LOCAL;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else if (envMode0 == GL_REPLACE && envMode1 == GL_ADD) {
- /* Vulpine sky */
- GLboolean isalpha[TDFX_NUM_TMU];
-
- isalpha[tmu0] = (baseFormat0 == GL_ALPHA);
- isalpha[tmu1] = (baseFormat1 == GL_ALPHA);
-
- if (isalpha[TDFX_TMU1]) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXTRUE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- } else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
-
- if (isalpha[TDFX_TMU0]) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- } else {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- }
-
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- else if (envMode1 == GL_REPLACE) {
- /* Homeworld2 */
-
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
-
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
-
- if ((baseFormat0 == GL_RGB) && (baseFormat0 == GL_LUMINANCE)) {
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- } else {
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->AlphaCombine.Local = locala;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
- if (baseFormat0 == GL_ALPHA) {
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- } else {
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_SCALE_OTHER;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_ONE;
- fxMesa->ColorCombine.Local = localc;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_TEXTURE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- }
- }
- else {
- _mesa_problem(ctx, "%s: Unexpected dual texture mode encountered", __FUNCTION__);
- return GL_FALSE;
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV;
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
- return GL_TRUE;
-}
-
-
-/*
- * This function makes sure that the correct mipmap levels are loaded
- * in the right places in memory and then makes the Glide calls to
- * setup the texture source pointers.
- */
-static void
-setupSingleTMU(tdfxContextPtr fxMesa, struct gl_texture_object *tObj)
-{
- struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData;
- tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- const GLcontext *ctx = fxMesa->glCtx;
-
- /* Make sure we're not loaded incorrectly */
- if (ti->isInTM && !shared->umaTexMemory) {
- /* if doing filtering between mipmap levels, alternate mipmap levels
- * must be in alternate TMUs.
- */
- if (ti->LODblend) {
- if (ti->whichTMU != TDFX_TMU_SPLIT)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj);
- }
- else {
- if (ti->whichTMU == TDFX_TMU_SPLIT)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj);
- }
- }
-
- /* Make sure we're loaded correctly */
- if (!ti->isInTM) {
- /* Have to download the texture */
- if (shared->umaTexMemory) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0);
- }
- else {
- /* Voodoo3 (split texture memory) */
- if (ti->LODblend) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU_SPLIT);
- }
- else {
-#if 0
- /* XXX putting textures into the second memory bank when the
- * first bank is full is not working at this time.
- */
- if (fxMesa->haveTwoTMUs) {
- GLint memReq = fxMesa->Glide.grTexTextureMemRequired(
- GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
- if (shared->freeTexMem[TDFX_TMU0] > memReq) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0);
- }
- else {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU1);
- }
- }
- else
-#endif
- {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj, TDFX_TMU0);
- }
- }
- }
- }
-
- if (ti->LODblend && ti->whichTMU == TDFX_TMU_SPLIT) {
- /* mipmap levels split between texture banks */
- GLint u;
-
- if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) {
- fxMesa->TexPalette.Type = ti->paltype;
- fxMesa->TexPalette.Data = &(ti->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
-
- for (u = 0; u < 2; u++) {
- fxMesa->TexParams[u].sClamp = ti->sClamp;
- fxMesa->TexParams[u].tClamp = ti->tClamp;
- fxMesa->TexParams[u].minFilt = ti->minFilt;
- fxMesa->TexParams[u].magFilt = ti->magFilt;
- fxMesa->TexParams[u].mmMode = ti->mmMode;
- fxMesa->TexParams[u].LODblend = ti->LODblend;
- fxMesa->TexParams[u].LodBias = ctx->Texture.Unit[u].LodBias;
- }
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
-
- fxMesa->TexSource[0].StartAddress = ti->tm[TDFX_TMU0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD;
- fxMesa->TexSource[0].Info = &(ti->info);
- fxMesa->TexSource[1].StartAddress = ti->tm[TDFX_TMU1]->startAddr;
- fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN;
- fxMesa->TexSource[1].Info = &(ti->info);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
- }
- else {
- FxU32 tmu;
-
- if (ti->whichTMU == TDFX_TMU_BOTH)
- tmu = TDFX_TMU0;
- else
- tmu = ti->whichTMU;
-
- if (shared->umaTexMemory) {
- assert(ti->whichTMU == TDFX_TMU0);
- assert(tmu == TDFX_TMU0);
- }
-
- if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) {
- fxMesa->TexPalette.Type = ti->paltype;
- fxMesa->TexPalette.Data = &(ti->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_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 (fxMesa->TexParams[tmu].sClamp != ti->sClamp ||
- fxMesa->TexParams[tmu].tClamp != ti->tClamp ||
- fxMesa->TexParams[tmu].minFilt != ti->minFilt ||
- fxMesa->TexParams[tmu].magFilt != ti->magFilt ||
- fxMesa->TexParams[tmu].mmMode != ti->mmMode ||
- fxMesa->TexParams[tmu].LODblend != FXFALSE ||
- fxMesa->TexParams[tmu].LodBias != ctx->Texture.Unit[tmu].LodBias) {
- fxMesa->TexParams[tmu].sClamp = ti->sClamp;
- fxMesa->TexParams[tmu].tClamp = ti->tClamp;
- fxMesa->TexParams[tmu].minFilt = ti->minFilt;
- fxMesa->TexParams[tmu].magFilt = ti->magFilt;
- fxMesa->TexParams[tmu].mmMode = ti->mmMode;
- fxMesa->TexParams[tmu].LODblend = FXFALSE;
- fxMesa->TexParams[tmu].LodBias = ctx->Texture.Unit[tmu].LodBias;
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- /* Glide texture source info */
- fxMesa->TexSource[0].Info = NULL;
- fxMesa->TexSource[1].Info = NULL;
- if (ti->tm[tmu]) {
- fxMesa->TexSource[tmu].StartAddress = ti->tm[tmu]->startAddr;
- fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu].Info = &(ti->info);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
- }
- }
-
- fxMesa->sScale0 = ti->sScale;
- fxMesa->tScale0 = ti->tScale;
-}
-
-static void
-selectSingleTMUSrc(tdfxContextPtr fxMesa, GLint tmu, FxBool LODblend)
-{
- if (LODblend) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
-
- if (fxMesa->haveTwoTMUs) {
- const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- int tmu;
-
- if (shared->umaTexMemory)
- tmu = GR_TMU0;
- else
- tmu = GR_TMU1;
-
- fxMesa->TexCombine[tmu].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[tmu].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[tmu].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[tmu].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[tmu].InvertRGB = FXFALSE;
- fxMesa->TexCombine[tmu].InvertAlpha = FXFALSE;
- }
- fxMesa->tmuSrc = TDFX_TMU_SPLIT;
- }
- else {
- if (tmu != TDFX_TMU1) {
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- if (fxMesa->haveTwoTMUs) {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_ZERO;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- }
- fxMesa->tmuSrc = TDFX_TMU0;
- }
- else {
- fxMesa->TexCombine[1].FunctionRGB = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorRGB = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].FunctionAlpha = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->TexCombine[1].FactorAlpha = GR_COMBINE_FACTOR_NONE;
- fxMesa->TexCombine[1].InvertRGB = FXFALSE;
- fxMesa->TexCombine[1].InvertAlpha = FXFALSE;
- /* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */
- fxMesa->TexCombine[0].FunctionRGB = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorRGB = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].FunctionAlpha = GR_COMBINE_FUNCTION_BLEND;
- fxMesa->TexCombine[0].FactorAlpha = GR_COMBINE_FACTOR_ONE;
- fxMesa->TexCombine[0].InvertRGB = FXFALSE;
- fxMesa->TexCombine[0].InvertAlpha = FXFALSE;
- fxMesa->tmuSrc = TDFX_TMU1;
- }
- }
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_ENV;
-}
-
-#if 0
-static void print_state(tdfxContextPtr fxMesa)
-{
- GLcontext *ctx = fxMesa->glCtx;
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[1]._Current;
- GLenum base0 = tObj0->Image[0][tObj0->BaseLevel] ? tObj0->Image[0][tObj0->BaseLevel]->Format : 99;
- GLenum base1 = tObj1->Image[0][tObj1->BaseLevel] ? tObj1->Image[0][tObj1->BaseLevel]->Format : 99;
-
- printf("Unit 0: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[0]._ReallyEnabled,
- fxMesa->TexState.Enabled[0]);
- printf(" EnvMode: GL=0x%x Gr=0x%x\n", ctx->Texture.Unit[0].EnvMode,
- fxMesa->TexState.EnvMode[0]);
- printf(" BaseFmt: GL=0x%x Gr=0x%x\n", base0, fxMesa->TexState.TexFormat[0]);
-
-
- printf("Unit 1: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[1]._ReallyEnabled,
- fxMesa->TexState.Enabled[1]);
- printf(" EnvMode: GL=0x%x Gr:0x%x\n", ctx->Texture.Unit[1].EnvMode,
- fxMesa->TexState.EnvMode[1]);
- printf(" BaseFmt: GL=0x%x Gr:0x%x\n", base1, fxMesa->TexState.TexFormat[1]);
-}
-#endif
-
-/*
- * When we're only using a single texture unit, we always use the 0th
- * Glide/hardware unit, regardless if it's GL_TEXTURE0_ARB or GL_TEXTURE1_ARB
- * that's enalbed.
- * Input: ctx - the context
- * unit - the OpenGL texture unit to use.
- */
-static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxTexInfo *ti;
- struct gl_texture_object *tObj;
- int tmu;
- GLenum envMode, baseFormat;
-
- tObj = ctx->Texture.Unit[unit]._Current;
- if (tObj->Image[0][tObj->BaseLevel]->Border > 0) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_TRUE);
- return;
- }
-
- setupSingleTMU(fxMesa, tObj);
-
- ti = TDFX_TEXTURE_DATA(tObj);
- if (ti->whichTMU == TDFX_TMU_BOTH)
- tmu = TDFX_TMU0;
- else
- tmu = ti->whichTMU;
-
- if (fxMesa->tmuSrc != tmu) {
- selectSingleTMUSrc(fxMesa, tmu, ti->LODblend);
- }
-
- if (ti->reloadImages)
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES;
-
- /* Check if we really need to update the texenv state */
- envMode = ctx->Texture.Unit[unit].EnvMode;
- baseFormat = tObj->Image[0][tObj->BaseLevel]->Format;
-
- if (TDFX_IS_NAPALM(fxMesa)) {
- /* see if we really need to update the unit */
- if (1/*fxMesa->TexState.Enabled[unit] != ctx->Texture.Unit[unit]._ReallyEnabled ||
- envMode != fxMesa->TexState.EnvMode[0] ||
- envMode == GL_COMBINE_EXT ||
- baseFormat != fxMesa->TexState.TexFormat[0]*/) {
- struct tdfx_texcombine_ext *otherEnv;
- if (!SetupTexEnvNapalm(ctx, GL_TRUE,
- &ctx->Texture.Unit[unit], baseFormat,
- &fxMesa->TexCombineExt[0])) {
- /* software fallback */
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
- /* disable other unit */
- otherEnv = &fxMesa->TexCombineExt[1];
- otherEnv->Color.SourceA = GR_CMBX_ZERO;
- otherEnv->Color.ModeA = GR_FUNC_MODE_ZERO;
- otherEnv->Color.SourceB = GR_CMBX_ZERO;
- otherEnv->Color.ModeB = GR_FUNC_MODE_ZERO;
- otherEnv->Color.SourceC = GR_CMBX_ZERO;
- otherEnv->Color.InvertC = FXFALSE;
- otherEnv->Color.SourceD = GR_CMBX_ZERO;
- otherEnv->Color.InvertD = FXFALSE;
- otherEnv->Color.Shift = 0;
- otherEnv->Color.Invert = FXFALSE;
- otherEnv->Alpha.SourceA = GR_CMBX_ITALPHA;
- otherEnv->Alpha.ModeA = GR_FUNC_MODE_ZERO;
- otherEnv->Alpha.SourceB = GR_CMBX_ITALPHA;
- otherEnv->Alpha.ModeB = GR_FUNC_MODE_ZERO;
- otherEnv->Alpha.SourceC = GR_CMBX_ZERO;
- otherEnv->Alpha.InvertC = FXFALSE;
- otherEnv->Alpha.SourceD = GR_CMBX_ZERO;
- otherEnv->Alpha.InvertD = FXFALSE;
- otherEnv->Alpha.Shift = 0;
- otherEnv->Alpha.Invert = FXFALSE;
-
-#if 0/*JJJ*/
- fxMesa->TexState.Enabled[unit] = ctx->Texture.Unit[unit]._ReallyEnabled;
- fxMesa->TexState.EnvMode[0] = envMode;
- fxMesa->TexState.TexFormat[0] = baseFormat;
- fxMesa->TexState.EnvMode[1] = 0;
- fxMesa->TexState.TexFormat[1] = 0;
-#endif
- }
- }
- else {
- /* Voodoo3 */
-
- /* see if we really need to update the unit */
- if (1/*fxMesa->TexState.Enabled[unit] != ctx->Texture.Unit[unit]._ReallyEnabled ||
- envMode != fxMesa->TexState.EnvMode[0] ||
- envMode == GL_COMBINE_EXT ||
- baseFormat != fxMesa->TexState.TexFormat[0]*/) {
- if (!SetupSingleTexEnvVoodoo3(ctx, unit, envMode, baseFormat)) {
- /* software fallback */
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
-#if 0/*JJJ*/
- fxMesa->TexState.Enabled[unit] = ctx->Texture.Unit[unit]._ReallyEnabled;
- fxMesa->TexState.EnvMode[0] = envMode;
- fxMesa->TexState.TexFormat[0] = baseFormat;
- fxMesa->TexState.EnvMode[1] = 0;
- fxMesa->TexState.TexFormat[1] = 0;
-#endif
- }
- }
-}
-
-
-static void
-setupDoubleTMU(tdfxContextPtr 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
-
- const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- const GLcontext *ctx = fxMesa->glCtx;
- tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0);
- tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1);
- GLuint tstate = 0;
- int tmu0 = 0, tmu1 = 1;
-
- if (shared->umaTexMemory) {
- if (!ti0->isInTM) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0);
- assert(ti0->isInTM);
- }
- if (!ti1->isInTM) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0);
- assert(ti1->isInTM);
- }
- }
- else {
- /* We shouldn't need to do this. There is something wrong with
- multitexturing when the TMUs are swapped. So, we're forcing
- them to always be loaded correctly. !!! */
- if (ti0->whichTMU == TDFX_TMU1)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj0);
- if (ti1->whichTMU == TDFX_TMU0)
- tdfxTMMoveOutTM_NoLock(fxMesa, tObj1);
-
- if (ti0->isInTM) {
- switch (ti0->whichTMU) {
- case TDFX_TMU0:
- tstate |= T0_IN_TMU0;
- break;
- case TDFX_TMU1:
- tstate |= T0_IN_TMU1;
- break;
- case TDFX_TMU_BOTH:
- tstate |= T0_IN_TMU0 | T0_IN_TMU1;
- break;
- case TDFX_TMU_SPLIT:
- tstate |= T0_NOT_IN_TMU;
- break;
- }
- }
- else
- tstate |= T0_NOT_IN_TMU;
-
- if (ti1->isInTM) {
- switch (ti1->whichTMU) {
- case TDFX_TMU0:
- tstate |= T1_IN_TMU0;
- break;
- case TDFX_TMU1:
- tstate |= T1_IN_TMU1;
- break;
- case TDFX_TMU_BOTH:
- tstate |= T1_IN_TMU0 | T1_IN_TMU1;
- break;
- case TDFX_TMU_SPLIT:
- tstate |= T1_NOT_IN_TMU;
- break;
- }
- }
- else
- tstate |= T1_NOT_IN_TMU;
-
- /* 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) {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_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 */
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1);
- }
- else {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_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 */
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU1);
- }
- else {
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU0);
- }
- tmu0 = 1;
- tmu1 = 0;
- }
- else { /* Nothing is loaded */
- tdfxTMMoveInTM_NoLock(fxMesa, tObj0, TDFX_TMU0);
- tdfxTMMoveInTM_NoLock(fxMesa, tObj1, TDFX_TMU1);
- /* tmu0 and tmu1 are setup */
- }
- }
- }
- }
-
- ti0->lastTimeUsed = fxMesa->texBindNumber;
- ti1->lastTimeUsed = fxMesa->texBindNumber;
-
-
- if (!ctx->Texture.SharedPalette) {
- if (ti0->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = ti0->paltype;
- fxMesa->TexPalette.Data = &(ti0->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- else if (ti1->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = ti1->paltype;
- fxMesa->TexPalette.Data = &(ti1->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- else {
- fxMesa->TexPalette.Data = NULL;
- }
- }
-
- /*
- * Setup Unit 0
- */
- assert(ti0->isInTM);
- assert(ti0->tm[tmu0]);
- fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr;
- fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu0].Info = &(ti0->info);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
-
- if (fxMesa->TexParams[tmu0].sClamp != ti0->sClamp ||
- fxMesa->TexParams[tmu0].tClamp != ti0->tClamp ||
- fxMesa->TexParams[tmu0].minFilt != ti0->minFilt ||
- fxMesa->TexParams[tmu0].magFilt != ti0->magFilt ||
- fxMesa->TexParams[tmu0].mmMode != ti0->mmMode ||
- fxMesa->TexParams[tmu0].LODblend != FXFALSE ||
- fxMesa->TexParams[tmu0].LodBias != ctx->Texture.Unit[tmu0].LodBias) {
- fxMesa->TexParams[tmu0].sClamp = ti0->sClamp;
- fxMesa->TexParams[tmu0].tClamp = ti0->tClamp;
- fxMesa->TexParams[tmu0].minFilt = ti0->minFilt;
- fxMesa->TexParams[tmu0].magFilt = ti0->magFilt;
- fxMesa->TexParams[tmu0].mmMode = ti0->mmMode;
- fxMesa->TexParams[tmu0].LODblend = FXFALSE;
- fxMesa->TexParams[tmu0].LodBias = ctx->Texture.Unit[tmu0].LodBias;
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- /*
- * Setup Unit 1
- */
- if (shared->umaTexMemory) {
- ASSERT(ti1->isInTM);
- ASSERT(ti1->tm[0]);
- fxMesa->TexSource[tmu1].StartAddress = ti1->tm[0]->startAddr;
- fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu1].Info = &(ti1->info);
- }
- else {
- ASSERT(ti1->isInTM);
- ASSERT(ti1->tm[tmu1]);
- fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr;
- fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu1].Info = &(ti1->info);
- }
-
- if (fxMesa->TexParams[tmu1].sClamp != ti1->sClamp ||
- fxMesa->TexParams[tmu1].tClamp != ti1->tClamp ||
- fxMesa->TexParams[tmu1].minFilt != ti1->minFilt ||
- fxMesa->TexParams[tmu1].magFilt != ti1->magFilt ||
- fxMesa->TexParams[tmu1].mmMode != ti1->mmMode ||
- fxMesa->TexParams[tmu1].LODblend != FXFALSE ||
- fxMesa->TexParams[tmu1].LodBias != ctx->Texture.Unit[tmu1].LodBias) {
- fxMesa->TexParams[tmu1].sClamp = ti1->sClamp;
- fxMesa->TexParams[tmu1].tClamp = ti1->tClamp;
- fxMesa->TexParams[tmu1].minFilt = ti1->minFilt;
- fxMesa->TexParams[tmu1].magFilt = ti1->magFilt;
- fxMesa->TexParams[tmu1].mmMode = ti1->mmMode;
- fxMesa->TexParams[tmu1].LODblend = FXFALSE;
- fxMesa->TexParams[tmu1].LodBias = ctx->Texture.Unit[tmu1].LodBias;
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PARAMS;
- }
-
- fxMesa->sScale0 = ti0->sScale;
- fxMesa->tScale0 = ti0->tScale;
- fxMesa->sScale1 = ti1->sScale;
- fxMesa->tScale1 = ti1->tScale;
-
-#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 setupTextureDoubleTMU(GLcontext * ctx)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[1]._Current;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[0]._Current;
- tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0);
- tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1);
- struct gl_texture_image *baseImage0 = tObj0->Image[0][tObj0->BaseLevel];
- struct gl_texture_image *baseImage1 = tObj1->Image[0][tObj1->BaseLevel];
-#if 0/*JJJ*/
- const GLenum envMode0 = ctx->Texture.Unit[0].EnvMode;
- const GLenum envMode1 = ctx->Texture.Unit[1].EnvMode;
-#endif
-
- if (baseImage0->Border > 0 || baseImage1->Border > 0) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_TRUE);
- return;
- }
-
- setupDoubleTMU(fxMesa, tObj0, tObj1);
-
- if (ti0->reloadImages || ti1->reloadImages)
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_IMAGES;
-
- fxMesa->tmuSrc = TDFX_TMU_BOTH;
-
- if (TDFX_IS_NAPALM(fxMesa)) {
- /* Remember, Glide has its texture units numbered in backward
- * order compared to OpenGL.
- */
- GLboolean hw1 = GL_TRUE, hw2 = GL_TRUE;
-
- /* check if we really need to update glide unit 1 */
- if (1/*fxMesa->TexState.Enabled[0] != ctx->Texture.Unit[0]._ReallyEnabled ||
- envMode0 != fxMesa->TexState.EnvMode[1] ||
- envMode0 == GL_COMBINE_EXT ||
- baseImage0->Format != fxMesa->TexState.TexFormat[1] ||
- (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)*/) {
- hw1 = SetupTexEnvNapalm(ctx, GL_TRUE, &ctx->Texture.Unit[0],
- baseImage0->Format, &fxMesa->TexCombineExt[1]);
-#if 0/*JJJ*/
- fxMesa->TexState.EnvMode[1] = envMode0;
- fxMesa->TexState.TexFormat[1] = baseImage0->Format;
- fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled;
-#endif
- }
-
- /* check if we really need to update glide unit 0 */
- if (1/*fxMesa->TexState.Enabled[1] != ctx->Texture.Unit[1]._ReallyEnabled ||
- envMode1 != fxMesa->TexState.EnvMode[0] ||
- envMode1 == GL_COMBINE_EXT ||
- baseImage1->Format != fxMesa->TexState.TexFormat[0] ||
- (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)*/) {
- hw2 = SetupTexEnvNapalm(ctx, GL_FALSE, &ctx->Texture.Unit[1],
- baseImage1->Format, &fxMesa->TexCombineExt[0]);
-#if 0/*JJJ*/
- fxMesa->TexState.EnvMode[0] = envMode1;
- fxMesa->TexState.TexFormat[0] = baseImage1->Format;
- fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled;
-#endif
- }
-
-
- if (!hw1 || !hw2) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
- }
- else {
- int unit0, unit1;
- if ((ti0->whichTMU == TDFX_TMU1) || (ti1->whichTMU == TDFX_TMU0))
- unit0 = 1;
- else
- unit0 = 0;
- unit1 = 1 - unit0;
-
- if (1/*fxMesa->TexState.Enabled[0] != ctx->Texture.Unit[0]._ReallyEnabled ||
- fxMesa->TexState.Enabled[1] != ctx->Texture.Unit[1]._ReallyEnabled ||
- envMode0 != fxMesa->TexState.EnvMode[unit0] ||
- envMode0 == GL_COMBINE_EXT ||
- envMode1 != fxMesa->TexState.EnvMode[unit1] ||
- envMode1 == GL_COMBINE_EXT ||
- baseImage0->Format != fxMesa->TexState.TexFormat[unit0] ||
- baseImage1->Format != fxMesa->TexState.TexFormat[unit1] ||
- (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)*/) {
-
- if (!SetupDoubleTexEnvVoodoo3(ctx, unit0,
- ctx->Texture.Unit[0].EnvMode, baseImage0->Format,
- ctx->Texture.Unit[1].EnvMode, baseImage1->Format)) {
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
-
-#if 0/*JJJ*/
- fxMesa->TexState.EnvMode[unit0] = envMode0;
- fxMesa->TexState.TexFormat[unit0] = baseImage0->Format;
- fxMesa->TexState.EnvMode[unit1] = envMode1;
- fxMesa->TexState.TexFormat[unit1] = baseImage1->Format;
- fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled;
- fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled;
-#endif
- }
- }
-}
-
-
-void
-tdfxUpdateTextureState( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_FALSE);
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_FALSE);
-
- if (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT) &&
- ctx->Texture.Unit[1]._ReallyEnabled == 0) {
- LOCK_HARDWARE( fxMesa ); /* XXX remove locking eventually */
- setupTextureSingleTMU(ctx, 0);
- UNLOCK_HARDWARE( fxMesa );
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
- ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- LOCK_HARDWARE( fxMesa );
- setupTextureSingleTMU(ctx, 1);
- UNLOCK_HARDWARE( fxMesa );
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT) &&
- ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- LOCK_HARDWARE( fxMesa );
- setupTextureDoubleTMU(ctx);
- UNLOCK_HARDWARE( fxMesa );
- }
- else {
- /* disable hardware texturing */
- if (TDFX_IS_NAPALM(fxMesa)) {
- fxMesa->ColorCombineExt.SourceA = GR_CMBX_ITRGB;
- fxMesa->ColorCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->ColorCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->ColorCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertC = FXTRUE;
- fxMesa->ColorCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->ColorCombineExt.InvertD = FXFALSE;
- fxMesa->ColorCombineExt.Shift = 0;
- fxMesa->ColorCombineExt.Invert = FXFALSE;
- fxMesa->AlphaCombineExt.SourceA = GR_CMBX_ITALPHA;
- fxMesa->AlphaCombineExt.ModeA = GR_FUNC_MODE_X;
- fxMesa->AlphaCombineExt.SourceB = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.ModeB = GR_FUNC_MODE_ZERO;
- fxMesa->AlphaCombineExt.SourceC = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertC = FXTRUE;
- fxMesa->AlphaCombineExt.SourceD = GR_CMBX_ZERO;
- fxMesa->AlphaCombineExt.InvertD = FXFALSE;
- fxMesa->AlphaCombineExt.Shift = 0;
- fxMesa->AlphaCombineExt.Invert = FXFALSE;
- }
- else {
- /* Voodoo 3*/
- fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->ColorCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->ColorCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->ColorCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->ColorCombine.Invert = FXFALSE;
- fxMesa->AlphaCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
- fxMesa->AlphaCombine.Factor = GR_COMBINE_FACTOR_NONE;
- fxMesa->AlphaCombine.Local = GR_COMBINE_LOCAL_ITERATED;
- fxMesa->AlphaCombine.Other = GR_COMBINE_OTHER_NONE;
- fxMesa->AlphaCombine.Invert = FXFALSE;
- }
-
- fxMesa->TexState.Enabled[0] = 0;
- fxMesa->TexState.Enabled[1] = 0;
- fxMesa->TexState.EnvMode[0] = 0;
- fxMesa->TexState.EnvMode[1] = 0;
-
- fxMesa->dirty |= TDFX_UPLOAD_COLOR_COMBINE;
- fxMesa->dirty |= TDFX_UPLOAD_ALPHA_COMBINE;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled != 0 ||
- ctx->Texture.Unit[1]._ReallyEnabled != 0) {
- /* software texture (cube map, rect tex, etc */
- FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE);
- }
- }
-}
-
-
-
-/*
- * This is a special case of texture state update.
- * It's used when we've simply bound a new texture to a texture
- * unit and the new texture has the exact same attributes as the
- * previously bound texture.
- * This is very common in Quake3.
- */
-void
-tdfxUpdateTextureBinding( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current;
- struct gl_texture_object *tObj1 = ctx->Texture.Unit[1]._Current;
- tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0);
- tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1);
-
- const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
- const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
-
- if (ti0) {
- fxMesa->sScale0 = ti0->sScale;
- fxMesa->tScale0 = ti0->tScale;
- if (ti0->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = ti0->paltype;
- fxMesa->TexPalette.Data = &(ti0->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- else if (ti1 && ti1->info.format == GR_TEXFMT_P_8) {
- fxMesa->TexPalette.Type = ti1->paltype;
- fxMesa->TexPalette.Data = &(ti1->palette);
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_PALETTE;
- }
- }
- if (ti1) {
- fxMesa->sScale1 = ti1->sScale;
- fxMesa->tScale1 = ti1->tScale;
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT) &&
- ctx->Texture.Unit[0]._ReallyEnabled == 0) {
- /* Only unit 0 2D enabled */
- if (shared->umaTexMemory) {
- fxMesa->TexSource[0].StartAddress = ti0->tm[0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[0].Info = &(ti0->info);
- }
- else {
- if (ti0->LODblend && ti0->whichTMU == TDFX_TMU_SPLIT) {
- fxMesa->TexSource[0].StartAddress = ti0->tm[TDFX_TMU0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_ODD;
- fxMesa->TexSource[0].Info = &(ti0->info);
- fxMesa->TexSource[1].StartAddress = ti0->tm[TDFX_TMU1]->startAddr;
- fxMesa->TexSource[1].EvenOdd = GR_MIPMAPLEVELMASK_EVEN;
- fxMesa->TexSource[1].Info = &(ti0->info);
- }
- else {
- FxU32 tmu;
- if (ti0->whichTMU == TDFX_TMU_BOTH)
- tmu = TDFX_TMU0;
- else
- tmu = ti0->whichTMU;
- fxMesa->TexSource[0].Info = NULL;
- fxMesa->TexSource[1].Info = NULL;
- if (ti0->tm[tmu]) {
- fxMesa->TexSource[tmu].StartAddress = ti0->tm[tmu]->startAddr;
- fxMesa->TexSource[tmu].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu].Info = &(ti0->info);
- }
- }
- }
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled == 0 &&
- ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- /* Only unit 1 2D enabled */
- if (shared->umaTexMemory) {
- fxMesa->TexSource[0].StartAddress = ti1->tm[0]->startAddr;
- fxMesa->TexSource[0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[0].Info = &(ti1->info);
- }
- }
- else if (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT) &&
- ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
- /* Both 2D enabled */
- if (shared->umaTexMemory) {
- const FxU32 tmu0 = 0, tmu1 = 1;
- fxMesa->TexSource[tmu0].StartAddress = ti0->tm[0]->startAddr;
- fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu0].Info = &(ti0->info);
-
- 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;
- fxMesa->TexSource[tmu0].StartAddress = ti0->tm[tmu0]->startAddr;
- fxMesa->TexSource[tmu0].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu0].Info = &(ti0->info);
-
- fxMesa->TexSource[tmu1].StartAddress = ti1->tm[tmu1]->startAddr;
- fxMesa->TexSource[tmu1].EvenOdd = GR_MIPMAPLEVELMASK_BOTH;
- fxMesa->TexSource[tmu1].Info = &(ti1->info);
- }
- }
-
-
- fxMesa->dirty |= TDFX_UPLOAD_TEXTURE_SOURCE;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.h
deleted file mode 100644
index 234ed4439..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_texstate.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texstate.h,v 1.1 2002/02/22 21:45:04 dawes Exp $ */
-
-/*
- * Original rewrite:
- * Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
- *
- * Authors:
- * Gareth Hughes <gareth@valinux.com>
- * Brian Paul <brianp@valinux.com>
- *
- */
-
-#ifndef __TDFX_TEXSTATE_H__
-#define __TDFX_TEXSTATE_H__
-
-extern void tdfxUpdateTextureState( GLcontext *ctx );
-extern void tdfxUpdateTextureBinding( GLcontext *ctx );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.c
deleted file mode 100644
index ac8daf474..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.c
+++ /dev/null
@@ -1,1293 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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.
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.c,v 1.4 2002/10/30 12:52:01 alanh Exp $ */
-
-/* New fixes:
- * Daniel Borca <dborca@users.sourceforge.net>, 19 Jul 2004
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "tdfx_tris.h"
-#include "tdfx_state.h"
-#include "tdfx_vb.h"
-#include "tdfx_lock.h"
-#include "tdfx_render.h"
-
-
-static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim );
-static void tdfxRenderPrimitive( 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_triangle( fxMesa, a, b, c ); \
- else \
- fxMesa->Glide.grDrawTriangle( a, b, c ); \
-} while (0) \
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- fxMesa->draw_triangle( fxMesa, a, b, d ); \
- fxMesa->draw_triangle( fxMesa, b, c, d ); \
- } else { \
- tdfxVertex *_v_[4]; \
- _v_[0] = d; \
- _v_[1] = a; \
- _v_[2] = b; \
- _v_[3] = c; \
- fxMesa->Glide.grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);\
- /*fxMesa->Glide.grDrawTriangle( a, b, d );*/\
- /*fxMesa->Glide.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; \
- fxMesa->Glide.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; \
- fxMesa->Glide.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
-tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (fxMesa->vertexFormat == TDFX_LAYOUT_TINY) {
- dst->win[0] = src->x - fxMesa->x_offset;
- dst->win[1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
- dst->win[2] = src->z;
- dst->win[3] = 1.0;
-
- dst->color[0] = src->color[2];
- dst->color[1] = src->color[1];
- dst->color[2] = src->color[0];
- dst->color[3] = src->color[3];
- }
- else {
- GLfloat w = 1.0 / src->rhw;
-
- dst->win[0] = src->x - fxMesa->x_offset;
- dst->win[1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
- dst->win[2] = src->z;
- dst->win[3] = src->rhw;
-
- dst->color[0] = src->color[2];
- dst->color[1] = src->color[1];
- dst->color[2] = src->color[0];
- dst->color[3] = src->color[3];
-
- dst->texcoord[0][0] = 1.0 / fxMesa->sScale0 * w * src->tu0;
- dst->texcoord[0][1] = 1.0 / fxMesa->tScale0 * w * src->tv0;
- if (fxMesa->vertexFormat == TDFX_LAYOUT_PROJ1 || fxMesa->vertexFormat == TDFX_LAYOUT_PROJ2) {
- dst->texcoord[0][3] = w * src->tq0;
- } else {
- dst->texcoord[0][3] = 1.0;
- }
-
- if (fxMesa->SetupIndex & TDFX_TEX1_BIT) {
- dst->texcoord[1][0] = 1.0 / fxMesa->sScale1 * w * src->tu1;
- dst->texcoord[1][1] = 1.0 / fxMesa->tScale1 * w * src->tv1;
- if (fxMesa->vertexFormat == TDFX_LAYOUT_PROJ2) {
- dst->texcoord[1][3] = w * src->tq1;
- } else {
- dst->texcoord[1][3] = 1.0;
- }
- }
- }
-
- dst->pointSize = ctx->Point._Size;
-}
-
-
-static void
-tdfx_fallback_tri( tdfxContextPtr fxMesa,
- tdfxVertex *v0,
- tdfxVertex *v1,
- tdfxVertex *v2 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[3];
- tdfx_translate_vertex( ctx, v0, &v[0] );
- tdfx_translate_vertex( ctx, v1, &v[1] );
- tdfx_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-
-static void
-tdfx_fallback_line( tdfxContextPtr fxMesa,
- tdfxVertex *v0,
- tdfxVertex *v1 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[2];
- tdfx_translate_vertex( ctx, v0, &v[0] );
- tdfx_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-tdfx_fallback_point( tdfxContextPtr fxMesa,
- tdfxVertex *v0 )
-{
- GLcontext *ctx = fxMesa->glCtx;
- SWvertex v[1];
- tdfx_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-/***********************************************************************
- * Functions to draw basic primitives *
- ***********************************************************************/
-
-static void tdfx_print_vertex( GLcontext *ctx, const tdfxVertex *v )
-{
- tdfxContextPtr tmesa = TDFX_CONTEXT( ctx );
-
- fprintf(stderr, "vertex at %p\n", (void *)v);
-
- if (tmesa->vertexFormat == TDFX_LAYOUT_TINY) {
- fprintf(stderr, "x %f y %f z %f\n", v->x, v->y, v->z);
- }
- else {
- fprintf(stderr, "x %f y %f z %f oow %f\n",
- v->x, v->y, v->z, v->rhw);
- }
- fprintf(stderr, "r %d g %d b %d a %d\n",
- v->color[0],
- v->color[1],
- v->color[2],
- v->color[3]);
-
- 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 tdfx_draw_triangle( tdfxContextPtr fxMesa,
- tdfxVertexPtr v0,
- tdfxVertexPtr v1,
- tdfxVertexPtr v2 )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-/* tdfx_print_vertex( fxMesa->glCtx, v0 ); */
-/* tdfx_print_vertex( fxMesa->glCtx, v1 ); */
-/* tdfx_print_vertex( fxMesa->glCtx, v2 ); */
- BEGIN_CLIP_LOOP_LOCKED(fxMesa) {
- TRI( v0, v1, v2 );
- } END_CLIP_LOOP_LOCKED(fxMesa);
-}
-
-static void tdfx_draw_line( tdfxContextPtr fxMesa,
- tdfxVertexPtr v0,
- tdfxVertexPtr v1 )
-{
- /* No support for wide lines (avoid wide/aa line fallback).
- */
- BEGIN_CLIP_LOOP_LOCKED(fxMesa) {
- LINE(v0, v1);
- } END_CLIP_LOOP_LOCKED(fxMesa);
-}
-
-static void tdfx_draw_point( tdfxContextPtr fxMesa,
- tdfxVertexPtr v0 )
-{
- /* No support for wide points.
- */
- BEGIN_CLIP_LOOP_LOCKED(fxMesa) {
- POINT( v0 );
- } END_CLIP_LOOP_LOCKED(fxMesa);
-}
-
-#undef DO_FALLBACK
-
-
-#define TDFX_UNFILLED_BIT 0x1
-#define TDFX_OFFSET_BIT 0x2
-#define TDFX_TWOSIDE_BIT 0x4
-#define TDFX_FLAT_BIT 0x8
-#define TDFX_FALLBACK_BIT 0x10
-#define TDFX_MAX_TRIFUNC 0x20
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[TDFX_MAX_TRIFUNC];
-
-#define DO_FALLBACK (IND & TDFX_FALLBACK_BIT)
-#define DO_OFFSET (IND & TDFX_OFFSET_BIT)
-#define DO_UNFILLED (IND & TDFX_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & TDFX_TWOSIDE_BIT)
-#define DO_FLAT (IND & TDFX_FLAT_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 0
-#define HAVE_HW_FLATSHADE 0
-#define HAVE_BACK_COLORS 0
-#define VERTEX tdfxVertex
-#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->z
-#define AREA_IS_CCW( a ) (a < 0)
-#define GET_VERTEX(e) (fxMesa->verts + (e))
-
-#define VERT_SET_RGBA( dst, f ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE(dst->color[2], f[0]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->color[1], f[1]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->color[0], f[2]);\
- UNCLAMPED_FLOAT_TO_UBYTE(dst->color[3], f[3]);\
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) \
- *(GLuint *)&v0->color = *(GLuint *)&v1->color
-
-#define VERT_SAVE_RGBA( idx ) \
- *(GLuint *)&color[idx] = *(GLuint *)&v[idx]->color
-
-#define VERT_RESTORE_RGBA( idx ) \
- *(GLuint *)&v[idx]->color = *(GLuint *)&color[idx]
-
-#define LOCAL_VARS(n) \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- GLubyte color[n][4]; \
- (void) color;
-
-
-
-/***********************************************************************
- * Functions to draw basic unfilled primitives *
- ***********************************************************************/
-
-#define RASTERIZE(x) if (fxMesa->raster_primitive != reduced_prim[x]) \
- tdfxRasterPrimitive( ctx, reduced_prim[x] )
-#define RENDER_PRIMITIVE fxMesa->render_primitive
-#define IND TDFX_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 (TDFX_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT| \
- TDFX_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* Tdfx doesn't support provoking-vertex flat-shading?
- */
-#define IND (TDFX_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_offset_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_UNFILLED_BIT|TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback_flat
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TDFX_TWOSIDE_BIT|TDFX_OFFSET_BIT|TDFX_UNFILLED_BIT| \
- TDFX_FALLBACK_BIT|TDFX_FLAT_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback_flat
-#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();
- 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();
-}
-
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-
-/* Accelerate vertex buffer rendering when renderindex == 0 and
- * there is no clipping.
- */
-#define INIT(x) tdfxRenderPrimitive( ctx, x )
-
-static void tdfx_render_vb_points( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- GLint i;
- (void) flags;
-
- 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;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_POINTS, count-start,
- fxVB + start, sizeof(tdfxVertex));
- /* 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 tdfx_render_vb_line_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- GLint i;
- (void) flags;
-
- 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;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start,
- fxVB + start, sizeof(tdfxVertex) );
-
- /* 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 tdfx_render_vb_line_loop( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- GLint i;
- GLint j = start;
- (void) flags;
-
- 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;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINE_STRIP, count-j,
- fxVB + j, sizeof(tdfxVertex));
-
- if (flags & PRIM_END)
- fxMesa->Glide.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 tdfx_render_vb_lines( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- GLint i;
- (void) flags;
-
- 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;
- }
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_LINES, count-start,
- fxVB + start, sizeof(tdfxVertex));
-
- /* 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 tdfx_render_vb_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- INIT(GL_TRIANGLES);
-
-#if 0
- /* [dBorca]
- * apparently, this causes troubles with some programs (GLExcess);
- * might be a bug in Glide... However, "grDrawVertexArrayContiguous"
- * eventually calls "grDrawTriangle" for GR_TRIANGLES, so we're better
- * off doing it by hand...
- */
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLES, count-start,
- fxVB + start, sizeof(tdfxVertex));
-#else
- {
- GLuint j;
- for (j=start+2; j<count; j+=3) {
- fxMesa->Glide.grDrawTriangle(fxVB + (j-2), fxVB + (j-1), fxVB + j);
- }
- }
-#endif
-}
-
-
-static void tdfx_render_vb_tri_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- int mode;
- (void) flags;
-
- INIT(GL_TRIANGLE_STRIP);
-
-/* fprintf(stderr, "%s/%d\n", __FUNCTION__, 1<<shift); */
-/* if(!prevLockLine) abort(); */
-
- mode = GR_TRIANGLE_STRIP;
-
- fxMesa->Glide.grDrawVertexArrayContiguous( mode, count-start,
- fxVB + start, sizeof(tdfxVertex));
-}
-
-
-static void tdfx_render_vb_tri_fan( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- INIT(GL_TRIANGLE_FAN);
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start,
- fxVB + start, sizeof(tdfxVertex) );
-}
-
-static void tdfx_render_vb_quads( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- GLuint i;
- (void) flags;
-
- INIT(GL_QUADS);
-
- for (i = start + 3 ; i < count ; i += 4 ) {
-#define VERT(x) (fxVB + (x))
- tdfxVertex *_v_[4];
- _v_[0] = VERT(i);
- _v_[1] = VERT(i-3);
- _v_[2] = VERT(i-2);
- _v_[3] = VERT(i-1);
- fxMesa->Glide.grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);
- /*fxMesa->Glide.grDrawTriangle( VERT(i-3), VERT(i-2), VERT(i) );*/
- /*fxMesa->Glide.grDrawTriangle( VERT(i-2), VERT(i-1), VERT(i) );*/
-#undef VERT
- }
-}
-
-static void tdfx_render_vb_quad_strip( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- INIT(GL_QUAD_STRIP);
-
- count -= (count-start)&1;
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP,
- count-start, fxVB + start, sizeof(tdfxVertex));
-}
-
-static void tdfx_render_vb_poly( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- tdfxVertex *fxVB = fxMesa->verts;
- (void) flags;
-
- INIT(GL_POLYGON);
-
- fxMesa->Glide.grDrawVertexArrayContiguous( GR_POLYGON, count-start,
- fxVB + start, sizeof(tdfxVertex));
-}
-
-static void tdfx_render_vb_noop( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- (void) (ctx && start && count && flags);
-}
-
-static void (*tdfx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
- GLuint,
- GLuint,
- GLuint) =
-{
- tdfx_render_vb_points,
- tdfx_render_vb_lines,
- tdfx_render_vb_line_loop,
- tdfx_render_vb_line_strip,
- tdfx_render_vb_triangles,
- tdfx_render_vb_tri_strip,
- tdfx_render_vb_tri_fan,
- tdfx_render_vb_quads,
- tdfx_render_vb_quad_strip,
- tdfx_render_vb_poly,
- tdfx_render_vb_noop,
-};
-#undef INIT
-
-
-/**********************************************************************/
-/* Render whole (indexed) begin/end objects */
-/**********************************************************************/
-
-
-#define VERT(x) (tdfxVertex *)(vertptr + (x))
-
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- fxMesa->Glide.grDrawPoint( VERT(ELT(start)) );
-
-#define RENDER_LINE( v0, v1 ) \
- fxMesa->Glide.grDrawLine( VERT(v0), VERT(v1) )
-
-#define RENDER_TRI( v0, v1, v2 ) \
- fxMesa->Glide.grDrawTriangle( VERT(v0), VERT(v1), VERT(v2) )
-
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- do { \
- tdfxVertex *_v_[4]; \
- _v_[0] = VERT(v3); \
- _v_[1] = VERT(v0); \
- _v_[2] = VERT(v1); \
- _v_[3] = VERT(v2); \
- fxMesa->Glide.grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);\
- /*fxMesa->Glide.grDrawTriangle( VERT(v0), VERT(v1), VERT(v3) );*/\
- /*fxMesa->Glide.grDrawTriangle( VERT(v1), VERT(v2), VERT(v3) );*/\
- } while (0)
-
-#define INIT(x) tdfxRenderPrimitive( ctx, x )
-
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); \
- tdfxVertex *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) tdfx_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl_dd/t_dd_rendertmp.h"
-
-/* Verts, no clipping.
- */
-#undef ELT
-#undef TAG
-#define TAG(x) tdfx_##x##_verts
-#define ELT(x) x
-/*#include "tnl_dd/t_dd_rendertmp.h"*/
-
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void tdfxRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- tdfxContextPtr fxMesa = TDFX_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 tdfxRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void tdfxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- int i;
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- tdfxVertex *vertptr = fxMesa->verts;
- if (n == 3) {
- fxMesa->Glide.grDrawTriangle( VERT(elts[0]), VERT(elts[1]), VERT(elts[2]) );
- } else if (n <= 32) {
- tdfxVertex *newvptr[32];
- for (i = 0 ; i < n ; i++) {
- newvptr[i] = VERT(elts[i]);
- }
- fxMesa->Glide.grDrawVertexArray(GR_TRIANGLE_FAN, n, newvptr);
- } else {
- const tdfxVertex *start = VERT(elts[0]);
- for (i = 2 ; i < n ; i++) {
- fxMesa->Glide.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)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|DD_TRI_STIPPLE)
-#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET| \
- DD_TRI_UNFILLED)
-
-
-/* All state referenced below:
- */
-#define _TDFX_NEW_RENDERSTATE (_DD_NEW_POINT_SMOOTH | \
- _DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_FLATSHADE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-
-static void tdfxChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (0) {
- fxMesa->draw_point = tdfx_draw_point;
- fxMesa->draw_line = tdfx_draw_line;
- fxMesa->draw_triangle = tdfx_draw_triangle;
- index |= TDFX_FALLBACK_BIT;
- }
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= TDFX_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= TDFX_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= TDFX_UNFILLED_BIT;
- if (flags & DD_FLATSHADE) index |= TDFX_FLAT_BIT;
- }
-
- fxMesa->draw_point = tdfx_draw_point;
- fxMesa->draw_line = tdfx_draw_line;
- fxMesa->draw_triangle = tdfx_draw_triangle;
-
- /* Hook in fallbacks for specific primitives.
- *
- * DD_TRI_UNFILLED is here because the unfilled_tri functions use
- * fxMesa->draw_tri *always*, and thus can't use the multipass
- * approach to cliprects.
- *
- */
- if (flags & (POINT_FALLBACK|
- LINE_FALLBACK|
- TRI_FALLBACK|
- DD_TRI_STIPPLE|
- DD_TRI_UNFILLED))
- {
- if (flags & POINT_FALLBACK)
- fxMesa->draw_point = tdfx_fallback_point;
-
- if (flags & LINE_FALLBACK)
- fxMesa->draw_line = tdfx_fallback_line;
-
- if (flags & TRI_FALLBACK)
- fxMesa->draw_triangle = tdfx_fallback_tri;
-
- if ((flags & DD_TRI_STIPPLE) && !fxMesa->haveHwStipple)
- fxMesa->draw_triangle = tdfx_fallback_tri;
-
- index |= TDFX_FALLBACK_BIT;
- }
- }
-
- if (fxMesa->RenderIndex != index) {
- fxMesa->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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = tdfx_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = tdfx_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = tdfxFastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = tdfxRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = tdfxRenderClippedPoly;
- }
- }
-}
-
-/**********************************************************************/
-/* Use multipass rendering for cliprects */
-/**********************************************************************/
-
-
-
-/* TODO: Benchmark this.
- * TODO: Use single back-buffer cliprect where possible.
- * NOTE: <pass> starts at 1, not zero!
- */
-static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- if (pass >= fxMesa->numClipRects)
- return GL_FALSE;
- else {
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[pass].x1,
- fxMesa->screen_height - fxMesa->pClipRects[pass].y2,
- fxMesa->pClipRects[pass].x2,
- fxMesa->screen_height - fxMesa->pClipRects[pass].y1);
-
- return GL_TRUE;
- }
-}
-
-
-/**********************************************************************/
-/* Runtime render state and callbacks */
-/**********************************************************************/
-
-static void tdfxRunPipeline( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (fxMesa->new_state) {
- tdfxDDUpdateHwState( ctx );
- }
-
- if (!fxMesa->Fallback && fxMesa->new_gl_state) {
- if (fxMesa->new_gl_state & _TDFX_NEW_RASTERSETUP)
- tdfxChooseVertexState( ctx );
-
- if (fxMesa->new_gl_state & _TDFX_NEW_RENDERSTATE)
- tdfxChooseRenderState( ctx );
-
- fxMesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-
-static void tdfxRenderStart( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- tdfxCheckTexSizes( ctx );
-
- LOCK_HARDWARE(fxMesa);
-
- /* Make sure vertex format changes get uploaded before we start
- * sending triangles.
- */
- if (fxMesa->dirty) {
- tdfxEmitHwStateLocked( fxMesa );
- }
-
- if (fxMesa->numClipRects && !(fxMesa->RenderIndex & TDFX_FALLBACK_BIT)) {
- fxMesa->Glide.grClipWindow(fxMesa->pClipRects[0].x1,
- fxMesa->screen_height - fxMesa->pClipRects[0].y2,
- fxMesa->pClipRects[0].x2,
- fxMesa->screen_height - fxMesa->pClipRects[0].y1);
- if (fxMesa->numClipRects > 1)
- tnl->Driver.Render.Multipass = multipass_cliprect;
- else
- tnl->Driver.Render.Multipass = NULL;
- }
- else
- tnl->Driver.Render.Multipass = NULL;
-}
-
-
-
-/* Always called between RenderStart and RenderFinish --> We already
- * hold the lock.
- */
-static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- FLUSH_BATCH( fxMesa );
-
- fxMesa->raster_primitive = prim;
-
- tdfxUpdateCull(ctx);
- if ( fxMesa->dirty & TDFX_UPLOAD_CULL ) {
- fxMesa->Glide.grCullMode( fxMesa->CullMode );
- fxMesa->dirty &= ~TDFX_UPLOAD_CULL;
- }
-
- tdfxUpdateStipple(ctx);
- if ( fxMesa->dirty & TDFX_UPLOAD_STIPPLE ) {
- fxMesa->Glide.grStipplePattern ( fxMesa->Stipple.Pattern );
- fxMesa->Glide.grStippleMode ( fxMesa->Stipple.Mode );
- fxMesa->dirty &= ~TDFX_UPLOAD_STIPPLE;
- }
-}
-
-
-
-/* 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 tdfx_render.c.
- */
-static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- tdfxContextPtr fxMesa = TDFX_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) {
- tdfxRasterPrimitive( ctx, rprim );
- }
-}
-
-static void tdfxRenderFinish( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
-
- if (fxMesa->RenderIndex & TDFX_FALLBACK_BIT)
- _swrast_flush( ctx );
-
- UNLOCK_HARDWARE(fxMesa);
-}
-
-
-/**********************************************************************/
-/* 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",
- "line stipple",
- "Rasterization disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint oldfallback = fxMesa->Fallback;
-
- if (mode) {
- fxMesa->Fallback |= bit;
- if (oldfallback == 0) {
- /*printf("Go to software rendering, bit = 0x%x\n", bit);*/
- FLUSH_BATCH(fxMesa);
- _swsetup_Wakeup( ctx );
- fxMesa->RenderIndex = ~0;
- if (TDFX_DEBUG & DEBUG_VERBOSE_FALL) {
- fprintf(stderr, "Tdfx begin software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
- else {
- fxMesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- /*printf("Go to hardware rendering, bit = 0x%x\n", bit);*/
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = tdfxRenderStart;
- tnl->Driver.Render.PrimitiveNotify = tdfxRenderPrimitive;
- tnl->Driver.Render.Finish = tdfxRenderFinish;
- tnl->Driver.Render.BuildVertices = tdfxBuildVertices;
- fxMesa->new_gl_state |= (_TDFX_NEW_RENDERSTATE|
- _TDFX_NEW_RASTERSETUP);
- if (TDFX_DEBUG & DEBUG_VERBOSE_FALL) {
- fprintf(stderr, "Tdfx end software fallback: 0x%x %s\n",
- bit, getFallbackString(bit));
- }
- }
- }
-}
-
-
-void tdfxDDInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- fxMesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = tdfxRunPipeline;
- tnl->Driver.Render.Start = tdfxRenderStart;
- tnl->Driver.Render.Finish = tdfxRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = tdfxRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = tdfxBuildVertices;
- tnl->Driver.Render.Multipass = NULL;
-
- (void) tdfx_print_vertex;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.h
deleted file mode 100644
index 57e5d9b0a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_tris.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- mode: c; c-basic-offset: 3 -*-
- *
- * 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 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>
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_tris.h,v 1.5 2002/10/30 12:52:01 alanh Exp $ */
-
-#ifndef TDFX_TRIS_INC
-#define TDFX_TRIS_INC
-
-#include "mtypes.h"
-
-extern void tdfxDDInitTriFuncs( GLcontext *ctx );
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.c
deleted file mode 100644
index 0580135d1..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel i810
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.c,v 1.3 2002/10/30 12:52:01 alanh Exp $ */
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "math/m_translate.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tdfx_context.h"
-#include "tdfx_vb.h"
-#include "tdfx_tris.h"
-#include "tdfx_state.h"
-#include "tdfx_render.h"
-
-static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- tdfxVertex *dst = fxMesa->verts + edst;
- tdfxVertex *src = fxMesa->verts + esrc;
- *(GLuint *)&dst->color = *(GLuint *)&src->color;
-}
-
-static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void * );
- tnl_interp_func interp;
- tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
- GLuint vertex_format;
-} setup_tab[TDFX_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;
-
- /*fprintf(stderr, "%s\n", __FUNCTION__);*/
-
- if (VB->ColorPtr[1]) {
- INTERP_4F( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
- }
-
- if (VB->EdgeFlag) {
- VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
- }
-
- setup_tab[TDFX_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->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
- }
-
- setup_tab[TDFX_CONTEXT(ctx)->SetupIndex].copy_pv(ctx, dst, src);
-}
-
-
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tdfx_vbtmp.h"
-
-/* Special for tdfx: fog requires w
- */
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT)
-#define TAG(x) x##_wg_fog
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT|\
- TDFX_PTEX_BIT)
-#define TAG(x) x##_wgpt0t1
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_TEX0_BIT|TDFX_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_RGBA_BIT|TDFX_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_RGBA_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tdfx_vbtmp.h"
-
-
-/* fogc { */
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_FOGC_BIT)
-#define TAG(x) x##_wgf
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_FOGC_BIT)
-#define TAG(x) x##_wgt0f
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT|TDFX_FOGC_BIT)
-#define TAG(x) x##_wgt0t1f
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_PTEX_BIT|TDFX_FOGC_BIT)
-#define TAG(x) x##_wgpt0f
-#include "tdfx_vbtmp.h"
-
-#define IND (TDFX_XYZ_BIT|TDFX_RGBA_BIT|TDFX_W_BIT|TDFX_TEX0_BIT|TDFX_TEX1_BIT|\
- TDFX_PTEX_BIT|TDFX_FOGC_BIT)
-#define TAG(x) x##_wgpt0t1f
-#include "tdfx_vbtmp.h"
-/* fogc } */
-
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wg_fog();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgpt0t1();
-
- init_g();
- init_t0();
- init_t0t1();
- init_gt0();
- init_gt0t1();
-
- /* fogcoord */
- init_wgf();
- init_wgt0f();
- init_wgt0t1f();
- init_wgpt0f();
- init_wgpt0t1f();
-}
-
-
-void tdfxPrintSetupFlags(char *msg, GLuint flags )
-{
- fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
- msg,
- (int)flags,
- (flags & TDFX_XYZ_BIT) ? " xyz," : "",
- (flags & TDFX_W_BIT) ? " w," : "",
- (flags & TDFX_RGBA_BIT) ? " rgba," : "",
- (flags & TDFX_TEX0_BIT) ? " tex-0," : "",
- (flags & TDFX_TEX1_BIT) ? " tex-1," : "",
- (flags & TDFX_FOGC_BIT) ? " fogc," : "");
-}
-
-
-
-void tdfxCheckTexSizes( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-
- if (!setup_tab[fxMesa->SetupIndex].check_tex_sizes(ctx)) {
- GLuint ind = fxMesa->SetupIndex |= (TDFX_PTEX_BIT|TDFX_RGBA_BIT);
-
- /* Tdfx handles projective textures nicely; just have to change
- * up to the new vertex format.
- */
- if (setup_tab[ind].vertex_format != fxMesa->vertexFormat) {
- FLUSH_BATCH(fxMesa);
- fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT;
- fxMesa->vertexFormat = setup_tab[ind].vertex_format;
-
- /* This is required as we have just changed the vertex
- * format, so the interp and copy routines must also change.
- * In the unfilled and twosided cases we are using the
- * swrast_setup 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;
- tnl->Driver.Render.CopyPV = setup_tab[fxMesa->SetupIndex].copy_pv;
- }
- }
- }
-}
-
-
-void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end,
- GLuint newinputs )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- tdfxVertex *v = fxMesa->verts + start;
-
- newinputs |= fxMesa->SetupNewInputs;
- fxMesa->SetupNewInputs = 0;
-
- 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 |= TDFX_RGBA_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= TDFX_FOGC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= TDFX_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= TDFX_TEX0_BIT|TDFX_TEX1_BIT;
-
- if (fxMesa->SetupIndex & TDFX_PTEX_BIT)
- ind = ~0;
-
- ind &= fxMesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, end, v );
- }
- }
-}
-
-
-void tdfxChooseVertexState( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
- GLuint ind = TDFX_XYZ_BIT|TDFX_RGBA_BIT;
-
- fxMesa->tmu_source[0] = 0;
- fxMesa->tmu_source[1] = 1;
-
- if (ctx->Texture._EnabledUnits & 0x2) {
- if (ctx->Texture._EnabledUnits & 0x1) {
- ind |= TDFX_TEX1_BIT;
- }
- ind |= TDFX_W_BIT|TDFX_TEX0_BIT;
- fxMesa->tmu_source[0] = 1;
- fxMesa->tmu_source[1] = 0;
- } else if (ctx->Texture._EnabledUnits & 0x1) {
- /* unit 0 enabled */
- ind |= TDFX_W_BIT|TDFX_TEX0_BIT;
- } else if (fxMesa->Fog.Mode != GR_FOG_DISABLE) {
- ind |= TDFX_W_BIT;
- }
-
- if (fxMesa->Fog.Mode == GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT) {
- ind |= TDFX_FOGC_BIT;
- }
-
- 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->vertexFormat) {
- FLUSH_BATCH(fxMesa);
- fxMesa->dirty |= TDFX_UPLOAD_VERTEX_LAYOUT;
- fxMesa->vertexFormat = setup_tab[ind].vertex_format;
- }
-}
-
-
-
-void tdfxInitVB( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
-
- fxMesa->verts = ALIGN_MALLOC(size * sizeof(tdfxVertex), 32);
- fxMesa->vertexFormat = TDFX_LAYOUT_TINY;
- fxMesa->SetupIndex = TDFX_XYZ_BIT|TDFX_RGBA_BIT;
-}
-
-
-void tdfxFreeVB( GLcontext *ctx )
-{
- tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
- if (fxMesa->verts) {
- ALIGN_FREE(fxMesa->verts);
- fxMesa->verts = 0;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.h
deleted file mode 100644
index 7b7cd9065..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vb.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * GLX Hardware Device Driver for Intel tdfx
- * Copyright (C) 1999 Keith Whitwell
- *
- * 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.
- *
- *
- */
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_vb.h,v 1.2 2002/02/22 21:45:04 dawes Exp $ */
-
-#ifndef TDFXVB_INC
-#define TDFXVB_INC
-
-#include "mtypes.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "math/m_xform.h"
-
-#define TDFX_XYZ_BIT 0x1
-#define TDFX_W_BIT 0x2
-#define TDFX_RGBA_BIT 0x4
-#define TDFX_TEX1_BIT 0x8
-#define TDFX_TEX0_BIT 0x10
-#define TDFX_PTEX_BIT 0x20
-#define TDFX_FOGC_BIT 0x40
-#define TDFX_MAX_SETUP 0x80
-
-#define _TDFX_NEW_RASTERSETUP (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-
-extern void tdfxValidateBuildProjVerts(GLcontext *ctx,
- GLuint start, GLuint count,
- GLuint newinputs );
-
-extern void tdfxPrintSetupFlags(char *msg, GLuint flags );
-
-extern void tdfxInitVB( GLcontext *ctx );
-
-extern void tdfxFreeVB( GLcontext *ctx );
-
-extern void tdfxCheckTexSizes( GLcontext *ctx );
-
-extern void tdfxChooseVertexState( GLcontext *ctx );
-
-extern void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end,
- GLuint newinputs );
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
deleted file mode 100644
index 9b780761f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h
+++ /dev/null
@@ -1,266 +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 )
-{
- tdfxContextPtr fxMesa = TDFX_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];
- GLuint tc0_stride, tc1_stride, col_stride;
- GLuint tc0_size, tc1_size, col_size;
- GLfloat (*proj)[4] = VB->NdcPtr->data;
- GLuint proj_stride = VB->NdcPtr->stride;
- GLfloat (*fog)[4];
- GLuint fog_stride;
- tdfxVertex *v = (tdfxVertex *)dest;
- GLfloat u0scale,v0scale,u1scale,v1scale;
- const GLubyte *mask = VB->ClipMask;
- const GLfloat *s = fxMesa->hw_viewport;
- int i;
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (IND & TDFX_TEX0_BIT) {
- tc0_stride = VB->TexCoordPtr[tmu0_source]->stride;
- tc0 = VB->TexCoordPtr[tmu0_source]->data;
- u0scale = fxMesa->sScale0;
- v0scale = fxMesa->tScale0;
- if (IND & TDFX_PTEX_BIT)
- tc0_size = VB->TexCoordPtr[tmu0_source]->size;
- }
-
- if (IND & TDFX_TEX1_BIT) {
- tc1 = VB->TexCoordPtr[tmu1_source]->data;
- tc1_stride = VB->TexCoordPtr[tmu1_source]->stride;
- u1scale = fxMesa->sScale1;
- v1scale = fxMesa->tScale1;
- if (IND & TDFX_PTEX_BIT)
- tc1_size = VB->TexCoordPtr[tmu1_source]->size;
- }
-
- if (IND & TDFX_RGBA_BIT) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
- col_size = VB->ColorPtr[0]->size;
- }
-
- if (IND & TDFX_FOGC_BIT) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->stride;
- }
-
- {
- /* May have nonstandard strides:
- */
- if (start) {
- proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride);
- if (IND & TDFX_TEX0_BIT)
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (IND & TDFX_TEX1_BIT)
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (IND & TDFX_RGBA_BIT)
- STRIDE_4F(col, start * col_stride);
- if (IND & TDFX_FOGC_BIT)
- STRIDE_4F(fog, start * fog_stride);
- }
-
- for (i=start; i < end; i++, v++) {
- if (IND & TDFX_XYZ_BIT) {
- if (mask[i] == 0) {
- /* unclipped */
- VIEWPORT_X(v->x, proj[0][0]);
- VIEWPORT_Y(v->y, proj[0][1]);
- VIEWPORT_Z(v->z, proj[0][2]);
- v->rhw = proj[0][3];
- } else {
- /* clipped */
- v->rhw = 1.0;
- }
- proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
- }
- if (IND & TDFX_RGBA_BIT) {
- UNCLAMPED_FLOAT_TO_UBYTE(v->color[0], col[0][2]);
- UNCLAMPED_FLOAT_TO_UBYTE(v->color[1], col[0][1]);
- UNCLAMPED_FLOAT_TO_UBYTE(v->color[2], col[0][0]);
- if (col_size == 4) {
- UNCLAMPED_FLOAT_TO_UBYTE(v->color[3], col[0][3]);
- } else {
- v->color[3] = 255;
- }
- STRIDE_4F(col, col_stride);
- }
- if (IND & TDFX_FOGC_BIT) {
- v->fog = CLAMP(fog[0][0], 0.0f, 1.0f);
- STRIDE_4F(fog, fog_stride);
- }
- if (IND & TDFX_TEX0_BIT) {
- GLfloat w = v->rhw;
- v->tu0 = tc0[0][0] * u0scale * w;
- v->tv0 = tc0[0][1] * v0scale * w;
- if (IND & TDFX_PTEX_BIT) {
- v->tq0 = w;
- if (tc0_size == 4)
- v->tq0 = tc0[0][3] * w;
- }
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- }
- if (IND & TDFX_TEX1_BIT) {
- GLfloat w = v->rhw;
- v->tu1 = tc1[0][0] * u1scale * w;
- v->tv1 = tc1[0][1] * v1scale * w;
- if (IND & TDFX_PTEX_BIT) {
- v->tq1 = w;
- if (tc1_size == 4)
- v->tq1 = tc1[0][3] * w;
- }
- tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + tc1_stride);
- }
- }
- }
-}
-
-
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (IND & TDFX_PTEX_BIT)
- return GL_TRUE;
-
- if (IND & TDFX_TEX0_BIT) {
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- if (IND & TDFX_TEX1_BIT) {
- if (VB->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
-
- if (VB->TexCoordPtr[1]->size == 4)
- return GL_FALSE;
- }
-
- if (VB->TexCoordPtr[0]->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 )
-{
- tdfxContextPtr fxMesa = TDFX_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 *s = fxMesa->hw_viewport;
- tdfxVertex *dst = fxMesa->verts + edst;
- const tdfxVertex *out = fxMesa->verts + eout;
- const tdfxVertex *in = fxMesa->verts + ein;
- const GLfloat wout = oow / out->rhw;
- const GLfloat win = oow / in->rhw;
-
- VIEWPORT_X(dst->x, dstclip[0] * oow);
- VIEWPORT_Y(dst->y, dstclip[1] * oow);
- VIEWPORT_Z(dst->z, dstclip[2] * oow);
- dst->rhw = oow;
-
- INTERP_UB( t, dst->color[0], out->color[0], in->color[0] );
- INTERP_UB( t, dst->color[1], out->color[1], in->color[1] );
- INTERP_UB( t, dst->color[2], out->color[2], in->color[2] );
- INTERP_UB( t, dst->color[3], out->color[3], in->color[3] );
-
- if (IND & TDFX_FOGC_BIT) {
- INTERP_F( t, dst->fog, out->fog, in->fog );
- }
-
- if (IND & TDFX_TEX0_BIT) {
- INTERP_F( t, dst->tu0, out->tu0 * wout, in->tu0 * win );
- INTERP_F( t, dst->tv0, out->tv0 * wout, in->tv0 * win );
- if (IND & TDFX_PTEX_BIT) {
- INTERP_F( t, dst->tq0, out->tq0 * wout, in->tq0 * win );
- }
- }
- if (IND & TDFX_TEX1_BIT) {
- INTERP_F( t, dst->tu1, out->tu1 * wout, in->tu1 * win );
- INTERP_F( t, dst->tv1, out->tv1 * wout, in->tv1 * win );
- if (IND & TDFX_PTEX_BIT) {
- INTERP_F( t, dst->tq1, out->tq1 * wout, in->tq1 * win );
- }
- }
-}
-
-
-static void TAG(init)( void )
-{
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- setup_tab[IND].emit = TAG(emit);
- setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes);
- setup_tab[IND].interp = TAG(interp);
- setup_tab[IND].copy_pv = copy_pv;
-
- if (IND & TDFX_TEX1_BIT) {
- if (IND & TDFX_PTEX_BIT) {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_PROJ2;
- }
- else {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_MULTI;
- }
- }
- else if (IND & TDFX_TEX0_BIT) {
- if (IND & TDFX_PTEX_BIT) {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_PROJ1;
- } else {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_SINGLE;
- }
- }
- else if (IND & TDFX_W_BIT) {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_NOTEX;
- } else {
- setup_tab[IND].vertex_format = TDFX_LAYOUT_TINY;
- }
-}
-
-
-#undef IND
-#undef TAG
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/Makefile
deleted file mode 100644
index 9ee24c504..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# src/mesa/drivers/dri/trident/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = trident_dri.so
-
-# Not yet
-# MINIGLX_SOURCES = server/trident_dri.c
-
-DRIVER_SOURCES = \
- trident_context.c \
- trident_state.c \
- trident_vb.c \
- trident_dd.c \
- trident_tris.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.c
deleted file mode 100644
index b44c6205c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * 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@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "trident_dri.h"
-#include "trident_context.h"
-#include "trident_lock.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-
-#include "context.h"
-#include "simple_list.h"
-#include "matrix.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-#include "simple_list.h"
-#include "mm.h"
-#include "drirenderbuffer.h"
-
-#include "drivers/common/driverfuncs.h"
-#include "dri_util.h"
-
-static const struct tnl_pipeline_stage *trident_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_render_stage,
- 0,
-};
-
-
-GLboolean tridentCreateContext( const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- tridentContextPtr tmesa;
- tridentScreenPtr tridentscrn;
- struct dd_function_table functions;
-#if 0
- drm_trident_sarea_t *saPriv=(drm_trident_sarea_t *)(((char*)sPriv->pSAREA)+
- sizeof(XF86DRISAREARec));
-#endif
-
- tmesa = (tridentContextPtr) CALLOC( sizeof(*tmesa) );
- if ( !tmesa ) return GL_FALSE;
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((tridentContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- _mesa_init_driver_functions(&functions);
-
- tmesa->glCtx =
- _mesa_create_context(glVisual, shareCtx, &functions, (void *)tmesa);
-
- if (!tmesa->glCtx) {
- FREE(tmesa);
- return GL_FALSE;
- }
-
- tmesa->driContext = driContextPriv;
- tmesa->driScreen = sPriv;
- tmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */
-
- tmesa->hHWContext = driContextPriv->hHWContext;
- tmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock;
- tmesa->driFd = sPriv->fd;
-#if 0
- tmesa->sarea = saPriv;
-#endif
-
- tridentscrn = tmesa->tridentScreen = (tridentScreenPtr)(sPriv->private);
-
- ctx = tmesa->glCtx;
-
- ctx->Const.MaxTextureLevels = 13; /* 4K by 4K? Is that right? */
- ctx->Const.MaxTextureUnits = 1; /* Permedia 3 */
-
- 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;
-
-#if 0
- tmesa->texHeap = mmInit( 0, tmesa->tridentScreen->textureSize );
-
- make_empty_list(&tmesa->TexObjList);
- make_empty_list(&tmesa->SwappedOut);
-
- tmesa->CurrentTexObj[0] = 0;
- tmesa->CurrentTexObj[1] = 0; /* Permedia 3, second texture */
-
- tmesa->RenderIndex = ~0;
-#endif
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, trident_pipeline );
-
- /* Configure swrast to match hardware characteristics:
- */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- tridentInitVB( ctx );
- tridentDDInitExtensions( ctx );
- tridentDDInitDriverFuncs( ctx );
- tridentDDInitStateFuncs( ctx );
-#if 0
- tridentDDInitSpanFuncs( ctx );
- tridentDDInitTextureFuncs( ctx );
-#endif
- tridentDDInitTriFuncs( ctx );
- tridentDDInitState( tmesa );
-
- driContextPriv->driverPrivate = (void *)tmesa;
-
- UNLOCK_HARDWARE(tmesa);
-
- return GL_TRUE;
-}
-
-static void
-tridentDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- tridentContextPtr tmesa = (tridentContextPtr)driContextPriv->driverPrivate;
-
- if (tmesa) {
- _swsetup_DestroyContext( tmesa->glCtx );
- _tnl_DestroyContext( tmesa->glCtx );
- _ac_DestroyContext( tmesa->glCtx );
- _swrast_DestroyContext( tmesa->glCtx );
-
- /* free the Mesa context */
- tmesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(tmesa->glCtx);
-
- _mesa_free(tmesa);
- driContextPriv->driverPrivate = NULL;
- }
-}
-
-
-static GLboolean
-tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- tridentScreenPtr screen = (tridentScreenPtr) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- }
- else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0
- );
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->frontOffset, screen->frontPitch);
- /*
- tridentSetSpanFunctions(frontRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->cpp,
- screen->backOffset, screen->backPitch);
- /*
- tridentSetSpanFunctions(backRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- /*
- tridentSetSpanFunctions(depthRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
- screen->depthOffset, screen->depthPitch);
- /*
- tridentSetSpanFunctions(depthRb, mesaVis);
- */
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- /* no h/w stencil?
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
- tridentSetSpanFunctions(stencilRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
- }
- */
-
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* color */
- GL_FALSE, /* depth */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-static void
-tridentSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
-
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- tridentContextPtr tmesa;
- GLcontext *ctx;
- tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = tmesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- tridentCopyBuffer( dPriv );
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "tridentSwapBuffers: drawable has no context!\n");
- }
-}
-
-static GLboolean
-tridentMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- GET_CURRENT_CONTEXT(ctx);
- tridentContextPtr oldCtx = ctx ? TRIDENT_CONTEXT(ctx) : NULL;
- tridentContextPtr newCtx = (tridentContextPtr) driContextPriv->driverPrivate;
-
- if ( newCtx != oldCtx ) {
- newCtx->dirty = ~0;
- }
-
- if (newCtx->driDrawable != driDrawPriv) {
- newCtx->driDrawable = driDrawPriv;
-#if 0
- tridentUpdateWindow ( newCtx->glCtx );
- tridentUpdateViewportOffset( newCtx->glCtx );
-#endif
- }
-
- newCtx->drawOffset = newCtx->tridentScreen->backOffset;
- newCtx->drawPitch = newCtx->tridentScreen->backPitch;
-
- _mesa_make_current( newCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
-
- if (!newCtx->glCtx->Viewport.Width) {
- _mesa_set_viewport(newCtx->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
- } else {
- _mesa_make_current( NULL, NULL, NULL );
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-tridentUnbindContext( __DRIcontextPrivate *driContextPriv )
-{
- return GL_TRUE;
-}
-
-
-tridentScreenPtr tridentCreateScreen( __DRIscreenPrivate *sPriv )
-{
- TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv;
- tridentScreenPtr tridentScreen;
-
- if (sPriv->devPrivSize != sizeof(TRIDENTDRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(TRIDENTDRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- tridentScreen = (tridentScreenPtr) CALLOC( sizeof(*tridentScreen) );
- if ( !tridentScreen ) return NULL;
-
- tridentScreen->driScreen = sPriv;
-
- tridentScreen->frontOffset = tDRIPriv->frontOffset;
- tridentScreen->backOffset = tDRIPriv->backOffset;
- tridentScreen->depthOffset = tDRIPriv->depthOffset;
- tridentScreen->frontPitch = tDRIPriv->frontPitch;
- tridentScreen->backPitch = tDRIPriv->backPitch;
- tridentScreen->depthPitch = tDRIPriv->depthPitch;
- tridentScreen->width = tDRIPriv->width;
- tridentScreen->height = tDRIPriv->height;
-
-printf("%d %d\n",tridentScreen->width,tridentScreen->height);
-printf("%d %d\n",tridentScreen->frontPitch,tridentScreen->backPitch);
-printf("offset 0x%x 0x%x\n",tridentScreen->backOffset,tridentScreen->depthOffset);
-
- tridentScreen->mmio.handle = tDRIPriv->regs;
- tridentScreen->mmio.size = 0x20000;
-
- if (drmMap(sPriv->fd,
- tridentScreen->mmio.handle, tridentScreen->mmio.size,
- (drmAddressPtr)&tridentScreen->mmio.map)) {
- FREE(tridentScreen);
- return GL_FALSE;
- }
-printf("MAPPED at %p\n", tridentScreen->mmio.map);
-
- return tridentScreen;
-}
-
-/* Destroy the device specific screen private data struct.
- */
-void tridentDestroyScreen( __DRIscreenPrivate *sPriv )
-{
- tridentScreenPtr tridentScreen = (tridentScreenPtr)sPriv->private;
-
- FREE(tridentScreen);
-}
-static GLboolean
-tridentInitDriver(__DRIscreenPrivate *sPriv)
-{
- sPriv->private = (void *) tridentCreateScreen( sPriv );
-
- if (!sPriv->private) {
- tridentDestroyScreen( sPriv );
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec tridentAPI = {
- tridentInitDriver,
- tridentDestroyScreen,
- tridentCreateContext,
- tridentDestroyContext,
- tridentCreateBuffer,
- tridentDestroyBuffer,
- tridentSwapBuffers,
- tridentMakeCurrent,
- tridentUnbindContext,
-};
-
-
-PUBLIC void *__driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 4, 0, 0 };
- static const __DRIversion dri_expected = { 3, 1, 0 };
- static const __DRIversion drm_expected = { 1, 0, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "Trident",
- 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, &tridentAPI);
-
- if ( psp != NULL ) {
-#if 0
- TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv;
- *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8,
- GL_TRUE );
-#endif
- }
- return (void *) psp;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.h
deleted file mode 100644
index 7ebb5f204..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_context.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * 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@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#ifndef _TRIDENT_CONTEXT_H_
-#define _TRIDENT_CONTEXT_H_
-
-#include "dri_util.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "drm.h"
-#include "mm.h"
-
-#define SUBPIXEL_X (0.0F)
-#define SUBPIXEL_Y (0.125F)
-
-#define _TRIDENT_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE)
-
-#define TRIDENT_FALLBACK_TEXTURE 0x01
-#define TRIDENT_FALLBACK_DRAW_BUFFER 0x02
-
-#define TRIDENT_NEW_CLIP 0x01
-
-#define TRIDENT_UPLOAD_COMMAND_D 0x00000001
-#define TRIDENT_UPLOAD_CONTEXT 0x04000000
-#define TRIDENT_UPLOAD_CLIPRECTS 0x80000000
-
-#define TAG(x) trident##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-/* these require that base be dword-aligned */
-static inline void MMIO_OUT32(unsigned char *base, unsigned int offset,
- unsigned int val)
-{
- unsigned int *addr = (unsigned int *)(base + offset);
- *addr = val;
-}
-
-static inline unsigned int MMIO_IN32(unsigned char *base, unsigned int offset)
-{
- unsigned int *addr = (unsigned int *)(base + offset);
- return *addr;
-}
-
-#define MMIO_OUT8(base, offset, val) *((base) + (offset)) = (val)
-#define MMIO_IN8(base, offset) *((base) + (offset))
-
-struct trident_context;
-typedef struct trident_context tridentContextRec;
-typedef struct trident_context *tridentContextPtr;
-
-typedef void (*trident_quad_func)( tridentContextPtr,
- const tridentVertex *,
- const tridentVertex *,
- const tridentVertex *,
- const tridentVertex * );
-typedef void (*trident_tri_func)( tridentContextPtr,
- const tridentVertex *,
- const tridentVertex *,
- const tridentVertex * );
-typedef void (*trident_line_func)( tridentContextPtr,
- const tridentVertex *,
- const tridentVertex * );
-typedef void (*trident_point_func)( tridentContextPtr,
- const tridentVertex * );
-
-typedef struct {
- drm_handle_t handle; /* Handle to the DRM region */
- drmSize size; /* Size of the DRM region */
- unsigned char *map; /* Mapping of the DRM region */
-} tridentRegionRec, *tridentRegionPtr;
-
-typedef struct {
- __DRIscreenPrivate *driScreen; /* Back pointer to DRI screen */
-
- drmBufMapPtr buffers;
-
- unsigned int frontOffset;
- unsigned int frontPitch;
- unsigned int backOffset;
- unsigned int backPitch;
- unsigned int depthOffset;
- unsigned int depthPitch;
- unsigned int width;
- unsigned int height;
- unsigned int cpp;
-
-#if 0
- unsigned int sarea_priv_offset;
-#endif
-
- tridentRegionRec mmio;
-} tridentScreenRec, *tridentScreenPtr;
-
-/**
- * tridentRenderbuffer, derived from Mesa's gl_renderbuffer
- */
-typedef struct {
- struct gl_renderbuffer Base;
- /* XXX per-window info should go here */
- int foo, bar;
-} tridentRenderbuffer;
-
-
-struct trident_context {
- GLcontext *glCtx; /* Mesa context */
-
- __DRIcontextPrivate *driContext;
- __DRIscreenPrivate *driScreen;
- __DRIdrawablePrivate *driDrawable;
-
- GLuint new_gl_state;
- GLuint new_state;
- GLuint dirty;
-
-#if 0
- drm_trident_sarea_t *sarea;
-#endif
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
- /* Mirrors of some DRI state
- */
- int lastStamp; /* mirror driDrawable->lastStamp */
-
- drm_context_t hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- tridentScreenPtr tridentScreen; /* Screen private DRI data */
-
- /* Visual, drawable, cliprect and scissor information
- */
- GLenum DrawBuffer;
- GLint drawOffset, drawPitch;
- GLint drawX, drawY; /* origin of drawable in draw buffer */
- GLint readOffset, readPitch;
-
- GLuint numClipRects; /* Cliprects for the draw buffer */
- drm_clip_rect_t *pClipRects;
-
- GLint scissor;
- drm_clip_rect_t ScissorRect; /* Current software scissor */
-
- GLuint Fallback;
- GLuint RenderIndex;
- GLuint SetupNewInputs;
- GLuint SetupIndex;
- GLfloat hw_viewport[16];
- GLfloat depth_scale;
- GLuint vertex_format;
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- char *verts;
-
- GLint tmu_source[2];
-
- GLuint hw_primitive;
- GLenum render_primitive;
-
- trident_point_func draw_point;
- trident_line_func draw_line;
- trident_tri_func draw_tri;
- trident_quad_func draw_quad;
-
-#if 0
- gammaTextureObjectPtr CurrentTexObj[2];
- struct gamma_texture_object_t TexObjList;
- struct gamma_texture_object_t SwappedOut;
- GLenum TexEnvImageFmt[2];
-
- memHeap_t *texHeap;
-
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
- int lastStamp;
-#endif
-
- /* Chip state */
-
- int commandD;
-
- /* Context State */
-
- int ClearColor;
-};
-
-void tridentDDInitExtensions( GLcontext *ctx );
-void tridentDDInitDriverFuncs( GLcontext *ctx );
-void tridentDDInitSpanFuncs( GLcontext *ctx );
-void tridentDDInitState( tridentContextPtr tmesa );
-void tridentInitHW( tridentContextPtr tmesa );
-void tridentDDInitStateFuncs( GLcontext *ctx );
-void tridentDDInitTextureFuncs( GLcontext *ctx );
-void tridentDDInitTriFuncs( GLcontext *ctx );
-
-extern void tridentBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs );
-extern void tridentInitVB( GLcontext *ctx );
-extern void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv );
-extern void tridentFallback( tridentContextPtr tmesa, GLuint bit,
- GLboolean mode );
-extern void tridentCheckTexSizes( GLcontext *ctx );
-extern void tridentChooseVertexState( GLcontext *ctx );
-extern void tridentDDUpdateHWState( GLcontext *ctx );
-extern void tridentUploadHwStateLocked( tridentContextPtr tmesa );
-
-#define TRIDENT_CONTEXT(ctx) ((tridentContextPtr)(ctx->DriverCtx))
-
-#endif /* _TRIDENT_CONTEXT_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dd.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dd.c
deleted file mode 100644
index 8c3af2001..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dd.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * 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@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "trident_context.h"
-#include "trident_lock.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
-
-#include "swrast/swrast.h"
-#include "context.h"
-#include "framebuffer.h"
-
-#define TRIDENT_DATE "20041223"
-
-/* Return the width and height of the current color buffer.
- */
-static void tridentDDGetBufferSize( GLframebuffer *framebuffer,
- GLuint *width, GLuint *height )
-{
- GET_CURRENT_CONTEXT(ctx);
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- LOCK_HARDWARE(tmesa);
- *width = tmesa->driDrawable->w;
- *height = tmesa->driDrawable->h;
- UNLOCK_HARDWARE(tmesa);
-}
-
-
-/* Return various strings for glGetString().
- */
-static const GLubyte *tridentDDGetString( GLcontext *ctx, GLenum name )
-{
- static char buffer[128];
-
- switch ( name ) {
- case GL_VENDOR:
- return (GLubyte *)"Alan Hourihane";
-
- case GL_RENDERER:
- sprintf( buffer, "Mesa DRI Trident " TRIDENT_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 tridentDDInitExtensions( GLcontext *ctx )
-{
- /* None... */
-}
-
-/* Initialize the driver's misc functions.
- */
-void tridentDDInitDriverFuncs( GLcontext *ctx )
-{
- ctx->Driver.GetBufferSize = tridentDDGetBufferSize;
- ctx->Driver.GetString = tridentDDGetString;
-
- ctx->Driver.Error = NULL;
-
- /* Pixel path fallbacks
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dri.h
deleted file mode 100644
index c1ce3c468..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_dri.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _TRIDENT_DRI_
-#define _TRIDENT_DRI_
-
-#include "xf86drm.h"
-
-typedef struct {
- drm_handle_t regs;
- drmSize regsSize;
- drmAddress regsMap;
- int deviceID;
- int width;
- int height;
- int mem;
- int frontOffset;
- int frontPitch;
- int backOffset;
- int backPitch;
- int depthOffset;
- int depthPitch;
- int cpp;
-#if 0
- int textureOffset;
- int textureSize;
-#endif
- unsigned int sarea_priv_offset;
-} TRIDENTDRIRec, *TRIDENTDRIPtr;
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_lock.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_lock.h
deleted file mode 100644
index ee0819f5c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_lock.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* XXX tridentGetLock doesn't exist... */
-
-#define LOCK_HARDWARE(tmesa) \
- do { \
- char __ret = 0; \
- DRM_CAS(tmesa->driHwLock, tmesa->hHWContext, \
- DRM_LOCK_HELD | tmesa->hHWContext, __ret); \
- } while (0)
-
-#define UNLOCK_HARDWARE(tmesa) \
- DRM_UNLOCK(tmesa->driFd, tmesa->driHwLock, tmesa->hHWContext)
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_state.c
deleted file mode 100644
index 76b2a8ef3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_state.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * 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@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "trident_context.h"
-#include "trident_lock.h"
-#include "array_cache/acache.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "framebuffer.h"
-
-#define TRIDENTPACKCOLOR332(r, g, b) \
- (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))
-
-#define TRIDENTPACKCOLOR1555(r, g, b, a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define TRIDENTPACKCOLOR565(r, g, b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define TRIDENTPACKCOLOR888(r, g, b) \
- (((r) << 16) | ((g) << 8) | (b))
-
-#define TRIDENTPACKCOLOR8888(r, g, b, a) \
- (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-#define TRIDENTPACKCOLOR4444(r, g, b, a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-static __inline__ GLuint tridentPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
-{
- switch ( cpp ) {
- case 2:
- return TRIDENTPACKCOLOR565( r, g, b );
- case 4:
- return TRIDENTPACKCOLOR8888( r, g, b, a );
- default:
- return 0;
- }
-}
-
-void tridentUploadHwStateLocked( tridentContextPtr tmesa )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
-#if 0
- ATISAREAPrivPtr sarea = tmesa->sarea;
- trident_context_regs_t *regs = &(sarea->ContextState);
-#endif
-
- if ( tmesa->dirty & TRIDENT_UPLOAD_COMMAND_D ) {
- MMIO_OUT32(MMIO, 0x00281C, tmesa->commandD );
- tmesa->dirty &= ~TRIDENT_UPLOAD_COMMAND_D;
- }
-
- if ( tmesa->dirty & TRIDENT_UPLOAD_CLIPRECTS ) {
- /* XXX FIX ME ! */
- MMIO_OUT32(MMIO, 0x002C80 , 0x20008000 | tmesa->tridentScreen->height );
- MMIO_OUT32(MMIO, 0x002C84 , 0x20000000 | tmesa->tridentScreen->width );
- tmesa->dirty &= ~TRIDENT_UPLOAD_CLIPRECTS;
- }
-
- tmesa->dirty = 0;
-}
-
-/* Copy the back color buffer to the front color buffer.
- */
-void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- unsigned char *MMIO;
- tridentContextPtr tmesa;
- GLint nbox, i;
- int busy;
- drm_clip_rect_t *pbox;
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate;
- MMIO = tmesa->tridentScreen->mmio.map;
-
- LOCK_HARDWARE( tmesa );
-
- /* use front buffer cliprects */
- nbox = dPriv->numClipRects;
- pbox = dPriv->pClipRects;
-
- for ( i = 0 ; i < nbox ; i++ ) {
-#if 0
- GLint nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS , nbox );
- drm_clip_rect_t *b = tmesa->sarea->boxes;
- GLint n = 0;
-
- for ( ; i < nr ; i++ ) {
- *b++ = pbox[i];
- n++;
- }
- tmesa->sarea->nbox = n;
-#endif
-
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->frontPitch << 20 | tmesa->tridentScreen->frontOffset>>4);
- MMIO_OUT32(MMIO, 0x2154, tmesa->tridentScreen->backPitch << 20 | tmesa->tridentScreen->backOffset>>4);
- MMIO_OUT8(MMIO, 0x2127, 0xCC); /* Copy Rop */
- MMIO_OUT32(MMIO, 0x2128, 0x4); /* scr2scr */
- MMIO_OUT32(MMIO, 0x2138, (pbox->x1 << 16) | pbox->y1);
- MMIO_OUT32(MMIO, 0x213C, (pbox->x1 << 16) | pbox->y1);
- MMIO_OUT32(MMIO, 0x2140, (pbox->x2 - pbox->x1) << 16 | (pbox->y2 - pbox->y1) );
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
- }
-
- UNLOCK_HARDWARE( tmesa );
-
-#if 0
- tmesa->dirty |= (MACH64_UPLOAD_CONTEXT |
- MACH64_UPLOAD_MISC |
- MACH64_UPLOAD_CLIPRECTS);
-#endif
-}
-
-
-static void tridentDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- int busy;
- GLuint flags = 0;
- GLint i;
-
-#define DRM_TRIDENT_FRONT 0x01
-#define DRM_TRIDENT_BACK 0x02
-#define DRM_TRIDENT_DEPTH 0x04
-
- if ( tmesa->new_state )
- tridentDDUpdateHWState( ctx );
-
- if ( mask & BUFFER_BIT_FRONT_LEFT ) {
- flags |= DRM_TRIDENT_FRONT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if ( mask & BUFFER_BIT_BACK_LEFT ) {
- flags |= DRM_TRIDENT_BACK;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) {
- flags |= DRM_TRIDENT_DEPTH;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- LOCK_HARDWARE(tmesa);
-
- if ( flags ) {
-
- cx += tmesa->drawX;
- cy += tmesa->drawY;
-
- /* HACK!!!
- */
- if ( tmesa->dirty & ~TRIDENT_UPLOAD_CLIPRECTS ) {
- tridentUploadHwStateLocked( tmesa );
- }
-
- for ( i = 0 ; i < tmesa->numClipRects ; i++ ) {
-#if 0
- int nr = MIN2( i + TRIDENT_NR_SAREA_CLIPRECTS, tmesa->numClipRects );
- drm_clip_rect_t *box = tmesa->pClipRects;
- drm_clip_rect_t *b = tmesa->sarea->boxes;
- GLint n = 0;
-
- if ( !all ) {
- for ( ; i < nr ; i++ ) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if ( x < cx ) w -= cx - x, x = cx;
- if ( y < cy ) h -= cy - y, y = cy;
- if ( x + w > cx + cw ) w = cx + cw - x;
- if ( y + h > cy + ch ) h = cy + ch - y;
- if ( w <= 0 ) continue;
- if ( h <= 0 ) continue;
-
- b->x1 = x;
- b->y1 = y;
- b->x2 = x + w;
- b->y2 = y + h;
- b++;
- n++;
- }
- } else {
- for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
- }
- }
-
- tmesa->sarea->nbox = n;
-#endif
-
-if (flags & DRM_TRIDENT_BACK) {
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->backPitch << 20 | tmesa->tridentScreen->backOffset>>4);
- MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */
- MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor);
- MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */
- MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy);
- MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch);
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
-}
-if (flags & DRM_TRIDENT_DEPTH) {
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->depthPitch << 20 | tmesa->tridentScreen->depthOffset>>4);
- MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */
- MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor);
- MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */
- MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy);
- MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch);
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
-}
- MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->frontPitch << 20 | tmesa->tridentScreen->frontOffset>>4);
-if (flags & DRM_TRIDENT_FRONT) {
- MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */
- MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor);
- MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */
- MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy);
- MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch);
- MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */
-#define GE_BUSY 0x80
- for (;;) {
- busy = MMIO_IN8(MMIO, 0x2120);
- if ( !(busy & GE_BUSY) )
- break;
- }
-}
-
- }
-
-#if 0
- tmesa->dirty |= (TRIDENT_UPLOAD_CONTEXT |
- TRIDENT_UPLOAD_MISC |
- TRIDENT_UPLOAD_CLIPRECTS);
-#endif
- }
-
- UNLOCK_HARDWARE(tmesa);
-
- if ( mask )
- _swrast_Clear( ctx, mask, all, cx, cy, cw, ch );
-}
-
-static void tridentDDShadeModel( GLcontext *ctx, GLenum mode )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- GLuint s = tmesa->commandD;
-
-#define TRIDENT_FLAT_SHADE 0x000000E0
-#define TRIDENT_FLAT_SHADE_VERTEX_C 0x00000060
-#define TRIDENT_FLAT_SHADE_GOURAUD 0x00000080
-
- s &= ~TRIDENT_FLAT_SHADE;
-
- switch ( mode ) {
- case GL_FLAT:
- s |= TRIDENT_FLAT_SHADE_VERTEX_C;
- break;
- case GL_SMOOTH:
- s |= TRIDENT_FLAT_SHADE_GOURAUD;
- break;
- default:
- return;
- }
-
- if ( tmesa->commandD != s ) {
- tmesa->commandD = s;
-
- tmesa->dirty |= TRIDENT_UPLOAD_COMMAND_D;
- }
-}
-
-void tridentCalcViewport( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = tmesa->hw_viewport;
-
- /* See also trident_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + tmesa->drawX + SUBPIXEL_X;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + tmesa->driDrawable->h + tmesa->drawY + SUBPIXEL_Y;
-#if 0
- m[MAT_SZ] = v[MAT_SZ] * tmesa->depth_scale;
- m[MAT_TZ] = v[MAT_TZ] * tmesa->depth_scale;
-#else
- m[MAT_SZ] = v[MAT_SZ];
- m[MAT_TZ] = v[MAT_TZ];
-#endif
-
- tmesa->SetupNewInputs = ~0;
-}
-
-static void tridentDDViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- tridentCalcViewport( ctx );
-}
-
-static void tridentDDDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- tridentCalcViewport( ctx );
-}
-
-void tridentSetCliprects( tridentContextPtr tmesa, GLenum mode )
-{
- __DRIdrawablePrivate *dPriv = tmesa->driDrawable;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- if (dPriv->numClipRects == 0) {
- static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
- tmesa->numClipRects = 1;
- tmesa->pClipRects = &zeroareacliprect;
- } else {
- tmesa->numClipRects = dPriv->numClipRects;
- tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects;
- }
- tmesa->drawX = dPriv->x;
- tmesa->drawY = dPriv->y;
- break;
- case GL_BACK_LEFT:
- if ( dPriv->numBackClipRects == 0 ) {
- if (dPriv->numClipRects == 0) {
- static drm_clip_rect_t zeroareacliprect = {0,0,0,0};
- tmesa->numClipRects = 1;
- tmesa->pClipRects = &zeroareacliprect;
- } else {
- tmesa->numClipRects = dPriv->numClipRects;
- tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects;
- tmesa->drawX = dPriv->x;
- tmesa->drawY = dPriv->y;
- }
- }
- else {
- tmesa->numClipRects = dPriv->numBackClipRects;
- tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pBackClipRects;
- tmesa->drawX = dPriv->backX;
- tmesa->drawY = dPriv->backY;
- }
- break;
- default:
- return;
- }
-
-#if 0
- tmesa->dirty |= TRIDENT_UPLOAD_CLIPRECTS;
-#endif
-}
-
-#if 0
-static GLboolean tridentDDSetDrawBuffer( GLcontext *ctx, GLenum mode )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- int found = GL_TRUE;
-
- if ( tmesa->DrawBuffer != mode ) {
- tmesa->DrawBuffer = mode;
-
- switch ( mode ) {
- case GL_FRONT_LEFT:
- tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_FALSE );
- tmesa->drawOffset = tmesa->tridentScreen->frontOffset;
- tmesa->drawPitch = tmesa->tridentScreen->frontPitch;
- tridentSetCliprects( tmesa, GL_FRONT_LEFT );
- break;
- case GL_BACK_LEFT:
- tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_FALSE );
- tmesa->drawOffset = tmesa->tridentScreen->backOffset;
- tmesa->drawPitch = tmesa->tridentScreen->backPitch;
- tridentSetCliprects( tmesa, GL_BACK_LEFT );
- break;
- default:
- tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_TRUE );
- found = GL_FALSE;
- break;
- }
-
-#if 0
- tmesa->setup.dst_off_pitch = (((tmesa->drawPitch/8) << 22) |
- (tmesa->drawOffset >> 3));
-
- tmesa->dirty |= MACH64_UPLOAD_DST_OFF_PITCH | MACH64_UPLOAD_CONTEXT;
-#endif
-
- }
-
- return found;
-}
-
-static void tridentDDClearColor( GLcontext *ctx,
- const GLchan color[4] )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- tmesa->ClearColor = tridentPackColor( tmesa->tridentScreen->cpp,
- color[0], color[1],
- color[2], color[3] );
-}
-#endif
-
-void tridentDDUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- TRIDENT_CONTEXT(ctx)->new_gl_state |= new_state;
-}
-
-
-/* Initialize the context's hardware state.
- */
-void tridentDDInitState( tridentContextPtr tmesa )
-{
- tmesa->new_state = 0;
-
- switch ( tmesa->glCtx->Visual.depthBits ) {
- case 16:
- tmesa->depth_scale = 1.0 / (GLfloat)0xffff;
- break;
- case 24:
- tmesa->depth_scale = 1.0 / (GLfloat)0xffffff;
- break;
- }
-}
-
-void tridentDDUpdateHWState( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- int new_state = tmesa->new_state;
-
- if ( new_state )
- {
- tmesa->new_state = 0;
-
-#if 0
- /* Update the various parts of the context's state.
- */
- if ( new_state & GAMMA_NEW_ALPHA )
- tridentUpdateAlphaMode( ctx );
-
- if ( new_state & GAMMA_NEW_DEPTH )
- tridentUpdateZMode( 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_STIPPLE )
- gammaUpdateStipple( ctx );
-#endif
- }
-
- /* HACK ! */
-
-#if 0
- gammaEmitHwState( tmesa );
-#endif
-}
-
-/* Initialize the driver's state functions.
- */
-void tridentDDInitStateFuncs( GLcontext *ctx )
-{
- ctx->Driver.UpdateState = tridentDDUpdateState;
-
- ctx->Driver.Clear = tridentDDClear;
- ctx->Driver.DepthRange = tridentDDDepthRange;
- ctx->Driver.ShadeModel = tridentDDShadeModel;
- ctx->Driver.Viewport = tridentDDViewport;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_tris.c
deleted file mode 100644
index ee85ab482..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_tris.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * 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@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-
-#include "trident_context.h"
-#include "trident_lock.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-
-static int first = 1;
-
-typedef struct reg {
- int addr;
- int data;
-} RegData;
-
-RegData initRegData[]={
- {0x2804, 0x19980824},
- {0x2F70, 0x46455858},
- {0x2F74, 0x41584998},
- {0x2F00, 0x00000000},
- {0x2F04, 0x80000800},
- {0x2F08, 0x00550200},
- {0x2F40, 0x00000001},
- {0x2F40, 0x00000001},
- {0x2F44, 0x00830097},
- {0x2F48, 0x0087009F},
- {0x2F4C, 0x00BF0003},
- {0x2F50, 0xF00B6C1B},
- {0x2C04, 0x00000000},
- {0x2D00, 0x00000080},
- {0x2D00, 0x00000000},
- {0x2DD4, 0x00100000},
- {0x2DD4, 0x00100010},
- {0x2DD8, 0x00100000},
- {0x2DD8, 0x00100010},
- {0x2C88, 0xFFFFFFFF},
- {0x2C94 , 0xFFFFFFFF},
- {0x281C, 0x00008000},
- {0x2C80, 0x00000000},
- {0x2C80, 0x00000000},
- {0x2C80 , 0x00008000},
- {0x2C00 , 0x00000000},
- {0x2C04 , 0x00000000},
- {0x2C08 , 0x00000000},
- {0x2C0C , 0x00000000},
- {0x2C10 , 0x00000000},
- {0x2C14 , 0x00000000},
- {0x2C18 , 0x00000000},
- {0x2C1C , 0x00000000},
- {0x2C20 , 0x00000000},
- {0x2C24 , 0x00000000},
- {0x2C2C , 0x00000000},
- {0x2C30 , 0x00000000},
- {0x2C34 , 0x00000000},
- {0x2C38 , 0x00000000},
- {0x2C3C , 0x00000000},
- {0x2C40 , 0x00000000},
- {0x2C44 , 0x00000000},
- {0x2C48 , 0x00000000},
- {0x2C4C , 0x00000000},
- {0x2C50 , 0x00000000},
- {0x2C54 , 0x00000000},
- {0x2C58 , 0x00000000},
- {0x2C5C , 0x00000000},
- {0x2C60 , 0x00000000},
- {0x2C64 , 0x00000000},
- {0x2C68 , 0x00000000},
- {0x2C6C , 0x00000000},
- {0x2C70 , 0x00000000},
- {0x2C74 , 0x00000000},
- {0x2C78 , 0x00000000},
- {0x2C7C , 0x00000000},
- {0x2C80 , 0x00008000},
- {0x2C84 , 0x00000000},
- {0x2C88 , 0xFFFFFFFF},
- {0x2C8C , 0x00000000},
- {0x2C90 , 0x00000000},
- {0x2C94 , 0xFFFFFFFF},
- {0x2C98 , 0x00000000},
- {0x2C9C , 0x00000000},
- {0x2CA0 , 0x00000000},
- {0x2CA4 , 0x00000000},
- {0x2CA8 , 0x00000000},
- {0x2CAC , 0x00000000},
- {0x2CB0 , 0x00000000},
- {0x2CB4 , 0x00000000},
- {0x2CB8 , 0x00000000},
- {0x2CBC , 0x00000000},
- {0x2CC0 , 0x00000000},
- {0x2CC4 , 0x00000000},
- {0x2CC8 , 0x00000000},
- {0x2CCC , 0x00000000},
- {0x2CD0 , 0x00000000},
- {0x2CD4 , 0x00000000},
- {0x2CD8 , 0x00000000},
- {0x2CDC , 0x00000000},
- {0x2CE0 , 0x00000000},
- {0x2CE4 , 0x00000000},
- {0x2CE8 , 0x00000000},
- {0x2CEC , 0x00000000},
- {0x2CF0 , 0x00000000},
- {0x2CF4 , 0x00000000},
- {0x2CF8 , 0x00000000},
- {0x2CFC , 0x00000000},
- {0x2D00 , 0x00000000},
- {0x2D04 , 0x00000000},
- {0x2D08 , 0x00000000},
- {0x2D0C , 0x00000000},
- {0x2D10 , 0x00000000},
- {0x2D14 , 0x00000000},
- {0x2D18 , 0x00000000},
- {0x2D1C , 0x00000000},
- {0x2D20 , 0x00000000},
- {0x2D24 , 0x00000000},
- {0x2D28 , 0x00000000},
- {0x2D2C , 0x00000000},
- {0x2D30 , 0x00000000},
- {0x2D34 , 0x00000000},
- {0x2D38 , 0x00000000},
- {0x2D3C , 0x00000000},
- {0x2D40 , 0x00000000},
- {0x2D44 , 0x00000000},
- {0x2D48 , 0x00000000},
- {0x2D4C , 0x00000000},
- {0x2D50 , 0x00000000},
- {0x2D54 , 0x00000000},
- {0x2D58 , 0x00000000},
- {0x2D5C , 0x00000000},
- {0x2D60 , 0x00000000},
- {0x2D64 , 0x00000000},
- {0x2D68 , 0x00000000},
- {0x2D6C , 0x00000000},
- {0x2D70 , 0x00000000},
- {0x2D74 , 0x00000000},
- {0x2D78 , 0x00000000},
- {0x2D7C , 0x00000000},
- {0x2D80 , 0x00000000},
- {0x2D84 , 0x00000000},
- {0x2D88 , 0x00000000},
- {0x2D8C , 0x00000000},
- {0x2D90 , 0x00000000},
- {0x2D94 , 0x00000000},
- {0x2D98 , 0x00000000},
- {0x2D9C , 0x00000000},
- {0x2DA0 , 0x00000000},
- {0x2DA4 , 0x00000000},
- {0x2DA8 , 0x00000000},
- {0x2DAC , 0x00000000},
- {0x2DB0 , 0x00000000},
- {0x2DB4 , 0x00000000},
- {0x2DB8 , 0x00000000},
- {0x2DBC , 0x00000000},
- {0x2DC0 , 0x00000000},
- {0x2DC4 , 0x00000000},
- {0x2DC8 , 0x00000000},
- {0x2DCC , 0x00000000},
- {0x2DD0 , 0x00000000},
- {0x2DD4 , 0x00100010},
- {0x2DD8 , 0x00100010},
- {0x2DDC , 0x00000000},
- {0x2DE0 , 0x00000000},
- {0x2DE4 , 0x00000000},
- {0x2DE8 , 0x00000000},
- {0x2DEC , 0x00000000},
- {0x2DF0 , 0x00000000},
- {0x2DF4 , 0x00000000},
- {0x2DF8 , 0x00000000},
- {0x2DFC , 0x00000000},
- {0x2E00 , 0x00000000},
- {0x2E04 , 0x00000000},
- {0x2E08 , 0x00000000},
- {0x2E0C , 0x00000000},
- {0x2E10 , 0x00000000},
- {0x2E14 , 0x00000000},
- {0x2E18 , 0x00000000},
- {0x2E1C , 0x00000000},
- {0x2E20 , 0x00000000},
- {0x2E24 , 0x00000000},
- {0x2E28 , 0x00000000},
- {0x2E2C , 0x00000000},
- {0x2E30 , 0x00000000},
- {0x2E34 , 0x00000000},
- {0x2E38 , 0x00000000},
- {0x2E3C , 0x00000000},
- {0x2E40 , 0x00000000},
- {0x2E44 , 0x00000000},
- {0x2E48 , 0x00000000},
- {0x2E4C , 0x00000000},
- {0x2E50 , 0x00000000},
- {0x2E54 , 0x00000000},
- {0x2E58 , 0x00000000},
- {0x2E5C , 0x00000000},
- {0x2E60 , 0x00000000},
- {0x2E64 , 0x00000000},
- {0x2E68 , 0x00000000},
- {0x2E6C , 0x00000000},
- {0x2E70 , 0x00000000},
- {0x2E74 , 0x00000000},
- {0x2E78 , 0x00000000},
- {0x2E7C , 0x00000000},
- {0x2E80 , 0x00000000},
- {0x2E84 , 0x00000000},
- {0x2E88 , 0x00000000},
- {0x2E8C , 0x00000000},
- {0x2E90 , 0x00000000},
- {0x2E94 , 0x00000000},
- {0x2E98 , 0x00000000},
- {0x2E9C , 0x00000000},
- {0x2EA0 , 0x00000000},
- {0x2EA4 , 0x00000000},
- {0x2EA8 , 0x00000000},
- {0x2EAC , 0x00000000},
- {0x2EB0 , 0x00000000},
- {0x2EB4 , 0x00000000},
- {0x2EB8 , 0x00000000},
- {0x2EBC , 0x00000000},
- {0x2EC0 , 0x00000000},
- {0x2EC4 , 0x00000000},
- {0x2EC8 , 0x00000000},
- {0x2ECC , 0x00000000},
- {0x2ED0 , 0x00000000},
- {0x2ED4 , 0x00000000},
- {0x2ED8 , 0x00000000},
- {0x2EDC , 0x00000000},
- {0x2EE0 , 0x00000000},
- {0x2EE4 ,0x00000000},
- {0x2EE8 ,0x00000000},
- {0x2EEC , 0x00000000},
- {0x2EF0 , 0x00000000},
- {0x2EF4 , 0x00000000},
- {0x2EF8 , 0x00000000},
- {0x2EFC , 0x00000000},
- /*{0x2F60 , 0x00000000},*/
-};
-
-int initRegDataNum=sizeof(initRegData)/sizeof(RegData);
-
-typedef union {
- unsigned int i;
- float f;
-} dmaBufRec, *dmaBuf;
-
-void Init3D( tridentContextPtr tmesa )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- int i;
-
- for(i=0;i<initRegDataNum;++i)
- MMIO_OUT32(MMIO, initRegData[i].addr, initRegData[i].data);
-}
-
-int DrawTriangle( tridentContextPtr tmesa)
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- dmaBufRec clr;
-
-printf("DRAW TRI\n");
- Init3D(tmesa);
-
-printf("ENGINE STATUS 0x%x\n",MMIO_IN32(MMIO, 0x2800));
- MMIO_OUT32(MMIO, 0x002800, 0x00000000 );
-#if 0
- MMIO_OUT32(MMIO, 0x002368 , MMIO_IN32(MMIO,0x002368)|1 );
-#endif
-
- MMIO_OUT32(MMIO, 0x002C00 , 0x00000014 );
-#if 0
- MMIO_OUT32(MMIO, 0x002C04 , 0x0A8004C0 );
-#else
- MMIO_OUT32(MMIO, 0x002C04 , 0x0A8000C0 );
-#endif
-
-#if 0
- MMIO_OUT32(MMIO, 0x002C08 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C0C , 0xFFCCCCCC );
- MMIO_OUT32(MMIO, 0x002C10 , 0x3F800000 );
- MMIO_OUT32(MMIO, 0x002C14 , 0x3D0D3DCB );
- MMIO_OUT32(MMIO, 0x002C2C , 0x70000000 );
- MMIO_OUT32(MMIO, 0x002C24 , 0x00202C00 );
- MMIO_OUT32(MMIO, 0x002C28 , 0xE0002500 );
- MMIO_OUT32(MMIO, 0x002C30 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C34 , 0xE0000000 );
- MMIO_OUT32(MMIO, 0x002C38 , 0x00000000 );
-#endif
-
- MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C54 , 0x0C320C80 );
- MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002C54 , 0x0C320C80 );
- MMIO_OUT32(MMIO, 0x002C80 , 0x20008258 );
- MMIO_OUT32(MMIO, 0x002C84 , 0x20000320 );
- MMIO_OUT32(MMIO, 0x002C94 , 0xFFFFFFFF );
-
-#if 0
- MMIO_OUT32(MMIO, 0x002D00 , 0x00009009 );
- MMIO_OUT32(MMIO, 0x002D38 , 0x00000000 );
- MMIO_OUT32(MMIO, 0x002D94 , 0x20002000 );
- MMIO_OUT32(MMIO, 0x002D50 , 0xf0000000 );
- MMIO_OUT32(MMIO, 0x002D80 , 0x24002000 );
- MMIO_OUT32(MMIO, 0x002D98 , 0x81000000 );
- MMIO_OUT32(MMIO, 0x002DB0 , 0x81000000 );
- MMIO_OUT32(MMIO, 0x002DC8 , 0x808000FF );
- MMIO_OUT32(MMIO, 0x002DD4 , 0x02000200 );
- MMIO_OUT32(MMIO, 0x002DD8 , 0x02000200 );
- MMIO_OUT32(MMIO, 0x002D30 , 0x02092400 );
- MMIO_OUT32(MMIO, 0x002D04 , 0x00102120 );
- MMIO_OUT32(MMIO, 0x002D08 , 0xFFFFFFFF );
- MMIO_OUT32(MMIO, 0x002D0C , 0xF00010D0 );
- MMIO_OUT32(MMIO, 0x002D10 , 0xC0000400 );
-#endif
-
- MMIO_OUT32(MMIO, 0x002814, 0x00000000 );
-#if 0
- MMIO_OUT32(MMIO, 0x002818 , 0x00036C20 );
-#else
- MMIO_OUT32(MMIO, 0x002818 , 0x00036020 );
-#endif
- MMIO_OUT32(MMIO, 0x00281C , 0x00098081 );
-
-printf("first TRI\n");
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 595.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0x00FF00 );
-#if 0
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0xFF0000 );
-#if 0
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
- clr.f = 395.0;
-printf("0x%x\n",clr.i);
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 5.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0xFF );
-#if 0
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 0.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
-printf("sec TRI\n");
- MMIO_OUT32(MMIO, 0x00281C , 0x00093980 );
- clr.f = 395.0;
- MMIO_OUT32(MMIO, 0x002820 , clr.i );
- clr.f = 595.0;
- MMIO_OUT32(MMIO, 0x002824 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002828 , clr.i );
- MMIO_OUT32(MMIO, 0x00282C , 0x00FF00 );
-#if 0
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002830 , clr.i );
- clr.f = 1.0;
- MMIO_OUT32(MMIO, 0x002834 , clr.i );
-#endif
-
-#if 0
- MMIO_OUT32(MMIO, 0x002368 , MMIO_IN32(MMIO,0x002368)&0xfffffffe );
-#endif
-
-printf("fin TRI\n");
-
- return 0;
-}
-
-static INLINE void trident_draw_point(tridentContextPtr tmesa,
- const tridentVertex *v0 )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- (void) MMIO;
-}
-
-static INLINE void trident_draw_line( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1 )
-{
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- (void) MMIO;
-}
-
-static INLINE void trident_draw_triangle( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2 )
-{
-}
-
-static INLINE void trident_draw_quad( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2,
- const tridentVertex *v3 )
-{
- GLuint vertsize = tmesa->vertex_size;
- GLint coloridx = (vertsize > 4) ? 4 : 3;
- unsigned char *MMIO = tmesa->tridentScreen->mmio.map;
- int clr;
- float *ftmp = (float *)(&clr);
-
- if (tmesa->dirty)
- tridentUploadHwStateLocked( tmesa );
-#if 0
- DrawTriangle(tmesa);
- exit(0);
-#else
-#if 1
- if (first) {
- Init3D(tmesa);
-#if 0
- DrawTriangle(tmesa);
-#endif
- first = 0;
- }
-#endif
-
- LOCK_HARDWARE( tmesa );
-
- MMIO_OUT32(MMIO, 0x002C00 , 0x00000010 );
- MMIO_OUT32(MMIO, 0x002C04 , 0x029C00C0 );
-
- /* Z buffer */
- MMIO_OUT32(MMIO, 0x002C24 , 0x00100000 /*| (tmesa->tridentScreen->depthOffset)*/ );
- MMIO_OUT32(MMIO, 0x002C28 , 0xE0000000 | (tmesa->tridentScreen->depthPitch * 4) );
-
- /* front buffer */
- MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 | (tmesa->drawOffset) );
- MMIO_OUT32(MMIO, 0x002C54 , 0x0C320000 | (tmesa->drawPitch * 4) );
-
- /* clipper */
- MMIO_OUT32(MMIO, 0x002C80 , 0x20008000 | tmesa->tridentScreen->height );
- MMIO_OUT32(MMIO, 0x002C84 , 0x20000000 | tmesa->tridentScreen->width );
-
- /* writemask */
- MMIO_OUT32(MMIO, 0x002C94 , 0xFFFFFFFF );
-
-if (vertsize == 4) {
- MMIO_OUT32(MMIO, 0x002818 , 0x0003A020 );
- MMIO_OUT32(MMIO, 0x00281C , 0x00098021 );
-
- *ftmp = v0->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v0->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v0->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v0->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v0->ui[coloridx] );
-
- *ftmp = v1->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v1->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v1->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v1->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v1->ui[coloridx] );
-
- *ftmp = v2->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v2->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v2->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v2->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v2->ui[coloridx] );
-
- MMIO_OUT32(MMIO, 0x00281C , 0x00093020 );
- *ftmp = v3->v.x;
- MMIO_OUT32(MMIO, 0x002820 , clr );
- *ftmp = v3->v.y;
- MMIO_OUT32(MMIO, 0x002824 , clr );
- *ftmp = v3->v.z;
- MMIO_OUT32(MMIO, 0x002828 , clr );
-#if 0
- *ftmp = v3->v.w;
- MMIO_OUT32(MMIO, 0x00282C , clr );
-#endif
- MMIO_OUT32(MMIO, 0x00282C , v3->ui[coloridx] );
-
-}
-#endif
-
- UNLOCK_HARDWARE( tmesa );
-}
-/***********************************************************************
- * 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.
- */
-#if 0
-static void
-trident_fallback_quad( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2,
- const tridentVertex *v3 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[4];
- trident_translate_vertex( ctx, v0, &v[0] );
- trident_translate_vertex( ctx, v1, &v[1] );
- trident_translate_vertex( ctx, v2, &v[2] );
- trident_translate_vertex( ctx, v3, &v[3] );
- _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] );
-}
-#endif
-
-/* XXX hack to get the prototype defined in time... */
-void trident_translate_vertex(GLcontext *ctx, const tridentVertex *src,
- SWvertex *dst);
-
-static void
-trident_fallback_tri( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1,
- const tridentVertex *v2 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[3];
- trident_translate_vertex( ctx, v0, &v[0] );
- trident_translate_vertex( ctx, v1, &v[1] );
- trident_translate_vertex( ctx, v2, &v[2] );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
-}
-
-static void
-trident_fallback_line( tridentContextPtr tmesa,
- const tridentVertex *v0,
- const tridentVertex *v1 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[2];
- trident_translate_vertex( ctx, v0, &v[0] );
- trident_translate_vertex( ctx, v1, &v[1] );
- _swrast_Line( ctx, &v[0], &v[1] );
-}
-
-
-static void
-trident_fallback_point( tridentContextPtr tmesa,
- const tridentVertex *v0 )
-{
- GLcontext *ctx = tmesa->glCtx;
- SWvertex v[1];
- trident_translate_vertex( ctx, v0, &v[0] );
- _swrast_Point( ctx, &v[0] );
-}
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- tmesa->draw_tri( tmesa, a, b, c ); \
- else \
- trident_draw_triangle( tmesa, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- tmesa->draw_tri( tmesa, a, b, d ); \
- tmesa->draw_tri( tmesa, b, c, d ); \
- } else \
- trident_draw_quad( tmesa, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- tmesa->draw_line( tmesa, v0, v1 ); \
- else \
- trident_draw_line( tmesa, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- tmesa->draw_point( tmesa, v0 ); \
- else \
- trident_draw_point( tmesa, v0 ); \
-} while (0)
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define TRIDENT_OFFSET_BIT 0x01
-#define TRIDENT_TWOSIDE_BIT 0x02
-#define TRIDENT_UNFILLED_BIT 0x04
-#define TRIDENT_FALLBACK_BIT 0x08
-#define TRIDENT_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[TRIDENT_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & TRIDENT_FALLBACK_BIT)
-#define DO_OFFSET (IND & TRIDENT_OFFSET_BIT)
-#define DO_UNFILLED (IND & TRIDENT_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & TRIDENT_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX tridentVertex
-#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) (tmesa->verts + (e<<tmesa->vertex_stride_shift))
-
-#define TRIDENT_COLOR( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
-} while (0)
-
-#define TRIDENT_SPEC( dst, src ) \
-do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
-} while (0)
-
-#define VERT_SET_RGBA( v, c ) TRIDENT_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (havespec) TRIDENT_SPEC( v->ub4[5], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5])
-#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
-#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
-
-#define LOCAL_VARS(n) \
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = (tmesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (tmesa->vertex_size == 4 ? 0 : 1); \
- (void) color; (void) spec; (void) coloroffset; (void) havespec;
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-#if 0
-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
-};
-#endif
-
-static void tridentResetLineStipple( GLcontext *ctx );
-#if 0
-static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-#endif
-static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim );
-
-#define RASTERIZE(x) /*if (tmesa->hw_primitive != hw_prim[x]) \
- tridentRasterPrimitive( ctx, hw_prim[x] ) */
-#define RENDER_PRIMITIVE tmesa->render_primitive
-#define TAG(x) x
-#define IND TRIDENT_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 (TRIDENT_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_OFFSET_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#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();
- 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();
-}
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define VERT(x) (tridentVertex *)(tridentverts + (x << shift))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) \
- trident_draw_point( tmesa, VERT(start) )
-#define RENDER_LINE( v0, v1 ) \
- trident_draw_line( tmesa, VERT(v0), VERT(v1) )
-#define RENDER_TRI( v0, v1, v2 ) \
- trident_draw_triangle( tmesa, VERT(v0), VERT(v1), VERT(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) \
- trident_draw_quad( tmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) )
-#define INIT(x) tridentRenderPrimitive( ctx, x );
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); \
- const GLuint shift = tmesa->vertex_stride_shift; \
- const char *tridentverts = (char *)tmesa->verts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE if ( stipple ) tridentResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) (x)
-#define TAG(x) trident_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) trident_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-static void tridentRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint prim = tmesa->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 tridentRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-#define _TRIDENT_NEW_RENDER_STATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_LINE_SMOOTH | \
- _DD_NEW_POINT_SMOOTH | \
- _DD_NEW_TRI_SMOOTH | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET) \
-
-
-#define POINT_FALLBACK (DD_POINT_SMOOTH)
-#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH)
-#define TRI_FALLBACK (DD_TRI_SMOOTH)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-
-static void tridentChooseRenderState(GLcontext *ctx)
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) {
- tmesa->draw_point = trident_draw_point;
- tmesa->draw_line = trident_draw_line;
- tmesa->draw_tri = trident_draw_triangle;
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= TRIDENT_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= TRIDENT_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= TRIDENT_UNFILLED_BIT;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)) {
- if (flags & POINT_FALLBACK) tmesa->draw_point = trident_fallback_point;
- if (flags & LINE_FALLBACK) tmesa->draw_line = trident_fallback_line;
- if (flags & TRI_FALLBACK) tmesa->draw_tri = trident_fallback_tri;
- index |= TRIDENT_FALLBACK_BIT;
- }
- }
-
- if (tmesa->RenderIndex != index) {
- tmesa->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 (tmesa->RenderIndex == 0) {
- tnl->Driver.Render.PrimTabVerts = trident_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = trident_render_tab_elts;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- }
- tnl->Driver.Render.ClippedLine = tridentRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = tridentRenderClippedPoly;
- }
-}
-
-
-/**********************************************************************/
-/* 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 tridentrender.c.
- */
-#if 0
-static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- if (tmesa->hw_primitive != hwprim)
- tmesa->hw_primitive = hwprim;
-}
-#endif
-
-static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- tmesa->render_primitive = prim;
-}
-
-static void tridentRunPipeline( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- if ( tmesa->new_state )
- tridentDDUpdateHWState( ctx );
-
- if (tmesa->new_gl_state) {
-#if 0
- if (tmesa->new_gl_state & _NEW_TEXTURE)
- tridentUpdateTextureState( ctx );
-#endif
-
- if (!tmesa->Fallback) {
- if (tmesa->new_gl_state & _TRIDENT_NEW_VERTEX)
- tridentChooseVertexState( ctx );
-
- if (tmesa->new_gl_state & _TRIDENT_NEW_RENDER_STATE)
- tridentChooseRenderState( ctx );
- }
-
- tmesa->new_gl_state = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void tridentRenderStart( GLcontext *ctx )
-{
- /* Check for projective texturing. Make sure all texcoord
- * pointers point to something. (fix in mesa?)
- */
- tridentCheckTexSizes( ctx );
-}
-
-static void tridentRenderFinish( GLcontext *ctx )
-{
- if (0)
- _swrast_flush( ctx ); /* never needed */
-}
-
-static void tridentResetLineStipple( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- (void) tmesa;
-
- /* Reset the hardware stipple counter.
- */
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-
-void tridentFallback( tridentContextPtr tmesa, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = tmesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = tmesa->Fallback;
-
- _tnl_need_projected_coords( ctx, GL_FALSE );
-
- if (mode) {
- tmesa->Fallback |= bit;
- if (oldfallback == 0) {
- _swsetup_Wakeup( ctx );
- tmesa->RenderIndex = ~0;
- }
- }
- else {
- tmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- tnl->Driver.Render.Start = tridentRenderStart;
- tnl->Driver.Render.PrimitiveNotify = tridentRenderPrimitive;
- tnl->Driver.Render.Finish = tridentRenderFinish;
- tnl->Driver.Render.BuildVertices = tridentBuildVertices;
- tnl->Driver.Render.ResetLineStipple = tridentResetLineStipple;
- tmesa->new_gl_state |= (_TRIDENT_NEW_RENDER_STATE|
- _TRIDENT_NEW_VERTEX);
- }
- }
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void tridentDDInitTriFuncs( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tmesa->RenderIndex = ~0;
-
- tnl->Driver.RunPipeline = tridentRunPipeline;
- tnl->Driver.Render.Start = tridentRenderStart;
- tnl->Driver.Render.Finish = tridentRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = tridentRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = tridentResetLineStipple;
- tnl->Driver.Render.BuildVertices = tridentBuildVertices;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_vb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_vb.c
deleted file mode 100644
index 77e4d9b76..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/trident/trident_vb.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK.
- *
- * 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@fairlite.demon.co.uk>
- *
- * Trident CyberBladeXP driver.
- *
- */
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/swrast.h"
-#include "tnl/t_context.h"
-#include "tnl/tnl.h"
-
-#include "trident_context.h"
-
-#define TRIDENT_TEX1_BIT 0x1
-#define TRIDENT_TEX0_BIT 0x2
-#define TRIDENT_RGBA_BIT 0x4
-#define TRIDENT_SPEC_BIT 0x8
-#define TRIDENT_FOG_BIT 0x10
-#define TRIDENT_XYZW_BIT 0x20
-#define TRIDENT_PTEX_BIT 0x40
-#define TRIDENT_MAX_SETUP 0x80
-
-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_stride_shift;
- GLuint vertex_format;
-} setup_tab[TRIDENT_MAX_SETUP];
-
-#define TINY_VERTEX_FORMAT 1
-#define NOTEX_VERTEX_FORMAT 2
-#define TEX0_VERTEX_FORMAT 3
-#define TEX1_VERTEX_FORMAT 4
-#define PROJ_TEX1_VERTEX_FORMAT 5
-#define TEX2_VERTEX_FORMAT 6
-#define TEX3_VERTEX_FORMAT 7
-#define PROJ_TEX3_VERTEX_FORMAT 8
-
-#define DO_XYZW (IND & TRIDENT_XYZW_BIT)
-#define DO_RGBA (IND & TRIDENT_RGBA_BIT)
-#define DO_SPEC (IND & TRIDENT_SPEC_BIT)
-#define DO_FOG (IND & TRIDENT_FOG_BIT)
-#define DO_TEX0 (IND & TRIDENT_TEX0_BIT)
-#define DO_TEX1 (IND & TRIDENT_TEX1_BIT)
-#define DO_TEX2 0
-#define DO_TEX3 0
-#define DO_PTEX (IND & TRIDENT_PTEX_BIT)
-
-#define VERTEX tridentVertex
-#define VERTEX_COLOR trident_color_t
-#define LOCALVARS tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-#define GET_VIEWPORT_MAT() tmesa->hw_viewport
-#define GET_TEXSOURCE(n) tmesa->tmu_source[n]
-#define GET_VERTEX_FORMAT() tmesa->vertex_format
-#define GET_VERTEX_SIZE() tmesa->vertex_size
-#define GET_VERTEX_STORE() tmesa->verts
-#define GET_VERTEX_STRIDE_SHIFT() tmesa->vertex_stride_shift
-#define GET_UBYTE_COLOR_STORE() &tmesa->UbyteColor
-#define GET_UBYTE_SPEC_COLOR_STORE() &tmesa->UbyteSecondaryColor
-
-#define HAVE_HW_VIEWPORT 0
-#define HAVE_HW_DIVIDE 0
-#define HAVE_RGBA_COLOR 0
-#define HAVE_TINY_VERTICES 1
-#define HAVE_NOTEX_VERTICES 1
-#define HAVE_TEX0_VERTICES 1
-#define HAVE_TEX1_VERTICES 1
-#define HAVE_TEX2_VERTICES 0
-#define HAVE_TEX3_VERTICES 0
-#define HAVE_PTEX_VERTICES 0
-
-#define UNVIEWPORT_VARS \
- const GLfloat dx = - tmesa->drawX - SUBPIXEL_X; \
- const GLfloat dy = (tmesa->driDrawable->h + \
- tmesa->drawY + SUBPIXEL_Y); \
- const GLfloat sz = 1.0 / tmesa->depth_scale
-
-#define UNVIEWPORT_X(x) x + dx;
-#define UNVIEWPORT_Y(y) - y + dy;
-#define UNVIEWPORT_Z(z) z * sz;
-
-#define PTEX_FALLBACK() tridentFallback(TRIDENT_CONTEXT(ctx), TRIDENT_FALLBACK_TEXTURE, 1)
-
-#define IMPORT_FLOAT_COLORS trident_import_float_colors
-#define IMPORT_FLOAT_SPEC_COLORS trident_import_float_spec_colors
-
-#define INTERP_VERTEX setup_tab[tmesa->SetupIndex].interp
-#define COPY_PV_VERTEX setup_tab[tmesa->SetupIndex].copy_pv
-
-/***********************************************************************
- * Generate pv-copying and translation functions *
- ***********************************************************************/
-
-#define TAG(x) trident_##x
-#include "tnl_dd/t_dd_vb.c"
-
-/***********************************************************************
- * Generate vertex emit and interp functions *
- ***********************************************************************/
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT)
-#define TAG(x) x##_wg
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_wgs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT)
-#define TAG(x) x##_wgf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_wgfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgfpt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_wgfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_wgfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT)
-#define TAG(x) x##_wgfspt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_TEX0_BIT)
-#define TAG(x) x##_t0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_t0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_FOG_BIT)
-#define TAG(x) x##_f
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_ft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_ft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT)
-#define TAG(x) x##_g
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_gs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gt0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gt0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT)
-#define TAG(x) x##_gf
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT)
-#define TAG(x) x##_gfs
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gft0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gft0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT)
-#define TAG(x) x##_gfst0
-#include "tnl_dd/t_dd_vbtmp.h"
-
-#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT)
-#define TAG(x) x##_gfst0t1
-#include "tnl_dd/t_dd_vbtmp.h"
-
-static void init_setup_tab( void )
-{
- init_wg();
- init_wgs();
- init_wgt0();
- init_wgt0t1();
- init_wgpt0();
- init_wgst0();
- init_wgst0t1();
- init_wgspt0();
- init_wgf();
- init_wgfs();
- init_wgft0();
- init_wgft0t1();
- init_wgfpt0();
- init_wgfst0();
- init_wgfst0t1();
- init_wgfspt0();
- init_t0();
- init_t0t1();
- init_f();
- init_ft0();
- init_ft0t1();
- init_g();
- init_gs();
- init_gt0();
- init_gt0t1();
- init_gst0();
- init_gst0t1();
- init_gf();
- init_gfs();
- init_gft0();
- init_gft0t1();
- init_gfst0();
- init_gfst0t1();
-}
-
-void tridentBuildVertices( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint newinputs )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx );
- GLubyte *v = ((GLubyte *)tmesa->verts + (start<<tmesa->vertex_stride_shift));
- GLuint stride = 1<<tmesa->vertex_stride_shift;
-
- newinputs |= tmesa->SetupNewInputs;
- tmesa->SetupNewInputs = 0;
-
- if (!newinputs)
- return;
-
- if (newinputs & VERT_BIT_POS) {
- setup_tab[tmesa->SetupIndex].emit( ctx, start, count, v, stride );
- } else {
- GLuint ind = 0;
-
- if (newinputs & VERT_BIT_COLOR0)
- ind |= TRIDENT_RGBA_BIT;
-
- if (newinputs & VERT_BIT_COLOR1)
- ind |= TRIDENT_SPEC_BIT;
-
- if (newinputs & VERT_BIT_TEX0)
- ind |= TRIDENT_TEX0_BIT;
-
- if (newinputs & VERT_BIT_TEX1)
- ind |= TRIDENT_TEX1_BIT;
-
- if (newinputs & VERT_BIT_FOG)
- ind |= TRIDENT_FOG_BIT;
-
- if (tmesa->SetupIndex & TRIDENT_PTEX_BIT)
- ind = ~0;
-
- ind &= tmesa->SetupIndex;
-
- if (ind) {
- setup_tab[ind].emit( ctx, start, count, v, stride );
- }
- }
-}
-
-void tridentCheckTexSizes( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx );
-
- if (!setup_tab[tmesa->SetupIndex].check_tex_sizes(ctx)) {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /* Invalidate stored verts
- */
- tmesa->SetupNewInputs = ~0;
- tmesa->SetupIndex |= TRIDENT_PTEX_BIT;
-
- if (!tmesa->Fallback &&
- !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
- tnl->Driver.Render.Interp = setup_tab[tmesa->SetupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[tmesa->SetupIndex].copy_pv;
- }
- }
-}
-
-void tridentChooseVertexState( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint ind = TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- ind |= TRIDENT_SPEC_BIT;
-
- if (ctx->Fog.Enabled)
- ind |= TRIDENT_FOG_BIT;
-
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
- ind |= TRIDENT_TEX0_BIT;
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
- ind |= TRIDENT_TEX1_BIT;
- }
- }
-
- tmesa->SetupIndex = ind;
-
- if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
- tnl->Driver.Render.Interp = trident_interp_extras;
- tnl->Driver.Render.CopyPV = trident_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 != tmesa->vertex_format) {
- tmesa->vertex_format = setup_tab[ind].vertex_format;
- tmesa->vertex_size = setup_tab[ind].vertex_size;
- tmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
- }
-}
-
-void tridentInitVB( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
- GLuint size = TNL_CONTEXT(ctx)->vb.Size;
-
- tmesa->verts = (char *)ALIGN_MALLOC( size * 16 * 4, 32 );
-
- {
- static int firsttime = 1;
- if (firsttime) {
- init_setup_tab();
- firsttime = 0;
- }
- }
-}
-
-void tridentFreeVB( GLcontext *ctx )
-{
- tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx);
-
- if (tmesa->verts) {
- ALIGN_FREE(tmesa->verts);
- tmesa->verts = 0;
- }
-
- if (tmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE((void *)tmesa->UbyteSecondaryColor.Ptr);
- tmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (tmesa->UbyteColor.Ptr) {
- ALIGN_FREE((void *)tmesa->UbyteColor.Ptr);
- tmesa->UbyteColor.Ptr = 0;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/Makefile
deleted file mode 100644
index 5fe00c1bd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# src/mesa/drivers/dri/unichrome/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = unichrome_dri.so
-
-MINIGLX_SOURCES = server/via_dri.c
-
-DRIVER_SOURCES = \
- via_context.c \
- via_fb.c \
- via_tex.c \
- via_ioctl.c \
- via_memcpy.c \
- via_render.c \
- via_screen.c \
- via_span.c \
- via_state.c \
- via_texcombine.c \
- via_tris.c
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via.h
deleted file mode 100644
index 2cfe6631e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __VIA_H__
-#define __VIA_H__
-
-typedef struct VIAInfo
-{
- size_t registerSize;
- void * registerHandle;
- void * data;
-} * VIAInfoPtr;
-
-#endif /* __VIA_H__ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.c
deleted file mode 100644
index d7217d205..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.c
+++ /dev/null
@@ -1,1252 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_dri.c,v 1.4 2003/09/24 02:43:30 dawes Exp $ */
-/*
- * 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 "via_common.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 u_int8_t*)base)+(addr)))+0)
-#define MMIO_OUT8(base, addr, val) ((*(((volatile u_int8_t*)base)+(addr)))=((u_int8_t)val))
-#define MMIO_OUT16(base, addr, val) ((*(volatile u_int16_t*)(((u_int8_t*)base)+(addr)))=((u_int16_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 = (u_int32_t)NULL;
- else
- drmInfo.agpAddr = (u_int32_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);
- u_int32_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);
- u_int8_t bRegTemp;
- u_int32_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, (u_int8_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, (u_int8_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);
- u_int32_t dwVQStartAddr, dwVQEndAddr;
- u_int32_t dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
- u_int32_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, (u_int32_t) i << 24);
- }
-
- VIASETREG(0x43C, 0x00020000);
-
- for (i = 0; i <= 0x94; i++)
- {
- VIASETREG(0x440, (u_int32_t) i << 24);
- }
-
- VIASETREG(0x440, 0x82400000);
-
- VIASETREG(0x43C, 0x01020000);
-
-
- for (i = 0; i <= 0x94; i++)
- {
- VIASETREG(0x440, (u_int32_t) i << 24);
- }
-
- VIASETREG(0x440, 0x82400000);
- VIASETREG(0x43C, 0xfe020000);
-
- for (i = 0; i <= 0x03; i++)
- {
- VIASETREG(0x440, (u_int32_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:
- 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/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.h
deleted file mode 100644
index b47397d57..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_dri.h
+++ /dev/null
@@ -1,78 +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
- * 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.
- */
-/*
- * Keep this file in perfect sync between the ddx and dri drivers.
- * At least bump the VIA_DRIDDX_VERSION defines appropriately.
- *
- */
-#ifndef _VIA_DRI_H_
-#define _VIA_DRI_H_ 1
-
-#define VIA_MAX_DRAWABLES 256
-
-#define VIA_DRIDDX_VERSION_MAJOR 5
-#define VIA_DRIDDX_VERSION_MINOR 0
-#define VIA_DRIDDX_VERSION_PATCH 0
-
-#ifndef XFree86Server
-typedef int Bool;
-#endif
-
-typedef struct {
- drm_handle_t handle;
- drmSize size;
-} viaRegion, *viaRegionPtr;
-
-typedef struct {
- viaRegion regs, agp;
- int deviceID;
- int width;
- int height;
- int mem;
- int bytesPerPixel;
- int priv1;
- int priv2;
- int fbOffset;
- int fbSize;
- Bool drixinerama;
- int backOffset;
- int depthOffset;
- int textureOffset;
- int textureSize;
- int irqEnabled;
- unsigned int scrnX, scrnY;
- int sarea_priv_offset;
- int ringBufActive;
- unsigned int reg_pause_addr;
-} VIADRIRec, *VIADRIPtr;
-
-typedef struct {
- int dummy;
-} VIAConfigPrivRec, *VIAConfigPrivPtr;
-
-typedef struct {
- int dummy;
-} VIADRIContextRec, *VIADRIContextPtr;
-
-#endif /* _VIA_DRI_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_driver.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_driver.h
deleted file mode 100644
index 997b2e41a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_driver.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_driver.h,v 1.7 2003/11/06 18:38:11 tsi Exp $ */
-/*
- * 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.
- */
-
-#ifndef _VIA_DRIVER_H
-#define _VIA_DRIVER_H
-
-#if 0 /* DEBUG is use in VIA DRI code as a flag */
-/* #define DEBUG_PRINT */
-#ifdef DEBUG_PRINT
-#define DEBUG(x) x
-#else
-#define DEBUG(x)
-#endif
-#endif
-
-#if 0
-#include "vgaHW.h"
-#include "xf86.h"
-#include "xf86Resources.h"
-#include "xf86_ansic.h"
-#include "xf86Pci.h"
-#include "xf86PciInfo.h"
-#include "xf86_OSproc.h"
-#include "compiler.h"
-#include "xf86Cursor.h"
-#include "mipointer.h"
-#include "micmap.h"
-
-#define USE_FB
-#ifdef USE_FB
-#include "fb.h"
-#else
-#include "cfb.h"
-#include "cfb16.h"
-#include "cfb32.h"
-#endif
-
-#include "xf86cmap.h"
-#include "vbe.h"
-#include "xaa.h"
-
-#include "via_regs.h"
-#include "via_bios.h"
-#include "via_gpioi2c.h"
-#include "via_priv.h"
-#include "ginfo.h"
-
-#ifdef XF86DRI
-#define _XF86DRI_SERVER_
-#include "sarea.h"
-#include "dri.h"
-#include "GL/glxint.h"
-#include "via_dri.h"
-#endif
-#else
-#include "via_regs.h"
-
-#include "GL/internal/dri_interface.h"
-#include "via_dri.h"
-#endif
-
-/* _SOLO : copied from via_bios.h */
-/* System Memory CLK */
-#define VIA_MEM_SDR66 0x00
-#define VIA_MEM_SDR100 0x01
-#define VIA_MEM_SDR133 0x02
-#define VIA_MEM_DDR200 0x03
-#define VIA_MEM_DDR266 0x04
-#define VIA_MEM_DDR333 0x05
-#define VIA_MEM_DDR400 0x06
-
-#define DRIVER_NAME "via"
-#define DRIVER_VERSION "4.1.0"
-#define VERSION_MAJOR 4
-#define VERSION_MINOR 1
-#define PATCHLEVEL 41
-#define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL)
-
-#define VGAIN8(addr) MMIO_IN8(pVia->MapBase+0x8000, addr)
-#define VGAIN16(addr) MMIO_IN16(pVia->MapBase+0x8000, addr)
-#define VGAIN(addr) MMIO_IN32(pVia->MapBase+0x8000, addr)
-
-#define VGAOUT8(addr, val) MMIO_OUT8(pVia->MapBase+0x8000, addr, val)
-#define VGAOUT16(addr, val) MMIO_OUT16(pVia->MapBase+0x8000, addr, val)
-#define VGAOUT(addr, val) MMIO_OUT32(pVia->MapBase+0x8000, addr, val)
-
-#define INREG(addr) MMIO_IN32(pVia->MapBase, addr)
-#define OUTREG(addr, val) MMIO_OUT32(pVia->MapBase, addr, val)
-#define INREG16(addr) MMIO_IN16(pVia->MapBase, addr)
-#define OUTREG16(addr, val) MMIO_OUT16(pVia->MapBase, addr, val)
-
-#define VIA_PIXMAP_CACHE_SIZE (256 * 1024)
-#define VIA_CURSOR_SIZE (4 * 1024)
-#define VIA_VQ_SIZE (256 * 1024)
-
-typedef struct {
- unsigned int mode, refresh, resMode;
- int countWidthByQWord;
- int offsetWidthByQWord;
- unsigned char SR08, SR0A, SR0F;
-
- /* extended Sequencer registers */
- unsigned char SR10, SR11, SR12, SR13,SR14,SR15,SR16;
- unsigned char SR17, SR18, SR19, SR1A,SR1B,SR1C,SR1D,SR1E;
- unsigned char SR1F, SR20, SR21, SR22,SR23,SR24,SR25,SR26;
- unsigned char SR27, SR28, SR29, SR2A,SR2B,SR2C,SR2D,SR2E;
- unsigned char SR2F, SR30, SR31, SR32,SR33,SR34,SR40,SR41;
- unsigned char SR42, SR43, SR44, SR45,SR46,SR47;
-
- unsigned char Clock;
-
- /* extended CRTC registers */
- unsigned char CR13, CR30, CR31, CR32, CR33, CR34, CR35, CR36;
- unsigned char CR37, CR38, CR39, CR3A, CR40, CR41, CR42, CR43;
- unsigned char CR44, CR45, CR46, CR47, CR48, CR49, CR4A;
- unsigned char CRTCRegs[83];
- unsigned char TVRegs[0xCF];
- unsigned char TVRegs2[0xCF];
-/* unsigned char LCDRegs[0x40];*/
-
-} VIARegRec, *VIARegPtr;
-
-
-typedef struct _VIA {
- VIARegRec SavedReg;
- VIARegRec ModeReg;
-#if 0
- xf86CursorInfoPtr CursorInfoRec;
- int stateMode;
- VIAModeInfoPtr VIAModeList;
-#endif
- int ModeStructInit;
- int Bpp, Bpl, ScissB;
- unsigned PlaneMask;
-
- unsigned long videoRambytes;
- int videoRamKbytes;
- int FBFreeStart;
- int FBFreeEnd;
- int CursorStart;
- int VQStart;
- int VQEnd;
-
- /* These are physical addresses. */
- unsigned long FrameBufferBase;
- unsigned long MmioBase;
-
- /* These are linear addresses. */
- unsigned char* MapBase;
- unsigned char* VidMapBase;
- unsigned char* BltBase;
- unsigned char* MapBaseDense;
- unsigned char* FBBase;
- unsigned char* FBStart;
-
- int PrimaryVidMapped;
- int dacSpeedBpp;
- int minClock, maxClock;
- int MCLK, REFCLK, LCDclk;
- double refclk_fact;
-
- /* Here are all the Options */
- int VQEnable;
- int pci_burst;
- int NoPCIRetry;
- int hwcursor;
- int NoAccel;
- int shadowFB;
- int NoDDCValue;
- int rotate;
-
-#if 0
- CloseScreenProcPtr CloseScreen;
- pciVideoPtr PciInfo;
- PCITAG PciTag;
-#endif
- int Chipset;
- int ChipId;
- int ChipRev;
- /*vbeInfoPtr pVbe;*/
- int EntityIndex;
-
- /* Support for shadowFB and rotation */
- unsigned char* ShadowPtr;
- int ShadowPitch;
- void (*PointerMoved)(int index, int x, int y);
-
- /* Support for XAA acceleration */
-#if 0
- XAAInfoRecPtr AccelInfoRec;
- xRectangle Rect;
-#endif
- u_int32_t SavedCmd;
- u_int32_t SavedFgColor;
- u_int32_t SavedBgColor;
- u_int32_t SavedPattern0;
- u_int32_t SavedPattern1;
- u_int32_t SavedPatternAddr;
-
-#if 0
- /* Support for Int10 processing */
- xf86Int10InfoPtr pInt10;
-
- /* BIOS Info Ptr */
- VIABIOSInfoPtr pBIOSInfo;
- VGABIOSVERPtr pBIOSVer;
-#endif
-
- /* Support for DGA */
- int numDGAModes;
- /*DGAModePtr DGAModes;*/
- int DGAactive;
- int DGAViewportStatus;
-
- /* The various wait handlers. */
- int (*myWaitIdle)(struct _VIA*);
-
-#if 0
- /* I2C & DDC */
- I2CBusPtr I2C_Port1;
- I2CBusPtr I2C_Port2;
- xf86MonPtr DDC1;
- xf86MonPtr DDC2;
-#endif
-
- /* MHS */
- int IsSecondary;
- int HasSecondary;
-
-#if 0
- /* Capture information */
- VIACAPINFO CapInfo[2]; /* 2 capture information */
-#endif
-
-/*
- u_int32_t Cap0_Deinterlace;
- u_int32_t Cap1_Deinterlace;
-
- int Cap0_FieldSwap;
- int NoCap0_HFilter;
- int Capture_OverScanOff;
- int NoMPEGHQV_VFilter;
-*/
-#ifdef XF86DRI
- int directRenderingEnabled;
- DRIInfoPtr pDRIInfo;
- int drmFD;
- int numVisualConfigs;
- __GLXvisualConfig* pVisualConfigs;
- VIAConfigPrivPtr pVisualConfigsPriv;
- unsigned long agpHandle;
- unsigned long registerHandle;
- u_int32_t agpAddr;
- unsigned char *agpBase;
- unsigned int agpSize;
- int IsPCI;
- int drixinerama;
-#else
- int drmFD;
- unsigned long agpHandle;
- unsigned long registerHandle;
- unsigned long agpAddr;
- unsigned char *agpBase;
- unsigned int agpSize;
- int IsPCI;
-#endif
-
- int V4LEnabled;
- u_int16_t ActiveDevice; /* if SAMM, non-equal pBIOSInfo->ActiveDevice */
- unsigned char *CursorImage;
- u_int32_t CursorFG;
- u_int32_t CursorBG;
- u_int32_t CursorMC;
-
- unsigned char MemClk;
- int EnableExtendedFIFO;
- VIADRIPtr devPrivate;
-} VIARec, *VIAPtr;
-
-
-/* Shortcuts. These depend on a local symbol "pVia". */
-
-#define WaitIdle() pVia->myWaitIdle(pVia)
-#define VIAPTR(p) ((VIAPtr)((p)->driverPrivate))
-
-#endif /* _VIA_DRIVER_H */
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_priv.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_priv.h
deleted file mode 100644
index 587531b37..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_priv.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_priv.h,v 1.3 2003/08/27 15:16:12 tsi Exp $ */
-
-#ifndef _VIA_PRIV_H_
-#define _VIA_PRIV_H_ 1
-
-//#include "ddmpeg.h"
-#include "via_common.h"
-
-#define MEM_BLOCKS 4
-
-typedef struct {
- unsigned long base; /* Offset into fb */
- int pool; /* Pool we drew from */
- int drm_fd; /* Fd in DRM mode */
- drm_via_mem_t drm; /* DRM management object */
- int slot; /* Pool 3 slot */
- void *pVia; /* VIA driver pointer */
- //FBLinearPtr linear; /* X linear pool info ptr */
-} VIAMem;
-
-typedef VIAMem *VIAMemPtr;
-
-
-
-#if 0
-typedef struct {
- unsigned long gdwVideoFlagTV1;
- unsigned long gdwVideoFlagSW;
- unsigned long gdwVideoFlagMPEG;
- unsigned long gdwAlphaEnabled; /* For Alpha blending use*/
-
- VIAMem SWOVMem;
- VIAMem HQVMem;
- VIAMem SWfbMem;
-
- DDPIXELFORMAT DPFsrc;
- DDUPDATEOVERLAY UpdateOverlayBackup; /* For HQVcontrol func use
- // To save MPEG updateoverlay info.*/
-
-/* device struct */
- SWDEVICE SWDevice;
- SUBDEVICE SUBDevice;
- MPGDEVICE MPGDevice;
- OVERLAYRECORD overlayRecordV1;
- OVERLAYRECORD overlayRecordV3;
-
- BoxRec AvailFBArea;
- FBLinearPtr SWOVlinear;
-
- int MPEG_ON;
- int SWVideo_ON;
-
-/*To solve the bandwidth issue */
- unsigned long gdwUseExtendedFIFO;
-
-/* For panning mode use */
- int panning_old_x;
- int panning_old_y;
- int panning_x;
- int panning_y;
-
-/*To solve the bandwidth issue */
- unsigned char Save_3C4_16;
- unsigned char Save_3C4_17;
- unsigned char Save_3C4_18;
-
-} swovRec, *swovPtr;
-#endif
-
-#endif /* _VIA_PRIV_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_regs.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_regs.h
deleted file mode 100644
index 5c5eecbe8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/server/via_regs.h
+++ /dev/null
@@ -1,197 +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.
- */
-
-/*************************************************************************
- *
- * File: via_regs.c
- * Content: The defines of Via registers
- *
- ************************************************************************/
-
-#ifndef _VIA_REGS_H
-#define _VIA_REGS_H
-
-#include "via_driver.h"
-
-/*#define VIA_SERIES(chip) (chip == VIA_CLE266)*/
-
-#define PCI_VIA_VENDOR_ID 0x1106
-
-#define PCI_CHIP_CLE3122 0x3122
-#define PCI_CHIP_CLE3022 0x3022
-#define PCI_CHIP_VT3205 0x3205
-#define PCI_CHIP_VT7205 0x7205
-#define PCI_CHIP_VT3204 0x3108
-#define PCI_CHIP_VT3259 0x3118
-
-
-#define BIOS_BSIZE 1024
-#define BIOS_BASE 0xc0000
-
-
-#define VIA_MMIO_REGSIZE 0x9000
-#define VIA_MMIO_REGBASE 0x0
-#define VIA_MMIO_VGABASE 0x8000
-#define VIA_MMIO_BLTBASE 0x200000
-#define VIA_MMIO_BLTSIZE 0x10000
-
-
-/* defines for VIA 2D registers */
-#define VIA_REG_GECMD 0x000
-#define VIA_REG_GEMODE 0x004
-#define VIA_REG_GESTATUS 0x004 /* as same as VIA_REG_GEMODE */
-#define VIA_REG_SRCPOS 0x008
-#define VIA_REG_DSTPOS 0x00C
-#define VIA_REG_LINE_K1K2 0x008
-#define VIA_REG_LINE_XY 0x00C
-#define VIA_REG_DIMENSION 0x010 /* width and height */
-#define VIA_REG_PATADDR 0x014
-#define VIA_REG_FGCOLOR 0x018
-#define VIA_REG_DSTCOLORKEY 0x018 /* as same as VIA_REG_FG */
-#define VIA_REG_BGCOLOR 0x01C
-#define VIA_REG_SRCCOLORKEY 0x01C /* as same as VIA_REG_BG */
-#define VIA_REG_CLIPTL 0x020 /* top and left of clipping */
-#define VIA_REG_CLIPBR 0x024 /* bottom and right of clipping */
-#define VIA_REG_OFFSET 0x028
-#define VIA_REG_LINE_ERROR 0x028
-#define VIA_REG_KEYCONTROL 0x02C /* color key control */
-#define VIA_REG_SRCBASE 0x030
-#define VIA_REG_DSTBASE 0x034
-#define VIA_REG_PITCH 0x038 /* pitch of src and dst */
-#define VIA_REG_MONOPAT0 0x03C
-#define VIA_REG_MONOPAT1 0x040
-#define VIA_REG_COLORPAT 0x100 /* from 0x100 to 0x1ff */
-
-
-
-/* defines for VIA video registers */
-#define VIA_REG_INTERRUPT 0x200
-#define VIA_REG_CRTCSTART 0x214
-
-
-/* defines for VIA HW cursor registers */
-#define VIA_REG_CURSOR_MODE 0x2D0
-#define VIA_REG_CURSOR_POS 0x2D4
-#define VIA_REG_CURSOR_ORG 0x2D8
-#define VIA_REG_CURSOR_BG 0x2DC
-#define VIA_REG_CURSOR_FG 0x2E0
-
-
-/* defines for VIA 3D registers */
-#define VIA_REG_STATUS 0x400
-#define VIA_REG_TRANSET 0x43C
-#define VIA_REG_TRANSPACE 0x440
-
-/* VIA_REG_STATUS(0x400): Engine Status */
-#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */
-#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */
-#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */
-#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */
-
-
-/* VIA_REG_GECMD(0x00): 2D Engine Command */
-#define VIA_GEC_NOOP 0x00000000
-#define VIA_GEC_BLT 0x00000001
-#define VIA_GEC_LINE 0x00000005
-
-#define VIA_GEC_SRC_XY 0x00000000
-#define VIA_GEC_SRC_LINEAR 0x00000010
-#define VIA_GEC_DST_XY 0x00000000
-#define VIA_GEC_DST_LINRAT 0x00000020
-
-#define VIA_GEC_SRC_FB 0x00000000
-#define VIA_GEC_SRC_SYS 0x00000040
-#define VIA_GEC_DST_FB 0x00000000
-#define VIA_GEC_DST_SYS 0x00000080
-
-#define VIA_GEC_SRC_MONO 0x00000100 /* source is mono */
-#define VIA_GEC_PAT_MONO 0x00000200 /* pattern is mono */
-
-#define VIA_GEC_MSRC_OPAQUE 0x00000000 /* mono src is opaque */
-#define VIA_GEC_MSRC_TRANS 0x00000400 /* mono src is transparent */
-
-#define VIA_GEC_PAT_FB 0x00000000 /* pattern is in frame buffer */
-#define VIA_GEC_PAT_REG 0x00000800 /* pattern is from reg setting */
-
-#define VIA_GEC_CLIP_DISABLE 0x00000000
-#define VIA_GEC_CLIP_ENABLE 0x00001000
-
-#define VIA_GEC_FIXCOLOR_PAT 0x00002000
-
-#define VIA_GEC_INCX 0x00000000
-#define VIA_GEC_DECY 0x00004000
-#define VIA_GEC_INCY 0x00000000
-#define VIA_GEC_DECX 0x00008000
-
-#define VIA_GEC_MPAT_OPAQUE 0x00000000 /* mono pattern is opaque */
-#define VIA_GEC_MPAT_TRANS 0x00010000 /* mono pattern is transparent */
-
-#define VIA_GEC_MONO_UNPACK 0x00000000
-#define VIA_GEC_MONO_PACK 0x00020000
-#define VIA_GEC_MONO_DWORD 0x00000000
-#define VIA_GEC_MONO_WORD 0x00040000
-#define VIA_GEC_MONO_BYTE 0x00080000
-
-#define VIA_GEC_LASTPIXEL_ON 0x00000000
-#define VIA_GEC_LASTPIXEL_OFF 0x00100000
-#define VIA_GEC_X_MAJOR 0x00000000
-#define VIA_GEC_Y_MAJOR 0x00200000
-#define VIA_GEC_QUICK_START 0x00800000
-
-
-/* VIA_REG_GEMODE(0x04): GE mode */
-#define VIA_GEM_8bpp 0x00000000
-#define VIA_GEM_16bpp 0x00000100
-#define VIA_GEM_32bpp 0x00000300
-
-#define VIA_GEM_640 0x00000000 /* 640*480 */
-#define VIA_GEM_800 0x00000400 /* 800*600 */
-#define VIA_GEM_1024 0x00000800 /* 1024*768 */
-#define VIA_GEM_1280 0x00000C00 /* 1280*1024 */
-#define VIA_GEM_1600 0x00001000 /* 1600*1200 */
-#define VIA_GEM_2048 0x00001400 /* 2048*1536 */
-
-/* VIA_REG_PITCH(0x38): Pitch Setting */
-#define VIA_PITCH_ENABLE 0x80000000
-
-
-#define MAXLOOP 0xffffff
-
-
-#define VerticalRetraceWait() \
-{ \
- VGAOUT8(vgaCRIndex, 0x17); \
- if (VGAIN8(vgaCRReg) & 0x80) { \
- while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \
- while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x08) ; \
- while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \
- } \
-}
-
-
-#define VIASETREG(addr, data) *(volatile unsigned int *)(pVia->MapBase + (addr)) = (data)
-#define VIAGETREG(addr) *(volatile unsigned int *)(pVia->MapBase + (addr))
-
-
-#endif /* _VIA_REGS_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_3d_reg.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_3d_reg.h
deleted file mode 100644
index 77b24dc61..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_3d_reg.h
+++ /dev/null
@@ -1,1652 +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.
- */
-
-#ifndef VIA_3D_REG_H
-#define VIA_3D_REG_H
-#define HC_REG_BASE 0x0400
-
-#define HC_ParaN_MASK 0xffffffff
-#define HC_Para_MASK 0x00ffffff
-#define HC_SubA_MASK 0xff000000
-#define HC_SubA_SHIFT 24
-/* Transmission Setting
- */
-#define HC_REG_TRANS_SET 0x003c
-#define HC_ParaSubType_MASK 0xff000000
-#define HC_ParaType_MASK 0x00ff0000
-#define HC_ParaOS_MASK 0x0000ff00
-#define HC_ParaAdr_MASK 0x000000ff
-#define HC_ParaSubType_SHIFT 24
-#define HC_ParaType_SHIFT 16
-#define HC_ParaOS_SHIFT 8
-#define HC_ParaAdr_SHIFT 0
-
-#define HC_ParaType_CmdVdata 0x0000
-#define HC_ParaType_NotTex 0x0001
-#define HC_ParaType_Tex 0x0002
-#define HC_ParaType_Palette 0x0003
-#define HC_ParaType_PreCR 0x0010
-#define HC_ParaType_Auto 0x00fe
-
-/* Transmission Space
- */
-#define HC_REG_Hpara0 0x0040
-#define HC_REG_HpataAF 0x02fc
-
-/* Read
- */
-#define HC_REG_HREngSt 0x0000
-#define HC_REG_HRFIFOempty 0x0004
-#define HC_REG_HRFIFOfull 0x0008
-#define HC_REG_HRErr 0x000c
-#define HC_REG_FIFOstatus 0x0010
-/* HC_REG_HREngSt 0x0000
- */
-#define HC_HDASZC_MASK 0x00010000
-#define HC_HSGEMI_MASK 0x0000f000
-#define HC_HLGEMISt_MASK 0x00000f00
-#define HC_HCRSt_MASK 0x00000080
-#define HC_HSE0St_MASK 0x00000040
-#define HC_HSE1St_MASK 0x00000020
-#define HC_HPESt_MASK 0x00000010
-#define HC_HXESt_MASK 0x00000008
-#define HC_HBESt_MASK 0x00000004
-#define HC_HE2St_MASK 0x00000002
-#define HC_HE3St_MASK 0x00000001
-/* HC_REG_HRFIFOempty 0x0004
- */
-#define HC_HRZDempty_MASK 0x00000010
-#define HC_HRTXAempty_MASK 0x00000008
-#define HC_HRTXDempty_MASK 0x00000004
-#define HC_HWZDempty_MASK 0x00000002
-#define HC_HWCDempty_MASK 0x00000001
-/* HC_REG_HRFIFOfull 0x0008
- */
-#define HC_HRZDfull_MASK 0x00000010
-#define HC_HRTXAfull_MASK 0x00000008
-#define HC_HRTXDfull_MASK 0x00000004
-#define HC_HWZDfull_MASK 0x00000002
-#define HC_HWCDfull_MASK 0x00000001
-/* HC_REG_HRErr 0x000c
- */
-#define HC_HAGPCMErr_MASK 0x80000000
-#define HC_HAGPCMErrC_MASK 0x70000000
-/* HC_REG_FIFOstatus 0x0010
- */
-#define HC_HRFIFOATall_MASK 0x80000000
-#define HC_HRFIFOATbusy_MASK 0x40000000
-#define HC_HRATFGMDo_MASK 0x00000100
-#define HC_HRATFGMDi_MASK 0x00000080
-#define HC_HRATFRZD_MASK 0x00000040
-#define HC_HRATFRTXA_MASK 0x00000020
-#define HC_HRATFRTXD_MASK 0x00000010
-#define HC_HRATFWZD_MASK 0x00000008
-#define HC_HRATFWCD_MASK 0x00000004
-#define HC_HRATTXTAG_MASK 0x00000002
-#define HC_HRATTXCH_MASK 0x00000001
-
-/* AGP Command Setting
- */
-#define HC_SubA_HAGPBstL 0x0060
-#define HC_SubA_HAGPBendL 0x0061
-#define HC_SubA_HAGPCMNT 0x0062
-#define HC_SubA_HAGPBpL 0x0063
-#define HC_SubA_HAGPBpH 0x0064
-/* HC_SubA_HAGPCMNT 0x0062
- */
-#define HC_HAGPCMNT_MASK 0x00800000
-#define HC_HCmdErrClr_MASK 0x00400000
-#define HC_HAGPBendH_MASK 0x0000ff00
-#define HC_HAGPBstH_MASK 0x000000ff
-#define HC_HAGPBendH_SHIFT 8
-#define HC_HAGPBstH_SHIFT 0
-/* HC_SubA_HAGPBpL 0x0063
- */
-#define HC_HAGPBpL_MASK 0x00fffffc
-#define HC_HAGPBpID_MASK 0x00000003
-#define HC_HAGPBpID_PAUSE 0x00000000
-#define HC_HAGPBpID_JUMP 0x00000001
-#define HC_HAGPBpID_STOP 0x00000002
-/* HC_SubA_HAGPBpH 0x0064
- */
-#define HC_HAGPBpH_MASK 0x00ffffff
-
-/* Miscellaneous Settings
- */
-#define HC_SubA_HClipTB 0x0070
-#define HC_SubA_HClipLR 0x0071
-#define HC_SubA_HFPClipTL 0x0072
-#define HC_SubA_HFPClipBL 0x0073
-#define HC_SubA_HFPClipLL 0x0074
-#define HC_SubA_HFPClipRL 0x0075
-#define HC_SubA_HFPClipTBH 0x0076
-#define HC_SubA_HFPClipLRH 0x0077
-#define HC_SubA_HLP 0x0078
-#define HC_SubA_HLPRF 0x0079
-#define HC_SubA_HSolidCL 0x007a
-#define HC_SubA_HPixGC 0x007b
-#define HC_SubA_HSPXYOS 0x007c
-#define HC_SubA_HVertexCNT 0x007d
-
-#define HC_HClipT_MASK 0x00fff000
-#define HC_HClipT_SHIFT 12
-#define HC_HClipB_MASK 0x00000fff
-#define HC_HClipB_SHIFT 0
-#define HC_HClipL_MASK 0x00fff000
-#define HC_HClipL_SHIFT 12
-#define HC_HClipR_MASK 0x00000fff
-#define HC_HClipR_SHIFT 0
-#define HC_HFPClipBH_MASK 0x0000ff00
-#define HC_HFPClipBH_SHIFT 8
-#define HC_HFPClipTH_MASK 0x000000ff
-#define HC_HFPClipTH_SHIFT 0
-#define HC_HFPClipRH_MASK 0x0000ff00
-#define HC_HFPClipRH_SHIFT 8
-#define HC_HFPClipLH_MASK 0x000000ff
-#define HC_HFPClipLH_SHIFT 0
-#define HC_HSolidCH_MASK 0x000000ff
-#define HC_HPixGC_MASK 0x00800000
-#define HC_HSPXOS_MASK 0x00fff000
-#define HC_HSPXOS_SHIFT 12
-#define HC_HSPYOS_MASK 0x00000fff
-
-/* Command
- * Command A
- */
-#define HC_HCmdHeader_MASK 0xfe000000 /*0xffe00000*/
-#define HC_HE3Fire_MASK 0x00100000
-#define HC_HPMType_MASK 0x000f0000
-#define HC_HEFlag_MASK 0x0000e000
-#define HC_HShading_MASK 0x00001c00
-#define HC_HPMValidN_MASK 0x00000200
-#define HC_HPLEND_MASK 0x00000100
-#define HC_HVCycle_MASK 0x000000ff
-#define HC_HVCycle_Style_MASK 0x000000c0
-#define HC_HVCycle_ChgA_MASK 0x00000030
-#define HC_HVCycle_ChgB_MASK 0x0000000c
-#define HC_HVCycle_ChgC_MASK 0x00000003
-#define HC_HPMType_Point 0x00000000
-#define HC_HPMType_Line 0x00010000
-#define HC_HPMType_Tri 0x00020000
-#define HC_HPMType_TriWF 0x00040000
-#define HC_HEFlag_NoAA 0x00000000
-#define HC_HEFlag_ab 0x00008000
-#define HC_HEFlag_bc 0x00004000
-#define HC_HEFlag_ca 0x00002000
-#define HC_HShading_Solid 0x00000000
-#define HC_HShading_FlatA 0x00000400
-#define HC_HShading_FlatB 0x00000800
-#define HC_HShading_FlatC 0x00000c00
-#define HC_HShading_Gouraud 0x00001000
-#define HC_HVCycle_Full 0x00000000
-#define HC_HVCycle_AFP 0x00000040
-#define HC_HVCycle_One 0x000000c0
-#define HC_HVCycle_NewA 0x00000000
-#define HC_HVCycle_AA 0x00000010
-#define HC_HVCycle_AB 0x00000020
-#define HC_HVCycle_AC 0x00000030
-#define HC_HVCycle_NewB 0x00000000
-#define HC_HVCycle_BA 0x00000004
-#define HC_HVCycle_BB 0x00000008
-#define HC_HVCycle_BC 0x0000000c
-#define HC_HVCycle_NewC 0x00000000
-#define HC_HVCycle_CA 0x00000001
-#define HC_HVCycle_CB 0x00000002
-#define HC_HVCycle_CC 0x00000003
-
-/* Command B
- */
-#define HC_HLPrst_MASK 0x00010000
-#define HC_HLLastP_MASK 0x00008000
-#define HC_HVPMSK_MASK 0x00007f80
-#define HC_HBFace_MASK 0x00000040
-#define HC_H2nd1VT_MASK 0x0000003f
-#define HC_HVPMSK_X 0x00004000
-#define HC_HVPMSK_Y 0x00002000
-#define HC_HVPMSK_Z 0x00001000
-#define HC_HVPMSK_W 0x00000800
-#define HC_HVPMSK_Cd 0x00000400
-#define HC_HVPMSK_Cs 0x00000200
-#define HC_HVPMSK_S 0x00000100
-#define HC_HVPMSK_T 0x00000080
-
-/* Enable Setting
- */
-#define HC_SubA_HEnable 0x0000
-#define HC_HenTXEnvMap_MASK 0x00200000
-#define HC_HenVertexCNT_MASK 0x00100000
-#define HC_HenCPUDAZ_MASK 0x00080000
-#define HC_HenDASZWC_MASK 0x00040000
-#define HC_HenFBCull_MASK 0x00020000
-#define HC_HenCW_MASK 0x00010000
-#define HC_HenAA_MASK 0x00008000
-#define HC_HenST_MASK 0x00004000
-#define HC_HenZT_MASK 0x00002000
-#define HC_HenZW_MASK 0x00001000
-#define HC_HenAT_MASK 0x00000800
-#define HC_HenAW_MASK 0x00000400
-#define HC_HenSP_MASK 0x00000200
-#define HC_HenLP_MASK 0x00000100
-#define HC_HenTXCH_MASK 0x00000080
-#define HC_HenTXMP_MASK 0x00000040
-#define HC_HenTXPP_MASK 0x00000020
-#define HC_HenTXTR_MASK 0x00000010
-#define HC_HenCS_MASK 0x00000008
-#define HC_HenFOG_MASK 0x00000004
-#define HC_HenABL_MASK 0x00000002
-#define HC_HenDT_MASK 0x00000001
-
-/* Z Setting
- */
-#define HC_SubA_HZWBBasL 0x0010
-#define HC_SubA_HZWBBasH 0x0011
-#define HC_SubA_HZWBType 0x0012
-#define HC_SubA_HZBiasL 0x0013
-#define HC_SubA_HZWBend 0x0014
-#define HC_SubA_HZWTMD 0x0015
-#define HC_SubA_HZWCDL 0x0016
-#define HC_SubA_HZWCTAGnum 0x0017
-#define HC_SubA_HZCYNum 0x0018
-#define HC_SubA_HZWCFire 0x0019
-/* HC_SubA_HZWBType
- */
-#define HC_HZWBType_MASK 0x00800000
-#define HC_HZBiasedWB_MASK 0x00400000
-#define HC_HZONEasFF_MASK 0x00200000
-#define HC_HZOONEasFF_MASK 0x00100000
-#define HC_HZWBFM_MASK 0x00030000
-#define HC_HZWBLoc_MASK 0x0000c000
-#define HC_HZWBPit_MASK 0x00003fff
-#define HC_HZWBFM_16 0x00000000
-#define HC_HZWBFM_32 0x00020000
-#define HC_HZWBFM_24 0x00030000
-#define HC_HZWBLoc_Local 0x00000000
-#define HC_HZWBLoc_SyS 0x00004000
-/* HC_SubA_HZWBend
- */
-#define HC_HZWBend_MASK 0x00ffe000
-#define HC_HZBiasH_MASK 0x000000ff
-#define HC_HZWBend_SHIFT 10
-/* HC_SubA_HZWTMD
- */
-#define HC_HZWTMD_MASK 0x00070000
-#define HC_HEBEBias_MASK 0x00007f00
-#define HC_HZNF_MASK 0x000000ff
-#define HC_HZWTMD_NeverPass 0x00000000
-#define HC_HZWTMD_LT 0x00010000
-#define HC_HZWTMD_EQ 0x00020000
-#define HC_HZWTMD_LE 0x00030000
-#define HC_HZWTMD_GT 0x00040000
-#define HC_HZWTMD_NE 0x00050000
-#define HC_HZWTMD_GE 0x00060000
-#define HC_HZWTMD_AllPass 0x00070000
-#define HC_HEBEBias_SHIFT 8
-/* HC_SubA_HZWCDL 0x0016
- */
-#define HC_HZWCDL_MASK 0x00ffffff
-/* HC_SubA_HZWCTAGnum 0x0017
- */
-#define HC_HZWCTAGnum_MASK 0x00ff0000
-#define HC_HZWCTAGnum_SHIFT 16
-#define HC_HZWCDH_MASK 0x000000ff
-#define HC_HZWCDH_SHIFT 0
-/* HC_SubA_HZCYNum 0x0018
- */
-#define HC_HZCYNum_MASK 0x00030000
-#define HC_HZCYNum_SHIFT 16
-#define HC_HZWCQWnum_MASK 0x00003fff
-#define HC_HZWCQWnum_SHIFT 0
-/* HC_SubA_HZWCFire 0x0019
- */
-#define HC_ZWCFire_MASK 0x00010000
-#define HC_HZWCQWnumLast_MASK 0x00003fff
-#define HC_HZWCQWnumLast_SHIFT 0
-
-/* Stencil Setting
- */
-#define HC_SubA_HSTREF 0x0023
-#define HC_SubA_HSTMD 0x0024
-/* HC_SubA_HSBFM
- */
-#define HC_HSBFM_MASK 0x00030000
-#define HC_HSBLoc_MASK 0x0000c000
-#define HC_HSBPit_MASK 0x00003fff
-/* HC_SubA_HSTREF
- */
-#define HC_HSTREF_MASK 0x00ff0000
-#define HC_HSTOPMSK_MASK 0x0000ff00
-#define HC_HSTBMSK_MASK 0x000000ff
-#define HC_HSTREF_SHIFT 16
-#define HC_HSTOPMSK_SHIFT 8
-/* HC_SubA_HSTMD
- */
-#define HC_HSTMD_MASK 0x00070000
-#define HC_HSTOPSF_MASK 0x000001c0
-#define HC_HSTOPSPZF_MASK 0x00000038
-#define HC_HSTOPSPZP_MASK 0x00000007
-#define HC_HSTMD_NeverPass 0x00000000
-#define HC_HSTMD_LT 0x00010000
-#define HC_HSTMD_EQ 0x00020000
-#define HC_HSTMD_LE 0x00030000
-#define HC_HSTMD_GT 0x00040000
-#define HC_HSTMD_NE 0x00050000
-#define HC_HSTMD_GE 0x00060000
-#define HC_HSTMD_AllPass 0x00070000
-#define HC_HSTOPSF_KEEP 0x00000000
-#define HC_HSTOPSF_ZERO 0x00000040
-#define HC_HSTOPSF_REPLACE 0x00000080
-#define HC_HSTOPSF_INCRSAT 0x000000c0
-#define HC_HSTOPSF_DECRSAT 0x00000100
-#define HC_HSTOPSF_INVERT 0x00000140
-#define HC_HSTOPSF_INCR 0x00000180
-#define HC_HSTOPSF_DECR 0x000001c0
-#define HC_HSTOPSPZF_KEEP 0x00000000
-#define HC_HSTOPSPZF_ZERO 0x00000008
-#define HC_HSTOPSPZF_REPLACE 0x00000010
-#define HC_HSTOPSPZF_INCRSAT 0x00000018
-#define HC_HSTOPSPZF_DECRSAT 0x00000020
-#define HC_HSTOPSPZF_INVERT 0x00000028
-#define HC_HSTOPSPZF_INCR 0x00000030
-#define HC_HSTOPSPZF_DECR 0x00000038
-#define HC_HSTOPSPZP_KEEP 0x00000000
-#define HC_HSTOPSPZP_ZERO 0x00000001
-#define HC_HSTOPSPZP_REPLACE 0x00000002
-#define HC_HSTOPSPZP_INCRSAT 0x00000003
-#define HC_HSTOPSPZP_DECRSAT 0x00000004
-#define HC_HSTOPSPZP_INVERT 0x00000005
-#define HC_HSTOPSPZP_INCR 0x00000006
-#define HC_HSTOPSPZP_DECR 0x00000007
-
-/* Alpha Setting
- */
-#define HC_SubA_HABBasL 0x0030
-#define HC_SubA_HABBasH 0x0031
-#define HC_SubA_HABFM 0x0032
-#define HC_SubA_HATMD 0x0033
-#define HC_SubA_HABLCsat 0x0034
-#define HC_SubA_HABLCop 0x0035
-#define HC_SubA_HABLAsat 0x0036
-#define HC_SubA_HABLAop 0x0037
-#define HC_SubA_HABLRCa 0x0038
-#define HC_SubA_HABLRFCa 0x0039
-#define HC_SubA_HABLRCbias 0x003a
-#define HC_SubA_HABLRCb 0x003b
-#define HC_SubA_HABLRFCb 0x003c
-#define HC_SubA_HABLRAa 0x003d
-#define HC_SubA_HABLRAb 0x003e
-/* HC_SubA_HABFM
- */
-#define HC_HABFM_MASK 0x00030000
-#define HC_HABLoc_MASK 0x0000c000
-#define HC_HABPit_MASK 0x000007ff
-/* HC_SubA_HATMD
- */
-#define HC_HATMD_MASK 0x00000700
-#define HC_HATREF_MASK 0x000000ff
-#define HC_HATMD_NeverPass 0x00000000
-#define HC_HATMD_LT 0x00000100
-#define HC_HATMD_EQ 0x00000200
-#define HC_HATMD_LE 0x00000300
-#define HC_HATMD_GT 0x00000400
-#define HC_HATMD_NE 0x00000500
-#define HC_HATMD_GE 0x00000600
-#define HC_HATMD_AllPass 0x00000700
-/* HC_SubA_HABLCsat
- */
-#define HC_HABLCsat_MASK 0x00010000
-#define HC_HABLCa_MASK 0x0000fc00
-#define HC_HABLCa_C_MASK 0x0000c000
-#define HC_HABLCa_OPC_MASK 0x00003c00
-#define HC_HABLFCa_MASK 0x000003f0
-#define HC_HABLFCa_C_MASK 0x00000300
-#define HC_HABLFCa_OPC_MASK 0x000000f0
-#define HC_HABLCbias_MASK 0x0000000f
-#define HC_HABLCbias_C_MASK 0x00000008
-#define HC_HABLCbias_OPC_MASK 0x00000007
-/*-- Define the input color.
- */
-#define HC_XC_Csrc 0x00000000
-#define HC_XC_Cdst 0x00000001
-#define HC_XC_Asrc 0x00000002
-#define HC_XC_Adst 0x00000003
-#define HC_XC_Fog 0x00000004
-#define HC_XC_HABLRC 0x00000005
-#define HC_XC_minSrcDst 0x00000006
-#define HC_XC_maxSrcDst 0x00000007
-#define HC_XC_mimAsrcInvAdst 0x00000008
-#define HC_XC_OPC 0x00000000
-#define HC_XC_InvOPC 0x00000010
-#define HC_XC_OPCp5 0x00000020
-/*-- Define the input Alpha
- */
-#define HC_XA_OPA 0x00000000
-#define HC_XA_InvOPA 0x00000010
-#define HC_XA_OPAp5 0x00000020
-#define HC_XA_0 0x00000000
-#define HC_XA_Asrc 0x00000001
-#define HC_XA_Adst 0x00000002
-#define HC_XA_Fog 0x00000003
-#define HC_XA_minAsrcFog 0x00000004
-#define HC_XA_minAsrcAdst 0x00000005
-#define HC_XA_maxAsrcFog 0x00000006
-#define HC_XA_maxAsrcAdst 0x00000007
-#define HC_XA_HABLRA 0x00000008
-#define HC_XA_minAsrcInvAdst 0x00000008
-#define HC_XA_HABLFRA 0x00000009
-/*--
- */
-#define HC_HABLCa_OPC (HC_XC_OPC << 10)
-#define HC_HABLCa_InvOPC (HC_XC_InvOPC << 10)
-#define HC_HABLCa_OPCp5 (HC_XC_OPCp5 << 10)
-#define HC_HABLCa_Csrc (HC_XC_Csrc << 10)
-#define HC_HABLCa_Cdst (HC_XC_Cdst << 10)
-#define HC_HABLCa_Asrc (HC_XC_Asrc << 10)
-#define HC_HABLCa_Adst (HC_XC_Adst << 10)
-#define HC_HABLCa_Fog (HC_XC_Fog << 10)
-#define HC_HABLCa_HABLRCa (HC_XC_HABLRC << 10)
-#define HC_HABLCa_minSrcDst (HC_XC_minSrcDst << 10)
-#define HC_HABLCa_maxSrcDst (HC_XC_maxSrcDst << 10)
-#define HC_HABLFCa_OPC (HC_XC_OPC << 4)
-#define HC_HABLFCa_InvOPC (HC_XC_InvOPC << 4)
-#define HC_HABLFCa_OPCp5 (HC_XC_OPCp5 << 4)
-#define HC_HABLFCa_Csrc (HC_XC_Csrc << 4)
-#define HC_HABLFCa_Cdst (HC_XC_Cdst << 4)
-#define HC_HABLFCa_Asrc (HC_XC_Asrc << 4)
-#define HC_HABLFCa_Adst (HC_XC_Adst << 4)
-#define HC_HABLFCa_Fog (HC_XC_Fog << 4)
-#define HC_HABLFCa_HABLRCa (HC_XC_HABLRC << 4)
-#define HC_HABLFCa_minSrcDst (HC_XC_minSrcDst << 4)
-#define HC_HABLFCa_maxSrcDst (HC_XC_maxSrcDst << 4)
-#define HC_HABLFCa_mimAsrcInvAdst (HC_XC_mimAsrcInvAdst << 4)
-#define HC_HABLCbias_HABLRCbias 0x00000000
-#define HC_HABLCbias_Asrc 0x00000001
-#define HC_HABLCbias_Adst 0x00000002
-#define HC_HABLCbias_Fog 0x00000003
-#define HC_HABLCbias_Cin 0x00000004
-/* HC_SubA_HABLCop 0x0035
- */
-#define HC_HABLdot_MASK 0x00010000
-#define HC_HABLCop_MASK 0x00004000
-#define HC_HABLCb_MASK 0x00003f00
-#define HC_HABLCb_C_MASK 0x00003000
-#define HC_HABLCb_OPC_MASK 0x00000f00
-#define HC_HABLFCb_MASK 0x000000fc
-#define HC_HABLFCb_C_MASK 0x000000c0
-#define HC_HABLFCb_OPC_MASK 0x0000003c
-#define HC_HABLCshift_MASK 0x00000003
-#define HC_HABLCb_OPC (HC_XC_OPC << 8)
-#define HC_HABLCb_InvOPC (HC_XC_InvOPC << 8)
-#define HC_HABLCb_OPCp5 (HC_XC_OPCp5 << 8)
-#define HC_HABLCb_Csrc (HC_XC_Csrc << 8)
-#define HC_HABLCb_Cdst (HC_XC_Cdst << 8)
-#define HC_HABLCb_Asrc (HC_XC_Asrc << 8)
-#define HC_HABLCb_Adst (HC_XC_Adst << 8)
-#define HC_HABLCb_Fog (HC_XC_Fog << 8)
-#define HC_HABLCb_HABLRCa (HC_XC_HABLRC << 8)
-#define HC_HABLCb_minSrcDst (HC_XC_minSrcDst << 8)
-#define HC_HABLCb_maxSrcDst (HC_XC_maxSrcDst << 8)
-#define HC_HABLFCb_OPC (HC_XC_OPC << 2)
-#define HC_HABLFCb_InvOPC (HC_XC_InvOPC << 2)
-#define HC_HABLFCb_OPCp5 (HC_XC_OPCp5 << 2)
-#define HC_HABLFCb_Csrc (HC_XC_Csrc << 2)
-#define HC_HABLFCb_Cdst (HC_XC_Cdst << 2)
-#define HC_HABLFCb_Asrc (HC_XC_Asrc << 2)
-#define HC_HABLFCb_Adst (HC_XC_Adst << 2)
-#define HC_HABLFCb_Fog (HC_XC_Fog << 2)
-#define HC_HABLFCb_HABLRCb (HC_XC_HABLRC << 2)
-#define HC_HABLFCb_minSrcDst (HC_XC_minSrcDst << 2)
-#define HC_HABLFCb_maxSrcDst (HC_XC_maxSrcDst << 2)
-#define HC_HABLFCb_mimAsrcInvAdst (HC_XC_mimAsrcInvAdst << 2)
-/* HC_SubA_HABLAsat 0x0036
- */
-#define HC_HABLAsat_MASK 0x00010000
-#define HC_HABLAa_MASK 0x0000fc00
-#define HC_HABLAa_A_MASK 0x0000c000
-#define HC_HABLAa_OPA_MASK 0x00003c00
-#define HC_HABLFAa_MASK 0x000003f0
-#define HC_HABLFAa_A_MASK 0x00000300
-#define HC_HABLFAa_OPA_MASK 0x000000f0
-#define HC_HABLAbias_MASK 0x0000000f
-#define HC_HABLAbias_A_MASK 0x00000008
-#define HC_HABLAbias_OPA_MASK 0x00000007
-#define HC_HABLAa_OPA (HC_XA_OPA << 10)
-#define HC_HABLAa_InvOPA (HC_XA_InvOPA << 10)
-#define HC_HABLAa_OPAp5 (HC_XA_OPAp5 << 10)
-#define HC_HABLAa_0 (HC_XA_0 << 10)
-#define HC_HABLAa_Asrc (HC_XA_Asrc << 10)
-#define HC_HABLAa_Adst (HC_XA_Adst << 10)
-#define HC_HABLAa_Fog (HC_XA_Fog << 10)
-#define HC_HABLAa_minAsrcFog (HC_XA_minAsrcFog << 10)
-#define HC_HABLAa_minAsrcAdst (HC_XA_minAsrcAdst << 10)
-#define HC_HABLAa_maxAsrcFog (HC_XA_maxAsrcFog << 10)
-#define HC_HABLAa_maxAsrcAdst (HC_XA_maxAsrcAdst << 10)
-#define HC_HABLAa_HABLRA (HC_XA_HABLRA << 10)
-#define HC_HABLFAa_OPA (HC_XA_OPA << 4)
-#define HC_HABLFAa_InvOPA (HC_XA_InvOPA << 4)
-#define HC_HABLFAa_OPAp5 (HC_XA_OPAp5 << 4)
-#define HC_HABLFAa_0 (HC_XA_0 << 4)
-#define HC_HABLFAa_Asrc (HC_XA_Asrc << 4)
-#define HC_HABLFAa_Adst (HC_XA_Adst << 4)
-#define HC_HABLFAa_Fog (HC_XA_Fog << 4)
-#define HC_HABLFAa_minAsrcFog (HC_XA_minAsrcFog << 4)
-#define HC_HABLFAa_minAsrcAdst (HC_XA_minAsrcAdst << 4)
-#define HC_HABLFAa_maxAsrcFog (HC_XA_maxAsrcFog << 4)
-#define HC_HABLFAa_maxAsrcAdst (HC_XA_maxAsrcAdst << 4)
-#define HC_HABLFAa_minAsrcInvAdst (HC_XA_minAsrcInvAdst << 4)
-#define HC_HABLFAa_HABLFRA (HC_XA_HABLFRA << 4)
-#define HC_HABLAbias_HABLRAbias 0x00000000
-#define HC_HABLAbias_Asrc 0x00000001
-#define HC_HABLAbias_Adst 0x00000002
-#define HC_HABLAbias_Fog 0x00000003
-#define HC_HABLAbias_Aaa 0x00000004
-/* HC_SubA_HABLAop 0x0037
- */
-#define HC_HABLAop_MASK 0x00004000
-#define HC_HABLAb_MASK 0x00003f00
-#define HC_HABLAb_OPA_MASK 0x00000f00
-#define HC_HABLFAb_MASK 0x000000fc
-#define HC_HABLFAb_OPA_MASK 0x0000003c
-#define HC_HABLAshift_MASK 0x00000003
-#define HC_HABLAb_OPA (HC_XA_OPA << 8)
-#define HC_HABLAb_InvOPA (HC_XA_InvOPA << 8)
-#define HC_HABLAb_OPAp5 (HC_XA_OPAp5 << 8)
-#define HC_HABLAb_0 (HC_XA_0 << 8)
-#define HC_HABLAb_Asrc (HC_XA_Asrc << 8)
-#define HC_HABLAb_Adst (HC_XA_Adst << 8)
-#define HC_HABLAb_Fog (HC_XA_Fog << 8)
-#define HC_HABLAb_minAsrcFog (HC_XA_minAsrcFog << 8)
-#define HC_HABLAb_minAsrcAdst (HC_XA_minAsrcAdst << 8)
-#define HC_HABLAb_maxAsrcFog (HC_XA_maxAsrcFog << 8)
-#define HC_HABLAb_maxAsrcAdst (HC_XA_maxAsrcAdst << 8)
-#define HC_HABLAb_HABLRA (HC_XA_HABLRA << 8)
-#define HC_HABLFAb_OPA (HC_XA_OPA << 2)
-#define HC_HABLFAb_InvOPA (HC_XA_InvOPA << 2)
-#define HC_HABLFAb_OPAp5 (HC_XA_OPAp5 << 2)
-#define HC_HABLFAb_0 (HC_XA_0 << 2)
-#define HC_HABLFAb_Asrc (HC_XA_Asrc << 2)
-#define HC_HABLFAb_Adst (HC_XA_Adst << 2)
-#define HC_HABLFAb_Fog (HC_XA_Fog << 2)
-#define HC_HABLFAb_minAsrcFog (HC_XA_minAsrcFog << 2)
-#define HC_HABLFAb_minAsrcAdst (HC_XA_minAsrcAdst << 2)
-#define HC_HABLFAb_maxAsrcFog (HC_XA_maxAsrcFog << 2)
-#define HC_HABLFAb_maxAsrcAdst (HC_XA_maxAsrcAdst << 2)
-#define HC_HABLFAb_minAsrcInvAdst (HC_XA_minAsrcInvAdst << 2)
-#define HC_HABLFAb_HABLFRA (HC_XA_HABLFRA << 2)
-/* HC_SubA_HABLRAa 0x003d
- */
-#define HC_HABLRAa_MASK 0x00ff0000
-#define HC_HABLRFAa_MASK 0x0000ff00
-#define HC_HABLRAbias_MASK 0x000000ff
-#define HC_HABLRAa_SHIFT 16
-#define HC_HABLRFAa_SHIFT 8
-/* HC_SubA_HABLRAb 0x003e
- */
-#define HC_HABLRAb_MASK 0x0000ff00
-#define HC_HABLRFAb_MASK 0x000000ff
-#define HC_HABLRAb_SHIFT 8
-
-/* Destination Setting
- */
-#define HC_SubA_HDBBasL 0x0040
-#define HC_SubA_HDBBasH 0x0041
-#define HC_SubA_HDBFM 0x0042
-#define HC_SubA_HFBBMSKL 0x0043
-#define HC_SubA_HROP 0x0044
-/* HC_SubA_HDBFM 0x0042
- */
-#define HC_HDBFM_MASK 0x001f0000
-#define HC_HDBLoc_MASK 0x0000c000
-#define HC_HDBPit_MASK 0x00003fff
-#define HC_HDBFM_RGB555 0x00000000
-#define HC_HDBFM_RGB565 0x00010000
-#define HC_HDBFM_ARGB4444 0x00020000
-#define HC_HDBFM_ARGB1555 0x00030000
-#define HC_HDBFM_BGR555 0x00040000
-#define HC_HDBFM_BGR565 0x00050000
-#define HC_HDBFM_ABGR4444 0x00060000
-#define HC_HDBFM_ABGR1555 0x00070000
-#define HC_HDBFM_ARGB0888 0x00080000
-#define HC_HDBFM_ARGB8888 0x00090000
-#define HC_HDBFM_ABGR0888 0x000a0000
-#define HC_HDBFM_ABGR8888 0x000b0000
-#define HC_HDBLoc_Local 0x00000000
-#define HC_HDBLoc_Sys 0x00004000
-/* HC_SubA_HROP 0x0044
- */
-#define HC_HROP_MASK 0x00000f00
-#define HC_HFBBMSKH_MASK 0x000000ff
-#define HC_HROP_BLACK 0x00000000
-#define HC_HROP_DPon 0x00000100
-#define HC_HROP_DPna 0x00000200
-#define HC_HROP_Pn 0x00000300
-#define HC_HROP_PDna 0x00000400
-#define HC_HROP_Dn 0x00000500
-#define HC_HROP_DPx 0x00000600
-#define HC_HROP_DPan 0x00000700
-#define HC_HROP_DPa 0x00000800
-#define HC_HROP_DPxn 0x00000900
-#define HC_HROP_D 0x00000a00
-#define HC_HROP_DPno 0x00000b00
-#define HC_HROP_P 0x00000c00
-#define HC_HROP_PDno 0x00000d00
-#define HC_HROP_DPo 0x00000e00
-#define HC_HROP_WHITE 0x00000f00
-
-/* Fog Setting
- */
-#define HC_SubA_HFogLF 0x0050
-#define HC_SubA_HFogCL 0x0051
-#define HC_SubA_HFogCH 0x0052
-#define HC_SubA_HFogStL 0x0053
-#define HC_SubA_HFogStH 0x0054
-#define HC_SubA_HFogOOdMF 0x0055
-#define HC_SubA_HFogOOdEF 0x0056
-#define HC_SubA_HFogEndL 0x0057
-#define HC_SubA_HFogDenst 0x0058
-/* HC_SubA_FogLF 0x0050
- */
-#define HC_FogLF_MASK 0x00000010
-#define HC_FogEq_MASK 0x00000008
-#define HC_FogMD_MASK 0x00000007
-#define HC_FogMD_LocalFog 0x00000000
-#define HC_FogMD_LinearFog 0x00000002
-#define HC_FogMD_ExponentialFog 0x00000004
-#define HC_FogMD_Exponential2Fog 0x00000005
-/* #define HC_FogMD_FogTable 0x00000003 */
-
-/* HC_SubA_HFogDenst 0x0058
- */
-#define HC_FogDenst_MASK 0x001fff00
-#define HC_FogEndL_MASK 0x000000ff
-
-/* Texture subtype definitions
- */
-#define HC_SubType_Tex0 0x00000000
-#define HC_SubType_Tex1 0x00000001
-#define HC_SubType_TexGeneral 0x000000fe
-
-/* Attribute of texture n
- */
-#define HC_SubA_HTXnL0BasL 0x0000
-#define HC_SubA_HTXnL1BasL 0x0001
-#define HC_SubA_HTXnL2BasL 0x0002
-#define HC_SubA_HTXnL3BasL 0x0003
-#define HC_SubA_HTXnL4BasL 0x0004
-#define HC_SubA_HTXnL5BasL 0x0005
-#define HC_SubA_HTXnL6BasL 0x0006
-#define HC_SubA_HTXnL7BasL 0x0007
-#define HC_SubA_HTXnL8BasL 0x0008
-#define HC_SubA_HTXnL9BasL 0x0009
-#define HC_SubA_HTXnLaBasL 0x000a
-#define HC_SubA_HTXnLbBasL 0x000b
-#define HC_SubA_HTXnLcBasL 0x000c
-#define HC_SubA_HTXnLdBasL 0x000d
-#define HC_SubA_HTXnLeBasL 0x000e
-#define HC_SubA_HTXnLfBasL 0x000f
-#define HC_SubA_HTXnL10BasL 0x0010
-#define HC_SubA_HTXnL11BasL 0x0011
-#define HC_SubA_HTXnL012BasH 0x0020
-#define HC_SubA_HTXnL345BasH 0x0021
-#define HC_SubA_HTXnL678BasH 0x0022
-#define HC_SubA_HTXnL9abBasH 0x0023
-#define HC_SubA_HTXnLcdeBasH 0x0024
-#define HC_SubA_HTXnLf1011BasH 0x0025
-#define HC_SubA_HTXnL0Pit 0x002b
-#define HC_SubA_HTXnL1Pit 0x002c
-#define HC_SubA_HTXnL2Pit 0x002d
-#define HC_SubA_HTXnL3Pit 0x002e
-#define HC_SubA_HTXnL4Pit 0x002f
-#define HC_SubA_HTXnL5Pit 0x0030
-#define HC_SubA_HTXnL6Pit 0x0031
-#define HC_SubA_HTXnL7Pit 0x0032
-#define HC_SubA_HTXnL8Pit 0x0033
-#define HC_SubA_HTXnL9Pit 0x0034
-#define HC_SubA_HTXnLaPit 0x0035
-#define HC_SubA_HTXnLbPit 0x0036
-#define HC_SubA_HTXnLcPit 0x0037
-#define HC_SubA_HTXnLdPit 0x0038
-#define HC_SubA_HTXnLePit 0x0039
-#define HC_SubA_HTXnLfPit 0x003a
-#define HC_SubA_HTXnL10Pit 0x003b
-#define HC_SubA_HTXnL11Pit 0x003c
-#define HC_SubA_HTXnL0_5WE 0x004b
-#define HC_SubA_HTXnL6_bWE 0x004c
-#define HC_SubA_HTXnLc_11WE 0x004d
-#define HC_SubA_HTXnL0_5HE 0x0051
-#define HC_SubA_HTXnL6_bHE 0x0052
-#define HC_SubA_HTXnLc_11HE 0x0053
-#define HC_SubA_HTXnL0OS 0x0077
-#define HC_SubA_HTXnTB 0x0078
-#define HC_SubA_HTXnMPMD 0x0079
-#define HC_SubA_HTXnCLODu 0x007a
-#define HC_SubA_HTXnFM 0x007b
-#define HC_SubA_HTXnTRCH 0x007c
-#define HC_SubA_HTXnTRCL 0x007d
-#define HC_SubA_HTXnTBC 0x007e
-#define HC_SubA_HTXnTRAH 0x007f
-#define HC_SubA_HTXnTBLCsat 0x0080
-#define HC_SubA_HTXnTBLCop 0x0081
-#define HC_SubA_HTXnTBLMPfog 0x0082
-#define HC_SubA_HTXnTBLAsat 0x0083
-#define HC_SubA_HTXnTBLRCa 0x0085
-#define HC_SubA_HTXnTBLRCb 0x0086
-#define HC_SubA_HTXnTBLRCc 0x0087
-#define HC_SubA_HTXnTBLRCbias 0x0088
-#define HC_SubA_HTXnTBLRAa 0x0089
-#define HC_SubA_HTXnTBLRFog 0x008a
-#define HC_SubA_HTXnBumpM00 0x0090
-#define HC_SubA_HTXnBumpM01 0x0091
-#define HC_SubA_HTXnBumpM10 0x0092
-#define HC_SubA_HTXnBumpM11 0x0093
-#define HC_SubA_HTXnLScale 0x0094
-#define HC_SubA_HTXSMD 0x0000
-/* HC_SubA_HTXnL012BasH 0x0020
- */
-#define HC_HTXnL0BasH_MASK 0x000000ff
-#define HC_HTXnL1BasH_MASK 0x0000ff00
-#define HC_HTXnL2BasH_MASK 0x00ff0000
-#define HC_HTXnL1BasH_SHIFT 8
-#define HC_HTXnL2BasH_SHIFT 16
-/* HC_SubA_HTXnL345BasH 0x0021
- */
-#define HC_HTXnL3BasH_MASK 0x000000ff
-#define HC_HTXnL4BasH_MASK 0x0000ff00
-#define HC_HTXnL5BasH_MASK 0x00ff0000
-#define HC_HTXnL4BasH_SHIFT 8
-#define HC_HTXnL5BasH_SHIFT 16
-/* HC_SubA_HTXnL678BasH 0x0022
- */
-#define HC_HTXnL6BasH_MASK 0x000000ff
-#define HC_HTXnL7BasH_MASK 0x0000ff00
-#define HC_HTXnL8BasH_MASK 0x00ff0000
-#define HC_HTXnL7BasH_SHIFT 8
-#define HC_HTXnL8BasH_SHIFT 16
-/* HC_SubA_HTXnL9abBasH 0x0023
- */
-#define HC_HTXnL9BasH_MASK 0x000000ff
-#define HC_HTXnLaBasH_MASK 0x0000ff00
-#define HC_HTXnLbBasH_MASK 0x00ff0000
-#define HC_HTXnLaBasH_SHIFT 8
-#define HC_HTXnLbBasH_SHIFT 16
-/* HC_SubA_HTXnLcdeBasH 0x0024
- */
-#define HC_HTXnLcBasH_MASK 0x000000ff
-#define HC_HTXnLdBasH_MASK 0x0000ff00
-#define HC_HTXnLeBasH_MASK 0x00ff0000
-#define HC_HTXnLdBasH_SHIFT 8
-#define HC_HTXnLeBasH_SHIFT 16
-/* HC_SubA_HTXnLcdeBasH 0x0025
- */
-#define HC_HTXnLfBasH_MASK 0x000000ff
-#define HC_HTXnL10BasH_MASK 0x0000ff00
-#define HC_HTXnL11BasH_MASK 0x00ff0000
-#define HC_HTXnL10BasH_SHIFT 8
-#define HC_HTXnL11BasH_SHIFT 16
-/* HC_SubA_HTXnL0Pit 0x002b
- */
-#define HC_HTXnLnPit_MASK 0x00003fff
-#define HC_HTXnEnPit_MASK 0x00080000
-#define HC_HTXnLnPitE_MASK 0x00f00000
-#define HC_HTXnLnPitE_SHIFT 20
-/* HC_SubA_HTXnL0_5WE 0x004b
- */
-#define HC_HTXnL0WE_MASK 0x0000000f
-#define HC_HTXnL1WE_MASK 0x000000f0
-#define HC_HTXnL2WE_MASK 0x00000f00
-#define HC_HTXnL3WE_MASK 0x0000f000
-#define HC_HTXnL4WE_MASK 0x000f0000
-#define HC_HTXnL5WE_MASK 0x00f00000
-#define HC_HTXnL1WE_SHIFT 4
-#define HC_HTXnL2WE_SHIFT 8
-#define HC_HTXnL3WE_SHIFT 12
-#define HC_HTXnL4WE_SHIFT 16
-#define HC_HTXnL5WE_SHIFT 20
-/* HC_SubA_HTXnL6_bWE 0x004c
- */
-#define HC_HTXnL6WE_MASK 0x0000000f
-#define HC_HTXnL7WE_MASK 0x000000f0
-#define HC_HTXnL8WE_MASK 0x00000f00
-#define HC_HTXnL9WE_MASK 0x0000f000
-#define HC_HTXnLaWE_MASK 0x000f0000
-#define HC_HTXnLbWE_MASK 0x00f00000
-#define HC_HTXnL7WE_SHIFT 4
-#define HC_HTXnL8WE_SHIFT 8
-#define HC_HTXnL9WE_SHIFT 12
-#define HC_HTXnLaWE_SHIFT 16
-#define HC_HTXnLbWE_SHIFT 20
-/* HC_SubA_HTXnLc_11WE 0x004d
- */
-#define HC_HTXnLcWE_MASK 0x0000000f
-#define HC_HTXnLdWE_MASK 0x000000f0
-#define HC_HTXnLeWE_MASK 0x00000f00
-#define HC_HTXnLfWE_MASK 0x0000f000
-#define HC_HTXnL10WE_MASK 0x000f0000
-#define HC_HTXnL11WE_MASK 0x00f00000
-#define HC_HTXnLdWE_SHIFT 4
-#define HC_HTXnLeWE_SHIFT 8
-#define HC_HTXnLfWE_SHIFT 12
-#define HC_HTXnL10WE_SHIFT 16
-#define HC_HTXnL11WE_SHIFT 20
-/* HC_SubA_HTXnL0_5HE 0x0051
- */
-#define HC_HTXnL0HE_MASK 0x0000000f
-#define HC_HTXnL1HE_MASK 0x000000f0
-#define HC_HTXnL2HE_MASK 0x00000f00
-#define HC_HTXnL3HE_MASK 0x0000f000
-#define HC_HTXnL4HE_MASK 0x000f0000
-#define HC_HTXnL5HE_MASK 0x00f00000
-#define HC_HTXnL1HE_SHIFT 4
-#define HC_HTXnL2HE_SHIFT 8
-#define HC_HTXnL3HE_SHIFT 12
-#define HC_HTXnL4HE_SHIFT 16
-#define HC_HTXnL5HE_SHIFT 20
-/* HC_SubA_HTXnL6_bHE 0x0052
- */
-#define HC_HTXnL6HE_MASK 0x0000000f
-#define HC_HTXnL7HE_MASK 0x000000f0
-#define HC_HTXnL8HE_MASK 0x00000f00
-#define HC_HTXnL9HE_MASK 0x0000f000
-#define HC_HTXnLaHE_MASK 0x000f0000
-#define HC_HTXnLbHE_MASK 0x00f00000
-#define HC_HTXnL7HE_SHIFT 4
-#define HC_HTXnL8HE_SHIFT 8
-#define HC_HTXnL9HE_SHIFT 12
-#define HC_HTXnLaHE_SHIFT 16
-#define HC_HTXnLbHE_SHIFT 20
-/* HC_SubA_HTXnLc_11HE 0x0053
- */
-#define HC_HTXnLcHE_MASK 0x0000000f
-#define HC_HTXnLdHE_MASK 0x000000f0
-#define HC_HTXnLeHE_MASK 0x00000f00
-#define HC_HTXnLfHE_MASK 0x0000f000
-#define HC_HTXnL10HE_MASK 0x000f0000
-#define HC_HTXnL11HE_MASK 0x00f00000
-#define HC_HTXnLdHE_SHIFT 4
-#define HC_HTXnLeHE_SHIFT 8
-#define HC_HTXnLfHE_SHIFT 12
-#define HC_HTXnL10HE_SHIFT 16
-#define HC_HTXnL11HE_SHIFT 20
-/* HC_SubA_HTXnL0OS 0x0077
- */
-#define HC_HTXnL0OS_MASK 0x003ff000
-#define HC_HTXnLVmax_MASK 0x00000fc0
-#define HC_HTXnLVmin_MASK 0x0000003f
-#define HC_HTXnL0OS_SHIFT 12
-#define HC_HTXnLVmax_SHIFT 6
-/* HC_SubA_HTXnTB 0x0078
- */
-#define HC_HTXnTB_MASK 0x00f00000
-#define HC_HTXnFLSe_MASK 0x0000e000
-#define HC_HTXnFLSs_MASK 0x00001c00
-#define HC_HTXnFLTe_MASK 0x00000380
-#define HC_HTXnFLTs_MASK 0x00000070
-#define HC_HTXnFLDs_MASK 0x0000000f
-#define HC_HTXnTB_NoTB 0x00000000
-#define HC_HTXnTB_TBC_S 0x00100000
-#define HC_HTXnTB_TBC_T 0x00200000
-#define HC_HTXnTB_TB_S 0x00400000
-#define HC_HTXnTB_TB_T 0x00800000
-
-/* The "S" in FLS? means the S texture coordinate, and a "T" means the T
- * texture coordinage. The "e" in FL?e means the magnification ("enlarge")
- * mode, and the "s" in FL?s means the minification ("shrink") mode.
- *
- * The "D" in FLD? means the intermipmap level mode. That means that the
- * GL_*_MIPMAP_LINEAR modes get FLDs_Linear, and the GL_*_MIPMAP_NEAREST modes
- * get FLDs_Nearest.
- */
-#define HC_HTXnFLSe_Nearest 0x00000000
-#define HC_HTXnFLSe_Linear 0x00002000
-#define HC_HTXnFLSe_NonLinear 0x00004000
-#define HC_HTXnFLSe_Sharp 0x00008000
-#define HC_HTXnFLSe_Flat_Gaussian_Cubic 0x0000c000
-#define HC_HTXnFLSs_Nearest 0x00000000
-#define HC_HTXnFLSs_Linear 0x00000400
-#define HC_HTXnFLSs_NonLinear 0x00000800
-#define HC_HTXnFLSs_Flat_Gaussian_Cubic 0x00001800
-#define HC_HTXnFLTe_Nearest 0x00000000
-#define HC_HTXnFLTe_Linear 0x00000080
-#define HC_HTXnFLTe_NonLinear 0x00000100
-#define HC_HTXnFLTe_Sharp 0x00000180
-#define HC_HTXnFLTe_Flat_Gaussian_Cubic 0x00000300
-#define HC_HTXnFLTs_Nearest 0x00000000
-#define HC_HTXnFLTs_Linear 0x00000010
-#define HC_HTXnFLTs_NonLinear 0x00000020
-#define HC_HTXnFLTs_Flat_Gaussian_Cubic 0x00000060
-#define HC_HTXnFLDs_Tex0 0x00000000
-#define HC_HTXnFLDs_Nearest 0x00000001
-#define HC_HTXnFLDs_Linear 0x00000002
-#define HC_HTXnFLDs_NonLinear 0x00000003
-#define HC_HTXnFLDs_Dither 0x00000004
-#define HC_HTXnFLDs_ConstLOD 0x00000005
-#define HC_HTXnFLDs_Ani 0x00000006
-#define HC_HTXnFLDs_AniDither 0x00000007
-
-/* HC_SubA_HTXnMPMD 0x0079
- */
-#define HC_HTXnMPMD_SMASK 0x00070000
-#define HC_HTXnMPMD_TMASK 0x00380000
-#define HC_HTXnLODDTf_MASK 0x00000007
-#define HC_HTXnXY2ST_MASK 0x00000008
-#define HC_HTXnMPMD_Tsingle 0x00000000
-#define HC_HTXnMPMD_Tclamp 0x00080000
-#define HC_HTXnMPMD_Trepeat 0x00100000
-#define HC_HTXnMPMD_Tmirror 0x00180000
-#define HC_HTXnMPMD_Twrap 0x00200000
-#define HC_HTXnMPMD_Ssingle 0x00000000
-#define HC_HTXnMPMD_Sclamp 0x00010000
-#define HC_HTXnMPMD_Srepeat 0x00020000
-#define HC_HTXnMPMD_Smirror 0x00030000
-#define HC_HTXnMPMD_Swrap 0x00040000
-/* HC_SubA_HTXnCLODu 0x007a
- */
-#define HC_HTXnCLODu_MASK 0x000ffc00
-#define HC_HTXnCLODd_MASK 0x000003ff
-#define HC_HTXnCLODu_SHIFT 10
-/* HC_SubA_HTXnFM 0x007b
- */
-#define HC_HTXnFM_MASK 0x00ff0000
-#define HC_HTXnLoc_MASK 0x00000003
-#define HC_HTXnFM_INDEX 0x00000000 /* 0 << 19 */
-#define HC_HTXnFM_Intensity 0x00080000 /* 1 << 19 */
-#define HC_HTXnFM_Lum 0x00100000 /* 2 << 19 */
-#define HC_HTXnFM_Alpha 0x00180000 /* 3 << 19 */
-#define HC_HTXnFM_DX 0x00280000 /* 5 << 19 */
-#define HC_HTXnFM_BUMPMAP 0x00380000 /* 7 << 19 */
-#define HC_HTXnFM_ARGB16 0x00880000 /* 17 << 19 */
-#define HC_HTXnFM_ARGB32 0x00980000 /* 19 << 19 */
-#define HC_HTXnFM_ABGR16 0x00a80000 /* 21 << 19 */
-#define HC_HTXnFM_ABGR32 0x00b80000 /* 23 << 19 */
-#define HC_HTXnFM_RGBA16 0x00c80000 /* 25 << 19 */
-#define HC_HTXnFM_RGBA32 0x00d80000 /* 27 << 19 */
-#define HC_HTXnFM_BGRA16 0x00e80000 /* 29 << 19 */
-#define HC_HTXnFM_BGRA32 0x00f80000 /* 31 << 19 */
-#define HC_HTXnFM_Index1 (HC_HTXnFM_INDEX | 0x00000000)
-#define HC_HTXnFM_Index2 (HC_HTXnFM_INDEX | 0x00010000)
-#define HC_HTXnFM_Index4 (HC_HTXnFM_INDEX | 0x00020000)
-#define HC_HTXnFM_Index8 (HC_HTXnFM_INDEX | 0x00030000)
-#define HC_HTXnFM_T1 (HC_HTXnFM_Intensity | 0x00000000)
-#define HC_HTXnFM_T2 (HC_HTXnFM_Intensity | 0x00010000)
-#define HC_HTXnFM_T4 (HC_HTXnFM_Intensity | 0x00020000)
-#define HC_HTXnFM_T8 (HC_HTXnFM_Intensity | 0x00030000)
-#define HC_HTXnFM_L1 (HC_HTXnFM_Lum | 0x00000000)
-#define HC_HTXnFM_L2 (HC_HTXnFM_Lum | 0x00010000)
-#define HC_HTXnFM_L4 (HC_HTXnFM_Lum | 0x00020000)
-#define HC_HTXnFM_L8 (HC_HTXnFM_Lum | 0x00030000)
-#define HC_HTXnFM_AL44 (HC_HTXnFM_Lum | 0x00040000)
-#define HC_HTXnFM_AL88 (HC_HTXnFM_Lum | 0x00050000)
-#define HC_HTXnFM_A1 (HC_HTXnFM_Alpha | 0x00000000)
-#define HC_HTXnFM_A2 (HC_HTXnFM_Alpha | 0x00010000)
-#define HC_HTXnFM_A4 (HC_HTXnFM_Alpha | 0x00020000)
-#define HC_HTXnFM_A8 (HC_HTXnFM_Alpha | 0x00030000)
-#define HC_HTXnFM_DX1 (HC_HTXnFM_DX | 0x00010000)
-#define HC_HTXnFM_DX23 (HC_HTXnFM_DX | 0x00020000)
-#define HC_HTXnFM_DX45 (HC_HTXnFM_DX | 0x00030000)
-#define HC_HTXnFM_RGB555 (HC_HTXnFM_ARGB16 | 0x00000000)
-#define HC_HTXnFM_RGB565 (HC_HTXnFM_ARGB16 | 0x00010000)
-#define HC_HTXnFM_ARGB1555 (HC_HTXnFM_ARGB16 | 0x00020000)
-#define HC_HTXnFM_ARGB4444 (HC_HTXnFM_ARGB16 | 0x00030000)
-#define HC_HTXnFM_ARGB0888 (HC_HTXnFM_ARGB32 | 0x00000000)
-#define HC_HTXnFM_ARGB8888 (HC_HTXnFM_ARGB32 | 0x00010000)
-#define HC_HTXnFM_BGR555 (HC_HTXnFM_ABGR16 | 0x00000000)
-#define HC_HTXnFM_BGR565 (HC_HTXnFM_ABGR16 | 0x00010000)
-#define HC_HTXnFM_ABGR1555 (HC_HTXnFM_ABGR16 | 0x00020000)
-#define HC_HTXnFM_ABGR4444 (HC_HTXnFM_ABGR16 | 0x00030000)
-#define HC_HTXnFM_ABGR0888 (HC_HTXnFM_ABGR32 | 0x00000000)
-#define HC_HTXnFM_ABGR8888 (HC_HTXnFM_ABGR32 | 0x00010000)
-#define HC_HTXnFM_RGBA5550 (HC_HTXnFM_RGBA16 | 0x00000000)
-#define HC_HTXnFM_RGBA5551 (HC_HTXnFM_RGBA16 | 0x00020000)
-#define HC_HTXnFM_RGBA4444 (HC_HTXnFM_RGBA16 | 0x00030000)
-#define HC_HTXnFM_RGBA8880 (HC_HTXnFM_RGBA32 | 0x00000000)
-#define HC_HTXnFM_RGBA8888 (HC_HTXnFM_RGBA32 | 0x00010000)
-#define HC_HTXnFM_BGRA5550 (HC_HTXnFM_BGRA16 | 0x00000000)
-#define HC_HTXnFM_BGRA5551 (HC_HTXnFM_BGRA16 | 0x00020000)
-#define HC_HTXnFM_BGRA4444 (HC_HTXnFM_BGRA16 | 0x00030000)
-#define HC_HTXnFM_BGRA8880 (HC_HTXnFM_BGRA32 | 0x00000000)
-#define HC_HTXnFM_BGRA8888 (HC_HTXnFM_BGRA32 | 0x00010000)
-#define HC_HTXnFM_VU88 (HC_HTXnFM_BUMPMAP | 0x00000000)
-#define HC_HTXnFM_LVU655 (HC_HTXnFM_BUMPMAP | 0x00010000)
-#define HC_HTXnFM_LVU888 (HC_HTXnFM_BUMPMAP | 0x00020000)
-#define HC_HTXnLoc_Local 0x00000000
-#define HC_HTXnLoc_Sys 0x00000002
-#define HC_HTXnLoc_AGP 0x00000003
-/* HC_SubA_HTXnTRAH 0x007f
- */
-#define HC_HTXnTRAH_MASK 0x00ff0000
-#define HC_HTXnTRAL_MASK 0x0000ff00
-#define HC_HTXnTBA_MASK 0x000000ff
-#define HC_HTXnTRAH_SHIFT 16
-#define HC_HTXnTRAL_SHIFT 8
-
-/*-- Define the input texture, for below
- */
-#define HC_XTC_TOPC 0x00000000
-#define HC_XTC_InvTOPC 0x00000010
-#define HC_XTC_TOPCp5 0x00000020
-#define HC_XTC_Cbias 0x00000000
-#define HC_XTC_InvCbias 0x00000010
-#define HC_XTC_0 0x00000000
-#define HC_XTC_Dif 0x00000001
-#define HC_XTC_Spec 0x00000002
-#define HC_XTC_Tex 0x00000003
-#define HC_XTC_Cur 0x00000004
-#define HC_XTC_Adif 0x00000005
-#define HC_XTC_Fog 0x00000006
-#define HC_XTC_Atex 0x00000007
-#define HC_XTC_Acur 0x00000008
-#define HC_XTC_HTXnTBLRC 0x00000009
-#define HC_XTC_Ctexnext 0x0000000a
-/** HC_SubA_HTXnTBLCsat 0x0080
- */
-#define HC_HTXnTBLCsat_MASK 0x00800000
-#define HC_HTXnTBLCa_MASK 0x000fc000
-#define HC_HTXnTBLCb_MASK 0x00001f80
-#define HC_HTXnTBLCc_MASK 0x0000003f
-#define HC_HTXnTBLCa_TOPC (HC_XTC_TOPC << 14)
-#define HC_HTXnTBLCa_InvTOPC (HC_XTC_InvTOPC << 14)
-#define HC_HTXnTBLCa_TOPCp5 (HC_XTC_TOPCp5 << 14)
-#define HC_HTXnTBLCa_0 (HC_XTC_0 << 14)
-#define HC_HTXnTBLCa_Dif (HC_XTC_Dif << 14)
-#define HC_HTXnTBLCa_Spec (HC_XTC_Spec << 14)
-#define HC_HTXnTBLCa_Tex (HC_XTC_Tex << 14)
-#define HC_HTXnTBLCa_Cur (HC_XTC_Cur << 14)
-#define HC_HTXnTBLCa_Adif (HC_XTC_Adif << 14)
-#define HC_HTXnTBLCa_Fog (HC_XTC_Fog << 14)
-#define HC_HTXnTBLCa_Atex (HC_XTC_Atex << 14)
-#define HC_HTXnTBLCa_Acur (HC_XTC_Acur << 14)
-#define HC_HTXnTBLCa_HTXnTBLRC (HC_XTC_HTXnTBLRC << 14)
-#define HC_HTXnTBLCa_Ctexnext (HC_XTC_Ctexnext << 14)
-#define HC_HTXnTBLCb_TOPC (HC_XTC_TOPC << 7)
-#define HC_HTXnTBLCb_InvTOPC (HC_XTC_InvTOPC << 7)
-#define HC_HTXnTBLCb_TOPCp5 (HC_XTC_TOPCp5 << 7)
-#define HC_HTXnTBLCb_0 (HC_XTC_0 << 7)
-#define HC_HTXnTBLCb_Dif (HC_XTC_Dif << 7)
-#define HC_HTXnTBLCb_Spec (HC_XTC_Spec << 7)
-#define HC_HTXnTBLCb_Tex (HC_XTC_Tex << 7)
-#define HC_HTXnTBLCb_Cur (HC_XTC_Cur << 7)
-#define HC_HTXnTBLCb_Adif (HC_XTC_Adif << 7)
-#define HC_HTXnTBLCb_Fog (HC_XTC_Fog << 7)
-#define HC_HTXnTBLCb_Atex (HC_XTC_Atex << 7)
-#define HC_HTXnTBLCb_Acur (HC_XTC_Acur << 7)
-#define HC_HTXnTBLCb_HTXnTBLRC (HC_XTC_HTXnTBLRC << 7)
-#define HC_HTXnTBLCb_Ctexnext (HC_XTC_Ctexnext << 7)
-#define HC_HTXnTBLCc_TOPC (HC_XTC_TOPC << 0)
-#define HC_HTXnTBLCc_InvTOPC (HC_XTC_InvTOPC << 0)
-#define HC_HTXnTBLCc_TOPCp5 (HC_XTC_TOPCp5 << 0)
-#define HC_HTXnTBLCc_0 (HC_XTC_0 << 0)
-#define HC_HTXnTBLCc_Dif (HC_XTC_Dif << 0)
-#define HC_HTXnTBLCc_Spec (HC_XTC_Spec << 0)
-#define HC_HTXnTBLCc_Tex (HC_XTC_Tex << 0)
-#define HC_HTXnTBLCc_Cur (HC_XTC_Cur << 0)
-#define HC_HTXnTBLCc_Adif (HC_XTC_Adif << 0)
-#define HC_HTXnTBLCc_Fog (HC_XTC_Fog << 0)
-#define HC_HTXnTBLCc_Atex (HC_XTC_Atex << 0)
-#define HC_HTXnTBLCc_Acur (HC_XTC_Acur << 0)
-#define HC_HTXnTBLCc_HTXnTBLRC (HC_XTC_HTXnTBLRC << 0)
-#define HC_HTXnTBLCc_Ctexnext (HC_XTC_Ctexnext << 0)
-/* HC_SubA_HTXnTBLCop 0x0081
- */
-#define HC_HTXnTBLdot_MASK 0x00c00000
-#define HC_HTXnTBLCop_MASK 0x00380000
-#define HC_HTXnTBLCbias_MASK 0x0007c000
-#define HC_HTXnTBLCshift_MASK 0x00001800
-#define HC_HTXnTBLAop_MASK 0x00000380
-#define HC_HTXnTBLAbias_MASK 0x00000078
-#define HC_HTXnTBLAshift_MASK 0x00000003
-#define HC_HTXnTBLDOT3 0x00800000
-#define HC_HTXnTBLDOT4 0x00c00000
-#define HC_HTXnTBLCop_Add 0x00000000
-#define HC_HTXnTBLCop_Sub 0x00080000
-#define HC_HTXnTBLCop_Min 0x00100000
-#define HC_HTXnTBLCop_Max 0x00180000
-#define HC_HTXnTBLCop_Mask 0x00200000
-#define HC_HTXnTBLCbias_Cbias (HC_XTC_Cbias << 14)
-#define HC_HTXnTBLCbias_InvCbias (HC_XTC_InvCbias << 14)
-#define HC_HTXnTBLCbias_0 (HC_XTC_0 << 14)
-#define HC_HTXnTBLCbias_Dif (HC_XTC_Dif << 14)
-#define HC_HTXnTBLCbias_Spec (HC_XTC_Spec << 14)
-#define HC_HTXnTBLCbias_Tex (HC_XTC_Tex << 14)
-#define HC_HTXnTBLCbias_Cur (HC_XTC_Cur << 14)
-#define HC_HTXnTBLCbias_Adif (HC_XTC_Adif << 14)
-#define HC_HTXnTBLCbias_Fog (HC_XTC_Fog << 14)
-#define HC_HTXnTBLCbias_Atex (HC_XTC_Atex << 14)
-#define HC_HTXnTBLCbias_Acur (HC_XTC_Acur << 14)
-#define HC_HTXnTBLCbias_HTXnTBLRC (HC_XTC_HTXnTBLRC << 14)
-#define HC_HTXnTBLCshift_1 0x00000000
-#define HC_HTXnTBLCshift_2 0x00000800
-#define HC_HTXnTBLCshift_No 0x00001000
-#define HC_HTXnTBLCshift_DotP 0x00001800
-#define HC_HTXnTBLAop_Add 0x00000000
-#define HC_HTXnTBLAop_Sub 0x00000080
-#define HC_HTXnTBLAop_Min 0x00000100
-#define HC_HTXnTBLAop_Max 0x00000180
-#define HC_HTXnTBLAop_Mask 0x00000200
-#define HC_HTXnTBLAbias_Inv 0x00000040
-#define HC_HTXnTBLAbias_Adif 0x00000000
-#define HC_HTXnTBLAbias_Fog 0x00000008
-#define HC_HTXnTBLAbias_Acur 0x00000010
-#define HC_HTXnTBLAbias_HTXnTBLRAbias 0x00000018
-#define HC_HTXnTBLAbias_Atex 0x00000020
-#define HC_HTXnTBLAshift_1 0x00000000
-#define HC_HTXnTBLAshift_2 0x00000001
-#define HC_HTXnTBLAshift_No 0x00000002
-#define HC_HTXnTBLAshift_DotP 0x00000003
-/* HC_SubA_HTXnTBLMPFog 0x0082
- */
-#define HC_HTXnTBLMPfog_MASK 0x00e00000
-#define HC_HTXnTBLMPfog_0 0x00000000
-#define HC_HTXnTBLMPfog_Adif 0x00200000
-#define HC_HTXnTBLMPfog_Fog 0x00400000
-#define HC_HTXnTBLMPfog_Atex 0x00600000
-#define HC_HTXnTBLMPfog_Acur 0x00800000
-#define HC_HTXnTBLMPfog_GHTXnTBLRFog 0x00a00000
-/* HC_SubA_HTXnTBLAsat 0x0083
- *-- Define the texture alpha input.
- */
-#define HC_XTA_TOPA 0x00000000
-#define HC_XTA_InvTOPA 0x00000008
-#define HC_XTA_TOPAp5 0x00000010
-#define HC_XTA_Adif 0x00000000
-#define HC_XTA_Fog 0x00000001
-#define HC_XTA_Acur 0x00000002
-#define HC_XTA_HTXnTBLRA 0x00000003
-#define HC_XTA_Atex 0x00000004
-#define HC_XTA_Atexnext 0x00000005
-/*--
- */
-#define HC_HTXnTBLAsat_MASK 0x00800000
-#define HC_HTXnTBLAMB_MASK 0x00700000
-#define HC_HTXnTBLAa_MASK 0x0007c000
-#define HC_HTXnTBLAb_MASK 0x00000f80
-#define HC_HTXnTBLAc_MASK 0x0000001f
-#define HC_HTXnTBLAMB_SHIFT 20
-#define HC_HTXnTBLAa_TOPA (HC_XTA_TOPA << 14)
-#define HC_HTXnTBLAa_InvTOPA (HC_XTA_InvTOPA << 14)
-#define HC_HTXnTBLAa_TOPAp5 (HC_XTA_TOPAp5 << 14)
-#define HC_HTXnTBLAa_Adif (HC_XTA_Adif << 14)
-#define HC_HTXnTBLAa_Fog (HC_XTA_Fog << 14)
-#define HC_HTXnTBLAa_Acur (HC_XTA_Acur << 14)
-#define HC_HTXnTBLAa_HTXnTBLRA (HC_XTA_HTXnTBLRA << 14)
-#define HC_HTXnTBLAa_Atex (HC_XTA_Atex << 14)
-#define HC_HTXnTBLAa_Atexnext (HC_XTA_Atexnext << 14)
-#define HC_HTXnTBLAb_TOPA (HC_XTA_TOPA << 7)
-#define HC_HTXnTBLAb_InvTOPA (HC_XTA_InvTOPA << 7)
-#define HC_HTXnTBLAb_TOPAp5 (HC_XTA_TOPAp5 << 7)
-#define HC_HTXnTBLAb_Adif (HC_XTA_Adif << 7)
-#define HC_HTXnTBLAb_Fog (HC_XTA_Fog << 7)
-#define HC_HTXnTBLAb_Acur (HC_XTA_Acur << 7)
-#define HC_HTXnTBLAb_HTXnTBLRA (HC_XTA_HTXnTBLRA << 7)
-#define HC_HTXnTBLAb_Atex (HC_XTA_Atex << 7)
-#define HC_HTXnTBLAb_Atexnext (HC_XTA_Atexnext << 7)
-#define HC_HTXnTBLAc_TOPA (HC_XTA_TOPA << 0)
-#define HC_HTXnTBLAc_InvTOPA (HC_XTA_InvTOPA << 0)
-#define HC_HTXnTBLAc_TOPAp5 (HC_XTA_TOPAp5 << 0)
-#define HC_HTXnTBLAc_Adif (HC_XTA_Adif << 0)
-#define HC_HTXnTBLAc_Fog (HC_XTA_Fog << 0)
-#define HC_HTXnTBLAc_Acur (HC_XTA_Acur << 0)
-#define HC_HTXnTBLAc_HTXnTBLRA (HC_XTA_HTXnTBLRA << 0)
-#define HC_HTXnTBLAc_Atex (HC_XTA_Atex << 0)
-#define HC_HTXnTBLAc_Atexnext (HC_XTA_Atexnext << 0)
-/* HC_SubA_HTXnTBLRAa 0x0089
- */
-#define HC_HTXnTBLRAa_MASK 0x00ff0000
-#define HC_HTXnTBLRAb_MASK 0x0000ff00
-#define HC_HTXnTBLRAc_MASK 0x000000ff
-#define HC_HTXnTBLRAa_SHIFT 16
-#define HC_HTXnTBLRAb_SHIFT 8
-#define HC_HTXnTBLRAc_SHIFT 0
-/* HC_SubA_HTXnTBLRFog 0x008a
- */
-#define HC_HTXnTBLRFog_MASK 0x0000ff00
-#define HC_HTXnTBLRAbias_MASK 0x000000ff
-#define HC_HTXnTBLRFog_SHIFT 8
-#define HC_HTXnTBLRAbias_SHIFT 0
-/* HC_SubA_HTXnLScale 0x0094
- */
-#define HC_HTXnLScale_MASK 0x0007fc00
-#define HC_HTXnLOff_MASK 0x000001ff
-#define HC_HTXnLScale_SHIFT 10
-/* HC_SubA_HTXSMD 0x0000
- */
-#define HC_HTXSMD_MASK 0x00000080
-#define HC_HTXTMD_MASK 0x00000040
-#define HC_HTXNum_MASK 0x00000038
-#define HC_HTXTRMD_MASK 0x00000006
-#define HC_HTXCHCLR_MASK 0x00000001
-#define HC_HTXNum_SHIFT 3
-
-/* Texture Palette n
- */
-#define HC_SubType_TexPalette0 0x00000000
-#define HC_SubType_TexPalette1 0x00000001
-#define HC_SubType_FogTable 0x00000010
-#define HC_SubType_Stipple 0x00000014
-/* HC_SubA_TexPalette0 0x0000
- */
-#define HC_HTPnA_MASK 0xff000000
-#define HC_HTPnR_MASK 0x00ff0000
-#define HC_HTPnG_MASK 0x0000ff00
-#define HC_HTPnB_MASK 0x000000ff
-/* HC_SubA_FogTable 0x0010
- */
-#define HC_HFPn3_MASK 0xff000000
-#define HC_HFPn2_MASK 0x00ff0000
-#define HC_HFPn1_MASK 0x0000ff00
-#define HC_HFPn_MASK 0x000000ff
-#define HC_HFPn3_SHIFT 24
-#define HC_HFPn2_SHIFT 16
-#define HC_HFPn1_SHIFT 8
-
-/* Auto Testing & Security
- */
-#define HC_SubA_HenFIFOAT 0x0000
-#define HC_SubA_HFBDrawFirst 0x0004
-#define HC_SubA_HFBBasL 0x0005
-#define HC_SubA_HFBDst 0x0006
-/* HC_SubA_HenFIFOAT 0x0000
- */
-#define HC_HenFIFOAT_MASK 0x00000020
-#define HC_HenGEMILock_MASK 0x00000010
-#define HC_HenFBASwap_MASK 0x00000008
-#define HC_HenOT_MASK 0x00000004
-#define HC_HenCMDQ_MASK 0x00000002
-#define HC_HenTXCTSU_MASK 0x00000001
-/* HC_SubA_HFBDrawFirst 0x0004
- */
-#define HC_HFBDrawFirst_MASK 0x00000800
-#define HC_HFBQueue_MASK 0x00000400
-#define HC_HFBLock_MASK 0x00000200
-#define HC_HEOF_MASK 0x00000100
-#define HC_HFBBasH_MASK 0x000000ff
-
-/* GEMI Setting
- */
-#define HC_SubA_HTArbRCM 0x0008
-#define HC_SubA_HTArbRZ 0x000a
-#define HC_SubA_HTArbWZ 0x000b
-#define HC_SubA_HTArbRTX 0x000c
-#define HC_SubA_HTArbRCW 0x000d
-#define HC_SubA_HTArbE2 0x000e
-#define HC_SubA_HArbRQCM 0x0010
-#define HC_SubA_HArbWQCM 0x0011
-#define HC_SubA_HGEMITout 0x0020
-#define HC_SubA_HFthRTXD 0x0040
-#define HC_SubA_HFthRTXA 0x0044
-#define HC_SubA_HCMDQstL 0x0050
-#define HC_SubA_HCMDQendL 0x0051
-#define HC_SubA_HCMDQLen 0x0052
-/* HC_SubA_HTArbRCM 0x0008
- */
-#define HC_HTArbRCM_MASK 0x0000ffff
-/* HC_SubA_HTArbRZ 0x000a
- */
-#define HC_HTArbRZ_MASK 0x0000ffff
-/* HC_SubA_HTArbWZ 0x000b
- */
-#define HC_HTArbWZ_MASK 0x0000ffff
-/* HC_SubA_HTArbRTX 0x000c
- */
-#define HC_HTArbRTX_MASK 0x0000ffff
-/* HC_SubA_HTArbRCW 0x000d
- */
-#define HC_HTArbRCW_MASK 0x0000ffff
-/* HC_SubA_HTArbE2 0x000e
- */
-#define HC_HTArbE2_MASK 0x0000ffff
-/* HC_SubA_HArbRQCM 0x0010
- */
-#define HC_HTArbRQCM_MASK 0x0000ffff
-/* HC_SubA_HArbWQCM 0x0011
- */
-#define HC_HArbWQCM_MASK 0x0000ffff
-/* HC_SubA_HGEMITout 0x0020
- */
-#define HC_HGEMITout_MASK 0x000f0000
-#define HC_HNPArbZC_MASK 0x0000ffff
-#define HC_HGEMITout_SHIFT 16
-/* HC_SubA_HFthRTXD 0x0040
- */
-#define HC_HFthRTXD_MASK 0x00ff0000
-#define HC_HFthRZD_MASK 0x0000ff00
-#define HC_HFthWZD_MASK 0x000000ff
-#define HC_HFthRTXD_SHIFT 16
-#define HC_HFthRZD_SHIFT 8
-/* HC_SubA_HFthRTXA 0x0044
- */
-#define HC_HFthRTXA_MASK 0x000000ff
-
-/******************************************************************************
-** Define the Halcyon Internal register access constants. For simulator only.
-******************************************************************************/
-#define HC_SIMA_HAGPBstL 0x0000
-#define HC_SIMA_HAGPBendL 0x0001
-#define HC_SIMA_HAGPCMNT 0x0002
-#define HC_SIMA_HAGPBpL 0x0003
-#define HC_SIMA_HAGPBpH 0x0004
-#define HC_SIMA_HClipTB 0x0005
-#define HC_SIMA_HClipLR 0x0006
-#define HC_SIMA_HFPClipTL 0x0007
-#define HC_SIMA_HFPClipBL 0x0008
-#define HC_SIMA_HFPClipLL 0x0009
-#define HC_SIMA_HFPClipRL 0x000a
-#define HC_SIMA_HFPClipTBH 0x000b
-#define HC_SIMA_HFPClipLRH 0x000c
-#define HC_SIMA_HLP 0x000d
-#define HC_SIMA_HLPRF 0x000e
-#define HC_SIMA_HSolidCL 0x000f
-#define HC_SIMA_HPixGC 0x0010
-#define HC_SIMA_HSPXYOS 0x0011
-#define HC_SIMA_HCmdA 0x0012
-#define HC_SIMA_HCmdB 0x0013
-#define HC_SIMA_HEnable 0x0014
-#define HC_SIMA_HZWBBasL 0x0015
-#define HC_SIMA_HZWBBasH 0x0016
-#define HC_SIMA_HZWBType 0x0017
-#define HC_SIMA_HZBiasL 0x0018
-#define HC_SIMA_HZWBend 0x0019
-#define HC_SIMA_HZWTMD 0x001a
-#define HC_SIMA_HZWCDL 0x001b
-#define HC_SIMA_HZWCTAGnum 0x001c
-#define HC_SIMA_HZCYNum 0x001d
-#define HC_SIMA_HZWCFire 0x001e
-/* #define HC_SIMA_HSBBasL 0x001d */
-/* #define HC_SIMA_HSBBasH 0x001e */
-/* #define HC_SIMA_HSBFM 0x001f */
-#define HC_SIMA_HSTREF 0x0020
-#define HC_SIMA_HSTMD 0x0021
-#define HC_SIMA_HABBasL 0x0022
-#define HC_SIMA_HABBasH 0x0023
-#define HC_SIMA_HABFM 0x0024
-#define HC_SIMA_HATMD 0x0025
-#define HC_SIMA_HABLCsat 0x0026
-#define HC_SIMA_HABLCop 0x0027
-#define HC_SIMA_HABLAsat 0x0028
-#define HC_SIMA_HABLAop 0x0029
-#define HC_SIMA_HABLRCa 0x002a
-#define HC_SIMA_HABLRFCa 0x002b
-#define HC_SIMA_HABLRCbias 0x002c
-#define HC_SIMA_HABLRCb 0x002d
-#define HC_SIMA_HABLRFCb 0x002e
-#define HC_SIMA_HABLRAa 0x002f
-#define HC_SIMA_HABLRAb 0x0030
-#define HC_SIMA_HDBBasL 0x0031
-#define HC_SIMA_HDBBasH 0x0032
-#define HC_SIMA_HDBFM 0x0033
-#define HC_SIMA_HFBBMSKL 0x0034
-#define HC_SIMA_HROP 0x0035
-#define HC_SIMA_HFogLF 0x0036
-#define HC_SIMA_HFogCL 0x0037
-#define HC_SIMA_HFogCH 0x0038
-#define HC_SIMA_HFogStL 0x0039
-#define HC_SIMA_HFogStH 0x003a
-#define HC_SIMA_HFogOOdMF 0x003b
-#define HC_SIMA_HFogOOdEF 0x003c
-#define HC_SIMA_HFogEndL 0x003d
-#define HC_SIMA_HFogDenst 0x003e
-/*---- start of texture 0 setting ----
- */
-#define HC_SIMA_HTX0L0BasL 0x0040
-#define HC_SIMA_HTX0L1BasL 0x0041
-#define HC_SIMA_HTX0L2BasL 0x0042
-#define HC_SIMA_HTX0L3BasL 0x0043
-#define HC_SIMA_HTX0L4BasL 0x0044
-#define HC_SIMA_HTX0L5BasL 0x0045
-#define HC_SIMA_HTX0L6BasL 0x0046
-#define HC_SIMA_HTX0L7BasL 0x0047
-#define HC_SIMA_HTX0L8BasL 0x0048
-#define HC_SIMA_HTX0L9BasL 0x0049
-#define HC_SIMA_HTX0LaBasL 0x004a
-#define HC_SIMA_HTX0LbBasL 0x004b
-#define HC_SIMA_HTX0LcBasL 0x004c
-#define HC_SIMA_HTX0LdBasL 0x004d
-#define HC_SIMA_HTX0LeBasL 0x004e
-#define HC_SIMA_HTX0LfBasL 0x004f
-#define HC_SIMA_HTX0L10BasL 0x0050
-#define HC_SIMA_HTX0L11BasL 0x0051
-#define HC_SIMA_HTX0L012BasH 0x0052
-#define HC_SIMA_HTX0L345BasH 0x0053
-#define HC_SIMA_HTX0L678BasH 0x0054
-#define HC_SIMA_HTX0L9abBasH 0x0055
-#define HC_SIMA_HTX0LcdeBasH 0x0056
-#define HC_SIMA_HTX0Lf1011BasH 0x0057
-#define HC_SIMA_HTX0L0Pit 0x0058
-#define HC_SIMA_HTX0L1Pit 0x0059
-#define HC_SIMA_HTX0L2Pit 0x005a
-#define HC_SIMA_HTX0L3Pit 0x005b
-#define HC_SIMA_HTX0L4Pit 0x005c
-#define HC_SIMA_HTX0L5Pit 0x005d
-#define HC_SIMA_HTX0L6Pit 0x005e
-#define HC_SIMA_HTX0L7Pit 0x005f
-#define HC_SIMA_HTX0L8Pit 0x0060
-#define HC_SIMA_HTX0L9Pit 0x0061
-#define HC_SIMA_HTX0LaPit 0x0062
-#define HC_SIMA_HTX0LbPit 0x0063
-#define HC_SIMA_HTX0LcPit 0x0064
-#define HC_SIMA_HTX0LdPit 0x0065
-#define HC_SIMA_HTX0LePit 0x0066
-#define HC_SIMA_HTX0LfPit 0x0067
-#define HC_SIMA_HTX0L10Pit 0x0068
-#define HC_SIMA_HTX0L11Pit 0x0069
-#define HC_SIMA_HTX0L0_5WE 0x006a
-#define HC_SIMA_HTX0L6_bWE 0x006b
-#define HC_SIMA_HTX0Lc_11WE 0x006c
-#define HC_SIMA_HTX0L0_5HE 0x006d
-#define HC_SIMA_HTX0L6_bHE 0x006e
-#define HC_SIMA_HTX0Lc_11HE 0x006f
-#define HC_SIMA_HTX0L0OS 0x0070
-#define HC_SIMA_HTX0TB 0x0071
-#define HC_SIMA_HTX0MPMD 0x0072
-#define HC_SIMA_HTX0CLODu 0x0073
-#define HC_SIMA_HTX0FM 0x0074
-#define HC_SIMA_HTX0TRCH 0x0075
-#define HC_SIMA_HTX0TRCL 0x0076
-#define HC_SIMA_HTX0TBC 0x0077
-#define HC_SIMA_HTX0TRAH 0x0078
-#define HC_SIMA_HTX0TBLCsat 0x0079
-#define HC_SIMA_HTX0TBLCop 0x007a
-#define HC_SIMA_HTX0TBLMPfog 0x007b
-#define HC_SIMA_HTX0TBLAsat 0x007c
-#define HC_SIMA_HTX0TBLRCa 0x007d
-#define HC_SIMA_HTX0TBLRCb 0x007e
-#define HC_SIMA_HTX0TBLRCc 0x007f
-#define HC_SIMA_HTX0TBLRCbias 0x0080
-#define HC_SIMA_HTX0TBLRAa 0x0081
-#define HC_SIMA_HTX0TBLRFog 0x0082
-#define HC_SIMA_HTX0BumpM00 0x0083
-#define HC_SIMA_HTX0BumpM01 0x0084
-#define HC_SIMA_HTX0BumpM10 0x0085
-#define HC_SIMA_HTX0BumpM11 0x0086
-#define HC_SIMA_HTX0LScale 0x0087
-/*---- end of texture 0 setting ---- 0x008f
- */
-#define HC_SIMA_TX0TX1_OFF 0x0050
-/*---- start of texture 1 setting ----
- */
-#define HC_SIMA_HTX1L0BasL (HC_SIMA_HTX0L0BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L1BasL (HC_SIMA_HTX0L1BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L2BasL (HC_SIMA_HTX0L2BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L3BasL (HC_SIMA_HTX0L3BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L4BasL (HC_SIMA_HTX0L4BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L5BasL (HC_SIMA_HTX0L5BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L6BasL (HC_SIMA_HTX0L6BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L7BasL (HC_SIMA_HTX0L7BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L8BasL (HC_SIMA_HTX0L8BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L9BasL (HC_SIMA_HTX0L9BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LaBasL (HC_SIMA_HTX0LaBasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LbBasL (HC_SIMA_HTX0LbBasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LcBasL (HC_SIMA_HTX0LcBasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LdBasL (HC_SIMA_HTX0LdBasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LeBasL (HC_SIMA_HTX0LeBasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LfBasL (HC_SIMA_HTX0LfBasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L10BasL (HC_SIMA_HTX0L10BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L11BasL (HC_SIMA_HTX0L11BasL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L012BasH (HC_SIMA_HTX0L012BasH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L345BasH (HC_SIMA_HTX0L345BasH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L678BasH (HC_SIMA_HTX0L678BasH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L9abBasH (HC_SIMA_HTX0L9abBasH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LcdeBasH (HC_SIMA_HTX0LcdeBasH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1Lf1011BasH (HC_SIMA_HTX0Lf1011BasH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L0Pit (HC_SIMA_HTX0L0Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L1Pit (HC_SIMA_HTX0L1Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L2Pit (HC_SIMA_HTX0L2Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L3Pit (HC_SIMA_HTX0L3Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L4Pit (HC_SIMA_HTX0L4Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L5Pit (HC_SIMA_HTX0L5Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L6Pit (HC_SIMA_HTX0L6Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L7Pit (HC_SIMA_HTX0L7Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L8Pit (HC_SIMA_HTX0L8Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L9Pit (HC_SIMA_HTX0L9Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LaPit (HC_SIMA_HTX0LaPit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LbPit (HC_SIMA_HTX0LbPit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LcPit (HC_SIMA_HTX0LcPit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LdPit (HC_SIMA_HTX0LdPit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LePit (HC_SIMA_HTX0LePit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LfPit (HC_SIMA_HTX0LfPit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L10Pit (HC_SIMA_HTX0L10Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L11Pit (HC_SIMA_HTX0L11Pit + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L0_5WE (HC_SIMA_HTX0L0_5WE + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L6_bWE (HC_SIMA_HTX0L6_bWE + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1Lc_11WE (HC_SIMA_HTX0Lc_11WE + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L0_5HE (HC_SIMA_HTX0L0_5HE + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L6_bHE (HC_SIMA_HTX0L6_bHE + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1Lc_11HE (HC_SIMA_HTX0Lc_11HE + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1L0OS (HC_SIMA_HTX0L0OS + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TB (HC_SIMA_HTX0TB + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1MPMD (HC_SIMA_HTX0MPMD + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1CLODu (HC_SIMA_HTX0CLODu + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1FM (HC_SIMA_HTX0FM + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TRCH (HC_SIMA_HTX0TRCH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TRCL (HC_SIMA_HTX0TRCL + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBC (HC_SIMA_HTX0TBC + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TRAH (HC_SIMA_HTX0TRAH + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LTC (HC_SIMA_HTX0LTC + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LTA (HC_SIMA_HTX0LTA + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLCsat (HC_SIMA_HTX0TBLCsat + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLCop (HC_SIMA_HTX0TBLCop + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLMPfog (HC_SIMA_HTX0TBLMPfog + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLAsat (HC_SIMA_HTX0TBLAsat + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLRCa (HC_SIMA_HTX0TBLRCa + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLRCb (HC_SIMA_HTX0TBLRCb + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLRCc (HC_SIMA_HTX0TBLRCc + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLRCbias (HC_SIMA_HTX0TBLRCbias + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLRAa (HC_SIMA_HTX0TBLRAa + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1TBLRFog (HC_SIMA_HTX0TBLRFog + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1BumpM00 (HC_SIMA_HTX0BumpM00 + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1BumpM01 (HC_SIMA_HTX0BumpM01 + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1BumpM10 (HC_SIMA_HTX0BumpM10 + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1BumpM11 (HC_SIMA_HTX0BumpM11 + HC_SIMA_TX0TX1_OFF)
-#define HC_SIMA_HTX1LScale (HC_SIMA_HTX0LScale + HC_SIMA_TX0TX1_OFF)
-/*---- end of texture 1 setting ---- 0xaf
- */
-#define HC_SIMA_HTXSMD 0x00b0
-#define HC_SIMA_HenFIFOAT 0x00b1
-#define HC_SIMA_HFBDrawFirst 0x00b2
-#define HC_SIMA_HFBBasL 0x00b3
-#define HC_SIMA_HTArbRCM 0x00b4
-#define HC_SIMA_HTArbRZ 0x00b5
-#define HC_SIMA_HTArbWZ 0x00b6
-#define HC_SIMA_HTArbRTX 0x00b7
-#define HC_SIMA_HTArbRCW 0x00b8
-#define HC_SIMA_HTArbE2 0x00b9
-#define HC_SIMA_HGEMITout 0x00ba
-#define HC_SIMA_HFthRTXD 0x00bb
-#define HC_SIMA_HFthRTXA 0x00bc
-/* Define the texture palette 0
- */
-#define HC_SIMA_HTP0 0x0100
-#define HC_SIMA_HTP1 0x0200
-#define HC_SIMA_FOGTABLE 0x0300
-#define HC_SIMA_STIPPLE 0x0400
-#define HC_SIMA_HE3Fire 0x0440
-#define HC_SIMA_TRANS_SET 0x0441
-#define HC_SIMA_HREngSt 0x0442
-#define HC_SIMA_HRFIFOempty 0x0443
-#define HC_SIMA_HRFIFOfull 0x0444
-#define HC_SIMA_HRErr 0x0445
-#define HC_SIMA_FIFOstatus 0x0446
-
-/******************************************************************************
-** Define the AGP command header.
-******************************************************************************/
-#define HC_ACMD_MASK 0xfe000000
-#define HC_ACMD_SUB_MASK 0x0c000000
-#define HC_ACMD_HCmdA 0xee000000
-#define HC_ACMD_HCmdB 0xec000000
-#define HC_ACMD_HCmdC 0xea000000
-#define HC_ACMD_H1 0xf0000000
-#define HC_ACMD_H2 0xf2000000
-#define HC_ACMD_H3 0xf4000000
-#define HC_ACMD_H4 0xf6000000
-
-#define HC_ACMD_H1IO_MASK 0x000001ff
-#define HC_ACMD_H2IO1_MASK 0x001ff000
-#define HC_ACMD_H2IO2_MASK 0x000001ff
-#define HC_ACMD_H2IO1_SHIFT 12
-#define HC_ACMD_H2IO2_SHIFT 0
-#define HC_ACMD_H3IO_MASK 0x000001ff
-#define HC_ACMD_H3COUNT_MASK 0x01fff000
-#define HC_ACMD_H3COUNT_SHIFT 12
-#define HC_ACMD_H4ID_MASK 0x000001ff
-#define HC_ACMD_H4COUNT_MASK 0x01fffe00
-#define HC_ACMD_H4COUNT_SHIFT 9
-
-/********************************************************************************
-** Define Header
-********************************************************************************/
-#define HC_HEADER2 0xF210F110
-
-/********************************************************************************
-** Define Dummy Value
-********************************************************************************/
-#define HC_DUMMY 0xCCCCCCCC
-/********************************************************************************
-** Define for DMA use
-********************************************************************************/
-#define HALCYON_HEADER2 0XF210F110
-#define HALCYON_FIRECMD 0XEE100000
-#define HALCYON_FIREMASK 0XFFF00000
-#define HALCYON_CMDB 0XEC000000
-#define HALCYON_CMDBMASK 0XFFFE0000
-#define HALCYON_SUB_ADDR0 0X00000000
-#define HALCYON_HEADER1MASK 0XFFFFFF00
-#define HALCYON_HEADER1 0XF0000000
-#define HC_SubA_HAGPBstL 0x0060
-#define HC_SubA_HAGPBendL 0x0061
-#define HC_SubA_HAGPCMNT 0x0062
-#define HC_SubA_HAGPBpL 0x0063
-#define HC_SubA_HAGPBpH 0x0064
-#define HC_HAGPCMNT_MASK 0x00800000
-#define HC_HCmdErrClr_MASK 0x00400000
-#define HC_HAGPBendH_MASK 0x0000ff00
-#define HC_HAGPBstH_MASK 0x000000ff
-#define HC_HAGPBendH_SHIFT 8
-#define HC_HAGPBstH_SHIFT 0
-#define HC_HAGPBpL_MASK 0x00fffffc
-#define HC_HAGPBpID_MASK 0x00000003
-#define HC_HAGPBpID_PAUSE 0x00000000
-#define HC_HAGPBpID_JUMP 0x00000001
-#define HC_HAGPBpID_STOP 0x00000002
-#define HC_HAGPBpH_MASK 0x00ffffff
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.c
deleted file mode 100644
index 4c18eba9b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.c
+++ /dev/null
@@ -1,782 +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.
- */
-
-/**
- * \file via_context.c
- *
- * \author John Sheng (presumably of either VIA Technologies or S3 Graphics)
- * \author Others at VIA Technologies?
- * \author Others at S3 Graphics?
- */
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "state.h"
-#include "simple_list.h"
-#include "extensions.h"
-#include "framebuffer.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "via_screen.h"
-#include "via_dri.h"
-
-#include "via_state.h"
-#include "via_tex.h"
-#include "via_span.h"
-#include "via_tris.h"
-#include "via_ioctl.h"
-#include "via_fb.h"
-
-#include <stdio.h>
-#include "macros.h"
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_point_parameters
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_secondary_color
-#include "extension_helper.h"
-
-#define DRIVER_DATE "20050526"
-
-#include "vblank.h"
-#include "utils.h"
-
-GLuint VIA_DEBUG = 0;
-
-/**
- * Return various strings for \c glGetString.
- *
- * \sa glGetString
- */
-static const GLubyte *viaGetString(GLcontext *ctx, GLenum name)
-{
- static char buffer[128];
- unsigned offset;
-
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *)"VIA Technology";
-
- case GL_RENDERER: {
- static const char * const chipset_names[] = {
- "UniChrome",
- "CastleRock (CLE266)",
- "UniChrome (KM400)",
- "UniChrome (K8M800)",
- "UniChrome (PM8x0/CN400)",
- };
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- unsigned id = vmesa->viaScreen->deviceID;
-
- offset = driGetRendererString( buffer,
- chipset_names[(id > VIA_PM800) ? 0 : id],
- DRIVER_DATE, 0 );
- return (GLubyte *)buffer;
- }
-
- default:
- return NULL;
- }
-}
-
-
-/**
- * Calculate a width that satisfies the hardware's alignment requirements.
- * On the Unichrome hardware, each scanline must be aligned to a multiple of
- * 16 pixels.
- *
- * \param width Minimum buffer width, in pixels.
- *
- * \returns A pixel width that meets the alignment requirements.
- */
-static __inline__ unsigned
-buffer_align( unsigned width )
-{
- return (width + 0x0f) & ~0x0f;
-}
-
-
-/**
- * Calculate the framebuffer parameters for all buffers (front, back, depth,
- * and stencil) associated with the specified context.
- *
- * \warning
- * This function also calls \c AllocateBuffer to actually allocate the
- * buffers.
- *
- * \sa AllocateBuffer
- */
-static GLboolean
-calculate_buffer_parameters( struct via_context *vmesa )
-{
- const unsigned shift = vmesa->viaScreen->bitsPerPixel / 16;
- const unsigned extra = 32;
- unsigned w;
- unsigned h;
-
- /* Allocate front-buffer */
- if (vmesa->drawType == GLX_PBUFFER_BIT) {
- w = vmesa->driDrawable->w;
- h = vmesa->driDrawable->h;
-
- vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel;
- vmesa->front.pitch = buffer_align( w ) << shift;
- vmesa->front.size = vmesa->front.pitch * h;
-
- if (vmesa->front.map)
- via_free_draw_buffer(vmesa, &vmesa->front);
- if (!via_alloc_draw_buffer(vmesa, &vmesa->front))
- return GL_FALSE;
-
- } else {
- w = vmesa->viaScreen->width;
- h = vmesa->viaScreen->height;
-
- vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel;
- vmesa->front.pitch = buffer_align( w ) << shift;
- vmesa->front.size = vmesa->front.pitch * h;
- if (getenv("ALTERNATE_SCREEN"))
- vmesa->front.offset = vmesa->front.size;
- else
- vmesa->front.offset = 0;
- vmesa->front.map = (char *) vmesa->driScreen->pFB;
- }
-
-
- /* Allocate back-buffer */
- if (vmesa->hasBack) {
- vmesa->back.bpp = vmesa->viaScreen->bitsPerPixel;
- vmesa->back.pitch = (buffer_align( vmesa->driDrawable->w ) << shift);
- vmesa->back.pitch += extra;
- vmesa->back.pitch = MIN2(vmesa->back.pitch, vmesa->front.pitch);
- vmesa->back.size = vmesa->back.pitch * vmesa->driDrawable->h;
- if (vmesa->back.map)
- via_free_draw_buffer(vmesa, &vmesa->back);
- if (!via_alloc_draw_buffer(vmesa, &vmesa->back))
- return GL_FALSE;
- }
- else {
- if (vmesa->back.map)
- via_free_draw_buffer(vmesa, &vmesa->back);
- (void) memset( &vmesa->back, 0, sizeof( vmesa->back ) );
- }
-
-
- /* Allocate depth-buffer */
- if ( vmesa->hasStencil || vmesa->hasDepth ) {
- vmesa->depth.bpp = vmesa->depthBits;
- if (vmesa->depth.bpp == 24)
- vmesa->depth.bpp = 32;
-
- vmesa->depth.pitch = (buffer_align( vmesa->driDrawable->w ) *
- (vmesa->depth.bpp/8)) + extra;
- vmesa->depth.size = vmesa->depth.pitch * vmesa->driDrawable->h;
-
- if (vmesa->depth.map)
- via_free_draw_buffer(vmesa, &vmesa->depth);
- if (!via_alloc_draw_buffer(vmesa, &vmesa->depth)) {
- return GL_FALSE;
- }
- }
- else {
- if (vmesa->depth.map)
- via_free_draw_buffer(vmesa, &vmesa->depth);
- (void) memset( & vmesa->depth, 0, sizeof( vmesa->depth ) );
- }
-
- if( vmesa->viaScreen->width == vmesa->driDrawable->w &&
- vmesa->viaScreen->height == vmesa->driDrawable->h ) {
- vmesa->doPageFlip = vmesa->allowPageFlip;
- assert(vmesa->back.pitch == vmesa->front.pitch);
- }
- else
- vmesa->doPageFlip = GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
- GLuint width, GLuint height)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
-#if 0
- _swrast_alloc_buffers( drawbuffer );
-#else
- _mesa_resize_framebuffer(ctx, drawbuffer, width, height);
-#endif
-
- calculate_buffer_parameters( vmesa );
-}
-
-static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- *width = vmesa->driDrawable->w;
- *height = vmesa->driDrawable->h;
-}
-
-/* Extension strings exported by the Unichrome driver.
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_env_combine", NULL },
-/* { "GL_ARB_texture_env_dot3", NULL }, */
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_env_combine", NULL },
-/* { "GL_EXT_texture_env_dot3", NULL }, */
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_NV_blend_square", NULL },
- { NULL, NULL }
-};
-
-extern const struct tnl_pipeline_stage _via_fastrender_stage;
-extern const struct tnl_pipeline_stage _via_render_stage;
-
-static const struct tnl_pipeline_stage *via_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
- &_via_fastrender_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "sleep", DEBUG_SLEEP },
- { "pix", DEBUG_PIXEL },
- { "2d", DEBUG_2D },
- { NULL, 0 }
-};
-
-
-static GLboolean
-AllocateDmaBuffer(struct via_context *vmesa)
-{
- if (vmesa->dma)
- via_free_dma_buffer(vmesa);
-
- if (!via_alloc_dma_buffer(vmesa))
- return GL_FALSE;
-
- vmesa->dmaLow = 0;
- vmesa->dmaCliprectAddr = ~0;
- return GL_TRUE;
-}
-
-static void
-FreeBuffer(struct via_context *vmesa)
-{
- if (vmesa->front.map && vmesa->drawType == GLX_PBUFFER_BIT)
- via_free_draw_buffer(vmesa, &vmesa->front);
-
- if (vmesa->back.map)
- via_free_draw_buffer(vmesa, &vmesa->back);
-
- if (vmesa->depth.map)
- via_free_draw_buffer(vmesa, &vmesa->depth);
-
- if (vmesa->breadcrumb.map)
- via_free_draw_buffer(vmesa, &vmesa->breadcrumb);
-
- if (vmesa->dma)
- via_free_dma_buffer(vmesa);
-}
-
-
-GLboolean
-viaCreateContext(const __GLcontextModes *visual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- GLcontext *ctx, *shareCtx;
- struct via_context *vmesa;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
- drm_via_sarea_t *saPriv = (drm_via_sarea_t *)
- (((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset);
- struct dd_function_table functions;
-
- /* Allocate via context */
- vmesa = (struct via_context *) CALLOC_STRUCT(via_context);
- if (!vmesa) {
- return GL_FALSE;
- }
-
- /* Parse configuration files.
- */
- driParseConfigFiles (&vmesa->optionCache, &viaScreen->optionCache,
- sPriv->myNum, "via");
-
- /* pick back buffer */
- vmesa->hasBack = visual->doubleBufferMode;
-
- switch(visual->depthBits) {
- case 0:
- vmesa->hasDepth = GL_FALSE;
- vmesa->depthBits = 0;
- vmesa->depth_max = 1.0;
- break;
- case 16:
- vmesa->hasDepth = GL_TRUE;
- vmesa->depthBits = visual->depthBits;
- vmesa->have_hw_stencil = GL_FALSE;
- vmesa->depth_max = (GLfloat)0xffff;
- vmesa->depth_clear_mask = 0xf << 28;
- vmesa->ClearDepth = 0xffff;
- vmesa->polygon_offset_scale = 1.0 / vmesa->depth_max;
- break;
- case 24:
- vmesa->hasDepth = GL_TRUE;
- vmesa->depthBits = visual->depthBits;
- vmesa->depth_max = (GLfloat) 0xffffff;
- vmesa->depth_clear_mask = 0xe << 28;
- vmesa->ClearDepth = 0xffffff00;
-
- assert(visual->haveStencilBuffer);
- assert(visual->stencilBits == 8);
-
- vmesa->have_hw_stencil = GL_TRUE;
- vmesa->stencilBits = visual->stencilBits;
- vmesa->stencil_clear_mask = 0x1 << 28;
- vmesa->polygon_offset_scale = 2.0 / vmesa->depth_max;
- break;
- case 32:
- vmesa->hasDepth = GL_TRUE;
- vmesa->depthBits = visual->depthBits;
- assert(!visual->haveStencilBuffer);
- vmesa->have_hw_stencil = GL_FALSE;
- vmesa->depth_max = (GLfloat)0xffffffff;
- vmesa->depth_clear_mask = 0xf << 28;
- vmesa->ClearDepth = 0xffffffff;
- vmesa->polygon_offset_scale = 2.0 / vmesa->depth_max;
- break;
- default:
- assert(0);
- break;
- }
-
- make_empty_list(&vmesa->freed_tex_buffers);
- make_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO]);
- make_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP]);
- make_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM]);
-
- _mesa_init_driver_functions(&functions);
- viaInitTextureFuncs(&functions);
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((struct via_context *) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- vmesa->glCtx = _mesa_create_context(visual, shareCtx, &functions,
- (void*) vmesa);
-
- vmesa->shareCtx = shareCtx;
-
- if (!vmesa->glCtx) {
- FREE(vmesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = vmesa;
-
- ctx = vmesa->glCtx;
-
- ctx->Const.MaxTextureLevels = 10;
- ctx->Const.MaxTextureUnits = 2;
- ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
- ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
-
- 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.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
- ctx->Const.PointSizeGranularity = 1.0;
-
- ctx->Driver.GetBufferSize = viaBufferSize;
-/* ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; *//* FIXME ?? */
- ctx->Driver.GetString = viaGetString;
-
- ctx->DriverCtx = (void *)vmesa;
- vmesa->glCtx = ctx;
-
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext(ctx);
- _ac_CreateContext(ctx);
- _tnl_CreateContext(ctx);
- _swsetup_CreateContext(ctx);
-
- /* Install the customized pipeline:
- */
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, via_pipeline);
-
- /* Configure swrast and T&L 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);
-
-/* vmesa->display = dpy; */
- vmesa->display = sPriv->display;
-
- vmesa->hHWContext = driContextPriv->hHWContext;
- vmesa->driFd = sPriv->fd;
- vmesa->driHwLock = &sPriv->pSAREA->lock;
-
- vmesa->viaScreen = viaScreen;
- vmesa->driScreen = sPriv;
- vmesa->sarea = saPriv;
-
- vmesa->renderIndex = ~0;
- vmesa->setupIndex = ~0;
- vmesa->hwPrimitive = GL_POLYGON+1;
-
- /* KW: Hardwire this. Was previously set bogusly in
- * viaCreateBuffer. Needs work before PBUFFER can be used:
- */
- vmesa->drawType = GLX_WINDOW_BIT;
-
-
- _math_matrix_ctr(&vmesa->ViewportMatrix);
-
- /* Do this early, before VIA_FLUSH_DMA can be called:
- */
- if (!AllocateDmaBuffer(vmesa)) {
- fprintf(stderr ,"AllocateDmaBuffer fail\n");
- FreeBuffer(vmesa);
- FREE(vmesa);
- return GL_FALSE;
- }
-
- /* Allocate a small piece of fb memory for synchronization:
- */
- vmesa->breadcrumb.bpp = 32;
- vmesa->breadcrumb.pitch = buffer_align( 64 ) << 2;
- vmesa->breadcrumb.size = vmesa->breadcrumb.pitch;
-
- if (!via_alloc_draw_buffer(vmesa, &vmesa->breadcrumb)) {
- fprintf(stderr ,"AllocateDmaBuffer fail\n");
- FreeBuffer(vmesa);
- FREE(vmesa);
- return GL_FALSE;
- }
-
- driInitExtensions( ctx, card_extensions, GL_TRUE );
- viaInitStateFuncs(ctx);
- viaInitTriFuncs(ctx);
- viaInitSpanFuncs(ctx);
- viaInitIoctlFuncs(ctx);
- viaInitState(ctx);
-
- if (getenv("VIA_DEBUG"))
- VIA_DEBUG = driParseDebugString( getenv( "VIA_DEBUG" ),
- debug_control );
-
- if (getenv("VIA_NO_RAST"))
- FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1);
-
- /* I don't understand why this isn't working:
- */
- vmesa->vblank_flags =
- vmesa->viaScreen->irqEnabled ?
- driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- /* Hack this up in its place:
- */
- vmesa->vblank_flags = (getenv("VIA_VSYNC") ?
- VBLANK_FLAG_SYNC : VBLANK_FLAG_NO_IRQ);
-
- if (getenv("VIA_PAGEFLIP"))
- vmesa->allowPageFlip = 1;
-
- (*dri_interface->getUST)( &vmesa->swap_ust );
-
-
- vmesa->regMMIOBase = (GLuint *)((unsigned long)viaScreen->reg);
- vmesa->pnGEMode = (GLuint *)((unsigned long)viaScreen->reg + 0x4);
- vmesa->regEngineStatus = (GLuint *)((unsigned long)viaScreen->reg + 0x400);
- vmesa->regTranSet = (GLuint *)((unsigned long)viaScreen->reg + 0x43C);
- vmesa->regTranSpace = (GLuint *)((unsigned long)viaScreen->reg + 0x440);
- vmesa->agpBase = viaScreen->agpBase;
-
-
- return GL_TRUE;
-}
-
-void
-viaDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct via_context *vmesa =
- (struct via_context *)driContextPriv->driverPrivate;
- struct via_context *current = ctx ? VIA_CONTEXT(ctx) : NULL;
- assert(vmesa); /* should never be null */
-
- /* check if we're deleting the currently bound context */
- if (vmesa == current) {
- VIA_FLUSH_DMA(vmesa);
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- if (vmesa) {
- viaWaitIdle(vmesa, GL_FALSE);
- if (vmesa->doPageFlip) {
- LOCK_HARDWARE(vmesa);
- if (vmesa->pfCurrentOffset != 0) {
- fprintf(stderr, "%s - reset pf\n", __FUNCTION__);
- viaResetPageFlippingLocked(vmesa);
- }
- UNLOCK_HARDWARE(vmesa);
- }
-
- _swsetup_DestroyContext(vmesa->glCtx);
- _tnl_DestroyContext(vmesa->glCtx);
- _ac_DestroyContext(vmesa->glCtx);
- _swrast_DestroyContext(vmesa->glCtx);
- /* free the Mesa context */
- _mesa_destroy_context(vmesa->glCtx);
- /* release our data */
- FreeBuffer(vmesa);
-
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP]));
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO]));
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM]));
- assert (is_empty_list(&vmesa->freed_tex_buffers));
-
- FREE(vmesa);
- }
-}
-
-
-void viaXMesaWindowMoved(struct via_context *vmesa)
-{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
-
- if (!dPriv)
- return;
-
- switch (vmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_BACK_LEFT:
- if (dPriv->numBackClipRects == 0) {
- vmesa->numClipRects = dPriv->numClipRects;
- vmesa->pClipRects = dPriv->pClipRects;
- }
- else {
- vmesa->numClipRects = dPriv->numBackClipRects;
- vmesa->pClipRects = dPriv->pBackClipRects;
- }
- break;
- case BUFFER_BIT_FRONT_LEFT:
- vmesa->numClipRects = dPriv->numClipRects;
- vmesa->pClipRects = dPriv->pClipRects;
- break;
- default:
- vmesa->numClipRects = 0;
- break;
- }
-
- if (vmesa->drawW != dPriv->w ||
- vmesa->drawH != dPriv->h)
- calculate_buffer_parameters( vmesa );
-
- vmesa->drawXoff = (GLuint)(((dPriv->x * bytePerPixel) & 0x1f) /
- bytePerPixel);
- vmesa->drawX = dPriv->x - vmesa->drawXoff;
- vmesa->drawY = dPriv->y;
- vmesa->drawW = dPriv->w;
- vmesa->drawH = dPriv->h;
-
- vmesa->front.orig = (vmesa->front.offset +
- vmesa->drawY * vmesa->front.pitch +
- vmesa->drawX * bytePerPixel);
-
- vmesa->front.origMap = (vmesa->front.map +
- vmesa->drawY * vmesa->front.pitch +
- vmesa->drawX * bytePerPixel);
-
- vmesa->back.orig = vmesa->back.offset;
- vmesa->depth.orig = vmesa->depth.offset;
- vmesa->back.origMap = vmesa->back.map;
- vmesa->depth.origMap = vmesa->depth.map;
-
- viaCalcViewport(vmesa->glCtx);
-}
-
-GLboolean
-viaUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-GLboolean
-viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (VIA_DEBUG & DEBUG_DRI) {
- fprintf(stderr, "driContextPriv = %016lx\n", (unsigned long)driContextPriv);
- fprintf(stderr, "driDrawPriv = %016lx\n", (unsigned long)driDrawPriv);
- fprintf(stderr, "driReadPriv = %016lx\n", (unsigned long)driReadPriv);
- }
-
- if (driContextPriv) {
- struct via_context *vmesa =
- (struct via_context *)driContextPriv->driverPrivate;
- GLcontext *ctx = vmesa->glCtx;
-
- if ( vmesa->driDrawable != driDrawPriv ) {
- driDrawableInitVBlank( driDrawPriv, vmesa->vblank_flags );
- vmesa->driDrawable = driDrawPriv;
- if ( ! calculate_buffer_parameters( vmesa ) ) {
- return GL_FALSE;
- }
- }
-
- _mesa_make_current(vmesa->glCtx,
- (GLframebuffer *)driDrawPriv->driverPrivate,
- (GLframebuffer *)driReadPriv->driverPrivate);
-
-
- ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
-
- viaXMesaWindowMoved(vmesa);
- ctx->Driver.Scissor(vmesa->glCtx,
- vmesa->glCtx->Scissor.X,
- vmesa->glCtx->Scissor.Y,
- vmesa->glCtx->Scissor.Width,
- vmesa->glCtx->Scissor.Height);
- }
- else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-void viaGetLock(struct via_context *vmesa, GLuint flags)
-{
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- __DRIscreenPrivate *sPriv = vmesa->driScreen;
-
- drmGetLock(vmesa->driFd, vmesa->hHWContext, flags);
-
- DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
-
- if (vmesa->sarea->ctxOwner != vmesa->hHWContext) {
- vmesa->sarea->ctxOwner = vmesa->hHWContext;
- vmesa->newEmitState = ~0;
- }
-
- if (vmesa->lastStamp != dPriv->lastStamp) {
- viaXMesaWindowMoved(vmesa);
- vmesa->newEmitState = ~0;
- vmesa->lastStamp = dPriv->lastStamp;
- }
-
- if (vmesa->doPageFlip &&
- vmesa->pfCurrentOffset != vmesa->sarea->pfCurrentOffset) {
- fprintf(stderr, "%s - reset pf\n", __FUNCTION__);
- viaResetPageFlippingLocked(vmesa);
- }
-}
-
-
-void
-viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
-{
- __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate;
-
- if (dPriv &&
- dPriv->driContextPriv &&
- dPriv->driContextPriv->driverPrivate) {
- struct via_context *vmesa =
- (struct via_context *)dPriv->driContextPriv->driverPrivate;
- GLcontext *ctx = vmesa->glCtx;
-
- _mesa_notifySwapBuffers(ctx);
-
- if (ctx->Visual.doubleBufferMode) {
- if (vmesa->doPageFlip) {
- viaPageFlip(dPriv);
- }
- else {
- viaCopyBuffer(dPriv);
- }
- }
- else
- VIA_FLUSH_DMA(vmesa);
- }
- else {
- _mesa_problem(NULL, "viaSwapBuffers: drawable has no context!\n");
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.h
deleted file mode 100644
index e51ec48af..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_context.h
+++ /dev/null
@@ -1,412 +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.
- */
-
-
-#ifndef _VIACONTEXT_H
-#define _VIACONTEXT_H
-
-#include "dri_util.h"
-
-#include "mtypes.h"
-#include "drm.h"
-#include "mm.h"
-#include "tnl/t_vertex.h"
-
-#include "via_screen.h"
-#include "via_tex.h"
-#include "via_drm.h"
-
-struct via_context;
-
-/* Chip tags. These are used to group the adapters into
- * related families.
- */
-enum VIACHIPTAGS {
- VIA_UNKNOWN = 0,
- VIA_CLE266,
- VIA_KM400,
- VIA_K8M800,
- VIA_PM800,
- VIA_LAST
-};
-
-#define VIA_FALLBACK_TEXTURE 0x1
-#define VIA_FALLBACK_DRAW_BUFFER 0x2
-#define VIA_FALLBACK_READ_BUFFER 0x4
-#define VIA_FALLBACK_COLORMASK 0x8
-#define VIA_FALLBACK_SPECULAR 0x20
-#define VIA_FALLBACK_LOGICOP 0x40
-#define VIA_FALLBACK_RENDERMODE 0x80
-#define VIA_FALLBACK_STENCIL 0x100
-#define VIA_FALLBACK_BLEND_EQ 0x200
-#define VIA_FALLBACK_BLEND_FUNC 0x400
-#define VIA_FALLBACK_USER_DISABLE 0x800
-#define VIA_FALLBACK_PROJ_TEXTURE 0x1000
-#define VIA_FALLBACK_POLY_STIPPLE 0x2000
-
-#define VIA_DMA_BUFSIZ 4096
-#define VIA_DMA_HIGHWATER (VIA_DMA_BUFSIZ - 128)
-
-#define VIA_NO_CLIPRECTS 0x1
-
-
-/* Use the templated vertex formats:
- */
-#define TAG(x) via##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-typedef void (*via_tri_func)(struct via_context *, viaVertex *, viaVertex *,
- viaVertex *);
-typedef void (*via_line_func)(struct via_context *, viaVertex *, viaVertex *);
-typedef void (*via_point_func)(struct via_context *, viaVertex *);
-
-struct via_buffer {
- drm_handle_t handle;
- drmSize size;
- unsigned long offset;
- unsigned long index;
- GLuint pitch;
- GLuint bpp;
- char *map;
- GLuint orig; /* The drawing origin,
- * at (drawX,drawY) in screen space.
- */
- char *origMap;
-};
-
-
-#define VIA_MAX_TEXLEVELS 10
-
-struct via_tex_buffer {
- struct via_tex_buffer *next, *prev;
- struct via_texture_image *image;
- unsigned long index;
- unsigned long offset;
- GLuint size;
- GLuint memType;
- unsigned char *bufAddr;
- GLuint texBase;
- GLuint lastUsed;
-};
-
-
-
-struct via_texture_image {
- struct gl_texture_image image;
- struct via_tex_buffer *texMem;
- GLint pitchLog2;
-};
-
-struct via_texture_object {
- struct gl_texture_object obj; /* The "parent" object */
-
- GLuint texelBytes;
- GLuint memType;
-
- GLuint regTexFM;
- GLuint regTexWidthLog2[2];
- GLuint regTexHeightLog2[2];
- GLuint regTexBaseH[4];
- struct {
- GLuint baseL;
- GLuint pitchLog2;
- } regTexBaseAndPitch[12];
-
- GLint firstLevel, lastLevel; /* upload tObj->Image[first .. lastLevel] */
-};
-
-
-
-struct via_context {
- GLint refcount;
- GLcontext *glCtx;
- GLcontext *shareCtx;
-
- struct via_buffer front;
- struct via_buffer back;
- struct via_buffer depth;
- struct via_buffer breadcrumb;
-
- GLboolean hasBack;
- GLboolean hasDepth;
- GLboolean hasStencil;
- GLboolean hasAccum;
- GLuint depthBits;
- GLuint stencilBits;
-
- GLboolean have_hw_stencil;
- GLuint ClearDepth;
- GLuint depth_clear_mask;
- GLuint stencil_clear_mask;
- GLfloat depth_max;
- GLfloat polygon_offset_scale;
-
- GLubyte *dma;
- viaRegion tex;
-
- /* Bit flag to keep 0track of fallbacks.
- */
- GLuint Fallback;
-
- /* State for via_tris.c.
- */
- GLuint newState; /* _NEW_* flags */
- GLuint newEmitState; /* _NEW_* flags */
- GLuint newRenderState; /* _NEW_* flags */
-
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
-
- GLuint setupIndex;
- GLuint renderIndex;
- GLmatrix ViewportMatrix;
- GLenum renderPrimitive;
- GLenum hwPrimitive;
- GLenum hwShadeModel;
- unsigned char *verts;
-
- /* drmBufPtr dma_buffer;
- */
- GLuint dmaLow;
- GLuint dmaCliprectAddr;
- GLuint dmaLastPrim;
- GLboolean useAgp;
-
-
- /* Fallback rasterization functions
- */
- via_point_func drawPoint;
- via_line_func drawLine;
- via_tri_func drawTri;
-
- /* Hardware register
- */
- GLuint regCmdA_End;
- GLuint regCmdB;
-
- GLuint regEnable;
- GLuint regHFBBMSKL;
- GLuint regHROP;
-
- GLuint regHZWTMD;
- GLuint regHSTREF;
- GLuint regHSTMD;
-
- GLuint regHATMD;
- GLuint regHABLCsat;
- GLuint regHABLCop;
- GLuint regHABLAsat;
- GLuint regHABLAop;
- GLuint regHABLRCa;
- GLuint regHABLRFCa;
- GLuint regHABLRCbias;
- GLuint regHABLRCb;
- GLuint regHABLRFCb;
- GLuint regHABLRAa;
- GLuint regHABLRAb;
- GLuint regHFogLF;
- GLuint regHFogCL;
- GLuint regHFogCH;
-
- GLuint regHLP;
- GLuint regHLPRF;
-
- GLuint regHTXnCLOD[2];
- GLuint regHTXnTB[2];
- GLuint regHTXnMPMD[2];
- GLuint regHTXnTBLCsat[2];
- GLuint regHTXnTBLCop[2];
- GLuint regHTXnTBLMPfog[2];
- GLuint regHTXnTBLAsat[2];
- GLuint regHTXnTBLRCb[2];
- GLuint regHTXnTBLRAa[2];
- GLuint regHTXnTBLRFog[2];
- GLuint regHTXnTBLRCa[2];
- GLuint regHTXnTBLRCc[2];
- GLuint regHTXnTBLRCbias[2];
- GLuint regHTXnTBC[2];
- GLuint regHTXnTRAH[2];
-
- int vertexSize;
- int hwVertexSize;
- GLboolean ptexHack;
- int coloroffset;
- int specoffset;
-
- GLint lastStamp;
-
- GLuint ClearColor;
- GLuint ClearMask;
-
- /* DRI stuff
- */
- GLboolean doPageFlip;
-
- struct via_buffer *drawBuffer;
- struct via_buffer *readBuffer;
-
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- int drawW;
- int drawH;
-
- int drawXoff; /* drawX is 32byte aligned - this is
- * the delta to the real origin, in
- * pixel units.
- */
-
- GLuint numClipRects; /* cliprects for that buffer */
- drm_clip_rect_t *pClipRects;
-
- GLboolean scissor;
- drm_clip_rect_t drawRect;
- drm_clip_rect_t scissorRect;
-
- drm_context_t hHWContext;
- drm_hw_lock_t *driHwLock;
- int driFd;
- __DRInativeDisplay *display;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *driScreen;
- viaScreenPrivate *viaScreen;
- drm_via_sarea_t *sarea;
- volatile GLuint* regMMIOBase;
- volatile GLuint* pnGEMode;
- volatile GLuint* regEngineStatus;
- volatile GLuint* regTranSet;
- volatile GLuint* regTranSpace;
- GLuint agpBase;
- GLuint drawType;
-
- GLuint nDoneFirstFlip;
- GLuint agpFullCount;
-
- GLboolean clearTexCache;
- GLboolean thrashing;
-
- /* Configuration cache
- */
- driOptionCache optionCache;
-
- GLuint vblank_flags;
- GLuint vbl_seq;
-
- int64_t swap_ust;
- int64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-
-
- GLuint pfCurrentOffset;
- GLboolean allowPageFlip;
-
- GLuint lastBreadcrumbRead;
- GLuint lastBreadcrumbWrite;
- GLuint lastSwap[2];
- GLuint lastDma;
-
- GLuint total_alloc[VIA_MEM_SYSTEM+1];
-
- struct via_tex_buffer tex_image_list[VIA_MEM_SYSTEM+1];
- struct via_tex_buffer freed_tex_buffers;
-
-};
-
-
-
-#define VIA_CONTEXT(ctx) ((struct via_context *)(ctx->DriverCtx))
-
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE(vmesa) \
- do { \
- char __ret = 0; \
- DRM_CAS(vmesa->driHwLock, vmesa->hHWContext, \
- (DRM_LOCK_HELD|vmesa->hHWContext), __ret); \
- if (__ret) \
- viaGetLock(vmesa, 0); \
- } while (0)
-
-
-/* Release the kernel lock.
- */
-#define UNLOCK_HARDWARE(vmesa) \
- DRM_UNLOCK(vmesa->driFd, vmesa->driHwLock, vmesa->hHWContext);
-
-
-
-extern GLuint VIA_DEBUG;
-
-#define DEBUG_TEXTURE 0x1
-#define DEBUG_STATE 0x2
-#define DEBUG_IOCTL 0x4
-#define DEBUG_PRIMS 0x8
-#define DEBUG_VERTS 0x10
-#define DEBUG_FALLBACKS 0x20
-#define DEBUG_VERBOSE 0x40
-#define DEBUG_DRI 0x80
-#define DEBUG_DMA 0x100
-#define DEBUG_SANITY 0x200
-#define DEBUG_SYNC 0x400
-#define DEBUG_SLEEP 0x800
-#define DEBUG_PIXEL 0x1000
-#define DEBUG_2D 0x2000
-
-
-extern void viaGetLock(struct via_context *vmesa, GLuint flags);
-extern void viaLock(struct via_context *vmesa, GLuint flags);
-extern void viaUnLock(struct via_context *vmesa, GLuint flags);
-extern void viaEmitHwStateLocked(struct via_context *vmesa);
-extern void viaEmitScissorValues(struct via_context *vmesa, int box_nr, int emit);
-extern void viaXMesaSetBackClipRects(struct via_context *vmesa);
-extern void viaXMesaSetFrontClipRects(struct via_context *vmesa);
-extern void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, GLuint width, GLuint height);
-extern void viaXMesaWindowMoved(struct via_context *vmesa);
-
-extern GLboolean viaTexCombineState(struct via_context *vmesa,
- const struct gl_tex_env_combine_state * combine,
- unsigned unit );
-
-/* Via hw already adjusted for GL pixel centers:
- */
-#define SUBPIXEL_X 0
-#define SUBPIXEL_Y 0
-
-/* TODO XXX _SOLO temp defines to make code compilable */
-#ifndef GLX_PBUFFER_BIT
-#define GLX_PBUFFER_BIT 0x00000004
-#endif
-#ifndef GLX_WINDOW_BIT
-#define GLX_WINDOW_BIT 0x00000001
-#endif
-#ifndef VERT_BIT_CLIP
-#define VERT_BIT_CLIP 0x1000000
-#endif
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_drmclient.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_drmclient.h
deleted file mode 100644
index 7beff9a9d..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_drmclient.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * 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 AUTHOR(S) AND/OR THE COPYRIGHT HOLDER(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 _VIA_DRMCLIENT_H_
-#define _VIA_DRMCLIENT_H_
-
-#define VIA_DMA_BUF_ORDER 12
-#define VIA_DMA_BUF_SZ (1 << VIA_DMA_BUF_ORDER)
-#define VIA_DMA_BUF_NR 256
-
-#endif /* _VIA_DRMCLIENT_H_ */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.c
deleted file mode 100644
index faa669073..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.c
+++ /dev/null
@@ -1,243 +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 <assert.h>
-
-#include "via_context.h"
-#include "via_ioctl.h"
-#include "via_fb.h"
-#include "xf86drm.h"
-#include "imports.h"
-#include "simple_list.h"
-#include <sys/ioctl.h>
-
-GLboolean
-via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf)
-{
- drm_via_mem_t mem;
- mem.context = vmesa->hHWContext;
- mem.size = buf->size;
- mem.type = VIA_MEM_VIDEO;
- mem.offset = 0;
- mem.index = 0;
-
- if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &mem))
- return GL_FALSE;
-
-
- buf->offset = mem.offset;
- buf->map = (char *)vmesa->driScreen->pFB + mem.offset;
- buf->index = mem.index;
- return GL_TRUE;
-}
-
-void
-via_free_draw_buffer(struct via_context *vmesa, struct via_buffer *buf)
-{
- drm_via_mem_t mem;
-
- if (!vmesa) return;
-
- mem.context = vmesa->hHWContext;
- mem.index = buf->index;
- mem.type = VIA_MEM_VIDEO;
- mem.offset = buf->offset;
- mem.size = buf->size;
-
- ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &mem);
- buf->map = NULL;
-}
-
-
-GLboolean
-via_alloc_dma_buffer(struct via_context *vmesa)
-{
- drm_via_dma_init_t init;
-
- vmesa->dma = (GLubyte *) malloc(VIA_DMA_BUFSIZ);
-
- /*
- * Check whether AGP DMA has been initialized.
- */
- memset(&init, 0, sizeof(init));
- init.func = VIA_DMA_INITIALIZED;
-
- vmesa->useAgp =
- ( 0 == drmCommandWrite(vmesa->driFd, DRM_VIA_DMA_INIT,
- &init, sizeof(init)));
- if (VIA_DEBUG & DEBUG_DMA) {
- if (vmesa->useAgp)
- fprintf(stderr, "unichrome_dri.so: Using AGP.\n");
- else
- fprintf(stderr, "unichrome_dri.so: Using PCI.\n");
- }
-
- return ((vmesa->dma) ? GL_TRUE : GL_FALSE);
-}
-
-void
-via_free_dma_buffer(struct via_context *vmesa)
-{
- if (!vmesa) return;
- free(vmesa->dma);
- vmesa->dma = 0;
-}
-
-
-/* These functions now allocate and free the via_tex_buffer struct as well:
- */
-struct via_tex_buffer *
-via_alloc_texture(struct via_context *vmesa,
- GLuint size,
- GLuint memType)
-{
- struct via_tex_buffer *t = CALLOC_STRUCT(via_tex_buffer);
-
- if (!t)
- goto cleanup;
-
- t->size = size;
- t->memType = memType;
- insert_at_tail(&vmesa->tex_image_list[memType], t);
-
- if (t->memType == VIA_MEM_AGP ||
- t->memType == VIA_MEM_VIDEO) {
- drm_via_mem_t fb;
-
- fb.context = vmesa->hHWContext;
- fb.size = t->size;
- fb.type = t->memType;
- fb.offset = 0;
- fb.index = 0;
-
- if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_ALLOCMEM, &fb) != 0 ||
- fb.index == 0)
- goto cleanup;
-
- if (0)
- fprintf(stderr, "offset %lx index %lx\n", fb.offset, fb.index);
-
- t->offset = fb.offset;
- t->index = fb.index;
-
- if (t->memType == VIA_MEM_AGP) {
- t->bufAddr = (GLubyte *)((unsigned long)vmesa->viaScreen->agpLinearStart +
- fb.offset);
- t->texBase = vmesa->agpBase + fb.offset;
- }
- else {
- t->bufAddr = (GLubyte *)((unsigned long)vmesa->driScreen->pFB + fb.offset);
- t->texBase = fb.offset;
- }
-
- vmesa->total_alloc[t->memType] += t->size;
- return t;
- }
- else if (t->memType == VIA_MEM_SYSTEM) {
-
- t->bufAddr = _mesa_malloc(t->size);
- if (!t->bufAddr)
- goto cleanup;
-
- vmesa->total_alloc[t->memType] += t->size;
- return t;
- }
-
- cleanup:
- if (t) {
- remove_from_list(t);
- FREE(t);
- }
-
- return NULL;
-}
-
-
-static void
-via_do_free_texture(struct via_context *vmesa, struct via_tex_buffer *t)
-{
- drm_via_mem_t fb;
-
- remove_from_list( t );
-
- vmesa->total_alloc[t->memType] -= t->size;
-
- fb.context = vmesa->hHWContext;
- fb.index = t->index;
- fb.offset = t->offset;
- fb.type = t->memType;
- fb.size = t->size;
-
- if (ioctl(vmesa->driFd, DRM_IOCTL_VIA_FREEMEM, &fb)) {
- fprintf(stderr, "via_free_texture fail\n");
- }
-
- FREE(t);
-}
-
-
-/* Release textures which were potentially still being referenced by
- * hardware at the time when they were originally freed.
- */
-void
-via_release_pending_textures( struct via_context *vmesa )
-{
- struct via_tex_buffer *s, *tmp;
-
- foreach_s( s, tmp, &vmesa->freed_tex_buffers ) {
- if (!VIA_GEQ_WRAP(s->lastUsed, vmesa->lastBreadcrumbRead)) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: release tex sz %d lastUsed %x\n",
- __FUNCTION__, s->size, s->lastUsed);
- via_do_free_texture(vmesa, s);
- }
- }
-}
-
-
-
-void
-via_free_texture(struct via_context *vmesa, struct via_tex_buffer *t)
-{
- if (!t) {
- return;
- }
- 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);
- }
- else if (t->index && viaCheckBreadcrumb(vmesa, t->lastUsed)) {
- via_do_free_texture( vmesa, t );
- }
- else {
- /* Close current breadcrumb so that we can free this eventually:
- */
- if (t->lastUsed == vmesa->lastBreadcrumbWrite)
- viaEmitBreadcrumb(vmesa);
-
- move_to_tail( &vmesa->freed_tex_buffers, t );
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.h
deleted file mode 100644
index 7ee153f47..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_fb.h
+++ /dev/null
@@ -1,42 +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.
- */
-
-#ifndef _VIAFB_INC
-#define _VIAFB_INC
-
-#include "via_context.h"
-
-extern GLboolean via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf);
-extern GLboolean via_alloc_dma_buffer(struct via_context *vmesa);
-
-struct via_tex_buffer *
-via_alloc_texture(struct via_context *vmesa,
- GLuint size,
- GLuint memType);
-
-extern void via_free_draw_buffer(struct via_context *vmesa, struct via_buffer *buf);
-extern void via_free_dma_buffer(struct via_context *vmesa);
-extern void via_free_texture(struct via_context *vmesa, struct via_tex_buffer *t);
-void via_release_pending_textures( struct via_context *vmesa );
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.c
deleted file mode 100644
index e84f4294a..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ /dev/null
@@ -1,970 +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 <unistd.h>
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-#include "via_context.h"
-#include "via_tris.h"
-#include "via_ioctl.h"
-#include "via_state.h"
-#include "via_fb.h"
-#include "via_3d_reg.h"
-
-#include "vblank.h"
-#include "drm.h"
-#include "xf86drm.h"
-#include <sys/ioctl.h>
-#include <errno.h>
-
-
-#define VIA_REG_STATUS 0x400
-#define VIA_REG_GEMODE 0x004
-#define VIA_REG_SRCBASE 0x030
-#define VIA_REG_DSTBASE 0x034
-#define VIA_REG_PITCH 0x038
-#define VIA_REG_SRCCOLORKEY 0x01C
-#define VIA_REG_KEYCONTROL 0x02C
-#define VIA_REG_SRCPOS 0x008
-#define VIA_REG_DSTPOS 0x00C
-#define VIA_REG_GECMD 0x000
-#define VIA_REG_DIMENSION 0x010 /* width and height */
-#define VIA_REG_FGCOLOR 0x018
-
-#define VIA_GEM_8bpp 0x00000000
-#define VIA_GEM_16bpp 0x00000100
-#define VIA_GEM_32bpp 0x00000300
-#define VIA_GEC_BLT 0x00000001
-#define VIA_PITCH_ENABLE 0x80000000
-#define VIA_GEC_INCX 0x00000000
-#define VIA_GEC_DECY 0x00004000
-#define VIA_GEC_INCY 0x00000000
-#define VIA_GEC_DECX 0x00008000
-#define VIA_GEC_FIXCOLOR_PAT 0x00002000
-
-
-#define VIA_BLIT_CLEAR 0x00
-#define VIA_BLIT_COPY 0xCC
-#define VIA_BLIT_FILL 0xF0
-#define VIA_BLIT_SET 0xFF
-
-static void dump_dma( struct via_context *vmesa )
-{
- GLuint i;
- GLuint *data = (GLuint *)vmesa->dma;
- for (i = 0; i < vmesa->dmaLow; i += 16) {
- fprintf(stderr, "%04x: ", i);
- fprintf(stderr, "%08x ", *data++);
- fprintf(stderr, "%08x ", *data++);
- fprintf(stderr, "%08x ", *data++);
- fprintf(stderr, "%08x\n", *data++);
- }
- fprintf(stderr, "******************************************\n");
-}
-
-
-void viaCheckDma(struct via_context *vmesa, GLuint bytes)
-{
- VIA_FINISH_PRIM( vmesa );
- if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) {
- viaFlushDma(vmesa);
- }
-}
-
-
-
-#define SetReg2DAGP(nReg, nData) do { \
- OUT_RING( ((nReg) >> 2) | 0xF0000000 ); \
- OUT_RING( nData ); \
-} while (0)
-
-
-static void viaBlit(struct via_context *vmesa, GLuint bpp,
- GLuint srcBase, GLuint srcPitch,
- GLuint dstBase, GLuint dstPitch,
- GLuint w, GLuint h,
- GLuint blitMode,
- GLuint color, GLuint nMask )
-{
-
- GLuint dwGEMode, srcX, dstX, cmd;
- RING_VARS;
-
- if (VIA_DEBUG & DEBUG_2D)
- fprintf(stderr,
- "%s bpp %d src %x/%x dst %x/%x w %d h %d "
- " mode: %x color: 0x%08x mask 0x%08x\n",
- __FUNCTION__, bpp, srcBase, srcPitch, dstBase,
- dstPitch, w,h, blitMode, color, nMask);
-
-
- if (!w || !h)
- return;
-
- switch (bpp) {
- case 16:
- dwGEMode = VIA_GEM_16bpp;
- srcX = (srcBase & 0x1f) >> 1;
- dstX = (dstBase & 0x1f) >> 1;
- break;
- case 32:
- dwGEMode = VIA_GEM_32bpp;
- srcX = (srcBase & 0x1f) >> 2;
- dstX = (dstBase & 0x1f) >> 2;
- break;
- default:
- return;
- }
-
- switch(blitMode) {
- case VIA_BLIT_FILL:
- cmd = VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | (VIA_BLIT_FILL << 24);
- break;
- case VIA_BLIT_COPY:
- cmd = VIA_GEC_BLT | (VIA_BLIT_COPY << 24);
- break;
- default:
- return;
- }
-
- BEGIN_RING(22);
- SetReg2DAGP( VIA_REG_GEMODE, dwGEMode);
- SetReg2DAGP( VIA_REG_FGCOLOR, color);
- SetReg2DAGP( 0x2C, nMask);
- SetReg2DAGP( VIA_REG_SRCBASE, (srcBase & ~0x1f) >> 3);
- SetReg2DAGP( VIA_REG_DSTBASE, (dstBase & ~0x1f) >> 3);
- SetReg2DAGP( VIA_REG_PITCH, VIA_PITCH_ENABLE |
- (srcPitch >> 3) | ((dstPitch >> 3) << 16));
- SetReg2DAGP( VIA_REG_SRCPOS, srcX);
- SetReg2DAGP( VIA_REG_DSTPOS, dstX);
- SetReg2DAGP( VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
- SetReg2DAGP( VIA_REG_GECMD, cmd);
- SetReg2DAGP( 0x2C, 0x00000000);
- ADVANCE_RING();
-}
-
-static void viaFillBuffer(struct via_context *vmesa,
- struct via_buffer *buffer,
- drm_clip_rect_t *pbox,
- int nboxes,
- GLuint pixel,
- GLuint mask)
-{
- GLuint bytePerPixel = buffer->bpp >> 3;
- GLuint i;
-
- for (i = 0; i < nboxes ; i++) {
- int x = pbox[i].x1 - vmesa->drawX;
- int y = pbox[i].y1 - vmesa->drawY;
- int w = pbox[i].x2 - pbox[i].x1;
- int h = pbox[i].y2 - pbox[i].y1;
-
- int offset = (buffer->orig +
- y * buffer->pitch +
- x * bytePerPixel);
-
- viaBlit(vmesa,
- buffer->bpp,
- offset, buffer->pitch,
- offset, buffer->pitch,
- w, h,
- VIA_BLIT_FILL, pixel, mask);
- }
-}
-
-
-
-static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- int flag = 0;
- GLuint i = 0;
- GLuint clear_depth_mask = 0xf << 28;
- GLuint clear_depth = 0;
-
- VIA_FLUSH_DMA(vmesa);
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- flag |= VIA_FRONT;
- mask &= ~BUFFER_BIT_FRONT_LEFT;
- }
-
- if (mask & BUFFER_BIT_BACK_LEFT) {
- flag |= VIA_BACK;
- mask &= ~BUFFER_BIT_BACK_LEFT;
- }
-
- if (mask & BUFFER_BIT_DEPTH) {
- flag |= VIA_DEPTH;
- clear_depth = (GLuint)(ctx->Depth.Clear * vmesa->ClearDepth);
- clear_depth_mask &= ~vmesa->depth_clear_mask;
- mask &= ~BUFFER_BIT_DEPTH;
- }
-
- if (mask & BUFFER_BIT_STENCIL) {
- if (vmesa->have_hw_stencil) {
- if (ctx->Stencil.WriteMask[0] == 0xff) {
- flag |= VIA_DEPTH;
- clear_depth &= ~0xff;
- clear_depth |= (ctx->Stencil.Clear & 0xff);
- clear_depth_mask &= ~vmesa->stencil_clear_mask;
- mask &= ~BUFFER_BIT_STENCIL;
- }
- else {
- if (VIA_DEBUG & DEBUG_2D)
- fprintf(stderr, "Clear stencil writemask %x\n",
- ctx->Stencil.WriteMask[0]);
- }
- }
- }
-
- /* 16bpp doesn't support masked clears */
- if (vmesa->viaScreen->bytesPerPixel == 2 &&
- vmesa->ClearMask & 0xf0000000) {
- if (flag & VIA_FRONT)
- mask |= BUFFER_BIT_FRONT_LEFT;
- if (flag & VIA_BACK)
- mask |= BUFFER_BIT_BACK_LEFT;
- flag &= ~(VIA_FRONT | VIA_BACK);
- }
-
- if (flag) {
- drm_clip_rect_t *boxes, *tmp_boxes = 0;
- int nr = 0;
-
- LOCK_HARDWARE(vmesa);
-
- /* flip top to bottom */
- cy = dPriv->h - cy - ch;
- cx += vmesa->drawX + vmesa->drawXoff;
- cy += vmesa->drawY;
-
- if (!all) {
- drm_clip_rect_t *b = vmesa->pClipRects;
-
- boxes = tmp_boxes =
- (drm_clip_rect_t *)malloc(vmesa->numClipRects *
- sizeof(drm_clip_rect_t));
- if (!boxes) {
- UNLOCK_HARDWARE(vmesa);
- return;
- }
-
- for (; i < vmesa->numClipRects; i++) {
- GLint x = b[i].x1;
- GLint y = b[i].y1;
- GLint w = b[i].x2 - x;
- GLint h = b[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- boxes[nr].x1 = x;
- boxes[nr].y1 = y;
- boxes[nr].x2 = x + w;
- boxes[nr].y2 = y + h;
- nr++;
- }
- }
- else {
- boxes = vmesa->pClipRects;
- nr = vmesa->numClipRects;
- }
-
- if (flag & VIA_FRONT) {
- viaFillBuffer(vmesa, &vmesa->front, boxes, nr, vmesa->ClearColor,
- vmesa->ClearMask);
- }
-
- if (flag & VIA_BACK) {
- viaFillBuffer(vmesa, &vmesa->back, boxes, nr, vmesa->ClearColor,
- vmesa->ClearMask);
- }
-
- if (flag & VIA_DEPTH) {
- viaFillBuffer(vmesa, &vmesa->depth, boxes, nr, clear_depth,
- clear_depth_mask);
- }
-
- viaFlushDmaLocked(vmesa, VIA_NO_CLIPRECTS);
- UNLOCK_HARDWARE(vmesa);
-
- if (tmp_boxes)
- free(tmp_boxes);
- }
-
- if (mask)
- _swrast_Clear(ctx, mask, all, cx, cy, cw, ch);
-}
-
-
-
-
-static void viaDoSwapBuffers(struct via_context *vmesa,
- drm_clip_rect_t *b,
- GLuint nbox)
-{
- GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3;
- struct via_buffer *front = &vmesa->front;
- struct via_buffer *back = &vmesa->back;
- GLuint i;
-
- for (i = 0; i < nbox; i++, b++) {
- GLint x = b->x1 - vmesa->drawX;
- GLint y = b->y1 - vmesa->drawY;
- GLint w = b->x2 - b->x1;
- GLint h = b->y2 - b->y1;
-
- GLuint src = back->orig + y * back->pitch + x * bytePerPixel;
- GLuint dest = front->orig + y * front->pitch + x * bytePerPixel;
-
- viaBlit(vmesa,
- bytePerPixel << 3,
- src, back->pitch,
- dest, front->pitch,
- w, h,
- VIA_BLIT_COPY, 0, 0);
- }
-
- viaFlushDmaLocked(vmesa, VIA_NO_CLIPRECTS); /* redundant */
-}
-
-
-static void viaEmitBreadcrumbLocked( struct via_context *vmesa )
-{
- struct via_buffer *buffer = &vmesa->breadcrumb;
- GLuint value = vmesa->lastBreadcrumbWrite + 1;
-
- if (VIA_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, value);
-
- assert(!vmesa->dmaLow);
-
- viaBlit(vmesa,
- buffer->bpp,
- buffer->offset, buffer->pitch,
- buffer->offset, buffer->pitch,
- 1, 1,
- VIA_BLIT_FILL, value, 0);
-
- viaFlushDmaLocked(vmesa, VIA_NO_CLIPRECTS); /* often redundant */
- vmesa->lastBreadcrumbWrite = value;
-}
-
-void viaEmitBreadcrumb( struct via_context *vmesa )
-{
- LOCK_HARDWARE(vmesa);
- if (vmesa->dmaLow)
- viaFlushDmaLocked(vmesa, 0);
-
- viaEmitBreadcrumbLocked( vmesa );
- UNLOCK_HARDWARE(vmesa);
-}
-
-static GLboolean viaCheckIdle( struct via_context *vmesa )
-{
- if ((vmesa->regEngineStatus[0] & 0xFFFEFFFF) == 0x00020000) {
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-GLboolean viaCheckBreadcrumb( struct via_context *vmesa, GLuint value )
-{
- GLuint *buf = (GLuint *)vmesa->breadcrumb.map;
- vmesa->lastBreadcrumbRead = *buf;
-
- if (VIA_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d < %d: %d\n", __FUNCTION__, value,
- vmesa->lastBreadcrumbRead,
- !VIA_GEQ_WRAP(value, vmesa->lastBreadcrumbRead));
-
- return !VIA_GEQ_WRAP(value, vmesa->lastBreadcrumbRead);
-}
-
-static void viaWaitBreadcrumb( struct via_context *vmesa, GLuint value )
-{
- if (VIA_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s %d\n", __FUNCTION__, value);
-
- assert(!VIA_GEQ_WRAP(value, vmesa->lastBreadcrumbWrite));
-
- while (!viaCheckBreadcrumb( vmesa, value )) {
- viaSwapOutWork( vmesa );
- via_release_pending_textures( vmesa );
- }
-}
-
-
-void viaWaitIdle( struct via_context *vmesa, GLboolean light )
-{
- VIA_FLUSH_DMA(vmesa);
-
- if (VIA_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s lastDma %d lastBreadcrumbWrite %d\n",
- __FUNCTION__, vmesa->lastDma, vmesa->lastBreadcrumbWrite);
-
- /* Need to emit a new breadcrumb?
- */
- if (vmesa->lastDma == vmesa->lastBreadcrumbWrite) {
- LOCK_HARDWARE(vmesa);
- viaEmitBreadcrumbLocked( vmesa );
- UNLOCK_HARDWARE(vmesa);
- }
-
- /* Need to wait?
- */
- if (VIA_GEQ_WRAP(vmesa->lastDma, vmesa->lastBreadcrumbRead))
- viaWaitBreadcrumb( vmesa, vmesa->lastDma );
-
- if (light) return;
-
- LOCK_HARDWARE(vmesa);
- while(!viaCheckIdle(vmesa))
- ;
- UNLOCK_HARDWARE(vmesa);
- via_release_pending_textures(vmesa);
-}
-
-
-void viaWaitIdleLocked( struct via_context *vmesa, GLboolean light )
-{
- if (vmesa->dmaLow)
- viaFlushDmaLocked(vmesa, 0);
-
- if (VIA_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s lastDma %d lastBreadcrumbWrite %d\n",
- __FUNCTION__, vmesa->lastDma, vmesa->lastBreadcrumbWrite);
-
- /* Need to emit a new breadcrumb?
- */
- if (vmesa->lastDma == vmesa->lastBreadcrumbWrite) {
- viaEmitBreadcrumbLocked( vmesa );
- }
-
- /* Need to wait?
- */
- if (vmesa->lastDma >= vmesa->lastBreadcrumbRead)
- viaWaitBreadcrumb( vmesa, vmesa->lastDma );
-
- if (light) return;
-
- while(!viaCheckIdle(vmesa))
- ;
-
- via_release_pending_textures(vmesa);
-}
-
-
-
-/* Wait for command stream to be processed *and* the next vblank to
- * occur. Equivalent to calling WAIT_IDLE() and then WaitVBlank,
- * except that WAIT_IDLE() will spin the CPU polling, while this is
- * IRQ driven.
- */
-static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv,
- struct via_context *vmesa,
- GLuint value )
-{
- GLboolean missed_target;
-
- VIA_FLUSH_DMA(vmesa);
-
- if (!value)
- return;
-
- do {
- if (value < vmesa->lastBreadcrumbRead ||
- vmesa->thrashing)
- viaSwapOutWork(vmesa);
-
- driWaitForVBlank( dPriv, & vmesa->vbl_seq,
- vmesa->vblank_flags, & missed_target );
- if ( missed_target ) {
- vmesa->swap_missed_count++;
- (*dri_interface->getUST)( &vmesa->swap_missed_ust );
- }
- }
- while (!viaCheckBreadcrumb(vmesa, value));
-
- vmesa->thrashing = 0; /* reset flag on swap */
- vmesa->swap_count++;
- via_release_pending_textures( vmesa );
-}
-
-
-
-static void viaDoPageFlipLocked(struct via_context *vmesa, GLuint offset)
-{
- RING_VARS;
-
- if (VIA_DEBUG & DEBUG_2D)
- fprintf(stderr, "%s %x\n", __FUNCTION__, offset);
-
- if (!vmesa->nDoneFirstFlip) {
- vmesa->nDoneFirstFlip = GL_TRUE;
- BEGIN_RING(4);
- OUT_RING(HALCYON_HEADER2);
- OUT_RING(0x00fe0000);
- OUT_RING(0x0000000e);
- OUT_RING(0x0000000e);
- ADVANCE_RING();
- }
-
- BEGIN_RING(4);
- OUT_RING( HALCYON_HEADER2 );
- OUT_RING( 0x00fe0000 );
- OUT_RING((HC_SubA_HFBBasL << 24) | (offset & 0xFFFFF8) | 0x2);
- OUT_RING((HC_SubA_HFBDrawFirst << 24) |
- ((offset & 0xFF000000) >> 24) | 0x0100);
- ADVANCE_RING();
-
- vmesa->pfCurrentOffset = vmesa->sarea->pfCurrentOffset = offset;
-
- viaFlushDmaLocked(vmesa, VIA_NO_CLIPRECTS); /* often redundant */
-}
-
-void viaResetPageFlippingLocked(struct via_context *vmesa)
-{
- if (VIA_DEBUG & DEBUG_2D)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- viaDoPageFlipLocked( vmesa, 0 );
-
- if (vmesa->front.offset != 0) {
- struct via_buffer buffer_tmp;
- memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_buffer));
- memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_buffer));
- memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_buffer));
- }
-
- assert(vmesa->front.offset == 0);
- vmesa->doPageFlip = vmesa->allowPageFlip = 0;
-}
-
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void viaCopyBuffer(const __DRIdrawablePrivate *dPriv)
-{
- struct via_context *vmesa =
- (struct via_context *)dPriv->driContextPriv->driverPrivate;
-
- if (VIA_DEBUG & DEBUG_IOCTL)
- fprintf(stderr,
- "%s: lastSwap[1] %d lastSwap[0] %d lastWrite %d lastRead %d\n",
- __FUNCTION__,
- vmesa->lastSwap[1],
- vmesa->lastSwap[0],
- vmesa->lastBreadcrumbWrite,
- vmesa->lastBreadcrumbRead);
-
- VIA_FLUSH_DMA(vmesa);
-
- if (vmesa->vblank_flags == VBLANK_FLAG_SYNC &&
- vmesa->lastBreadcrumbWrite > 1)
- viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite-1);
- else
- viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastSwap[1]);
-
- LOCK_HARDWARE(vmesa);
-
- /* Catch and cleanup situation where we were pageflipping but have
- * stopped.
- */
- if (dPriv->numClipRects && vmesa->sarea->pfCurrentOffset != 0) {
- viaResetPageFlippingLocked(vmesa);
- UNLOCK_HARDWARE(vmesa);
- return;
- }
-
- viaDoSwapBuffers(vmesa, dPriv->pClipRects, dPriv->numClipRects);
- vmesa->lastSwap[1] = vmesa->lastSwap[0];
- vmesa->lastSwap[0] = vmesa->lastBreadcrumbWrite;
- viaEmitBreadcrumbLocked(vmesa);
- UNLOCK_HARDWARE(vmesa);
-
- (*dri_interface->getUST)( &vmesa->swap_ust );
-}
-
-
-void viaPageFlip(const __DRIdrawablePrivate *dPriv)
-{
- struct via_context *vmesa =
- (struct via_context *)dPriv->driContextPriv->driverPrivate;
- struct via_buffer buffer_tmp;
-
- VIA_FLUSH_DMA(vmesa);
- if (vmesa->vblank_flags == VBLANK_FLAG_SYNC &&
- vmesa->lastBreadcrumbWrite > 1)
- viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite - 1);
- else
- viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastSwap[0]);
-
- LOCK_HARDWARE(vmesa);
- viaDoPageFlipLocked(vmesa, vmesa->back.offset);
- vmesa->lastSwap[1] = vmesa->lastSwap[0];
- vmesa->lastSwap[0] = vmesa->lastBreadcrumbWrite;
- viaEmitBreadcrumbLocked(vmesa);
- UNLOCK_HARDWARE(vmesa);
-
- (*dri_interface->getUST)( &vmesa->swap_ust );
-
-
- /* KW: FIXME: When buffers are freed, could free frontbuffer by
- * accident:
- */
- memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_buffer));
- memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_buffer));
- memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_buffer));
-}
-
-
-
-
-#define VIA_CMDBUF_MAX_LAG 50000
-
-static int fire_buffer(struct via_context *vmesa)
-{
- drm_via_cmdbuffer_t bufI;
- int ret;
-
- bufI.buf = (char *)vmesa->dma;
- bufI.size = vmesa->dmaLow;
-
- if (vmesa->useAgp) {
- drm_via_cmdbuf_size_t bSiz;
-
- /* Do the CMDBUF_SIZE ioctl:
- */
- bSiz.func = VIA_CMDBUF_LAG;
- bSiz.wait = 1;
- bSiz.size = VIA_CMDBUF_MAX_LAG;
- do {
- ret = drmCommandWriteRead(vmesa->driFd, DRM_VIA_CMDBUF_SIZE,
- &bSiz, sizeof(bSiz));
- } while (ret == -EAGAIN);
- if (ret) {
- UNLOCK_HARDWARE(vmesa);
- fprintf(stderr, "%s: DRM_VIA_CMDBUF_SIZE returned %d\n",
- __FUNCTION__, ret);
- abort();
- return ret;
- }
-
- /* Actually fire the buffer:
- */
- do {
- ret = drmCommandWrite(vmesa->driFd, DRM_VIA_CMDBUFFER,
- &bufI, sizeof(bufI));
- } while (ret == -EAGAIN);
- if (ret) {
- UNLOCK_HARDWARE(vmesa);
- fprintf(stderr, "%s: DRM_VIA_CMDBUFFER returned %d\n",
- __FUNCTION__, ret);
- abort();
- /* If this fails, the original code fell back to the PCI path.
- */
- }
- else
- return 0;
-
- /* Fall through to PCI handling?!?
- */
- viaWaitIdleLocked(vmesa, GL_FALSE);
- }
-
- ret = drmCommandWrite(vmesa->driFd, DRM_VIA_PCICMD, &bufI, sizeof(bufI));
- if (ret) {
- UNLOCK_HARDWARE(vmesa);
- dump_dma(vmesa);
- fprintf(stderr, "%s: DRM_VIA_PCICMD returned %d\n", __FUNCTION__, ret);
- abort();
- }
-
- return ret;
-}
-
-
-/* Inserts the surface addresss and active cliprects one at a time
- * into the head of the DMA buffer being flushed. Fires the buffer
- * for each cliprect.
- */
-static void via_emit_cliprect(struct via_context *vmesa,
- drm_clip_rect_t *b)
-{
- struct via_buffer *buffer = vmesa->drawBuffer;
- GLuint *vb = (GLuint *)(vmesa->dma + vmesa->dmaCliprectAddr);
-
- GLuint format = (vmesa->viaScreen->bitsPerPixel == 0x20
- ? HC_HDBFM_ARGB8888
- : HC_HDBFM_RGB565);
-
- GLuint pitch = buffer->pitch;
- GLuint offset = buffer->orig;
-
- if (0)
- fprintf(stderr, "emit cliprect for box %d,%d %d,%d\n",
- b->x1, b->y1, b->x2, b->y2);
-
- vb[0] = HC_HEADER2;
- vb[1] = (HC_ParaType_NotTex << 16);
-
- if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) {
- vb[2] = (HC_SubA_HClipTB << 24) | 0x0;
- vb[3] = (HC_SubA_HClipLR << 24) | 0x0;
- }
- else {
- vb[2] = (HC_SubA_HClipTB << 24) | (b->y1 << 12) | b->y2;
- vb[3] = (HC_SubA_HClipLR << 24) | (b->x1 << 12) | b->x2;
- }
-
- vb[4] = (HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF);
- vb[5] = (HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000) >> 24);
-
- vb[6] = (HC_SubA_HSPXYOS << 24) | ((31-vmesa->drawXoff) << HC_HSPXOS_SHIFT);
- vb[7] = (HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch;
-}
-
-
-
-static int intersect_rect(drm_clip_rect_t *out,
- drm_clip_rect_t *a,
- drm_clip_rect_t *b)
-{
- *out = *a;
-
- if (0)
- fprintf(stderr, "intersect %d,%d %d,%d and %d,%d %d,%d\n",
- a->x1, a->y1, a->x2, a->y2,
- b->x1, b->y1, b->x2, b->y2);
-
- if (b->x1 > out->x1) out->x1 = b->x1;
- if (b->x2 < out->x2) out->x2 = b->x2;
- if (out->x1 >= out->x2) return 0;
-
- if (b->y1 > out->y1) out->y1 = b->y1;
- if (b->y2 < out->y2) out->y2 = b->y2;
- if (out->y1 >= out->y2) return 0;
-
- return 1;
-}
-
-void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags)
-{
- int i;
- RING_VARS;
-
- if (VIA_DEBUG & (DEBUG_IOCTL|DEBUG_DMA))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (*(GLuint *)vmesa->driHwLock != (DRM_LOCK_HELD|vmesa->hHWContext) &&
- *(GLuint *)vmesa->driHwLock !=
- (DRM_LOCK_HELD|DRM_LOCK_CONT|vmesa->hHWContext)) {
- fprintf(stderr, "%s called without lock held\n", __FUNCTION__);
- abort();
- }
-
- if (vmesa->dmaLow == 0) {
- return;
- }
-
- assert(vmesa->dmaLastPrim == 0);
-
- /* viaFinishPrimitive can add up to 8 bytes beyond VIA_DMA_HIGHWATER:
- */
- if (vmesa->dmaLow > VIA_DMA_HIGHWATER + 8) {
- fprintf(stderr, "buffer overflow in Flush Prims = %d\n",vmesa->dmaLow);
- abort();
- }
-
- switch (vmesa->dmaLow & 0x1F) {
- case 8:
- BEGIN_RING_NOCHECK( 6 );
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- ADVANCE_RING();
- break;
- case 16:
- BEGIN_RING_NOCHECK( 4 );
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- ADVANCE_RING();
- break;
- case 24:
- BEGIN_RING_NOCHECK( 10 );
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- OUT_RING( HC_DUMMY );
- ADVANCE_RING();
- break;
- case 0:
- break;
- default:
- if (VIA_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s: unaligned value for vmesa->dmaLow: %x\n",
- __FUNCTION__, vmesa->dmaLow);
- }
-
- vmesa->lastDma = vmesa->lastBreadcrumbWrite;
-
- if (VIA_DEBUG & DEBUG_DMA)
- dump_dma( vmesa );
-
- if (flags & VIA_NO_CLIPRECTS) {
- if (0) fprintf(stderr, "%s VIA_NO_CLIPRECTS\n", __FUNCTION__);
- assert(vmesa->dmaCliprectAddr == ~0);
- fire_buffer( vmesa );
- }
- else if (vmesa->dmaCliprectAddr == ~0) {
- /* Contains only state. Could just dump the packet?
- */
- if (0) fprintf(stderr, "%s: no dmaCliprectAddr\n", __FUNCTION__);
- if (0) fire_buffer( vmesa );
- }
- else if (vmesa->numClipRects) {
- drm_clip_rect_t *pbox = vmesa->pClipRects;
-
- for (i = 0; i < vmesa->numClipRects; i++) {
- drm_clip_rect_t b;
-
- b.x1 = pbox[i].x1 - (vmesa->drawX + vmesa->drawXoff);
- b.x2 = pbox[i].x2 - (vmesa->drawX + vmesa->drawXoff);
- b.y1 = pbox[i].y1 - vmesa->drawY;
- b.y2 = pbox[i].y2 - vmesa->drawY;
-
- if (vmesa->scissor &&
- !intersect_rect(&b, &b, &vmesa->scissorRect))
- continue;
-
- b.x1 += vmesa->drawXoff;
- b.x2 += vmesa->drawXoff;
-
- via_emit_cliprect(vmesa, &b);
-
- if (fire_buffer(vmesa) != 0) {
- dump_dma( vmesa );
- goto done;
- }
- }
- } else {
- if (0) fprintf(stderr, "%s: no cliprects\n", __FUNCTION__);
- UNLOCK_HARDWARE(vmesa);
- sched_yield();
- LOCK_HARDWARE(vmesa);
- }
-
- done:
- /* Reset vmesa vars:
- */
- vmesa->dmaLow = 0;
- vmesa->dmaCliprectAddr = ~0;
- vmesa->newEmitState = ~0;
-}
-
-void viaWrapPrimitive( struct via_context *vmesa )
-{
- GLenum renderPrimitive = vmesa->renderPrimitive;
- GLenum hwPrimitive = vmesa->hwPrimitive;
-
- if (VIA_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (vmesa->dmaLastPrim)
- viaFinishPrimitive( vmesa );
-
- viaFlushDma(vmesa);
-
- if (renderPrimitive != GL_POLYGON + 1)
- viaRasterPrimitive( vmesa->glCtx,
- renderPrimitive,
- hwPrimitive );
-
-}
-
-void viaFlushDma(struct via_context *vmesa)
-{
- if (vmesa->dmaLow) {
- assert(!vmesa->dmaLastPrim);
-
- LOCK_HARDWARE(vmesa);
- viaFlushDmaLocked(vmesa, 0);
- UNLOCK_HARDWARE(vmesa);
- }
-}
-
-static void viaFlush(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- VIA_FLUSH_DMA(vmesa);
-}
-
-static void viaFinish(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- VIA_FLUSH_DMA(vmesa);
- viaWaitIdle(vmesa, GL_FALSE);
-}
-
-static void viaClearStencil(GLcontext *ctx, int s)
-{
- return;
-}
-
-void viaInitIoctlFuncs(GLcontext *ctx)
-{
- ctx->Driver.Flush = viaFlush;
- ctx->Driver.Clear = viaClear;
- ctx->Driver.Finish = viaFinish;
- ctx->Driver.ClearStencil = viaClearStencil;
-}
-
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.h
deleted file mode 100644
index d5d95aa8f..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_ioctl.h
+++ /dev/null
@@ -1,135 +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.
- */
-
-#ifndef _VIAIOCTL_H
-#define _VIAIOCTL_H
-
-#include "via_context.h"
-
-
-void viaFinishPrimitive(struct via_context *vmesa);
-void viaFlushDma(struct via_context *vmesa);
-void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags);
-
-void viaInitIoctlFuncs(GLcontext *ctx);
-void viaCopyBuffer(const __DRIdrawablePrivate *dpriv);
-void viaPageFlip(const __DRIdrawablePrivate *dpriv);
-void viaCheckDma(struct via_context *vmesa, GLuint bytes);
-void viaResetPageFlippingLocked(struct via_context *vmesa);
-void viaWaitIdle(struct via_context *vmesa, GLboolean light);
-void viaWaitIdleLocked(struct via_context *vmesa, GLboolean light);
-
-GLboolean viaCheckBreadcrumb( struct via_context *vmesa, GLuint value );
-void viaEmitBreadcrumb( struct via_context *vmesa );
-
-
-#define VIA_FINISH_PRIM(vmesa) do { \
- if (vmesa->dmaLastPrim) \
- viaFinishPrimitive( vmesa ); \
-} while (0)
-
-#define VIA_FLUSH_DMA(vmesa) do { \
- VIA_FINISH_PRIM(vmesa); \
- if (vmesa->dmaLow) \
- viaFlushDma(vmesa); \
-} while (0)
-
-
-void viaWrapPrimitive( struct via_context *vmesa );
-
-static __inline__ GLuint *viaAllocDma(struct via_context *vmesa, int bytes)
-{
- if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) {
- viaFlushDma(vmesa);
- }
-
- {
- GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow);
- vmesa->dmaLow += bytes;
- return start;
- }
-}
-
-
-static GLuint __inline__ *viaExtendPrimitive(struct via_context *vmesa, int bytes)
-{
- if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) {
- viaWrapPrimitive(vmesa);
- }
-
- {
- GLuint *start = (GLuint *)(vmesa->dma + vmesa->dmaLow);
- vmesa->dmaLow += bytes;
- return start;
- }
-}
-
-
-
-
-#define RING_VARS GLuint *_vb = 0, _nr, _x;
-
-#define BEGIN_RING(n) do { \
- if (_vb != 0) abort(); \
- _vb = viaAllocDma(vmesa, (n) * sizeof(GLuint)); \
- _nr = (n); \
- _x = 0; \
-} while (0)
-
-#define BEGIN_RING_NOCHECK(n) do { \
- if (_vb != 0) abort(); \
- _vb = (GLuint *)(vmesa->dma + vmesa->dmaLow); \
- vmesa->dmaLow += (n) * sizeof(GLuint); \
- _nr = (n); \
- _x = 0; \
-} while (0)
-
-#define OUT_RING(n) _vb[_x++] = (n)
-
-#define ADVANCE_RING() do { \
- if (_x != _nr) abort(); \
- _vb = 0; \
-} while (0)
-
-#define ADVANCE_RING_VARIABLE() do { \
- if (_x > _nr) abort(); \
- vmesa->dmaLow -= (_nr - _x) * sizeof(GLuint); \
- _vb = 0; \
-} while (0)
-
-
-#define QWORD_PAD_RING() do { \
- if (vmesa->dmaLow & 0x4) { \
- BEGIN_RING(1); \
- OUT_RING(HC_DUMMY); \
- ADVANCE_RING(); \
- } \
-} while (0)
-
-#define VIA_GEQ_WRAP(left, right) \
- (((left) - (right)) < ( 1 << 23))
-
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_memcpy.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_memcpy.c
deleted file mode 100644
index d7b05bcaa..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_memcpy.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2004 Thomas Hellstrom, 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
- * THE CODE SUPPLIER(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.
- */
-
-/* Thomas' orginal gutted for mesa by Keith Whitwell
- */
-
-#include "via_tex.h"
-
-#if defined( USE_SSE_ASM )
-
-#define SSE_PREFETCH " prefetchnta "
-#define FENCE __asm__ __volatile__ ("sfence":::"memory");
-
-
-#define PREFETCH1(arch_prefetch,from) \
- __asm__ __volatile__ ( \
- "1: " arch_prefetch "(%0)\n" \
- arch_prefetch "32(%0)\n" \
- arch_prefetch "64(%0)\n" \
- arch_prefetch "96(%0)\n" \
- arch_prefetch "128(%0)\n" \
- arch_prefetch "160(%0)\n" \
- arch_prefetch "192(%0)\n" \
- arch_prefetch "256(%0)\n" \
- arch_prefetch "288(%0)\n" \
- "2:\n" \
- : : "r" (from) );
-
-
-
-#define small_memcpy(to,from,n) \
- { \
- __asm__ __volatile__( \
- "movl %2,%%ecx\n\t" \
- "sarl $2,%%ecx\n\t" \
- "rep ; movsl\n\t" \
- "testb $2,%b2\n\t" \
- "je 1f\n\t" \
- "movsw\n" \
- "1:\ttestb $1,%b2\n\t" \
- "je 2f\n\t" \
- "movsb\n" \
- "2:" \
- :"=&D" (to), "=&S" (from) \
- :"q" (n),"0" ((long) to),"1" ((long) from) \
- : "%ecx","memory"); \
- }
-
-
-#define SSE_CPY(prefetch,from,to,dummy,lcnt) \
- if ((unsigned long) from & 15) { \
- __asm__ __volatile__ ( \
- "1:\n" \
- prefetch "320(%1)\n" \
- " movups (%1), %%xmm0\n" \
- " movups 16(%1), %%xmm1\n" \
- " movntps %%xmm0, (%0)\n" \
- " movntps %%xmm1, 16(%0)\n" \
- prefetch "352(%1)\n" \
- " movups 32(%1), %%xmm2\n" \
- " movups 48(%1), %%xmm3\n" \
- " movntps %%xmm2, 32(%0)\n" \
- " movntps %%xmm3, 48(%0)\n" \
- " addl $64,%0\n" \
- " addl $64,%1\n" \
- " decl %2\n" \
- " jne 1b\n" \
- :"=&D"(to), "=&S"(from), "=&r"(dummy) \
- :"0" (to), "1" (from), "2" (lcnt): "memory"); \
- } else { \
- __asm__ __volatile__ ( \
- "2:\n" \
- prefetch "320(%1)\n" \
- " movaps (%1), %%xmm0\n" \
- " movaps 16(%1), %%xmm1\n" \
- " movntps %%xmm0, (%0)\n" \
- " movntps %%xmm1, 16(%0)\n" \
- prefetch "352(%1)\n" \
- " movaps 32(%1), %%xmm2\n" \
- " movaps 48(%1), %%xmm3\n" \
- " movntps %%xmm2, 32(%0)\n" \
- " movntps %%xmm3, 48(%0)\n" \
- " addl $64,%0\n" \
- " addl $64,%1\n" \
- " decl %2\n" \
- " jne 2b\n" \
- :"=&D"(to), "=&S"(from), "=&r"(dummy) \
- :"0" (to), "1" (from), "2" (lcnt): "memory"); \
- }
-
-
-
-/*
- */
-void via_sse_memcpy(void *to,
- const void *from,
- size_t sz)
-
-{
- int dummy;
- int lcnt = sz >> 6;
- int rest = sz & 63;
-
- PREFETCH1(SSE_PREFETCH,from);
-
- if (lcnt > 5) {
- lcnt -= 5;
- SSE_CPY(SSE_PREFETCH,from,to,dummy,lcnt);
- lcnt = 5;
- }
- if (lcnt) {
- SSE_CPY("#",from,to,dummy,lcnt);
- }
- if (rest) small_memcpy(to, from, rest);
- FENCE;
-}
-
-#endif /* defined( USE_SSE_ASM ) */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_render.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_render.c
deleted file mode 100644
index 387473ef5..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_render.c
+++ /dev/null
@@ -1,131 +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.
- */
-
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware acceleration where possible.
- *
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "mtypes.h"
-
-#include "tnl/t_context.h"
-
-#include "via_context.h"
-#include "via_tris.h"
-#include "via_state.h"
-#include "via_ioctl.h"
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 1
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_LINE_LOOP 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0
-
-#define LOCAL_VARS struct via_context *vmesa = VIA_CONTEXT(ctx)
-#define INIT(prim) do { \
- viaRasterPrimitive(ctx, prim, prim); \
-} while (0)
-#define GET_CURRENT_VB_MAX_VERTS() \
- ((VIA_DMA_BUF_SZ - (512 + (int)vmesa->dmaLow)) / (vmesa->vertexSize * 4))
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (VIA_DMA_BUF_SZ - 512) / (vmesa->vertexSize * 4)
-
-#define ALLOC_VERTS( nr ) \
- viaExtendPrimitive( vmesa, (nr) * vmesa->vertexSize * 4)
-
-#define EMIT_VERTS(ctx, j, nr, buf) \
- _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf )
-
-#define FLUSH() VIA_FINISH_PRIM( vmesa )
-
-#define TAG(x) via_fast##x
-#include "tnl_dd/t_dd_dmatmp.h"
-#undef TAG
-#undef LOCAL_VARS
-#undef INIT
-
-/**********************************************************************/
-/* Fast Render pipeline stage */
-/**********************************************************************/
-static GLboolean via_run_fastrender(GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
-
- tnl->Driver.Render.Start(ctx);
-
- if (VB->ClipOrMask ||
- vmesa->renderIndex != 0 ||
- !via_fastvalidate_render( ctx, VB )) {
- tnl->Driver.Render.Finish(ctx);
- return GL_TRUE;
- }
-
- tnl->clipspace.new_inputs |= VERT_BIT_POS;
-
- for (i = 0; i < VB->PrimitiveCount; ++i) {
- GLuint mode = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
- if (length)
- via_fastrender_tab_verts[mode & PRIM_MODE_MASK](ctx, start, start+length, mode);
- }
-
- tnl->Driver.Render.Finish(ctx);
-
- return GL_FALSE; /* finished the pipe */
-}
-
-const struct tnl_pipeline_stage _via_fastrender_stage =
-{
- "via fast render",
- NULL,
- NULL,
- NULL,
- NULL,
- via_run_fastrender /* run */
-};
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.c
deleted file mode 100644
index 267eeffc8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.c
+++ /dev/null
@@ -1,491 +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 "utils.h"
-#include "dri_util.h"
-#include "glheader.h"
-#include "context.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "vblank.h"
-
-#include "via_state.h"
-#include "via_tex.h"
-#include "via_span.h"
-#include "via_tris.h"
-#include "via_ioctl.h"
-#include "via_screen.h"
-#include "via_fb.h"
-#include "via_dri.h"
-
-#include "GL/internal/dri_interface.h"
-
-/* Radeon configuration
- */
-#include "xmlpool.h"
-
-const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_DEBUG
- DRI_CONF_NO_RAST(false)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-static const GLuint __driNConfigOptions = 3;
-
-extern const struct dri_extension card_extensions[];
-
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-static drmBufMapPtr via_create_empty_buffers(void)
-{
- drmBufMapPtr retval;
-
- retval = (drmBufMapPtr)MALLOC(sizeof(drmBufMap));
- if (retval == NULL) return NULL;
- memset(retval, 0, sizeof(drmBufMap));
-
- retval->list = (drmBufPtr)MALLOC(sizeof(drmBuf) * VIA_DMA_BUF_NR);
- if (retval->list == NULL) {
- FREE(retval);
- return NULL;
- }
- memset(retval->list, 0, sizeof(drmBuf) * VIA_DMA_BUF_NR);
- return retval;
-}
-
-static void via_free_empty_buffers( drmBufMapPtr bufs )
-{
- if (bufs && bufs->list)
- FREE(bufs->list);
-
- if (bufs)
- FREE(bufs);
-}
-
-
-static GLboolean
-viaInitDriver(__DRIscreenPrivate *sPriv)
-{
- viaScreenPrivate *viaScreen;
- VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(VIADRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- viaScreen = (viaScreenPrivate *) CALLOC(sizeof(viaScreenPrivate));
- if (!viaScreen) {
- __driUtilMessage("viaInitDriver: alloc viaScreenPrivate struct failed");
- return GL_FALSE;
- }
-
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&viaScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
-
- viaScreen->driScrnPriv = sPriv;
- sPriv->private = (void *)viaScreen;
-
- viaScreen->deviceID = gDRIPriv->deviceID;
- viaScreen->width = gDRIPriv->width;
- viaScreen->height = gDRIPriv->height;
- viaScreen->mem = gDRIPriv->mem;
- viaScreen->bitsPerPixel = gDRIPriv->bytesPerPixel * 8;
- viaScreen->bytesPerPixel = gDRIPriv->bytesPerPixel;
- viaScreen->fbOffset = 0;
- viaScreen->fbSize = gDRIPriv->fbSize;
- viaScreen->irqEnabled = gDRIPriv->irqEnabled;
- viaScreen->irqEnabled = 1;
-
- if (VIA_DEBUG & DEBUG_DRI) {
- fprintf(stderr, "deviceID = %08x\n", viaScreen->deviceID);
- fprintf(stderr, "width = %08x\n", viaScreen->width);
- fprintf(stderr, "height = %08x\n", viaScreen->height);
- fprintf(stderr, "cpp = %08x\n", viaScreen->cpp);
- fprintf(stderr, "fbOffset = %08x\n", viaScreen->fbOffset);
- }
-
- viaScreen->bufs = via_create_empty_buffers();
- if (viaScreen->bufs == NULL) {
- __driUtilMessage("viaInitDriver: via_create_empty_buffers() failed");
- FREE(viaScreen);
- return GL_FALSE;
- }
-
- if (drmMap(sPriv->fd,
- gDRIPriv->regs.handle,
- gDRIPriv->regs.size,
- (drmAddress *)&viaScreen->reg) != 0) {
- FREE(viaScreen);
- sPriv->private = NULL;
- __driUtilMessage("viaInitDriver: drmMap regs failed");
- return GL_FALSE;
- }
-
- if (gDRIPriv->agp.size) {
- if (drmMap(sPriv->fd,
- gDRIPriv->agp.handle,
- gDRIPriv->agp.size,
- (drmAddress *)&viaScreen->agpLinearStart) != 0) {
- drmUnmap(viaScreen->reg, gDRIPriv->regs.size);
- FREE(viaScreen);
- sPriv->private = NULL;
- __driUtilMessage("viaInitDriver: drmMap agp failed");
- return GL_FALSE;
- }
-
- /*
- * FIXME: This is an invalid assumption that works until handle is
- * changed to mean something else than the 32-bit physical AGP address.
- */
-
- viaScreen->agpBase = gDRIPriv->agp.handle;
- } else
- viaScreen->agpLinearStart = 0;
-
- viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset;
-
- if ( glx_enable_extension != NULL ) {
- if ( viaScreen->irqEnabled ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- }
-
- return GL_TRUE;
-}
-
-static void
-viaDestroyScreen(__DRIscreenPrivate *sPriv)
-{
- viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
- VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
-
- drmUnmap(viaScreen->reg, gDRIPriv->regs.size);
- if (gDRIPriv->agp.size)
- drmUnmap(viaScreen->agpLinearStart, gDRIPriv->agp.size);
-
- via_free_empty_buffers(viaScreen->bufs);
-
- FREE(viaScreen);
- sPriv->private = NULL;
-}
-
-
-static GLboolean
-viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap)
-{
- viaScreenPrivate *screen = (viaScreenPrivate *) driScrnPriv->private;
-
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
-
-
- if (isPixmap) {
- /* KW: This needs work, disabled for now:
- */
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-
- return (driDrawPriv->driverPrivate != NULL);
-#endif
- return GL_FALSE;
- }
- else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-#else
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- /* XXX check/fix the offset/pitch parameters! */
- {
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->bytesPerPixel,
- 0, screen->width);
- viaSetSpanFunctions(frontRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->bytesPerPixel,
- 0, screen->width);
- viaSetSpanFunctions(backRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 16) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->bytesPerPixel,
- 0, screen->width);
- viaSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 24) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->bytesPerPixel,
- 0, screen->width);
- viaSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
- else if (mesaVis->depthBits == 32) {
- driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->bytesPerPixel,
- 0, screen->width);
- viaSetSpanFunctions(depthRb, mesaVis);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- if (mesaVis->stencilBits > 0 && !swStencil) {
- driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->bytesPerPixel,
- 0, screen->width);
- viaSetSpanFunctions(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;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-
-static void
-viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *)(driDrawPriv->driverPrivate));
-}
-
-
-
-static struct __DriverAPIRec viaAPI = {
- .InitDriver = viaInitDriver,
- .DestroyScreen = viaDestroyScreen,
- .CreateContext = viaCreateContext,
- .DestroyContext = viaDestroyContext,
- .CreateBuffer = viaCreateBuffer,
- .DestroyBuffer = viaDestroyBuffer,
- .SwapBuffers = viaSwapBuffers,
- .MakeCurrent = viaMakeCurrent,
- .UnbindContext = viaUnbindContext,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *
-viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer )
-{
- __GLcontextModes * modes;
- __GLcontextModes * m;
- unsigned num_modes;
- const unsigned back_buffer_factor = (have_back_buffer) ? 2 : 1;
- 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 */
- };
-
- /* The 32-bit depth-buffer mode isn't supported yet, so don't actually
- * enable it.
- */
- static const u_int8_t depth_bits_array[4] = { 0, 16, 24, 32 };
- static const u_int8_t stencil_bits_array[4] = { 0, 0, 8, 0 };
- const unsigned depth_buffer_factor = 3;
-
-
- 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_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->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;
- }
-
- 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 __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __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,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR,
- VIA_DRIDDX_VERSION_MINOR,
- VIA_DRIDDX_VERSION_PATCH };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 2, 3, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "Unichrome",
- 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, &viaAPI);
- if ( psp != NULL ) {
- VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv;
- *driver_modes = viaFillInModes( dri_priv->bytesPerPixel * 8,
- GL_TRUE );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- fprintf(stderr, "%s - succeeded\n", __FUNCTION__);
- return (void *) psp;
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- struct via_context *vmesa;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- vmesa = (struct via_context *) dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = vmesa->swap_count;
- sInfo->swap_ust = vmesa->swap_ust;
- sInfo->swap_missed_count = vmesa->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, vmesa->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.h
deleted file mode 100644
index 84aa5aef8..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_screen.h
+++ /dev/null
@@ -1,95 +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.
- */
-
-#ifndef _VIAINIT_H
-#define _VIAINIT_H
-
-#include <sys/time.h>
-#include "dri_util.h"
-#include "via_dri.h"
-#include "xmlconfig.h"
-
-typedef struct {
- viaRegion regs;
- viaRegion agp;
- int deviceID;
- int width;
- int height;
- int mem;
-
- int cpp;
- int bitsPerPixel;
- int bytesPerPixel;
- int fbFormat;
- int fbOffset;
- int fbSize;
-
- int fbStride;
-
- int backOffset;
- int depthOffset;
-
- int backPitch;
- int backPitchBits;
-
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
-
- drmAddress reg;
- drmAddress agpLinearStart;
- GLuint agpBase;
-
- __DRIscreenPrivate *driScrnPriv;
- drmBufMapPtr bufs;
- unsigned int sareaPrivOffset;
- /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
- int VQEnable;
- int irqEnabled;
-
- /* Configuration cache with default values for all contexts */
- driOptionCache optionCache;
-} viaScreenPrivate;
-
-
-extern GLboolean
-viaCreateContext(const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-extern void
-viaDestroyContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-viaUnbindContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
-extern void
-viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.c
deleted file mode 100644
index 40772f480..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.c
+++ /dev/null
@@ -1,289 +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 "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-#include "via_context.h"
-#include "via_span.h"
-#include "via_ioctl.h"
-#include "swrast/swrast.h"
-
-#define DBG 0
-
-#define Y_FLIP(_y) (height - _y - 1)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- struct via_context *vmesa = VIA_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- GLuint draw_pitch = vmesa->drawBuffer->pitch; \
- GLuint read_pitch = vmesa->readBuffer->pitch; \
- GLuint height = dPriv->h; \
- GLint p = 0; \
- char *buf = (char *)(vmesa->drawBuffer->origMap + vmesa->drawXoff * vmesa->viaScreen->bytesPerPixel); \
- char *read_buf = (char *)(vmesa->readBuffer->origMap + vmesa->drawXoff * vmesa->viaScreen->bytesPerPixel); \
- (void) (read_pitch && draw_pitch && buf && read_buf && p);
-
-/* ================================================================
- * Color buffer
- */
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 2 + (_y) * read_pitch)
-#define GET_DST_PTR(_x, _y) ( buf + (_x) * 2 + (_y) * draw_pitch)
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) via##x##_565
-#define TAG2(x,y) via##x##_565##y
-#include "spantmp2.h"
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 4 + (_y) * read_pitch)
-#define GET_DST_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * draw_pitch)
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) via##x##_8888
-#define TAG2(x,y) via##x##_8888##y
-#include "spantmp2.h"
-
-
-/* 16 bit depthbuffer functions.
- */
-#define LOCAL_DEPTH_VARS \
- struct via_context *vmesa = VIA_CONTEXT(ctx); \
- __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
- GLuint depth_pitch = vmesa->depth.pitch; \
- GLuint height = dPriv->h; \
- char *buf = (char *)(vmesa->depth.map + (vmesa->drawXoff * vmesa->depth.bpp/8))
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-
-#define WRITE_DEPTH(_x, _y, d) \
- *(GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch) = d;
-
-#define READ_DEPTH(d, _x, _y) \
- d = *(volatile GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch);
-
-#define TAG(x) via##x##_16
-#include "depthtmp.h"
-
-/* 32 bit depthbuffer functions.
- */
-#define WRITE_DEPTH(_x, _y, d) \
- *(GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch) = d;
-
-#define READ_DEPTH(d, _x, _y) \
- d = *(volatile GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch);
-
-#define TAG(x) via##x##_32
-#include "depthtmp.h"
-
-
-
-/* 24/8 bit interleaved depth/stencil functions
- */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch); \
- tmp &= 0x000000ff; \
- tmp |= ((d)<<8); \
- *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) = tmp; \
-}
-
-#define READ_DEPTH( d, _x, _y ) \
- d = (*(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch)) >> 8;
-
-
-#define TAG(x) via##x##_24_8
-#include "depthtmp.h"
-
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch); \
- tmp &= 0xffffff00; \
- tmp |= (d); \
- *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) & 0xff;
-
-#define TAG(x) via##x##_24_8
-#include "stenciltmp.h"
-
-
-
-static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLuint bufferBit)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
- }
- else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
- }
- else {
- ASSERT(0);
- }
-}
-
-/* Move locking out to get reasonable span performance.
- */
-void viaSpanRenderStart( GLcontext *ctx )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- viaWaitIdle(vmesa, GL_FALSE);
- LOCK_HARDWARE(vmesa);
-}
-
-void viaSpanRenderFinish( GLcontext *ctx )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- _swrast_flush( ctx );
- UNLOCK_HARDWARE( vmesa );
-}
-
-void viaInitSpanFuncs(GLcontext *ctx)
-{
-#if 0
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-#endif
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = viaSetBuffer;
-#if 0
- if (vmesa->viaScreen->bitsPerPixel == 16) {
- viaInitPointers_565( swdd );
- }
- else if (vmesa->viaScreen->bitsPerPixel == 32) {
- viaInitPointers_8888( swdd );
- }
- else {
- assert(0);
- }
-#endif
-#if 0
- if (vmesa->glCtx->Visual.depthBits == 16) {
- swdd->ReadDepthSpan = viaReadDepthSpan_16;
- swdd->WriteDepthSpan = viaWriteDepthSpan_16;
- swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_16;
- swdd->ReadDepthPixels = viaReadDepthPixels_16;
- swdd->WriteDepthPixels = viaWriteDepthPixels_16;
- }
- else if (vmesa->glCtx->Visual.depthBits == 24) {
- swdd->ReadDepthSpan = viaReadDepthSpan_24_8;
- swdd->WriteDepthSpan = viaWriteDepthSpan_24_8;
- swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_24_8;
- swdd->ReadDepthPixels = viaReadDepthPixels_24_8;
- swdd->WriteDepthPixels = viaWriteDepthPixels_24_8;
-
- swdd->WriteStencilSpan = viaWriteStencilSpan_24_8;
- swdd->ReadStencilSpan = viaReadStencilSpan_24_8;
- swdd->WriteStencilPixels = viaWriteStencilPixels_24_8;
- swdd->ReadStencilPixels = viaReadStencilPixels_24_8;
- }
- else if (vmesa->glCtx->Visual.depthBits == 32) {
- swdd->ReadDepthSpan = viaReadDepthSpan_32;
- swdd->WriteDepthSpan = viaWriteDepthSpan_32;
- swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_32;
- swdd->ReadDepthPixels = viaReadDepthPixels_32;
- swdd->WriteDepthPixels = viaWriteDepthPixels_32;
- }
-#endif
-
- swdd->SpanRenderStart = viaSpanRenderStart;
- swdd->SpanRenderFinish = viaSpanRenderFinish;
-
-#if 0
- swdd->WriteCI8Span = NULL;
- swdd->WriteCI32Span = NULL;
- swdd->WriteMonoCISpan = NULL;
- swdd->WriteCI32Pixels = NULL;
- swdd->WriteMonoCIPixels = NULL;
- swdd->ReadCI32Span = NULL;
- swdd->ReadCI32Pixels = NULL;
-#endif
-}
-
-
-
-/**
- * Plug in the Get/Put routines for the given driRenderbuffer.
- */
-void
-viaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
-{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- viaInitPointers_565(&drb->Base);
- }
- else {
- viaInitPointers_8888(&drb->Base);
- }
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = viaReadDepthSpan_16;
- drb->Base.GetValues = viaReadDepthPixels_16;
- drb->Base.PutRow = viaWriteDepthSpan_16;
- drb->Base.PutMonoRow = viaWriteMonoDepthSpan_16;
- drb->Base.PutValues = viaWriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- drb->Base.GetRow = viaReadDepthSpan_24_8;
- drb->Base.GetValues = viaReadDepthPixels_24_8;
- drb->Base.PutRow = viaWriteDepthSpan_24_8;
- drb->Base.PutMonoRow = viaWriteMonoDepthSpan_24_8;
- drb->Base.PutValues = viaWriteDepthPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
- drb->Base.GetRow = viaReadDepthSpan_32;
- drb->Base.GetValues = viaReadDepthPixels_32;
- drb->Base.PutRow = viaWriteDepthSpan_32;
- drb->Base.PutMonoRow = viaWriteMonoDepthSpan_32;
- drb->Base.PutValues = viaWriteDepthPixels_32;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- drb->Base.GetRow = viaReadStencilSpan_24_8;
- drb->Base.GetValues = viaReadStencilPixels_24_8;
- drb->Base.PutRow = viaWriteStencilSpan_24_8;
- drb->Base.PutMonoRow = viaWriteMonoStencilSpan_24_8;
- drb->Base.PutValues = viaWriteStencilPixels_24_8;
- drb->Base.PutMonoValues = NULL;
- }
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.h
deleted file mode 100644
index c3bd24b0e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_span.h
+++ /dev/null
@@ -1,37 +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.
- */
-
-#ifndef _VIA_SPAN_H
-#define _VIA_SPAN_H
-
-#include "drirenderbuffer.h"
-
-extern void viaInitSpanFuncs(GLcontext *ctx);
-extern void viaSpanRenderStart( GLcontext *ctx );
-extern void viaSpanRenderFinish( GLcontext *ctx );
-
-extern void
-viaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.c
deleted file mode 100644
index 4037d14ff..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.c
+++ /dev/null
@@ -1,1550 +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 "glheader.h"
-#include "buffers.h"
-#include "context.h"
-#include "macros.h"
-#include "colormac.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "mm.h"
-#include "via_context.h"
-#include "via_state.h"
-#include "via_tex.h"
-#include "via_tris.h"
-#include "via_ioctl.h"
-#include "via_3d_reg.h"
-
-#include "swrast/swrast.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "swrast_setup/swrast_setup.h"
-
-#include "tnl/t_pipeline.h"
-
-
-static GLuint ROP[16] = {
- HC_HROP_BLACK, /* GL_CLEAR 0 */
- HC_HROP_DPa, /* GL_AND s & d */
- HC_HROP_PDna, /* GL_AND_REVERSE s & ~d */
- HC_HROP_P, /* GL_COPY s */
- HC_HROP_DPna, /* GL_AND_INVERTED ~s & d */
- HC_HROP_D, /* GL_NOOP d */
- HC_HROP_DPx, /* GL_XOR s ^ d */
- HC_HROP_DPo, /* GL_OR s | d */
- HC_HROP_DPon, /* GL_NOR ~(s | d) */
- HC_HROP_DPxn, /* GL_EQUIV ~(s ^ d) */
- HC_HROP_Dn, /* GL_INVERT ~d */
- HC_HROP_PDno, /* GL_OR_REVERSE s | ~d */
- HC_HROP_Pn, /* GL_COPY_INVERTED ~s */
- HC_HROP_DPno, /* GL_OR_INVERTED ~s | d */
- HC_HROP_DPan, /* GL_NAND ~(s & d) */
- HC_HROP_WHITE /* GL_SET 1 */
-};
-
-/*
- * Compute the 'S5.5' lod bias factor from the floating point OpenGL bias.
- */
-static GLuint viaComputeLodBias(GLfloat bias)
-{
- int b = (int) (bias * 32.0);
- if (b > 511)
- b = 511;
- else if (b < -512)
- b = -512;
- return (GLuint) b;
-}
-
-void viaEmitState(struct via_context *vmesa)
-{
- GLcontext *ctx = vmesa->glCtx;
- GLuint i = 0;
- GLuint j = 0;
- RING_VARS;
-
- viaCheckDma(vmesa, 0x110);
-
- BEGIN_RING(5);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( ((HC_SubA_HEnable << 24) | vmesa->regEnable) );
- OUT_RING( ((HC_SubA_HFBBMSKL << 24) | vmesa->regHFBBMSKL) );
- OUT_RING( ((HC_SubA_HROP << 24) | vmesa->regHROP) );
- ADVANCE_RING();
-
- if (vmesa->have_hw_stencil) {
- GLuint pitch, format, offset;
-
- format = HC_HZWBFM_24;
- offset = vmesa->depth.offset;
- pitch = vmesa->depth.pitch;
-
- BEGIN_RING(6);
- OUT_RING( (HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF) );
- OUT_RING( (HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24) );
- OUT_RING( (HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK |
- format | pitch );
- OUT_RING( (HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD );
- OUT_RING( (HC_SubA_HSTREF << 24) | vmesa->regHSTREF );
- OUT_RING( (HC_SubA_HSTMD << 24) | vmesa->regHSTMD );
- ADVANCE_RING();
- }
- else if (vmesa->hasDepth) {
- GLuint pitch, format, offset;
-
- if (vmesa->depthBits == 16) {
- format = HC_HZWBFM_16;
- }
- else {
- format = HC_HZWBFM_32;
- }
-
-
- offset = vmesa->depth.offset;
- pitch = vmesa->depth.pitch;
-
- BEGIN_RING(4);
- OUT_RING( (HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF) );
- OUT_RING( (HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24) );
- OUT_RING( (HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK |
- format | pitch );
- OUT_RING( (HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD );
- ADVANCE_RING();
- }
-
- if (ctx->Color.AlphaEnabled) {
- BEGIN_RING(1);
- OUT_RING( (HC_SubA_HATMD << 24) | vmesa->regHATMD );
- ADVANCE_RING();
- i++;
- }
-
- if (ctx->Color.BlendEnabled) {
- BEGIN_RING(11);
- OUT_RING( (HC_SubA_HABLCsat << 24) | vmesa->regHABLCsat );
- OUT_RING( (HC_SubA_HABLCop << 24) | vmesa->regHABLCop );
- OUT_RING( (HC_SubA_HABLAsat << 24) | vmesa->regHABLAsat );
- OUT_RING( (HC_SubA_HABLAop << 24) | vmesa->regHABLAop );
- OUT_RING( (HC_SubA_HABLRCa << 24) | vmesa->regHABLRCa );
- OUT_RING( (HC_SubA_HABLRFCa << 24) | vmesa->regHABLRFCa );
- OUT_RING( (HC_SubA_HABLRCbias << 24) | vmesa->regHABLRCbias );
- OUT_RING( (HC_SubA_HABLRCb << 24) | vmesa->regHABLRCb );
- OUT_RING( (HC_SubA_HABLRFCb << 24) | vmesa->regHABLRFCb );
- OUT_RING( (HC_SubA_HABLRAa << 24) | vmesa->regHABLRAa );
- OUT_RING( (HC_SubA_HABLRAb << 24) | vmesa->regHABLRAb );
- ADVANCE_RING();
- }
-
- if (ctx->Fog.Enabled) {
- BEGIN_RING(3);
- OUT_RING( (HC_SubA_HFogLF << 24) | vmesa->regHFogLF );
- OUT_RING( (HC_SubA_HFogCL << 24) | vmesa->regHFogCL );
- OUT_RING( (HC_SubA_HFogCH << 24) | vmesa->regHFogCH );
- ADVANCE_RING();
- }
-
- if (ctx->Line.StippleFlag) {
- BEGIN_RING(2);
- OUT_RING( (HC_SubA_HLP << 24) | ctx->Line.StipplePattern );
- OUT_RING( (HC_SubA_HLPRF << 24) | ctx->Line.StippleFactor );
- ADVANCE_RING();
- }
-
- BEGIN_RING(1);
- OUT_RING( (HC_SubA_HPixGC << 24) | 0x0 );
- ADVANCE_RING();
-
- QWORD_PAD_RING();
-
-
- if (ctx->Texture._EnabledUnits) {
-
- struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0];
- struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1];
-
- {
- GLuint nDummyValue = 0;
-
- BEGIN_RING( 8 );
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Tex << 16) | (HC_SubType_TexGeneral << 24) );
-
- if (texUnit0->Enabled && texUnit1->Enabled) {
- nDummyValue = (HC_SubA_HTXSMD << 24) | (1 << 3);
- }
- else {
- nDummyValue = (HC_SubA_HTXSMD << 24) | 0;
- }
-
- if (vmesa->clearTexCache) {
- vmesa->clearTexCache = 0;
- OUT_RING( nDummyValue | HC_HTXCHCLR_MASK );
- OUT_RING( nDummyValue );
- }
- else {
- OUT_RING( nDummyValue );
- OUT_RING( nDummyValue );
- }
-
- OUT_RING( HC_HEADER2 );
- OUT_RING( HC_ParaType_NotTex << 16 );
- OUT_RING( (HC_SubA_HEnable << 24) | vmesa->regEnable );
- OUT_RING( (HC_SubA_HEnable << 24) | vmesa->regEnable );
- ADVANCE_RING();
- }
-
- if (texUnit0->Enabled) {
- struct gl_texture_object *texObj = texUnit0->_Current;
- struct via_texture_object *t = (struct via_texture_object *)texObj;
- GLuint numLevels = t->lastLevel - t->firstLevel + 1;
- if (VIA_DEBUG & DEBUG_STATE) {
- fprintf(stderr, "texture0 enabled\n");
- }
- if (numLevels == 8) {
- BEGIN_RING(27);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Tex << 16) | (0 << 24) );
- OUT_RING( t->regTexFM );
- OUT_RING( (HC_SubA_HTXnL0OS << 24) |
- ((t->lastLevel) << HC_HTXnLVmax_SHIFT) | t->firstLevel );
- OUT_RING( t->regTexWidthLog2[0] );
- OUT_RING( t->regTexWidthLog2[1] );
- OUT_RING( t->regTexHeightLog2[0] );
- OUT_RING( t->regTexHeightLog2[1] );
- OUT_RING( t->regTexBaseH[0] );
- OUT_RING( t->regTexBaseH[1] );
- OUT_RING( t->regTexBaseH[2] );
- OUT_RING( t->regTexBaseAndPitch[0].baseL );
- OUT_RING( t->regTexBaseAndPitch[0].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[1].baseL );
- OUT_RING( t->regTexBaseAndPitch[1].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[2].baseL );
- OUT_RING( t->regTexBaseAndPitch[2].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[3].baseL );
- OUT_RING( t->regTexBaseAndPitch[3].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[4].baseL );
- OUT_RING( t->regTexBaseAndPitch[4].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[5].baseL );
- OUT_RING( t->regTexBaseAndPitch[5].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[6].baseL );
- OUT_RING( t->regTexBaseAndPitch[6].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[7].baseL );
- OUT_RING( t->regTexBaseAndPitch[7].pitchLog2 );
- ADVANCE_RING();
- }
- else if (numLevels > 1) {
-
- BEGIN_RING(12 + numLevels * 2);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Tex << 16) | (0 << 24) );
- OUT_RING( t->regTexFM );
- OUT_RING( (HC_SubA_HTXnL0OS << 24) |
- ((t->lastLevel) << HC_HTXnLVmax_SHIFT) | t->firstLevel );
- OUT_RING( t->regTexWidthLog2[0] );
- OUT_RING( t->regTexHeightLog2[0] );
-
- if (numLevels > 6) {
- OUT_RING( t->regTexWidthLog2[1] );
- OUT_RING( t->regTexHeightLog2[1] );
- }
-
- OUT_RING( t->regTexBaseH[0] );
-
- if (numLevels > 3) {
- OUT_RING( t->regTexBaseH[1] );
- }
- if (numLevels > 6) {
- OUT_RING( t->regTexBaseH[2] );
- }
- if (numLevels > 9) {
- OUT_RING( t->regTexBaseH[3] );
- }
-
- for (j = 0; j < numLevels; j++) {
- OUT_RING( t->regTexBaseAndPitch[j].baseL );
- OUT_RING( t->regTexBaseAndPitch[j].pitchLog2 );
- }
-
- ADVANCE_RING_VARIABLE();
- }
- else {
-
- BEGIN_RING(9);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Tex << 16) | (0 << 24) );
- OUT_RING( t->regTexFM );
- OUT_RING( (HC_SubA_HTXnL0OS << 24) |
- ((t->lastLevel) << HC_HTXnLVmax_SHIFT) | t->firstLevel );
- OUT_RING( t->regTexWidthLog2[0] );
- OUT_RING( t->regTexHeightLog2[0] );
- OUT_RING( t->regTexBaseH[0] );
- OUT_RING( t->regTexBaseAndPitch[0].baseL );
- OUT_RING( t->regTexBaseAndPitch[0].pitchLog2 );
- ADVANCE_RING();
- }
-
- BEGIN_RING(14);
- OUT_RING( (HC_SubA_HTXnTB << 24) | vmesa->regHTXnTB[0] );
- OUT_RING( (HC_SubA_HTXnMPMD << 24) | vmesa->regHTXnMPMD[0] );
- OUT_RING( (HC_SubA_HTXnTBLCsat << 24) | vmesa->regHTXnTBLCsat[0] );
- OUT_RING( (HC_SubA_HTXnTBLCop << 24) | vmesa->regHTXnTBLCop[0] );
- OUT_RING( (HC_SubA_HTXnTBLMPfog << 24) | vmesa->regHTXnTBLMPfog[0] );
- OUT_RING( (HC_SubA_HTXnTBLAsat << 24) | vmesa->regHTXnTBLAsat[0] );
- OUT_RING( (HC_SubA_HTXnTBLRCb << 24) | vmesa->regHTXnTBLRCb[0] );
- OUT_RING( (HC_SubA_HTXnTBLRAa << 24) | vmesa->regHTXnTBLRAa[0] );
- OUT_RING( (HC_SubA_HTXnTBLRFog << 24) | vmesa->regHTXnTBLRFog[0] );
- OUT_RING( (HC_SubA_HTXnTBLRCa << 24) | vmesa->regHTXnTBLRCa[0] );
- OUT_RING( (HC_SubA_HTXnTBLRCc << 24) | vmesa->regHTXnTBLRCc[0] );
- OUT_RING( (HC_SubA_HTXnTBLRCbias << 24) | vmesa->regHTXnTBLRCbias[0] );
- OUT_RING( (HC_SubA_HTXnTBC << 24) | vmesa->regHTXnTBC[0] );
- OUT_RING( (HC_SubA_HTXnTRAH << 24) | vmesa->regHTXnTRAH[0] );
-/* OUT_RING( (HC_SubA_HTXnCLODu << 24) | vmesa->regHTXnCLOD[0] ); */
- ADVANCE_RING();
-
- /* KW: This test never succeeds:
- */
- if (t->regTexFM == HC_HTXnFM_Index8) {
- struct gl_color_table *table = &texObj->Palette;
- GLfloat *tableF = (GLfloat *)table->Table;
-
- BEGIN_RING(2 + table->Size);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Palette << 16) | (0 << 24) );
- for (j = 0; j < table->Size; j++)
- OUT_RING( tableF[j] );
- ADVANCE_RING();
-
- }
-
- QWORD_PAD_RING();
- }
-
- if (texUnit1->Enabled) {
- struct gl_texture_object *texObj = texUnit1->_Current;
- struct via_texture_object *t = (struct via_texture_object *)texObj;
- GLuint numLevels = t->lastLevel - t->firstLevel + 1;
- int texunit = (texUnit0->Enabled ? 1 : 0);
- if (VIA_DEBUG & DEBUG_STATE) {
- fprintf(stderr, "texture1 enabled\n");
- }
- if (numLevels == 8) {
- BEGIN_RING(27);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Tex << 16) | (texunit << 24) );
- OUT_RING( t->regTexFM );
- OUT_RING( (HC_SubA_HTXnL0OS << 24) |
- ((t->lastLevel) << HC_HTXnLVmax_SHIFT) | t->firstLevel );
- OUT_RING( t->regTexWidthLog2[0] );
- OUT_RING( t->regTexWidthLog2[1] );
- OUT_RING( t->regTexHeightLog2[0] );
- OUT_RING( t->regTexHeightLog2[1] );
- OUT_RING( t->regTexBaseH[0] );
- OUT_RING( t->regTexBaseH[1] );
- OUT_RING( t->regTexBaseH[2] );
- OUT_RING( t->regTexBaseAndPitch[0].baseL );
- OUT_RING( t->regTexBaseAndPitch[0].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[1].baseL );
- OUT_RING( t->regTexBaseAndPitch[1].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[2].baseL );
- OUT_RING( t->regTexBaseAndPitch[2].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[3].baseL );
- OUT_RING( t->regTexBaseAndPitch[3].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[4].baseL );
- OUT_RING( t->regTexBaseAndPitch[4].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[5].baseL );
- OUT_RING( t->regTexBaseAndPitch[5].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[6].baseL );
- OUT_RING( t->regTexBaseAndPitch[6].pitchLog2 );
- OUT_RING( t->regTexBaseAndPitch[7].baseL );
- OUT_RING( t->regTexBaseAndPitch[7].pitchLog2 );
- ADVANCE_RING();
- }
- else if (numLevels > 1) {
- BEGIN_RING(12 + numLevels * 2);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Tex << 16) | (texunit << 24) );
- OUT_RING( t->regTexFM );
- OUT_RING( (HC_SubA_HTXnL0OS << 24) |
- ((t->lastLevel) << HC_HTXnLVmax_SHIFT) | t->firstLevel );
- OUT_RING( t->regTexWidthLog2[0] );
- OUT_RING( t->regTexHeightLog2[0] );
-
- if (numLevels > 6) {
- OUT_RING( t->regTexWidthLog2[1] );
- OUT_RING( t->regTexHeightLog2[1] );
- i += 2;
- }
-
- OUT_RING( t->regTexBaseH[0] );
-
- if (numLevels > 3) {
- OUT_RING( t->regTexBaseH[1] );
- }
- if (numLevels > 6) {
- OUT_RING( t->regTexBaseH[2] );
- }
- if (numLevels > 9) {
- OUT_RING( t->regTexBaseH[3] );
- }
-
- for (j = 0; j < numLevels; j++) {
- OUT_RING( t->regTexBaseAndPitch[j].baseL );
- OUT_RING( t->regTexBaseAndPitch[j].pitchLog2 );
- }
- ADVANCE_RING_VARIABLE();
- }
- else {
- BEGIN_RING(9);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Tex << 16) | (texunit << 24) );
- OUT_RING( t->regTexFM );
- OUT_RING( (HC_SubA_HTXnL0OS << 24) |
- ((t->lastLevel) << HC_HTXnLVmax_SHIFT) | t->firstLevel );
- OUT_RING( t->regTexWidthLog2[0] );
- OUT_RING( t->regTexHeightLog2[0] );
- OUT_RING( t->regTexBaseH[0] );
- OUT_RING( t->regTexBaseAndPitch[0].baseL );
- OUT_RING( t->regTexBaseAndPitch[0].pitchLog2 );
- ADVANCE_RING();
- }
-
- BEGIN_RING(14);
- OUT_RING( (HC_SubA_HTXnTB << 24) | vmesa->regHTXnTB[1] );
- OUT_RING( (HC_SubA_HTXnMPMD << 24) | vmesa->regHTXnMPMD[1] );
- OUT_RING( (HC_SubA_HTXnTBLCsat << 24) | vmesa->regHTXnTBLCsat[1] );
- OUT_RING( (HC_SubA_HTXnTBLCop << 24) | vmesa->regHTXnTBLCop[1] );
- OUT_RING( (HC_SubA_HTXnTBLMPfog << 24) | vmesa->regHTXnTBLMPfog[1] );
- OUT_RING( (HC_SubA_HTXnTBLAsat << 24) | vmesa->regHTXnTBLAsat[1] );
- OUT_RING( (HC_SubA_HTXnTBLRCb << 24) | vmesa->regHTXnTBLRCb[1] );
- OUT_RING( (HC_SubA_HTXnTBLRAa << 24) | vmesa->regHTXnTBLRAa[1] );
- OUT_RING( (HC_SubA_HTXnTBLRFog << 24) | vmesa->regHTXnTBLRFog[1] );
- OUT_RING( (HC_SubA_HTXnTBLRCa << 24) | vmesa->regHTXnTBLRCa[1] );
- OUT_RING( (HC_SubA_HTXnTBLRCc << 24) | vmesa->regHTXnTBLRCc[1] );
- OUT_RING( (HC_SubA_HTXnTBLRCbias << 24) | vmesa->regHTXnTBLRCbias[1] );
- OUT_RING( (HC_SubA_HTXnTBC << 24) | vmesa->regHTXnTBC[1] );
- OUT_RING( (HC_SubA_HTXnTRAH << 24) | vmesa->regHTXnTRAH[1] );
-/* OUT_RING( (HC_SubA_HTXnCLODu << 24) | vmesa->regHTXnCLOD[1] ); */
- ADVANCE_RING();
-
- /* KW: This test never succeeds:
- */
- if (t->regTexFM == HC_HTXnFM_Index8) {
- struct gl_color_table *table = &texObj->Palette;
- GLfloat *tableF = (GLfloat *)table->Table;
-
- BEGIN_RING(2 + table->Size);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_Palette << 16) | (texunit << 24) );
- for (j = 0; j < table->Size; j++) {
- OUT_RING( tableF[j] );
- }
- ADVANCE_RING();
- }
-
- QWORD_PAD_RING();
- }
- }
-
-#if 0
- /* Polygon stipple is broken - for certain stipple values,
- * eg. 0xf0f0f0f0, the hardware will refuse to accept the stipple.
- * Coincidentally, conform generates just such a stipple.
- */
- if (ctx->Polygon.StippleFlag) {
- GLuint *stipple = &ctx->PolygonStipple[0];
- GLint i;
-
- BEGIN_RING(38);
- OUT_RING( HC_HEADER2 );
-
- OUT_RING( ((HC_ParaType_Palette << 16) | (HC_SubType_Stipple << 24)) );
- for (i = 31; i >= 0; i--) {
- GLint j;
- GLuint k = 0;
-
- /* Need to flip bits left to right:
- */
- for (j = 0 ; j < 32; j++)
- if (stipple[i] & (1<<j))
- k |= 1 << (31-j);
-
- OUT_RING( k );
- }
-
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( (HC_SubA_HSPXYOS << 24) |
- (((32- vmesa->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
- OUT_RING( (HC_SubA_HSPXYOS << 24) |
- (((32 - vmesa->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
-
- ADVANCE_RING();
- }
-#endif
-
- vmesa->newEmitState = 0;
-}
-
-
-static __inline__ GLuint viaPackColor(GLuint bpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
-{
- switch (bpp) {
- case 16:
- return PACK_COLOR_565(r, g, b);
- case 32:
- return PACK_COLOR_8888(a, r, g, b);
- default:
- assert(0);
- return 0;
- }
-}
-
-static void viaBlendEquationSeparate(GLcontext *ctx,
- GLenum rgbMode,
- GLenum aMode)
-{
- if (VIA_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s in\n", __FUNCTION__);
-
- /* GL_EXT_blend_equation_separate not supported */
- ASSERT(rgbMode == aMode);
-
- /* Can only do GL_ADD equation in hardware */
- FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_BLEND_EQ,
- rgbMode != GL_FUNC_ADD_EXT);
-
- /* BlendEquation sets ColorLogicOpEnabled in an unexpected
- * manner.
- */
- FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_LOGICOP,
- (ctx->Color.ColorLogicOpEnabled &&
- ctx->Color.LogicOp != GL_COPY));
-}
-
-static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- GLboolean fallback = GL_FALSE;
- if (VIA_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s in\n", __FUNCTION__);
-
- switch (ctx->Color.BlendSrcRGB) {
- case GL_SRC_ALPHA_SATURATE:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- fallback = GL_TRUE;
- break;
- default:
- break;
- }
-
- switch (ctx->Color.BlendDstRGB) {
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- fallback = GL_TRUE;
- break;
- default:
- break;
- }
-
- FALLBACK(vmesa, VIA_FALLBACK_BLEND_FUNC, fallback);
-}
-
-/* Shouldn't be called as the extension is disabled.
- */
-static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA)
-{
- if (dfactorRGB != dfactorA || sfactorRGB != sfactorA) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendEquation (disabled)");
- }
-
- viaBlendFunc(ctx, sfactorRGB, dfactorRGB);
-}
-
-
-
-
-/* =============================================================
- * Hardware clipping
- */
-static void viaScissor(GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (!vmesa->driDrawable)
- return;
-
- if (VIA_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s %d,%d %dx%d, drawH %d\n", __FUNCTION__,
- x,y,w,h, vmesa->driDrawable->h);
-
- if (vmesa->scissor) {
- VIA_FLUSH_DMA(vmesa); /* don't pipeline cliprect changes */
- }
-
- vmesa->scissorRect.x1 = x;
- vmesa->scissorRect.y1 = vmesa->driDrawable->h - y - h;
- vmesa->scissorRect.x2 = x + w;
- vmesa->scissorRect.y2 = vmesa->driDrawable->h - y;
-}
-
-static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- switch (cap) {
- case GL_SCISSOR_TEST:
- VIA_FLUSH_DMA(vmesa);
- vmesa->scissor = state;
- break;
- default:
- break;
- }
-}
-
-
-
-/* Fallback to swrast for select and feedback.
- */
-static void viaRenderMode(GLcontext *ctx, GLenum mode)
-{
- FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER));
-}
-
-
-static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (VIA_DEBUG & (DEBUG_DRI|DEBUG_STATE))
- fprintf(stderr, "%s in\n", __FUNCTION__);
-
- if (!ctx->DrawBuffer)
- return;
-
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- VIA_FLUSH_DMA(vmesa);
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
- FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
- break;
- case BUFFER_BIT_BACK_LEFT:
- VIA_FLUSH_DMA(vmesa);
- vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
- FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
- break;
- default:
- FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_TRUE);
- return;
- }
-
-
- viaXMesaWindowMoved(vmesa);
-
- /* We want to update the s/w rast state too so that viaSetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-}
-
-static void viaClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- GLubyte pcolor[4];
- CLAMPED_FLOAT_TO_UBYTE(pcolor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(pcolor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(pcolor[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(pcolor[3], color[3]);
- vmesa->ClearColor = viaPackColor(vmesa->viaScreen->bitsPerPixel,
- pcolor[0], pcolor[1],
- pcolor[2], pcolor[3]);
-}
-
-#define WRITEMASK_ALPHA_SHIFT 31
-#define WRITEMASK_RED_SHIFT 30
-#define WRITEMASK_GREEN_SHIFT 29
-#define WRITEMASK_BLUE_SHIFT 28
-
-static void viaColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- struct via_context *vmesa = VIA_CONTEXT( ctx );
-
- if (VIA_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
-
- vmesa->ClearMask = (((!r) << WRITEMASK_RED_SHIFT) |
- ((!g) << WRITEMASK_GREEN_SHIFT) |
- ((!b) << WRITEMASK_BLUE_SHIFT) |
- ((!a) << WRITEMASK_ALPHA_SHIFT));
-}
-
-
-/* =============================================================
- */
-
-
-/* Using drawXoff like this is incorrect outside of locked regions.
- * This hardware just isn't capable of private back buffers without
- * glitches and/or a hefty locking scheme.
- */
-void viaCalcViewport(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- GLfloat *m = vmesa->ViewportMatrix.m;
-
- /* See also via_translate_vertex.
- */
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X + vmesa->drawXoff;
- m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + vmesa->driDrawable->h + SUBPIXEL_Y;
- m[MAT_SZ] = v[MAT_SZ] * (1.0 / vmesa->depth_max);
- m[MAT_TZ] = v[MAT_TZ] * (1.0 / vmesa->depth_max);
-}
-
-static void viaViewport(GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height)
-{
- /* update size of Mesa/software ancillary buffers */
- _mesa_ResizeBuffersMESA();
- viaCalcViewport(ctx);
-}
-
-static void viaDepthRange(GLcontext *ctx,
- GLclampd nearval, GLclampd farval)
-{
- viaCalcViewport(ctx);
-}
-
-void viaInitState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- vmesa->regCmdB = HC_ACMD_HCmdB;
- vmesa->regEnable = HC_HenCW_MASK;
-
- /* Mesa should do this for us:
- */
-
- ctx->Driver.BlendEquationSeparate( ctx,
- ctx->Color.BlendEquationRGB,
- ctx->Color.BlendEquationA);
-
- ctx->Driver.BlendFuncSeparate( ctx,
- ctx->Color.BlendSrcRGB,
- ctx->Color.BlendDstRGB,
- ctx->Color.BlendSrcA,
- ctx->Color.BlendDstA);
-
- ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height );
-
- ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
-}
-
-/**
- * Convert S and T texture coordinate wrap modes to hardware bits.
- */
-static u_int32_t
-get_wrap_mode( GLenum sWrap, GLenum tWrap )
-{
- u_int32_t v = 0;
-
-
- switch( sWrap ) {
- case GL_REPEAT:
- v |= HC_HTXnMPMD_Srepeat;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- v |= HC_HTXnMPMD_Sclamp;
- break;
- case GL_MIRRORED_REPEAT:
- v |= HC_HTXnMPMD_Smirror;
- break;
- }
-
- switch( tWrap ) {
- case GL_REPEAT:
- v |= HC_HTXnMPMD_Trepeat;
- break;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- v |= HC_HTXnMPMD_Tclamp;
- break;
- case GL_MIRRORED_REPEAT:
- v |= HC_HTXnMPMD_Tmirror;
- break;
- }
-
- return v;
-}
-
-static u_int32_t
-get_minmag_filter( GLenum min, GLenum mag )
-{
- u_int32_t v = 0;
-
- switch (min) {
- case GL_NEAREST:
- v = HC_HTXnFLSs_Nearest |
- HC_HTXnFLTs_Nearest;
- break;
- case GL_LINEAR:
- v = HC_HTXnFLSs_Linear |
- HC_HTXnFLTs_Linear;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- v = HC_HTXnFLSs_Nearest |
- HC_HTXnFLTs_Nearest;
- v |= HC_HTXnFLDs_Nearest;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- v = HC_HTXnFLSs_Linear |
- HC_HTXnFLTs_Linear;
- v |= HC_HTXnFLDs_Nearest;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- v = HC_HTXnFLSs_Nearest |
- HC_HTXnFLTs_Nearest;
- v |= HC_HTXnFLDs_Linear;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- v = HC_HTXnFLSs_Linear |
- HC_HTXnFLTs_Linear;
- v |= HC_HTXnFLDs_Linear;
- break;
- default:
- break;
- }
-
- switch (mag) {
- case GL_LINEAR:
- v |= HC_HTXnFLSe_Linear |
- HC_HTXnFLTe_Linear;
- break;
- case GL_NEAREST:
- v |= HC_HTXnFLSe_Nearest |
- HC_HTXnFLTe_Nearest;
- break;
- default:
- break;
- }
-
- return v;
-}
-
-
-static GLboolean viaChooseTextureState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0];
- struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1];
-
- if (texUnit0->_ReallyEnabled || texUnit1->_ReallyEnabled) {
- vmesa->regEnable |= HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK;
-
- if (texUnit0->_ReallyEnabled) {
- struct gl_texture_object *texObj = texUnit0->_Current;
-
- vmesa->regHTXnTB[0] = get_minmag_filter( texObj->MinFilter,
- texObj->MagFilter );
-
- vmesa->regHTXnMPMD[0] &= ~(HC_HTXnMPMD_SMASK | HC_HTXnMPMD_TMASK);
- vmesa->regHTXnMPMD[0] |= get_wrap_mode( texObj->WrapS,
- texObj->WrapT );
-
- vmesa->regHTXnTB[0] &= ~(HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
- if (texObj->Image[0][texObj->BaseLevel]->Border > 0) {
- vmesa->regHTXnTB[0] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
- vmesa->regHTXnTBC[0] =
- PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]),
- FLOAT_TO_UBYTE(texObj->BorderColor[1]),
- FLOAT_TO_UBYTE(texObj->BorderColor[2]));
- vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->BorderColor[3]);
- }
-
- if (texUnit0->LodBias != 0.0f) {
- GLuint b = viaComputeLodBias(texUnit0->LodBias);
- vmesa->regHTXnTB[0] &= ~HC_HTXnFLDs_MASK;
- vmesa->regHTXnTB[0] |= HC_HTXnFLDs_ConstLOD;
- vmesa->regHTXnCLOD[0] = (b&0x1f) | (((~b)&0x1f)<<10); /* FIXME */
- }
-
- if (!viaTexCombineState( vmesa, texUnit0->_CurrentCombine, 0 )) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "viaTexCombineState failed for unit 0\n");
- return GL_FALSE;
- }
- }
-
- if (texUnit1->_ReallyEnabled) {
- struct gl_texture_object *texObj = texUnit1->_Current;
-
- vmesa->regHTXnTB[1] = get_minmag_filter( texObj->MinFilter,
- texObj->MagFilter );
- vmesa->regHTXnMPMD[1] &= ~(HC_HTXnMPMD_SMASK | HC_HTXnMPMD_TMASK);
- vmesa->regHTXnMPMD[1] |= get_wrap_mode( texObj->WrapS,
- texObj->WrapT );
-
- vmesa->regHTXnTB[1] &= ~(HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
- if (texObj->Image[0][texObj->BaseLevel]->Border > 0) {
- vmesa->regHTXnTB[1] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T);
- vmesa->regHTXnTBC[1] =
- PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]),
- FLOAT_TO_UBYTE(texObj->BorderColor[1]),
- FLOAT_TO_UBYTE(texObj->BorderColor[2]));
- vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->BorderColor[3]);
- }
-
-
- if (texUnit1->LodBias != 0.0f) {
- GLuint b = viaComputeLodBias(texUnit1->LodBias);
- vmesa->regHTXnTB[1] &= ~HC_HTXnFLDs_MASK;
- vmesa->regHTXnTB[1] |= HC_HTXnFLDs_ConstLOD;
- vmesa->regHTXnCLOD[1] = (b&0x1f) | (((~b)&0x1f)<<10); /* FIXME */
- }
-
- if (!viaTexCombineState( vmesa, texUnit1->_CurrentCombine, 1 )) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "viaTexCombineState failed for unit 1\n");
- return GL_FALSE;
- }
- }
- }
- else {
- vmesa->regEnable &= ~(HC_HenTXMP_MASK | HC_HenTXCH_MASK |
- HC_HenTXPP_MASK);
- }
-
- return GL_TRUE;
-}
-
-static void viaChooseColorState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- GLenum s = ctx->Color.BlendSrcRGB;
- GLenum d = ctx->Color.BlendDstRGB;
-
- /* The HW's blending equation is:
- * (Ca * FCa + Cbias + Cb * FCb) << Cshift
- */
-
- if (ctx->Color.BlendEnabled) {
- vmesa->regEnable |= HC_HenABL_MASK;
- /* Ca -- always from source color.
- */
- vmesa->regHABLCsat = HC_HABLCsat_MASK | HC_HABLCa_OPC | HC_HABLCa_Csrc;
- /* Aa -- always from source alpha.
- */
- vmesa->regHABLAsat = HC_HABLAsat_MASK | HC_HABLAa_OPA | HC_HABLAa_Asrc;
- /* FCa -- depend on following condition.
- * FAa -- depend on following condition.
- */
- switch (s) {
- case GL_ZERO:
- /* (0, 0, 0, 0)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
- vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA;
- vmesa->regHABLRFCa = 0x0;
- vmesa->regHABLRAa = 0x0;
- break;
- case GL_ONE:
- /* (1, 1, 1, 1)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa;
- vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA;
- vmesa->regHABLRFCa = 0x0;
- vmesa->regHABLRAa = 0x0;
- break;
- case GL_SRC_COLOR:
- /* (Rs, Gs, Bs, As)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Csrc;
- vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- /* (1, 1, 1, 1) - (Rs, Gs, Bs, As)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Csrc;
- vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc;
- break;
- case GL_DST_COLOR:
- /* (Rd, Gd, Bd, Ad)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Cdst;
- vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- /* (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Cdst;
- vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst;
- break;
- case GL_SRC_ALPHA:
- /* (As, As, As, As)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Asrc;
- vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Asrc;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- /* (1, 1, 1, 1) - (As, As, As, As)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Asrc;
- vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Asrc;
- break;
- case GL_DST_ALPHA:
- {
- if (vmesa->viaScreen->bitsPerPixel == 16) {
- /* (1, 1, 1, 1)
- */
- vmesa->regHABLCsat |= (HC_HABLFCa_InvOPC |
- HC_HABLFCa_HABLRCa);
- vmesa->regHABLAsat |= (HC_HABLFAa_InvOPA |
- HC_HABLFAa_HABLFRA);
- vmesa->regHABLRFCa = 0x0;
- vmesa->regHABLRAa = 0x0;
- }
- else {
- /* (Ad, Ad, Ad, Ad)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_Adst;
- vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_Adst;
- }
- }
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- {
- if (vmesa->viaScreen->bitsPerPixel == 16) {
- /* (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
- vmesa->regHABLAsat |= HC_HABLFAa_OPA | HC_HABLFAa_HABLFRA;
- vmesa->regHABLRFCa = 0x0;
- vmesa->regHABLRAa = 0x0;
- }
- else {
- /* (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_Adst;
- vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_Adst;
- }
- }
- break;
- case GL_SRC_ALPHA_SATURATE:
- {
- if (vmesa->viaScreen->bitsPerPixel == 16) {
- /* (f, f, f, 1), f = min(As, 1 - Ad) = min(As, 1 - 1) = 0
- * So (f, f, f, 1) = (0, 0, 0, 1)
- */
- vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa;
- vmesa->regHABLAsat |= (HC_HABLFAa_InvOPA |
- HC_HABLFAa_HABLFRA);
- vmesa->regHABLRFCa = 0x0;
- vmesa->regHABLRAa = 0x0;
- }
- else {
- /* (f, f, f, 1), f = min(As, 1 - Ad)
- */
- vmesa->regHABLCsat |= (HC_HABLFCa_OPC |
- HC_HABLFCa_mimAsrcInvAdst);
- vmesa->regHABLAsat |= (HC_HABLFAa_InvOPA |
- HC_HABLFAa_HABLFRA);
- vmesa->regHABLRFCa = 0x0;
- vmesa->regHABLRAa = 0x0;
- }
- }
- break;
- }
-
- /* Op is add.
- */
-
- /* bias is 0.
- */
- vmesa->regHABLCsat |= HC_HABLCbias_HABLRCbias;
- vmesa->regHABLAsat |= HC_HABLAbias_HABLRAbias;
-
- /* Cb -- always from destination color.
- */
- vmesa->regHABLCop = HC_HABLCb_OPC | HC_HABLCb_Cdst;
- /* Ab -- always from destination alpha.
- */
- vmesa->regHABLAop = HC_HABLAb_OPA | HC_HABLAb_Adst;
- /* FCb -- depend on following condition.
- */
- switch (d) {
- case GL_ZERO:
- /* (0, 0, 0, 0)
- */
- vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
- vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
- vmesa->regHABLRFCb = 0x0;
- vmesa->regHABLRAb = 0x0;
- break;
- case GL_ONE:
- /* (1, 1, 1, 1)
- */
- vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb;
- vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA;
- vmesa->regHABLRFCb = 0x0;
- vmesa->regHABLRAb = 0x0;
- break;
- case GL_SRC_COLOR:
- /* (Rs, Gs, Bs, As)
- */
- vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Csrc;
- vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- /* (1, 1, 1, 1) - (Rs, Gs, Bs, As)
- */
- vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Csrc;
- vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Asrc;
- break;
- case GL_DST_COLOR:
- /* (Rd, Gd, Bd, Ad)
- */
- vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Cdst;
- vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst;
- break;
- case GL_ONE_MINUS_DST_COLOR:
- /* (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
- */
- vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Cdst;
- vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst;
- break;
- case GL_SRC_ALPHA:
- /* (As, As, As, As)
- */
- vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Asrc;
- vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Asrc;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- /* (1, 1, 1, 1) - (As, As, As, As)
- */
- vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Asrc;
- vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Asrc;
- break;
- case GL_DST_ALPHA:
- {
- if (vmesa->viaScreen->bitsPerPixel == 16) {
- /* (1, 1, 1, 1)
- */
- vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_HABLRCb;
- vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_HABLFRA;
- vmesa->regHABLRFCb = 0x0;
- vmesa->regHABLRAb = 0x0;
- }
- else {
- /* (Ad, Ad, Ad, Ad)
- */
- vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_Adst;
- vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_Adst;
- }
- }
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- {
- if (vmesa->viaScreen->bitsPerPixel == 16) {
- /* (1, 1, 1, 1) - (1, 1, 1, 1) = (0, 0, 0, 0)
- */
- vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
- vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
- vmesa->regHABLRFCb = 0x0;
- vmesa->regHABLRAb = 0x0;
- }
- else {
- /* (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
- */
- vmesa->regHABLCop |= HC_HABLFCb_InvOPC | HC_HABLFCb_Adst;
- vmesa->regHABLAop |= HC_HABLFAb_InvOPA | HC_HABLFAb_Adst;
- }
- }
- break;
- default:
- vmesa->regHABLCop |= HC_HABLFCb_OPC | HC_HABLFCb_HABLRCb;
- vmesa->regHABLAop |= HC_HABLFAb_OPA | HC_HABLFAb_HABLFRA;
- vmesa->regHABLRFCb = 0x0;
- vmesa->regHABLRAb = 0x0;
- break;
- }
-
- if (vmesa->viaScreen->bitsPerPixel <= 16)
- vmesa->regEnable &= ~HC_HenDT_MASK;
-
- }
- else {
- vmesa->regEnable &= (~HC_HenABL_MASK);
- }
-
- if (ctx->Color.AlphaEnabled) {
- vmesa->regEnable |= HC_HenAT_MASK;
- vmesa->regHATMD = FLOAT_TO_UBYTE(ctx->Color.AlphaRef) |
- ((ctx->Color.AlphaFunc - GL_NEVER) << 8);
- }
- else {
- vmesa->regEnable &= (~HC_HenAT_MASK);
- }
-
- if (ctx->Color.DitherFlag && (vmesa->viaScreen->bitsPerPixel < 32)) {
- if (ctx->Color.BlendEnabled) {
- vmesa->regEnable &= ~HC_HenDT_MASK;
- }
- else {
- vmesa->regEnable |= HC_HenDT_MASK;
- }
- }
-
-
- vmesa->regEnable &= ~HC_HenDT_MASK;
-
- if (ctx->Color.ColorLogicOpEnabled)
- vmesa->regHROP = ROP[ctx->Color.LogicOp & 0xF];
- else
- vmesa->regHROP = HC_HROP_P;
-
- vmesa->regHFBBMSKL = PACK_COLOR_888(ctx->Color.ColorMask[0],
- ctx->Color.ColorMask[1],
- ctx->Color.ColorMask[2]);
- vmesa->regHROP |= ctx->Color.ColorMask[3];
-
- if (ctx->Color.ColorMask[3])
- vmesa->regEnable |= HC_HenAW_MASK;
- else
- vmesa->regEnable &= ~HC_HenAW_MASK;
-}
-
-static void viaChooseFogState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (ctx->Fog.Enabled) {
- GLubyte r, g, b, a;
-
- vmesa->regEnable |= HC_HenFOG_MASK;
-
- /* Use fog equation 0 (OpenGL's default) & local fog.
- */
- vmesa->regHFogLF = 0x0;
-
- r = (GLubyte)(ctx->Fog.Color[0] * 255.0F);
- g = (GLubyte)(ctx->Fog.Color[1] * 255.0F);
- b = (GLubyte)(ctx->Fog.Color[2] * 255.0F);
- a = (GLubyte)(ctx->Fog.Color[3] * 255.0F);
- vmesa->regHFogCL = (r << 16) | (g << 8) | b;
- vmesa->regHFogCH = a;
- }
- else {
- vmesa->regEnable &= ~HC_HenFOG_MASK;
- }
-}
-
-static void viaChooseDepthState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- if (ctx->Depth.Test) {
- vmesa->regEnable |= HC_HenZT_MASK;
- if (ctx->Depth.Mask)
- vmesa->regEnable |= HC_HenZW_MASK;
- else
- vmesa->regEnable &= (~HC_HenZW_MASK);
- vmesa->regHZWTMD = (ctx->Depth.Func - GL_NEVER) << 16;
-
- }
- else {
- vmesa->regEnable &= ~HC_HenZT_MASK;
-
- /*=* [DBG] racer : can't display cars in car selection menu *=*/
- /*if (ctx->Depth.Mask)
- vmesa->regEnable |= HC_HenZW_MASK;
- else
- vmesa->regEnable &= (~HC_HenZW_MASK);*/
- vmesa->regEnable &= (~HC_HenZW_MASK);
- }
-}
-
-static void viaChooseLineState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (ctx->Line.StippleFlag) {
- vmesa->regEnable |= HC_HenLP_MASK;
- vmesa->regHLP = ctx->Line.StipplePattern;
- vmesa->regHLPRF = ctx->Line.StippleFactor;
- }
- else {
- vmesa->regEnable &= ~HC_HenLP_MASK;
- }
-}
-
-static void viaChoosePolygonState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
-#if 0
- /* Polygon stipple is broken - see via_state.c
- */
- if (ctx->Polygon.StippleFlag) {
- vmesa->regEnable |= HC_HenSP_MASK;
- }
- else {
- vmesa->regEnable &= ~HC_HenSP_MASK;
- }
-#else
- FALLBACK(vmesa, VIA_FALLBACK_POLY_STIPPLE,
- ctx->Polygon.StippleFlag);
-#endif
-
- if (ctx->Polygon.CullFlag) {
- vmesa->regEnable |= HC_HenFBCull_MASK;
- }
- else {
- vmesa->regEnable &= ~HC_HenFBCull_MASK;
- }
-}
-
-static void viaChooseStencilState(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (ctx->Stencil.Enabled) {
- GLuint temp;
-
- vmesa->regEnable |= HC_HenST_MASK;
- temp = (ctx->Stencil.Ref[0] & 0xFF) << HC_HSTREF_SHIFT;
- temp |= 0xFF << HC_HSTOPMSK_SHIFT;
- temp |= (ctx->Stencil.ValueMask[0] & 0xFF);
- vmesa->regHSTREF = temp;
-
- temp = (ctx->Stencil.Function[0] - GL_NEVER) << 16;
-
- switch (ctx->Stencil.FailFunc[0]) {
- case GL_KEEP:
- temp |= HC_HSTOPSF_KEEP;
- break;
- case GL_ZERO:
- temp |= HC_HSTOPSF_ZERO;
- break;
- case GL_REPLACE:
- temp |= HC_HSTOPSF_REPLACE;
- break;
- case GL_INVERT:
- temp |= HC_HSTOPSF_INVERT;
- break;
- case GL_INCR:
- temp |= HC_HSTOPSF_INCR;
- break;
- case GL_DECR:
- temp |= HC_HSTOPSF_DECR;
- break;
- }
-
- switch (ctx->Stencil.ZFailFunc[0]) {
- case GL_KEEP:
- temp |= HC_HSTOPSPZF_KEEP;
- break;
- case GL_ZERO:
- temp |= HC_HSTOPSPZF_ZERO;
- break;
- case GL_REPLACE:
- temp |= HC_HSTOPSPZF_REPLACE;
- break;
- case GL_INVERT:
- temp |= HC_HSTOPSPZF_INVERT;
- break;
- case GL_INCR:
- temp |= HC_HSTOPSPZF_INCR;
- break;
- case GL_DECR:
- temp |= HC_HSTOPSPZF_DECR;
- break;
- }
-
- switch (ctx->Stencil.ZPassFunc[0]) {
- case GL_KEEP:
- temp |= HC_HSTOPSPZP_KEEP;
- break;
- case GL_ZERO:
- temp |= HC_HSTOPSPZP_ZERO;
- break;
- case GL_REPLACE:
- temp |= HC_HSTOPSPZP_REPLACE;
- break;
- case GL_INVERT:
- temp |= HC_HSTOPSPZP_INVERT;
- break;
- case GL_INCR:
- temp |= HC_HSTOPSPZP_INCR;
- break;
- case GL_DECR:
- temp |= HC_HSTOPSPZP_DECR;
- break;
- }
- vmesa->regHSTMD = temp;
- }
- else {
- vmesa->regEnable &= ~HC_HenST_MASK;
- }
-}
-
-
-
-static void viaChooseTriangle(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (ctx->Polygon.CullFlag == GL_TRUE) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- vmesa->regCmdB |= HC_HBFace_MASK;
- else
- vmesa->regCmdB &= ~HC_HBFace_MASK;
- break;
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CW)
- vmesa->regCmdB |= HC_HBFace_MASK;
- else
- vmesa->regCmdB &= ~HC_HBFace_MASK;
- break;
- case GL_FRONT_AND_BACK:
- return;
- }
- }
-}
-
-void viaValidateState( GLcontext *ctx )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (vmesa->newState & _NEW_TEXTURE) {
- GLboolean ok = (viaChooseTextureState(ctx) &&
- viaUpdateTextureState(ctx));
-
- FALLBACK(vmesa, VIA_FALLBACK_TEXTURE, !ok);
- }
-
- if (vmesa->newState & _NEW_COLOR)
- viaChooseColorState(ctx);
-
- if (vmesa->newState & _NEW_DEPTH)
- viaChooseDepthState(ctx);
-
- if (vmesa->newState & _NEW_FOG)
- viaChooseFogState(ctx);
-
- if (vmesa->newState & _NEW_LINE)
- viaChooseLineState(ctx);
-
- if (vmesa->newState & (_NEW_POLYGON | _NEW_POLYGONSTIPPLE)) {
- viaChoosePolygonState(ctx);
- viaChooseTriangle(ctx);
- }
-
- if ((vmesa->newState & _NEW_STENCIL) && vmesa->have_hw_stencil)
- viaChooseStencilState(ctx);
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- vmesa->regEnable |= HC_HenCS_MASK;
- else
- vmesa->regEnable &= ~HC_HenCS_MASK;
-
- if (ctx->Point.SmoothFlag ||
- ctx->Line.SmoothFlag ||
- ctx->Polygon.SmoothFlag)
- vmesa->regEnable |= HC_HenAA_MASK;
- else
- vmesa->regEnable &= ~HC_HenAA_MASK;
-
- vmesa->newEmitState |= vmesa->newState;
- vmesa->newState = 0;
-}
-
-static void viaInvalidateState(GLcontext *ctx, GLuint newState)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- VIA_FINISH_PRIM( vmesa );
- vmesa->newState |= newState;
-
- _swrast_InvalidateState(ctx, newState);
- _swsetup_InvalidateState(ctx, newState);
- _ac_InvalidateState(ctx, newState);
- _tnl_InvalidateState(ctx, newState);
-}
-
-void viaInitStateFuncs(GLcontext *ctx)
-{
- /* Callbacks for internal Mesa events.
- */
- ctx->Driver.UpdateState = viaInvalidateState;
-
- /* API callbacks
- */
- ctx->Driver.BlendEquationSeparate = viaBlendEquationSeparate;
- ctx->Driver.BlendFuncSeparate = viaBlendFuncSeparate;
- ctx->Driver.ClearColor = viaClearColor;
- ctx->Driver.ColorMask = viaColorMask;
- ctx->Driver.DrawBuffer = viaDrawBuffer;
- ctx->Driver.RenderMode = viaRenderMode;
- ctx->Driver.Scissor = viaScissor;
- ctx->Driver.DepthRange = viaDepthRange;
- ctx->Driver.Viewport = viaViewport;
- ctx->Driver.Enable = viaEnable;
-
- /* Pixel path fallbacks.
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.ResizeBuffers = viaReAllocateBuffers;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.h
deleted file mode 100644
index 065ec57d3..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_state.h
+++ /dev/null
@@ -1,39 +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.
- */
-
-#ifndef _VIA_STATE_H
-#define _VIA_STATE_H
-
-#include "via_context.h"
-
-extern void viaInitState(GLcontext *ctx);
-extern void viaInitStateFuncs(GLcontext *ctx);
-extern void viaCalcViewport(GLcontext *ctx);
-extern void viaValidateState(GLcontext *ctx);
-extern void viaEmitState(struct via_context *vmesa);
-
-extern void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode);
-#define FALLBACK(vmesa, bit, mode) viaFallback(vmesa, bit, mode)
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.c
deleted file mode 100644
index c308339f2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.c
+++ /dev/null
@@ -1,970 +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 <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "colortab.h"
-#include "convolve.h"
-#include "context.h"
-#include "simple_list.h"
-#include "texcompress.h"
-#include "texformat.h"
-#include "texobj.h"
-#include "texstore.h"
-
-#include "mm.h"
-#include "via_context.h"
-#include "via_fb.h"
-#include "via_tex.h"
-#include "via_state.h"
-#include "via_ioctl.h"
-#include "via_3d_reg.h"
-
-static const struct gl_texture_format *
-viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- const GLboolean do32bpt = ( vmesa->viaScreen->bitsPerPixel == 32
-/* && vmesa->viaScreen->textureSize > 4*1024*1024 */
- );
-
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ||
- type == GL_UNSIGNED_BYTE ) {
- return &_mesa_texformat_argb8888;
- }
- else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- else if ( type == GL_UNSIGNED_BYTE ||
- type == GL_UNSIGNED_INT_8_8_8_8_REV ||
- type == GL_UNSIGNED_INT_8_8_8_8 ) {
- return &_mesa_texformat_argb8888;
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
- }
- else if ( type == GL_UNSIGNED_BYTE ) {
- return &_mesa_texformat_argb8888;
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_argb8888;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
-
- 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_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
- 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_texformat_ci8;
-
- default:
- fprintf(stderr, "unexpected texture format %s in %s\n",
- _mesa_lookup_enum_by_nr(internalFormat),
- __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
-
-static int logbase2(int n)
-{
- GLint i = 1;
- GLint log2 = 0;
-
- while (n > i) {
- i *= 2;
- log2++;
- }
-
- return log2;
-}
-
-static const char *get_memtype_name( GLint memType )
-{
- static const char *names[] = {
- "VIA_MEM_VIDEO",
- "VIA_MEM_AGP",
- "VIA_MEM_SYSTEM",
- "VIA_MEM_MIXED",
- "VIA_MEM_UNKNOWN"
- };
-
- return names[memType];
-}
-
-
-static GLboolean viaMoveTexBuffers( struct via_context *vmesa,
- struct via_tex_buffer **buffers,
- GLuint nr,
- GLint newMemType )
-{
- struct via_tex_buffer *newTexBuf[VIA_MAX_TEXLEVELS];
- GLint i;
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s to %s\n",
- __FUNCTION__,
- get_memtype_name(newMemType));
-
- memset(newTexBuf, 0, sizeof(newTexBuf));
-
- /* First do all the allocations (or fail):
- */
- for (i = 0; i < nr; i++) {
- if (buffers[i]->memType != newMemType) {
-
- /* Don't allow uploads in a thrash state. Should try and
- * catch this earlier.
- */
- if (vmesa->thrashing && newMemType != VIA_MEM_SYSTEM)
- goto cleanup;
-
- newTexBuf[i] = via_alloc_texture(vmesa,
- buffers[i]->size,
- newMemType);
- if (!newTexBuf[i])
- goto cleanup;
- }
- }
-
-
- /* Now copy all the image data and free the old texture memory.
- */
- for (i = 0; i < nr; i++) {
- if (newTexBuf[i]) {
- memcpy(newTexBuf[i]->bufAddr,
- buffers[i]->bufAddr,
- buffers[i]->size);
-
- newTexBuf[i]->image = buffers[i]->image;
- newTexBuf[i]->image->texMem = newTexBuf[i];
- newTexBuf[i]->image->image.Data = newTexBuf[i]->bufAddr;
- via_free_texture(vmesa, buffers[i]);
- }
- }
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s - success\n", __FUNCTION__);
-
- return GL_TRUE;
-
- cleanup:
- /* Release any allocations made prior to failure:
- */
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s - failed\n", __FUNCTION__);
-
- for (i = 0; i < nr; i++) {
- if (newTexBuf[i]) {
- via_free_texture(vmesa, newTexBuf[i]);
- }
- }
-
- return GL_FALSE;
-}
-
-
-static GLboolean viaMoveTexObject( struct via_context *vmesa,
- struct via_texture_object *viaObj,
- GLint newMemType )
-{
- struct via_texture_image **viaImage =
- (struct via_texture_image **)&viaObj->obj.Image[0][0];
- struct via_tex_buffer *buffers[VIA_MAX_TEXLEVELS];
- GLuint i, nr = 0;
-
- for (i = viaObj->firstLevel; i <= viaObj->lastLevel; i++)
- buffers[nr++] = viaImage[i]->texMem;
-
- if (viaMoveTexBuffers( vmesa, &buffers[0], nr, newMemType )) {
- viaObj->memType = newMemType;
- return GL_TRUE;
- }
-
- return GL_FALSE;
-}
-
-
-
-static GLboolean viaSwapInTexObject( struct via_context *vmesa,
- struct via_texture_object *viaObj )
-{
- const struct via_texture_image *baseImage =
- (struct via_texture_image *)viaObj->obj.Image[0][viaObj->obj.BaseLevel];
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (baseImage->texMem->memType != VIA_MEM_SYSTEM)
- return viaMoveTexObject( vmesa, viaObj, baseImage->texMem->memType );
-
- return (viaMoveTexObject( vmesa, viaObj, VIA_MEM_AGP ) ||
- viaMoveTexObject( vmesa, viaObj, VIA_MEM_VIDEO ));
-}
-
-
-/* This seems crude, but it asks a fairly pertinent question and gives
- * an accurate answer:
- */
-static GLboolean viaIsTexMemLow( struct via_context *vmesa,
- GLuint heap )
-{
- struct via_tex_buffer *buf = via_alloc_texture(vmesa, 512 * 1024, heap );
- if (!buf)
- return GL_TRUE;
-
- via_free_texture(vmesa, buf);
- return GL_FALSE;
-}
-
-
-/* Speculatively move texture images which haven't been used in a
- * while back to system memory.
- *
- * TODO: only do this when texture memory is low.
- *
- * TODO: use dma.
- *
- * TODO: keep the fb/agp version hanging around and use the local
- * version as backing store, so re-upload might be avoided.
- *
- * TODO: do this properly in the kernel...
- */
-GLboolean viaSwapOutWork( struct via_context *vmesa )
-{
- struct via_tex_buffer *s, *tmp;
- GLuint done = 0;
- GLuint heap, target;
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s VID %d AGP %d SYS %d\n", __FUNCTION__,
- vmesa->total_alloc[VIA_MEM_VIDEO],
- vmesa->total_alloc[VIA_MEM_AGP],
- vmesa->total_alloc[VIA_MEM_SYSTEM]);
-
-
- for (heap = VIA_MEM_VIDEO; heap <= VIA_MEM_AGP; heap++) {
- GLuint nr = 0, sz = 0;
-
- if (vmesa->thrashing) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Heap %d: trash flag\n", heap);
- target = 1*1024*1024;
- }
- else if (viaIsTexMemLow(vmesa, heap)) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Heap %d: low memory\n", heap);
- target = 64*1024;
- }
- else {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Heap %d: nothing to do\n", heap);
- continue;
- }
-
- foreach_s( s, tmp, &vmesa->tex_image_list[heap] ) {
- if (s->lastUsed < vmesa->lastSwap[1]) {
- struct via_texture_object *viaObj =
- (struct via_texture_object *) s->image->image.TexObject;
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "back copy tex sz %d, lastUsed %d lastSwap %d\n",
- s->size, s->lastUsed, vmesa->lastSwap[1]);
-
- if (viaMoveTexBuffers( vmesa, &s, 1, VIA_MEM_SYSTEM )) {
- viaObj->memType = VIA_MEM_MIXED;
- done += s->size;
- }
- else {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Failed to back copy texture!\n");
- sz += s->size;
- }
- }
- else {
- nr ++;
- sz += s->size;
- }
-
- if (done > target) {
- vmesa->thrashing = GL_FALSE; /* might not get set otherwise? */
- return GL_TRUE;
- }
- }
-
- assert(sz == vmesa->total_alloc[heap]);
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Heap %d: nr %d tot sz %d\n", heap, nr, sz);
- }
-
-
- return done != 0;
-}
-
-
-
-/* Basically, just collect the image dimensions and addresses for each
- * image and update the texture object state accordingly.
- */
-static GLboolean viaSetTexImages(GLcontext *ctx,
- struct gl_texture_object *texObj)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- struct via_texture_object *viaObj = (struct via_texture_object *)texObj;
- const struct via_texture_image *baseImage =
- (struct via_texture_image *)texObj->Image[0][texObj->BaseLevel];
- GLint firstLevel, lastLevel, numLevels;
- GLuint texFormat;
- GLint w, h, p;
- GLint i, j = 0, k = 0, l = 0, m = 0;
- GLuint texBase;
- GLuint basH = 0;
- GLuint widthExp = 0;
- GLuint heightExp = 0;
-
- switch (baseImage->image.TexFormat->MesaFormat) {
- case MESA_FORMAT_ARGB8888:
- texFormat = HC_HTXnFM_ARGB8888;
- break;
- case MESA_FORMAT_ARGB4444:
- texFormat = HC_HTXnFM_ARGB4444;
- break;
- case MESA_FORMAT_RGB565:
- texFormat = HC_HTXnFM_RGB565;
- break;
- case MESA_FORMAT_ARGB1555:
- texFormat = HC_HTXnFM_ARGB1555;
- break;
- case MESA_FORMAT_RGB888:
- texFormat = HC_HTXnFM_ARGB0888;
- break;
- case MESA_FORMAT_L8:
- texFormat = HC_HTXnFM_L8;
- break;
- case MESA_FORMAT_I8:
- texFormat = HC_HTXnFM_T8;
- break;
- case MESA_FORMAT_CI8:
- texFormat = HC_HTXnFM_Index8;
- break;
- case MESA_FORMAT_AL88:
- texFormat = HC_HTXnFM_AL88;
- break;
- case MESA_FORMAT_A8:
- texFormat = HC_HTXnFM_A8;
- break;
- default:
- _mesa_problem(vmesa->glCtx, "Bad texture format in viaSetTexImages");
- return GL_FALSE;
- }
-
- /* 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 (texObj->MinFilter == GL_LINEAR || texObj->MinFilter == GL_NEAREST) {
- firstLevel = lastLevel = texObj->BaseLevel;
- }
- else {
- firstLevel = texObj->BaseLevel + (GLint)(texObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, texObj->BaseLevel);
- lastLevel = texObj->BaseLevel + (GLint)(texObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, texObj->BaseLevel);
- lastLevel = MIN2(lastLevel, texObj->BaseLevel + baseImage->image.MaxLog2);
- lastLevel = MIN2(lastLevel, texObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
-
- numLevels = lastLevel - firstLevel + 1;
-
- /* save these values, check if they effect the residency of the
- * texture:
- */
- if (viaObj->firstLevel != firstLevel ||
- viaObj->lastLevel != lastLevel) {
- viaObj->firstLevel = firstLevel;
- viaObj->lastLevel = lastLevel;
- viaObj->memType = VIA_MEM_MIXED;
- }
-
- if (VIA_DEBUG & DEBUG_TEXTURE & 0)
- fprintf(stderr, "%s, current memType: %s\n",
- __FUNCTION__,
- get_memtype_name(viaObj->memType));
-
-
- if (viaObj->memType == VIA_MEM_MIXED ||
- viaObj->memType == VIA_MEM_SYSTEM) {
- if (!viaSwapInTexObject(vmesa, viaObj)) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- if (!vmesa->thrashing)
- fprintf(stderr, "Thrashing flag set for frame %d\n",
- vmesa->swap_count);
- vmesa->thrashing = GL_TRUE;
- return GL_FALSE;
- }
- }
-
- if (viaObj->memType == VIA_MEM_AGP)
- viaObj->regTexFM = (HC_SubA_HTXnFM << 24) | HC_HTXnLoc_AGP | texFormat;
- else
- viaObj->regTexFM = (HC_SubA_HTXnFM << 24) | HC_HTXnLoc_Local | texFormat;
-
-
- for (i = 0; i < numLevels; i++) {
- struct via_texture_image *viaImage =
- (struct via_texture_image *)texObj->Image[0][firstLevel + i];
-
- w = viaImage->image.WidthLog2;
- h = viaImage->image.HeightLog2;
- p = viaImage->pitchLog2;
-
- assert(viaImage->texMem->memType == viaObj->memType);
-
- texBase = viaImage->texMem->texBase;
- if (!texBase) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s: no texBase[%d]\n", __FUNCTION__, i);
- return GL_FALSE;
- }
-
- /* Image has to remain resident until the coming fence is retired.
- */
- move_to_head( &vmesa->tex_image_list[viaImage->texMem->memType],
- viaImage->texMem );
- viaImage->texMem->lastUsed = vmesa->lastBreadcrumbWrite;
-
-
- viaObj->regTexBaseAndPitch[i].baseL =
- ((HC_SubA_HTXnL0BasL + i) << 24) | (texBase & 0xFFFFFF);
-
- viaObj->regTexBaseAndPitch[i].pitchLog2 =
- ((HC_SubA_HTXnL0Pit + i) << 24) | (p << 20);
-
-
- /* The base high bytes for each 3 levels are packed
- * together into one register:
- */
- j = i / 3;
- k = 3 - (i % 3);
- basH |= ((texBase & 0xFF000000) >> (k << 3));
- if (k == 1) {
- viaObj->regTexBaseH[j] = ((j + HC_SubA_HTXnL012BasH) << 24) | basH;
- basH = 0;
- }
-
- /* Likewise, sets of 6 log2width and log2height values are
- * packed into individual registers:
- */
- l = i / 6;
- m = i % 6;
- widthExp |= (((GLuint)w & 0xF) << (m << 2));
- heightExp |= (((GLuint)h & 0xF) << (m << 2));
- if (m == 5) {
- viaObj->regTexWidthLog2[l] =
- (l + HC_SubA_HTXnL0_5WE) << 24 | widthExp;
- viaObj->regTexHeightLog2[l] =
- (l + HC_SubA_HTXnL0_5HE) << 24 | heightExp;
- widthExp = 0;
- heightExp = 0;
- }
- if (w) w--;
- if (h) h--;
- if (p) p--;
- }
-
- if (k != 1) {
- viaObj->regTexBaseH[j] = ((j + HC_SubA_HTXnL012BasH) << 24) | basH;
- }
- if (m != 5) {
- viaObj->regTexWidthLog2[l] = (l + HC_SubA_HTXnL0_5WE) << 24 | widthExp;
- viaObj->regTexHeightLog2[l] = (l + HC_SubA_HTXnL0_5HE) << 24 | heightExp;
- }
-
- return GL_TRUE;
-}
-
-
-GLboolean viaUpdateTextureState( GLcontext *ctx )
-{
- struct gl_texture_unit *texUnit = ctx->Texture.Unit;
- GLuint i;
-
- for (i = 0; i < 2; i++) {
- if (texUnit[i]._ReallyEnabled == TEXTURE_2D_BIT ||
- texUnit[i]._ReallyEnabled == TEXTURE_1D_BIT) {
-
- if (!viaSetTexImages(ctx, texUnit[i]._Current))
- return GL_FALSE;
- }
- else if (texUnit[i]._ReallyEnabled) {
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-
-
-
-
-
-
-
-static void viaTexImage(GLcontext *ctx,
- GLint dims,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- GLint postConvWidth = width;
- GLint postConvHeight = height;
- GLint texelBytes, sizeInBytes;
- struct via_texture_object *viaObj = (struct via_texture_object *)texObj;
- struct via_texture_image *viaImage = (struct via_texture_image *)texImage;
- int heaps[3], nheaps, i;
-
- if (!is_empty_list(&vmesa->freed_tex_buffers)) {
- viaCheckBreadcrumb(vmesa, 0);
- via_release_pending_textures(vmesa);
- }
-
- if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
- _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth,
- &postConvHeight);
- }
-
- /* choose the texture format */
- texImage->TexFormat = viaChooseTexFormat(ctx, internalFormat,
- format, type);
-
- assert(texImage->TexFormat);
-
- if (dims == 1) {
- texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
- texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
- }
- else {
- texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
- texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
- }
- texelBytes = texImage->TexFormat->TexelBytes;
-
-
- /* Minimum pitch of 32 bytes */
- if (postConvWidth * texelBytes < 32) {
- postConvWidth = 32 / texelBytes;
- texImage->RowStride = postConvWidth;
- }
-
- assert(texImage->RowStride == postConvWidth);
- viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes);
-
- /* allocate memory */
- if (texImage->IsCompressed)
- sizeInBytes = texImage->CompressedSize;
- else
- sizeInBytes = postConvWidth * postConvHeight * texelBytes;
-
-
- /* Attempt to allocate texture memory directly, otherwise use main
- * memory and this texture will always be a fallback. FIXME!
- *
- * TODO: make room in agp if this fails.
- * TODO: use fb ram for textures as well.
- */
-
-
- switch (viaObj->memType) {
- case VIA_MEM_UNKNOWN:
- heaps[0] = VIA_MEM_AGP;
- heaps[1] = VIA_MEM_VIDEO;
- heaps[2] = VIA_MEM_SYSTEM;
- nheaps = 3;
- break;
- case VIA_MEM_AGP:
- case VIA_MEM_VIDEO:
- heaps[0] = viaObj->memType;
- heaps[1] = VIA_MEM_SYSTEM;
- nheaps = 2;
- break;
- case VIA_MEM_MIXED:
- case VIA_MEM_SYSTEM:
- default:
- heaps[0] = VIA_MEM_SYSTEM;
- nheaps = 1;
- break;
- }
-
- for (i = 0; i < nheaps && !viaImage->texMem; i++) {
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "try %s (obj %s)\n", get_memtype_name(heaps[i]),
- get_memtype_name(viaObj->memType));
- viaImage->texMem = via_alloc_texture(vmesa, sizeInBytes, heaps[i]);
- }
-
- if (!viaImage->texMem) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
- return;
- }
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "upload %d bytes to %s\n", sizeInBytes,
- get_memtype_name(viaImage->texMem->memType));
-
- viaImage->texMem->image = viaImage;
- texImage->Data = viaImage->texMem->bufAddr;
-
- if (viaObj->memType == VIA_MEM_UNKNOWN)
- viaObj->memType = viaImage->texMem->memType;
- else if (viaObj->memType != viaImage->texMem->memType)
- viaObj->memType = VIA_MEM_MIXED;
-
- if (VIA_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "%s, obj %s, image : %s\n",
- __FUNCTION__,
- get_memtype_name(viaObj->memType),
- get_memtype_name(viaImage->texMem->memType));
-
- vmesa->clearTexCache = 1;
-
- pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, 1,
- format, type,
- pixels, packing, "glTexImage");
- if (!pixels) {
- /* Note: we check for a NULL image pointer here, _after_ we allocated
- * memory for the texture. That's what the GL spec calls for.
- */
- return;
- }
- else {
- GLint dstRowStride, dstImageStride = 0;
- GLboolean success;
- if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width);
- }
- else {
- dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes;
- }
- ASSERT(texImage->TexFormat->StoreImage);
- success = texImage->TexFormat->StoreImage(ctx, dims, texImage->Format,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride, dstImageStride,
- width, height, 1,
- format, type, pixels, packing);
- if (!success) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
- }
- }
-
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- _mesa_generate_mipmap(ctx, target,
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
- texObj);
- }
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-}
-
-static void viaTexImage2D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- viaTexImage( ctx, 2, target, level,
- internalFormat, width, height, border,
- format, type, pixels,
- packing, texObj, texImage );
-}
-
-static void viaTexSubImage2D(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)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- viaWaitIdle(vmesa, GL_TRUE);
- vmesa->clearTexCache = 1;
-
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
- height, format, type, pixels, packing, texObj,
- texImage);
-}
-
-static void viaTexImage1D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- viaTexImage( ctx, 1, target, level,
- internalFormat, width, 1, border,
- format, type, pixels,
- packing, texObj, texImage );
-}
-
-static void viaTexSubImage1D(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)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- viaWaitIdle(vmesa, GL_TRUE);
- vmesa->clearTexCache = 1;
-
- _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
- format, type, pixels, packing, texObj,
- texImage);
-}
-
-
-
-static GLboolean viaIsTextureResident(GLcontext *ctx,
- struct gl_texture_object *texObj)
-{
- struct via_texture_object *viaObj =
- (struct via_texture_object *)texObj;
-
- return (viaObj->memType == VIA_MEM_AGP ||
- viaObj->memType == VIA_MEM_VIDEO);
-}
-
-
-
-static struct gl_texture_image *viaNewTextureImage( GLcontext *ctx )
-{
- (void) ctx;
- return (struct gl_texture_image *)CALLOC_STRUCT(via_texture_image);
-}
-
-
-static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx,
- GLuint name,
- GLenum target )
-{
- struct via_texture_object *obj = CALLOC_STRUCT(via_texture_object);
-
- _mesa_initialize_texture_object(&obj->obj, name, target);
- (void) ctx;
-
- obj->memType = VIA_MEM_UNKNOWN;
-
- return &obj->obj;
-}
-
-
-static void viaFreeTextureImageData( GLcontext *ctx,
- struct gl_texture_image *texImage )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- struct via_texture_image *image = (struct via_texture_image *)texImage;
-
- if (image->texMem) {
- via_free_texture(vmesa, image->texMem);
- image->texMem = NULL;
- }
-
- texImage->Data = NULL;
-}
-
-
-
-
-void viaInitTextureFuncs(struct dd_function_table * functions)
-{
- functions->ChooseTextureFormat = viaChooseTexFormat;
- functions->TexImage1D = viaTexImage1D;
- functions->TexImage2D = viaTexImage2D;
- functions->TexSubImage1D = viaTexSubImage1D;
- functions->TexSubImage2D = viaTexSubImage2D;
-
- functions->NewTextureObject = viaNewTextureObject;
- functions->NewTextureImage = viaNewTextureImage;
- functions->DeleteTexture = _mesa_delete_texture_object;
- functions->FreeTexImageData = viaFreeTextureImageData;
-
-#if 0 && defined( USE_SSE_ASM )
- /*
- * XXX this code is disabled for now because the via_sse_memcpy()
- * routine causes segfaults with flightgear.
- * See Mesa3d-dev mail list messages from 7/15/2005 for details.
- * Note that this function is currently disabled in via_tris.c too.
- */
- if (getenv("VIA_NO_SSE"))
- functions->TextureMemCpy = _mesa_memcpy;
- else
- functions->TextureMemCpy = via_sse_memcpy;
-#else
- functions->TextureMemCpy = _mesa_memcpy;
-#endif
-
- functions->UpdateTexturePalette = 0;
- functions->IsTextureResident = viaIsTextureResident;
-}
-
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.h
deleted file mode 100644
index 73cfa91ad..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tex.h
+++ /dev/null
@@ -1,41 +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.
- */
-
-
-#ifndef _VIATEX_H
-#define _VIATEX_H
-
-#include "mtypes.h"
-
-struct via_context;
-
-GLboolean viaUpdateTextureState(GLcontext *ctx);
-void viaInitTextureFuncs(struct dd_function_table * functions);
-GLboolean viaSwapOutWork( struct via_context *vmesa );
-
-#if defined( USE_SSE_ASM )
-void via_sse_memcpy( void *to, const void *from, size_t sz );
-#endif /* defined( USE_SSE_ASM ) */
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_texcombine.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_texcombine.c
deleted file mode 100644
index d604457bf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_texcombine.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004
- * 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, 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
- * IBM 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.
- */
-
-/**
- * \file via_texcombine.c
- * Calculate texture combine hardware state.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "colormac.h"
-#include "enums.h"
-
-#include "via_context.h"
-#include "via_state.h"
-#include "via_tex.h"
-#include "via_3d_reg.h"
-
-
-#define VIA_USE_ALPHA (HC_XTC_Adif - HC_XTC_Dif)
-
-#define INPUT_A_SHIFT 14
-#define INPUT_B_SHIFT 7
-#define INPUT_C_SHIFT 0
-#define INPUT_CBias_SHIFT 14
-
-#define CONST_ONE (HC_XTC_0 | HC_XTC_InvTOPC)
-
-static const unsigned color_operand_modifier[4] = {
- 0,
- HC_XTC_InvTOPC,
- VIA_USE_ALPHA,
- VIA_USE_ALPHA | HC_XTC_InvTOPC,
-};
-
-static const unsigned alpha_operand_modifier[2] = {
- 0, HC_XTA_InvTOPA
-};
-
-static const unsigned bias_alpha_operand_modifier[2] = {
- 0, HC_HTXnTBLAbias_Inv
-};
-
-
-static const unsigned c_shift_table[3] = {
- HC_HTXnTBLCshift_No, HC_HTXnTBLCshift_1, HC_HTXnTBLCshift_2
-};
-
-static const unsigned a_shift_table[3] = {
- HC_HTXnTBLAshift_No, HC_HTXnTBLAshift_1, HC_HTXnTBLAshift_2
-};
-
-
-/**
- * Calculate the hardware state for the specified texture combine mode
- *
- * \bug
- * All forms of DOT3 bumpmapping are completely untested, and are most
- * likely wrong. KW: Looks like it will never be quite right as the
- * hardware seems to experience overflow in color calculation at the
- * 4x shift levels, which need to be programed for DOT3. Maybe newer
- * hardware fixes these issues.
- *
- * \bug
- * KW: needs attention to the case where texunit 1 is enabled but
- * texunit 0 is not.
- */
-GLboolean
-viaTexCombineState( struct via_context *vmesa,
- const struct gl_tex_env_combine_state * combine,
- unsigned unit )
-{
- unsigned color_arg[3];
- unsigned alpha_arg[3];
- unsigned bias_alpha_arg[3];
- unsigned color = HC_HTXnTBLCsat_MASK;
- unsigned alpha = HC_HTXnTBLAsat_MASK;
- unsigned bias = 0;
- unsigned op = 0;
- unsigned a_shift = combine->ScaleShiftA;
- unsigned c_shift = combine->ScaleShiftRGB;
- unsigned i;
- unsigned constant_color[3];
- unsigned ordered_constant_color[4];
- unsigned constant_alpha[3];
- unsigned bias_alpha = 0;
- unsigned abc_alpha = 0;
- const struct gl_texture_unit * texUnit =
- &vmesa->glCtx->Texture.Unit[unit];
- unsigned env_color[4];
-
- /* It seems that the color clamping can be overwhelmed at the 4x
- * scale settings, necessitating this fallback:
- */
- if (c_shift == 2 || a_shift == 2) {
- return GL_FALSE;
- }
-
- CLAMPED_FLOAT_TO_UBYTE(env_color[0], texUnit->EnvColor[0]);
- CLAMPED_FLOAT_TO_UBYTE(env_color[1], texUnit->EnvColor[1]);
- CLAMPED_FLOAT_TO_UBYTE(env_color[2], texUnit->EnvColor[2]);
- CLAMPED_FLOAT_TO_UBYTE(env_color[3], texUnit->EnvColor[3]);
-
- (void) memset( constant_color, 0, sizeof( constant_color ) );
- (void) memset( ordered_constant_color, 0, sizeof( ordered_constant_color ) );
- (void) memset( constant_alpha, 0, sizeof( constant_alpha ) );
-
- for ( i = 0 ; i < combine->_NumArgsRGB ; i++ ) {
- const GLint op = combine->OperandRGB[i] - GL_SRC_COLOR;
-
- switch ( combine->SourceRGB[i] ) {
- case GL_TEXTURE:
- color_arg[i] = HC_XTC_Tex;
- color_arg[i] += color_operand_modifier[op];
- break;
- case GL_CONSTANT:
- color_arg[i] = HC_XTC_HTXnTBLRC;
-
- switch( op ) {
- case 0: /* GL_SRC_COLOR */
- constant_color[i] = ((env_color[0] << 16) |
- (env_color[1] << 8) |
- env_color[2]);
- break;
- case 1: /* GL_ONE_MINUS_SRC_COLOR */
- constant_color[i] = ~((env_color[0] << 16) |
- (env_color[1] << 8) |
- env_color[2]) & 0x00ffffff;
- break;
- case 2: /* GL_SRC_ALPHA */
- constant_color[i] = ((env_color[3] << 16) |
- (env_color[3] << 8) |
- env_color[3]);
- break;
- case 3: /* GL_ONE_MINUS_SRC_ALPHA */
- constant_color[i] = ~((env_color[3] << 16) |
- (env_color[3] << 8) |
- env_color[3]) & 0x00ffffff;
- break;
- }
- break;
- case GL_PRIMARY_COLOR:
- color_arg[i] = HC_XTC_Dif;
- color_arg[i] += color_operand_modifier[op];
- break;
- case GL_PREVIOUS:
- color_arg[i] = (unit == 0) ? HC_XTC_Dif : HC_XTC_Cur;
- color_arg[i] += color_operand_modifier[op];
- break;
- }
- }
-
-
- /* On the Unichrome, all combine operations take on some form of:
- *
- * (xA * (xB op xC) + xBias) << xShift
- *
- * 'op' can be selected as add, subtract, min, max, or mask. The min, max
- * and mask modes are currently unused. With the exception of DOT3, all
- * standard GL_COMBINE modes can be implemented simply by selecting the
- * correct inputs for A, B, C, and Bias and the correct operation for op.
- *
- * NOTE: xBias (when read from the constant registers) is signed,
- * and scaled to fit -255..255 in 8 bits, ie 0x1 == 2.
- */
-
- switch( combine->ModeRGB ) {
- /* Ca = 1.0, Cb = arg0, Cc = 0, Cbias = 0
- */
- case GL_REPLACE:
- color |= ((CONST_ONE << INPUT_A_SHIFT) |
- (color_arg[0] << INPUT_B_SHIFT));
-
- ordered_constant_color[1] = constant_color[0];
- break;
-
- /* Ca = arg[0], Cb = arg[1], Cc = 0, Cbias = 0
- */
- case GL_MODULATE:
- color |= ((color_arg[0] << INPUT_A_SHIFT) |
- (color_arg[1] << INPUT_B_SHIFT));
-
- ordered_constant_color[0] = constant_color[0];
- ordered_constant_color[1] = constant_color[1];
- break;
-
- /* Ca = 1.0, Cb = arg[0], Cc = arg[1], Cbias = 0
- */
- case GL_ADD:
- case GL_SUBTRACT:
- if ( combine->ModeRGB == GL_SUBTRACT ) {
- op |= HC_HTXnTBLCop_Sub;
- }
-
- color |= ((CONST_ONE << INPUT_A_SHIFT) |
- (color_arg[0] << INPUT_B_SHIFT) |
- (color_arg[1] << INPUT_C_SHIFT));
-
- ordered_constant_color[1] = constant_color[0];
- ordered_constant_color[2] = constant_color[1];
- break;
-
- /* Ca = 1.0, Cb = arg[0], Cc = arg[1], Cbias = -0.5
- */
- case GL_ADD_SIGNED:
- color |= ((CONST_ONE << INPUT_A_SHIFT) |
- (color_arg[0] << INPUT_B_SHIFT) |
- (color_arg[1] << INPUT_C_SHIFT));
-
- bias |= HC_HTXnTBLCbias_HTXnTBLRC;
-
- ordered_constant_color[1] = constant_color[0];
- ordered_constant_color[2] = constant_color[1];
- ordered_constant_color[3] = 0x00bfbfbf; /* -.5 */
- break;
-
- /* Ca = arg[2], Cb = arg[0], Cc = arg[1], Cbias = arg[1]
- */
- case GL_INTERPOLATE:
- op |= HC_HTXnTBLCop_Sub;
-
- color |= ((color_arg[2] << INPUT_A_SHIFT) |
- (color_arg[0] << INPUT_B_SHIFT) |
- (color_arg[1] << INPUT_C_SHIFT));
-
- bias |= (color_arg[1] << INPUT_CBias_SHIFT);
-
- ordered_constant_color[0] = constant_color[2];
- ordered_constant_color[1] = constant_color[0];
- ordered_constant_color[2] = constant_color[1];
- ordered_constant_color[3] = (constant_color[1] >> 1) & 0x7f7f7f;
- break;
-
-#if 0
- /* At this point this code is completely untested. It appears that the
- * Unichrome has the same limitation as the Radeon R100. The only
- * supported post-scale when doing DOT3 bumpmapping is 1x.
- */
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGBA_EXT:
- case GL_DOT3_RGB:
- case GL_DOT3_RGBA:
- c_shift = 2;
- a_shift = 2;
- color |= ((color_arg[0] << INPUT_A_SHIFT) |
- (color_arg[1] << INPUT_B_SHIFT));
- op |= HC_HTXnTBLDOT4;
- break;
-#endif
-
- default:
- assert(0);
- break;
- }
-
-
-
-
- /* The alpha blend stage has the annoying quirk of not having a
- * hard-wired 0 input, like the color stage. As a result, we have
- * to program the constant register with 0 and use that as our
- * 0 input.
- *
- * (xA * (xB op xC) + xBias) << xShift
- *
- */
-
- for ( i = 0 ; i < combine->_NumArgsA ; i++ ) {
- const GLint op = combine->OperandA[i] - GL_SRC_ALPHA;
-
- switch ( combine->SourceA[i] ) {
- case GL_TEXTURE:
- alpha_arg[i] = HC_XTA_Atex;
- alpha_arg[i] += alpha_operand_modifier[op];
- bias_alpha_arg[i] = HC_HTXnTBLAbias_Atex;
- bias_alpha_arg[i] += bias_alpha_operand_modifier[op];
- break;
- case GL_CONSTANT:
- alpha_arg[i] = HC_XTA_HTXnTBLRA;
- bias_alpha_arg[i] = HC_HTXnTBLAbias_HTXnTBLRAbias;
- constant_alpha[i] = (op == 0) ? env_color[3] : (~env_color[3] & 0xff);
- break;
- case GL_PRIMARY_COLOR:
- alpha_arg[i] = HC_XTA_Adif;
- alpha_arg[i] += alpha_operand_modifier[op];
- bias_alpha_arg[i] = HC_HTXnTBLAbias_Adif;
- bias_alpha_arg[i] += bias_alpha_operand_modifier[op];
- break;
- case GL_PREVIOUS:
- alpha_arg[i] = (unit == 0) ? HC_XTA_Adif : HC_XTA_Acur;
- alpha_arg[i] += alpha_operand_modifier[op];
- bias_alpha_arg[i] = (unit == 0 ?
- HC_HTXnTBLAbias_Adif :
- HC_HTXnTBLAbias_Acur);
- bias_alpha_arg[i] += bias_alpha_operand_modifier[op];
- break;
- }
- }
-
- switch( combine->ModeA ) {
- /* Aa = 0, Ab = 0, Ac = 0, Abias = arg0
- */
- case GL_REPLACE:
- alpha |= ((HC_XTA_HTXnTBLRA << INPUT_A_SHIFT) |
- (HC_XTA_HTXnTBLRA << INPUT_B_SHIFT) |
- (HC_XTA_HTXnTBLRA << INPUT_C_SHIFT));
- abc_alpha = 0;
-
- bias |= bias_alpha_arg[0];
- bias_alpha = constant_alpha[0] >> 1;
- break;
-
- /* Aa = arg[0], Ab = arg[1], Ac = 0, Abias = 0
- */
- case GL_MODULATE:
- alpha |= ((alpha_arg[1] << INPUT_A_SHIFT) |
- (alpha_arg[0] << INPUT_B_SHIFT) |
- (HC_XTA_HTXnTBLRA << INPUT_C_SHIFT));
-
- abc_alpha = ((constant_alpha[1] << HC_HTXnTBLRAa_SHIFT) |
- (constant_alpha[0] << HC_HTXnTBLRAb_SHIFT) |
- (0 << HC_HTXnTBLRAc_SHIFT));
-
- bias |= HC_HTXnTBLAbias_HTXnTBLRAbias;
- bias_alpha = 0;
- break;
-
- /* Aa = 1.0, Ab = arg[0], Ac = arg[1], Abias = 0
- */
- case GL_ADD:
- case GL_SUBTRACT:
- if ( combine->ModeA == GL_SUBTRACT ) {
- op |= HC_HTXnTBLAop_Sub;
- }
-
- alpha |= ((HC_XTA_HTXnTBLRA << INPUT_A_SHIFT) |
- (alpha_arg[0] << INPUT_B_SHIFT) |
- (alpha_arg[1] << INPUT_C_SHIFT));
-
- abc_alpha = ((0xff << HC_HTXnTBLRAa_SHIFT) |
- (constant_alpha[0] << HC_HTXnTBLRAb_SHIFT) |
- (constant_alpha[1] << HC_HTXnTBLRAc_SHIFT));
-
- bias |= HC_HTXnTBLAbias_HTXnTBLRAbias;
- bias_alpha = 0;
- break;
-
- /* Aa = 1.0, Ab = arg[0], Ac = arg[1], Abias = -0.5
- */
- case GL_ADD_SIGNED:
- alpha |= ((HC_XTA_HTXnTBLRA << INPUT_A_SHIFT) |
- (alpha_arg[0] << INPUT_B_SHIFT) |
- (alpha_arg[1] << INPUT_C_SHIFT));
- abc_alpha = ((0xff << HC_HTXnTBLRAa_SHIFT) |
- (constant_alpha[0] << HC_HTXnTBLRAb_SHIFT) |
- (constant_alpha[1] << HC_HTXnTBLRAc_SHIFT));
-
- bias |= HC_HTXnTBLAbias_HTXnTBLRAbias;
- bias_alpha = 0xbf;
- break;
-
- /* Aa = arg[2], Ab = arg[0], Ac = arg[1], Abias = arg[1]
- */
- case GL_INTERPOLATE:
- op |= HC_HTXnTBLAop_Sub;
-
- alpha |= ((alpha_arg[2] << INPUT_A_SHIFT) |
- (alpha_arg[0] << INPUT_B_SHIFT) |
- (alpha_arg[1] << INPUT_C_SHIFT));
- abc_alpha = ((constant_alpha[2] << HC_HTXnTBLRAa_SHIFT) |
- (constant_alpha[0] << HC_HTXnTBLRAb_SHIFT) |
- (constant_alpha[1] << HC_HTXnTBLRAc_SHIFT));
-
- bias |= bias_alpha_arg[1];
- bias_alpha = constant_alpha[1] >> 1;
- break;
- }
-
-
- op |= c_shift_table[ c_shift ] | a_shift_table[ a_shift ];
-
-
- vmesa->regHTXnTBLMPfog[unit] = HC_HTXnTBLMPfog_Fog;
-
- vmesa->regHTXnTBLCsat[unit] = color;
- vmesa->regHTXnTBLAsat[unit] = alpha;
- vmesa->regHTXnTBLCop[unit] = op | bias;
- vmesa->regHTXnTBLRAa[unit] = abc_alpha;
- vmesa->regHTXnTBLRFog[unit] = bias_alpha;
-
- vmesa->regHTXnTBLRCa[unit] = ordered_constant_color[0];
- vmesa->regHTXnTBLRCb[unit] = ordered_constant_color[1];
- vmesa->regHTXnTBLRCc[unit] = ordered_constant_color[2];
- vmesa->regHTXnTBLRCbias[unit] = ordered_constant_color[3];
-
- return GL_TRUE;
-}
-
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.c
deleted file mode 100644
index 9cb88ae23..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.c
+++ /dev/null
@@ -1,1190 +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 <math.h>
-
-#include "glheader.h"
-#include "context.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-#include "enums.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "via_context.h"
-#include "via_tris.h"
-#include "via_state.h"
-#include "via_span.h"
-#include "via_ioctl.h"
-#include "via_3d_reg.h"
-#include "via_tex.h"
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-#define LINE_FALLBACK (0)
-#define POINT_FALLBACK (0)
-#define TRI_FALLBACK (0)
-#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-
-
-#if 0
-#define COPY_DWORDS(vb, vertsize, v) \
-do { \
- via_sse_memcpy(vb, v, vertsize * 4); \
- vb += vertsize; \
-} while (0)
-#else
-#if defined( USE_X86_ASM )
-#define COPY_DWORDS(vb, vertsize, v) \
- do { \
- int j; \
- int __tmp; \
- __asm__ __volatile__("rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v)); \
- } while (0)
-#else
-#define COPY_DWORDS(vb, vertsize, v) \
- do { \
- int j; \
- for (j = 0; j < vertsize; j++) \
- vb[j] = ((GLuint *)v)[j]; \
- vb += vertsize; \
- } while (0)
-#endif
-#endif
-
-static void via_draw_triangle(struct via_context *vmesa,
- viaVertexPtr v0,
- viaVertexPtr v1,
- viaVertexPtr v2)
-{
- GLuint vertsize = vmesa->vertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, 3 * 4 * vertsize);
-
- COPY_DWORDS(vb, vertsize, v0);
- COPY_DWORDS(vb, vertsize, v1);
- COPY_DWORDS(vb, vertsize, v2);
-}
-
-
-static void via_draw_quad(struct via_context *vmesa,
- viaVertexPtr v0,
- viaVertexPtr v1,
- viaVertexPtr v2,
- viaVertexPtr v3)
-{
- GLuint vertsize = vmesa->vertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, 6 * 4 * vertsize);
-
- COPY_DWORDS(vb, vertsize, v0);
- COPY_DWORDS(vb, vertsize, v1);
- COPY_DWORDS(vb, vertsize, v3);
- COPY_DWORDS(vb, vertsize, v1);
- COPY_DWORDS(vb, vertsize, v2);
- COPY_DWORDS(vb, vertsize, v3);
-}
-
-static void via_draw_line(struct via_context *vmesa,
- viaVertexPtr v0,
- viaVertexPtr v1)
-{
- GLuint vertsize = vmesa->vertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, 2 * 4 * vertsize);
- COPY_DWORDS(vb, vertsize, v0);
- COPY_DWORDS(vb, vertsize, v1);
-}
-
-
-static void via_draw_point(struct via_context *vmesa,
- viaVertexPtr v0)
-{
- GLuint vertsize = vmesa->vertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, 4 * vertsize);
- COPY_DWORDS(vb, vertsize, v0);
-}
-
-
-/* Fallback drawing functions for the ptex hack.
- */
-#define PTEX_VERTEX( tmp, vertex_size, v) \
-do { \
- GLuint j; \
- GLfloat rhw = 1.0 / v->f[vertex_size]; \
- for ( j = 0 ; j < vertex_size ; j++ ) \
- tmp.f[j] = v->f[j]; \
- tmp.f[3] *= v->f[vertex_size]; \
- tmp.f[vertex_size-2] *= rhw; \
- tmp.f[vertex_size-1] *= rhw; \
-} while (0)
-
-static void via_ptex_tri (struct via_context *vmesa,
- viaVertexPtr v0,
- viaVertexPtr v1,
- viaVertexPtr v2)
-{
- GLuint vertsize = vmesa->hwVertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, 3*4*vertsize);
- viaVertex tmp;
-
- PTEX_VERTEX(tmp, vertsize, v0); COPY_DWORDS(vb, vertsize, &tmp);
- PTEX_VERTEX(tmp, vertsize, v1); COPY_DWORDS(vb, vertsize, &tmp);
- PTEX_VERTEX(tmp, vertsize, v2); COPY_DWORDS(vb, vertsize, &tmp);
-}
-
-static void via_ptex_line (struct via_context *vmesa,
- viaVertexPtr v0,
- viaVertexPtr v1)
-{
- GLuint vertsize = vmesa->hwVertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, 2*4*vertsize);
- viaVertex tmp;
-
- PTEX_VERTEX(tmp, vertsize, v0); COPY_DWORDS(vb, vertsize, &tmp);
- PTEX_VERTEX(tmp, vertsize, v1); COPY_DWORDS(vb, vertsize, &tmp);
-}
-
-static void via_ptex_point (struct via_context *vmesa,
- viaVertexPtr v0)
-{
- GLuint vertsize = vmesa->hwVertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, 1*4*vertsize);
- viaVertex tmp;
-
- PTEX_VERTEX(tmp, vertsize, v0); COPY_DWORDS(vb, vertsize, &tmp);
-}
-
-
-
-
-
-/***********************************************************************
- * Macros for via_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI(a, b, c) \
- do { \
- if (DO_FALLBACK) \
- vmesa->drawTri(vmesa, a, b, c); \
- else \
- via_draw_triangle(vmesa, a, b, c); \
- } while (0)
-
-#define QUAD(a, b, c, d) \
- do { \
- if (DO_FALLBACK) { \
- vmesa->drawTri(vmesa, a, b, d); \
- vmesa->drawTri(vmesa, b, c, d); \
- } \
- else \
- via_draw_quad(vmesa, a, b, c, d); \
- } while (0)
-
-#define LINE(v0, v1) \
- do { \
- if (DO_FALLBACK) \
- vmesa->drawLine(vmesa, v0, v1); \
- else \
- via_draw_line(vmesa, v0, v1); \
- } while (0)
-
-#define POINT(v0) \
- do { \
- if (DO_FALLBACK) \
- vmesa->drawPoint(vmesa, v0); \
- else \
- via_draw_point(vmesa, v0); \
- } while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define VIA_OFFSET_BIT 0x01
-#define VIA_TWOSIDE_BIT 0x02
-#define VIA_UNFILLED_BIT 0x04
-#define VIA_FALLBACK_BIT 0x08
-#define VIA_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[VIA_MAX_TRIFUNC + 1];
-
-
-#define DO_FALLBACK (IND & VIA_FALLBACK_BIT)
-#define DO_OFFSET (IND & VIA_OFFSET_BIT)
-#define DO_UNFILLED (IND & VIA_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & VIA_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 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX viaVertex
-#define TAB rast_tab
-
-/* Only used to pull back colors into vertices (ie, we know color is
- * floating point).
- */
-#define VIA_COLOR(dst, src) \
- do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- dst[3] = src[3]; \
- } while (0)
-
-#define VIA_SPEC(dst, src) \
- do { \
- dst[0] = src[2]; \
- dst[1] = src[1]; \
- dst[2] = src[0]; \
- } while (0)
-
-
-#define DEPTH_SCALE vmesa->polygon_offset_scale
-#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) (vmesa->verts + (e * vmesa->vertexSize * sizeof(int)))
-
-#define VERT_SET_RGBA( v, c ) \
-do { \
- via_color_t *color = (via_color_t *)&((v)->ui[coloroffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->alpha, (c)[3]); \
-} while (0)
-
-#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
-
-#define VERT_SET_SPEC( v, c ) \
-do { \
- if (specoffset) { \
- via_color_t *color = (via_color_t *)&((v)->ui[specoffset]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
- } \
-} while (0)
-#define VERT_COPY_SPEC( v0, v1 ) \
-do { \
- if (specoffset) { \
- v0->ub4[specoffset][0] = v1->ub4[specoffset][0]; \
- v0->ub4[specoffset][1] = v1->ub4[specoffset][1]; \
- v0->ub4[specoffset][2] = v1->ub4[specoffset][2]; \
- } \
-} while (0)
-
-
-#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
-#define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
-
-
-#define LOCAL_VARS(n) \
- struct via_context *vmesa = VIA_CONTEXT(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = vmesa->coloroffset; \
- GLuint specoffset = vmesa->specoffset; \
- (void)color; (void)spec; (void)coloroffset; (void)specoffset;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLenum hwPrim[GL_POLYGON + 2] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_POLYGON+1
-};
-
-
-#define RASTERIZE(x) viaRasterPrimitive( ctx, x, hwPrim[x] )
-#define RENDER_PRIMITIVE vmesa->renderPrimitive
-#define TAG(x) x
-#define IND VIA_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-#undef RASTERIZE
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-#define RASTERIZE(x)
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_OFFSET_BIT|VIA_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT|VIA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT|VIA_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_OFFSET_BIT|VIA_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT|VIA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT|VIA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_UNFILLED_BIT|VIA_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_OFFSET_BIT|VIA_UNFILLED_BIT|VIA_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT|VIA_UNFILLED_BIT|VIA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (VIA_TWOSIDE_BIT|VIA_OFFSET_BIT|VIA_UNFILLED_BIT| \
- VIA_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-/* Catchall case for flat, separate specular triangles (via has flat
- * diffuse shading, but always does specular color with gouraud).
- */
-#undef DO_FALLBACK
-#undef DO_OFFSET
-#undef DO_UNFILLED
-#undef DO_TWOSIDE
-#undef DO_FLAT
-#define DO_FALLBACK (0)
-#define DO_OFFSET (ctx->_TriangleCaps & DD_TRI_OFFSET)
-#define DO_UNFILLED (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define DO_TWOSIDE (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
-#define DO_FLAT 1
-#define TAG(x) x##_flat_specular
-#define IND VIA_MAX_TRIFUNC
-#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();
- 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_specular(); /* special! */
-}
-
-
-/***********************************************************************
- * 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
-via_fallback_tri(struct via_context *vmesa,
- viaVertex *v0,
- viaVertex *v1,
- viaVertex *v2)
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[3];
- _swsetup_Translate(ctx, v0, &v[0]);
- _swsetup_Translate(ctx, v1, &v[1]);
- _swsetup_Translate(ctx, v2, &v[2]);
- viaSpanRenderStart( ctx );
- _swrast_Triangle(ctx, &v[0], &v[1], &v[2]);
- viaSpanRenderFinish( ctx );
-}
-
-
-static void
-via_fallback_line(struct via_context *vmesa,
- viaVertex *v0,
- viaVertex *v1)
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[2];
- _swsetup_Translate(ctx, v0, &v[0]);
- _swsetup_Translate(ctx, v1, &v[1]);
- viaSpanRenderStart( ctx );
- _swrast_Line(ctx, &v[0], &v[1]);
- viaSpanRenderFinish( ctx );
-}
-
-
-static void
-via_fallback_point(struct via_context *vmesa,
- viaVertex *v0)
-{
- GLcontext *ctx = vmesa->glCtx;
- SWvertex v[1];
- _swsetup_Translate(ctx, v0, &v[0]);
- viaSpanRenderStart( ctx );
- _swrast_Point(ctx, &v[0]);
- viaSpanRenderFinish( ctx );
-}
-
-static void viaResetLineStipple( GLcontext *ctx )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- vmesa->regCmdB |= HC_HLPrst_MASK;
-}
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-#define IND 0
-#define V(x) (viaVertex *)(vertptr + ((x) * vertsize * sizeof(int)))
-#define RENDER_POINTS(start, count) \
- for (; start < count; start++) POINT(V(ELT(start)));
-#define RENDER_LINE(v0, v1) LINE(V(v0), V(v1))
-#define RENDER_TRI( v0, v1, v2) TRI( V(v0), V(v1), V(v2))
-#define RENDER_QUAD(v0, v1, v2, v3) QUAD(V(v0), V(v1), V(v2), V(v3))
-#define INIT(x) viaRasterPrimitive(ctx, x, hwPrim[x])
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- struct via_context *vmesa = VIA_CONTEXT(ctx); \
- GLubyte *vertptr = (GLubyte *)vmesa->verts; \
- const GLuint vertsize = vmesa->vertexSize; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) elt; (void) stipple;
-#define RESET_STIPPLE if ( stipple ) viaResetLineStipple( ctx );
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) via_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) via_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#undef NEED_EDGEFLAG_SETUP
-#undef EDGEFLAG_GET
-#undef EDGEFLAG_SET
-#undef RESET_OCCLUSION
-
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
- GLuint n)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = VIA_CONTEXT(ctx)->renderPrimitive;
-
- /* 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 &&
- prim != GL_POLYGON + 1)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void viaRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line(ctx, ii, jj);
-}
-
-static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
- GLuint n)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- GLuint vertsize = vmesa->vertexSize;
- GLuint *vb = viaExtendPrimitive(vmesa, (n - 2) * 3 * 4 * vertsize);
- GLubyte *vertptr = (GLubyte *)vmesa->verts;
- const GLuint *start = (const GLuint *)V(elts[0]);
- int i;
-
- for (i = 2; i < n; i++) {
- COPY_DWORDS(vb, vertsize, V(elts[i - 1]));
- COPY_DWORDS(vb, vertsize, V(elts[i]));
- COPY_DWORDS(vb, vertsize, start);
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-
-#define _VIA_NEW_VERTEX (_NEW_TEXTURE | \
- _DD_NEW_SEPARATE_SPECULAR | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _NEW_FOG)
-
-#define _VIA_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_POLYGONSTIPPLE)
-
-
-static void viaChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- GLuint flags = ctx->_TriangleCaps;
- GLuint index = 0;
-
- if (vmesa->ptexHack) {
- vmesa->drawPoint = via_ptex_point;
- vmesa->drawLine = via_ptex_line;
- vmesa->drawTri = via_ptex_tri;
- index |= VIA_FALLBACK_BIT;
- }
- else {
- vmesa->drawPoint = via_draw_point;
- vmesa->drawLine = via_draw_line;
- vmesa->drawTri = via_draw_triangle;
- }
-
- if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= VIA_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= VIA_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= VIA_UNFILLED_BIT;
- if (flags & ANY_FALLBACK_FLAGS) index |= VIA_FALLBACK_BIT;
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & POINT_FALLBACK)
- vmesa->drawPoint = via_fallback_point;
-
- if (flags & LINE_FALLBACK)
- vmesa->drawLine = via_fallback_line;
-
- if (flags & TRI_FALLBACK)
- vmesa->drawTri = via_fallback_tri;
- }
-
-
- if ((flags & DD_SEPARATE_SPECULAR) &&
- ctx->Light.ShadeModel == GL_FLAT) {
- index = VIA_MAX_TRIFUNC; /* flat specular */
- }
-
- if (vmesa->renderIndex != index) {
- vmesa->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 (index == 0) {
- tnl->Driver.Render.PrimTabVerts = via_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = via_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = viaFastRenderClippedPoly;
- }
- else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = viaRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = viaRenderClippedPoly;
- }
- }
-}
-
-
-#define VIA_EMIT_TEX1 0x01
-#define VIA_EMIT_TEX0 0x02
-#define VIA_EMIT_PTEX0 0x04
-#define VIA_EMIT_RGBA 0x08
-#define VIA_EMIT_SPEC 0x10
-#define VIA_EMIT_FOG 0x20
-#define VIA_EMIT_W 0x40
-
-#define EMIT_ATTR( ATTR, STYLE, INDEX, REGB ) \
-do { \
- vmesa->vertex_attrs[vmesa->vertex_attr_count].attrib = (ATTR); \
- vmesa->vertex_attrs[vmesa->vertex_attr_count].format = (STYLE); \
- vmesa->vertex_attr_count++; \
- setupIndex |= (INDEX); \
- regCmdB |= (REGB); \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- vmesa->vertex_attrs[vmesa->vertex_attr_count].attrib = 0; \
- vmesa->vertex_attrs[vmesa->vertex_attr_count].format = EMIT_PAD; \
- vmesa->vertex_attrs[vmesa->vertex_attr_count].offset = (N); \
- vmesa->vertex_attr_count++; \
-} while (0)
-
-
-
-static void viaChooseVertexState( GLcontext *ctx )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint index = tnl->render_inputs;
- GLuint regCmdB = HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Z;
- GLuint setupIndex = 0;
-
- vmesa->vertex_attr_count = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if (index & (_TNL_BITS_TEX_ANY|_TNL_BIT_FOG)) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VIA_EMIT_W, HC_HVPMSK_W );
- vmesa->coloroffset = 4;
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, 0, 0 );
- vmesa->coloroffset = 3;
- }
-
- /* t_context.c always includes a diffuse color */
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VIA_EMIT_RGBA,
- HC_HVPMSK_Cd );
-
- vmesa->specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if ((index & _TNL_BIT_COLOR1)) {
- vmesa->specoffset = vmesa->coloroffset + 1;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VIA_EMIT_SPEC,
- HC_HVPMSK_Cs );
- }
- else
- EMIT_PAD( 3 );
-
- if ((index & _TNL_BIT_FOG))
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VIA_EMIT_FOG, HC_HVPMSK_Cs );
- else
- EMIT_PAD( 1 );
- }
-
- if (index & _TNL_BIT_TEX(0)) {
- if (vmesa->ptexHack)
- EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, VIA_EMIT_PTEX0,
- (HC_HVPMSK_S | HC_HVPMSK_T) );
- else
- EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, VIA_EMIT_TEX0,
- (HC_HVPMSK_S | HC_HVPMSK_T) );
- }
-
- if (index & _TNL_BIT_TEX(1)) {
- EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, VIA_EMIT_TEX1,
- (HC_HVPMSK_S | HC_HVPMSK_T) );
- }
-
- if (setupIndex != vmesa->setupIndex) {
- vmesa->vertexSize = _tnl_install_attrs( ctx,
- vmesa->vertex_attrs,
- vmesa->vertex_attr_count,
- vmesa->ViewportMatrix.m, 0 );
- vmesa->vertexSize >>= 2;
- vmesa->setupIndex = setupIndex;
- vmesa->regCmdB &= ~HC_HVPMSK_MASK;
- vmesa->regCmdB |= regCmdB;
-
- if (vmesa->ptexHack)
- vmesa->hwVertexSize = vmesa->vertexSize - 1;
- else
- vmesa->hwVertexSize = vmesa->vertexSize;
- }
-}
-
-
-
-
-/* Check if projective texture coordinates are used and if we can fake
- * them. Fallback to swrast if we can't. Returns GL_TRUE if projective
- * texture coordinates must be faked, GL_FALSE otherwise.
- */
-static GLboolean viaCheckPTexHack( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLboolean fallback = GL_FALSE;
- GLboolean ptexHack = GL_FALSE;
-
- if (index & _TNL_BIT_TEX(0) && VB->TexCoordPtr[0]->size == 4) {
- if ((index & _TNL_BITS_TEX_ANY) == _TNL_BIT_TEX(0))
- ptexHack = GL_TRUE;
- else
- fallback = GL_TRUE;
- }
- if ((index & _TNL_BIT_TEX(1)) && VB->TexCoordPtr[1]->size == 4)
- fallback = GL_TRUE;
-
- FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_PROJ_TEXTURE, fallback);
- return ptexHack;
-}
-
-
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-static void viaRenderStart(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- {
- GLboolean ptexHack = viaCheckPTexHack( ctx );
- if (ptexHack != vmesa->ptexHack) {
- vmesa->ptexHack = ptexHack;
- vmesa->newRenderState |= _VIA_NEW_RENDERSTATE;
- }
- }
-
- if (vmesa->newState) {
- vmesa->newRenderState |= vmesa->newState;
- viaValidateState( ctx );
- }
-
- if (vmesa->Fallback) {
- tnl->Driver.Render.Start(ctx);
- return;
- }
-
- if (vmesa->newRenderState) {
- viaChooseVertexState(ctx);
- viaChooseRenderState(ctx);
- vmesa->newRenderState = 0;
- }
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
-}
-
-static void viaRenderFinish(GLcontext *ctx)
-{
- VIA_FINISH_PRIM(VIA_CONTEXT(ctx));
-}
-
-
-/* System to flush dma and emit state changes based on the rasterized
- * primitive.
- */
-void viaRasterPrimitive(GLcontext *ctx,
- GLenum glprim,
- GLenum hwprim)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- GLuint regCmdB;
- RING_VARS;
-
- if (VIA_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: %s/%s/%s\n",
- __FUNCTION__, _mesa_lookup_enum_by_nr(glprim),
- _mesa_lookup_enum_by_nr(hwprim),
- _mesa_lookup_enum_by_nr(ctx->Light.ShadeModel));
-
- assert (!vmesa->newState);
-
- vmesa->renderPrimitive = glprim;
-
- if (hwprim != vmesa->hwPrimitive ||
- ctx->Light.ShadeModel != vmesa->hwShadeModel) {
-
- VIA_FINISH_PRIM(vmesa);
-
- /* Ensure no wrapping inside this function */
- viaCheckDma( vmesa, 1024 );
-
- if (vmesa->newEmitState) {
- viaEmitState(vmesa);
- }
-
- vmesa->regCmdA_End = HC_ACMD_HCmdA;
-
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- vmesa->regCmdA_End |= HC_HShading_Gouraud;
- }
-
- vmesa->hwShadeModel = ctx->Light.ShadeModel;
- regCmdB = vmesa->regCmdB;
-
- switch (hwprim) {
- case GL_POINTS:
- vmesa->regCmdA_End |= HC_HPMType_Point | HC_HVCycle_Full;
- vmesa->regCmdA_End |= HC_HShading_Gouraud; /* always Gouraud
- shade points?!? */
- break;
- case GL_LINES:
- vmesa->regCmdA_End |= HC_HPMType_Line | HC_HVCycle_Full;
- regCmdB |= HC_HLPrst_MASK;
- if (ctx->Light.ShadeModel == GL_FLAT)
- vmesa->regCmdA_End |= HC_HShading_FlatB;
- break;
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- vmesa->regCmdA_End |= HC_HPMType_Line | HC_HVCycle_AFP |
- HC_HVCycle_AB | HC_HVCycle_NewB;
- regCmdB |= HC_HVCycle_AB | HC_HVCycle_NewB | HC_HLPrst_MASK;
- if (ctx->Light.ShadeModel == GL_FLAT)
- vmesa->regCmdA_End |= HC_HShading_FlatB;
- break;
- case GL_TRIANGLES:
- vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_Full;
- if (ctx->Light.ShadeModel == GL_FLAT)
- vmesa->regCmdA_End |= HC_HShading_FlatC;
- break;
- case GL_TRIANGLE_STRIP:
- vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_AFP |
- HC_HVCycle_AC | HC_HVCycle_BB | HC_HVCycle_NewC;
- regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC;
- if (ctx->Light.ShadeModel == GL_FLAT)
- vmesa->regCmdA_End |= HC_HShading_FlatC;
- break;
- case GL_TRIANGLE_FAN:
- vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_AFP |
- HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC;
- regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC;
- if (ctx->Light.ShadeModel == GL_FLAT)
- vmesa->regCmdA_End |= HC_HShading_FlatC;
- break;
- case GL_QUADS:
- abort();
- return;
- case GL_QUAD_STRIP:
- abort();
- return;
- case GL_POLYGON:
- vmesa->regCmdA_End |= HC_HPMType_Tri | HC_HVCycle_AFP |
- HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC;
- regCmdB |= HC_HVCycle_AA | HC_HVCycle_BC | HC_HVCycle_NewC;
- if (ctx->Light.ShadeModel == GL_FLAT)
- vmesa->regCmdA_End |= HC_HShading_FlatC;
- break;
- default:
- abort();
- return;
- }
-
-/* assert((vmesa->dmaLow & 0x4) == 0); */
-
- if (vmesa->dmaCliprectAddr == ~0) {
- if (VIA_DEBUG & DEBUG_DMA)
- fprintf(stderr, "reserve cliprect space at %x\n", vmesa->dmaLow);
- vmesa->dmaCliprectAddr = vmesa->dmaLow;
- BEGIN_RING(8);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( 0xCCCCCCCC );
- OUT_RING( 0xCCCCCCCC );
- OUT_RING( 0xCCCCCCCC );
- OUT_RING( 0xCCCCCCCC );
- OUT_RING( 0xCCCCCCCC );
- OUT_RING( 0xCCCCCCCC );
- ADVANCE_RING();
- }
-
- assert(vmesa->dmaLastPrim == 0);
-
- BEGIN_RING(8);
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( 0xCCCCCCCC );
- OUT_RING( 0xDDDDDDDD );
-
- OUT_RING( HC_HEADER2 );
- OUT_RING( (HC_ParaType_CmdVdata << 16) );
- OUT_RING( regCmdB );
- OUT_RING( vmesa->regCmdA_End );
- ADVANCE_RING();
-
- vmesa->hwPrimitive = hwprim;
- vmesa->dmaLastPrim = vmesa->dmaLow;
- }
- else {
- assert(!vmesa->newEmitState);
- }
-}
-
-/* Callback for mesa:
- */
-static void viaRenderPrimitive( GLcontext *ctx, GLuint prim )
-{
- viaRasterPrimitive( ctx, prim, hwPrim[prim] );
-}
-
-
-void viaFinishPrimitive(struct via_context *vmesa)
-{
- if (VIA_DEBUG & (DEBUG_DMA|DEBUG_PRIMS))
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!vmesa->dmaLastPrim || vmesa->dmaCliprectAddr == ~0) {
- assert(0);
- }
- else if (vmesa->dmaLow != vmesa->dmaLastPrim) {
- GLuint cmdA = (vmesa->regCmdA_End | HC_HPLEND_MASK |
- HC_HPMValidN_MASK | HC_HE3Fire_MASK);
- RING_VARS;
-
- vmesa->dmaLastPrim = 0;
-
- /* KW: modified 0x1 to 0x4 below:
- */
- if ((vmesa->dmaLow & 0x4) || !vmesa->useAgp) {
- BEGIN_RING_NOCHECK( 1 );
- OUT_RING( cmdA );
- ADVANCE_RING();
- }
- else {
- BEGIN_RING_NOCHECK( 2 );
- OUT_RING( cmdA );
- OUT_RING( cmdA );
- ADVANCE_RING();
- }
-
- if (vmesa->dmaLow > VIA_DMA_HIGHWATER)
- viaFlushDma( vmesa );
- }
- else {
- if (VIA_DEBUG & (DEBUG_DMA|DEBUG_PRIMS))
- fprintf(stderr, "remove empty primitive\n");
-
- /* Remove the primitive header:
- */
- vmesa->dmaLastPrim = 0;
- vmesa->dmaLow -= 8 * sizeof(GLuint);
-
- /* Maybe remove the cliprect as well:
- */
- if (vmesa->dmaCliprectAddr == vmesa->dmaLow - 8 * sizeof(GLuint)) {
- vmesa->dmaLow -= 8 * sizeof(GLuint);
- vmesa->dmaCliprectAddr = ~0;
- }
- }
-
- vmesa->renderPrimitive = GL_POLYGON + 1;
- vmesa->hwPrimitive = GL_POLYGON + 1;
- vmesa->dmaLastPrim = 0;
-}
-
-
-/**********************************************************************/
-/* Transition to/from hardware rasterization. */
-/**********************************************************************/
-
-
-void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode)
-{
- GLcontext *ctx = vmesa->glCtx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = vmesa->Fallback;
-
- if (mode) {
- vmesa->Fallback |= bit;
- if (oldfallback == 0) {
- VIA_FLUSH_DMA(vmesa);
-
- if (VIA_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "ENTER FALLBACK %x\n", bit);
-
- _swsetup_Wakeup(ctx);
- vmesa->renderIndex = ~0;
- }
- }
- else {
- vmesa->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
-
- if (VIA_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "LEAVE FALLBACK %x\n", bit);
-
- tnl->Driver.Render.Start = viaRenderStart;
- tnl->Driver.Render.PrimitiveNotify = viaRenderPrimitive;
- tnl->Driver.Render.Finish = viaRenderFinish;
-
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
- tnl->Driver.Render.ResetLineStipple = viaResetLineStipple;
-
- _tnl_invalidate_vertex_state( ctx, ~0 );
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_install_attrs( ctx,
- vmesa->vertex_attrs,
- vmesa->vertex_attr_count,
- vmesa->ViewportMatrix.m, 0 );
-
- vmesa->newState |= (_VIA_NEW_RENDERSTATE|_VIA_NEW_VERTEX);
- }
- }
-}
-
-static void viaRunPipeline( GLcontext *ctx )
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
-
- if (vmesa->newState) {
- vmesa->newRenderState |= vmesa->newState;
- viaValidateState( ctx );
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void viaInitTriFuncs(GLcontext *ctx)
-{
- struct via_context *vmesa = VIA_CONTEXT(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = viaRunPipeline;
- tnl->Driver.Render.Start = viaRenderStart;
- tnl->Driver.Render.Finish = viaRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = viaRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = viaResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- (6 + 2*ctx->Const.MaxTextureUnits) * sizeof(GLfloat) );
-
- vmesa->verts = (GLubyte *)tnl->clipspace.vertex_buf;
-
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.h
deleted file mode 100644
index b4f0880a7..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/unichrome/via_tris.h
+++ /dev/null
@@ -1,35 +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.
- */
-
-#ifndef _VIATRIS_H
-#define _VIATRIS_H
-
-#include "mtypes.h"
-
-extern void viaPrintRenderState(const char *msg, GLuint state);
-extern void viaInitTriFuncs(GLcontext *ctx);
-extern void viaRasterPrimitive(GLcontext *ctx, GLenum rPrim, GLuint hwPrim);
-extern void viaRasterPrimitiveFinish(GLcontext *ctx);
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/Makefile b/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/Makefile
deleted file mode 100644
index c7dd15209..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/Makefile
+++ /dev/null
@@ -1,89 +0,0 @@
-# src/mesa/drivers/dri/x11/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = x11_dri.so
-
-DRIVER_SOURCES = x11_dri.c \
- $(TOP)/src/mesa/drivers/common/driverfuncs.c \
- ../common/dri_util.c \
- ../../x11/xm_api.c \
- ../../x11/xm_dd.c \
- ../../x11/xm_line.c \
- ../../x11/xm_span.c \
- ../../x11/xm_tri.c
-
-C_SOURCES = \
- $(DRIVER_SOURCES) \
- $(DRI_SOURCES)
-
-
-# Include directories
-INCLUDE_DIRS = \
- -I. \
- -I../common \
- -I../../x11 \
- -I../dri_client \
- -I../dri_client/imports \
- -Iserver \
- -I$(TOP)/include \
- -I$(DRM_SOURCE_PATH)/shared-core \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa/math \
- -I$(TOP)/src/mesa/transform \
- -I$(TOP)/src/mesa/shader \
- -I$(TOP)/src/mesa/swrast \
- -I$(TOP)/src/mesa/swrast_setup
-
-# Core Mesa objects
-MESA_MODULES = $(TOP)/src/mesa/mesa.a
-
-# Libraries that the driver shared lib depends on
-LIB_DEPS = -lm -lpthread -lc
-# LIB_DEPS = -lGL -lm -lpthread -lc
-
-
-ASM_SOURCES =
-
-OBJECTS = $(C_SOURCES:.c=.o) \
- $(ASM_SOURCES:.S=.o)
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(LIB_DIR)/$(LIBNAME)
-
-
-$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile
- CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(LIBNAME) -noprefix -install $(LIB_DIR) \
- $(OBJECTS) $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES)
-
-
-depend: $(C_SOURCES) $(ASM_SOURCES)
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDE_DIRS) $(C_SOURCES) $(ASM_SOURCES) \
- > /dev/null
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-clean:
- -rm -f *.o server/*.o
-
-
-include depend
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.c b/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.c
deleted file mode 100644
index f414b7e42..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.c
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 0.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.
- */
-
-
-/* Minimal swrast-based DRI-loadable driver.
- *
- * Derived from fb_dri.c, the difference being that one works for
- * framebuffers without X, whereas this points Mesa at an X surface
- * to draw on.
- *
- * This is basically just a wrapper around src/mesa/drivers/x11 to make it
- * look like a DRI driver.
- */
-
-#define GLX_DIRECT_RENDERING
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/shm.h>
-#include <sys/stat.h>
-#include <linux/kd.h>
-#include <linux/vt.h>
-
-#include "dri_util.h"
-
-#include "GL/xmesa.h"
-#include "xmesaP.h"
-
-#include "mtypes.h"
-#include "context.h"
-#include "extensions.h"
-#include "imports.h"
-#include "matrix.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "array_cache/acache.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"
-
-#include "x11_dri.h"
-
-typedef struct {
- GLcontext *glCtx; /* Mesa context */
-
- struct {
- __DRIcontextPrivate *context;
- __DRIscreenPrivate *screen;
- __DRIdrawablePrivate *drawable; /* drawable bound to this ctx */
- } dri;
-} x11Context, *x11ContextPtr;
-
-#define X11_CONTEXT(ctx) ((x11ContextPtr)(ctx->DriverCtx))
-
-static const GLubyte *
-get_string(GLcontext *ctx, GLenum pname)
-{
- (void) ctx;
- switch (pname) {
- case GL_RENDERER:
- return (const GLubyte *) "Mesa X11 hack";
- 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);
- _ac_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);
- x11ContextPtr x11mesa = X11_CONTEXT(ctx);
-
- *width = x11mesa->dri.drawable->w;
- *height = x11mesa->dri.drawable->h;
-}
-
-static void
-init_core_functions(struct dd_function_table *functions)
-{
- functions->GetString = get_string;
- functions->UpdateState = update_state;
- functions->ResizeBuffers = _swrast_alloc_buffers;
- functions->GetBufferSize = get_buffer_size;
-
- functions->Clear = _swrast_Clear; /* could accelerate with blits */
-}
-
-/* Initialize the driver specific screen private data.
- */
-static GLboolean
-x11InitDriver(__DRIscreenPrivate *sPriv)
-{
- sPriv->private = NULL;
- return GL_TRUE;
-}
-
-static void
-x11DestroyScreen(__DRIscreenPrivate *sPriv)
-{
-}
-
-/* placeholders, disables rendering */
-static void
-nullwrite(void *a, int b, int c, int d, void *e, void *f)
-{
-}
-
-static void
-set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
-{
-}
-
-/* Create the device specific context. */
-static GLboolean
-x11CreateContext(const __GLcontextModes *glVisual,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- x11ContextPtr x11mesa;
- GLcontext *ctx, *shareCtx;
- struct dd_function_table functions;
-
- assert(glVisual);
- assert(driContextPriv);
-
- /* Allocate the Fb context */
- x11mesa = (x11ContextPtr) CALLOC(sizeof(*x11mesa));
- if (!x11mesa)
- return GL_FALSE;
-
- /* Init default driver functions then plug in our own functions */
- _mesa_init_driver_functions(&functions);
- init_core_functions(&functions);
-
- /* Allocate the Mesa context */
- if (sharedContextPrivate)
- shareCtx = ((x11ContextPtr) sharedContextPrivate)->glCtx;
- else
- shareCtx = NULL;
-
- ctx = x11mesa->glCtx = _mesa_create_context(glVisual, shareCtx,
- &functions, (void *) x11mesa);
- if (!x11mesa->glCtx) {
- FREE(x11mesa);
- return GL_FALSE;
- }
- driContextPriv->driverPrivate = x11mesa;
-
- /* Create module contexts */
- _swrast_CreateContext(ctx);
- _ac_CreateContext(ctx);
- _tnl_CreateContext(ctx);
- _swsetup_CreateContext(ctx);
- _swsetup_Wakeup(ctx);
-
- /* swrast init */
- {
- struct swrast_device_driver *swdd;
- swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SetBuffer = set_buffer;
- if (!glVisual->rgbMode) {
- swdd->WriteCI32Span =
- swdd->WriteCI32Span =
- swdd->WriteCI8Span =
- swdd->WriteMonoCISpan =
- swdd->WriteCI32Pixels =
- swdd->WriteMonoCIPixels =
- swdd->ReadCI32Span =
- swdd->ReadCI32Pixels = nullwrite;
- }
- else if (glVisual->rgbBits == 24 &&
- glVisual->alphaBits == 0) {
- swdd->WriteRGBASpan =
- swdd->WriteRGBSpan =
- swdd->WriteMonoRGBASpan =
- swdd->WriteRGBAPixels =
- swdd->WriteMonoRGBAPixels =
- swdd->ReadRGBASpan =
- swdd->ReadRGBAPixels = nullwrite;
- }
- else if (glVisual->rgbBits == 32 &&
- glVisual->alphaBits == 8) {
- swdd->WriteRGBASpan =
- swdd->WriteRGBSpan =
- swdd->WriteMonoRGBASpan =
- swdd->WriteRGBAPixels =
- swdd->WriteMonoRGBAPixels =
- swdd->ReadRGBASpan =
- swdd->ReadRGBAPixels = nullwrite;
- }
- else if (glVisual->rgbBits == 16 &&
- glVisual->alphaBits == 0) {
- swdd->WriteRGBASpan =
- swdd->WriteRGBSpan =
- swdd->WriteMonoRGBASpan =
- swdd->WriteRGBAPixels =
- swdd->WriteMonoRGBAPixels =
- swdd->ReadRGBASpan =
- swdd->ReadRGBAPixels = nullwrite;
- }
- else if (glVisual->rgbBits == 15 &&
- glVisual->alphaBits == 0) {
- swdd->WriteRGBASpan =
- swdd->WriteRGBSpan =
- swdd->WriteMonoRGBASpan =
- swdd->WriteRGBAPixels =
- swdd->WriteMonoRGBAPixels =
- swdd->ReadRGBASpan =
- swdd->ReadRGBAPixels = nullwrite;
- }
- else {
- _mesa_printf("bad pixelformat rgb %d alpha %d\n",
- glVisual->rgbBits,
- glVisual->alphaBits );
- }
- }
-
- /* 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
-x11DestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- GET_CURRENT_CONTEXT(ctx);
- x11ContextPtr x11mesa = (x11ContextPtr) driContextPriv->driverPrivate;
- x11ContextPtr current = ctx ? X11_CONTEXT(ctx) : NULL;
-
- /* check if we're deleting the currently bound context */
- if (x11mesa == current) {
- _mesa_make_current2(NULL, NULL, NULL);
- }
-
- /* Free x11 context resources */
- if (x11mesa) {
- _swsetup_DestroyContext(x11mesa->glCtx);
- _tnl_DestroyContext(x11mesa->glCtx);
- _ac_DestroyContext(x11mesa->glCtx);
- _swrast_DestroyContext(x11mesa->glCtx);
-
- /* free the Mesa context */
- x11mesa->glCtx->DriverCtx = NULL;
- _mesa_destroy_context(x11mesa->glCtx);
-
- FREE(x11mesa);
- }
-}
-
-
-/* Create and initialize the Mesa and driver specific pixmap buffer
- * data.
- */
-static GLboolean
-x11CreateBuffer(__DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap)
-{
- 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;
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- swDepth,
- swStencil,
- swAccum,
- swAlpha);
-
- if (!driDrawPriv->driverPrivate)
- return 0;
-
- /* Replace the framebuffer back buffer with a malloc'ed one --
- * big speedup.
- */
-/*
- if (driDrawPriv->backBuffer)
- driDrawPriv->backBuffer = malloc(driDrawPriv->currentPitch * driDrawPriv->h);
-*/
-
- return 1;
- }
-}
-
-
-static void
-x11DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-/* free(driDrawPriv->backBuffer); */
-}
-
-
-
-/* If the backbuffer is on a videocard, this is extraordinarily slow!
- */
-static void
-x11SwapBuffers(__DRIdrawablePrivate *dPriv)
-{
-
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- x11ContextPtr x11mesa;
- GLcontext *ctx;
- x11mesa = (x11ContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = x11mesa->glCtx;
- if (ctx->Visual.doubleBufferMode) {
- int i;
- int offset = 0;
- char *tmp /*= malloc(dPriv->currentPitch) */ ;
-
- _mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
-
-/*
- ASSERT(dPriv->frontBuffer);
- ASSERT(dPriv->backBuffer);
-
- for (i = 0 ; i < dPriv->h ; i++ ) {
- memcpy(tmp, (char *)dPriv->frontBuffer + offset, dPriv->currentPitch);
- memcpy((char *)dPriv->backBuffer + offset, tmp, dPriv->currentPitch);
- offset += dPriv->currentPitch;
- }
-
- free(tmp);
-*/
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "x11SwapBuffers: drawable has no context!\n");
- }
-}
-
-
-/* Force the context `c' to be the current context and associate with it
- * buffer `b'.
- */
-static GLboolean
-x11MakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
- if (driContextPriv) {
- x11ContextPtr newFbCtx =
- (x11ContextPtr) driContextPriv->driverPrivate;
-
- newFbCtx->dri.drawable = driDrawPriv;
-
- _mesa_make_current2(newFbCtx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
- } else {
- _mesa_make_current(0, 0);
- }
-
- return GL_TRUE;
-}
-
-
-/* Force the context `c' to be unbound from its buffer.
- */
-static GLboolean
-x11UnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-static struct __DriverAPIRec x11API = {
- x11InitDriver,
- x11DestroyScreen,
- x11CreateContext,
- x11DestroyContext,
- x11CreateBuffer,
- x11DestroyBuffer,
- x11SwapBuffers,
- x11MakeCurrent,
- x11UnbindContext
-};
-
-/*
- * This is the bootstrap function for the driver.
- * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return: pointer to a __DRIscreenPrivate.
- */
-void *
-__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
- int numConfigs, __GLXvisualConfig *config)
-{
- __DRIscreenPrivate *psp;
- psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &x11API);
- return (void *) psp;
-}
-
-/**
- * \brief Establish the set of modes available for the display.
- *
- * \param ctx display handle.
- * \param numModes will receive the number of supported modes.
- * \param modes will point to the list of supported modes.
- *
- * \return one on success, or zero on failure.
- *
- * Allocates a single visual and fills it with information according to the
- * display bit depth. Supports only 16 and 32 bpp bit depths, aborting
- * otherwise.
- */
-const __GLcontextModes __glModes[] = {
- /* 32 bit, RGBA Depth=24 Stencil=8 */
- {.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
- .haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
- .redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
- .redMask = 0xff0000, .greenMask = 0xff00, .blueMask = 0xff, .alphaMask = 0xff000000,
- .rgbBits = 32, .indexBits = 0,
- .accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
- .depthBits = 24, .stencilBits = 8,
- .numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
-
- /* 16 bit, RGB Depth=16 */
- {.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
- .haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
- .redBits = 5, .greenBits = 6, .blueBits = 5, .alphaBits = 0,
- .redMask = 0xf800, .greenMask = 0x07e0, .blueMask = 0x001f, .alphaMask = 0x0,
- .rgbBits = 16, .indexBits = 0,
- .accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
- .depthBits = 16, .stencilBits = 0,
- .numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
-};
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.h b/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.h
deleted file mode 100644
index fd1e64f45..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/x11_dri.h
+++ /dev/null
@@ -1,12 +0,0 @@
-typedef struct {
-
- void *frontBuffer;
- void *backBuffer;
- void *currentBuffer;
- int currentPitch;
-
- int depthCpp;
- void *depthBuffer;
- int depthPitch;
-
-} x11ScreenPrivate;
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/fbdev/glfbdev.c b/nx-X11/extras/Mesa/src/mesa/drivers/fbdev/glfbdev.c
deleted file mode 100644
index c8d9375b6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/fbdev/glfbdev.c
+++ /dev/null
@@ -1,861 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.1
- *
- * 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.
- */
-
-
-/*
- * OpenGL (Mesa) interface for fbdev.
- * For info about fbdev:
- * http://www.tldp.org/HOWTO/Framebuffer-HOWTO.html
- *
- * known VGA modes
- * Colours 640x400 640x480 800x600 1024x768 1152x864 1280x1024 1600x1200
- * --------+--------------------------------------------------------------
- * 4 bits | ? ? 0x302 ? ? ? ?
- * 8 bits | 0x300 0x301 0x303 0x305 0x161 0x307 0x31C
- * 15 bits | ? 0x310 0x313 0x316 0x162 0x319 0x31D
- * 16 bits | ? 0x311 0x314 0x317 0x163 0x31A 0x31E
- * 24 bits | ? 0x312 0x315 0x318 ? 0x31B 0x31F
- * 32 bits | ? ? ? ? 0x164 ?
- */
-#ifdef USE_GLFBDEV_DRIVER
-
-#include "glheader.h"
-#include <linux/fb.h>
-#include "GL/glfbdev.h"
-#include "buffers.h"
-#include "context.h"
-#include "extensions.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "imports.h"
-#include "renderbuffer.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "array_cache/acache.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 PF_B8G8R8 1
-#define PF_B8G8R8A8 2
-#define PF_B5G6R5 3
-#define PF_B5G5R5 4
-#define PF_CI8 5
-
-
-/*
- * Derived from Mesa's GLvisual class.
- */
-struct GLFBDevVisualRec {
- GLvisual glvisual; /* base class */
- struct fb_fix_screeninfo fix;
- struct fb_var_screeninfo var;
- int pixelFormat;
-};
-
-/*
- * Derived from Mesa's GLframebuffer class.
- */
-struct GLFBDevBufferRec {
- GLframebuffer glframebuffer; /* base class */
- GLFBDevVisualPtr visual;
- struct fb_fix_screeninfo fix;
- struct fb_var_screeninfo var;
- size_t size; /* color buffer size in bytes */
- GLuint bytesPerPixel;
-};
-
-/*
- * Derived from Mesa's GLcontext class.
- */
-struct GLFBDevContextRec {
- GLcontext glcontext; /* base class */
- GLFBDevVisualPtr visual;
- GLFBDevBufferPtr drawBuffer;
- GLFBDevBufferPtr readBuffer;
- GLFBDevBufferPtr curBuffer;
-};
-
-/*
- * Derived from Mesa's gl_renderbuffer class.
- */
-struct GLFBDevRenderbufferRec {
- struct gl_renderbuffer Base;
- GLubyte *bottom; /* pointer to last row */
- GLuint rowStride; /* in bytes */
- GLboolean mallocedBuffer;
-};
-
-
-
-#define GLFBDEV_CONTEXT(CTX) ((GLFBDevContextPtr) (CTX))
-#define GLFBDEV_BUFFER(BUF) ((GLFBDevBufferPtr) (BUF))
-
-
-/**********************************************************************/
-/* Internal device driver functions */
-/**********************************************************************/
-
-
-static const GLubyte *
-get_string(GLcontext *ctx, GLenum pname)
-{
- (void) ctx;
- switch (pname) {
- case GL_RENDERER:
- return (const GLubyte *) "Mesa glfbdev";
- 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 );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-
-static void
-get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
-{
- const GLFBDevBufferPtr fbdevbuffer = GLFBDEV_BUFFER(buffer);
- *width = fbdevbuffer->var.xres_virtual;
- *height = fbdevbuffer->var.yres_virtual;
-}
-
-
-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 */
- _mesa_ResizeBuffersMESA();
-}
-
-
-/* specifies the buffer for swrast span rendering/reading */
-static void
-set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
-{
- /* this is a no-op when using the new gl_renderbuffer span functions. */
-}
-
-
-/*
- * Generate code for span functions.
- */
-
-/* 24-bit BGR */
-#define NAME(PREFIX) PREFIX##_B8G8R8
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = frb->bottom - (Y) * frb->rowStride + (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] = CHAN_MAX
-
-#include "swrast/s_spantemp2.h"
-
-
-/* 32-bit BGRA */
-#define NAME(PREFIX) PREFIX##_B8G8R8A8
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = frb->bottom - (Y) * frb->rowStride + (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 FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = SRC[2]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[0]; \
- DST[ACOMP] = SRC[3]
-
-#include "swrast/s_spantemp2.h"
-
-
-/* 16-bit BGR (XXX implement dithering someday) */
-#define NAME(PREFIX) PREFIX##_B5G6R5
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (frb->bottom - (Y) * frb->rowStride + (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] = CHAN_MAX
-
-#include "swrast/s_spantemp2.h"
-
-
-/* 15-bit BGR (XXX implement dithering someday) */
-#define NAME(PREFIX) PREFIX##_B5G5R5
-#define FORMAT GL_RGBA8
-#define SPAN_VARS \
- struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (frb->bottom - (Y) * frb->rowStride + (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] = CHAN_MAX
-
-#include "swrast/s_spantemp2.h"
-
-
-/* 8-bit color index */
-#define NAME(PREFIX) PREFIX##_CI8
-#define FORMAT GL_COLOR_INDEX8_EXT
-#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_spantemp2.h"
-
-
-
-
-/**********************************************************************/
-/* Public API functions */
-/**********************************************************************/
-
-
-const char *
-glFBDevGetString( int str )
-{
- switch (str) {
- case GLFBDEV_VENDOR:
- return "Mesa Project";
- case GLFBDEV_VERSION:
- return "1.0.0";
- default:
- return NULL;
- }
-}
-
-
-const GLFBDevProc
-glFBDevGetProcAddress( const char *procName )
-{
- struct name_address {
- const char *name;
- const GLFBDevProc func;
- };
- static const struct name_address functions[] = {
- { "glFBDevGetString", (GLFBDevProc) glFBDevGetString },
- { "glFBDevGetProcAddress", (GLFBDevProc) glFBDevGetProcAddress },
- { "glFBDevCreateVisual", (GLFBDevProc) glFBDevCreateVisual },
- { "glFBDevDestroyVisual", (GLFBDevProc) glFBDevDestroyVisual },
- { "glFBDevGetVisualAttrib", (GLFBDevProc) glFBDevGetVisualAttrib },
- { "glFBDevCreateBuffer", (GLFBDevProc) glFBDevCreateBuffer },
- { "glFBDevDestroyBuffer", (GLFBDevProc) glFBDevDestroyBuffer },
- { "glFBDevGetBufferAttrib", (GLFBDevProc) glFBDevGetBufferAttrib },
- { "glFBDevGetCurrentDrawBuffer", (GLFBDevProc) glFBDevGetCurrentDrawBuffer },
- { "glFBDevGetCurrentReadBuffer", (GLFBDevProc) glFBDevGetCurrentReadBuffer },
- { "glFBDevSwapBuffers", (GLFBDevProc) glFBDevSwapBuffers },
- { "glFBDevCreateContext", (GLFBDevProc) glFBDevCreateContext },
- { "glFBDevDestroyContext", (GLFBDevProc) glFBDevDestroyContext },
- { "glFBDevGetContextAttrib", (GLFBDevProc) glFBDevGetContextAttrib },
- { "glFBDevGetCurrentContext", (GLFBDevProc) glFBDevGetCurrentContext },
- { "glFBDevMakeCurrent", (GLFBDevProc) glFBDevMakeCurrent },
- { NULL, NULL }
- };
- const struct name_address *entry;
- for (entry = functions; entry->name; entry++) {
- if (_mesa_strcmp(entry->name, procName) == 0) {
- return entry->func;
- }
- }
- return _glapi_get_proc_address(procName);
-}
-
-
-GLFBDevVisualPtr
-glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
- const struct fb_var_screeninfo *varInfo,
- const int *attribs )
-{
- GLFBDevVisualPtr vis;
- const int *attrib;
- GLboolean rgbFlag = GL_TRUE, dbFlag = GL_FALSE, stereoFlag = GL_FALSE;
- GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits = 0;
- GLint indexBits = 0, depthBits = 0, stencilBits = 0;
- GLint accumRedBits = 0, accumGreenBits = 0;
- GLint accumBlueBits = 0, accumAlphaBits = 0;
- GLint numSamples = 0;
-
- ASSERT(fixInfo);
- ASSERT(varInfo);
-
- vis = CALLOC_STRUCT(GLFBDevVisualRec);
- if (!vis)
- return NULL;
-
- vis->fix = *fixInfo; /* struct assignment */
- vis->var = *varInfo; /* struct assignment */
-
- for (attrib = attribs; attrib && *attrib != GLFBDEV_NONE; attrib++) {
- switch (*attrib) {
- case GLFBDEV_DOUBLE_BUFFER:
- dbFlag = GL_TRUE;
- break;
- case GLFBDEV_COLOR_INDEX:
- rgbFlag = GL_FALSE;
- break;
- case GLFBDEV_DEPTH_SIZE:
- depthBits = attrib[1];
- attrib++;
- break;
- case GLFBDEV_STENCIL_SIZE:
- stencilBits = attrib[1];
- attrib++;
- break;
- case GLFBDEV_ACCUM_SIZE:
- accumRedBits = accumGreenBits = accumBlueBits = accumAlphaBits
- = attrib[1];
- attrib++;
- break;
- case GLFBDEV_LEVEL:
- /* ignored for now */
- break;
- default:
- /* unexpected token */
- _mesa_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)
- && varInfo->bits_per_pixel == 24
- && varInfo->red.offset == 16
- && varInfo->green.offset == 8
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B8G8R8;
- }
- else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR)
- && varInfo->bits_per_pixel == 32
- && varInfo->red.offset == 16
- && varInfo->green.offset == 8
- && varInfo->blue.offset == 0
- && varInfo->transp.offset == 24) {
- vis->pixelFormat = PF_B8G8R8A8;
- }
- else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR)
- && varInfo->bits_per_pixel == 16
- && varInfo->red.offset == 11
- && varInfo->green.offset == 5
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B5G6R5;
- }
- else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR)
- && 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");
- /*
- printf("fixInfo->visual = 0x%x\n", fixInfo->visual);
- printf("varInfo->bits_per_pixel = %d\n", varInfo->bits_per_pixel);
- printf("varInfo->red.offset = %d\n", varInfo->red.offset);
- printf("varInfo->green.offset = %d\n", varInfo->green.offset);
- printf("varInfo->blue.offset = %d\n", varInfo->blue.offset);
- */
- _mesa_free(vis);
- return NULL;
- }
- }
- 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 {
- _mesa_problem(NULL, "Unsupported fbdev CI visual/bitdepth!\n");
- _mesa_free(vis);
- return NULL;
- }
- }
-
- if (!_mesa_initialize_visual(&vis->glvisual, rgbFlag, dbFlag, stereoFlag,
- redBits, greenBits, blueBits, alphaBits,
- indexBits, depthBits, stencilBits,
- accumRedBits, accumGreenBits,
- accumBlueBits, accumAlphaBits,
- numSamples)) {
- /* something was invalid */
- _mesa_free(vis);
- return NULL;
- }
-
- return vis;
-}
-
-
-void
-glFBDevDestroyVisual( GLFBDevVisualPtr visual )
-{
- if (visual)
- _mesa_free(visual);
-}
-
-
-int
-glFBDevGetVisualAttrib( const GLFBDevVisualPtr visual, int attrib)
-{
- /* XXX unfinished */
- (void) visual;
- (void) attrib;
- return -1;
-}
-
-
-static void
-delete_renderbuffer(struct gl_renderbuffer *rb)
-{
- struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
- if (frb->mallocedBuffer) {
- _mesa_free(frb->Base.Data);
- }
- _mesa_free(frb);
-}
-
-
-static GLboolean
-renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat, GLuint width, GLuint height)
-{
- /* no-op: the renderbuffer storage is allocated just once when it's
- * created. Never resized or reallocated.
- */
- return GL_TRUE;
-}
-
-
-static struct GLFBDevRenderbufferRec *
-new_glfbdev_renderbuffer(void *bufferStart, int pixelFormat)
-{
- struct GLFBDevRenderbufferRec *rb = CALLOC_STRUCT(GLFBDevRenderbufferRec);
- if (rb) {
- GLuint name = 0;
- _mesa_init_renderbuffer(&rb->Base, name);
-
- rb->Base.Delete = delete_renderbuffer;
- rb->Base.AllocStorage = renderbuffer_storage;
-
- if (pixelFormat == PF_B8G8R8) {
- rb->Base.GetRow = get_row_B8G8R8;
- rb->Base.GetValues = get_values_B8G8R8;
- rb->Base.PutRow = put_row_B8G8R8;
- rb->Base.PutMonoRow = put_mono_row_B8G8R8;
- rb->Base.PutValues = put_values_B8G8R8;
- rb->Base.PutMonoValues = put_mono_values_B8G8R8;
- }
- else if (pixelFormat == PF_B8G8R8A8) {
- rb->Base.GetRow = get_row_B8G8R8A8;
- rb->Base.GetValues = get_values_B8G8R8A8;
- rb->Base.PutRow = put_row_B8G8R8A8;
- rb->Base.PutMonoRow = put_mono_row_B8G8R8A8;
- rb->Base.PutValues = put_values_B8G8R8A8;
- rb->Base.PutMonoValues = put_mono_values_B8G8R8A8;
- }
- else if (pixelFormat == PF_B5G6R5) {
- rb->Base.GetRow = get_row_B5G6R5;
- rb->Base.GetValues = get_values_B5G6R5;
- rb->Base.PutRow = put_row_B5G6R5;
- rb->Base.PutMonoRow = put_mono_row_B5G6R5;
- rb->Base.PutValues = put_values_B5G6R5;
- rb->Base.PutMonoValues = put_mono_values_B5G6R5;
- }
- else if (pixelFormat == PF_B5G5R5) {
- rb->Base.GetRow = get_row_B5G5R5;
- rb->Base.GetValues = get_values_B5G5R5;
- rb->Base.PutRow = put_row_B5G5R5;
- rb->Base.PutMonoRow = put_mono_row_B5G5R5;
- 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.DataType = GL_UNSIGNED_BYTE;
- rb->Base.Data = bufferStart;
- }
- return rb;
-}
-
-
-GLFBDevBufferPtr
-glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
- const struct fb_var_screeninfo *varInfo,
- const GLFBDevVisualPtr visual,
- void *frontBuffer, void *backBuffer, size_t size )
-{
- struct GLFBDevRenderbufferRec *frontrb, *backrb;
- GLFBDevBufferPtr buf;
-
- ASSERT(visual);
- ASSERT(frontBuffer);
- ASSERT(size > 0);
-
- if (visual->fix.visual != fixInfo->visual ||
- visual->fix.type != fixInfo->type ||
- visual->var.bits_per_pixel != varInfo->bits_per_pixel ||
- visual->var.grayscale != varInfo->grayscale ||
- visual->var.red.offset != varInfo->red.offset ||
- visual->var.green.offset != varInfo->green.offset ||
- visual->var.blue.offset != varInfo->blue.offset ||
- visual->var.transp.offset != varInfo->transp.offset) {
- /* visual mismatch! */
- return NULL;
- }
-
- buf = CALLOC_STRUCT(GLFBDevBufferRec);
- if (!buf)
- return NULL;
-
- /* basic framebuffer setup */
- _mesa_initialize_framebuffer(&buf->glframebuffer, &visual->glvisual);
- /* add front renderbuffer */
- frontrb = new_glfbdev_renderbuffer(frontBuffer, visual->pixelFormat);
- _mesa_add_renderbuffer(&buf->glframebuffer, BUFFER_FRONT_LEFT,
- &frontrb->Base);
- /* add back renderbuffer */
- if (visual->glvisual.doubleBufferMode) {
- backrb = new_glfbdev_renderbuffer(backBuffer, visual->pixelFormat);
- _mesa_add_renderbuffer(&buf->glframebuffer, BUFFER_BACK_LEFT,
- &backrb->Base);
- }
- /* add software renderbuffers */
- _mesa_add_soft_renderbuffers(&buf->glframebuffer,
- GL_FALSE, /* color */
- visual->glvisual.haveDepthBuffer,
- visual->glvisual.haveStencilBuffer,
- visual->glvisual.haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux bufs */);
-
-
-
- buf->fix = *fixInfo; /* struct assignment */
- buf->var = *varInfo; /* struct assignment */
- buf->visual = visual; /* ptr assignment */
- buf->size = size;
- buf->bytesPerPixel = visual->var.bits_per_pixel / 8;
- frontrb->rowStride = visual->var.xres_virtual * buf->bytesPerPixel;
- frontrb->bottom = (GLubyte *) frontrb->Base.Data
- + (visual->var.yres_virtual - 1) * frontrb->rowStride;
-
- if (visual->glvisual.doubleBufferMode) {
- if (!backBuffer) {
- /* malloc a back buffer */
- backrb->Base.Data = _mesa_malloc(size);
- if (!backrb->Base.Data) {
- _mesa_free_framebuffer_data(&buf->glframebuffer);
- _mesa_free(buf);
- return NULL;
- }
- backrb->mallocedBuffer = GL_TRUE;
- }
- backrb->rowStride = frontrb->rowStride;
- backrb->bottom = (GLubyte *) backrb->Base.Data
- + (visual->var.yres_virtual - 1) * backrb->rowStride;
- }
- else {
- backrb->bottom = NULL;
- backrb->rowStride = 0;
- }
-
- return buf;
-}
-
-
-void
-glFBDevDestroyBuffer( GLFBDevBufferPtr buffer )
-{
- if (buffer) {
- /* check if destroying the current buffer */
- GLFBDevBufferPtr curDraw = glFBDevGetCurrentDrawBuffer();
- GLFBDevBufferPtr curRead = glFBDevGetCurrentReadBuffer();
- if (buffer == curDraw || buffer == curRead) {
- glFBDevMakeCurrent( NULL, NULL, NULL);
- }
- /* free the software depth, stencil, accum buffers */
- _mesa_free_framebuffer_data(&buffer->glframebuffer);
- _mesa_free(buffer);
- }
-}
-
-
-int
-glFBDevGetBufferAttrib( const GLFBDevBufferPtr buffer, int attrib)
-{
- (void) buffer;
- (void) attrib;
- return -1;
-}
-
-
-GLFBDevBufferPtr
-glFBDevGetCurrentDrawBuffer( void )
-{
- GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext();
- if (fbdevctx)
- return fbdevctx->drawBuffer;
- else
- return NULL;
-}
-
-
-GLFBDevBufferPtr
-glFBDevGetCurrentReadBuffer( void )
-{
- GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext();
- if (fbdevctx)
- return fbdevctx->readBuffer;
- else
- return NULL;
-}
-
-
-void
-glFBDevSwapBuffers( GLFBDevBufferPtr buffer )
-{
- GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext();
- struct GLFBDevRenderbufferRec *frontrb = (struct GLFBDevRenderbufferRec *)
- buffer->glframebuffer.Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
- struct GLFBDevRenderbufferRec *backrb = (struct GLFBDevRenderbufferRec *)
- buffer->glframebuffer.Attachment[BUFFER_BACK_LEFT].Renderbuffer;
-
- if (!buffer || !buffer->visual->glvisual.doubleBufferMode)
- return;
-
- /* check if swapping currently bound buffer */
- if (fbdevctx->drawBuffer == buffer) {
- /* flush pending rendering */
- _mesa_notifySwapBuffers(&fbdevctx->glcontext);
- }
-
- ASSERT(frontrb->Base.Data);
- ASSERT(backrb->Base.Data);
- _mesa_memcpy(frontrb->Base.Data, backrb->Base.Data, buffer->size);
-}
-
-
-GLFBDevContextPtr
-glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share )
-{
- GLFBDevContextPtr ctx;
- GLcontext *glctx;
- struct dd_function_table functions;
-
- ASSERT(visual);
-
- ctx = CALLOC_STRUCT(GLFBDevContextRec);
- if (!ctx)
- return NULL;
-
- /* build table of device driver functions */
- _mesa_init_driver_functions(&functions);
- functions.GetString = get_string;
- functions.UpdateState = update_state;
- functions.GetBufferSize = get_buffer_size;
- functions.Viewport = viewport;
-
- if (!_mesa_initialize_context(&ctx->glcontext, &visual->glvisual,
- share ? &share->glcontext : NULL,
- &functions, (void *) ctx)) {
- _mesa_free(ctx);
- return NULL;
- }
-
- ctx->visual = visual;
-
- /* Create module contexts */
- glctx = (GLcontext *) &ctx->glcontext;
- _swrast_CreateContext( glctx );
- _ac_CreateContext( glctx );
- _tnl_CreateContext( glctx );
- _swsetup_CreateContext( glctx );
- _swsetup_Wakeup( glctx );
-
- /* swrast init */
- {
- struct swrast_device_driver *swdd;
- swdd = _swrast_GetDeviceDriverReference( glctx );
- swdd->SetBuffer = set_buffer;
-
- /* no longer used */
- swdd->WriteRGBASpan = NULL;
- swdd->WriteRGBSpan = NULL;
- swdd->WriteMonoRGBASpan = NULL;
- swdd->WriteRGBAPixels = NULL;
- swdd->WriteMonoRGBAPixels = NULL;
- swdd->ReadRGBASpan = NULL;
- swdd->ReadRGBAPixels = NULL;
- }
-
- /* use default TCL pipeline */
- {
- TNLcontext *tnl = TNL_CONTEXT(glctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- }
-
- _mesa_enable_sw_extensions(glctx);
-
- return ctx;
-}
-
-
-void
-glFBDevDestroyContext( GLFBDevContextPtr context )
-{
- GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext();
-
- if (context) {
- if (fbdevctx == context) {
- /* destroying current context */
- _mesa_make_current(NULL, NULL, NULL);
- _mesa_notifyDestroy(&context->glcontext);
- }
- _mesa_free_context_data(&context->glcontext);
- _mesa_free(context);
- }
-}
-
-
-int
-glFBDevGetContextAttrib( const GLFBDevContextPtr context, int attrib)
-{
- (void) context;
- (void) attrib;
- return -1;
-}
-
-
-GLFBDevContextPtr
-glFBDevGetCurrentContext( void )
-{
- GET_CURRENT_CONTEXT(ctx);
- return (GLFBDevContextPtr) ctx;
-}
-
-
-int
-glFBDevMakeCurrent( GLFBDevContextPtr context,
- GLFBDevBufferPtr drawBuffer,
- GLFBDevBufferPtr readBuffer )
-{
- if (context && drawBuffer && readBuffer) {
- /* Make sure the context's visual and the buffers' visuals match.
- * XXX we might do this by comparing specific fields like bits_per_pixel,
- * visual, etc. in the future.
- */
- if (context->visual != drawBuffer->visual ||
- context->visual != readBuffer->visual) {
- return 0;
- }
- _mesa_make_current( &context->glcontext,
- &drawBuffer->glframebuffer,
- &readBuffer->glframebuffer );
- context->drawBuffer = drawBuffer;
- context->readBuffer = readBuffer;
- context->curBuffer = drawBuffer;
- }
- else {
- /* unbind */
- _mesa_make_current( NULL, NULL, NULL );
- }
-
- return 1;
-}
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxapi.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxapi.c
deleted file mode 100644
index e535e739b..000000000
--- a/nx-X11/extras/Mesa/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 "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_destroy_framebuffer(fxMesa->glBuffer);
- }
- 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_destroy_framebuffer(fxMesa->glBuffer);
- 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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxdd.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxdd.c
deleted file mode 100644
index 4e9df208b..000000000
--- a/nx-X11/extras/Mesa/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 "image.h"
-#include "mtypes.h"
-#include "fxdrv.h"
-#include "buffers.h"
-#include "enums.h"
-#include "extensions.h"
-#include "macros.h"
-#include "texstore.h"
-#include "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 "array_cache/acache.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;
- }
-}
-
-
-static void
-fxDDViewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- /* poll for window size change and realloc software Z/stencil/etc if needed */
- _mesa_ResizeBuffersMESA();
-}
-
-
-/* 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, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
-{
- 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( %d, %d, %d, %d )\n",
- (int) x, (int) y, (int) width, (int) height );
- }
-
- /* 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, all, x, y, width, height );
-}
-
-
-/* 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_arb_vertex_program_stage,
- &_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);
-
- 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);
- _ac_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);
- _ac_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_ARB_texture_compression");
- _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_ARB_texture_compression");*/
- _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 */
- _mesa_enable_extension(ctx, "GL_EXT_multi_draw_arrays");
- _mesa_enable_extension(ctx, "GL_IBM_multimode_draw_arrays");
- _mesa_enable_extension(ctx, "GL_ARB_vertex_buffer_object");
- /* 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");
- _mesa_enable_extension(ctx, "GL_MESA_program_debug");
- }
-#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->_ColorDrawBufferMask[0] != BUFFER_BIT_FRONT_LEFT &&
- ctx->DrawBuffer->_ColorDrawBufferMask[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);
- _ac_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.StencilFunc = fxDDStencilFunc;
- ctx->Driver.StencilMask = fxDDStencilMask;
- ctx->Driver.StencilOp = fxDDStencilOp;
- }
-
- 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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddspan.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddspan.c
deleted file mode 100644
index 79abbefc2..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddspan.c
+++ /dev/null
@@ -1,663 +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 \
- 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, \
- fxMesa->currentFB, LFB_MODE, \
- GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
-
-#define HW_WRITE_UNLOCK() \
- grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->currentFB ); \
- }
-
-#define HW_READ_LOCK() \
- fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GrLfbInfo_t info; \
- info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_READ_ONLY, fxMesa->currentFB, \
- LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
-
-#define HW_READ_UNLOCK() \
- grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->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 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 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);
- GrLfbInfo_t info;
- info.size = sizeof(GrLfbInfo_t);
- 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 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, fxMesa->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);
- GrLfbInfo_t info;
- info.size = sizeof(GrLfbInfo_t);
- 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 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, fxMesa->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);
- GLuint i;
- grLfbReadRegion(fxMesa->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, GLdepth 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, GLdepth 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
- */
-}
-
-
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void
-fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- (void) buffer;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDSetBuffer(%x)\n", (int)bufferBit);
- }
-
- if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
- fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
- grRenderBuffer(fxMesa->currentFB);
- }
- else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
- fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
- grRenderBuffer(fxMesa->currentFB);
- }
-}
-
-
-/************************************************************************/
-
-
-
-void
-fxSetupDDSpanPointers(GLcontext * ctx)
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
-
- swdd->SetBuffer = fxDDSetBuffer;
-
- 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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddtex.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddtex.c
deleted file mode 100644
index f3f12c4cc..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxddtex.c
+++ /dev/null
@@ -1,1849 +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 "enums.h"
-#include "image.h"
-#include "teximage.h"
-#include "texformat.h"
-#include "texcompress.h"
-#include "texobj.h"
-#include "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_rgba8888(ctx, 2, GL_RGBA,
- &_mesa_texformat_rgba8888_rev, src,
- 0, 0, 0, /* dstX/Y/Zoffset */
- srcRowStride, /* dstRowStride */
- 0, /* dstImageStride */
- srcWidth, srcHeight, 1,
- texImage->Format, _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;
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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;
- CLAMP_SELF(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->Format) {
- 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
-
-
-const struct gl_texture_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_texformat_rgb565;
- }
- /* intentional fall through */
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_rgb565;
- case GL_RGBA2:
- case GL_RGBA4:
- return &_mesa_texformat_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_texformat_argb8888;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- /* intentional fall through */
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return (allow32bpt) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_argb4444;
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_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_texformat_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_texformat_al88;
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- return &_mesa_texformat_rgb565;
- case GL_RGB5_A1:
- return &_mesa_texformat_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_texformat_rgb_dxt1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- return &_mesa_texformat_rgba_dxt3;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
- /* GL_3DFX_texture_compression_FXT1 */
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-
-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 (!texImage->IsCompressed) {
- GLubyte *destAddr;
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- return GL_FALSE;
- }
-
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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_rgba8888(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*/ );
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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->IntFormat, 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 && texImage->IsCompressed) {
- 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->IntFormat = 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->IntFormat = internalFormat = texNapalm;
- texImage->IsCompressed = GL_TRUE;
- }
- }
-#endif
-
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, format, type);
- assert(texImage->TexFormat);
- texelBytes = texImage->TexFormat->TexelBytes;
- /*if (!fxMesa->HaveTexFmt) assert(texelBytes == 1 || texelBytes == 2);*/
-
- mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
-
- /* allocate mipmap buffer */
- assert(!texImage->Data);
- if (texImage->IsCompressed) {
- texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
- mml->width,
- mml->height,
- 1,
- internalFormat);
- dstRowStride = _mesa_compressed_row_stride(internalFormat, 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 */
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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(!texImage->IsCompressed);
-
- 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->Format);
-
- texelBytes = texImage->TexFormat->TexelBytes;
- if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, 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 */
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- 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(!texImage->IsCompressed);
-
- 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(texImage->IsCompressed);
-
- 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;
-
-
- /* choose the texture format */
- assert(ctx->Driver.ChooseTextureFormat);
- texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx,
- internalFormat, -1/*format*/, -1/*type*/);
- assert(texImage->TexFormat);
-
- /* 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_compressed_texture_size(ctx,
- mml->width,
- mml->height,
- 1,
- internalFormat);
- 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_compressed_row_stride(internalFormat, width);
-
- GLuint destRowStride = _mesa_compressed_row_stride(internalFormat,
- 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(!texImage->IsCompressed);
- }
-
- 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_compressed_row_stride(texImage->IntFormat, width);
-
- destRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
- mml->width);
- dest = _mesa_compressed_image_address(xoffset, yoffset, 0,
- texImage->IntFormat,
- 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_compressed_row_stride(texImage->IntFormat, texImage->Width);
-
- destRowStride = _mesa_compressed_row_stride(texImage->IntFormat,
- 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(!texImage->IsCompressed);
- }
-
- 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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxdrv.h b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxdrv.h
deleted file mode 100644
index ca3bdc99b..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxdrv.h
+++ /dev/null
@@ -1,771 +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 "context.h"
-#include "imports.h"
-#include "macros.h"
-#include "matrix.h"
-#include "mtypes.h"
-
-#include "GL/fxmesa.h"
-#include "fxglidew.h"
-
-#include "math/m_vector.h"
-
-
-/* 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 fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
-extern void fxDDStencilMask (GLcontext *ctx, GLuint mask);
-extern void fxDDStencilOp (GLcontext *ctx, 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 GLdepth depth[], const GLubyte mask[]);
-
-extern void fxDDReadDepthSpan(GLcontext * ctx, GLuint n, GLint x, GLint y,
- GLdepth depth[]);
-
-extern void fxDDWriteDepthPixels(GLcontext * ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth depth[], const GLubyte mask[]);
-
-extern void fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLdepth 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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxg.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxg.c
deleted file mode 100644
index afb9441ad..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxg.h b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxg.h
deleted file mode 100644
index e71201116..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxglidew.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxglidew.c
deleted file mode 100644
index 1fedf2ab9..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxglidew.h b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxglidew.h
deleted file mode 100644
index a19d0b58c..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxsetup.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxsetup.c
deleted file mode 100644
index 360a42f7e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxsetup.c
+++ /dev/null
@@ -1,2217 +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 "enums.h"
-#include "tnl.h"
-#include "tnl/t_context.h"
-#include "swrast.h"
-#include "texstore.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 = texImage->TexFormat->TexelBytes;
- 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
-fxDDStencilFunc (GLcontext *ctx, 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
-fxDDStencilMask (GLcontext *ctx, 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
-fxDDStencilOp (GLcontext *ctx, 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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxsetup.h b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxsetup.h
deleted file mode 100644
index 9d337d4b0..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxtexman.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxtexman.c
deleted file mode 100644
index 940c8fd0b..000000000
--- a/nx-X11/extras/Mesa/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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxtris.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxtris.c
deleted file mode 100644
index 180637565..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxtris.c
+++ /dev/null
@@ -1,1834 +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 "imports.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "colormac.h"
-#include "nvfragprog.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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxvb.c b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxvb.c
deleted file mode 100644
index 34ada61f4..000000000
--- a/nx-X11/extras/Mesa/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 "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "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->ColorPtr[1]) {
- /* If stride is zero, ColorPtr[1] 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->ColorPtr[1]->stride) {
- assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
- INTERP_4F( t,
- GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], out),
- GET_COLOR(VB->ColorPtr[1], in) );
- }
-
- if (VB->SecondaryColorPtr[1]) {
- INTERP_3F( t,
- GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], out),
- GET_COLOR(VB->SecondaryColorPtr[1], 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->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
- GET_COLOR(VB->ColorPtr[1], src) );
-
- if (VB->SecondaryColorPtr[1]) {
- COPY_3FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
- GET_COLOR(VB->SecondaryColorPtr[1], 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/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxvbtmp.h b/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxvbtmp.h
deleted file mode 100644
index f7970c78e..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/glide/fxvbtmp.h
+++ /dev/null
@@ -1,369 +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->TexCoordPtr[tmu0_source]->data;
- tc0_stride = VB->TexCoordPtr[tmu0_source]->stride;
- u0scale = fxMesa->s0scale;
- v0scale = fxMesa->t0scale;
- if (IND & SETUP_PTEX)
- tc0_size = VB->TexCoordPtr[tmu0_source]->size;
- }
-
- if (IND & SETUP_TMU1) {
- tc1 = VB->TexCoordPtr[tmu1_source]->data;
- tc1_stride = VB->TexCoordPtr[tmu1_source]->stride;
- u1scale = fxMesa->s1scale; /* wrong if tmu1_source == 0, possible? */
- v1scale = fxMesa->t1scale;
- if (IND & SETUP_PTEX)
- tc1_size = VB->TexCoordPtr[tmu1_source]->size;
- }
-
- if (IND & SETUP_RGBA) {
- col = VB->ColorPtr[0]->data;
- col_stride = VB->ColorPtr[0]->stride;
- col_size = VB->ColorPtr[0]->size;
- }
-
- if (IND & SETUP_SPEC) {
- spec = VB->SecondaryColorPtr[0]->data;
- spec_stride = VB->SecondaryColorPtr[0]->stride;
- }
-
- if (IND & SETUP_FOGC) {
- fog = VB->FogCoordPtr->data;
- fog_stride = VB->FogCoordPtr->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->TexCoordPtr[0] == 0)
- VB->TexCoordPtr[0] = VB->TexCoordPtr[1];
-
- if (VB->TexCoordPtr[1]->size == 4)
- return GL_FALSE;
- }
-
- if (VB->TexCoordPtr[0] && VB->TexCoordPtr[0]->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/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/Makefile.win b/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/Makefile.win
deleted file mode 100644
index 36d520e65..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/Makefile.win
+++ /dev/null
@@ -1,39 +0,0 @@
-# Makefile for Win32
-
-!include <win32.mak>
-
-TOP = ..\..
-
-OSMESA_SRCS = osmesa.c
-OSMESA_OBJS = osmesa.obj
-
-ASM_SRCS =
-CORE_SRCS =
-DRIVER_SRCS = $(OSMESA_SRCS)
-
-SRCS = $(OSMESA_SRCS)
-
-all : osmesadll
-
-!include "$(TOP)/mesawin32.mak"
-
-osmesadll: $(OSMESADLL)
-
-CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -DBUILD_GL32 -I$(TOP)/src
-LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
-
-OBJS = $(ASM_SRCS:.S=.obj) $(CORE_SRCS:.c=.obj) $(DRIVER_SRCS:.c=.obj)
-LIBS = $(guilibsdll) $(TOP)/lib/$(MESALIB)
-
-$(OSMESADLL) : $(OBJS) osmesa.def
- $(link) $(LFLAGS) -def:osmesa.def -out:$(OSMESADLL) $(OBJS) $(LIBS)
- @echo "copying OSMesa library to library directory..."
- -copy $(OSMESALIB) $(TOP)\lib
- @echo "copying OSMesa dll to library directory..."
- -copy $(OSMESADLL) $(TOP)\lib
-
-install : $(OSMESADLL)
- @echo "copying OSMesa library to system library directory..."
- -copy $(OSMESALIB) $(LIBINSTALL)
- @echo "copying OSMesa dll to system library directory..."
- -copy $(OSMESADLL) $(DLLINSTALL)
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/descrip.mms b/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/descrip.mms
deleted file mode 100644
index 64dc041f9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/descrip.mms
+++ /dev/null
@@ -1,41 +0,0 @@
-# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 16 June 2003
-
-.first
- define gl [----.include.gl]
- define math [--.math]
- define tnl [--.tnl]
- define swrast [--.swrast]
- define swrast_setup [--.swrast_setup]
- define array_cache [--.array_cache]
- define drivers [-]
-
-.include [----]mms-config.
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = [----.include],[--.main],[--.glapi]
-LIBDIR = [----.lib]
-CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)
-
-SOURCES = osmesa.c
-
-OBJECTS = osmesa.obj
-
-##### RULES #####
-
-VERSION=Mesa V3.4
-
-##### TARGETS #####
-# Make the library
-$(LIBDIR)$(GL_LIB) : $(OBJECTS)
- @ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
-
-clean :
- purge
- delete *.obj;*
-
-osmesa.obj : osmesa.c
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.c b/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.c
deleted file mode 100644
index 8a85b5ecf..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.c
+++ /dev/null
@@ -1,1333 +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.
- */
-
-
-/*
- * Off-Screen Mesa rendering / Rendering into client memory space
- *
- * Note on thread safety: this driver is thread safe. All
- * functions are reentrant. The notion of current context is
- * managed by the core _mesa_make_current() and _mesa_get_current_context()
- * functions. Those functions are thread-safe.
- */
-
-
-#include "glheader.h"
-#include "GL/osmesa.h"
-#include "context.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "fbobject.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "renderbuffer.h"
-#include "array_cache/acache.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "drivers/common/driverfuncs.h"
-
-
-
-/*
- * This is the OS/Mesa context struct.
- * Notice how it includes a GLcontext. By doing this we're mimicking
- * C++ inheritance/derivation.
- * Later, we can cast a GLcontext pointer into an OSMesaContext pointer
- * or vice versa.
- */
-struct osmesa_context {
- GLcontext mesa; /* The core GL/Mesa context */
- GLvisual *gl_visual; /* Describes the buffers */
- GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */
- GLenum format; /* either GL_RGBA or GL_COLOR_INDEX */
- void *buffer; /* the image buffer */
- GLint width, height; /* size of image buffer */
- GLint rowlength; /* number of pixels per row */
- GLint userRowLength; /* user-specified number of pixels per row */
- GLint rshift, gshift; /* bit shifts for RGBA formats */
- GLint bshift, ashift;
- GLint rInd, gInd, bInd, aInd;/* index offsets for RGBA formats */
- GLchan *rowaddr[MAX_HEIGHT]; /* address of first pixel in each image row */
- GLboolean yup; /* TRUE -> Y increases upward */
- /* FALSE -> Y increases downward */
-};
-
-
-/* Just cast, since we're using structure containment */
-#define OSMESA_CONTEXT(ctx) ((OSMesaContext) (ctx->DriverCtx))
-
-
-
-/**********************************************************************/
-/*** Private Device Driver Functions ***/
-/**********************************************************************/
-
-
-static const GLubyte *
-get_string( GLcontext *ctx, GLenum name )
-{
- (void) ctx;
- switch (name) {
- case GL_RENDERER:
-#if CHAN_BITS == 32
- return (const GLubyte *) "Mesa OffScreen32";
-#elif CHAN_BITS == 16
- return (const GLubyte *) "Mesa OffScreen16";
-#else
- return (const GLubyte *) "Mesa OffScreen";
-#endif
- default:
- return NULL;
- }
-}
-
-
-static void
-osmesa_update_state( GLcontext *ctx, GLuint new_state )
-{
- /* easy - just propogate */
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-
-static void
-set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
-{
- /* separate read buffer not supported */
- ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(bufferBit == BUFFER_BIT_FRONT_LEFT);
-}
-
-
-/*
- * Just return the current buffer size.
- * There's no window to track the size of.
- */
-static void
-get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
-{
- /* don't use GET_CURRENT_CONTEXT(ctx) here - it's a problem on Windows */
- GLcontext *ctx = (GLcontext *) _glapi_get_context();
- (void) buffer;
- if (ctx) {
- OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
- *width = osmesa->width;
- *height = osmesa->height;
- }
-}
-
-
-/**********************************************************************/
-/***** Read/write spans/arrays of pixels *****/
-/**********************************************************************/
-
-/* RGBA */
-#define NAME(PREFIX) PREFIX##_RGBA
-#define FORMAT GL_RGBA
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
-#define INC_PIXEL_PTR(P) P += 4
-#if CHAN_TYPE == GL_FLOAT
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[0] = MAX2((VALUE[RCOMP]), 0.0F); \
- DST[1] = MAX2((VALUE[GCOMP]), 0.0F); \
- DST[2] = MAX2((VALUE[BCOMP]), 0.0F); \
- DST[3] = CLAMP((VALUE[ACOMP]), 0.0F, CHAN_MAXF)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- DST[0] = MAX2((VALUE[RCOMP]), 0.0F); \
- DST[1] = MAX2((VALUE[GCOMP]), 0.0F); \
- DST[2] = MAX2((VALUE[BCOMP]), 0.0F); \
- DST[3] = CHAN_MAXF
-#else
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[0] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[2] = VALUE[BCOMP]; \
- DST[3] = VALUE[ACOMP]
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- DST[0] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[2] = VALUE[BCOMP]; \
- DST[3] = CHAN_MAX
-#endif
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = SRC[0]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[2]; \
- DST[ACOMP] = SRC[3]
-#include "swrast/s_spantemp.h"
-
-/* BGRA */
-#define NAME(PREFIX) PREFIX##_BGRA
-#define FORMAT GL_RGBA
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
-#define INC_PIXEL_PTR(P) P += 4
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[2] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[0] = VALUE[BCOMP]; \
- DST[3] = VALUE[ACOMP]
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- DST[2] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[0] = VALUE[BCOMP]; \
- DST[3] = CHAN_MAX
-#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"
-
-/* ARGB */
-#define NAME(PREFIX) PREFIX##_ARGB
-#define FORMAT GL_RGBA
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
-#define INC_PIXEL_PTR(P) P += 4
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[1] = VALUE[RCOMP]; \
- DST[2] = VALUE[GCOMP]; \
- DST[3] = VALUE[BCOMP]; \
- DST[0] = VALUE[ACOMP]
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- DST[1] = VALUE[RCOMP]; \
- DST[2] = VALUE[GCOMP]; \
- DST[3] = VALUE[BCOMP]; \
- DST[0] = CHAN_MAX
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = SRC[1]; \
- DST[GCOMP] = SRC[2]; \
- DST[BCOMP] = SRC[3]; \
- DST[ACOMP] = SRC[0]
-#include "swrast/s_spantemp.h"
-
-/* RGB */
-#define NAME(PREFIX) PREFIX##_RGB
-#define FORMAT GL_RGBA
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
-#define INC_PIXEL_PTR(P) P += 3
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[0] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[2] = VALUE[BCOMP]
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = SRC[0]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[2]; \
- DST[ACOMP] = CHAN_MAX
-#include "swrast/s_spantemp.h"
-
-/* BGR */
-#define NAME(PREFIX) PREFIX##_BGR
-#define FORMAT GL_RGBA
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLchan *P = osmesa->rowaddr[Y] + 4 * (X)
-#define INC_PIXEL_PTR(P) P += 3
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- DST[2] = VALUE[RCOMP]; \
- DST[1] = VALUE[GCOMP]; \
- DST[0] = VALUE[BCOMP]
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = SRC[2]; \
- DST[GCOMP] = SRC[1]; \
- DST[BCOMP] = SRC[0]; \
- DST[ACOMP] = CHAN_MAX
-#include "swrast/s_spantemp.h"
-
-/* 16-bit BGR */
-#if CHAN_TYPE == GL_UNSIGNED_BYTE
-#define NAME(PREFIX) PREFIX##_RGB_565
-#define FORMAT GL_RGBA
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) osmesa->rowaddr[Y] + (X)
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = ( (((VALUE[RCOMP]) & 0xf8) << 8) | (((VALUE[GCOMP]) & 0xfc) << 3) | ((VALUE[BCOMP]) >> 3) )
-#define FETCH_PIXEL(DST, SRC) \
- DST[RCOMP] = ( (((*SRC) >> 8) & 0xf8) | (((*SRC) >> 11) & 0x7) ); \
- DST[GCOMP] = ( (((*SRC) >> 3) & 0xfc) | (((*SRC) >> 5) & 0x3) ); \
- DST[BCOMP] = ( (((*SRC) << 3) & 0xf8) | (((*SRC) ) & 0x7) ); \
- DST[ACOMP] = CHAN_MAX
-#include "swrast/s_spantemp.h"
-#endif /* CHAN_TYPE == GL_UNSIGNED_BYTE */
-
-/* color index */
-#define NAME(PREFIX) PREFIX##_CI
-#define FORMAT GL_COLOR_INDEX8_EXT
-#define SPAN_VARS \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = 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"
-
-
-
-
-/**********************************************************************/
-/***** Optimized line rendering *****/
-/**********************************************************************/
-
-
-#if CHAN_TYPE == GL_FLOAT
-#define PACK_RGBA(DST, R, G, B, A) \
-do { \
- (DST)[0] = MAX2( R, 0.0F ); \
- (DST)[1] = MAX2( G, 0.0F ); \
- (DST)[2] = MAX2( B, 0.0F ); \
- (DST)[3] = CLAMP(A, 0.0F, CHAN_MAXF);\
-} while (0)
-#else
-#define PACK_RGBA(DST, R, G, B, A) \
-do { \
- (DST)[osmesa->rInd] = R; \
- (DST)[osmesa->gInd] = G; \
- (DST)[osmesa->bInd] = B; \
- (DST)[osmesa->aInd] = A; \
-} while (0)
-#endif
-
-#define PACK_RGB(DST, R, G, B) \
-do { \
- (DST)[0] = R; \
- (DST)[1] = G; \
- (DST)[2] = B; \
-} while (0)
-
-#define PACK_BGR(DST, R, G, B) \
-do { \
- (DST)[0] = B; \
- (DST)[1] = G; \
- (DST)[2] = R; \
-} while (0)
-
-#define PACK_RGB_565(DST, R, G, B) \
-do { \
- (DST) = (((int) (R) << 8) & 0xf800) | (((int) (G) << 3) & 0x7e0) | ((int) (B) >> 3);\
-} while (0)
-
-#define UNPACK_RED(P) ( (P)[osmesa->rInd] )
-#define UNPACK_GREEN(P) ( (P)[osmesa->gInd] )
-#define UNPACK_BLUE(P) ( (P)[osmesa->bInd] )
-#define UNPACK_ALPHA(P) ( (P)[osmesa->aInd] )
-
-#define PIXELADDR1(X,Y) (osmesa->rowaddr[Y] + (X))
-#define PIXELADDR2(X,Y) (osmesa->rowaddr[Y] + 2 * (X))
-#define PIXELADDR3(X,Y) (osmesa->rowaddr[Y] + 3 * (X))
-#define PIXELADDR4(X,Y) (osmesa->rowaddr[Y] + 4 * (X))
-
-
-/*
- * Draw a flat-shaded, RGB line into an osmesa buffer.
- */
-#define NAME flat_rgba_line
-#define CLIP_HACK 1
-#define SETUP_CODE \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \
- const GLchan *color = vert1->color;
-
-#define PLOT(X, Y) \
-do { \
- GLchan *p = PIXELADDR4(X, Y); \
- PACK_RGBA(p, color[0], color[1], color[2], color[3]); \
-} while (0)
-
-#ifdef WIN32
-#include "..\swrast\s_linetemp.h"
-#else
-#include "swrast/s_linetemp.h"
-#endif
-
-
-
-/*
- * Draw a flat-shaded, Z-less, RGB line into an osmesa buffer.
- */
-#define NAME flat_rgba_z_line
-#define CLIP_HACK 1
-#define INTERP_Z 1
-#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define SETUP_CODE \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \
- const GLchan *color = vert1->color;
-
-#define PLOT(X, Y) \
-do { \
- if (Z < *zPtr) { \
- GLchan *p = PIXELADDR4(X, Y); \
- PACK_RGBA(p, color[RCOMP], color[GCOMP], \
- color[BCOMP], color[ACOMP]); \
- *zPtr = Z; \
- } \
-} while (0)
-
-#ifdef WIN32
-#include "..\swrast\s_linetemp.h"
-#else
-#include "swrast/s_linetemp.h"
-#endif
-
-
-
-/*
- * Analyze context state to see if we can provide a fast line drawing
- * function, like those in lines.c. Otherwise, return NULL.
- */
-static swrast_line_func
-osmesa_choose_line_function( GLcontext *ctx )
-{
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
- const SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- if (CHAN_BITS != 8) return NULL;
- if (ctx->RenderMode != GL_RENDER) return NULL;
- if (ctx->Line.SmoothFlag) return NULL;
- if (ctx->Texture._EnabledUnits) return NULL;
- if (ctx->Light.ShadeModel != GL_FLAT) return NULL;
- if (ctx->Line.Width != 1.0F) return NULL;
- if (ctx->Line.StippleFlag) return NULL;
- if (ctx->Line.SmoothFlag) return NULL;
- if (osmesa->format != OSMESA_RGBA &&
- osmesa->format != OSMESA_BGRA &&
- osmesa->format != OSMESA_ARGB) return NULL;
-
- if (swrast->_RasterMask==DEPTH_BIT
- && ctx->Depth.Func==GL_LESS
- && ctx->Depth.Mask==GL_TRUE
- && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS) {
- return (swrast_line_func) flat_rgba_z_line;
- }
-
- if (swrast->_RasterMask == 0) {
- return (swrast_line_func) flat_rgba_line;
- }
-
- return (swrast_line_func) NULL;
-}
-
-
-/**********************************************************************/
-/***** Optimized triangle rendering *****/
-/**********************************************************************/
-
-
-/*
- * Smooth-shaded, z-less triangle, RGBA color.
- */
-#define NAME smooth_rgba_z_triangle
-#define INTERP_Z 1
-#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define INTERP_RGB 1
-#define INTERP_ALPHA 1
-#define SETUP_CODE \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-#define RENDER_SPAN( span ) \
- GLuint i; \
- GLchan *img = PIXELADDR4(span.x, span.y); \
- for (i = 0; i < span.end; i++, img += 4) { \
- const GLdepth z = FixedToDepth(span.z); \
- if (z < zRow[i]) { \
- PACK_RGBA(img, FixedToChan(span.red), \
- FixedToChan(span.green), FixedToChan(span.blue), \
- FixedToChan(span.alpha)); \
- zRow[i] = z; \
- } \
- span.red += span.redStep; \
- span.green += span.greenStep; \
- span.blue += span.blueStep; \
- span.alpha += span.alphaStep; \
- span.z += span.zStep; \
- }
-#ifdef WIN32
-#include "..\swrast\s_tritemp.h"
-#else
-#include "swrast/s_tritemp.h"
-#endif
-
-
-
-/*
- * Flat-shaded, z-less triangle, RGBA color.
- */
-#define NAME flat_rgba_z_triangle
-#define INTERP_Z 1
-#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define SETUP_CODE \
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \
- GLuint pixel; \
- PACK_RGBA((GLchan *) &pixel, v2->color[0], v2->color[1], \
- v2->color[2], v2->color[3]);
-
-#define RENDER_SPAN( span ) \
- GLuint i; \
- GLuint *img = (GLuint *) PIXELADDR4(span.x, span.y); \
- for (i = 0; i < span.end; i++) { \
- const GLdepth z = FixedToDepth(span.z); \
- if (z < zRow[i]) { \
- img[i] = pixel; \
- zRow[i] = z; \
- } \
- span.z += span.zStep; \
- }
-#ifdef WIN32
-#include "..\swrast\s_tritemp.h"
-#else
-#include "swrast/s_tritemp.h"
-#endif
-
-
-
-/*
- * Return pointer to an accelerated triangle function if possible.
- */
-static swrast_tri_func
-osmesa_choose_triangle_function( GLcontext *ctx )
-{
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
- const SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- if (CHAN_BITS != 8) return (swrast_tri_func) NULL;
- if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
- if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
- if (ctx->Polygon.StippleFlag) return (swrast_tri_func) NULL;
- if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;
- if (osmesa->format != OSMESA_RGBA &&
- osmesa->format != OSMESA_BGRA &&
- osmesa->format != OSMESA_ARGB) return (swrast_tri_func) NULL;
- if (ctx->Polygon.CullFlag &&
- ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
- return (swrast_tri_func) NULL;
-
- if (swrast->_RasterMask == DEPTH_BIT &&
- ctx->Depth.Func == GL_LESS &&
- ctx->Depth.Mask == GL_TRUE &&
- ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS) {
- if (ctx->Light.ShadeModel == GL_SMOOTH) {
- return (swrast_tri_func) smooth_rgba_z_triangle;
- }
- else {
- return (swrast_tri_func) flat_rgba_z_triangle;
- }
- }
- return (swrast_tri_func) NULL;
-}
-
-
-
-/* Override for the swrast triangle-selection function. Try to use one
- * of our internal triangle functions, otherwise fall back to the
- * standard swrast functions.
- */
-static void
-osmesa_choose_triangle( GLcontext *ctx )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- swrast->Triangle = osmesa_choose_triangle_function( ctx );
- if (!swrast->Triangle)
- _swrast_choose_triangle( ctx );
-}
-
-static void
-osmesa_choose_line( GLcontext *ctx )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- swrast->Line = osmesa_choose_line_function( ctx );
- if (!swrast->Line)
- _swrast_choose_line( ctx );
-}
-
-
-#define OSMESA_NEW_LINE (_NEW_LINE | \
- _NEW_TEXTURE | \
- _NEW_LIGHT | \
- _NEW_DEPTH | \
- _NEW_RENDERMODE | \
- _SWRAST_NEW_RASTERMASK)
-
-#define OSMESA_NEW_TRIANGLE (_NEW_POLYGON | \
- _NEW_TEXTURE | \
- _NEW_LIGHT | \
- _NEW_DEPTH | \
- _NEW_RENDERMODE | \
- _SWRAST_NEW_RASTERMASK)
-
-
-/**
- * Don't use _mesa_delete_renderbuffer since we can't free rb->Data.
- */
-static void
-osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
-{
- _mesa_free(rb);
-}
-
-
-/**
- * Allocate renderbuffer storage. We don't actually allocate any storage
- * since we're using a user-provided buffer.
- * Just set up all the gl_renderbuffer methods.
- */
-static GLboolean
-osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat, GLuint width, GLuint height)
-{
- const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
-
- if (osmesa->format == OSMESA_RGBA) {
- rb->GetRow = get_row_RGBA;
- rb->GetValues = get_values_RGBA;
- rb->PutRow = put_row_RGBA;
- rb->PutRowRGB = put_row_rgb_RGBA;
- rb->PutMonoRow = put_mono_row_RGBA;
- rb->PutValues = put_values_RGBA;
- rb->PutMonoValues = put_mono_values_RGBA;
- }
- else if (osmesa->format == OSMESA_BGRA) {
- rb->GetRow = get_row_BGRA;
- rb->GetValues = get_values_BGRA;
- rb->PutRow = put_row_BGRA;
- rb->PutRowRGB = put_row_rgb_BGRA;
- rb->PutMonoRow = put_mono_row_BGRA;
- rb->PutValues = put_values_BGRA;
- rb->PutMonoValues = put_mono_values_BGRA;
- }
- else if (osmesa->format == OSMESA_ARGB) {
- rb->GetRow = get_row_ARGB;
- rb->GetValues = get_values_ARGB;
- rb->PutRow = put_row_ARGB;
- rb->PutRowRGB = put_row_rgb_ARGB;
- rb->PutMonoRow = put_mono_row_ARGB;
- rb->PutValues = put_values_ARGB;
- rb->PutMonoValues = put_mono_values_ARGB;
- }
- else if (osmesa->format == OSMESA_RGB) {
- rb->GetRow = get_row_RGB;
- rb->GetValues = get_values_RGB;
- rb->PutRow = put_row_RGB;
- rb->PutRowRGB = put_row_rgb_RGB;
- rb->PutMonoRow = put_mono_row_RGB;
- rb->PutValues = put_values_RGB;
- rb->PutMonoValues = put_mono_values_RGB;
- }
- else if (osmesa->format == OSMESA_BGR) {
- rb->GetRow = get_row_BGR;
- rb->GetValues = get_values_BGR;
- rb->PutRow = put_row_BGR;
- rb->PutRowRGB = put_row_rgb_BGR;
- rb->PutMonoRow = put_mono_row_BGR;
- rb->PutValues = put_values_BGR;
- rb->PutMonoValues = put_mono_values_BGR;
- }
-#if CHAN_TYPE == GL_UNSIGNED_BYTE
- else if (osmesa->format == OSMESA_RGB_565) {
- rb->GetRow = get_row_RGB_565;
- rb->GetValues = get_values_RGB_565;
- rb->PutRow = put_row_RGB_565;
- rb->PutRow = put_row_rgb_RGB_565;
- rb->PutMonoRow = put_mono_row_RGB_565;
- rb->PutValues = put_values_RGB_565;
- rb->PutMonoValues = put_mono_values_RGB_565;
- }
-#endif
- 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");
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * Allocate a new renderbuffer tpo describe the user-provided color buffer.
- */
-static struct gl_renderbuffer *
-new_osmesa_renderbuffer(GLenum format)
-{
- struct gl_renderbuffer *rb = CALLOC_STRUCT(gl_renderbuffer);
- if (rb) {
- const GLuint name = 0;
- _mesa_init_renderbuffer(rb, name);
-
- rb->Delete = osmesa_delete_renderbuffer;
- rb->AllocStorage = osmesa_renderbuffer_storage;
-
- if (format == OSMESA_COLOR_INDEX) {
- rb->_BaseFormat = GL_COLOR_INDEX;
- rb->InternalFormat = GL_COLOR_INDEX;
- rb->DataType = GL_UNSIGNED_BYTE;
- }
- else {
- rb->_BaseFormat = GL_RGBA;
- rb->InternalFormat = GL_RGBA;
- rb->DataType = CHAN_TYPE;
- }
- }
- return rb;
-}
-
-
-
-/**********************************************************************/
-/***** Public Functions *****/
-/**********************************************************************/
-
-
-/*
- * 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
- * sharelist - specifies another OSMesaContext with which to share
- * display lists. NULL indicates no sharing.
- * Return: an OSMesaContext or 0 if error
- */
-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);
-}
-
-
-
-/*
- * New in Mesa 3.5
- *
- * Create context and specify size of ancillary buffers.
- */
-GLAPI OSMesaContext GLAPIENTRY
-OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
- GLint accumBits, OSMesaContext sharelist )
-{
- OSMesaContext osmesa;
- struct dd_function_table functions;
- GLint rshift, gshift, bshift, ashift;
- GLint rind, gind, bind, aind;
- GLint indexBits = 0, redBits = 0, greenBits = 0, blueBits = 0, alphaBits =0;
- GLboolean rgbmode;
- const GLuint i4 = 1;
- const GLubyte *i1 = (GLubyte *) &i4;
- const GLint little_endian = *i1;
-
- rind = gind = bind = aind = 0;
- if (format==OSMESA_COLOR_INDEX) {
- indexBits = 8;
- rshift = gshift = bshift = ashift = 0;
- rgbmode = GL_FALSE;
- }
- else if (format==OSMESA_RGBA) {
- indexBits = 0;
- redBits = CHAN_BITS;
- greenBits = CHAN_BITS;
- blueBits = CHAN_BITS;
- alphaBits = CHAN_BITS;
- rind = 0;
- gind = 1;
- bind = 2;
- aind = 3;
- if (little_endian) {
- rshift = 0;
- gshift = 8;
- bshift = 16;
- ashift = 24;
- }
- else {
- rshift = 24;
- gshift = 16;
- bshift = 8;
- ashift = 0;
- }
- rgbmode = GL_TRUE;
- }
- else if (format==OSMESA_BGRA) {
- indexBits = 0;
- redBits = CHAN_BITS;
- greenBits = CHAN_BITS;
- blueBits = CHAN_BITS;
- alphaBits = CHAN_BITS;
- bind = 0;
- gind = 1;
- rind = 2;
- aind = 3;
- if (little_endian) {
- bshift = 0;
- gshift = 8;
- rshift = 16;
- ashift = 24;
- }
- else {
- bshift = 24;
- gshift = 16;
- rshift = 8;
- ashift = 0;
- }
- rgbmode = GL_TRUE;
- }
- else if (format==OSMESA_ARGB) {
- indexBits = 0;
- redBits = CHAN_BITS;
- greenBits = CHAN_BITS;
- blueBits = CHAN_BITS;
- alphaBits = CHAN_BITS;
- aind = 0;
- rind = 1;
- gind = 2;
- bind = 3;
- if (little_endian) {
- ashift = 0;
- rshift = 8;
- gshift = 16;
- bshift = 24;
- }
- else {
- ashift = 24;
- rshift = 16;
- gshift = 8;
- bshift = 0;
- }
- rgbmode = GL_TRUE;
- }
- else if (format==OSMESA_RGB) {
- indexBits = 0;
- redBits = CHAN_BITS;
- greenBits = CHAN_BITS;
- blueBits = CHAN_BITS;
- alphaBits = 0;
- bshift = 0;
- gshift = 8;
- rshift = 16;
- ashift = 24;
- 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;
- alphaBits = 0;
- bshift = 0;
- gshift = 8;
- rshift = 16;
- ashift = 24;
- 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;
- alphaBits = 0;
- rshift = 11;
- gshift = 5;
- bshift = 0;
- ashift = 0;
- rind = 0; /* not used */
- gind = 0;
- bind = 0;
- rgbmode = GL_TRUE;
- }
-#endif
- else {
- return NULL;
- }
-
- osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context);
- if (osmesa) {
- osmesa->gl_visual = _mesa_create_visual( rgbmode,
- GL_FALSE, /* double buffer */
- GL_FALSE, /* stereo */
- redBits,
- greenBits,
- blueBits,
- alphaBits,
- indexBits,
- depthBits,
- stencilBits,
- accumBits,
- accumBits,
- accumBits,
- alphaBits ? accumBits : 0,
- 1 /* num samples */
- );
- if (!osmesa->gl_visual) {
- FREE(osmesa);
- return NULL;
- }
-
- /* Initialize device driver function table */
- _mesa_init_driver_functions(&functions);
- /* override with our functions */
- functions.GetString = get_string;
- functions.UpdateState = osmesa_update_state;
- functions.GetBufferSize = get_buffer_size;
-
- if (!_mesa_initialize_context(&osmesa->mesa,
- osmesa->gl_visual,
- sharelist ? &sharelist->mesa
- : (GLcontext *) NULL,
- &functions, (void *) osmesa)) {
- _mesa_destroy_visual( osmesa->gl_visual );
- FREE(osmesa);
- return NULL;
- }
-
- _mesa_enable_sw_extensions(&(osmesa->mesa));
- _mesa_enable_1_3_extensions(&(osmesa->mesa));
- _mesa_enable_1_4_extensions(&(osmesa->mesa));
- _mesa_enable_1_5_extensions(&(osmesa->mesa));
-
- osmesa->gl_buffer = _mesa_create_framebuffer(osmesa->gl_visual);
- if (!osmesa->gl_buffer) {
- _mesa_destroy_visual( osmesa->gl_visual );
- _mesa_free_context_data( &osmesa->mesa );
- FREE(osmesa);
- return NULL;
- }
-
- /* create front color buffer in user-provided memory (no back buffer) */
- _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
- new_osmesa_renderbuffer(format));
- _mesa_add_soft_renderbuffers(osmesa->gl_buffer,
- GL_FALSE, /* color */
- osmesa->gl_visual->haveDepthBuffer,
- osmesa->gl_visual->haveStencilBuffer,
- osmesa->gl_visual->haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */ );
-
- osmesa->format = format;
- osmesa->buffer = NULL;
- osmesa->width = 0;
- osmesa->height = 0;
- osmesa->userRowLength = 0;
- osmesa->rowlength = 0;
- osmesa->yup = GL_TRUE;
- osmesa->rshift = rshift;
- osmesa->gshift = gshift;
- osmesa->bshift = bshift;
- osmesa->ashift = ashift;
- osmesa->rInd = rind;
- osmesa->gInd = gind;
- osmesa->bInd = bind;
- osmesa->aInd = aind;
-
- /* Initialize the software rasterizer and helper modules. */
- {
- GLcontext *ctx = &osmesa->mesa;
- SWcontext *swrast;
- struct swrast_device_driver *swdd;
- TNLcontext *tnl;
-
- if (!_swrast_CreateContext( ctx ) ||
- !_ac_CreateContext( ctx ) ||
- !_tnl_CreateContext( ctx ) ||
- !_swsetup_CreateContext( ctx )) {
- _mesa_destroy_visual(osmesa->gl_visual);
- _mesa_free_context_data(ctx);
- _mesa_free(osmesa);
- return NULL;
- }
-
- _swsetup_Wakeup( ctx );
-
- /* use default TCL pipeline */
- tnl = TNL_CONTEXT(ctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
-
- swdd = _swrast_GetDeviceDriverReference( ctx );
- swdd->SetBuffer = set_buffer;
-
- /* Extend the software rasterizer with our optimized line and triangle
- * drawing functions.
- */
- swrast = SWRAST_CONTEXT( ctx );
- swrast->choose_line = osmesa_choose_line;
- swrast->choose_triangle = osmesa_choose_triangle;
- swrast->invalidate_line |= OSMESA_NEW_LINE;
- swrast->invalidate_triangle |= OSMESA_NEW_TRIANGLE;
- }
- }
- return osmesa;
-}
-
-
-/*
- * Destroy an Off-Screen Mesa rendering context.
- *
- * Input: ctx - the context to destroy
- */
-GLAPI void GLAPIENTRY
-OSMesaDestroyContext( OSMesaContext ctx )
-{
- if (ctx) {
- _swsetup_DestroyContext( &ctx->mesa );
- _tnl_DestroyContext( &ctx->mesa );
- _ac_DestroyContext( &ctx->mesa );
- _swrast_DestroyContext( &ctx->mesa );
-
- _mesa_destroy_visual( ctx->gl_visual );
- _mesa_destroy_framebuffer( ctx->gl_buffer );
- _mesa_free_context_data( &ctx->mesa );
- FREE( ctx );
- }
-}
-
-
-/*
- * Recompute the values of the context's rowaddr array.
- */
-static void
-compute_row_addresses( OSMesaContext ctx )
-{
- GLint bytesPerPixel, bytesPerRow, i;
- GLubyte *origin = (GLubyte *) ctx->buffer;
-
- if (ctx->format == OSMESA_COLOR_INDEX) {
- /* CI mode */
- bytesPerPixel = 1 * sizeof(GLchan);
- }
- else if ((ctx->format == OSMESA_RGB) || (ctx->format == OSMESA_BGR)) {
- /* RGB mode */
- bytesPerPixel = 3 * sizeof(GLchan);
- }
- else if (ctx->format == OSMESA_RGB_565) {
- /* 5/6/5 RGB pixel in 16 bits */
- bytesPerPixel = 2;
- }
- else {
- /* RGBA mode */
- bytesPerPixel = 4 * sizeof(GLchan);
- }
-
- bytesPerRow = ctx->rowlength * bytesPerPixel;
-
- if (ctx->yup) {
- /* Y=0 is bottom line of window */
- for (i = 0; i < MAX_HEIGHT; i++) {
- ctx->rowaddr[i] = (GLchan *) ((GLubyte *) origin + i * bytesPerRow);
- }
- }
- else {
- /* Y=0 is top line of window */
- for (i = 0; i < MAX_HEIGHT; i++) {
- GLint j = ctx->height - i - 1;
- ctx->rowaddr[i] = (GLchan *) ((GLubyte *) origin + j * bytesPerRow);
- }
- }
-}
-
-
-/*
- * Bind an OSMesaContext to an image buffer. The image buffer is just a
- * block of memory which the client provides. Its size must be at least
- * as large as width*height*sizeof(type). Its address should be a multiple
- * of 4 if using RGBA mode.
- *
- * Image data is stored in the order of glDrawPixels: row-major order
- * with the lower-left image pixel stored in the first array position
- * (ie. bottom-to-top).
- *
- * If the context's viewport hasn't been initialized yet, it will now be
- * initialized to (0,0,width,height).
- *
- * Input: ctx - the rendering context
- * buffer - the image buffer memory
- * type - data type for pixel components
- * Normally, only GL_UNSIGNED_BYTE and GL_UNSIGNED_SHORT_5_6_5
- * are supported. But if Mesa's been compiled with CHAN_BITS==16
- * then type must be GL_UNSIGNED_SHORT. And if Mesa's been build
- * with CHAN_BITS==32 then type must be GL_FLOAT.
- * width, height - size of image buffer in pixels, at least 1
- * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx,
- * invalid buffer address, invalid type, width<1, height<1,
- * width>internal limit or height>internal limit.
- */
-GLAPI GLboolean GLAPIENTRY
-OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
- GLsizei width, GLsizei height )
-{
- if (!ctx || !buffer ||
- width < 1 || height < 1 ||
- width > MAX_WIDTH || height > MAX_HEIGHT) {
- return GL_FALSE;
- }
-
- if (ctx->format == OSMESA_RGB_565) {
- if (type != GL_UNSIGNED_SHORT_5_6_5)
- return GL_FALSE;
- }
- else if (type != CHAN_TYPE) {
- return GL_FALSE;
- }
-
- /* Need to set these before calling _mesa_make_current() since the first
- * time the context is bound, _mesa_make_current() will call our
- * get_buffer_size() function to initialize the viewport. These are the
- * values returned by get_buffer_size():
- */
- ctx->buffer = buffer;
- ctx->width = width;
- ctx->height = height;
-
- osmesa_update_state( &ctx->mesa, 0 );
- _mesa_make_current( &ctx->mesa, ctx->gl_buffer, ctx->gl_buffer );
-
- if (ctx->userRowLength)
- ctx->rowlength = ctx->userRowLength;
- else
- ctx->rowlength = width;
-
- compute_row_addresses( ctx );
-
- /* this will make ensure we recognize the new buffer size */
- _mesa_resize_framebuffer(&ctx->mesa, ctx->gl_buffer, width, height);
-
- /* Added by Gerk Huisma: */
- _tnl_MakeCurrent( &ctx->mesa, ctx->mesa.DrawBuffer,
- ctx->mesa.ReadBuffer );
-
- return GL_TRUE;
-}
-
-
-
-GLAPI OSMesaContext GLAPIENTRY
-OSMesaGetCurrentContext( void )
-{
- GLcontext *ctx = _mesa_get_current_context();
- if (ctx)
- return (OSMesaContext) ctx;
- else
- return NULL;
-}
-
-
-
-GLAPI void GLAPIENTRY
-OSMesaPixelStore( GLint pname, GLint value )
-{
- OSMesaContext osmesa = OSMesaGetCurrentContext();
-
- switch (pname) {
- case OSMESA_ROW_LENGTH:
- if (value<0) {
- _mesa_error( &osmesa->mesa, GL_INVALID_VALUE,
- "OSMesaPixelStore(value)" );
- return;
- }
- osmesa->userRowLength = value;
- osmesa->rowlength = value ? value : osmesa->width;
- break;
- case OSMESA_Y_UP:
- osmesa->yup = value ? GL_TRUE : GL_FALSE;
- break;
- default:
- _mesa_error( &osmesa->mesa, GL_INVALID_ENUM, "OSMesaPixelStore(pname)" );
- return;
- }
-
- compute_row_addresses( osmesa );
-}
-
-
-GLAPI void GLAPIENTRY
-OSMesaGetIntegerv( GLint pname, GLint *value )
-{
- OSMesaContext osmesa = OSMesaGetCurrentContext();
-
- switch (pname) {
- case OSMESA_WIDTH:
- *value = osmesa->width;
- return;
- case OSMESA_HEIGHT:
- *value = osmesa->height;
- return;
- case OSMESA_FORMAT:
- *value = osmesa->format;
- return;
- case OSMESA_TYPE:
- *value = CHAN_TYPE;
- return;
- case OSMESA_ROW_LENGTH:
- *value = osmesa->userRowLength;
- return;
- case OSMESA_Y_UP:
- *value = osmesa->yup;
- return;
- case OSMESA_MAX_WIDTH:
- *value = MAX_WIDTH;
- return;
- case OSMESA_MAX_HEIGHT:
- *value = MAX_HEIGHT;
- return;
- default:
- _mesa_error(&osmesa->mesa, GL_INVALID_ENUM, "OSMesaGetIntergerv(pname)");
- return;
- }
-}
-
-/*
- * Return the depth buffer associated with an OSMesa context.
- * Input: c - the OSMesa context
- * Output: width, height - size of buffer in pixels
- * bytesPerValue - bytes per depth value (2 or 4)
- * buffer - pointer to depth buffer values
- * Return: GL_TRUE or GL_FALSE to indicate success or failure.
- */
-GLAPI GLboolean GLAPIENTRY
-OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
- GLint *bytesPerValue, void **buffer )
-{
- struct gl_renderbuffer *rb = NULL;
-
- if (c->gl_buffer)
- rb = c->gl_buffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-
- if (!rb || !rb->Data) {
- /*if ((!c->gl_buffer) || (!c->gl_buffer->DepthBuffer)) {*/
- *width = 0;
- *height = 0;
- *bytesPerValue = 0;
- *buffer = 0;
- return GL_FALSE;
- }
- else {
- *width = c->gl_buffer->Width;
- *height = c->gl_buffer->Height;
- if (c->gl_visual->depthBits <= 16)
- *bytesPerValue = sizeof(GLushort);
- else
- *bytesPerValue = sizeof(GLuint);
- *buffer = rb->Data;
- return GL_TRUE;
- }
-}
-
-/*
- * Return the color buffer associated with an OSMesa context.
- * Input: c - the OSMesa context
- * Output: width, height - size of buffer in pixels
- * format - the pixel format (OSMESA_FORMAT)
- * buffer - pointer to color buffer values
- * Return: GL_TRUE or GL_FALSE to indicate success or failure.
- */
-GLAPI GLboolean GLAPIENTRY
-OSMesaGetColorBuffer( OSMesaContext c, GLint *width,
- GLint *height, GLint *format, void **buffer )
-{
- if (!c->buffer) {
- *width = 0;
- *height = 0;
- *format = 0;
- *buffer = 0;
- return GL_FALSE;
- }
- else {
- *width = c->width;
- *height = c->height;
- *format = c->format;
- *buffer = c->buffer;
- return GL_TRUE;
- }
-}
-
-
-struct name_function
-{
- const char *Name;
- OSMESAproc Function;
-};
-
-static struct name_function functions[] = {
- { "OSMesaCreateContext", (OSMESAproc) OSMesaCreateContext },
- { "OSMesaCreateContextExt", (OSMESAproc) OSMesaCreateContextExt },
- { "OSMesaDestroyContext", (OSMESAproc) OSMesaDestroyContext },
- { "OSMesaMakeCurrent", (OSMESAproc) OSMesaMakeCurrent },
- { "OSMesaGetCurrentContext", (OSMESAproc) OSMesaGetCurrentContext },
- { "OSMesaPixelsStore", (OSMESAproc) OSMesaPixelStore },
- { "OSMesaGetIntegerv", (OSMESAproc) OSMesaGetIntegerv },
- { "OSMesaGetDepthBuffer", (OSMESAproc) OSMesaGetDepthBuffer },
- { "OSMesaGetColorBuffer", (OSMESAproc) OSMesaGetColorBuffer },
- { "OSMesaGetProcAddress", (OSMESAproc) OSMesaGetProcAddress },
- { NULL, NULL }
-};
-
-
-GLAPI OSMESAproc GLAPIENTRY
-OSMesaGetProcAddress( const char *funcName )
-{
- int i;
- for (i = 0; functions[i].Name; i++) {
- if (_mesa_strcmp(functions[i].Name, funcName) == 0)
- return functions[i].Function;
- }
- return _glapi_get_proc_address(funcName);
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.def b/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.def
deleted file mode 100644
index a92a30f35..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/osmesa/osmesa.def
+++ /dev/null
@@ -1,13 +0,0 @@
-DESCRIPTION 'Mesa OSMesa lib for Win32'
-VERSION 4.1
-
-EXPORTS
- OSMesaCreateContext
- OSMesaCreateContextExt
- OSMesaDestroyContext
- OSMesaMakeCurrent
- OSMesaGetCurrentContext
- OSMesaPixelStore
- OSMesaGetIntegerv
- OSMesaGetDepthBuffer
- OSMesaGetColorBuffer
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/descrip.mms b/nx-X11/extras/Mesa/src/mesa/drivers/x11/descrip.mms
deleted file mode 100644
index 69d14e36c..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/descrip.mms
+++ /dev/null
@@ -1,51 +0,0 @@
-# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 16 June 2003
-
-.first
- define gl [----.include.gl]
- define math [--.math]
- define tnl [--.tnl]
- define swrast [--.swrast]
- define swrast_setup [--.swrast_setup]
- define array_cache [--.array_cache]
- define drivers [-]
-
-.include [----]mms-config.
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = [----.include],[--.main],[--.glapi]
-LIBDIR = [----.lib]
-CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)
-
-SOURCES = fakeglx.c glxapi.c xfonts.c xm_api.c xm_dd.c xm_line.c xm_span.c\
- xm_tri.c xm_buffer.c
-
-OBJECTS =fakeglx.obj,glxapi.obj,xfonts.obj,xm_api.obj,xm_dd.obj,xm_line.obj,\
- xm_span.obj,xm_tri.obj,xm_buffer.obj
-
-##### RULES #####
-
-VERSION=Mesa V3.4
-
-##### TARGETS #####
-# Make the library
-$(LIBDIR)$(GL_LIB) : $(OBJECTS)
- @ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
-
-clean :
- purge
- delete *.obj;*
-
-fakeglx.obj : fakeglx.c
-glxapi.obj : glxapi.c
-xfonts.obj : xfonts.c
-xm_api.obj : xm_api.c
-xm_buffer.obj : xm_buffer.c
-xm_dd.obj : xm_dd.c
-xm_line.obj : xm_line.c
-xm_span.obj : xm_span.c
-xm_tri.obj : xm_tri.c
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/fakeglx.c b/nx-X11/extras/Mesa/src/mesa/drivers/x11/fakeglx.c
deleted file mode 100644
index d3213e708..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/fakeglx.c
+++ /dev/null
@@ -1,2886 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.4
- *
- * 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.
- */
-
-
-/*
- * This is an emulation of the GLX API which allows Mesa/GLX-based programs
- * to run on X servers which do not have the real GLX extension.
- *
- * Thanks to the contributors:
- *
- * Initial version: Philip Brown (phil@bolthole.com)
- * Better glXGetConfig() support: Armin Liebchen (liebchen@asylum.cs.utah.edu)
- * Further visual-handling refinements: Wolfram Gloger
- * (wmglo@Dent.MED.Uni-Muenchen.DE).
- *
- * Notes:
- * Don't be fooled, stereo isn't supported yet.
- */
-
-
-
-#include "glxheader.h"
-#include "glxapi.h"
-#include "GL/xmesa.h"
-#include "context.h"
-#include "config.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "version.h"
-#include "xfonts.h"
-#include "xmesaP.h"
-
-#ifdef __VMS
-#define _mesa_sprintf sprintf
-#endif
-
-/* This indicates the client-side GLX API and GLX encoder version. */
-#define CLIENT_MAJOR_VERSION 1
-#define CLIENT_MINOR_VERSION 4 /* but don't have 1.3's pbuffers, etc yet */
-
-/* This indicates the server-side GLX decoder version.
- * GLX 1.4 indicates OpenGL 1.3 support
- */
-#define SERVER_MAJOR_VERSION 1
-#define SERVER_MINOR_VERSION 4
-
-/* This is appended onto the glXGetClient/ServerString version strings. */
-#define MESA_GLX_VERSION "Mesa " MESA_VERSION_STRING
-
-/* Who implemented this GLX? */
-#define VENDOR "Brian Paul"
-
-#define EXTENSIONS \
- "GLX_MESA_set_3dfx_mode " \
- "GLX_MESA_copy_sub_buffer " \
- "GLX_MESA_pixmap_colormap " \
- "GLX_MESA_release_buffers " \
- "GLX_ARB_get_proc_address " \
- "GLX_EXT_visual_info " \
- "GLX_EXT_visual_rating " \
- "GLX_SGI_video_sync " \
- "GLX_SGIX_fbconfig " \
- "GLX_SGIX_pbuffer "
-
-/*
- * Our fake GLX context will contain a "real" GLX context and an XMesa context.
- *
- * Note that a pointer to a __GLXcontext is a pointer to a fake_glx_context,
- * and vice versa.
- *
- * We really just need this structure in order to make the libGL functions
- * glXGetCurrentContext(), glXGetCurrentDrawable() and glXGetCurrentDisplay()
- * work correctly.
- */
-struct fake_glx_context {
- __GLXcontext glxContext; /* this MUST be first! */
- XMesaContext xmesaContext;
-};
-
-
-
-/**********************************************************************/
-/*** GLX Visual Code ***/
-/**********************************************************************/
-
-#define DONT_CARE -1
-
-
-static XMesaVisual *VisualTable = NULL;
-static int NumVisuals = 0;
-
-
-/*
- * This struct and some code fragments borrowed
- * from Mark Kilgard's GLUT library.
- */
-typedef struct _OverlayInfo {
- /* Avoid 64-bit portability problems by being careful to use
- longs due to the way XGetWindowProperty is specified. Note
- that these parameters are passed as CARD32s over X
- protocol. */
- unsigned long overlay_visual;
- long transparent_type;
- long value;
- long layer;
-} OverlayInfo;
-
-
-
-/* Macro to handle c_class vs class field name in XVisualInfo struct */
-#if defined(__cplusplus) || defined(c_plusplus)
-#define CLASS c_class
-#else
-#define CLASS class
-#endif
-
-
-
-/*
- * Test if the given XVisualInfo is usable for Mesa rendering.
- */
-static GLboolean
-is_usable_visual( XVisualInfo *vinfo )
-{
- switch (vinfo->CLASS) {
- case StaticGray:
- case GrayScale:
- /* Any StaticGray/GrayScale visual works in RGB or CI mode */
- 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;
- }
- case TrueColor:
- case DirectColor:
- /* Any depth of TrueColor or DirectColor works in RGB mode */
- return GL_TRUE;
- default:
- /* This should never happen */
- return GL_FALSE;
- }
-}
-
-
-
-/**
- * Get an array OverlayInfo records for specified screen.
- * \param dpy the display
- * \param screen screen number
- * \param numOverlays returns numver of OverlayInfo records
- * \return pointer to OverlayInfo array, free with XFree()
- */
-static OverlayInfo *
-GetOverlayInfo(Display *dpy, int screen, int *numOverlays)
-{
- Atom overlayVisualsAtom;
- Atom actualType;
- Status status;
- unsigned char *ovInfo;
- unsigned long sizeData, bytesLeft;
- int actualFormat;
-
- /*
- * The SERVER_OVERLAY_VISUALS property on the root window contains
- * a list of overlay visuals. Get that list now.
- */
- overlayVisualsAtom = XInternAtom(dpy,"SERVER_OVERLAY_VISUALS", True);
- if (overlayVisualsAtom == None) {
- return 0;
- }
-
- status = XGetWindowProperty(dpy, RootWindow(dpy, screen),
- overlayVisualsAtom, 0L, (long) 10000, False,
- overlayVisualsAtom, &actualType, &actualFormat,
- &sizeData, &bytesLeft,
- &ovInfo);
-
- if (status != Success || actualType != overlayVisualsAtom ||
- actualFormat != 32 || sizeData < 4) {
- /* something went wrong */
- XFree((void *) ovInfo);
- *numOverlays = 0;
- return NULL;
- }
-
- *numOverlays = sizeData / 4;
- return (OverlayInfo *) ovInfo;
-}
-
-
-
-/**
- * Return the level (overlay, normal, underlay) of a given XVisualInfo.
- * Input: dpy - the X display
- * vinfo - the XVisualInfo to test
- * Return: level of the visual:
- * 0 = normal planes
- * >0 = overlay planes
- * <0 = underlay planes
- */
-static int
-level_of_visual( Display *dpy, XVisualInfo *vinfo )
-{
- OverlayInfo *overlay_info;
- int numOverlaysPerScreen, i;
-
- overlay_info = GetOverlayInfo(dpy, vinfo->screen, &numOverlaysPerScreen);
- if (!overlay_info) {
- return 0;
- }
-
- /* search the overlay visual list for the visual ID of interest */
- for (i = 0; i < numOverlaysPerScreen; i++) {
- const OverlayInfo *ov = overlay_info + i;
- if (ov->overlay_visual == vinfo->visualid) {
- /* found the visual */
- if (/*ov->transparent_type==1 &&*/ ov->layer!=0) {
- int level = ov->layer;
- XFree((void *) overlay_info);
- return level;
- }
- else {
- XFree((void *) overlay_info);
- return 0;
- }
- }
- }
-
- /* The visual ID was not found in the overlay list. */
- XFree((void *) overlay_info);
- return 0;
-}
-
-
-
-
-/*
- * Given an XVisualInfo and RGB, Double, and Depth buffer flags, save the
- * configuration in our list of GLX visuals.
- */
-static XMesaVisual
-save_glx_visual( Display *dpy, XVisualInfo *vinfo,
- GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag,
- GLboolean stereoFlag,
- GLint depth_size, GLint stencil_size,
- GLint accumRedSize, GLint accumGreenSize,
- GLint accumBlueSize, GLint accumAlphaSize,
- GLint level, GLint numAuxBuffers )
-{
- GLboolean ximageFlag = GL_TRUE;
- XMesaVisual xmvis;
- GLint i;
- GLboolean comparePointers;
-
- if (dbFlag) {
- /* Check if the MESA_BACK_BUFFER env var is set */
- char *backbuffer = _mesa_getenv("MESA_BACK_BUFFER");
- if (backbuffer) {
- if (backbuffer[0]=='p' || backbuffer[0]=='P') {
- ximageFlag = GL_FALSE;
- }
- else if (backbuffer[0]=='x' || backbuffer[0]=='X') {
- ximageFlag = GL_TRUE;
- }
- else {
- _mesa_warning(NULL, "Mesa: invalid value for MESA_BACK_BUFFER environment variable, using an XImage.");
- }
- }
- }
-
- /* Comparing IDs uses less memory but sometimes fails. */
- /* XXX revisit this after 3.0 is finished. */
- if (_mesa_getenv("MESA_GLX_VISUAL_HACK"))
- comparePointers = GL_TRUE;
- else
- comparePointers = GL_FALSE;
-
- /* Force the visual to have an alpha channel */
- if (rgbFlag && _mesa_getenv("MESA_GLX_FORCE_ALPHA"))
- alphaFlag = GL_TRUE;
-
- /* First check if a matching visual is already in the list */
- for (i=0; i<NumVisuals; i++) {
- XMesaVisual v = VisualTable[i];
- if (v->display == dpy
- && 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
- && (v->mesa_visual.depthBits >= depth_size || depth_size == 0)
- && (v->mesa_visual.stencilBits >= stencil_size || stencil_size == 0)
- && (v->mesa_visual.accumRedBits >= accumRedSize || accumRedSize == 0)
- && (v->mesa_visual.accumGreenBits >= accumGreenSize || accumGreenSize == 0)
- && (v->mesa_visual.accumBlueBits >= accumBlueSize || accumBlueSize == 0)
- && (v->mesa_visual.accumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) {
- /* now either compare XVisualInfo pointers or visual IDs */
- if ((!comparePointers && v->visinfo->visualid == vinfo->visualid)
- || (comparePointers && v->vishandle == vinfo)) {
- return v;
- }
- }
- }
-
- /* Create a new visual and add it to the list. */
-
- xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag,
- stereoFlag, ximageFlag,
- depth_size, stencil_size,
- accumRedSize, accumBlueSize,
- accumBlueSize, accumAlphaSize, 0, level,
- GLX_NONE_EXT );
- if (xmvis) {
- /* Save a copy of the pointer now so we can find this visual again
- * if we need to search for it in find_glx_visual().
- */
- xmvis->vishandle = vinfo;
- /* Allocate more space for additional visual */
- VisualTable = _mesa_realloc( VisualTable,
- sizeof(XMesaVisual) * NumVisuals,
- sizeof(XMesaVisual) * (NumVisuals + 1));
- /* add xmvis to the list */
- VisualTable[NumVisuals] = xmvis;
- NumVisuals++;
- /* XXX minor hack, because XMesaCreateVisual doesn't support an
- * aux buffers parameter.
- */
- xmvis->mesa_visual.numAuxBuffers = numAuxBuffers;
- }
- return xmvis;
-}
-
-
-/**
- * Return the default number of bits for the Z buffer.
- * If defined, use the MESA_GLX_DEPTH_BITS env var value.
- * Otherwise, use the DEFAULT_SOFTWARE_DEPTH_BITS constant.
- * XXX probably do the same thing for stencil, accum, etc.
- */
-static GLint
-default_depth_bits(void)
-{
- int zBits;
- const char *zEnv = _mesa_getenv("MESA_GLX_DEPTH_BITS");
- if (zEnv)
- zBits = _mesa_atoi(zEnv);
- else
- zBits = DEFAULT_SOFTWARE_DEPTH_BITS;
- return zBits;
-}
-
-
-
-/*
- * Create a GLX visual from a regular XVisualInfo.
- * This is called when Fake GLX is given an XVisualInfo which wasn't
- * returned by glXChooseVisual. Since this is the first time we're
- * considering this visual we'll take a guess at reasonable values
- * for depth buffer size, stencil size, accum size, etc.
- * This is the best we can do with a client-side emulation of GLX.
- */
-static XMesaVisual
-create_glx_visual( Display *dpy, XVisualInfo *visinfo )
-{
- int vislevel;
- GLint zBits = default_depth_bits();
-
- 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 */
- );
- }
- 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 */
- GL_FALSE, /* alpha */
- GL_TRUE, /* double */
- GL_FALSE, /* stereo */
- zBits,
- STENCIL_BITS,
- ACCUM_BITS, /* r */
- ACCUM_BITS, /* g */
- ACCUM_BITS, /* b */
- ACCUM_BITS, /* a */
- 0, /* level */
- 0 /* numAux */
- );
- }
- }
- else {
- _mesa_warning(NULL, "Mesa: error in glXCreateContext: bad visual\n");
- return NULL;
- }
-}
-
-
-
-/*
- * Find the GLX visual associated with an XVisualInfo.
- */
-static XMesaVisual
-find_glx_visual( Display *dpy, XVisualInfo *vinfo )
-{
- int i;
-
- /* try to match visual id */
- for (i=0;i<NumVisuals;i++) {
- if (VisualTable[i]->display==dpy
- && VisualTable[i]->visinfo->visualid == vinfo->visualid) {
- return VisualTable[i];
- }
- }
-
- /* if that fails, try to match pointers */
- for (i=0;i<NumVisuals;i++) {
- if (VisualTable[i]->display==dpy && VisualTable[i]->vishandle==vinfo) {
- return VisualTable[i];
- }
- }
-
- return NULL;
-}
-
-
-
-/**
- * Return the transparent pixel value for a GLX visual.
- * Input: glxvis - the glx_visual
- * Return: a pixel value or -1 if no transparent pixel
- */
-static int
-transparent_pixel( XMesaVisual glxvis )
-{
- Display *dpy = glxvis->display;
- XVisualInfo *vinfo = glxvis->visinfo;
- OverlayInfo *overlay_info;
- int numOverlaysPerScreen, i;
-
- overlay_info = GetOverlayInfo(dpy, vinfo->screen, &numOverlaysPerScreen);
- if (!overlay_info) {
- return -1;
- }
-
- for (i = 0; i < numOverlaysPerScreen; i++) {
- const OverlayInfo *ov = overlay_info + i;
- if (ov->overlay_visual == vinfo->visualid) {
- /* found it! */
- if (ov->transparent_type == 0) {
- /* type 0 indicates no transparency */
- XFree((void *) overlay_info);
- return -1;
- }
- else {
- /* ov->value is the transparent pixel */
- XFree((void *) overlay_info);
- return ov->value;
- }
- }
- }
-
- /* The visual ID was not found in the overlay list. */
- XFree((void *) overlay_info);
- return -1;
-}
-
-
-
-/**
- * Try to get an X visual which matches the given arguments.
- */
-static XVisualInfo *
-get_visual( Display *dpy, int scr, unsigned int depth, int xclass )
-{
- XVisualInfo temp, *vis;
- long mask;
- int n;
- unsigned int default_depth;
- int default_class;
-
- mask = VisualScreenMask | VisualDepthMask | VisualClassMask;
- temp.screen = scr;
- temp.depth = depth;
- temp.CLASS = xclass;
-
- default_depth = DefaultDepth(dpy,scr);
- default_class = DefaultVisual(dpy,scr)->CLASS;
-
- if (depth==default_depth && xclass==default_class) {
- /* try to get root window's visual */
- temp.visualid = DefaultVisual(dpy,scr)->visualid;
- mask |= VisualIDMask;
- }
-
- vis = XGetVisualInfo( dpy, mask, &temp, &n );
-
- /* In case bits/pixel > 24, make sure color channels are still <=8 bits.
- * An SGI Infinite Reality system, for example, can have 30bpp pixels:
- * 10 bits per color channel. Mesa's limited to a max of 8 bits/channel.
- */
- if (vis && depth > 24 && (xclass==TrueColor || xclass==DirectColor)) {
- if (_mesa_bitcount((GLuint) vis->red_mask ) <= 8 &&
- _mesa_bitcount((GLuint) vis->green_mask) <= 8 &&
- _mesa_bitcount((GLuint) vis->blue_mask ) <= 8) {
- return vis;
- }
- else {
- XFree((void *) vis);
- return NULL;
- }
- }
-
- return vis;
-}
-
-
-
-/*
- * Retrieve the value of the given environment variable and find
- * the X visual which matches it.
- * Input: dpy - the display
- * screen - the screen number
- * varname - the name of the environment variable
- * Return: an XVisualInfo pointer to NULL if error.
- */
-static XVisualInfo *
-get_env_visual(Display *dpy, int scr, const char *varname)
-{
- char value[100], type[100];
- int depth, xclass = -1;
- XVisualInfo *vis;
-
- if (!_mesa_getenv( varname )) {
- return NULL;
- }
-
- _mesa_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 (xclass>-1 && depth>0) {
- vis = get_visual( dpy, scr, depth, xclass );
- if (vis) {
- return vis;
- }
- }
-
- _mesa_warning(NULL, "GLX unable to find visual class=%s, depth=%d.",
- type, depth);
-
- return NULL;
-}
-
-
-
-/*
- * 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 )
-{
- 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;
- }
- }
- }
- }
- }
- 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;
- }
- /* 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;
- }
- }
- }
- }
- 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;
- }
- }
- }
- }
-
- /* didn't find a visual */
- return NULL;
-}
-
-
-
-/*
- * Find the deepest X over/underlay visual of at least min_depth.
- * Input: dpy, screen - X display and screen number
- * level - the over/underlay level
- * trans_type - transparent pixel type: GLX_NONE_EXT,
- * GLX_TRANSPARENT_RGB_EXT, GLX_TRANSPARENT_INDEX_EXT,
- * or DONT_CARE
- * trans_value - transparent pixel value or DONT_CARE
- * 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_overlay_visual( Display *dpy, int scr, GLboolean rgbFlag,
- int level, int trans_type, int trans_value,
- int min_depth, int preferred_class )
-{
- OverlayInfo *overlay_info;
- int numOverlaysPerScreen;
- int i;
- XVisualInfo *deepvis;
- int deepest;
-
- /*DEBUG int tt, tv; */
-
- switch (preferred_class) {
- case GLX_TRUE_COLOR_EXT: preferred_class = TrueColor; break;
- case GLX_DIRECT_COLOR_EXT: preferred_class = DirectColor; break;
- case GLX_PSEUDO_COLOR_EXT: preferred_class = PseudoColor; break;
- case GLX_STATIC_COLOR_EXT: preferred_class = StaticColor; break;
- case GLX_GRAY_SCALE_EXT: preferred_class = GrayScale; break;
- case GLX_STATIC_GRAY_EXT: preferred_class = StaticGray; break;
- default: preferred_class = DONT_CARE;
- }
-
- overlay_info = GetOverlayInfo(dpy, scr, &numOverlaysPerScreen);
- if (!overlay_info) {
- return NULL;
- }
-
- /* Search for the deepest overlay which satisifies all criteria. */
- deepest = min_depth;
- deepvis = NULL;
-
- for (i = 0; i < numOverlaysPerScreen; i++) {
- const OverlayInfo *ov = overlay_info + i;
- XVisualInfo *vislist, vistemplate;
- int count;
-
- if (ov->layer!=level) {
- /* failed overlay level criteria */
- continue;
- }
- if (!(trans_type==DONT_CARE
- || (trans_type==GLX_TRANSPARENT_INDEX_EXT
- && ov->transparent_type>0)
- || (trans_type==GLX_NONE_EXT && ov->transparent_type==0))) {
- /* failed transparent pixel type criteria */
- continue;
- }
- if (trans_value!=DONT_CARE && trans_value!=ov->value) {
- /* failed transparent pixel value criteria */
- continue;
- }
-
- /* get XVisualInfo and check the depth */
- vistemplate.visualid = ov->overlay_visual;
- vistemplate.screen = scr;
- vislist = XGetVisualInfo( dpy, VisualIDMask | VisualScreenMask,
- &vistemplate, &count );
-
- if (count!=1) {
- /* something went wrong */
- continue;
- }
- if (preferred_class!=DONT_CARE && preferred_class!=vislist->CLASS) {
- /* wrong visual class */
- 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))
- continue;
-
- if (deepvis==NULL || vislist->depth > deepest) {
- /* YES! found a satisfactory visual */
- if (deepvis) {
- XFree( deepvis );
- }
- deepest = vislist->depth;
- deepvis = vislist;
- /* DEBUG tt = ov->transparent_type;*/
- /* DEBUG tv = ov->value; */
- }
- }
-
-/*DEBUG
- if (deepvis) {
- printf("chose 0x%x: layer=%d depth=%d trans_type=%d trans_value=%d\n",
- deepvis->visualid, level, deepvis->depth, tt, tv );
- }
-*/
- return deepvis;
-}
-
-
-/**********************************************************************/
-/*** Begin Fake GLX API Functions ***/
-/**********************************************************************/
-
-
-/**
- * Helper used by glXChooseVisual and glXChooseFBConfig.
- * The fbConfig parameter must be GL_FALSE for the former and GL_TRUE for
- * the later.
- * In either case, the attribute list is terminated with the value 'None'.
- */
-static XMesaVisual
-choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
-{
- const GLboolean rgbModeDefault = fbConfig;
- const int *parselist;
- XVisualInfo *vis;
- int min_ci = 0;
- int min_red=0, min_green=0, min_blue=0;
- GLboolean rgb_flag = rgbModeDefault;
- GLboolean alpha_flag = GL_FALSE;
- GLboolean double_flag = GL_FALSE;
- GLboolean stereo_flag = GL_FALSE;
- GLint depth_size = 0;
- GLint stencil_size = 0;
- GLint accumRedSize = 0;
- GLint accumGreenSize = 0;
- GLint accumBlueSize = 0;
- GLint accumAlphaSize = 0;
- int level = 0;
- int visual_type = DONT_CARE;
- int trans_type = DONT_CARE;
- int trans_value = DONT_CARE;
- GLint caveat = DONT_CARE;
- XMesaVisual xmvis = NULL;
- int desiredVisualID = -1;
- int numAux = 0;
-
- parselist = list;
-
- while (*parselist) {
-
- switch (*parselist) {
- case GLX_USE_GL:
- if (fbConfig) {
- /* invalid token */
- return NULL;
- }
- else {
- /* skip */
- parselist++;
- }
- break;
- case GLX_BUFFER_SIZE:
- parselist++;
- min_ci = *parselist++;
- break;
- case GLX_LEVEL:
- parselist++;
- level = *parselist++;
- break;
- case GLX_RGBA:
- if (fbConfig) {
- /* invalid token */
- return NULL;
- }
- else {
- rgb_flag = GL_TRUE;
- parselist++;
- }
- break;
- case GLX_DOUBLEBUFFER:
- parselist++;
- if (fbConfig) {
- double_flag = *parselist++;
- }
- else {
- double_flag = GL_TRUE;
- }
- break;
- case GLX_STEREO:
- parselist++;
- if (fbConfig) {
- stereo_flag = *parselist++;
- }
- else {
- stereo_flag = GL_TRUE;
- }
- return NULL; /* stereo not supported */
- case GLX_AUX_BUFFERS:
- parselist++;
- numAux = *parselist++;
- if (numAux > MAX_AUX_BUFFERS)
- return NULL;
- break;
- case GLX_RED_SIZE:
- parselist++;
- min_red = *parselist++;
- break;
- case GLX_GREEN_SIZE:
- parselist++;
- min_green = *parselist++;
- break;
- case GLX_BLUE_SIZE:
- parselist++;
- min_blue = *parselist++;
- break;
- case GLX_ALPHA_SIZE:
- parselist++;
- {
- GLint size = *parselist++;
- alpha_flag = size>0 ? 1 : 0;
- }
- break;
- case GLX_DEPTH_SIZE:
- parselist++;
- depth_size = *parselist++;
- break;
- case GLX_STENCIL_SIZE:
- parselist++;
- stencil_size = *parselist++;
- break;
- case GLX_ACCUM_RED_SIZE:
- parselist++;
- {
- GLint size = *parselist++;
- accumRedSize = MAX2( accumRedSize, size );
- }
- break;
- case GLX_ACCUM_GREEN_SIZE:
- parselist++;
- {
- GLint size = *parselist++;
- accumGreenSize = MAX2( accumGreenSize, size );
- }
- break;
- case GLX_ACCUM_BLUE_SIZE:
- parselist++;
- {
- GLint size = *parselist++;
- accumBlueSize = MAX2( accumBlueSize, size );
- }
- break;
- case GLX_ACCUM_ALPHA_SIZE:
- parselist++;
- {
- GLint size = *parselist++;
- accumAlphaSize = MAX2( accumAlphaSize, size );
- }
- break;
-
- /*
- * GLX_EXT_visual_info extension
- */
- case GLX_X_VISUAL_TYPE_EXT:
- parselist++;
- visual_type = *parselist++;
- break;
- case GLX_TRANSPARENT_TYPE_EXT:
- parselist++;
- trans_type = *parselist++;
- break;
- case GLX_TRANSPARENT_INDEX_VALUE_EXT:
- parselist++;
- trans_value = *parselist++;
- break;
- case GLX_TRANSPARENT_RED_VALUE_EXT:
- case GLX_TRANSPARENT_GREEN_VALUE_EXT:
- case GLX_TRANSPARENT_BLUE_VALUE_EXT:
- case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
- /* ignore */
- parselist++;
- parselist++;
- break;
-
- /*
- * GLX_EXT_visual_info extension
- */
- case GLX_VISUAL_CAVEAT_EXT:
- parselist++;
- caveat = *parselist++; /* ignored for now */
- break;
-
- /*
- * GLX_ARB_multisample
- */
- case GLX_SAMPLE_BUFFERS_ARB:
- /* ms not supported */
- return NULL;
- case GLX_SAMPLES_ARB:
- /* ms not supported */
- return NULL;
-
- /*
- * FBConfig attribs.
- */
- case GLX_RENDER_TYPE:
- if (!fbConfig)
- return NULL;
- parselist++;
- if (*parselist == GLX_RGBA_BIT) {
- rgb_flag = GL_TRUE;
- }
- else if (*parselist == GLX_COLOR_INDEX_BIT) {
- rgb_flag = GL_FALSE;
- }
- else if (*parselist == 0) {
- rgb_flag = GL_TRUE;
- }
- parselist++;
- break;
- case GLX_DRAWABLE_TYPE:
- if (!fbConfig)
- return NULL;
- parselist++;
- if (*parselist & ~(GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT)) {
- return NULL; /* bad bit */
- }
- parselist++;
- break;
- case GLX_FBCONFIG_ID:
- if (!fbConfig)
- return NULL;
- parselist++;
- desiredVisualID = *parselist++;
- break;
- case GLX_X_RENDERABLE:
- if (!fbConfig)
- return NULL;
- parselist += 2;
- /* ignore */
- break;
-
- case None:
- /* end of list */
- break;
-
- default:
- /* undefined attribute */
- _mesa_warning(NULL, "unexpected attrib 0x%x in choose_visual()",
- *parselist);
- return NULL;
- }
- }
-
- (void) caveat;
-
- /*
- * Since we're only simulating the GLX extension this function will never
- * find any real GL visuals. Instead, all we can do is try to find an RGB
- * or CI visual of appropriate depth. Other requested attributes such as
- * double buffering, depth buffer, etc. will be associated with the X
- * visual and stored in the VisualTable[].
- */
- if (desiredVisualID != -1) {
- /* try to get a specific visual, by visualID */
- XVisualInfo temp;
- int n;
- temp.visualid = desiredVisualID;
- temp.screen = screen;
- vis = XGetVisualInfo(dpy, VisualIDMask | VisualScreenMask, &temp, &n);
- if (vis) {
- /* give the visual some useful GLX attributes */
- double_flag = GL_TRUE;
- if (vis->depth > 8)
- rgb_flag = GL_TRUE;
- 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 );
- }
- else {
- /* color index overlay */
- vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
- trans_type, trans_value, min_ci, visual_type );
- }
- }
-
- if (vis) {
- /* Note: we're not exactly obeying the glXChooseVisual rules here.
- * When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the
- * largest depth buffer size, which is 32bits/value. Instead, we
- * return 16 to maintain performance with earlier versions of Mesa.
- */
- if (depth_size > 24)
- depth_size = 31; /* 32 causes int overflow problems */
- else if (depth_size > 16)
- depth_size = 24;
- else if (depth_size > 0) {
- depth_size = default_depth_bits();
- }
-
- /* we only support one size of stencil and accum buffers. */
- if (stencil_size > 0)
- stencil_size = STENCIL_BITS;
- if (accumRedSize > 0 || accumGreenSize > 0 || accumBlueSize > 0 ||
- accumAlphaSize > 0) {
- accumRedSize = ACCUM_BITS;
- accumGreenSize = ACCUM_BITS;
- accumBlueSize = ACCUM_BITS;
- accumAlphaSize = alpha_flag ? ACCUM_BITS : 0;
- }
-
- xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag,
- stereo_flag, depth_size, stencil_size,
- accumRedSize, accumGreenSize,
- accumBlueSize, accumAlphaSize, level, numAux );
- }
-
- return xmvis;
-}
-
-
-static XVisualInfo *
-Fake_glXChooseVisual( Display *dpy, int screen, int *list )
-{
- XMesaVisual xmvis = choose_visual(dpy, screen, list, GL_FALSE);
- if (xmvis) {
-#if 0
- return xmvis->vishandle;
-#else
- /* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
- if (xmvis->vishandle) {
- _mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
- }
- return xmvis->vishandle;
-#endif
- }
- else
- return NULL;
-}
-
-
-static GLXContext
-Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
- GLXContext share_list, Bool direct )
-{
- XMesaVisual xmvis;
- struct fake_glx_context *glxCtx;
- struct fake_glx_context *shareCtx = (struct fake_glx_context *) share_list;
-
- if (!dpy || !visinfo)
- return 0;
-
- glxCtx = CALLOC_STRUCT(fake_glx_context);
- if (!glxCtx)
- return 0;
-
- /* deallocate unused windows/buffers */
- XMesaGarbageCollect();
-
- xmvis = find_glx_visual( dpy, visinfo );
- if (!xmvis) {
- /* This visual wasn't found with glXChooseVisual() */
- xmvis = create_glx_visual( dpy, visinfo );
- if (!xmvis) {
- /* unusable visual */
- FREE(glxCtx);
- return NULL;
- }
- }
-
- glxCtx->xmesaContext = XMesaCreateContext(xmvis,
- shareCtx ? shareCtx->xmesaContext : NULL);
- if (!glxCtx->xmesaContext) {
- FREE(glxCtx);
- return NULL;
- }
-
- glxCtx->xmesaContext->direct = GL_FALSE;
- glxCtx->glxContext.isDirect = GL_FALSE;
- glxCtx->glxContext.currentDpy = dpy;
- glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */
-
- assert((void *) glxCtx == (void *) &(glxCtx->glxContext));
-
- return (GLXContext) glxCtx;
-}
-
-
-/* XXX these may have to be removed due to thread-safety issues. */
-static GLXContext MakeCurrent_PrevContext = 0;
-static GLXDrawable MakeCurrent_PrevDrawable = 0;
-static GLXDrawable MakeCurrent_PrevReadable = 0;
-static XMesaBuffer MakeCurrent_PrevDrawBuffer = 0;
-static XMesaBuffer MakeCurrent_PrevReadBuffer = 0;
-
-
-/* GLX 1.3 and later */
-static Bool
-Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
- GLXDrawable read, GLXContext ctx )
-{
- struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
-
- if (ctx && draw && read) {
- XMesaBuffer drawBuffer, readBuffer;
- XMesaContext xmctx = glxCtx->xmesaContext;
-
- /* Find the XMesaBuffer which corresponds to the GLXDrawable 'draw' */
- if (ctx == MakeCurrent_PrevContext
- && draw == MakeCurrent_PrevDrawable) {
- drawBuffer = MakeCurrent_PrevDrawBuffer;
- }
- else {
- drawBuffer = XMesaFindBuffer( dpy, draw );
- }
- if (!drawBuffer) {
- /* drawable must be a new window! */
- drawBuffer = XMesaCreateWindowBuffer2( xmctx->xm_visual, draw, xmctx);
- if (!drawBuffer) {
- /* Out of memory, or context/drawable depth mismatch */
- return False;
- }
- }
-
- /* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */
- if (ctx == MakeCurrent_PrevContext
- && read == MakeCurrent_PrevReadable) {
- readBuffer = MakeCurrent_PrevReadBuffer;
- }
- else {
- readBuffer = XMesaFindBuffer( dpy, read );
- }
- if (!readBuffer) {
- /* drawable must be a new window! */
- readBuffer = XMesaCreateWindowBuffer2(glxCtx->xmesaContext->xm_visual,
- read, xmctx);
- if (!readBuffer) {
- /* Out of memory, or context/drawable depth mismatch */
- return False;
- }
- }
-
- MakeCurrent_PrevContext = ctx;
- MakeCurrent_PrevDrawable = draw;
- MakeCurrent_PrevReadable = read;
- MakeCurrent_PrevDrawBuffer = drawBuffer;
- MakeCurrent_PrevReadBuffer = readBuffer;
-
- /* Now make current! */
- if (XMesaMakeCurrent2(xmctx, drawBuffer, readBuffer)) {
- ((__GLXcontext *) ctx)->currentDpy = dpy;
- ((__GLXcontext *) ctx)->currentDrawable = draw;
- ((__GLXcontext *) ctx)->currentReadable = read;
- return True;
- }
- else {
- return False;
- }
- }
- else if (!ctx && !draw && !read) {
- /* release current context w/out assigning new one. */
- XMesaMakeCurrent( NULL, NULL );
- MakeCurrent_PrevContext = 0;
- MakeCurrent_PrevDrawable = 0;
- MakeCurrent_PrevReadable = 0;
- MakeCurrent_PrevDrawBuffer = 0;
- MakeCurrent_PrevReadBuffer = 0;
- return True;
- }
- else {
- /* The args must either all be non-zero or all zero.
- * This is an error.
- */
- return False;
- }
-}
-
-
-static Bool
-Fake_glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx )
-{
- return Fake_glXMakeContextCurrent( dpy, drawable, drawable, ctx );
-}
-
-
-static GLXPixmap
-Fake_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo, Pixmap pixmap )
-{
- XMesaVisual v;
- XMesaBuffer b;
-
- v = find_glx_visual( dpy, visinfo );
- if (!v) {
- v = create_glx_visual( dpy, visinfo );
- if (!v) {
- /* unusable visual */
- return 0;
- }
- }
-
- b = XMesaCreatePixmapBuffer( v, pixmap, 0 );
- if (!b) {
- return 0;
- }
- return b->frontxrb->pixmap;
-}
-
-
-/*** GLX_MESA_pixmap_colormap ***/
-
-static GLXPixmap
-Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
- Pixmap pixmap, Colormap cmap )
-{
- XMesaVisual v;
- XMesaBuffer b;
-
- v = find_glx_visual( dpy, visinfo );
- if (!v) {
- v = create_glx_visual( dpy, visinfo );
- if (!v) {
- /* unusable visual */
- return 0;
- }
- }
-
- b = XMesaCreatePixmapBuffer( v, pixmap, cmap );
- if (!b) {
- return 0;
- }
- return b->frontxrb->pixmap;
-}
-
-
-static void
-Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
-{
- XMesaBuffer b = XMesaFindBuffer(dpy, pixmap);
- if (b) {
- XMesaDestroyBuffer(b);
- }
- else if (_mesa_getenv("MESA_DEBUG")) {
- _mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
- }
-}
-
-
-static void
-Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
- unsigned long mask )
-{
- struct fake_glx_context *fakeSrc = (struct fake_glx_context *) src;
- struct fake_glx_context *fakeDst = (struct fake_glx_context *) dst;
- XMesaContext xm_src = fakeSrc->xmesaContext;
- XMesaContext xm_dst = fakeDst->xmesaContext;
- (void) dpy;
- _mesa_copy_context( &(xm_src->mesa), &(xm_dst->mesa), (GLuint) mask );
-}
-
-
-static Bool
-Fake_glXQueryExtension( Display *dpy, int *errorb, int *event )
-{
- /* Mesa's GLX isn't really an X extension but we try to act like one. */
- (void) dpy;
- (void) errorb;
- (void) event;
- return True;
-}
-
-
-extern void _kw_ungrab_all( Display *dpy );
-void _kw_ungrab_all( Display *dpy )
-{
- XUngrabPointer( dpy, CurrentTime );
- XUngrabKeyboard( dpy, CurrentTime );
-}
-
-
-static void
-Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
-{
- struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
- (void) dpy;
- MakeCurrent_PrevContext = 0;
- MakeCurrent_PrevDrawable = 0;
- MakeCurrent_PrevReadable = 0;
- MakeCurrent_PrevDrawBuffer = 0;
- MakeCurrent_PrevReadBuffer = 0;
- XMesaDestroyContext( glxCtx->xmesaContext );
- XMesaGarbageCollect();
-}
-
-
-static Bool
-Fake_glXIsDirect( Display *dpy, GLXContext ctx )
-{
- struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
- (void) dpy;
- return glxCtx->xmesaContext->direct;
-}
-
-
-
-static void
-Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
-{
- XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
-
- if (buffer) {
- XMesaSwapBuffers(buffer);
- }
- else if (_mesa_getenv("MESA_DEBUG")) {
- _mesa_warning(NULL, "glXSwapBuffers: invalid drawable 0x%x\n",
- (int) drawable);
- }
-}
-
-
-
-/*** GLX_MESA_copy_sub_buffer ***/
-
-static void
-Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
- int x, int y, int width, int height )
-{
- XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
- if (buffer) {
- XMesaCopySubBuffer(buffer, x, y, width, height);
- }
- else if (_mesa_getenv("MESA_DEBUG")) {
- _mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
- }
-}
-
-
-static Bool
-Fake_glXQueryVersion( Display *dpy, int *maj, int *min )
-{
- (void) dpy;
- /* Return GLX version, not Mesa version */
- assert(CLIENT_MAJOR_VERSION == SERVER_MAJOR_VERSION);
- *maj = CLIENT_MAJOR_VERSION;
- *min = MIN2( CLIENT_MINOR_VERSION, SERVER_MINOR_VERSION );
- return True;
-}
-
-
-/*
- * Query the GLX attributes of the given XVisualInfo.
- */
-static int
-get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
-{
- ASSERT(xmvis);
- switch(attrib) {
- case GLX_USE_GL:
- if (fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = (int) True;
- return 0;
- case GLX_BUFFER_SIZE:
- *value = xmvis->visinfo->depth;
- return 0;
- case GLX_LEVEL:
- *value = xmvis->mesa_visual.level;
- return 0;
- case GLX_RGBA:
- if (fbconfig)
- return GLX_BAD_ATTRIBUTE;
- if (xmvis->mesa_visual.rgbMode) {
- *value = True;
- }
- else {
- *value = False;
- }
- return 0;
- case GLX_DOUBLEBUFFER:
- *value = (int) xmvis->mesa_visual.doubleBufferMode;
- return 0;
- case GLX_STEREO:
- *value = (int) xmvis->mesa_visual.stereoMode;
- return 0;
- case GLX_AUX_BUFFERS:
- *value = xmvis->mesa_visual.numAuxBuffers;
- return 0;
- case GLX_RED_SIZE:
- *value = xmvis->mesa_visual.redBits;
- return 0;
- case GLX_GREEN_SIZE:
- *value = xmvis->mesa_visual.greenBits;
- return 0;
- case GLX_BLUE_SIZE:
- *value = xmvis->mesa_visual.blueBits;
- return 0;
- case GLX_ALPHA_SIZE:
- *value = xmvis->mesa_visual.alphaBits;
- return 0;
- case GLX_DEPTH_SIZE:
- *value = xmvis->mesa_visual.depthBits;
- return 0;
- case GLX_STENCIL_SIZE:
- *value = xmvis->mesa_visual.stencilBits;
- return 0;
- case GLX_ACCUM_RED_SIZE:
- *value = xmvis->mesa_visual.accumRedBits;
- return 0;
- case GLX_ACCUM_GREEN_SIZE:
- *value = xmvis->mesa_visual.accumGreenBits;
- return 0;
- case GLX_ACCUM_BLUE_SIZE:
- *value = xmvis->mesa_visual.accumBlueBits;
- return 0;
- case GLX_ACCUM_ALPHA_SIZE:
- *value = xmvis->mesa_visual.accumAlphaBits;
- return 0;
-
- /*
- * GLX_EXT_visual_info extension
- */
- case GLX_X_VISUAL_TYPE_EXT:
- switch (xmvis->visinfo->CLASS) {
- case StaticGray: *value = GLX_STATIC_GRAY_EXT; return 0;
- case GrayScale: *value = GLX_GRAY_SCALE_EXT; return 0;
- case StaticColor: *value = GLX_STATIC_GRAY_EXT; return 0;
- case PseudoColor: *value = GLX_PSEUDO_COLOR_EXT; return 0;
- case TrueColor: *value = GLX_TRUE_COLOR_EXT; return 0;
- case DirectColor: *value = GLX_DIRECT_COLOR_EXT; return 0;
- }
- return 0;
- case GLX_TRANSPARENT_TYPE_EXT:
- if (xmvis->mesa_visual.level==0) {
- /* normal planes */
- *value = GLX_NONE_EXT;
- }
- else if (xmvis->mesa_visual.level>0) {
- /* overlay */
- if (xmvis->mesa_visual.rgbMode) {
- *value = GLX_TRANSPARENT_RGB_EXT;
- }
- else {
- *value = GLX_TRANSPARENT_INDEX_EXT;
- }
- }
- else if (xmvis->mesa_visual.level<0) {
- /* underlay */
- *value = GLX_NONE_EXT;
- }
- return 0;
- case GLX_TRANSPARENT_INDEX_VALUE_EXT:
- {
- int pixel = transparent_pixel( xmvis );
- if (pixel>=0) {
- *value = pixel;
- }
- /* else undefined */
- }
- return 0;
- case GLX_TRANSPARENT_RED_VALUE_EXT:
- /* undefined */
- return 0;
- case GLX_TRANSPARENT_GREEN_VALUE_EXT:
- /* undefined */
- return 0;
- case GLX_TRANSPARENT_BLUE_VALUE_EXT:
- /* undefined */
- return 0;
- case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
- /* undefined */
- return 0;
-
- /*
- * GLX_EXT_visual_info extension
- */
- case GLX_VISUAL_CAVEAT_EXT:
- /* test for zero, just in case */
- if (xmvis->mesa_visual.visualRating > 0)
- *value = xmvis->mesa_visual.visualRating;
- else
- *value = GLX_NONE_EXT;
- return 0;
-
- /*
- * GLX_ARB_multisample
- */
- case GLX_SAMPLE_BUFFERS_ARB:
- *value = 0;
- return 0;
- case GLX_SAMPLES_ARB:
- *value = 0;
- return 0;
-
- /*
- * For FBConfigs:
- */
- case GLX_SCREEN_EXT:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = xmvis->visinfo->screen;
- break;
- case GLX_DRAWABLE_TYPE: /*SGIX too */
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
- break;
- case GLX_RENDER_TYPE_SGIX:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- if (xmvis->mesa_visual.rgbMode)
- *value = GLX_RGBA_BIT;
- else
- *value = GLX_COLOR_INDEX_BIT;
- break;
- case GLX_X_RENDERABLE_SGIX:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = True; /* XXX really? */
- break;
- case GLX_FBCONFIG_ID_SGIX:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = xmvis->visinfo->visualid;
- break;
- case GLX_MAX_PBUFFER_WIDTH:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- /* XXX or MAX_WIDTH? */
- *value = DisplayWidth(xmvis->display, xmvis->visinfo->screen);
- break;
- case GLX_MAX_PBUFFER_HEIGHT:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = DisplayHeight(xmvis->display, xmvis->visinfo->screen);
- break;
- case GLX_MAX_PBUFFER_PIXELS:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = DisplayWidth(xmvis->display, xmvis->visinfo->screen) *
- DisplayHeight(xmvis->display, xmvis->visinfo->screen);
- break;
- case GLX_VISUAL_ID:
- if (!fbconfig)
- return GLX_BAD_ATTRIBUTE;
- *value = xmvis->visinfo->visualid;
- break;
-
- default:
- return GLX_BAD_ATTRIBUTE;
- }
- return Success;
-}
-
-
-static int
-Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
- int attrib, int *value )
-{
- XMesaVisual xmvis;
- int k;
- if (!dpy || !visinfo)
- return GLX_BAD_ATTRIBUTE;
-
- xmvis = find_glx_visual( dpy, visinfo );
- if (!xmvis) {
- /* this visual wasn't obtained with glXChooseVisual */
- xmvis = create_glx_visual( dpy, visinfo );
- if (!xmvis) {
- /* this visual can't be used for GL rendering */
- if (attrib==GLX_USE_GL) {
- *value = (int) False;
- return 0;
- }
- else {
- return GLX_BAD_VISUAL;
- }
- }
- }
-
- k = get_config(xmvis, attrib, value, GL_FALSE);
- return k;
-}
-
-
-static void
-Fake_glXWaitGL( void )
-{
- XMesaContext xmesa = XMesaGetCurrentContext();
- XMesaFlush( xmesa );
-}
-
-
-
-static void
-Fake_glXWaitX( void )
-{
- XMesaContext xmesa = XMesaGetCurrentContext();
- XMesaFlush( xmesa );
-}
-
-
-static const char *
-get_extensions( void )
-{
-#ifdef FX
- const char *fx = _mesa_getenv("MESA_GLX_FX");
- if (fx && fx[0] != 'd') {
- return EXTENSIONS;
- }
-#endif
- return EXTENSIONS + 23; /* skip "GLX_MESA_set_3dfx_mode" */
-}
-
-
-
-/* GLX 1.1 and later */
-static const char *
-Fake_glXQueryExtensionsString( Display *dpy, int screen )
-{
- (void) dpy;
- (void) screen;
- return get_extensions();
-}
-
-
-
-/* GLX 1.1 and later */
-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);
-
- (void) dpy;
- (void) screen;
-
- switch (name) {
- case GLX_EXTENSIONS:
- return get_extensions();
- case GLX_VENDOR:
- return VENDOR;
- case GLX_VERSION:
- return version;
- default:
- return NULL;
- }
-}
-
-
-
-/* GLX 1.1 and later */
-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);
-
- (void) dpy;
-
- switch (name) {
- case GLX_EXTENSIONS:
- return get_extensions();
- case GLX_VENDOR:
- return VENDOR;
- case GLX_VERSION:
- return version;
- default:
- return NULL;
- }
-}
-
-
-
-/*
- * GLX 1.3 and later
- */
-
-
-static int
-Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
- int attribute, int *value )
-{
- XMesaVisual v = (XMesaVisual) config;
- (void) dpy;
- (void) config;
-
- if (!dpy || !config || !value)
- return -1;
-
- return get_config(v, attribute, value, GL_TRUE);
-}
-
-
-static GLXFBConfig *
-Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements )
-{
- XVisualInfo *visuals, visTemplate;
- const long visMask = VisualScreenMask;
- int i;
-
- /* Get list of all X visuals */
- visTemplate.screen = screen;
- visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
- if (*nelements > 0) {
- XMesaVisual *results;
- results = (XMesaVisual *) _mesa_malloc(*nelements * sizeof(XMesaVisual));
- if (!results) {
- *nelements = 0;
- return NULL;
- }
- for (i = 0; i < *nelements; i++) {
- results[i] = create_glx_visual(dpy, visuals + i);
- }
- return (GLXFBConfig *) results;
- }
- return NULL;
-}
-
-
-static GLXFBConfig *
-Fake_glXChooseFBConfig( Display *dpy, int screen,
- const int *attribList, int *nitems )
-{
- XMesaVisual xmvis;
-
- if (!attribList || !attribList[0]) {
- /* return list of all configs (per GLX_SGIX_fbconfig spec) */
- return Fake_glXGetFBConfigs(dpy, screen, nitems);
- }
-
- xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
- if (xmvis) {
- GLXFBConfig *config = (GLXFBConfig *) _mesa_malloc(sizeof(XMesaVisual));
- if (!config) {
- *nitems = 0;
- return NULL;
- }
- *nitems = 1;
- config[0] = (GLXFBConfig) xmvis;
- return (GLXFBConfig *) config;
- }
- else {
- *nitems = 0;
- return NULL;
- }
-}
-
-
-static XVisualInfo *
-Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
-{
- if (dpy && config) {
- XMesaVisual xmvis = (XMesaVisual) config;
-#if 0
- return xmvis->vishandle;
-#else
- /* create a new vishandle - the cached one may be stale */
- xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
- if (xmvis->vishandle) {
- _mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
- }
- return xmvis->vishandle;
-#endif
- }
- else {
- return NULL;
- }
-}
-
-
-static GLXWindow
-Fake_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
- const int *attribList )
-{
- XMesaVisual xmvis = (XMesaVisual) config;
- XMesaBuffer xmbuf;
- if (!xmvis)
- return 0;
-
- xmbuf = XMesaCreateWindowBuffer2(xmvis, win, NULL);
- if (!xmbuf)
- return 0;
-
- (void) dpy;
- (void) attribList; /* Ignored in GLX 1.3 */
-
- return win; /* A hack for now */
-}
-
-
-static void
-Fake_glXDestroyWindow( Display *dpy, GLXWindow window )
-{
- XMesaBuffer b = XMesaFindBuffer(dpy, (XMesaDrawable) window);
- if (b)
- XMesaDestroyBuffer(b);
- /* don't destroy X window */
-}
-
-
-/* XXX untested */
-static GLXPixmap
-Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
- const int *attribList )
-{
- XMesaVisual v = (XMesaVisual) config;
- XMesaBuffer b;
-
- (void) dpy;
- (void) config;
- (void) pixmap;
- (void) attribList; /* Ignored in GLX 1.3 */
-
- if (!dpy || !config || !pixmap)
- return 0;
-
- b = XMesaCreatePixmapBuffer( v, pixmap, 0 );
- if (!b) {
- return 0;
- }
-
- return pixmap;
-}
-
-
-static void
-Fake_glXDestroyPixmap( Display *dpy, GLXPixmap pixmap )
-{
- XMesaBuffer b = XMesaFindBuffer(dpy, (XMesaDrawable)pixmap);
- if (b)
- XMesaDestroyBuffer(b);
- /* don't destroy X pixmap */
-}
-
-
-static GLXPbuffer
-Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config,
- const int *attribList )
-{
- XMesaVisual xmvis = (XMesaVisual) config;
- XMesaBuffer xmbuf;
- const int *attrib;
- int width = 0, height = 0;
- GLboolean useLargest = GL_FALSE, preserveContents = GL_FALSE;
-
- (void) dpy;
-
- for (attrib = attribList; *attrib; attrib++) {
- switch (*attrib) {
- case GLX_PBUFFER_WIDTH:
- attrib++;
- width = *attrib;
- break;
- case GLX_PBUFFER_HEIGHT:
- attrib++;
- height = *attrib;
- break;
- case GLX_PRESERVED_CONTENTS:
- attrib++;
- preserveContents = *attrib; /* ignored */
- break;
- case GLX_LARGEST_PBUFFER:
- attrib++;
- useLargest = *attrib; /* ignored */
- break;
- default:
- return 0;
- }
- }
-
- /* not used at this time */
- (void) useLargest;
- (void) preserveContents;
-
- if (width == 0 || height == 0)
- return 0;
-
- xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height);
- /* A GLXPbuffer handle must be an X Drawable because that's what
- * glXMakeCurrent takes.
- */
- if (xmbuf)
- return (GLXPbuffer) xmbuf->frontxrb->pixmap;
- else
- return 0;
-}
-
-
-static void
-Fake_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf )
-{
- XMesaBuffer b = XMesaFindBuffer(dpy, pbuf);
- if (b) {
- XMesaDestroyBuffer(b);
- }
-}
-
-
-static void
-Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
- unsigned int *value )
-{
- XMesaBuffer xmbuf = XMesaFindBuffer(dpy, draw);
- if (!xmbuf)
- return;
-
- switch (attribute) {
- case GLX_WIDTH:
- *value = xmbuf->mesa_buffer.Width;
- break;
- case GLX_HEIGHT:
- *value = xmbuf->mesa_buffer.Height;
- break;
- case GLX_PRESERVED_CONTENTS:
- *value = True;
- break;
- case GLX_LARGEST_PBUFFER:
- *value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height;
- break;
- case GLX_FBCONFIG_ID:
- *value = xmbuf->xm_visual->visinfo->visualid;
- return;
- default:
- return; /* GLX_BAD_ATTRIBUTE? */
- }
-}
-
-
-static GLXContext
-Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config,
- int renderType, GLXContext shareList, Bool direct )
-{
- struct fake_glx_context *glxCtx;
- struct fake_glx_context *shareCtx = (struct fake_glx_context *) shareList;
- XMesaVisual xmvis = (XMesaVisual) config;
-
- if (!dpy || !config ||
- (renderType != GLX_RGBA_TYPE && renderType != GLX_COLOR_INDEX_TYPE))
- return 0;
-
- glxCtx = CALLOC_STRUCT(fake_glx_context);
- if (!glxCtx)
- return 0;
-
- /* deallocate unused windows/buffers */
- XMesaGarbageCollect();
-
- glxCtx->xmesaContext = XMesaCreateContext(xmvis,
- shareCtx ? shareCtx->xmesaContext : NULL);
- if (!glxCtx->xmesaContext) {
- FREE(glxCtx);
- return NULL;
- }
-
- glxCtx->xmesaContext->direct = GL_FALSE;
- glxCtx->glxContext.isDirect = GL_FALSE;
- glxCtx->glxContext.currentDpy = dpy;
- glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */
-
- assert((void *) glxCtx == (void *) &(glxCtx->glxContext));
-
- return (GLXContext) glxCtx;
-}
-
-
-static int
-Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value )
-{
- struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
- XMesaContext xmctx = glxCtx->xmesaContext;
-
- (void) dpy;
- (void) ctx;
-
- switch (attribute) {
- case GLX_FBCONFIG_ID:
- *value = xmctx->xm_visual->visinfo->visualid;
- break;
- case GLX_RENDER_TYPE:
- if (xmctx->xm_visual->mesa_visual.rgbMode)
- *value = GLX_RGBA_BIT;
- else
- *value = GLX_COLOR_INDEX_BIT;
- break;
- case GLX_SCREEN:
- *value = 0;
- return Success;
- default:
- return GLX_BAD_ATTRIBUTE;
- }
- return 0;
-}
-
-
-static void
-Fake_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask )
-{
- XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
- if (xmbuf)
- xmbuf->selectedEvents = mask;
-}
-
-
-static void
-Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
- unsigned long *mask )
-{
- XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
- if (xmbuf)
- *mask = xmbuf->selectedEvents;
- else
- *mask = 0;
-}
-
-
-
-/*** GLX_SGI_swap_control ***/
-
-static int
-Fake_glXSwapIntervalSGI(int interval)
-{
- (void) interval;
- return 0;
-}
-
-
-
-/*** GLX_SGI_video_sync ***/
-
-static int
-Fake_glXGetVideoSyncSGI(unsigned int *count)
-{
- (void) count;
- return 0;
-}
-
-static int
-Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
-{
- (void) divisor;
- (void) remainder;
- (void) count;
- return 0;
-}
-
-
-
-/*** GLX_SGI_make_current_read ***/
-
-static Bool
-Fake_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
-{
- return Fake_glXMakeContextCurrent( dpy, draw, read, ctx );
-}
-
-/* not used
-static GLXDrawable
-Fake_glXGetCurrentReadDrawableSGI(void)
-{
- return 0;
-}
-*/
-
-
-/*** GLX_SGIX_video_source ***/
-#if defined(_VL_H)
-
-static GLXVideoSourceSGIX
-Fake_glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
-{
- (void) dpy;
- (void) screen;
- (void) server;
- (void) path;
- (void) nodeClass;
- (void) drainNode;
- return 0;
-}
-
-static void
-Fake_glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
-{
- (void) dpy;
- (void) src;
-}
-
-#endif
-
-
-/*** GLX_EXT_import_context ***/
-
-static void
-Fake_glXFreeContextEXT(Display *dpy, GLXContext context)
-{
- (void) dpy;
- (void) context;
-}
-
-static GLXContextID
-Fake_glXGetContextIDEXT(const GLXContext context)
-{
- (void) context;
- return 0;
-}
-
-static GLXContext
-Fake_glXImportContextEXT(Display *dpy, GLXContextID contextID)
-{
- (void) dpy;
- (void) contextID;
- return 0;
-}
-
-static int
-Fake_glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute, int *value)
-{
- (void) dpy;
- (void) context;
- (void) attribute;
- (void) value;
- return 0;
-}
-
-
-
-/*** GLX_SGIX_fbconfig ***/
-
-static int
-Fake_glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value)
-{
- return Fake_glXGetFBConfigAttrib(dpy, config, attribute, value);
-}
-
-static GLXFBConfigSGIX *
-Fake_glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements)
-{
- return (GLXFBConfig *) Fake_glXChooseFBConfig(dpy, screen, attrib_list, nelements);
-}
-
-
-static GLXPixmap
-Fake_glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
-{
- XMesaVisual xmvis = (XMesaVisual) config;
- XMesaBuffer xmbuf = XMesaCreatePixmapBuffer(xmvis, pixmap, 0);
- return xmbuf->frontxrb->pixmap; /* need to return an X ID */
-}
-
-
-static GLXContext
-Fake_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct)
-{
- XMesaVisual xmvis = (XMesaVisual) config;
- struct fake_glx_context *glxCtx;
- struct fake_glx_context *shareCtx = (struct fake_glx_context *) share_list;
-
- glxCtx = CALLOC_STRUCT(fake_glx_context);
- if (!glxCtx)
- return 0;
-
- /* deallocate unused windows/buffers */
- XMesaGarbageCollect();
-
- glxCtx->xmesaContext = XMesaCreateContext(xmvis,
- shareCtx ? shareCtx->xmesaContext : NULL);
- if (!glxCtx->xmesaContext) {
- FREE(glxCtx);
- return NULL;
- }
-
- glxCtx->xmesaContext->direct = GL_FALSE;
- glxCtx->glxContext.isDirect = GL_FALSE;
- glxCtx->glxContext.currentDpy = dpy;
- glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */
-
- assert((void *) glxCtx == (void *) &(glxCtx->glxContext));
-
- return (GLXContext) glxCtx;
-}
-
-
-static XVisualInfo *
-Fake_glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config)
-{
- return Fake_glXGetVisualFromFBConfig(dpy, config);
-}
-
-
-static GLXFBConfigSGIX
-Fake_glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
-{
- XMesaVisual xmvis = find_glx_visual(dpy, vis);
- if (!xmvis) {
- /* This visual wasn't found with glXChooseVisual() */
- xmvis = create_glx_visual(dpy, vis);
- }
-
- return (GLXFBConfigSGIX) xmvis;
-}
-
-
-
-/*** GLX_SGIX_pbuffer ***/
-
-static GLXPbufferSGIX
-Fake_glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config,
- unsigned int width, unsigned int height,
- int *attribList)
-{
- XMesaVisual xmvis = (XMesaVisual) config;
- XMesaBuffer xmbuf;
- const int *attrib;
- GLboolean useLargest = GL_FALSE, preserveContents = GL_FALSE;
-
- (void) dpy;
-
- for (attrib = attribList; attrib && *attrib; attrib++) {
- switch (*attrib) {
- case GLX_PRESERVED_CONTENTS_SGIX:
- attrib++;
- preserveContents = *attrib; /* ignored */
- break;
- case GLX_LARGEST_PBUFFER_SGIX:
- attrib++;
- useLargest = *attrib; /* ignored */
- break;
- default:
- return 0;
- }
- }
-
- /* not used at this time */
- (void) useLargest;
- (void) preserveContents;
-
- xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height);
- /* A GLXPbuffer handle must be an X Drawable because that's what
- * glXMakeCurrent takes.
- */
- return (GLXPbuffer) xmbuf->frontxrb->pixmap;
-}
-
-
-static void
-Fake_glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf)
-{
- XMesaBuffer xmbuf = XMesaFindBuffer(dpy, pbuf);
- if (xmbuf) {
- XMesaDestroyBuffer(xmbuf);
- }
-}
-
-
-static int
-Fake_glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value)
-{
- const XMesaBuffer xmbuf = XMesaFindBuffer(dpy, pbuf);
-
- if (!xmbuf) {
- /* Generate GLXBadPbufferSGIX for bad pbuffer */
- return 0;
- }
-
- switch (attribute) {
- case GLX_PRESERVED_CONTENTS_SGIX:
- *value = True;
- break;
- case GLX_LARGEST_PBUFFER_SGIX:
- *value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height;
- break;
- case GLX_WIDTH_SGIX:
- *value = xmbuf->mesa_buffer.Width;
- break;
- case GLX_HEIGHT_SGIX:
- *value = xmbuf->mesa_buffer.Height;
- break;
- case GLX_EVENT_MASK_SGIX:
- *value = 0; /* XXX might be wrong */
- break;
- default:
- *value = 0;
- }
- return 0;
-}
-
-
-static void
-Fake_glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask)
-{
- XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
- if (xmbuf) {
- /* Note: we'll never generate clobber events */
- xmbuf->selectedEvents = mask;
- }
-}
-
-
-static void
-Fake_glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask)
-{
- XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
- if (xmbuf) {
- *mask = xmbuf->selectedEvents;
- }
- else {
- *mask = 0;
- }
-}
-
-
-
-/*** GLX_SGI_cushion ***/
-
-static void
-Fake_glXCushionSGI(Display *dpy, Window win, float cushion)
-{
- (void) dpy;
- (void) win;
- (void) cushion;
-}
-
-
-
-/*** GLX_SGIX_video_resize ***/
-
-static int
-Fake_glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window)
-{
- (void) dpy;
- (void) screen;
- (void) channel;
- (void) window;
- return 0;
-}
-
-static int
-Fake_glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h)
-{
- (void) dpy;
- (void) screen;
- (void) channel;
- (void) x;
- (void) y;
- (void) w;
- (void) h;
- return 0;
-}
-
-static int
-Fake_glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
-{
- (void) dpy;
- (void) screen;
- (void) channel;
- (void) x;
- (void) y;
- (void) w;
- (void) h;
- return 0;
-}
-
-static int
-Fake_glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
-{
- (void) dpy;
- (void) screen;
- (void) channel;
- (void) dx;
- (void) dy;
- (void) dw;
- (void) dh;
- return 0;
-}
-
-static int
-Fake_glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype)
-{
- (void) dpy;
- (void) screen;
- (void) channel;
- (void) synctype;
- return 0;
-}
-
-
-
-/*** GLX_SGIX_dmbuffer **/
-
-#if defined(_DM_BUFFER_H_)
-static Bool
-Fake_glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
-{
- (void) dpy;
- (void) pbuffer;
- (void) params;
- (void) dmbuffer;
- return False;
-}
-#endif
-
-
-/*** GLX_SGIX_swap_group ***/
-
-static void
-Fake_glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member)
-{
- (void) dpy;
- (void) drawable;
- (void) member;
-}
-
-
-
-/*** GLX_SGIX_swap_barrier ***/
-
-static void
-Fake_glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier)
-{
- (void) dpy;
- (void) drawable;
- (void) barrier;
-}
-
-static Bool
-Fake_glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
-{
- (void) dpy;
- (void) screen;
- (void) max;
- return False;
-}
-
-
-
-/*** GLX_SUN_get_transparent_index ***/
-
-static Status
-Fake_glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent)
-{
- (void) dpy;
- (void) overlay;
- (void) underlay;
- (void) pTransparent;
- return 0;
-}
-
-
-
-/*** GLX_MESA_release_buffers ***/
-
-/*
- * Release the depth, stencil, accum buffers attached to a GLXDrawable
- * (a window or pixmap) prior to destroying the GLXDrawable.
- */
-static Bool
-Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
-{
- XMesaBuffer b = XMesaFindBuffer(dpy, d);
- if (b) {
- XMesaDestroyBuffer(b);
- return True;
- }
- return False;
-}
-
-
-
-/*** GLX_MESA_set_3dfx_mode ***/
-
-static Bool
-Fake_glXSet3DfxModeMESA( int mode )
-{
- return XMesaSetFXmode( mode );
-}
-
-
-
-/*** GLX_NV_vertex_array range ***/
-static void *
-Fake_glXAllocateMemoryNV( GLsizei size,
- GLfloat readFrequency,
- GLfloat writeFrequency,
- GLfloat priority )
-{
- (void) size;
- (void) readFrequency;
- (void) writeFrequency;
- (void) priority;
- return NULL;
-}
-
-
-static void
-Fake_glXFreeMemoryNV( GLvoid *pointer )
-{
- (void) pointer;
-}
-
-
-/*** GLX_MESA_agp_offset ***/
-
-static GLuint
-Fake_glXGetAGPOffsetMESA( const GLvoid *pointer )
-{
- (void) pointer;
- return ~0;
-}
-
-
-/* silence warning */
-extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void);
-
-
-/**
- * Create a new GLX API dispatch table with its function pointers
- * initialized to point to Mesa's "fake" GLX API functions.
- * Note: there's a similar function (_real_GetGLXDispatchTable) that
- * returns a new dispatch table with all pointers initalized to point
- * to "real" GLX functions (which understand GLX wire protocol, etc).
- */
-struct _glxapi_table *
-_mesa_GetGLXDispatchTable(void)
-{
- static struct _glxapi_table glx;
-
- /* be sure our dispatch table size <= libGL's table */
- {
- GLuint size = sizeof(struct _glxapi_table) / sizeof(void *);
- (void) size;
- assert(_glxapi_get_dispatch_table_size() >= size);
- }
-
- /* initialize the whole table to no-ops */
- _glxapi_set_no_op_table(&glx);
-
- /* now initialize the table with the functions I implement */
- glx.ChooseVisual = Fake_glXChooseVisual;
- glx.CopyContext = Fake_glXCopyContext;
- glx.CreateContext = Fake_glXCreateContext;
- glx.CreateGLXPixmap = Fake_glXCreateGLXPixmap;
- glx.DestroyContext = Fake_glXDestroyContext;
- glx.DestroyGLXPixmap = Fake_glXDestroyGLXPixmap;
- glx.GetConfig = Fake_glXGetConfig;
- /*glx.GetCurrentContext = Fake_glXGetCurrentContext;*/
- /*glx.GetCurrentDrawable = Fake_glXGetCurrentDrawable;*/
- glx.IsDirect = Fake_glXIsDirect;
- glx.MakeCurrent = Fake_glXMakeCurrent;
- glx.QueryExtension = Fake_glXQueryExtension;
- glx.QueryVersion = Fake_glXQueryVersion;
- glx.SwapBuffers = Fake_glXSwapBuffers;
- glx.UseXFont = Fake_glXUseXFont;
- glx.WaitGL = Fake_glXWaitGL;
- glx.WaitX = Fake_glXWaitX;
-
- /*** GLX_VERSION_1_1 ***/
- glx.GetClientString = Fake_glXGetClientString;
- glx.QueryExtensionsString = Fake_glXQueryExtensionsString;
- glx.QueryServerString = Fake_glXQueryServerString;
-
- /*** GLX_VERSION_1_2 ***/
- /*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/
-
- /*** GLX_VERSION_1_3 ***/
- glx.ChooseFBConfig = Fake_glXChooseFBConfig;
- glx.CreateNewContext = Fake_glXCreateNewContext;
- glx.CreatePbuffer = Fake_glXCreatePbuffer;
- glx.CreatePixmap = Fake_glXCreatePixmap;
- glx.CreateWindow = Fake_glXCreateWindow;
- glx.DestroyPbuffer = Fake_glXDestroyPbuffer;
- glx.DestroyPixmap = Fake_glXDestroyPixmap;
- glx.DestroyWindow = Fake_glXDestroyWindow;
- /*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/
- glx.GetFBConfigAttrib = Fake_glXGetFBConfigAttrib;
- glx.GetFBConfigs = Fake_glXGetFBConfigs;
- glx.GetSelectedEvent = Fake_glXGetSelectedEvent;
- glx.GetVisualFromFBConfig = Fake_glXGetVisualFromFBConfig;
- glx.MakeContextCurrent = Fake_glXMakeContextCurrent;
- glx.QueryContext = Fake_glXQueryContext;
- glx.QueryDrawable = Fake_glXQueryDrawable;
- glx.SelectEvent = Fake_glXSelectEvent;
-
- /*** GLX_SGI_swap_control ***/
- glx.SwapIntervalSGI = Fake_glXSwapIntervalSGI;
-
- /*** GLX_SGI_video_sync ***/
- glx.GetVideoSyncSGI = Fake_glXGetVideoSyncSGI;
- glx.WaitVideoSyncSGI = Fake_glXWaitVideoSyncSGI;
-
- /*** GLX_SGI_make_current_read ***/
- glx.MakeCurrentReadSGI = Fake_glXMakeCurrentReadSGI;
- /*glx.GetCurrentReadDrawableSGI = Fake_glXGetCurrentReadDrawableSGI;*/
-
-/*** GLX_SGIX_video_source ***/
-#if defined(_VL_H)
- glx.CreateGLXVideoSourceSGIX = Fake_glXCreateGLXVideoSourceSGIX;
- glx.DestroyGLXVideoSourceSGIX = Fake_glXDestroyGLXVideoSourceSGIX;
-#endif
-
- /*** GLX_EXT_import_context ***/
- glx.FreeContextEXT = Fake_glXFreeContextEXT;
- glx.GetContextIDEXT = Fake_glXGetContextIDEXT;
- /*glx.GetCurrentDisplayEXT = Fake_glXGetCurrentDisplayEXT;*/
- glx.ImportContextEXT = Fake_glXImportContextEXT;
- glx.QueryContextInfoEXT = Fake_glXQueryContextInfoEXT;
-
- /*** GLX_SGIX_fbconfig ***/
- glx.GetFBConfigAttribSGIX = Fake_glXGetFBConfigAttribSGIX;
- glx.ChooseFBConfigSGIX = Fake_glXChooseFBConfigSGIX;
- glx.CreateGLXPixmapWithConfigSGIX = Fake_glXCreateGLXPixmapWithConfigSGIX;
- glx.CreateContextWithConfigSGIX = Fake_glXCreateContextWithConfigSGIX;
- glx.GetVisualFromFBConfigSGIX = Fake_glXGetVisualFromFBConfigSGIX;
- glx.GetFBConfigFromVisualSGIX = Fake_glXGetFBConfigFromVisualSGIX;
-
- /*** GLX_SGIX_pbuffer ***/
- glx.CreateGLXPbufferSGIX = Fake_glXCreateGLXPbufferSGIX;
- glx.DestroyGLXPbufferSGIX = Fake_glXDestroyGLXPbufferSGIX;
- glx.QueryGLXPbufferSGIX = Fake_glXQueryGLXPbufferSGIX;
- glx.SelectEventSGIX = Fake_glXSelectEventSGIX;
- glx.GetSelectedEventSGIX = Fake_glXGetSelectedEventSGIX;
-
- /*** GLX_SGI_cushion ***/
- glx.CushionSGI = Fake_glXCushionSGI;
-
- /*** GLX_SGIX_video_resize ***/
- glx.BindChannelToWindowSGIX = Fake_glXBindChannelToWindowSGIX;
- glx.ChannelRectSGIX = Fake_glXChannelRectSGIX;
- glx.QueryChannelRectSGIX = Fake_glXQueryChannelRectSGIX;
- glx.QueryChannelDeltasSGIX = Fake_glXQueryChannelDeltasSGIX;
- glx.ChannelRectSyncSGIX = Fake_glXChannelRectSyncSGIX;
-
- /*** GLX_SGIX_dmbuffer **/
-#if defined(_DM_BUFFER_H_)
- glx.AssociateDMPbufferSGIX = NULL;
-#endif
-
- /*** GLX_SGIX_swap_group ***/
- glx.JoinSwapGroupSGIX = Fake_glXJoinSwapGroupSGIX;
-
- /*** GLX_SGIX_swap_barrier ***/
- glx.BindSwapBarrierSGIX = Fake_glXBindSwapBarrierSGIX;
- glx.QueryMaxSwapBarriersSGIX = Fake_glXQueryMaxSwapBarriersSGIX;
-
- /*** GLX_SUN_get_transparent_index ***/
- glx.GetTransparentIndexSUN = Fake_glXGetTransparentIndexSUN;
-
- /*** GLX_MESA_copy_sub_buffer ***/
- glx.CopySubBufferMESA = Fake_glXCopySubBufferMESA;
-
- /*** GLX_MESA_release_buffers ***/
- glx.ReleaseBuffersMESA = Fake_glXReleaseBuffersMESA;
-
- /*** GLX_MESA_pixmap_colormap ***/
- glx.CreateGLXPixmapMESA = Fake_glXCreateGLXPixmapMESA;
-
- /*** GLX_MESA_set_3dfx_mode ***/
- glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA;
-
- /*** GLX_NV_vertex_array_range ***/
- glx.AllocateMemoryNV = Fake_glXAllocateMemoryNV;
- glx.FreeMemoryNV = Fake_glXFreeMemoryNV;
-
- /*** GLX_MESA_agp_offset ***/
- glx.GetAGPOffsetMESA = Fake_glXGetAGPOffsetMESA;
-
- return &glx;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.c b/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.c
deleted file mode 100644
index 69af99730..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.c
+++ /dev/null
@@ -1,1348 +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.
- */
-
-
-/*
- * This is the GLX API dispatcher. Calls to the glX* functions are
- * either routed to the real GLX encoders or to Mesa's pseudo-GLX functions.
- * See the glxapi.h file for more details.
- */
-
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "glheader.h"
-#include "glapi.h"
-#include "glxapi.h"
-
-
-extern struct _glxapi_table *_real_GetGLXDispatchTable(void);
-extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void);
-
-
-struct display_dispatch {
- Display *Dpy;
- struct _glxapi_table *Table;
- struct display_dispatch *Next;
-};
-
-static struct display_dispatch *DispatchList = NULL;
-
-
-/* Display -> Dispatch caching */
-static Display *prevDisplay = NULL;
-static struct _glxapi_table *prevTable = NULL;
-
-
-static struct _glxapi_table *
-get_dispatch(Display *dpy)
-{
- if (!dpy)
- return NULL;
-
- /* search list of display/dispatch pairs for this display */
- {
- const struct display_dispatch *d = DispatchList;
- while (d) {
- if (d->Dpy == dpy) {
- prevDisplay = dpy;
- prevTable = d->Table;
- return d->Table; /* done! */
- }
- d = d->Next;
- }
- }
-
- /* A new display, determine if we should use real GLX
- * or Mesa's pseudo-GLX.
- */
- {
- struct _glxapi_table *t = _mesa_GetGLXDispatchTable();
-
- if (t) {
- struct display_dispatch *d;
- d = (struct display_dispatch *) malloc(sizeof(struct display_dispatch));
- if (d) {
- d->Dpy = dpy;
- d->Table = t;
- /* insert at head of list */
- d->Next = DispatchList;
- DispatchList = d;
- /* update cache */
- prevDisplay = dpy;
- prevTable = t;
- return t;
- }
- }
- }
-
- /* If we get here that means we can't use real GLX on this display
- * and the Mesa pseudo-GLX software renderer wasn't compiled in.
- * Or, we ran out of memory!
- */
- return NULL;
-}
-
-
-#define GET_DISPATCH(DPY, TABLE) \
- if (DPY == prevDisplay) { \
- TABLE = prevTable; \
- } \
- else if (!DPY) { \
- TABLE = NULL; \
- } \
- else { \
- TABLE = get_dispatch(DPY); \
- }
-
-
-
-
-/* Set by glXMakeCurrent() and glXMakeContextCurrent() only */
-static GLXContext CurrentContext = 0;
-#define __glXGetCurrentContext() CurrentContext;
-
-
-/*
- * GLX API entrypoints
- */
-
-/*** GLX_VERSION_1_0 ***/
-
-XVisualInfo PUBLIC *
-glXChooseVisual(Display *dpy, int screen, int *list)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return NULL;
- return (t->ChooseVisual)(dpy, screen, list);
-}
-
-
-void PUBLIC
-glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->CopyContext)(dpy, src, dst, mask);
-}
-
-
-GLXContext PUBLIC
-glXCreateContext(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateContext)(dpy, visinfo, shareList, direct);
-}
-
-
-GLXPixmap PUBLIC
-glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateGLXPixmap)(dpy, visinfo, pixmap);
-}
-
-
-void PUBLIC
-glXDestroyContext(Display *dpy, GLXContext ctx)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->DestroyContext)(dpy, ctx);
-}
-
-
-void PUBLIC
-glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->DestroyGLXPixmap)(dpy, pixmap);
-}
-
-
-int PUBLIC
-glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return GLX_NO_EXTENSION;
- return (t->GetConfig)(dpy, visinfo, attrib, value);
-}
-
-
-GLXContext PUBLIC
-glXGetCurrentContext(void)
-{
- return CurrentContext;
-}
-
-
-GLXDrawable PUBLIC
-glXGetCurrentDrawable(void)
-{
- __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
- return gc ? gc->currentDrawable : 0;
-}
-
-
-Bool PUBLIC
-glXIsDirect(Display *dpy, GLXContext ctx)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (t->IsDirect)(dpy, ctx);
-}
-
-
-Bool PUBLIC
-glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
-{
- Bool b;
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t) {
- return False;
- }
- b = (*t->MakeCurrent)(dpy, drawable, ctx);
- if (b) {
- CurrentContext = ctx;
- }
- return b;
-}
-
-
-Bool PUBLIC
-glXQueryExtension(Display *dpy, int *errorb, int *event)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (t->QueryExtension)(dpy, errorb, event);
-}
-
-
-Bool PUBLIC
-glXQueryVersion(Display *dpy, int *maj, int *min)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (t->QueryVersion)(dpy, maj, min);
-}
-
-
-void PUBLIC
-glXSwapBuffers(Display *dpy, GLXDrawable drawable)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->SwapBuffers)(dpy, drawable);
-}
-
-
-void PUBLIC
-glXUseXFont(Font font, int first, int count, int listBase)
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->UseXFont)(font, first, count, listBase);
-}
-
-
-void PUBLIC
-glXWaitGL(void)
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->WaitGL)();
-}
-
-
-void PUBLIC
-glXWaitX(void)
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->WaitX)();
-}
-
-
-
-/*** GLX_VERSION_1_1 ***/
-
-const char PUBLIC *
-glXGetClientString(Display *dpy, int name)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return NULL;
- return (t->GetClientString)(dpy, name);
-}
-
-
-const char PUBLIC *
-glXQueryExtensionsString(Display *dpy, int screen)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return NULL;
- return (t->QueryExtensionsString)(dpy, screen);
-}
-
-
-const char PUBLIC *
-glXQueryServerString(Display *dpy, int screen, int name)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return NULL;
- return (t->QueryServerString)(dpy, screen, name);
-}
-
-
-/*** GLX_VERSION_1_2 ***/
-
-Display PUBLIC *
-glXGetCurrentDisplay(void)
-{
- /* Same code as in libGL's glxext.c */
- __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
- if (NULL == gc) return NULL;
- return gc->currentDpy;
-}
-
-
-
-/*** GLX_VERSION_1_3 ***/
-
-GLXFBConfig PUBLIC *
-glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->ChooseFBConfig)(dpy, screen, attribList, nitems);
-}
-
-
-GLXContext PUBLIC
-glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateNewContext)(dpy, config, renderType, shareList, direct);
-}
-
-
-GLXPbuffer PUBLIC
-glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreatePbuffer)(dpy, config, attribList);
-}
-
-
-GLXPixmap PUBLIC
-glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreatePixmap)(dpy, config, pixmap, attribList);
-}
-
-
-GLXWindow PUBLIC
-glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateWindow)(dpy, config, win, attribList);
-}
-
-
-void PUBLIC
-glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->DestroyPbuffer)(dpy, pbuf);
-}
-
-
-void PUBLIC
-glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->DestroyPixmap)(dpy, pixmap);
-}
-
-
-void PUBLIC
-glXDestroyWindow(Display *dpy, GLXWindow window)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->DestroyWindow)(dpy, window);
-}
-
-
-GLXDrawable PUBLIC
-glXGetCurrentReadDrawable(void)
-{
- __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
- return gc ? gc->currentReadable : 0;
-}
-
-
-int PUBLIC
-glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return GLX_NO_EXTENSION;
- return (t->GetFBConfigAttrib)(dpy, config, attribute, value);
-}
-
-
-GLXFBConfig PUBLIC *
-glXGetFBConfigs(Display *dpy, int screen, int *nelements)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->GetFBConfigs)(dpy, screen, nelements);
-}
-
-void PUBLIC
-glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->GetSelectedEvent)(dpy, drawable, mask);
-}
-
-
-XVisualInfo PUBLIC *
-glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return NULL;
- return (t->GetVisualFromFBConfig)(dpy, config);
-}
-
-
-Bool PUBLIC
-glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
-{
- Bool b;
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- b = (t->MakeContextCurrent)(dpy, draw, read, ctx);
- if (b) {
- CurrentContext = ctx;
- }
- return b;
-}
-
-
-int PUBLIC
-glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- assert(t);
- if (!t)
- return 0; /* XXX correct? */
- return (t->QueryContext)(dpy, ctx, attribute, value);
-}
-
-
-void PUBLIC
-glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->QueryDrawable)(dpy, draw, attribute, value);
-}
-
-
-void PUBLIC
-glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->SelectEvent)(dpy, drawable, mask);
-}
-
-
-
-/*** GLX_SGI_swap_control ***/
-
-int PUBLIC
-glXSwapIntervalSGI(int interval)
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->SwapIntervalSGI)(interval);
-}
-
-
-
-/*** GLX_SGI_video_sync ***/
-
-int PUBLIC
-glXGetVideoSyncSGI(unsigned int *count)
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->GetVideoSyncSGI)(count);
-}
-
-int PUBLIC
-glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->WaitVideoSyncSGI)(divisor, remainder, count);
-}
-
-
-
-/*** GLX_SGI_make_current_read ***/
-
-Bool PUBLIC
-glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->MakeCurrentReadSGI)(dpy, draw, read, ctx);
-}
-
-GLXDrawable PUBLIC
-glXGetCurrentReadDrawableSGI(void)
-{
- return glXGetCurrentReadDrawable();
-}
-
-
-#if defined(_VL_H)
-
-GLXVideoSourceSGIX PUBLIC
-glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateGLXVideoSourceSGIX)(dpy, screen, server, path, nodeClass, drainNode);
-}
-
-void PUBLIC
-glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->DestroyGLXVideoSourceSGIX)(dpy, src);
-}
-
-#endif
-
-
-/*** GLX_EXT_import_context ***/
-
-void PUBLIC
-glXFreeContextEXT(Display *dpy, GLXContext context)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->FreeContextEXT)(dpy, context);
-}
-
-GLXContextID PUBLIC
-glXGetContextIDEXT(const GLXContext context)
-{
- return ((__GLXcontext *) context)->xid;
-}
-
-Display PUBLIC *
-glXGetCurrentDisplayEXT(void)
-{
- return glXGetCurrentDisplay();
-}
-
-GLXContext PUBLIC
-glXImportContextEXT(Display *dpy, GLXContextID contextID)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->ImportContextEXT)(dpy, contextID);
-}
-
-int PUBLIC
-glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int *value)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0; /* XXX ok? */
- return (t->QueryContextInfoEXT)(dpy, context, attribute, value);
-}
-
-
-
-/*** GLX_SGIX_fbconfig ***/
-
-int PUBLIC
-glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->GetFBConfigAttribSGIX)(dpy, config, attribute, value);
-}
-
-GLXFBConfigSGIX PUBLIC *
-glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->ChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
-}
-
-GLXPixmap PUBLIC
-glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap);
-}
-
-GLXContext PUBLIC
-glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct);
-}
-
-XVisualInfo PUBLIC *
-glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->GetVisualFromFBConfigSGIX)(dpy, config);
-}
-
-GLXFBConfigSGIX PUBLIC
-glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->GetFBConfigFromVisualSGIX)(dpy, vis);
-}
-
-
-
-/*** GLX_SGIX_pbuffer ***/
-
-GLXPbufferSGIX PUBLIC
-glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
-}
-
-void PUBLIC
-glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->DestroyGLXPbufferSGIX)(dpy, pbuf);
-}
-
-int PUBLIC
-glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->QueryGLXPbufferSGIX)(dpy, pbuf, attribute, value);
-}
-
-void PUBLIC
-glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->SelectEventSGIX)(dpy, drawable, mask);
-}
-
-void PUBLIC
-glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->GetSelectedEventSGIX)(dpy, drawable, mask);
-}
-
-
-
-/*** GLX_SGI_cushion ***/
-
-void PUBLIC
-glXCushionSGI(Display *dpy, Window win, float cushion)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->CushionSGI)(dpy, win, cushion);
-}
-
-
-
-/*** GLX_SGIX_video_resize ***/
-
-int PUBLIC
-glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->BindChannelToWindowSGIX)(dpy, screen, channel, window);
-}
-
-int PUBLIC
-glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->ChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
-}
-
-int PUBLIC
-glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->QueryChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
-}
-
-int PUBLIC
-glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->QueryChannelDeltasSGIX)(dpy, screen, channel, dx, dy, dw, dh);
-}
-
-int PUBLIC
-glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->ChannelRectSyncSGIX)(dpy, screen, channel, synctype);
-}
-
-
-
-#if defined(_DM_BUFFER_H_)
-
-Bool PUBLIC
-glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (t->AssociateDMPbufferSGIX)(dpy, pbuffer, params, dmbuffer);
-}
-
-#endif
-
-
-/*** GLX_SGIX_swap_group ***/
-
-void PUBLIC
-glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (*t->JoinSwapGroupSGIX)(dpy, drawable, member);
-}
-
-
-/*** GLX_SGIX_swap_barrier ***/
-
-void PUBLIC
-glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (*t->BindSwapBarrierSGIX)(dpy, drawable, barrier);
-}
-
-Bool PUBLIC
-glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (*t->QueryMaxSwapBarriersSGIX)(dpy, screen, max);
-}
-
-
-
-/*** GLX_SUN_get_transparent_index ***/
-
-Status PUBLIC
-glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (*t->GetTransparentIndexSUN)(dpy, overlay, underlay, pTransparent);
-}
-
-
-
-/*** GLX_MESA_copy_sub_buffer ***/
-
-void PUBLIC
-glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->CopySubBufferMESA)(dpy, drawable, x, y, width, height);
-}
-
-
-
-/*** GLX_MESA_release_buffers ***/
-
-Bool PUBLIC
-glXReleaseBuffersMESA(Display *dpy, Window w)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (t->ReleaseBuffersMESA)(dpy, w);
-}
-
-
-
-/*** GLX_MESA_pixmap_colormap ***/
-
-GLXPixmap PUBLIC
-glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap)
-{
- struct _glxapi_table *t;
- GET_DISPATCH(dpy, t);
- if (!t)
- return 0;
- return (t->CreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap);
-}
-
-
-
-/*** GLX_MESA_set_3dfx_mode ***/
-
-Bool PUBLIC
-glXSet3DfxModeMESA(int mode)
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return False;
- return (t->Set3DfxModeMESA)(mode);
-}
-
-
-
-/*** GLX_NV_vertex_array_range ***/
-
-void PUBLIC *
-glXAllocateMemoryNV( GLsizei size,
- GLfloat readFrequency,
- GLfloat writeFrequency,
- GLfloat priority )
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return NULL;
- return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority);
-}
-
-
-void PUBLIC
-glXFreeMemoryNV( GLvoid *pointer )
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return;
- (t->FreeMemoryNV)(pointer);
-}
-
-
-
-
-/*** GLX_MESA_agp_offset */
-
-GLuint PUBLIC
-glXGetAGPOffsetMESA( const GLvoid *pointer )
-{
- struct _glxapi_table *t;
- Display *dpy = glXGetCurrentDisplay();
- GET_DISPATCH(dpy, t);
- if (!t)
- return ~0;
- return (t->GetAGPOffsetMESA)(pointer);
-}
-
-
-/*** GLX_MESA_allocate_memory */
-
-void *
-glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size,
- float readfreq, float writefreq, float priority)
-{
- /* dummy */
- return NULL;
-}
-
-void
-glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
-{
- /* dummy */
-}
-
-
-GLuint
-glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer)
-{
- /* dummy */
- return 0;
-}
-
-
-
-/**********************************************************************/
-/* GLX API management functions */
-/**********************************************************************/
-
-
-const char *
-_glxapi_get_version(void)
-{
- return "1.3";
-}
-
-
-/*
- * Return array of extension strings.
- */
-const char **
-_glxapi_get_extensions(void)
-{
- static const char *extensions[] = {
-#ifdef GLX_EXT_import_context
- "GLX_EXT_import_context",
-#endif
-#ifdef GLX_SGI_video_sync
- "GLX_SGI_video_sync",
-#endif
-#ifdef GLX_MESA_copy_sub_buffer
- "GLX_MESA_copy_sub_buffer",
-#endif
-#ifdef GLX_MESA_release_buffers
- "GLX_MESA_release_buffers",
-#endif
-#ifdef GLX_MESA_pixmap_colormap
- "GLX_MESA_pixmap_colormap",
-#endif
-#ifdef GLX_MESA_set_3dfx_mode
- "GLX_MESA_set_3dfx_mode",
-#endif
-#ifdef GLX_SGIX_fbconfig
- "GLX_SGIX_fbconfig",
-#endif
-#ifdef GLX_SGIX_pbuffer
- "GLX_SGIX_pbuffer",
-#endif
- NULL
- };
- return extensions;
-}
-
-
-/*
- * Return size of the GLX dispatch table, in entries, not bytes.
- */
-GLuint
-_glxapi_get_dispatch_table_size(void)
-{
- return sizeof(struct _glxapi_table) / sizeof(void *);
-}
-
-
-static int
-generic_no_op_func(void)
-{
- return 0;
-}
-
-
-/*
- * Initialize all functions in given dispatch table to be no-ops
- */
-void
-_glxapi_set_no_op_table(struct _glxapi_table *t)
-{
- typedef int (*nop_func)(void);
- nop_func *dispatch = (nop_func *) t;
- GLuint n = _glxapi_get_dispatch_table_size();
- GLuint i;
- for (i = 0; i < n; i++) {
- dispatch[i] = generic_no_op_func;
- }
-}
-
-
-struct name_address_pair {
- const char *Name;
- __GLXextFuncPtr Address;
-};
-
-static struct name_address_pair GLX_functions[] = {
- /*** GLX_VERSION_1_0 ***/
- { "glXChooseVisual", (__GLXextFuncPtr) glXChooseVisual },
- { "glXCopyContext", (__GLXextFuncPtr) glXCopyContext },
- { "glXCreateContext", (__GLXextFuncPtr) glXCreateContext },
- { "glXCreateGLXPixmap", (__GLXextFuncPtr) glXCreateGLXPixmap },
- { "glXDestroyContext", (__GLXextFuncPtr) glXDestroyContext },
- { "glXDestroyGLXPixmap", (__GLXextFuncPtr) glXDestroyGLXPixmap },
- { "glXGetConfig", (__GLXextFuncPtr) glXGetConfig },
- { "glXGetCurrentContext", (__GLXextFuncPtr) glXGetCurrentContext },
- { "glXGetCurrentDrawable", (__GLXextFuncPtr) glXGetCurrentDrawable },
- { "glXIsDirect", (__GLXextFuncPtr) glXIsDirect },
- { "glXMakeCurrent", (__GLXextFuncPtr) glXMakeCurrent },
- { "glXQueryExtension", (__GLXextFuncPtr) glXQueryExtension },
- { "glXQueryVersion", (__GLXextFuncPtr) glXQueryVersion },
- { "glXSwapBuffers", (__GLXextFuncPtr) glXSwapBuffers },
- { "glXUseXFont", (__GLXextFuncPtr) glXUseXFont },
- { "glXWaitGL", (__GLXextFuncPtr) glXWaitGL },
- { "glXWaitX", (__GLXextFuncPtr) glXWaitX },
-
- /*** GLX_VERSION_1_1 ***/
- { "glXGetClientString", (__GLXextFuncPtr) glXGetClientString },
- { "glXQueryExtensionsString", (__GLXextFuncPtr) glXQueryExtensionsString },
- { "glXQueryServerString", (__GLXextFuncPtr) glXQueryServerString },
-
- /*** GLX_VERSION_1_2 ***/
- { "glXGetCurrentDisplay", (__GLXextFuncPtr) glXGetCurrentDisplay },
-
- /*** GLX_VERSION_1_3 ***/
- { "glXChooseFBConfig", (__GLXextFuncPtr) glXChooseFBConfig },
- { "glXCreateNewContext", (__GLXextFuncPtr) glXCreateNewContext },
- { "glXCreatePbuffer", (__GLXextFuncPtr) glXCreatePbuffer },
- { "glXCreatePixmap", (__GLXextFuncPtr) glXCreatePixmap },
- { "glXCreateWindow", (__GLXextFuncPtr) glXCreateWindow },
- { "glXDestroyPbuffer", (__GLXextFuncPtr) glXDestroyPbuffer },
- { "glXDestroyPixmap", (__GLXextFuncPtr) glXDestroyPixmap },
- { "glXDestroyWindow", (__GLXextFuncPtr) glXDestroyWindow },
- { "glXGetCurrentReadDrawable", (__GLXextFuncPtr) glXGetCurrentReadDrawable },
- { "glXGetFBConfigAttrib", (__GLXextFuncPtr) glXGetFBConfigAttrib },
- { "glXGetFBConfigs", (__GLXextFuncPtr) glXGetFBConfigs },
- { "glXGetSelectedEvent", (__GLXextFuncPtr) glXGetSelectedEvent },
- { "glXGetVisualFromFBConfig", (__GLXextFuncPtr) glXGetVisualFromFBConfig },
- { "glXMakeContextCurrent", (__GLXextFuncPtr) glXMakeContextCurrent },
- { "glXQueryContext", (__GLXextFuncPtr) glXQueryContext },
- { "glXQueryDrawable", (__GLXextFuncPtr) glXQueryDrawable },
- { "glXSelectEvent", (__GLXextFuncPtr) glXSelectEvent },
-
- /*** GLX_VERSION_1_4 ***/
- { "glXGetProcAddress", (__GLXextFuncPtr) glXGetProcAddress },
-
- /*** GLX_SGI_swap_control ***/
- { "glXSwapIntervalSGI", (__GLXextFuncPtr) glXSwapIntervalSGI },
-
- /*** GLX_SGI_video_sync ***/
- { "glXGetVideoSyncSGI", (__GLXextFuncPtr) glXGetVideoSyncSGI },
- { "glXWaitVideoSyncSGI", (__GLXextFuncPtr) glXWaitVideoSyncSGI },
-
- /*** GLX_SGI_make_current_read ***/
- { "glXMakeCurrentReadSGI", (__GLXextFuncPtr) glXMakeCurrentReadSGI },
- { "glXGetCurrentReadDrawableSGI", (__GLXextFuncPtr) glXGetCurrentReadDrawableSGI },
-
- /*** GLX_SGIX_video_source ***/
-#if defined(_VL_H)
- { "glXCreateGLXVideoSourceSGIX", (__GLXextFuncPtr) glXCreateGLXVideoSourceSGIX },
- { "glXDestroyGLXVideoSourceSGIX", (__GLXextFuncPtr) glXDestroyGLXVideoSourceSGIX },
-#endif
-
- /*** GLX_EXT_import_context ***/
- { "glXFreeContextEXT", (__GLXextFuncPtr) glXFreeContextEXT },
- { "glXGetContextIDEXT", (__GLXextFuncPtr) glXGetContextIDEXT },
- { "glXGetCurrentDisplayEXT", (__GLXextFuncPtr) glXGetCurrentDisplayEXT },
- { "glXImportContextEXT", (__GLXextFuncPtr) glXImportContextEXT },
- { "glXQueryContextInfoEXT", (__GLXextFuncPtr) glXQueryContextInfoEXT },
-
- /*** GLX_SGIX_fbconfig ***/
- { "glXGetFBConfigAttribSGIX", (__GLXextFuncPtr) glXGetFBConfigAttribSGIX },
- { "glXChooseFBConfigSGIX", (__GLXextFuncPtr) glXChooseFBConfigSGIX },
- { "glXCreateGLXPixmapWithConfigSGIX", (__GLXextFuncPtr) glXCreateGLXPixmapWithConfigSGIX },
- { "glXCreateContextWithConfigSGIX", (__GLXextFuncPtr) glXCreateContextWithConfigSGIX },
- { "glXGetVisualFromFBConfigSGIX", (__GLXextFuncPtr) glXGetVisualFromFBConfigSGIX },
- { "glXGetFBConfigFromVisualSGIX", (__GLXextFuncPtr) glXGetFBConfigFromVisualSGIX },
-
- /*** GLX_SGIX_pbuffer ***/
- { "glXCreateGLXPbufferSGIX", (__GLXextFuncPtr) glXCreateGLXPbufferSGIX },
- { "glXDestroyGLXPbufferSGIX", (__GLXextFuncPtr) glXDestroyGLXPbufferSGIX },
- { "glXQueryGLXPbufferSGIX", (__GLXextFuncPtr) glXQueryGLXPbufferSGIX },
- { "glXSelectEventSGIX", (__GLXextFuncPtr) glXSelectEventSGIX },
- { "glXGetSelectedEventSGIX", (__GLXextFuncPtr) glXGetSelectedEventSGIX },
-
- /*** GLX_SGI_cushion ***/
- { "glXCushionSGI", (__GLXextFuncPtr) glXCushionSGI },
-
- /*** GLX_SGIX_video_resize ***/
- { "glXBindChannelToWindowSGIX", (__GLXextFuncPtr) glXBindChannelToWindowSGIX },
- { "glXChannelRectSGIX", (__GLXextFuncPtr) glXChannelRectSGIX },
- { "glXQueryChannelRectSGIX", (__GLXextFuncPtr) glXQueryChannelRectSGIX },
- { "glXQueryChannelDeltasSGIX", (__GLXextFuncPtr) glXQueryChannelDeltasSGIX },
- { "glXChannelRectSyncSGIX", (__GLXextFuncPtr) glXChannelRectSyncSGIX },
-
- /*** GLX_SGIX_dmbuffer **/
-#if defined(_DM_BUFFER_H_)
- { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr) glXAssociateDMPbufferSGIX },
-#endif
-
- /*** GLX_SGIX_swap_group ***/
- { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr) glXJoinSwapGroupSGIX },
-
- /*** GLX_SGIX_swap_barrier ***/
- { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr) glXBindSwapBarrierSGIX },
- { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr) glXQueryMaxSwapBarriersSGIX },
-
- /*** GLX_SUN_get_transparent_index ***/
- { "glXGetTransparentIndexSUN", (__GLXextFuncPtr) glXGetTransparentIndexSUN },
-
- /*** GLX_MESA_copy_sub_buffer ***/
- { "glXCopySubBufferMESA", (__GLXextFuncPtr) glXCopySubBufferMESA },
-
- /*** GLX_MESA_pixmap_colormap ***/
- { "glXCreateGLXPixmapMESA", (__GLXextFuncPtr) glXCreateGLXPixmapMESA },
-
- /*** GLX_MESA_release_buffers ***/
- { "glXReleaseBuffersMESA", (__GLXextFuncPtr) glXReleaseBuffersMESA },
-
- /*** GLX_MESA_set_3dfx_mode ***/
- { "glXSet3DfxModeMESA", (__GLXextFuncPtr) glXSet3DfxModeMESA },
-
- /*** GLX_ARB_get_proc_address ***/
- { "glXGetProcAddressARB", (__GLXextFuncPtr) glXGetProcAddressARB },
-
- /*** GLX_NV_vertex_array_range ***/
- { "glXAllocateMemoryNV", (__GLXextFuncPtr) glXAllocateMemoryNV },
- { "glXFreeMemoryNV", (__GLXextFuncPtr) glXFreeMemoryNV },
-
- /*** GLX_MESA_agp_offset ***/
- { "glXGetAGPOffsetMESA", (__GLXextFuncPtr) glXGetAGPOffsetMESA },
-
- /*** GLX_MESA_allocate_memory ***/
- { "glXAllocateMemoryMESA", (__GLXextFuncPtr) glXAllocateMemoryMESA },
- { "glXFreeMemoryMESA", (__GLXextFuncPtr) glXFreeMemoryMESA },
- { "glXGetMemoryOffsetMESA", (__GLXextFuncPtr) glXGetMemoryOffsetMESA },
-
- { NULL, NULL } /* end of list */
-};
-
-
-
-/*
- * Return address of named glX function, or NULL if not found.
- */
-__GLXextFuncPtr
-_glxapi_get_proc_address(const char *funcName)
-{
- GLuint i;
- for (i = 0; GLX_functions[i].Name; i++) {
- if (strcmp(GLX_functions[i].Name, funcName) == 0)
- return GLX_functions[i].Address;
- }
- return NULL;
-}
-
-
-
-/*
- * This function does not get dispatched through the dispatch table
- * since it's really a "meta" function.
- */
-__GLXextFuncPtr
-glXGetProcAddressARB(const GLubyte *procName)
-{
- __GLXextFuncPtr f;
-
- f = _glxapi_get_proc_address((const char *) procName);
- if (f) {
- return f;
- }
-
- f = (__GLXextFuncPtr) _glapi_get_proc_address((const char *) procName);
- return f;
-}
-
-
-/* GLX 1.4 */
-void (*glXGetProcAddress(const GLubyte *procName))()
-{
- return glXGetProcAddressARB(procName);
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.h b/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.h
deleted file mode 100644
index 3187534c9..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxapi.h
+++ /dev/null
@@ -1,223 +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.
- */
-
-
-#ifndef _glxapi_h_
-#define _glxapi_h_
-
-
-#define GLX_GLXEXT_PROTOTYPES
-#include "GL/glx.h"
-
-
-/* The GLX API dispatcher (i.e. this code) is being built into stand-alone
- * Mesa. We don't know anything about XFree86 or real GLX so we define a
- * minimal __GLXContextRec here so some of the functions in this file can
- * work properly.
- */
-typedef struct __GLXcontextRec {
- Display *currentDpy;
- GLboolean isDirect;
- GLXDrawable currentDrawable;
- GLXDrawable currentReadable;
- XID xid;
-} __GLXcontext;
-
-
-/*
- * Almost all the GLX API functions get routed through this dispatch table.
- * The exceptions are the glXGetCurrentXXX() functions.
- *
- * This dispatch table allows multiple GLX client-side modules to coexist.
- * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
- * pseudo-GLX can be present at the same time. The former being used on
- * GLX-enabled X servers and the later on non-GLX X servers.
- *
- * Red Hat has been using this since Red Hat Linux 7.0 (I think).
- * This'll be a standard feature in XFree86 4.3. It basically allows one
- * libGL to do both DRI-rendering and "fake GLX" rendering to X displays
- * that lack the GLX extension.
- */
-struct _glxapi_table {
- /*** GLX_VERSION_1_0 ***/
- XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list);
- void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
- GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct);
- GLXPixmap (*CreateGLXPixmap)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap);
- void (*DestroyContext)(Display *dpy, GLXContext ctx);
- void (*DestroyGLXPixmap)(Display *dpy, GLXPixmap pixmap);
- int (*GetConfig)(Display *dpy, XVisualInfo *visinfo, int attrib, int *value);
- /*GLXContext (*GetCurrentContext)(void);*/
- /*GLXDrawable (*GetCurrentDrawable)(void);*/
- Bool (*IsDirect)(Display *dpy, GLXContext ctx);
- Bool (*MakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
- Bool (*QueryExtension)(Display *dpy, int *errorb, int *event);
- Bool (*QueryVersion)(Display *dpy, int *maj, int *min);
- void (*SwapBuffers)(Display *dpy, GLXDrawable drawable);
- void (*UseXFont)(Font font, int first, int count, int listBase);
- void (*WaitGL)(void);
- void (*WaitX)(void);
-
- /*** GLX_VERSION_1_1 ***/
- const char *(*GetClientString)(Display *dpy, int name);
- const char *(*QueryExtensionsString)(Display *dpy, int screen);
- const char *(*QueryServerString)(Display *dpy, int screen, int name);
-
- /*** GLX_VERSION_1_2 ***/
- /*Display *(*GetCurrentDisplay)(void);*/
-
- /*** GLX_VERSION_1_3 ***/
- GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
- GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
- GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
- GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList);
- GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList);
- void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf);
- void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap);
- void (*DestroyWindow)(Display *dpy, GLXWindow window);
- /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
- int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value);
- GLXFBConfig *(*GetFBConfigs)(Display *dpy, int screen, int *nelements);
- void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask);
- XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
- Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
- int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value);
- void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
- void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
-
- /*** GLX_SGI_swap_control ***/
- int (*SwapIntervalSGI)(int);
-
- /*** GLX_SGI_video_sync ***/
- int (*GetVideoSyncSGI)(unsigned int *count);
- int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
-
- /*** GLX_SGI_make_current_read ***/
- Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext);
- /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
-
- /*** GLX_SGIX_video_source (needs video library) ***/
-#if defined(_VL_H_)
- GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode);
- void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX);
-#else
- void *CreateGLXVideoSourceSGIX;
- void *DestroyGLXVideoSourceSGIX;
-#endif
-
- /*** GLX_EXT_import_context ***/
- void (*FreeContextEXT)(Display *dpy, GLXContext context);
- GLXContextID (*GetContextIDEXT)(const GLXContext context);
- /*Display *(*GetCurrentDisplayEXT)(void);*/
- GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID);
- int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
-
- /*** GLX_SGIX_fbconfig ***/
- int (*GetFBConfigAttribSGIX)(Display *, GLXFBConfigSGIX, int, int *);
- GLXFBConfigSGIX * (*ChooseFBConfigSGIX)(Display *, int, int *, int *);
- GLXPixmap (*CreateGLXPixmapWithConfigSGIX)(Display *, GLXFBConfigSGIX, Pixmap);
- GLXContext (*CreateContextWithConfigSGIX)(Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
- XVisualInfo * (*GetVisualFromFBConfigSGIX)(Display *, GLXFBConfigSGIX);
- GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX)(Display *, XVisualInfo *);
-
- /*** GLX_SGIX_pbuffer ***/
- GLXPbufferSGIX (*CreateGLXPbufferSGIX)(Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
- void (*DestroyGLXPbufferSGIX)(Display *, GLXPbufferSGIX);
- int (*QueryGLXPbufferSGIX)(Display *, GLXPbufferSGIX, int, unsigned int *);
- void (*SelectEventSGIX)(Display *, GLXDrawable, unsigned long);
- void (*GetSelectedEventSGIX)(Display *, GLXDrawable, unsigned long *);
-
- /*** GLX_SGI_cushion ***/
- void (*CushionSGI)(Display *, Window, float);
-
- /*** GLX_SGIX_video_resize ***/
- int (*BindChannelToWindowSGIX)(Display *, int, int, Window);
- int (*ChannelRectSGIX)(Display *, int, int, int, int, int, int);
- int (*QueryChannelRectSGIX)(Display *, int, int, int *, int *, int *, int *);
- int (*QueryChannelDeltasSGIX)(Display *, int, int, int *, int *, int *, int *);
- int (*ChannelRectSyncSGIX)(Display *, int, int, GLenum);
-
- /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
-#if defined (_DM_BUFFER_H_)
- Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
-#else
- void *AssociciateDMPbufferSGIX;
-#endif
-
- /*** GLX_SGIX_swap_group ***/
- void (*JoinSwapGroupSGIX)(Display *, GLXDrawable, GLXDrawable);
-
- /*** GLX_SGIX_swap_barrier ***/
- void (*BindSwapBarrierSGIX)(Display *, GLXDrawable, int);
- Bool (*QueryMaxSwapBarriersSGIX)(Display *, int, int *);
-
- /*** GLX_SUN_get_transparent_index ***/
- Status (*GetTransparentIndexSUN)(Display *, Window, Window, long *);
-
- /*** GLX_MESA_copy_sub_buffer ***/
- void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
-
- /*** GLX_MESA_release_buffers ***/
- Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
-
- /*** GLX_MESA_pixmap_colormap ***/
- GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
-
- /*** GLX_MESA_set_3dfx_mode ***/
- Bool (*Set3DfxModeMESA)(int mode);
-
- /*** GLX_NV_vertex_array_range ***/
- void * (*AllocateMemoryNV)( GLsizei size,
- GLfloat readFrequency,
- GLfloat writeFrequency,
- GLfloat priority );
- void (*FreeMemoryNV)( GLvoid *pointer );
-
- /*** GLX_MESA_agp_offset ***/
- GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer );
-};
-
-
-
-extern const char *
-_glxapi_get_version(void);
-
-
-extern const char **
-_glxapi_get_extensions(void);
-
-
-extern GLuint
-_glxapi_get_dispatch_table_size(void);
-
-
-extern void
-_glxapi_set_no_op_table(struct _glxapi_table *t);
-
-
-extern __GLXextFuncPtr
-_glxapi_get_proc_address(const char *funcName);
-
-
-#endif
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.c b/nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.c
deleted file mode 100644
index 30adb7465..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.c
+++ /dev/null
@@ -1,180 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.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.
- */
-
-
-#include <assert.h>
-#include <GL/glx.h>
-#include "realglx.h"
-#include "glxapi.h"
-
-
-struct _glxapi_table *
-_real_GetGLXDispatchTable(void)
-{
- static struct _glxapi_table glx;
-
- /* be sure our dispatch table size <= libGL's table */
- {
- GLuint size = sizeof(struct _glxapi_table) / sizeof(void *);
- (void) size;
- assert(_glxapi_get_dispatch_table_size() >= size);
- }
-
- /* initialize the whole table to no-ops */
- _glxapi_set_no_op_table(&glx);
-
- /* now initialize the table with the functions I implement */
-
- /*** GLX_VERSION_1_0 ***/
- glx.ChooseVisual = _real_glXChooseVisual;
- glx.CopyContext = _real_glXCopyContext;
- glx.CreateContext = _real_glXCreateContext;
- glx.CreateGLXPixmap = _real_glXCreateGLXPixmap;
- glx.DestroyContext = _real_glXDestroyContext;
- glx.DestroyGLXPixmap = _real_glXDestroyGLXPixmap;
- glx.GetConfig = _real_glXGetConfig;
- /*glx.GetCurrentContext = _real_glXGetCurrentContext;*/
- /*glx.GetCurrentDrawable = _real_glXGetCurrentDrawable;*/
- glx.IsDirect = _real_glXIsDirect;
- glx.MakeCurrent = _real_glXMakeCurrent;
- glx.QueryExtension = _real_glXQueryExtension;
- glx.QueryVersion = _real_glXQueryVersion;
- glx.SwapBuffers = _real_glXSwapBuffers;
- glx.UseXFont = _real_glXUseXFont;
- glx.WaitGL = _real_glXWaitGL;
- glx.WaitX = _real_glXWaitX;
-
- /*** GLX_VERSION_1_1 ***/
- glx.GetClientString = _real_glXGetClientString;
- glx.QueryExtensionsString = _real_glXQueryExtensionsString;
- glx.QueryServerString = _real_glXQueryServerString;
-
- /*** GLX_VERSION_1_2 ***/
- /*glx.GetCurrentDisplay = _real_glXGetCurrentDisplay;*/
-
- /*** GLX_VERSION_1_3 ***/
- glx.ChooseFBConfig = _real_glXChooseFBConfig;
- glx.CreateNewContext = _real_glXCreateNewContext;
- glx.CreatePbuffer = _real_glXCreatePbuffer;
- glx.CreatePixmap = _real_glXCreatePixmap;
- glx.CreateWindow = _real_glXCreateWindow;
- glx.DestroyPbuffer = _real_glXDestroyPbuffer;
- glx.DestroyPixmap = _real_glXDestroyPixmap;
- glx.DestroyWindow = _real_glXDestroyWindow;
- /*glx.GetCurrentReadDrawable = _real_glXGetCurrentReadDrawable;*/
- glx.GetFBConfigAttrib = _real_glXGetFBConfigAttrib;
- glx.GetFBConfigs = _real_glXGetFBConfigs;
- glx.GetSelectedEvent = _real_glXGetSelectedEvent;
- glx.GetVisualFromFBConfig = _real_glXGetVisualFromFBConfig;
- glx.MakeContextCurrent = _real_glXMakeContextCurrent;
- glx.QueryContext = _real_glXQueryContext;
- glx.QueryDrawable = _real_glXQueryDrawable;
- glx.SelectEvent = _real_glXSelectEvent;
-
- /*** GLX_SGI_swap_control ***/
- glx.SwapIntervalSGI = _real_glXSwapIntervalSGI;
-
- /*** GLX_SGI_video_sync ***/
- glx.GetVideoSyncSGI = _real_glXGetVideoSyncSGI;
- glx.WaitVideoSyncSGI = _real_glXWaitVideoSyncSGI;
-
- /*** GLX_SGI_make_current_read ***/
- glx.MakeCurrentReadSGI = _real_glXMakeCurrentReadSGI;
- /*glx.GetCurrentReadDrawableSGI = _real_glXGetCurrentReadDrawableSGI;*/
-
-#if defined(_VL_H)
- /*** GLX_SGIX_video_source ***/
- glx.CreateGLXVideoSourceSGIX = _real_glXCreateGLXVideoSourceSGIX;
- glx.DestroyGLXVideoSourceSGIX = _real_glXDestroyGLXVideoSourceSGIX;
-#endif
-
- /*** GLX_EXT_import_context ***/
- glx.FreeContextEXT = _real_glXFreeContextEXT;
- /*glx.GetContextIDEXT = _real_glXGetContextIDEXT;*/
- /*glx.GetCurrentDisplayEXT = _real_glXGetCurrentDisplayEXT;*/
- glx.ImportContextEXT = _real_glXImportContextEXT;
- glx.QueryContextInfoEXT = _real_glXQueryContextInfoEXT;
-
- /*** GLX_SGIX_fbconfig ***/
- glx.GetFBConfigAttribSGIX = _real_glXGetFBConfigAttribSGIX;
- glx.ChooseFBConfigSGIX = _real_glXChooseFBConfigSGIX;
- glx.CreateGLXPixmapWithConfigSGIX = _real_glXCreateGLXPixmapWithConfigSGIX;
- glx.CreateContextWithConfigSGIX = _real_glXCreateContextWithConfigSGIX;
- glx.GetVisualFromFBConfigSGIX = _real_glXGetVisualFromFBConfigSGIX;
- glx.GetFBConfigFromVisualSGIX = _real_glXGetFBConfigFromVisualSGIX;
-
- /*** GLX_SGIX_pbuffer ***/
- glx.CreateGLXPbufferSGIX = _real_glXCreateGLXPbufferSGIX;
- glx.DestroyGLXPbufferSGIX = _real_glXDestroyGLXPbufferSGIX;
- glx.QueryGLXPbufferSGIX = _real_glXQueryGLXPbufferSGIX;
- glx.SelectEventSGIX = _real_glXSelectEventSGIX;
- glx.GetSelectedEventSGIX = _real_glXGetSelectedEventSGIX;
-
- /*** GLX_SGI_cushion ***/
- glx.CushionSGI = _real_glXCushionSGI;
-
- /*** GLX_SGIX_video_resize ***/
- glx.BindChannelToWindowSGIX = _real_glXBindChannelToWindowSGIX;
- glx.ChannelRectSGIX = _real_glXChannelRectSGIX;
- glx.QueryChannelRectSGIX = _real_glXQueryChannelRectSGIX;
- glx.QueryChannelDeltasSGIX = _real_glXQueryChannelDeltasSGIX;
- glx.ChannelRectSyncSGIX = _real_glXChannelRectSyncSGIX;
-
-#if defined(_DM_BUFFER_H_)
- /*** (GLX_SGIX_dmbuffer ***/
- glx.AssociateDMPbufferSGIX = NULL;
-#endif
-
- /*** GLX_SGIX_swap_group ***/
- glx.JoinSwapGroupSGIX = _real_glXJoinSwapGroupSGIX;
-
- /*** GLX_SGIX_swap_barrier ***/
- glx.BindSwapBarrierSGIX = _real_glXBindSwapBarrierSGIX;
- glx.QueryMaxSwapBarriersSGIX = _real_glXQueryMaxSwapBarriersSGIX;
-
- /*** GLX_SUN_get_transparent_index ***/
- glx.GetTransparentIndexSUN = _real_glXGetTransparentIndexSUN;
-
- /*** GLX_MESA_copy_sub_buffer ***/
- glx.CopySubBufferMESA = _real_glXCopySubBufferMESA;
-
- /*** GLX_MESA_release_buffers ***/
- glx.ReleaseBuffersMESA = _real_glXReleaseBuffersMESA;
-
- /*** GLX_MESA_pixmap_colormap ***/
- glx.CreateGLXPixmapMESA = _real_glXCreateGLXPixmapMESA;
-
- /*** GLX_MESA_set_3dfx_mode ***/
- glx.Set3DfxModeMESA = _real_glXSet3DfxModeMESA;
-
- /*** GLX_NV_vertex_array_range ***/
- glx.AllocateMemoryNV = _real_glXAllocateMemoryNV;
- glx.FreeMemoryNV = _real_glXFreeMemoryNV;
-
- /*** GLX_MESA_agp_offset ***/
- glx.GetAGPOffsetMESA = _real_glXGetAGPOffsetMESA;
-
- return &glx;
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.h b/nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.h
deleted file mode 100644
index 150129db6..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/realglx.h
+++ /dev/null
@@ -1,326 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * 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.
- */
-
-
-#ifndef REALGLX_H
-#define REALGLX_H
-
-
-extern struct _glxapi_table *
-_real_GetGLXDispatchTable(void);
-
-
-/*
- * Basically just need these to prevent compiler warnings.
- */
-
-
-extern XVisualInfo *
-_real_glXChooseVisual( Display *dpy, int screen, int *list );
-
-extern GLXContext
-_real_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
- GLXContext share_list, Bool direct );
-
-extern GLXPixmap
-_real_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo, Pixmap pixmap );
-
-extern GLXPixmap
-_real_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
- Pixmap pixmap, Colormap cmap );
-
-extern void
-_real_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
-
-extern void
-_real_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
- unsigned long mask );
-
-extern Bool
-_real_glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx );
-
-extern Bool
-_real_glXQueryExtension( Display *dpy, int *errorb, int *event );
-
-extern void
-_real_glXDestroyContext( Display *dpy, GLXContext ctx );
-
-extern Bool
-_real_glXIsDirect( Display *dpy, GLXContext ctx );
-
-extern void
-_real_glXSwapBuffers( Display *dpy, GLXDrawable drawable );
-
-extern void
-_real_glXUseXFont( Font font, int first, int count, int listbase );
-
-extern Bool
-_real_glXQueryVersion( Display *dpy, int *maj, int *min );
-
-extern int
-_real_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
- int attrib, int *value );
-
-extern void
-_real_glXWaitGL( void );
-
-
-extern void
-_real_glXWaitX( void );
-
-/* GLX 1.1 and later */
-extern const char *
-_real_glXQueryExtensionsString( Display *dpy, int screen );
-
-/* GLX 1.1 and later */
-extern const char *
-_real_glXQueryServerString( Display *dpy, int screen, int name );
-
-/* GLX 1.1 and later */
-extern const char *
-_real_glXGetClientString( Display *dpy, int name );
-
-
-/*
- * GLX 1.3 and later
- */
-
-extern GLXFBConfig *
-_real_glXChooseFBConfig( Display *dpy, int screen,
- const int *attribList, int *nitems );
-
-extern int
-_real_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
- int attribute, int *value );
-
-extern GLXFBConfig *
-_real_glXGetFBConfigs( Display *dpy, int screen, int *nelements );
-
-extern XVisualInfo *
-_real_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config );
-
-extern GLXWindow
-_real_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
- const int *attribList );
-
-extern void
-_real_glXDestroyWindow( Display *dpy, GLXWindow window );
-
-extern GLXPixmap
-_real_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
- const int *attribList );
-
-extern void
-_real_glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
-
-extern GLXPbuffer
-_real_glXCreatePbuffer( Display *dpy, GLXFBConfig config,
- const int *attribList );
-
-extern void
-_real_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
-
-extern void
-_real_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
- unsigned int *value );
-
-extern GLXContext
-_real_glXCreateNewContext( Display *dpy, GLXFBConfig config,
- int renderType, GLXContext shareList, Bool direct );
-
-
-extern Bool
-_real_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
- GLXDrawable read, GLXContext ctx );
-
-extern int
-_real_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value );
-
-extern void
-_real_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask );
-
-extern void
-_real_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
- unsigned long *mask );
-
-#ifdef GLX_SGI_swap_control
-extern int
-_real_glXSwapIntervalSGI(int interval);
-#endif
-
-
-#ifdef GLX_SGI_video_sync
-extern int
-_real_glXGetVideoSyncSGI(unsigned int *count);
-
-extern int
-_real_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count);
-#endif
-
-
-#ifdef GLX_SGI_make_current_read
-extern Bool
-_real_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
-
-extern GLXDrawable
-_real_glXGetCurrentReadDrawableSGI(void);
-#endif
-
-#if defined(_VL_H) && defined(GLX_SGIX_video_source)
-extern GLXVideoSourceSGIX
-_real_glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
-
-extern void
-_real_glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src);
-#endif
-
-#ifdef GLX_EXT_import_context
-extern void
-_real_glXFreeContextEXT(Display *dpy, GLXContext context);
-
-extern GLXContextID
-_real_glXGetContextIDEXT(const GLXContext context);
-
-extern Display *
-_real_glXGetCurrentDisplayEXT(void);
-
-extern GLXContext
-_real_glXImportContextEXT(Display *dpy, GLXContextID contextID);
-
-extern int
-_real_glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute, int *value);
-#endif
-
-#ifdef GLX_SGIX_fbconfig
-extern int
-_real_glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
-
-extern GLXFBConfigSGIX *
-_real_glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements);
-
-extern GLXPixmap
-_real_glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
-
-extern GLXContext
-_real_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
-
-extern XVisualInfo *
-_real_glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config);
-
-extern GLXFBConfigSGIX
-_real_glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis);
-#endif
-
-#ifdef GLX_SGIX_pbuffer
-extern GLXPbufferSGIX
-_real_glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
-
-extern void
-_real_glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf);
-
-extern int
-_real_glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
-
-extern void
-_real_glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask);
-
-extern void
-_real_glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask);
-#endif
-
-#ifdef GLX_SGI_cushion
-extern void
-_real_glXCushionSGI(Display *dpy, Window win, float cushion);
-#endif
-
-#ifdef GLX_SGIX_video_resize
-extern int
-_real_glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window);
-
-extern int
-_real_glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h);
-
-extern int
-_real_glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h);
-
-extern int
-_real_glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
-
-extern int
-_real_glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype);
-#endif
-
-#if defined(_DM_BUFFER_H_) && defined(GLX_SGIX_dmbuffer)
-extern Bool
-_real_glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
-#endif
-
-#ifdef GLX_SGIX_swap_group
-extern void
-_real_glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member);
-#endif
-
-#ifdef GLX_SGIX_swap_barrier
-extern void
-_real_glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier);
-
-extern Bool
-_real_glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max);
-#endif
-
-#ifdef GLX_SUN_get_transparent_index
-extern Status
-_real_glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent);
-#endif
-
-#ifdef GLX_MESA_release_buffers
-extern Bool
-_real_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
-#endif
-
-#ifdef GLX_MESA_set_3dfx_mode
-extern Bool
-_real_glXSet3DfxModeMESA( int mode );
-#endif
-
-#ifdef GLX_NV_vertex_array_range
-extern void *
-_real_glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
-extern void
-_real_glXFreeMemoryNV(GLvoid *pointer);
-#endif
-
-#ifdef GLX_MESA_agp_offset
-extern GLuint
-_real_glXGetAGPOffsetMESA(const GLvoid *pointer);
-#endif
-
-#ifdef GLX_MESA_copy_sub_buffer
-extern void
-_real_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
- int x, int y, int width, int height );
-#endif
-
-#endif /* REALGLX_H */
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.c b/nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.c
deleted file mode 100644
index d72c600bd..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.c
+++ /dev/null
@@ -1,377 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * 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.
- */
-
-
-/* xfonts.c -- glXUseXFont() for Mesa written by
- * Copyright (C) 1995 Thorsten.Ohl @ Physik.TH-Darmstadt.de
- */
-
-#ifdef __VMS
-#include <GL/vms_x_fix.h>
-#endif
-
-#include "glxheader.h"
-#include "context.h"
-#include "imports.h"
-#include "xfonts.h"
-
-
-/* Some debugging info. */
-
-#ifdef DEBUG
-#undef _R
-#undef _G
-#undef _B
-#include <ctype.h>
-
-int debug_xfonts = 0;
-
-static void
-dump_char_struct(XCharStruct * ch, char *prefix)
-{
- printf("%slbearing = %d, rbearing = %d, width = %d\n",
- prefix, ch->lbearing, ch->rbearing, ch->width);
- printf("%sascent = %d, descent = %d, attributes = %u\n",
- prefix, ch->ascent, ch->descent, (unsigned int) ch->attributes);
-}
-
-static void
-dump_font_struct(XFontStruct * font)
-{
- printf("ascent = %d, descent = %d\n", font->ascent, font->descent);
- printf("char_or_byte2 = (%u,%u)\n",
- font->min_char_or_byte2, font->max_char_or_byte2);
- printf("byte1 = (%u,%u)\n", font->min_byte1, font->max_byte1);
- printf("all_chars_exist = %s\n", font->all_chars_exist ? "True" : "False");
- printf("default_char = %c (\\%03o)\n",
- (char) (isprint(font->default_char) ? font->default_char : ' '),
- font->default_char);
- dump_char_struct(&font->min_bounds, "min> ");
- dump_char_struct(&font->max_bounds, "max> ");
-#if 0
- for (c = font->min_char_or_byte2; c <= font->max_char_or_byte2; c++) {
- char prefix[8];
- sprintf(prefix, "%d> ", c);
- dump_char_struct(&font->per_char[c], prefix);
- }
-#endif
-}
-
-static void
-dump_bitmap(unsigned int width, unsigned int height, GLubyte * bitmap)
-{
- unsigned int x, y;
-
- printf(" ");
- for (x = 0; x < 8 * width; x++)
- printf("%o", 7 - (x % 8));
- putchar('\n');
- for (y = 0; y < height; y++) {
- printf("%3o:", y);
- for (x = 0; x < 8 * width; x++)
- putchar((bitmap[width * (height - y - 1) + x / 8] & (1 << (7 - (x %
- 8))))
- ? '*' : '.');
- printf(" ");
- for (x = 0; x < width; x++)
- printf("0x%02x, ", bitmap[width * (height - y - 1) + x]);
- putchar('\n');
- }
-}
-#endif /* DEBUG */
-
-
-/* Implementation. */
-
-/* Fill a BITMAP with a character C from thew current font
- in the graphics context GC. WIDTH is the width in bytes
- and HEIGHT is the height in bits.
-
- Note that the generated bitmaps must be used with
-
- glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
- glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
-
- Possible optimizations:
-
- * use only one reusable pixmap with the maximum dimensions.
- * draw the entire font into a single pixmap (careful with
- proportional fonts!).
-*/
-
-
-/*
- * Generate OpenGL-compatible bitmap.
- */
-static void
-fill_bitmap(Display * dpy, Window win, GC gc,
- unsigned int width, unsigned int height,
- int x0, int y0, unsigned int c, GLubyte * bitmap)
-{
- XImage *image;
- unsigned int x, y;
- Pixmap pixmap;
- XChar2b char2b;
-
- pixmap = XCreatePixmap(dpy, win, 8 * width, height, 1);
- XSetForeground(dpy, gc, 0);
- XFillRectangle(dpy, pixmap, gc, 0, 0, 8 * width, height);
- XSetForeground(dpy, gc, 1);
-
- char2b.byte1 = (c >> 8) & 0xff;
- char2b.byte2 = (c & 0xff);
-
- XDrawString16(dpy, pixmap, gc, x0, y0, &char2b, 1);
-
- image = XGetImage(dpy, pixmap, 0, 0, 8 * width, height, 1, XYPixmap);
- if (image) {
- /* Fill the bitmap (X11 and OpenGL are upside down wrt each other). */
- for (y = 0; y < height; y++)
- for (x = 0; x < 8 * width; x++)
- if (XGetPixel(image, x, y))
- bitmap[width * (height - y - 1) + x / 8] |=
- (1 << (7 - (x % 8)));
- XDestroyImage(image);
- }
-
- XFreePixmap(dpy, pixmap);
-}
-
-/*
- * determine if a given glyph is valid and return the
- * corresponding XCharStruct.
- */
-static XCharStruct *
-isvalid(XFontStruct * fs, unsigned int which)
-{
- unsigned int rows, pages;
- unsigned int byte1 = 0, byte2 = 0;
- int i, valid = 1;
-
- rows = fs->max_byte1 - fs->min_byte1 + 1;
- pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
-
- if (rows == 1) {
- /* "linear" fonts */
- if ((fs->min_char_or_byte2 > which) || (fs->max_char_or_byte2 < which))
- valid = 0;
- }
- else {
- /* "matrix" fonts */
- byte2 = which & 0xff;
- byte1 = which >> 8;
- if ((fs->min_char_or_byte2 > byte2) ||
- (fs->max_char_or_byte2 < byte2) ||
- (fs->min_byte1 > byte1) || (fs->max_byte1 < byte1))
- valid = 0;
- }
-
- if (valid) {
- if (fs->per_char) {
- if (rows == 1) {
- /* "linear" fonts */
- return (fs->per_char + (which - fs->min_char_or_byte2));
- }
- else {
- /* "matrix" fonts */
- i = ((byte1 - fs->min_byte1) * pages) +
- (byte2 - fs->min_char_or_byte2);
- return (fs->per_char + i);
- }
- }
- else {
- return (&fs->min_bounds);
- }
- }
- return (NULL);
-}
-
-
-void
-Fake_glXUseXFont(Font font, int first, int count, int listbase)
-{
- Display *dpy;
- Window win;
- Pixmap pixmap;
- GC gc;
- XGCValues values;
- unsigned long valuemask;
- XFontStruct *fs;
- GLint swapbytes, lsbfirst, rowlength;
- GLint skiprows, skippixels, alignment;
- unsigned int max_width, max_height, max_bm_width, max_bm_height;
- GLubyte *bm;
- int i;
-
- dpy = glXGetCurrentDisplay();
- if (!dpy)
- return; /* I guess glXMakeCurrent wasn't called */
- win = RootWindow(dpy, DefaultScreen(dpy));
-
- fs = XQueryFont(dpy, font);
- if (!fs) {
- _mesa_error(NULL, GL_INVALID_VALUE,
- "Couldn't get font structure information");
- return;
- }
-
- /* Allocate a bitmap that can fit all characters. */
- max_width = fs->max_bounds.rbearing - fs->min_bounds.lbearing;
- max_height = fs->max_bounds.ascent + fs->max_bounds.descent;
- max_bm_width = (max_width + 7) / 8;
- max_bm_height = max_height;
-
- bm = (GLubyte *) MALLOC((max_bm_width * max_bm_height) * sizeof(GLubyte));
- if (!bm) {
- XFreeFontInfo(NULL, fs, 1);
- _mesa_error(NULL, GL_OUT_OF_MEMORY,
- "Couldn't allocate bitmap in glXUseXFont()");
- return;
- }
-
-#if 0
- /* get the page info */
- pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
- firstchar = (fs->min_byte1 << 8) + fs->min_char_or_byte2;
- lastchar = (fs->max_byte1 << 8) + fs->max_char_or_byte2;
- rows = fs->max_byte1 - fs->min_byte1 + 1;
- unsigned int first_char, last_char, pages, rows;
-#endif
-
- /* Save the current packing mode for bitmaps. */
- glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
- glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
- glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
- glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
- glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
- glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
-
- /* Enforce a standard packing mode which is compatible with
- fill_bitmap() from above. This is actually the default mode,
- except for the (non)alignment. */
- glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
- glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- pixmap = XCreatePixmap(dpy, win, 10, 10, 1);
- values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
- values.background = WhitePixel(dpy, DefaultScreen(dpy));
- values.font = fs->fid;
- valuemask = GCForeground | GCBackground | GCFont;
- gc = XCreateGC(dpy, pixmap, valuemask, &values);
- XFreePixmap(dpy, pixmap);
-
-#ifdef DEBUG
- if (debug_xfonts)
- dump_font_struct(fs);
-#endif
-
- for (i = 0; i < count; i++) {
- unsigned int width, height, bm_width, bm_height;
- GLfloat x0, y0, dx, dy;
- XCharStruct *ch;
- int x, y;
- unsigned int c = first + i;
- int list = listbase + i;
- int valid;
-
- /* check on index validity and get the bounds */
- ch = isvalid(fs, c);
- if (!ch) {
- ch = &fs->max_bounds;
- valid = 0;
- }
- else {
- valid = 1;
- }
-
-#ifdef DEBUG
- if (debug_xfonts) {
- char s[7];
- sprintf(s, isprint(c) ? "%c> " : "\\%03o> ", c);
- dump_char_struct(ch, s);
- }
-#endif
-
- /* glBitmap()' parameters:
- straight from the glXUseXFont(3) manpage. */
- width = ch->rbearing - ch->lbearing;
- height = ch->ascent + ch->descent;
- x0 = -ch->lbearing;
- y0 = ch->descent - 0; /* XXX used to subtract 1 here */
- /* but that caused a conformace failure */
- dx = ch->width;
- dy = 0;
-
- /* X11's starting point. */
- x = -ch->lbearing;
- y = ch->ascent;
-
- /* Round the width to a multiple of eight. We will use this also
- for the pixmap for capturing the X11 font. This is slightly
- inefficient, but it makes the OpenGL part real easy. */
- bm_width = (width + 7) / 8;
- bm_height = height;
-
- glNewList(list, GL_COMPILE);
- if (valid && (bm_width > 0) && (bm_height > 0)) {
-
- 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);
-#ifdef DEBUG
- if (debug_xfonts) {
- printf("width/height = %u/%u\n", width, height);
- printf("bm_width/bm_height = %u/%u\n", bm_width, bm_height);
- dump_bitmap(bm_width, bm_height, bm);
- }
-#endif
- }
- else {
- glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL);
- }
- glEndList();
- }
-
- FREE(bm);
- XFreeFontInfo(NULL, fs, 1);
- XFreeGC(dpy, gc);
-
- /* Restore saved packing modes. */
- glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
- glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
- glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
-}
diff --git a/nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.h b/nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.h
deleted file mode 100644
index e36f42f81..000000000
--- a/nx-X11/extras/Mesa/src/mesa/drivers/x11/xfonts.h
+++ /dev/null
@@ -1,41 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * 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.
- */
-
-
-#ifndef XFONTS_H
-#define XFONTS_H
-
-#ifdef __VMS
-#include <GL/vms_x_fix.h>
-#endif
-
-#include <X11/Xlib.h>
-
-
-extern void Fake_glXUseXFont( Font font, int first, int count, int listbase );
-
-
-#endif
-